Commits

Armin Rigo  committed 327693f Merge

merge heads

  • Participants
  • Parent commits 7dd4f26, af844bf
  • Branches jitframe-on-heap

Comments (0)

Files changed (6)

File rpython/jit/backend/llsupport/llmodel.py

         # the same as normal JITFRAME, however with an array of pointers
         self.refarraydescr = ArrayDescr(ad.basesize, ad.itemsize, ad.lendescr,
                                         FLAG_POINTER)
-        self.floatarraydescr = ArrayDescr(ad.basesize, ad.itemsize, ad.lendescr,
-                                          FLAG_FLOAT)
+        if WORD == 4:
+            self.floatarraydescr = ArrayDescr(ad.basesize, ad.itemsize * 2,
+                                              ad.lendescr, FLAG_FLOAT)
+        else:
+            self.floatarraydescr = ArrayDescr(ad.basesize, ad.itemsize,
+                                              ad.lendescr, FLAG_FLOAT)
         self.setup()
 
     def getarraydescr_for_frame(self, type):

File rpython/jit/backend/llsupport/rewrite.py

                            None, descr=descrs.jf_frame_info)
         self.newops.append(op2)
         arglist = op.getarglist()
-        index = self.cpu.getarryoffset_for_frame()	
+        index = self.cpu.getarryoffset_for_frame()
         for i, arg in enumerate(arglist):
             descr = self.cpu.getarraydescr_for_frame(arg.type)
-            self.newops.append(ResOperation(rop.SETARRAYITEM_GC,
-                                            [frame, ConstInt(index), arg],
-                                            None, descr))
-            if WORD == 4 and type == history.FLOAT:
-                index += 2
+            if WORD == 4 and arg.type == history.FLOAT:
+                self.newops.append(ResOperation(rop.SETARRAYITEM_GC,
+                                                [frame, ConstInt(index // 2),
+                                                 arg],
+                                                None, descr))
+                index += 2 
             else:
+                self.newops.append(ResOperation(rop.SETARRAYITEM_GC,
+                                                [frame, ConstInt(index),
+                                                 arg],
+                                                None, descr))
                 index += 1
         descr = op.getdescr()
         assert isinstance(descr, JitCellToken)

File rpython/jit/backend/x86/assembler.py

             # push first arg
             mc.MOV_rr(edi.value, ebp.value)
             align = align_stack_words(1)
+            mc.SUB_ri(esp.value, (align - 1) * WORD)
         else:
-            mc.PUSH(RawStackLoc(WORD * 2))
-            mc.PUSH_r(ebp.value)
             align = align_stack_words(3)
+            mc.MOV_rs(eax.value, WORD * 2)
+            mc.SUB_ri(esp.value, (align - 1) * WORD)
+            mc.MOV_sr(WORD, eax.value)
+            mc.MOV_sr(0, ebp.value)
         # align
-        mc.SUB_ri(esp.value, (align - 1) * WORD)
 
         mc.CALL(imm(self.cpu.realloc_frame))
         mc.ADD_ri(esp.value, (align - 1) * WORD)
                     stack_depth += 2
                 else:
                     stack_depth += 1
-            stack_depth += loc.get_width()
+            stack_depth += loc.get_width() // WORD
         if stack_depth > PASS_ON_MY_FRAME:
             stack_depth = align_stack_words(stack_depth)
             align = (stack_depth - PASS_ON_MY_FRAME)
         self.mc.CALL(x)
         if can_collect:
             self._reload_frame_if_necessary(self.mc)
-        if align:
-            self.mc.ADD_ri(esp.value, align * WORD)
         if can_collect:
             self.pop_gcmap(self.mc)
         #
         if callconv != FFI_DEFAULT_ABI:
-            self._fix_stdcall(callconv, p)
+            self._fix_stdcall(callconv, p - align * WORD)
+        elif align:
+            self.mc.ADD_ri(esp.value, align * WORD)
 
     def _fix_stdcall(self, callconv, p):
         from rpython.rlib.clibffi import FFI_STDCALL
-        xxx
         assert callconv == FFI_STDCALL
         # it's a bit stupid, but we're just going to cancel the fact that
         # the called function just added 'p' to ESP, by subtracting it again.

File rpython/jit/backend/x86/regalloc.py

 
     def prepare_loop(self, inputargs, operations, looptoken, allgcrefs):
         operations = self._prepare(inputargs, operations, allgcrefs)
-        self._set_initial_bindings(inputargs)
+        self._set_initial_bindings(inputargs, looptoken)
         # note: we need to make a copy of inputargs because possibly_free_vars
         # is also used on op args, which is a non-resizable list
         self.possibly_free_vars(list(inputargs))
     def get_final_frame_depth(self):
         return self.fm.get_frame_depth()
 
-    def _set_initial_bindings(self, inputargs):
+    def _set_initial_bindings(self, inputargs, looptoken):
+        locs = []
         for box in inputargs:
             assert isinstance(box, Box)
-            self.fm.get_new_loc(box)
+            loc = self.fm.get_new_loc(box)
+            locs.append(loc.value)
+        looptoken.compiled_loop_token._x86_initial_locs = locs
 
     def possibly_free_var(self, var):
         if var.type == FLOAT:

File rpython/jit/backend/x86/runner.py

             return 1000
 
     def getarryoffset_for_frame(self):
-	return JITFRAME_FIXED_SIZE
+        return JITFRAME_FIXED_SIZE
 
     def setup(self):
         self.assembler = Assembler386(self, self.translate_support_code)
             #llop.debug_print(lltype.Void, ">>>> Entering", addr)
             frame_info = clt.frame_info
             frame = self.gc_ll_descr.malloc_jitframe(frame_info)
+            base_ofs = self.get_baseofs_of_frame_field()
             ll_frame = lltype.cast_opaque_ptr(llmemory.GCREF, frame)
+            locs = executable_token.compiled_loop_token._x86_initial_locs
             prev_interpreter = None   # help flow space
             if not self.translate_support_code:
                 prev_interpreter = LLInterpreter.current_interpreter
                 LLInterpreter.current_interpreter = self.debug_ll_interpreter
             try:
-                num = JITFRAME_FIXED_SIZE * WORD
                 for i, kind in kinds:
                     arg = args[i]
+                    num = locs[i] - base_ofs
                     if kind == history.INT:
                         self.set_int_value(ll_frame, num, arg)
                     elif kind == history.FLOAT:
                         self.set_float_value(ll_frame, num, arg)
-                        if IS_X86_32:
-                            num += WORD
                     else:
                         assert kind == history.REF
                         self.set_ref_value(ll_frame, num, arg)
-                    num += WORD
                 ll_frame = func(ll_frame)
             finally:
                 if not self.translate_support_code:

File rpython/jit/backend/x86/test/test_runner.py

     # ====> ../../test/runner_test.py
 
     add_loop_instructions = ['mov', 'add', 'test', 'je', 'jmp']
-    bridge_loop_instructions = ['cmp', 'jge', 'mov', 'mov', 'mov', 'mov',
-                                'call', 'mov', 'jmp']
+    if WORD == 4:
+        bridge_loop_instructions = ['cmp', 'jge', 'mov', 'mov', 'call', 'jmp']
+    else:
+        bridge_loop_instructions = ['cmp', 'jge', 'mov', 'mov', 'mov', 'mov',
+                                    'call', 'mov', 'jmp']
 
     def get_cpu(self):
         cpu = CPU(rtyper=None, stats=FakeStats())
             ResOperation(rop.GUARD_FALSE, [i3], None,
                          descr=BasicFailDescr(0)),
             ResOperation(rop.FINISH, [], None,
-                         descr=BasicFailDescr(1))
+                         descr=BasicFinalDescr(1))
             ]
             ops[-2].setfailargs([i3, i4, i5, i6])
             ops[1].setfailargs([])