Commits

Antonio Cuni  committed cd1d693

wrap copy_string_to_raw inside a oopspec, because the JIT complains if it sees a cast_ptr_to_adr on a GC-managed object

  • Participants
  • Parent commits 4d172e0
  • Branches improve-str2charp

Comments (0)

Files changed (4)

File rpython/jit/codewriter/effectinfo.py

     #
     OS_RAW_MALLOC_VARSIZE_CHAR  = 110
     OS_RAW_FREE                 = 111
+    #
+    OS_STR_COPY_TO_RAW          = 112
+    OS_UNI_COPY_TO_RAW          = 113
 
     OS_JIT_FORCE_VIRTUAL        = 120
 

File rpython/jit/codewriter/jtransform.py

             dict = {"stroruni.concat": EffectInfo.OS_STR_CONCAT,
                     "stroruni.slice":  EffectInfo.OS_STR_SLICE,
                     "stroruni.equal":  EffectInfo.OS_STR_EQUAL,
+                    "stroruni.copy_string_to_raw": EffectInfo.OS_STR_COPY_TO_RAW,
                     }
             CHR = lltype.Char
         elif SoU.TO == rstr.UNICODE:
             dict = {"stroruni.concat": EffectInfo.OS_UNI_CONCAT,
                     "stroruni.slice":  EffectInfo.OS_UNI_SLICE,
                     "stroruni.equal":  EffectInfo.OS_UNI_EQUAL,
+                    "stroruni.copy_string_to_raw": EffectInfo.OS_UNI_COPY_TO_RAW
                     }
             CHR = lltype.UniChar
         else:

File rpython/rtyper/lltypesystem/rstr.py

     copy_string_contents = func_with_new_name(copy_string_contents,
                                               'copy_%s_contents' % name)
 
+    @jit.oopspec('stroruni.copy_string_to_raw(src, ptrdst, srcstart, length)')
     def copy_string_to_raw(src, ptrdst, srcstart, length):
         """
         Copies 'length' characters from the 'src' string to the 'ptrdst'

File rpython/rtyper/test/test_rstr.py

         self.interpret(f, [array, 4])
         assert list(array) == list('abc'*4)
         lltype.free(array, flavor='raw')
-        
-
-
-        
 
 class TestOOtype(BaseTestRstr, OORtypeMixin):
     pass