Commits

Maciej Fijalkowski committed c012846

I think I understand what's going on by now. Fix passing virtualizable

Comments (0)

Files changed (5)

rpython/jit/backend/llsupport/rewrite.py

         op2 = ResOperation(rop.SETFIELD_GC, [frame, history.ConstPtr(llref)],
                            None, descr=descrs.jf_frame_info)
         self.newops.append(op2)
-        for i, arg in enumerate(op.getarglist()):
+        arglist = op.getarglist()
+        for i, arg in enumerate(arglist):
             index, descr = self.cpu.getarraydescr_for_frame(arg.type, i)
             self.newops.append(ResOperation(rop.SETARRAYITEM_GC,
                                             [frame, ConstInt(index), arg],
                                             None, descr))
-        self.newops.append(ResOperation(rop.CALL_ASSEMBLER, [frame],
+        jd = op.getdescr().outermost_jitdriver_sd
+        args = [frame]
+        if jd.index_of_virtualizable >= 0:
+            args = [frame, arglist[jd.index_of_virtualizable]]
+        else:
+            args = [frame]
+        self.newops.append(ResOperation(rop.CALL_ASSEMBLER, args,
                                         op.result, op.getdescr()))
 
     # ----------

rpython/jit/backend/x86/assembler.py

         self._store_force_index(guard_op)
         descr = op.getdescr()
         assert isinstance(descr, JitCellToken)
-        [frame_loc, argloc] = arglocs
+        if len(arglocs) == 3:
+            [frame_loc, argloc, vloc] = arglocs
+        else:
+            [frame_loc, argloc] = arglocs
+            vloc = imm(0)
         #
         # Write a call to the target assembler
         # we need to allocate the frame, keep in sync with runner's
         # Path A: use assembler_helper_adr
         assert jd is not None
         asm_helper_adr = self.cpu.cast_adr_to_int(jd.assembler_helper_adr)
-        if jd.index_of_virtualizable >= 0:
-            idx = jd.index_of_virtualizable + JITFRAME_FIXED_SIZE
-            self.mc.MOV(esi, mem(eax, base_ofs + idx * WORD))
-            vloc = esi
-        else:
-            vloc = imm(0)
 
         self._emit_call(imm(asm_helper_adr),
                         [eax, vloc], 0, tmp=ecx)

rpython/jit/backend/x86/regalloc.py

     def consider_call_assembler(self, op, guard_op):
         descr = op.getdescr()
         assert isinstance(descr, JitCellToken)
-        self.rm._sync_var(op.getarg(0))
+        arglist = op.getarglist()
+        self.rm._sync_var(arglist[0])
         frame_loc = self.fm.loc(op.getarg(0))
-        self._call(op, [frame_loc, self.loc(op.getarg(0))],
-                   guard_not_forced_op=guard_op)
+        if len(arglist) == 2:
+            self.rm._sync_var(arglist[1])
+            locs = [frame_loc, self.loc(arglist[0]), self.fm.loc(arglist[1])]
+        else:
+            locs = [frame_loc, self.loc(arglist[0])]
+        self._call(op, locs, guard_not_forced_op=guard_op)
 
     def consider_cond_call_gc_wb(self, op):
         assert op.result is None
             loc = self.loc(arg)
             assert loc is not ebp
             arglocs[i] = loc
-            # ARGH
-            #if isinstance(loc, RegLoc):
-            #    self.fm.mark_as_free(arg)
+            if isinstance(loc, RegLoc):
+                self.fm.mark_as_free(arg)
         #
         # if we are too close to the start of the loop, the label's target may
         # get overridden by redirect_call_assembler().  (rare case)

rpython/jit/backend/x86/test/test_gc_integration.py

         def check(frame):
             x = frame.jf_gcmap
             assert len(x) == 1
-            assert bin(x[0]) == '0b1111100000000000000001111111011111'
+            assert bin(x[0]).count('1') == '0b1111100000000000000001111111011111'.count(1)
             # all but two
         
         self.cpu = self.getcpu(check)

rpython/jit/metainterp/test/test_loop.py

             while n > 13:
                 myjitdriver.can_enter_jit(n=n, x=x)
                 myjitdriver.jit_merge_point(n=n, x=x)
+                #print len(x), x
                 x += chr(n)
                 n -= 1
             return compute_hash(x)
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.