[pypy-svn] r61481 - in pypy/branch/oo-jit/pypy/rpython: . lltypesystem

fijal at codespeak.net fijal at codespeak.net
Sat Jan 31 12:33:47 CET 2009


Author: fijal
Date: Sat Jan 31 12:33:47 2009
New Revision: 61481

Modified:
   pypy/branch/oo-jit/pypy/rpython/annlowlevel.py
   pypy/branch/oo-jit/pypy/rpython/lltypesystem/lloperation.py
Log:
port llstr from trunk


Modified: pypy/branch/oo-jit/pypy/rpython/annlowlevel.py
==============================================================================
--- pypy/branch/oo-jit/pypy/rpython/annlowlevel.py	(original)
+++ pypy/branch/oo-jit/pypy/rpython/annlowlevel.py	Sat Jan 31 12:33:47 2009
@@ -463,6 +463,28 @@
         return hop.genop('same_as', [v_ll_str],
                          resulttype = hop.r_result.lowleveltype)
 
+def llstr(s):
+    from pypy.rpython.lltypesystem.rstr import mallocstr
+    # XXX not sure what to do with ootypesystem
+    ll_s = mallocstr(len(s))
+    for i, c in enumerate(s):
+        ll_s.chars[i] = c
+    return ll_s
+
+class LLStrEntry(extregistry.ExtRegistryEntry):
+    _about_ = llstr
+
+    def compute_result_annotation(self, s_str):
+        from pypy.rpython.lltypesystem.rstr import STR
+        return annmodel.lltype_to_annotation(lltype.Ptr(STR))
+
+    def specialize_call(self, hop):
+        hop.exception_cannot_occur()
+        assert hop.args_r[0].lowleveltype == hop.r_result.lowleveltype
+        v_ll_str, = hop.inputargs(*hop.args_r)
+        return hop.genop('same_as', [v_ll_str],
+                         resulttype = hop.r_result.lowleveltype)        
+
 # ____________________________________________________________
 
 def cast_object_to_ptr(PTR, object):

Modified: pypy/branch/oo-jit/pypy/rpython/lltypesystem/lloperation.py
==============================================================================
--- pypy/branch/oo-jit/pypy/rpython/lltypesystem/lloperation.py	(original)
+++ pypy/branch/oo-jit/pypy/rpython/lltypesystem/lloperation.py	Sat Jan 31 12:33:47 2009
@@ -381,6 +381,7 @@
     'call_boehm_gc_alloc':  LLOp(canraise=(MemoryError,)),
     'jit_marker':           LLOp(),
     'promote_virtualizable':LLOp(canrun=True),
+    'can_enter_jit':        LLOp(),
 
     # __________ GC operations __________
 



More information about the Pypy-commit mailing list