[pypy-svn] r54910 - in pypy/branch/oo-jit/pypy: jit/codegen/cli translator/cli translator/oosupport

antocuni at codespeak.net antocuni at codespeak.net
Sun May 18 23:11:16 CEST 2008


Author: antocuni
Date: Sun May 18 23:11:14 2008
New Revision: 54910

Modified:
   pypy/branch/oo-jit/pypy/jit/codegen/cli/operation.py
   pypy/branch/oo-jit/pypy/jit/codegen/cli/rgenop.py
   pypy/branch/oo-jit/pypy/translator/cli/opcodes.py
   pypy/branch/oo-jit/pypy/translator/oosupport/constant.py
Log:
yai! test_gencli_portal.test_very_simple passes :-)



Modified: pypy/branch/oo-jit/pypy/jit/codegen/cli/operation.py
==============================================================================
--- pypy/branch/oo-jit/pypy/jit/codegen/cli/operation.py	(original)
+++ pypy/branch/oo-jit/pypy/jit/codegen/cli/operation.py	Sun May 18 23:11:14 2008
@@ -177,6 +177,23 @@
         self.storeResult()
 
 
+class SetField(Operation):
+
+    def __init__(self, builder, gv_obj, gv_value, fieldname):
+        self.builder = builder
+        self.gv_obj = gv_obj
+        self.gv_value = gv_value
+        clitype = gv_obj.getCliType()
+        self.fieldinfo = clitype.GetField(fieldname)
+
+    def restype(self):
+        return None
+
+    def emit(self):
+        self.gv_obj.load(self.builder)
+        self.gv_value.load(self.builder)
+        self.builder.graphbuilder.il.Emit(OpCodes.Stfld, self.fieldinfo)
+
 def opcode2attrname(opcode):
     if opcode == 'ldc.r8 0':
         return 'Ldc_R8, 0' # XXX this is a hack

Modified: pypy/branch/oo-jit/pypy/jit/codegen/cli/rgenop.py
==============================================================================
--- pypy/branch/oo-jit/pypy/jit/codegen/cli/rgenop.py	(original)
+++ pypy/branch/oo-jit/pypy/jit/codegen/cli/rgenop.py	Sun May 18 23:11:14 2008
@@ -208,7 +208,11 @@
     @specialize.arg(1)
     def revealconst(self, T):
         assert isinstance(T, ootype.OOType)
-        return unbox(self.holder.GetFunc(), T)
+        if isinstance(T, ootype.StaticMethod):
+            return unbox(self.holder.GetFunc(), T)
+        else:
+            assert T is ootype.Object
+            return ootype.cast_to_object(self.holder.GetFunc())
 
 class Label(GenLabel):
     def __init__(self, label, inputargs_gv):
@@ -373,6 +377,9 @@
     def genop_oogetfield(self, fieldtoken, gv_obj):
         return self.branches[0].genop_oogetfield(fieldtoken, gv_obj)
 
+    def genop_oosetfield(self, fieldtoken, gv_obj, gv_value):
+        return self.branches[0].genop_oosetfield(fieldtoken, gv_obj, gv_value)
+
     def end(self):
         # render all the pending branches
         for branchbuilder in self.branches:
@@ -450,8 +457,9 @@
         self.appendop(op)
         return op.gv_res()
 
-##    def genop_oosetfield(self, fieldtoken, gv_obj, gv_value):
-##        pass
+    def genop_oosetfield(self, fieldtoken, gv_obj, gv_value):
+        op = ops.SetField(self, gv_obj, gv_value, fieldtoken)
+        self.appendop(op)
 
     def enter_next_block(self, args_gv):
         for i in range(len(args_gv)):

Modified: pypy/branch/oo-jit/pypy/translator/cli/opcodes.py
==============================================================================
--- pypy/branch/oo-jit/pypy/translator/cli/opcodes.py	(original)
+++ pypy/branch/oo-jit/pypy/translator/cli/opcodes.py	Sun May 18 23:11:14 2008
@@ -72,6 +72,7 @@
     'gc__disable_finalizers':    Ignore,
     'resume_point':             Ignore,
     'debug_assert':             Ignore,
+    'debug_print':              Ignore,
     'keepalive':                Ignore,
     'is_early_constant':        [PushPrimitive(ootype.Bool, False)],
     }

Modified: pypy/branch/oo-jit/pypy/translator/oosupport/constant.py
==============================================================================
--- pypy/branch/oo-jit/pypy/translator/oosupport/constant.py	(original)
+++ pypy/branch/oo-jit/pypy/translator/oosupport/constant.py	Sun May 18 23:11:14 2008
@@ -191,6 +191,7 @@
 
         if isinstance(value, ootype._object) and value: # leave ootype.NULL as is
             value = value.obj
+            self.db.cts.lltype_to_cts(value._TYPE) # record const
 
         # Determine if the static type differs from the dynamic type.
         if isinstance(value, ootype._view):



More information about the Pypy-commit mailing list