[pypy-commit] pypy reflex-support: put elidable back on offset calculation for data members

wlav noreply at buildbot.pypy.org
Fri Aug 26 20:07:19 CEST 2011


Author: Wim Lavrijsen <WLavrijsen at lbl.gov>
Branch: reflex-support
Changeset: r46804:b7ca135edfec
Date: 2011-08-26 11:13 -0700
http://bitbucket.org/pypy/pypy/changeset/b7ca135edfec/

Log:	put elidable back on offset calculation for data members

diff --git a/pypy/module/cppyy/interp_cppyy.py b/pypy/module/cppyy/interp_cppyy.py
--- a/pypy/module/cppyy/interp_cppyy.py
+++ b/pypy/module/cppyy/interp_cppyy.py
@@ -311,8 +311,8 @@
     def is_static(self):
         return self.space.newbool(self._is_static)
 
-    def _get_offset(self, w_cppinstance):
-        cppinstance = self.space.interp_w(W_CPPInstance, w_cppinstance, can_be_None=True)
+    @jit.elidable_promote()
+    def _get_offset(self, cppinstance):
         if cppinstance:
             offset = self.offset + capi.c_base_offset(
                 cppinstance.cppclass.handle, self.scope_handle, cppinstance.rawobject)
@@ -321,11 +321,13 @@
         return offset
 
     def get(self, w_cppinstance, w_type):
-        offset = self._get_offset(w_cppinstance)
+        cppinstance = self.space.interp_w(W_CPPInstance, w_cppinstance, can_be_None=True)
+        offset = self._get_offset(cppinstance)
         return self.converter.from_memory(self.space, w_cppinstance, w_type, offset)
 
     def set(self, w_cppinstance, w_value):
-        offset = self._get_offset(w_cppinstance)
+        cppinstance = self.space.interp_w(W_CPPInstance, w_cppinstance, can_be_None=True)
+        offset = self._get_offset(cppinstance)
         self.converter.to_memory(self.space, w_cppinstance, w_value, offset)
         return self.space.w_None
 


More information about the pypy-commit mailing list