[pypy-commit] pypy llvm-translation-backend: Use GCTransformer's get_prebuilt_hash() method.

mjacob pypy.commits at gmail.com
Fri Feb 19 12:47:49 EST 2016


Author: Manuel Jacob <me at manueljacob.de>
Branch: llvm-translation-backend
Changeset: r82328:ee28a2e5145b
Date: 2016-02-17 00:56 +0100
http://bitbucket.org/pypy/pypy/changeset/ee28a2e5145b/

Log:	Use GCTransformer's get_prebuilt_hash() method.

diff --git a/rpython/translator/llvm/genllvm.py b/rpython/translator/llvm/genllvm.py
--- a/rpython/translator/llvm/genllvm.py
+++ b/rpython/translator/llvm/genllvm.py
@@ -98,7 +98,7 @@
         else:
             global_attrs += 'global'
 
-        hash_ = database.genllvm.gcpolicy.get_prebuilt_hash(obj)
+        hash_ = database.genllvm.gcpolicy.gctransformer.get_prebuilt_hash(obj)
         if hash_ is None:
             if self.varsize:
                 extra_len = self.get_extra_len(obj)
@@ -1653,9 +1653,6 @@
     def get_gc_fields(self):
         return [(database.get_type(self.gctransformer.HDR), '_gc_header')]
 
-    def get_prebuilt_hash(self, obj):
-        pass
-
     def finish(self):
         genllvm = self.genllvm
         while self.delayed_ptrs:
@@ -1696,23 +1693,10 @@
 
     def get_gc_field_values(self, obj):
         obj = lltype.top_container(obj)
-        needs_hash = self.get_prebuilt_hash(obj) is not None
+        needs_hash = self.gctransformer.get_prebuilt_hash(obj) is not None
         hdr = self.gctransformer.gc_header_for(obj, needs_hash)
         return [hdr._obj]
 
-    # from c backend
-    def get_prebuilt_hash(self, obj):
-        # for prebuilt objects that need to have their hash stored and
-        # restored.  Note that only structures that are StructNodes all
-        # the way have their hash stored (and not e.g. structs with var-
-        # sized arrays at the end).  'obj' must be the top_container.
-        TYPE = lltype.typeOf(obj)
-        if not isinstance(TYPE, lltype.GcStruct):
-            return None
-        if TYPE._is_varsize():
-            return None
-        return getattr(obj, '_hash_cache_', None)
-
 
 class RefcountGCPolicy(GCPolicy):
     class RttiType(FuncType):


More information about the pypy-commit mailing list