[pypy-commit] pypy jit-cleanup: Inline instanceOf() into its only caller and simplify

rlamy pypy.commits at gmail.com
Mon Apr 1 23:41:11 EDT 2019


Author: Ronan Lamy <ronan.lamy at gmail.com>
Branch: jit-cleanup
Changeset: r96403:49a109ff63cc
Date: 2019-04-02 04:40 +0100
http://bitbucket.org/pypy/pypy/changeset/49a109ff63cc/

Log:	Inline instanceOf() into its only caller and simplify

diff --git a/rpython/jit/metainterp/pyjitpl.py b/rpython/jit/metainterp/pyjitpl.py
--- a/rpython/jit/metainterp/pyjitpl.py
+++ b/rpython/jit/metainterp/pyjitpl.py
@@ -1352,9 +1352,9 @@
         last_exc_value = metainterp.last_exc_value
         assert last_exc_value
         assert metainterp.class_of_last_exc_is_const
-        if not metainterp.cpu.ts.instanceOf(
-                ConstPtr(lltype.cast_opaque_ptr(llmemory.GCREF, last_exc_value)),
-                vtablebox):
+        cls = llmemory.cast_adr_to_ptr(vtablebox.getaddr(), rclass.CLASSTYPE)
+        real_instance = rclass.ll_cast_to_object(last_exc_value)
+        if not rclass.ll_isinstance(real_instance, cls):
             self.pc = next_exc_target
 
     @arguments("box", "orgpc")
diff --git a/rpython/jit/metainterp/typesystem.py b/rpython/jit/metainterp/typesystem.py
--- a/rpython/jit/metainterp/typesystem.py
+++ b/rpython/jit/metainterp/typesystem.py
@@ -19,12 +19,6 @@
         cls = llmemory.cast_ptr_to_adr(obj.typeptr)
         return history.ConstInt(heaptracker.adr2int(cls))
 
-    def instanceOf(self, instbox, clsbox):
-        adr = clsbox.getaddr()
-        bounding_class = llmemory.cast_adr_to_ptr(adr, rclass.CLASSTYPE)
-        real_instance = instbox.getref(rclass.OBJECTPTR)
-        return rclass.ll_isinstance(real_instance, bounding_class)
-
     # A dict whose keys are refs (like the .value of BoxPtr).
     # It is an r_dict on lltype.  Two copies, to avoid conflicts with
     # the value type.  Note that NULL is not allowed as a key.


More information about the pypy-commit mailing list