Author: Antonio Cuni <[email protected]>
Branch: improve-str2charp
Changeset: r65270:cd1d693151be
Date: 2013-07-08 18:46 +0200
http://bitbucket.org/pypy/pypy/changeset/cd1d693151be/
Log: 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
diff --git a/rpython/jit/codewriter/effectinfo.py
b/rpython/jit/codewriter/effectinfo.py
--- a/rpython/jit/codewriter/effectinfo.py
+++ b/rpython/jit/codewriter/effectinfo.py
@@ -79,6 +79,9 @@
#
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
diff --git a/rpython/jit/codewriter/jtransform.py
b/rpython/jit/codewriter/jtransform.py
--- a/rpython/jit/codewriter/jtransform.py
+++ b/rpython/jit/codewriter/jtransform.py
@@ -1665,12 +1665,14 @@
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:
diff --git a/rpython/rtyper/lltypesystem/rstr.py
b/rpython/rtyper/lltypesystem/rstr.py
--- a/rpython/rtyper/lltypesystem/rstr.py
+++ b/rpython/rtyper/lltypesystem/rstr.py
@@ -83,6 +83,7 @@
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'
diff --git a/rpython/rtyper/test/test_rstr.py b/rpython/rtyper/test/test_rstr.py
--- a/rpython/rtyper/test/test_rstr.py
+++ b/rpython/rtyper/test/test_rstr.py
@@ -1138,10 +1138,6 @@
self.interpret(f, [array, 4])
assert list(array) == list('abc'*4)
lltype.free(array, flavor='raw')
-
-
-
-
class TestOOtype(BaseTestRstr, OORtypeMixin):
pass
_______________________________________________
pypy-commit mailing list
[email protected]
http://mail.python.org/mailman/listinfo/pypy-commit