Commits

Maciej Fijalkowski  committed 1ca3fb9

start passing some tests (Finally!!!)

  • Participants
  • Parent commits 9855918
  • Branches result-in-resops

Comments (0)

Files changed (2)

File pypy/jit/metainterp/compile.py

 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
     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:
     else:
         hooks = None
         debug_info = None
-    operations = get_deep_immutable_oplist(operations)
     metainterp_sd.profiler.start_backend()
     debug_start("jit-backend")
     try:
     # 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
         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)

File pypy/jit/metainterp/resoperation.py

     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