[pypy-svn] r25434 - in pypy/dist/pypy: jit/codegen/llvm translator/llvm/pyllvm

ericvrp at codespeak.net ericvrp at codespeak.net
Thu Apr 6 10:08:16 CEST 2006


Author: ericvrp
Date: Thu Apr  6 10:08:16 2006
New Revision: 25434

Modified:
   pypy/dist/pypy/jit/codegen/llvm/rgenop.py
   pypy/dist/pypy/translator/llvm/pyllvm/cc.py
Log:
* ctypes load (instead of LoadLibrary) was correct after all, I was using an
  older ctypes version on the other linux server. (need ctypes >=0.9.9.3)

* small changes to codegen/llvm/rgenop.py to stay in sync with rpython/rgenop.py


Modified: pypy/dist/pypy/jit/codegen/llvm/rgenop.py
==============================================================================
--- pypy/dist/pypy/jit/codegen/llvm/rgenop.py	(original)
+++ pypy/dist/pypy/jit/codegen/llvm/rgenop.py	Thu Apr  6 10:08:16 2006
@@ -10,12 +10,17 @@
 from pypy.rpython.module.support import init_opaque_object
 from pypy.rpython.module.support import to_opaque_object, from_opaque_object
 from pypy.rpython.module.support import from_rstr
+from pypy.rpython import extregistry
 from pypy.jit.codegen.llvm.jitcode import JITcode
 
 
 # for debugging, sanity checks in non-RPython code
 reveal = from_opaque_object
 
+def isptrtype(gv_type):
+    c = from_opaque_object(gv_type)
+    return isinstance(c.value, lltype.Ptr)
+
 def initblock(opaqueptr):
     init_opaque_object(opaqueptr, flowmodel.Block([]))
 
@@ -26,6 +31,8 @@
 
 def geninputarg(blockcontainer, gv_CONCRETE_TYPE):
     block = from_opaque_object(blockcontainer.obj)
+    assert not block.operations, "block already contains operations"
+    assert block.exits == [], "block already closed"
     CONCRETE_TYPE = from_opaque_object(gv_CONCRETE_TYPE).value
     v = flowmodel.Variable()
     v.concretetype = CONCRETE_TYPE
@@ -50,6 +57,7 @@
     if not isinstance(opname, str):
         opname = from_rstr(opname)
     block = from_opaque_object(blockcontainer.obj)
+    assert block.exits == [], "block already closed"
     RESULT_TYPE = from_opaque_object(gv_RESULT_TYPE).value
     opvars = _inputvars(vars)    
     v = flowmodel.Variable()
@@ -82,7 +90,11 @@
         return llmemory.cast_ptr_to_adr(c.value)
     else:
         return lltype.cast_primitive(T, c.value)
-                                    
+
+def isconst(gv_value):
+    c = from_opaque_object(gv_value)
+    return isinstance(c, flowmodel.Constant)
+
 # XXX
 # temporary interface; it's unclera if genop itself should change to ease dinstinguishing
 # Void special args from the rest. Or there should be variation for the ops involving them
@@ -196,8 +208,6 @@
     from pypy.rpython.llinterp import LLInterpreter
     if viewbefore:
         gengraph.show()
-    #llinterp = LLInterpreter(PseudoRTyper())
-    #return llinterp.eval_graph(gengraph, args)
     jitcode = JITcode(PseudoRTyper())
     return jitcode.eval_graph(gengraph, args)
     
@@ -226,6 +236,25 @@
 fields = tuple(zip(fieldnames, lltypes))    
 LINKPAIR = lltype.GcStruct('tuple2', *fields)
 
+# support constants and types
+
+nullvar = lltype.nullptr(CONSTORVAR.TO)
+gv_Void = constTYPE(lltype.Void)
+
+# VARLIST
+def ll_fixed_items(l):
+    return l
+
+def ll_fixed_length(l):
+    return len(l)
+
+VARLIST = lltype.Ptr(lltype.GcArray(CONSTORVAR,
+                                    adtmeths = {
+                                        "ll_items": ll_fixed_items,
+                                        "ll_length": ll_fixed_length
+                                    }))
+
+
 # helpers
 def setannotation(func, annotation, specialize_as_constant=False):
     if specialize_as_constant:

Modified: pypy/dist/pypy/translator/llvm/pyllvm/cc.py
==============================================================================
--- pypy/dist/pypy/translator/llvm/pyllvm/cc.py	(original)
+++ pypy/dist/pypy/translator/llvm/pyllvm/cc.py	Thu Apr  6 10:08:16 2006
@@ -8,7 +8,7 @@
         d = __file__[:__file__.find("pyllvm")] + "llvmcapi/"
         #XXX does this load once or every time?
         try:
-            self.library  = cdll.LoadLibrary(d + libname + ".so")
+            self.library  = cdll.load(d + libname + ".so")
         except:
             raise Exception("llvmcapi not found: run 'python setup.py build_ext -i' in " + d)
         self.restype  = restype



More information about the Pypy-commit mailing list