Commits

Maciej Fijalkowski committed 35b3b5b

some fixes for tests, not done yet

  • Participants
  • Parent commits 637b1b3
  • Branches kill-gen-store-back-in

Comments (0)

Files changed (4)

File rpython/jit/backend/llgraph/runner.py

         self.fieldname = fieldname
         self.FIELD = getattr(S, fieldname)
 
+    def get_vinfo(self):
+        return self.vinfo
+
     def __repr__(self):
         return 'FieldDescr(%r, %r)' % (self.S, self.fieldname)
 
     translate_support_code = False
     is_llgraph = True
 
-    def __init__(self, rtyper, stats=None, *ignored_args, **ignored_kwds):
+    def __init__(self, rtyper, stats=None, *ignored_args, **kwds):
         model.AbstractCPU.__init__(self)
         self.rtyper = rtyper
         self.llinterp = LLInterpreter(rtyper)
         class MiniStats:
             pass
         self.stats = stats or MiniStats()
+        self.vinfo_for_tests = kwds.get('vinfo_for_tests', None)
 
     def compile_loop(self, inputargs, operations, looptoken, log=True, name=''):
         clt = model.CompiledLoopToken(self, looptoken.number)
         assert isinstance(frame, LLFrame)
         assert frame.forced_deadframe is None
         values = []
+        if frame.force_guard_op is None:
+            if frame.current_op.opnum == rop.FINISH:
+                values = [frame.env[arg] for arg in
+                          frame.current_op.getarglist()]
+            else:
+                xxx
+            frame.forced_deadframe = LLDeadFrame(
+                _getdescr(frame.current_op), values)
+            return frame.forced_deadframe
         for box in frame.force_guard_op.getfailargs():
             if box is not None:
                 if box is not frame.current_op.result:
         except KeyError:
             descr = FieldDescr(S, fieldname)
             self.descrs[key] = descr
+            if self.vinfo_for_tests is not None:
+                descr.vinfo = self.vinfo_for_tests
             return descr
 
     def arraydescrof(self, A):
     forced_deadframe = None
     overflow_flag = False
     last_exception = None
+    force_guard_op = None
 
     def __init__(self, cpu, argboxes, args):
         self.env = {}

File rpython/jit/metainterp/pyjitpl.py

         # contents of the virtualizable should be generally correct
         self.history.record(rop.FORCE_TOKEN, [], force_token_box)
         self.history.record(rop.SETFIELD_GC, [vbox, force_token_box],
-                        None, descr=vinfo.vable_token_descr)
+                            None, descr=vinfo.vable_token_descr)
 
     def compile_exit_frame_with_exception(self, valuebox):
         self.store_token_in_vable()

File rpython/jit/metainterp/test/test_virtualizable.py

     pass
 
 
-class TestLLtype(ExplicitVirtualizableTests,
-                 ImplicitVirtualizableTests,
+class TestLLtype1(ExplicitVirtualizableTests,
                  LLJitMixin):
     pass
+
+class TestLLtype2(ImplicitVirtualizableTests,
+                  LLJitMixin):
+    def meta_interp(self, *args, **kwds):
+        class VInfo(object):
+            pass
+
+        kwds['vinfo_for_tests'] = VInfo()
+        return LLJitMixin.meta_interp(*args, **kwds)

File rpython/jit/metainterp/warmstate.py

         def execute_assembler(loop_token, *args):
             # Call the backend to run the 'looptoken' with the given
             # input args.
-            deadframe = func_execute_token(loop_token, *args)
+
+            # If we have a virtualizable, we have to clear its
+            # state, to make sure we enter with vable_token being NONE
             #
-            # If we have a virtualizable, we have to reset its
-            # 'vable_token' field afterwards
             if vinfo is not None:
                 virtualizable = args[index_of_virtualizable]
-                virtualizable = vinfo.cast_gcref_to_vtype(virtualizable)
-                vinfo.reset_vable_token(virtualizable)
+                vinfo.clear_vable_token(virtualizable)
+            
+            deadframe = func_execute_token(loop_token, *args)
             #
             # Record in the memmgr that we just ran this loop,
             # so that it will keep it alive for a longer time
                 fn = support.maybe_on_top_of_llinterp(rtyper, inline_ptr)
                 return fn(*greenargs)
         self.should_unroll_one_iteration = should_unroll_one_iteration
-        
+
         redargtypes = ''.join([kind[0] for kind in jd.red_args_types])
 
         def get_assembler_token(greenkey):