David Schneider avatar David Schneider committed cce43ec

(bivab, arigo) Add test for an operation that does not correctly emit the code for the guard, i.e. emitting two guards for the same operation

Comments (0)

Files changed (1)


                          'float', descr=calldescr)
             assert res.getfloat() == expected
+    def test_some_issue(self):
+        t_box, T_box = self.alloc_instance(self.T)
+        null_box = self.null_instance()
+        faildescr = BasicFailDescr(42)
+        operations = [
+            ResOperation(rop.GUARD_NONNULL_CLASS, [t_box, T_box], None,
+                                                        descr=faildescr),
+            ResOperation(rop.FINISH, [], None, descr=BasicFailDescr(1))]
+        operations[0].setfailargs([])
+        looptoken = JitCellToken()
+        inputargs = [t_box]
+        self.cpu.compile_loop(inputargs, operations, looptoken)
+        operations = [
+            ResOperation(rop.FINISH, [], None, descr=BasicFailDescr(99))
+        ]
+        self.cpu.compile_bridge(faildescr, [], operations, looptoken)
+        fail = self.cpu.execute_token(looptoken, null_box.getref_base())
+        assert fail.identifier == 99
     def test_compile_loop_with_target(self):
         i0 = BoxInt()
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.