Commits

David Schneider committed 6ee2777

call_malloc_nursery_varsize_small

Comments (0)

Files changed (3)

rpython/jit/backend/arm/assembler.py

         else:
             raise AssertionError('Trying to pop to an invalid location')
 
-    def malloc_cond(self, nursery_free_adr, nursery_top_adr, size, gcmap):
-        assert size & (WORD-1) == 0     # must be correctly aligned
+    def malloc_cond(self, nursery_free_adr, nursery_top_adr, sizeloc, gcmap):
+        if sizeloc.is_imm():     # must be correctly aligned
+            assert sizeloc.value & (WORD-1) == 0
 
         self.mc.gen_load_int(r.r0.value, nursery_free_adr)
         self.mc.LDR_ri(r.r0.value, r.r0.value)
 
-        if check_imm_arg(size):
-            self.mc.ADD_ri(r.r1.value, r.r0.value, size)
+        if sizeloc.is_imm():
+            if check_imm_arg(sizeloc.value):
+                self.mc.ADD_ri(r.r1.value, r.r0.value, sizeloc.value)
+            else:
+                self.mc.gen_load_int(r.r1.value, sizeloc.value)
+                self.mc.ADD_rr(r.r1.value, r.r0.value, r.r1.value)
         else:
-            self.mc.gen_load_int(r.r1.value, size)
-            self.mc.ADD_rr(r.r1.value, r.r0.value, r.r1.value)
+            self.mc.ADD_rr(r.r1.value, r.r0.value, sizeloc.value)
 
         self.mc.gen_load_int(r.ip.value, nursery_top_adr)
         self.mc.LDR_ri(r.ip.value, r.ip.value)

rpython/jit/backend/arm/opassembler.py

     def emit_op_call_malloc_nursery(self, op, arglocs, regalloc, fcond):
         # registers r0 and r1 are allocated for this call
         assert len(arglocs) == 1
-        size = arglocs[0].value
+        sizeloc = arglocs[0]
         gc_ll_descr = self.cpu.gc_ll_descr
         gcmap = regalloc.get_gcmap([r.r0, r.r1])
         self.malloc_cond(
             gc_ll_descr.get_nursery_free_addr(),
             gc_ll_descr.get_nursery_top_addr(),
-            size,
+            sizeloc,
             gcmap
             )
         self._alignment_check()
         return fcond
+    emit_op_call_malloc_nursery_varsize_small = emit_op_call_malloc_nursery
+
 
     def _alignment_check(self):
         if not self.debug:

rpython/jit/backend/arm/regalloc.py

         self.rm.force_allocate_reg(op.result, selected_reg=r.r0)
         t = TempInt()
         self.rm.force_allocate_reg(t, selected_reg=r.r1)
-        self.possibly_free_var(op.result)
         self.possibly_free_var(t)
         return [imm(size)]
 
         self.rm.force_allocate_reg(op.result, selected_reg=r.r0)
         t = TempInt()
         self.rm.force_allocate_reg(t, selected_reg=r.r1)
-        self.possibly_free_var(op.result)
+        argloc = self.make_sure_var_in_reg(size_box,
+                                            forbidden_vars=[op.result, t])
         self.possibly_free_var(t)
-        return [imm(size)]
+        return [argloc]
 
     prepare_op_debug_merge_point = void
     prepare_op_jit_debug = void
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.