[pypy-svn] r23190 - in pypy/dist/pypy: doc/discussion jit jit/test rpython rpython/test

pedronis at codespeak.net pedronis at codespeak.net
Fri Feb 10 01:28:46 CET 2006


Author: pedronis
Date: Fri Feb 10 01:28:43 2006
New Revision: 23190

Modified:
   pypy/dist/pypy/doc/discussion/draft-jit-ideas.txt
   pypy/dist/pypy/jit/hintrtyper.py
   pypy/dist/pypy/jit/llabstractinterp.py
   pypy/dist/pypy/jit/rtimeshift.py
   pypy/dist/pypy/jit/test/test_hint_timeshift.py
   pypy/dist/pypy/rpython/rgenop.py
   pypy/dist/pypy/rpython/test/test_rgenop.py
   pypy/dist/pypy/rpython/test/test_rlist.py
Log:
remove the required block argument for genconst, the api is very much distant from the final form and
at the moment the requirement is an hindrance to progress on other fronts.



Modified: pypy/dist/pypy/doc/discussion/draft-jit-ideas.txt
==============================================================================
--- pypy/dist/pypy/doc/discussion/draft-jit-ideas.txt	(original)
+++ pypy/dist/pypy/doc/discussion/draft-jit-ideas.txt	Fri Feb 10 01:28:43 2006
@@ -98,7 +98,13 @@
 
 * genop(block, opname, [list-of-vars], RESULT_CONCRETE_TYPE) -> (result var)
 
-* genconst(block, llvalue) -> (result var)
+* genconst(llvalue) -> (result var) # not for Void consts
+
+* constFieldName(name) # Void constant for a name, likely not runtime
+
+* constTYPE(LLTYPE)    # Void constant for a lltype, likely not runtime
+
+* placeholder(dummy)   # likely ignored Void constant, likely not runtime
 
 * gencallableconst(block, name, target-block, FUNCTYPE) -> (result var)
 

Modified: pypy/dist/pypy/jit/hintrtyper.py
==============================================================================
--- pypy/dist/pypy/jit/hintrtyper.py	(original)
+++ pypy/dist/pypy/jit/hintrtyper.py	Fri Feb 10 01:28:43 2006
@@ -120,8 +120,9 @@
 
     def convert_const(self, ll_value):
         assert lltype.typeOf(ll_value) == lltype.Signed # XXX other ll types!
-        # XXX can this really be a static constant  and reused ???
+        # this should be immutable!
         box = lltype.malloc(rtimeshift.SIGNED_REDBOX)
+        box.basebox.genvar = rgenop.genconst(ll_value)
         box.value = ll_value
         box = lltype.cast_pointer(rtimeshift.REDBOX_PTR,  box)
         return box

Modified: pypy/dist/pypy/jit/llabstractinterp.py
==============================================================================
--- pypy/dist/pypy/jit/llabstractinterp.py	(original)
+++ pypy/dist/pypy/jit/llabstractinterp.py	Fri Feb 10 01:28:43 2006
@@ -539,7 +539,7 @@
         return rgenop.genop(self.newblock, opname, args, RESULT_TYPE)
 
     def genconst(self, llvalue):
-        return rgenop.genconst(self.newblock, llvalue)
+        return rgenop.genconst(llvalue)
     
     def binding(self, v):
         assert isinstance(v, (Constant, Variable))

Modified: pypy/dist/pypy/jit/rtimeshift.py
==============================================================================
--- pypy/dist/pypy/jit/rtimeshift.py	(original)
+++ pypy/dist/pypy/jit/rtimeshift.py	Fri Feb 10 01:28:43 2006
@@ -23,7 +23,7 @@
     return box.genvar
 
 def ll_gvar_from_const(jitstate, value):
-    return rgenop.genconst(jitstate.curblock, value)
+    return rgenop.genconst(value)
 
 def ll_generate_operation(jitstate, opname, args, RESULTTYPE):
     gvar = rgenop.genop(jitstate.curblock, opname, args, RESULTTYPE)

Modified: pypy/dist/pypy/jit/test/test_hint_timeshift.py
==============================================================================
--- pypy/dist/pypy/jit/test/test_hint_timeshift.py	(original)
+++ pypy/dist/pypy/jit/test/test_hint_timeshift.py	Fri Feb 10 01:28:43 2006
@@ -68,7 +68,7 @@
     # now try to run the block produced by the jitstate
     r = htshift.hrtyper.bindingrepr(graph1.getreturnvar())
     if isinstance(r, hintrtyper.GreenRepr):
-        result_gvar = rgenop.genconst(jitstate.curblock, result1)
+        result_gvar = rgenop.genconst(result1)
     elif isinstance(r, hintrtyper.RedRepr):
         result_gvar = result1.genvar
     else:

Modified: pypy/dist/pypy/rpython/rgenop.py
==============================================================================
--- pypy/dist/pypy/rpython/rgenop.py	(original)
+++ pypy/dist/pypy/rpython/rgenop.py	Fri Feb 10 01:28:43 2006
@@ -57,9 +57,9 @@
     target = from_opaque_object(targetcontainer.obj)
     fptr = lltype.functionptr(FUNCTYPE, name,
                               graph=_buildgraph(target))
-    return genconst(blockcontainer, fptr)
+    return genconst(fptr)
 
-def genconst(blockcontainer, llvalue):
+def genconst(llvalue):
     v = flowmodel.Constant(llvalue)
     v.concretetype = lltype.typeOf(llvalue)
     if v.concretetype == lltype.Void: # XXX genconst should not really be used for Void constants
@@ -163,7 +163,7 @@
         self.type_system = LowLevelTypeSystem.instance
 
 def _buildgraph(block):
-    graph = flowmodel.FunctionGraph('?', block)
+    graph = flowmodel.FunctionGraph('generated', block)
     _patchgraph(graph)
     flowmodel.checkgraph(graph)
     eliminate_empty_blocks(graph)

Modified: pypy/dist/pypy/rpython/test/test_rgenop.py
==============================================================================
--- pypy/dist/pypy/rpython/test/test_rgenop.py	(original)
+++ pypy/dist/pypy/rpython/test/test_rgenop.py	Fri Feb 10 01:28:43 2006
@@ -50,7 +50,7 @@
     """
     block = newblock()
     v0 = geninputarg(block, Signed)
-    const0 = genconst(block, 0)
+    const0 = genconst(0)
     v1 = genop(block, 'int_lt', [v0, const0], Bool)
     exitspair = closeblock2(block, v1)
     false_link, true_link = exitspair.item0, exitspair.item1
@@ -84,14 +84,14 @@
     """
     block = newblock()
     v0 = geninputarg(block, Signed)
-    const1 = genconst(block, 1)
+    const1 = genconst(1)
     link = closeblock1(block)
     loopblock = newblock()
     result0 = geninputarg(loopblock, Signed)
     i0 = geninputarg(loopblock, Signed)
     v1 = geninputarg(loopblock, Signed)
     closelink(link, [const1, const1, v0], loopblock)
-    const1 = genconst(block, 1)
+    const1 = genconst(1)
     result1 = genop(loopblock, 'int_mul', [result0, i0], Signed)
     i1 = genop(loopblock, 'int_add', [i0, const1], Signed)
     v2 = genop(loopblock, 'int_le', [i1, v1], Bool)

Modified: pypy/dist/pypy/rpython/test/test_rlist.py
==============================================================================
--- pypy/dist/pypy/rpython/test/test_rlist.py	(original)
+++ pypy/dist/pypy/rpython/test/test_rlist.py	Fri Feb 10 01:28:43 2006
@@ -914,7 +914,7 @@
             return rgenop.genop(self.newblock, opname, args, RESULT_TYPE)
 
         def genconst(self, llvalue):
-            return rgenop.genconst(self.newblock, llvalue)
+            return rgenop.genconst(llvalue)
 
         # inspection
         def __getitem__(self, index):



More information about the Pypy-commit mailing list