1. Pypy
  2. Untitled project
  3. pypy

Commits

Armin Rigo  committed eb15703

Starting to fix the front-end

  • Participants
  • Parent commits 9b08118
  • Branches remove-globals-in-jit

Comments (0)

Files changed (6)

File pypy/jit/metainterp/blackhole.py

View file
     # We will continue to loop in _run_forever() from the parent level.
     return blackholeinterp, lle
 
-def resume_in_blackhole(metainterp_sd, jitdriver_sd, resumedescr,
+def resume_in_blackhole(metainterp_sd, jitdriver_sd, resumedescr, deadframe,
                         all_virtuals=None):
     from pypy.jit.metainterp.resume import blackhole_from_resumedata
     #debug_start('jit-blackhole')
         metainterp_sd.blackholeinterpbuilder,
         jitdriver_sd,
         resumedescr,
+        deadframe,
         all_virtuals)
     if isinstance(resumedescr, ResumeAtPositionDescr):
         dont_change_position = True

File pypy/jit/metainterp/compile.py

View file
             assert cnt > self.CNT_BASE_MASK
             self._counter = cnt | i
 
-    def handle_fail(self, metainterp_sd, jitdriver_sd):
+    def handle_fail(self, deadframe, metainterp_sd, jitdriver_sd):
         if self.must_compile(metainterp_sd, jitdriver_sd):
             self.start_compiling()
             try:
                 self.done_compiling()
         else:
             from pypy.jit.metainterp.blackhole import resume_in_blackhole
-            resume_in_blackhole(metainterp_sd, jitdriver_sd, self)
+            resume_in_blackhole(metainterp_sd, jitdriver_sd, self, deadframe)
         assert 0, "unreachable"
 
     def _trace_and_compile_from_bridge(self, metainterp_sd, jitdriver_sd):

File pypy/jit/metainterp/optimizeopt/test/test_util.py

View file
     node_vtable2 = lltype.malloc(OBJECT_VTABLE, immortal=True)
     node_vtable2.name = rclass.alloc_array_name('node2')
     node_vtable_adr2 = llmemory.cast_ptr_to_adr(node_vtable2)
-    cpu = runner.LLtypeCPU(None)
+    cpu = runner.LLGraphCPU(None)
 
     NODE = lltype.GcForwardReference()
     NODE.become(lltype.GcStruct('NODE', ('parent', OBJECT),

File pypy/jit/metainterp/resume.py

View file
         value = self.decode_float(self.cur_numb.nums[index])
         self.write_a_float(register_index, value)
 
-    def done(self):
-        self.cpu.clear_latest_values(self.cpu.get_latest_value_count())
-
 # ---------- when resuming for pyjitpl.py, make boxes ----------
 
 def rebuild_from_resumedata(metainterp, storage, virtualizable_info,
         if frameinfo is None:
             break
     metainterp.framestack.reverse()
-    resumereader.done()
     return resumereader.liveboxes, virtualizable_boxes, virtualref_boxes
 
 class ResumeDataBoxReader(AbstractResumeDataReader):
 # ---------- when resuming for blackholing, get direct values ----------
 
 def blackhole_from_resumedata(blackholeinterpbuilder, jitdriver_sd, storage,
-                              all_virtuals=None):
+                              deadframe, all_virtuals=None):
     # The initialization is stack-critical code: it must not be interrupted by
     # StackOverflow, otherwise the jit_virtual_refs are left in a dangling state.
     rstack._stack_criticalcode_start()
     try:
         resumereader = ResumeDataDirectReader(blackholeinterpbuilder.metainterp_sd,
-                                              storage, all_virtuals)
+                                              storage, deadframe, all_virtuals)
         vinfo = jitdriver_sd.virtualizable_info
         ginfo = jitdriver_sd.greenfield_info
         vrefinfo = blackholeinterpbuilder.metainterp_sd.virtualref_info
         frameinfo = frameinfo.prev
         if frameinfo is None:
             break
-    resumereader.done()
     return firstbh
 
 def force_from_resumedata(metainterp_sd, storage, vinfo, ginfo):
     #             1: in handle_async_forcing
     #             2: resuming from the GUARD_NOT_FORCED
 
-    def __init__(self, metainterp_sd, storage, all_virtuals=None):
+    def __init__(self, metainterp_sd, storage, deadframe, all_virtuals=None):
         self._init(metainterp_sd.cpu, storage)
+        self.deadframe = deadframe
         self.callinfocollection = metainterp_sd.callinfocollection
         if all_virtuals is None:        # common case
             self._prepare(storage)
             assert tag == TAGBOX
             if num < 0:
                 num += self.cpu.get_latest_value_count()
-            return self.cpu.get_latest_value_int(num)
+            return self.cpu.get_latest_value_int(self.deadframe, num)
 
     def decode_ref(self, tagged):
         num, tag = untag(tagged)

File pypy/jit/metainterp/test/support.py

View file
     for i in range(len(args) - num_green_args):
         x = args[num_green_args + i]
         args1.append(unspecialize_value(x))
-    faildescr = cpu.execute_token(procedure_token, *args1)
+    deadframe = cpu.execute_token(procedure_token, *args1)
+    faildescr = cpu.get_latest_descr(deadframe)
     assert faildescr.__class__.__name__.startswith('DoneWithThisFrameDescr')
     if metainterp.jitdriver_sd.result_type == history.INT:
-        return cpu.get_latest_value_int(0)
+        return cpu.get_latest_value_int(deadframe, 0)
     elif metainterp.jitdriver_sd.result_type == history.REF:
-        return cpu.get_latest_value_ref(0)
+        return cpu.get_latest_value_ref(deadframe, 0)
     elif metainterp.jitdriver_sd.result_type == history.FLOAT:
-        return cpu.get_latest_value_float(0)
+        return cpu.get_latest_value_float(deadframe, 0)
     else:
         return None
 
 
 class LLJitMixin(JitMixin):
     type_system = 'lltype'
-    CPUClass = runner.LLtypeCPU
+    CPUClass = runner.LLGraphCPU
 
     @staticmethod
     def Ptr(T):

File pypy/jit/metainterp/warmstate.py

View file
             else:
                 assert 0, kind
         func_execute_token = self.cpu.make_execute_token(*ARGS)
+        cpu = self.cpu
 
         def execute_assembler(loop_token, *args):
             # Call the backend to run the 'looptoken' with the given
             # input args.
-            fail_descr = func_execute_token(loop_token, *args)
+            deadframe = func_execute_token(loop_token, *args)
             #
             # If we have a virtualizable, we have to reset its
             # 'vable_token' field afterwards
             warmrunnerdesc.memory_manager.keep_loop_alive(loop_token)
             #
             # Handle the failure
-            fail_descr.handle_fail(metainterp_sd, jitdriver_sd)
+            fail_descr = cpu.get_latest_descr(deadframe)
+            fail_descr.handle_fail(deadframe, metainterp_sd, jitdriver_sd)
             #
             assert 0, "should have raised"