Author: Maciej Fijalkowski <fij...@gmail.com>
Branch: result-in-resops
Changeset: r56436:1ca3fb9431b3
Date: 2012-07-24 19:25 +0200
http://bitbucket.org/pypy/pypy/changeset/1ca3fb9431b3/

Log:    start passing some tests (Finally!!!)

diff --git a/pypy/jit/metainterp/compile.py b/pypy/jit/metainterp/compile.py
--- a/pypy/jit/metainterp/compile.py
+++ b/pypy/jit/metainterp/compile.py
@@ -9,7 +9,7 @@
 from pypy.conftest import option
 from pypy.tool.sourcetools import func_with_new_name
 
-from pypy.jit.metainterp.resoperation import rop, get_deep_immutable_oplist
+from pypy.jit.metainterp.resoperation import rop
 from pypy.jit.metainterp.history import TreeLoop, Box, History, JitCellToken, 
TargetToken
 from pypy.jit.metainterp.history import AbstractFailDescr, BoxInt
 from pypy.jit.metainterp.history import BoxPtr, BoxObj, BoxFloat, Const, 
ConstInt
@@ -329,7 +329,7 @@
     else:
         debug_info = None
         hooks = None
-    operations = get_deep_immutable_oplist(loop.operations)
+    operations = loop.operations
     metainterp_sd.profiler.start_backend()
     debug_start("jit-backend")
     try:
@@ -374,7 +374,6 @@
     else:
         hooks = None
         debug_info = None
-    operations = get_deep_immutable_oplist(operations)
     metainterp_sd.profiler.start_backend()
     debug_start("jit-backend")
     try:
@@ -816,9 +815,8 @@
     # it does not work -- i.e. none of the existing old_loop_tokens match.
     new_trace = create_empty_loop(metainterp)
     new_trace.inputargs = inputargs = metainterp.history.inputargs[:]
-    # clone ops, as optimize_bridge can mutate the ops
 
-    new_trace.operations = [op.clone() for op in metainterp.history.operations]
+    new_trace.operations = metainterp.history.operations
     new_trace.resume_at_jump_descr = resume_at_jump_descr
     metainterp_sd = metainterp.staticdata
     state = metainterp.jitdriver_sd.warmstate
@@ -900,7 +898,6 @@
         ResOperation(rop.FINISH, finishargs, None, descr=jd.portal_finishtoken)
         ]
     operations[1].setfailargs([])
-    operations = get_deep_immutable_oplist(operations)
     cpu.compile_loop(inputargs, operations, jitcell_token, log=False)
     if memory_manager is not None:    # for tests
         memory_manager.keep_loop_alive(jitcell_token)
diff --git a/pypy/jit/metainterp/resoperation.py 
b/pypy/jit/metainterp/resoperation.py
--- a/pypy/jit/metainterp/resoperation.py
+++ b/pypy/jit/metainterp/resoperation.py
@@ -981,25 +981,3 @@
     rop.PTR_EQ: rop.PTR_EQ,
     rop.PTR_NE: rop.PTR_NE,
     }
-
-
-def get_deep_immutable_oplist(operations):
-    """
-    When not we_are_translated(), turns ``operations`` into a frozenlist and
-    monkey-patch its items to make sure they are not mutated.
-
-    When we_are_translated(), do nothing and just return the old list.
-    """
-    from pypy.tool.frozenlist import frozenlist
-    if we_are_translated():
-        return operations
-    #
-    def setarg(*args):
-        assert False, "operations cannot change at this point"
-    def setdescr(*args):
-        assert False, "operations cannot change at this point"
-    newops = frozenlist(operations)
-    for op in newops:
-        op.setarg = setarg
-        op.setdescr = setdescr
-    return newops
_______________________________________________
pypy-commit mailing list
pypy-commit@python.org
http://mail.python.org/mailman/listinfo/pypy-commit

Reply via email to