Commits

Armin Rigo  committed a79b417

Fix copystrcontent on stm

  • Participants
  • Parent commits 907b74d
  • Branches stmgc-c7

Comments (0)

Files changed (4)

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

         return val not in self.write_barrier_applied
 
 
-    def handle_copystrcontent(self, op):
-        xxxxxxxx
-        # first, a write barrier on the target string
-        lst = op.getarglist()
-        lst[1] = self.gen_barrier(lst[1], 'W')
-        op = op.copy_and_change(op.getopnum(), args=lst)
-        # then an immutable read barrier the source string
-        # XXX: 'I' enough?
-        self.handle_category_operations(op, 'R')
-
     @specialize.arg(1)
     def _do_stm_call(self, funcname, args, result):
         addr = self.gc_ll_descr.get_malloc_fn_addr(funcname)

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

         self.mc.LEA(result, addr_add(self.SEGMENT_NO, frm, sizereg,
                                      baseofs, scale))
 
+    def convert_addresses_to_linear(self, reg1, reg2):
+        if not self.cpu.gc_ll_descr.stm:   # stm-only
+            return
+        if not IS_X86_64:
+            todo()   # "needed for X86_64_SCRATCH_REG"
+        sb_adr = rstm.adr_segment_base
+        assert rx86.fits_in_32bits(sb_adr)    # because it is in the 2nd page
+        self.mc.MOV_rj(X86_64_SCRATCH_REG.value, (self.SEGMENT_GC, sb_adr))
+        self.mc.ADD(reg1, X86_64_SCRATCH_REG)
+        self.mc.ADD(reg2, X86_64_SCRATCH_REG)
+
     def _unaryop(asmop):
         def genop_unary(self, op, arglocs, resloc):
             getattr(self.mc, asmop)(arglocs[0])

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

         dstaddr_loc = self.rm.force_allocate_reg(dstaddr_box, forbidden_vars)
         self._gen_address_inside_string(base_loc, ofs_loc, dstaddr_loc,
                                         is_unicode=is_unicode)
+        # for stm: convert the addresses from %gs-based to linear
+        self.assembler.convert_addresses_to_linear(srcaddr_loc, dstaddr_loc)
         # compute the length in bytes
         length_box = args[4]
         length_loc = self.loc(length_box)

File rpython/rlib/rstm.py

     CFlexSymbolic('((long)&STM_SEGMENT->transaction_read_version)'))
 adr_jmpbuf_ptr = (
     CFlexSymbolic('((long)&STM_SEGMENT->jmpbuf_ptr)'))
+adr_segment_base = (
+    CFlexSymbolic('((long)&STM_SEGMENT->segment_base)'))
 adr_write_slowpath = CFlexSymbolic('((long)&_stm_write_slowpath)')
 
 adr__pypy_stm_become_inevitable = (