[pypy-svn] r69878 - in pypy/branch/virtual-forcing/pypy: jit/metainterp jit/metainterp/test rlib rpython rpython/lltypesystem rpython/test translator/c translator/cli translator/jvm

arigo at codespeak.net arigo at codespeak.net
Thu Dec 3 21:25:06 CET 2009


Author: arigo
Date: Thu Dec  3 21:25:04 2009
New Revision: 69878

Modified:
   pypy/branch/virtual-forcing/pypy/jit/metainterp/codewriter.py
   pypy/branch/virtual-forcing/pypy/jit/metainterp/effectinfo.py
   pypy/branch/virtual-forcing/pypy/jit/metainterp/pyjitpl.py
   pypy/branch/virtual-forcing/pypy/jit/metainterp/resoperation.py
   pypy/branch/virtual-forcing/pypy/jit/metainterp/test/test_codewriter.py
   pypy/branch/virtual-forcing/pypy/jit/metainterp/test/test_virtualizable.py
   pypy/branch/virtual-forcing/pypy/jit/metainterp/virtualizable.py
   pypy/branch/virtual-forcing/pypy/rlib/_jit_vref.py
   pypy/branch/virtual-forcing/pypy/rlib/jit.py
   pypy/branch/virtual-forcing/pypy/rpython/llinterp.py
   pypy/branch/virtual-forcing/pypy/rpython/lltypesystem/lloperation.py
   pypy/branch/virtual-forcing/pypy/rpython/lltypesystem/opimpl.py
   pypy/branch/virtual-forcing/pypy/rpython/rvirtualizable2.py
   pypy/branch/virtual-forcing/pypy/rpython/test/test_rvirtualizable2.py
   pypy/branch/virtual-forcing/pypy/translator/c/funcgen.py
   pypy/branch/virtual-forcing/pypy/translator/cli/opcodes.py
   pypy/branch/virtual-forcing/pypy/translator/jvm/opcodes.py
Log:
* rename 'promote_virtualizable' in 'jit_force_virtualizable',
  which is closer to the current meaning.

* add 'jit_force_virtual', not implemented yet.

* slowly move 'virtual_ref' closer to pyjitpl.py.


Modified: pypy/branch/virtual-forcing/pypy/jit/metainterp/codewriter.py
==============================================================================
--- pypy/branch/virtual-forcing/pypy/jit/metainterp/codewriter.py	(original)
+++ pypy/branch/virtual-forcing/pypy/jit/metainterp/codewriter.py	Thu Dec  3 21:25:04 2009
@@ -1213,7 +1213,7 @@
             if pure and not all_promoted_args:
                 effectinfo = calldescr.get_extra_info()
                 assert (effectinfo is not None and
-                        not effectinfo.promotes_virtualizables)
+                        not effectinfo.forces_virtual_or_virtualizable)
         try:
             canraise = self.codewriter.raise_analyzer.can_raise(op)
         except lltype.DelayedPointer:
@@ -1279,6 +1279,9 @@
         return self._do_builtin_call(op, oopspec_name, args)
 
     def _do_builtin_call(self, op, oopspec_name, args):
+        if oopspec_name == 'virtual_ref':
+            self.handle_virtual_ref_call(op, args)
+            return
         argtypes = [v.concretetype for v in args]
         resulttype = op.result.concretetype
         c_func, TP = support.builtin_func_for_spec(self.codewriter.rtyper,
@@ -1299,6 +1302,11 @@
         self.emit_varargs([c_func] + non_void_args)
         self.register_var(op.result)
 
+    def handle_virtual_ref_call(self, op, args):
+        self.emit('virtual_ref')
+        self.emit(self.var_position(args[0]))
+        self.register_var(op.result)
+
     def _array_of_voids(self, ARRAY):
         if isinstance(ARRAY, ootype.Array):
             return ARRAY.ITEM == ootype.Void
@@ -1557,7 +1565,7 @@
         log.WARNING("found debug_assert in %r; should have be removed" %
                     (self.graph,))
 
-    def serialize_op_promote_virtualizable(self, op):
+    def serialize_op_jit_force_virtualizable(self, op):
         vinfo = self.codewriter.metainterp_sd.virtualizable_info
         assert vinfo is not None
         assert vinfo.is_vtypeptr(op.args[0].concretetype)

Modified: pypy/branch/virtual-forcing/pypy/jit/metainterp/effectinfo.py
==============================================================================
--- pypy/branch/virtual-forcing/pypy/jit/metainterp/effectinfo.py	(original)
+++ pypy/branch/virtual-forcing/pypy/jit/metainterp/effectinfo.py	Thu Dec  3 21:25:04 2009
@@ -8,19 +8,20 @@
     _cache = {}
 
     def __new__(cls, write_descrs_fields, write_descrs_arrays,
-                promotes_virtualizables=False):
+                forces_virtual_or_virtualizable=False):
         key = (frozenset(write_descrs_fields), frozenset(write_descrs_arrays),
-               promotes_virtualizables)
+               forces_virtual_or_virtualizable)
         if key in cls._cache:
             return cls._cache[key]
         result = object.__new__(cls)
         result.write_descrs_fields = write_descrs_fields
         result.write_descrs_arrays = write_descrs_arrays
-        result.promotes_virtualizables = promotes_virtualizables
+        result.forces_virtual_or_virtualizable= forces_virtual_or_virtualizable
         cls._cache[key] = result
         return result
 
-def effectinfo_from_writeanalyze(effects, cpu, promotes_virtualizables=False):
+def effectinfo_from_writeanalyze(effects, cpu,
+                                 forces_virtual_or_virtualizable=False):
     from pypy.translator.backendopt.writeanalyze import top_set
     if effects is top_set:
         return None
@@ -44,7 +45,7 @@
         else:
             assert 0
     return EffectInfo(write_descrs_fields, write_descrs_arrays,
-                      promotes_virtualizables)
+                      forces_virtual_or_virtualizable)
 
 def consider_struct(TYPE, fieldname):
     if fieldType(TYPE, fieldname) is lltype.Void:
@@ -73,4 +74,5 @@
 
 class VirtualizableAnalyzer(BoolGraphAnalyzer):
     def analyze_simple_operation(self, op):
-        return op.opname == 'promote_virtualizable'
+        return op.opname in ('jit_force_virtualizable',
+                             'jit_force_virtual')

Modified: pypy/branch/virtual-forcing/pypy/jit/metainterp/pyjitpl.py
==============================================================================
--- pypy/branch/virtual-forcing/pypy/jit/metainterp/pyjitpl.py	(original)
+++ pypy/branch/virtual-forcing/pypy/jit/metainterp/pyjitpl.py	Thu Dec  3 21:25:04 2009
@@ -988,7 +988,7 @@
 
     def do_residual_call(self, argboxes, descr, exc):
         effectinfo = descr.get_extra_info()
-        if effectinfo is None or effectinfo.promotes_virtualizables:
+        if effectinfo is None or effectinfo.forces_virtual_or_virtualizable:
             # residual calls require attention to keep virtualizables in-sync
             self.metainterp.vable_before_residual_call()
             # xxx do something about code duplication

Modified: pypy/branch/virtual-forcing/pypy/jit/metainterp/resoperation.py
==============================================================================
--- pypy/branch/virtual-forcing/pypy/jit/metainterp/resoperation.py	(original)
+++ pypy/branch/virtual-forcing/pypy/jit/metainterp/resoperation.py	Thu Dec  3 21:25:04 2009
@@ -205,6 +205,7 @@
     'NEW/0d',
     'NEW_WITH_VTABLE/1',
     'NEW_ARRAY/1d',
+    'FORCE_TOKEN/0',
     '_NOSIDEEFFECT_LAST', # ----- end of no_side_effect operations -----
 
     'SETARRAYITEM_GC/3d',
@@ -221,7 +222,6 @@
     'COND_CALL_GC_MALLOC',  # [a, b, if_(a<=b)_result, if_(a>b)_call, args...]
                             #        => result          (for mallocs)
     'DEBUG_MERGE_POINT/1',      # debugging only
-    'FORCE_TOKEN/0',
 
     '_CANRAISE_FIRST', # ----- start of can_raise operations -----
     'CALL',

Modified: pypy/branch/virtual-forcing/pypy/jit/metainterp/test/test_codewriter.py
==============================================================================
--- pypy/branch/virtual-forcing/pypy/jit/metainterp/test/test_codewriter.py	(original)
+++ pypy/branch/virtual-forcing/pypy/jit/metainterp/test/test_codewriter.py	Thu Dec  3 21:25:04 2009
@@ -283,7 +283,7 @@
         assert calldescrs[0][4] is not None
         assert not calldescrs[0][4].write_descrs_fields
         assert not calldescrs[0][4].write_descrs_arrays
-        assert not calldescrs[0][4].promotes_virtualizables
+        assert not calldescrs[0][4].forces_virtual_or_virtualizable
 
     def test_oosend_look_inside_only_one(self):
         class A:
@@ -394,7 +394,7 @@
         assert cw.list_of_addr2name[0][1].endswith('.A1')
         assert cw.list_of_addr2name[1][1] == 'A1.g'
 
-    def test_promote_virtualizable_effectinfo(self):
+    def test_jit_force_virtualizable_effectinfo(self):
         class Frame(object):
             _virtualizable2_ = ['x']
             
@@ -430,9 +430,23 @@
         effectinfo_g1 = calldescrs[1][4]
         effectinfo_g2 = calldescrs[2][4]
         effectinfo_h  = calldescrs[3][4]
-        assert effectinfo_g1.promotes_virtualizables
-        assert effectinfo_g2.promotes_virtualizables
-        assert not effectinfo_h.promotes_virtualizables
+        assert effectinfo_g1.forces_virtual_or_virtualizable
+        assert effectinfo_g2.forces_virtual_or_virtualizable
+        assert not effectinfo_h.forces_virtual_or_virtualizable
+
+    def test_vref_simple(self):
+        class X:
+            pass
+        def f():
+            return jit.virtual_ref(X())
+        graphs = self.make_graphs(f, [])
+        assert graphs[0].func is f
+        assert graphs[1].func is jit.virtual_ref
+        cw = CodeWriter(self.rtyper)
+        cw.candidate_graphs = [graphs[0]]
+        cw._start(self.metainterp_sd, None)
+        jitcode = cw.make_one_bytecode((graphs[0], None), False)
+        assert 'virtual_ref' in jitcode._source
 
 
 class ImmutableFieldsTests:

Modified: pypy/branch/virtual-forcing/pypy/jit/metainterp/test/test_virtualizable.py
==============================================================================
--- pypy/branch/virtual-forcing/pypy/jit/metainterp/test/test_virtualizable.py	(original)
+++ pypy/branch/virtual-forcing/pypy/jit/metainterp/test/test_virtualizable.py	Thu Dec  3 21:25:04 2009
@@ -28,7 +28,7 @@
                   hop.inputconst(lltype.Void, hop.args_v[1].value),
                   hop.inputconst(lltype.Void, {})]
         hop.exception_cannot_occur()
-        return hop.genop('promote_virtualizable',
+        return hop.genop('jit_force_virtualizable',
                          args_v, resulttype=lltype.Void)
 
 debug_print = lloperation.llop.debug_print

Modified: pypy/branch/virtual-forcing/pypy/jit/metainterp/virtualizable.py
==============================================================================
--- pypy/branch/virtual-forcing/pypy/jit/metainterp/virtualizable.py	(original)
+++ pypy/branch/virtual-forcing/pypy/jit/metainterp/virtualizable.py	Thu Dec  3 21:25:04 2009
@@ -162,7 +162,7 @@
         ts = self.warmrunnerdesc.cpu.ts
         (_, FUNCPTR) = ts.get_FuncType([self.VTYPEPTR], lltype.Void)
         funcptr = self.warmrunnerdesc.helper_func(FUNCPTR, force_if_necessary)
-        rvirtualizable2.replace_promote_virtualizable_with_call(
+        rvirtualizable2.replace_force_virtualizable_with_call(
             all_graphs, self.VTYPEPTR, funcptr)
 
     def unwrap_virtualizable_box(self, virtualizable_box):

Modified: pypy/branch/virtual-forcing/pypy/rlib/_jit_vref.py
==============================================================================
--- pypy/branch/virtual-forcing/pypy/rlib/_jit_vref.py	(original)
+++ pypy/branch/virtual-forcing/pypy/rlib/_jit_vref.py	Thu Dec  3 21:25:04 2009
@@ -35,19 +35,3 @@
         [v] = hop.inputargs(self)
         v = hop.genop('jit_virtual_force', [v], resulttype = OBJECTPTR)
         return hop.genop('cast_pointer', [v], resulttype = hop.r_result)
-
-# ____________________________________________________________
-
-
-def jit_virtual_ref(x):
-    raise Exception("should not be reached")
-
-class Entry(ExtRegistryEntry):
-    _about_ = jit_virtual_ref
-
-    def compute_result_annotation(self, s_obj):
-        return SomeVRef(s_obj)
-
-    def specialize_call(self, hop):
-        [v] = hop.inputargs(getinstancerepr(hop.rtyper, None))
-        return hop.genop('jit_virtual_ref', [v], resulttype = hop.r_result)

Modified: pypy/branch/virtual-forcing/pypy/rlib/jit.py
==============================================================================
--- pypy/branch/virtual-forcing/pypy/rlib/jit.py	(original)
+++ pypy/branch/virtual-forcing/pypy/rlib/jit.py	Thu Dec  3 21:25:04 2009
@@ -102,11 +102,8 @@
 # VRefs
 
 def virtual_ref(x):
-    if we_are_jitted():
-        from pypy.rlib import _jit_vref
-        return _jit_vref.jit_virtual_ref(x)
-    else:
-        return DirectVRef(x)
+    return DirectVRef(x)
+virtual_ref.oopspec = 'virtual_ref(x)'
 
 class DirectVRef(object):
     def __init__(self, x):

Modified: pypy/branch/virtual-forcing/pypy/rpython/llinterp.py
==============================================================================
--- pypy/branch/virtual-forcing/pypy/rpython/llinterp.py	(original)
+++ pypy/branch/virtual-forcing/pypy/rpython/llinterp.py	Thu Dec  3 21:25:04 2009
@@ -546,9 +546,6 @@
     def op_jit_marker(self, *args):
         pass
 
-    def op_promote_virtualizable(self, *args):
-        pass
-
     def op_get_exception_addr(self, *args):
         raise NotImplementedError
 

Modified: pypy/branch/virtual-forcing/pypy/rpython/lltypesystem/lloperation.py
==============================================================================
--- pypy/branch/virtual-forcing/pypy/rpython/lltypesystem/lloperation.py	(original)
+++ pypy/branch/virtual-forcing/pypy/rpython/lltypesystem/lloperation.py	Thu Dec  3 21:25:04 2009
@@ -427,15 +427,14 @@
     # __________ used by the JIT ________
 
     'jit_marker':           LLOp(),
-    'promote_virtualizable':LLOp(canrun=True),
+    'jit_force_virtualizable':LLOp(canrun=True),
+    'jit_force_virtual':    LLOp(canrun=True),
     'get_exception_addr':   LLOp(),
     'get_exc_value_addr':   LLOp(),
     'do_malloc_fixedsize_clear': LLOp(canunwindgc=True),
     'do_malloc_varsize_clear': LLOp(canunwindgc=True),
     'get_write_barrier_failing_case': LLOp(sideeffects=False),
     'gc_get_type_info_group': LLOp(sideeffects=False),
-    'jit_virtual_ref':      LLOp(),
-    'jit_virtual_force':    LLOp(canfold=True),
 
     # __________ GC operations __________
 

Modified: pypy/branch/virtual-forcing/pypy/rpython/lltypesystem/opimpl.py
==============================================================================
--- pypy/branch/virtual-forcing/pypy/rpython/lltypesystem/opimpl.py	(original)
+++ pypy/branch/virtual-forcing/pypy/rpython/lltypesystem/opimpl.py	Thu Dec  3 21:25:04 2009
@@ -436,8 +436,11 @@
 def op_gc_stack_bottom():
     pass       # marker for trackgcroot.py
 
-def op_promote_virtualizable(object, fieldname, flags):
-    pass # XXX should do something
+def op_jit_force_virtualizable(*args):
+    pass
+
+def op_jit_force_virtual(x):
+    return x
 
 def op_get_group_member(TYPE, grpptr, memberoffset):
     from pypy.rpython.lltypesystem import llgroup
@@ -489,9 +492,6 @@
 def op_gc_assume_young_pointers(addr):
     pass
 
-def op_jit_virtual_force(x):
-    return x
-
 # ____________________________________________________________
 
 def get_op_impl(opname):

Modified: pypy/branch/virtual-forcing/pypy/rpython/rvirtualizable2.py
==============================================================================
--- pypy/branch/virtual-forcing/pypy/rpython/rvirtualizable2.py	(original)
+++ pypy/branch/virtual-forcing/pypy/rpython/rvirtualizable2.py	Thu Dec  3 21:25:04 2009
@@ -52,10 +52,10 @@
         #if not flags.get('access_directly'):
         if cname.value in self.my_redirected_fields:
             cflags = inputconst(lltype.Void, flags)
-            llops.genop('promote_virtualizable', [vinst, cname, cflags])
+            llops.genop('jit_force_virtualizable', [vinst, cname, cflags])
 
 
-def replace_promote_virtualizable_with_call(graphs, VTYPEPTR, funcptr):
+def replace_force_virtualizable_with_call(graphs, VTYPEPTR, funcptr):
     # funcptr should be an ll or oo function pointer with a VTYPEPTR argument
     c_funcptr = inputconst(lltype.typeOf(funcptr), funcptr)
     count = 0
@@ -65,7 +65,7 @@
                 continue
             newoplist = []
             for i, op in enumerate(block.operations):
-                if (op.opname == 'promote_virtualizable' and
+                if (op.opname == 'jit_force_virtualizable' and
                     match_virtualizable_type(op.args[0].concretetype,
                                              VTYPEPTR)):
                     if op.args[-1].value.get('access_directly', False):
@@ -75,7 +75,7 @@
                     count += 1
                 newoplist.append(op)
             block.operations = newoplist
-    log("replaced %d 'promote_virtualizable' with %r" % (count, funcptr))
+    log("replaced %d 'jit_force_virtualizable' with %r" % (count, funcptr))
 
 def match_virtualizable_type(TYPE, VTYPEPTR):
     if isinstance(TYPE, ootype.Instance):

Modified: pypy/branch/virtual-forcing/pypy/rpython/test/test_rvirtualizable2.py
==============================================================================
--- pypy/branch/virtual-forcing/pypy/rpython/test/test_rvirtualizable2.py	(original)
+++ pypy/branch/virtual-forcing/pypy/rpython/test/test_rvirtualizable2.py	Thu Dec  3 21:25:04 2009
@@ -1,7 +1,7 @@
 import py
 from pypy.rpython.lltypesystem import lltype
 from pypy.rpython.test.tool import BaseRtypingTest, LLRtypeMixin, OORtypeMixin
-from pypy.rpython.rvirtualizable2 import replace_promote_virtualizable_with_call
+from pypy.rpython.rvirtualizable2 import replace_force_virtualizable_with_call
 from pypy.rlib.jit import hint
 from pypy.objspace.flow.model import summary
 
@@ -29,15 +29,15 @@
     def __init__(self, v0):
         self.v0 = v0
 
-def get_promote_virtualizable_flags(graph):
+def get_force_virtualizable_flags(graph):
     res = []
     for block, op in graph.iterblockops():
-        if op.opname == 'promote_virtualizable':
+        if op.opname == 'jit_force_virtualizable':
             res.append(op.args[-1].value)
     return res
 
 class BaseTest(BaseRtypingTest):
-    def test_generate_promote_virtualizable(self):
+    def test_generate_force_virtualizable(self):
         def fn(n):
             vinst = V(n)
             return vinst.v
@@ -47,11 +47,11 @@
         op_getfield = block.operations[-1]
         assert op_getfield.opname in ('getfield', 'oogetfield')
         v_inst = op_getfield.args[0]
-        assert op_promote.opname == 'promote_virtualizable'
+        assert op_promote.opname == 'jit_force_virtualizable'
         assert op_promote.args[0] is v_inst
         assert op_promote.args[-1].value == {}
 
-    def test_generate_promote_virtualizable_subclass(self):
+    def test_generate_force_virtualizable_subclass(self):
         def fn(n):
             V(n) # to attach v to V
             vinst = SubclassV(n)
@@ -62,11 +62,11 @@
         op_getfield = block.operations[-1]
         assert op_getfield.opname in ('getfield', 'oogetfield')
         v_inst = op_getfield.args[0]
-        assert op_promote.opname == 'promote_virtualizable'
+        assert op_promote.opname == 'jit_force_virtualizable'
         assert op_promote.args[0] is v_inst
         assert op_promote.args[-1].value == {}
 
-    def test_no_promote_virtualizable_for_other_fields(self):
+    def test_no_force_virtualizable_for_other_fields(self):
         def fn(n):
             vinst = V(n)
             return vinst.w
@@ -77,7 +77,7 @@
         assert op_getfield.opname in ('getfield', 'oogetfield')
         assert op_call.opname == 'direct_call'    # to V.__init__
 
-    def test_generate_promote_virtualizable_array(self):
+    def test_generate_force_virtualizable_array(self):
         def fn(n):
             vinst = VArray([n, n+1])
             return vinst.lst[1]
@@ -89,7 +89,7 @@
         assert op_getarrayitem.opname == 'direct_call'  # to ll_getitem_xxx
         assert op_getfield.opname in ('getfield', 'oogetfield')
         v_inst = op_getfield.args[0]
-        assert op_promote.opname == 'promote_virtualizable'
+        assert op_promote.opname == 'jit_force_virtualizable'
         assert op_promote.args[0] is v_inst
         assert op_promote.args[-1].value == {}        
 
@@ -126,13 +126,13 @@
         TYPE = self.gettype(w_inst)
         assert 'virtualizable2_accessor' not in TYPE._hints
 
-    def replace_promote_virtualizable(self, rtyper, graphs):
+    def replace_force_virtualizable(self, rtyper, graphs):
         from pypy.annotation import model as annmodel
         from pypy.rpython.annlowlevel import MixLevelHelperAnnotator
         graph = graphs[0]
 
         for block, op in graph.iterblockops():
-            if op.opname == 'promote_virtualizable':
+            if op.opname == 'jit_force_virtualizable':
                 v_inst_ll_type = op.args[0].concretetype
                 break
             
@@ -145,11 +145,10 @@
             s_vinst = annmodel.SomeOOInstance(v_inst_ll_type)
         funcptr = annhelper.delayedfunction(mycall, [s_vinst], annmodel.s_None)
         annhelper.finish()
-        replace_promote_virtualizable_with_call(graphs, v_inst_ll_type,
-                                                funcptr)
+        replace_force_virtualizable_with_call(graphs, v_inst_ll_type, funcptr)
         return funcptr
 
-    def test_replace_promote_virtualizable_with_call(self):
+    def test_replace_force_virtualizable_with_call(self):
         def fn(n):
             vinst = V(n)
             return vinst.v
@@ -157,7 +156,7 @@
         block = graph.startblock
         op_getfield = block.operations[-1]
         assert op_getfield.opname in ('getfield', 'oogetfield')
-        funcptr = self.replace_promote_virtualizable(rtyper, [graph])
+        funcptr = self.replace_force_virtualizable(rtyper, [graph])
         op_promote = block.operations[-2]
         op_getfield = block.operations[-1]
         assert op_getfield.opname in ('getfield', 'oogetfield')
@@ -179,9 +178,9 @@
         g_graph = t._graphof(g)
 
         expected =  [{'access_directly': True}] * 3
-        assert get_promote_virtualizable_flags(g_graph) == expected
+        assert get_force_virtualizable_flags(g_graph) == expected
 
-        self.replace_promote_virtualizable(typer, [g_graph])
+        self.replace_force_virtualizable(typer, [g_graph])
         assert summary(g_graph) == {self.GETFIELD: 2, self.SETFIELD: 1, 'int_add': 1}
 
         res = self.interpret(f, [23])
@@ -202,7 +201,7 @@
         f_graph = t._graphof(f)
         g_graph = t._graphof(g)
 
-        self.replace_promote_virtualizable(typer, [f_graph, g_graph])
+        self.replace_force_virtualizable(typer, [f_graph, g_graph])
         t.checkgraphs()
 
         res = self.interpret(f, [23]) 
@@ -225,12 +224,12 @@
         g_graphs.sort()
         assert g_graphs[0][0] is None
 
-        assert get_promote_virtualizable_flags(g_graphs[0][1]) == [{}]
+        assert get_force_virtualizable_flags(g_graphs[0][1]) == [{}]
         expected =  [{'access_directly': True}]        
-        assert get_promote_virtualizable_flags(g_graphs[1][1]) == expected
+        assert get_force_virtualizable_flags(g_graphs[1][1]) == expected
 
-        self.replace_promote_virtualizable(typer, [g_graphs[0][1],
-                                                   g_graphs[1][1]])
+        self.replace_force_virtualizable(typer, [g_graphs[0][1],
+                                                 g_graphs[1][1]])
         
         assert summary(g_graphs[0][1]) == {'direct_call': 1, self.GETFIELD: 1}
         assert summary(g_graphs[1][1]) == {self.GETFIELD: 1}        
@@ -265,8 +264,9 @@
         assert summary(g_graphs[1][1]) == {self.SETFIELD: 1}
         
         h_graph = t._graphof(h)
-        assert summary(h_graph) == {'promote_virtualizable': 1, self.GETFIELD: 1}
-        assert get_promote_virtualizable_flags(h_graph) == [{}]
+        assert summary(h_graph) == {'jit_force_virtualizable': 1,
+                                    self.GETFIELD: 1}
+        assert get_force_virtualizable_flags(h_graph) == [{}]
 
         res = self.interpret(f, [23])
         assert res == 23
@@ -292,7 +292,7 @@
         t, typer, graph = self.gengraph(f, [int])
         g_graph = t._graphof(A.g.im_func)
 
-        self.replace_promote_virtualizable(typer, [g_graph])
+        self.replace_force_virtualizable(typer, [g_graph])
         
         assert summary(g_graph) == {self.GETFIELD: 1, 'int_mul': 1}
 

Modified: pypy/branch/virtual-forcing/pypy/translator/c/funcgen.py
==============================================================================
--- pypy/branch/virtual-forcing/pypy/translator/c/funcgen.py	(original)
+++ pypy/branch/virtual-forcing/pypy/translator/c/funcgen.py	Thu Dec  3 21:25:04 2009
@@ -793,8 +793,12 @@
     def OP_JIT_MARKER(self, op):
         return '/* JIT_MARKER %s */' % op
 
-    def OP_PROMOTE_VIRTUALIZABLE(self, op):
-        return '/* PROMOTE_VIRTUALIZABLE %s */' % op
+    def OP_JIT_FORCE_VIRTUALIZABLE(self, op):
+        return '/* JIT_FORCE_VIRTUALIZABLE %s */' % op
+
+    def OP_JIT_FORCE_VIRTUAL(self, op):
+        return '%s = %s; /* JIT_FORCE_VIRTUAL */' % (self.expr(op.result),
+                                                     self.expr(op.args[0])))
 
     def OP_GET_GROUP_MEMBER(self, op):
         typename = self.db.gettype(op.result.concretetype)

Modified: pypy/branch/virtual-forcing/pypy/translator/cli/opcodes.py
==============================================================================
--- pypy/branch/virtual-forcing/pypy/translator/cli/opcodes.py	(original)
+++ pypy/branch/virtual-forcing/pypy/translator/cli/opcodes.py	Thu Dec  3 21:25:04 2009
@@ -84,7 +84,8 @@
     'debug_fatalerror':         [PushAllArgs, 'call void [pypylib]pypy.runtime.Debug::DEBUG_FATALERROR(string)'],
     'keepalive':                Ignore,
     'jit_marker':               Ignore,
-    'promote_virtualizable':    Ignore,
+    'jit_force_virtualizable':  Ignore,
+    'jit_force_virtual':        DoNothing,
     }
 
 # __________ numeric operations __________

Modified: pypy/branch/virtual-forcing/pypy/translator/jvm/opcodes.py
==============================================================================
--- pypy/branch/virtual-forcing/pypy/translator/jvm/opcodes.py	(original)
+++ pypy/branch/virtual-forcing/pypy/translator/jvm/opcodes.py	Thu Dec  3 21:25:04 2009
@@ -97,7 +97,8 @@
     'gc_set_max_heap_size':     Ignore,
     'resume_point':             Ignore,
     'jit_marker':               Ignore,
-    'promote_virtualizable':    Ignore,
+    'jit_force_virtualizable':  Ignore,
+    'jit_force_virtual':        DoNothing,
 
     'debug_assert':              [], # TODO: implement?
 



More information about the Pypy-commit mailing list