[pypy-commit] pypy default: Reintroduce rclass.alloc_array_name() and revert some changes to use it again.

arigo noreply at buildbot.pypy.org
Wed Jul 9 19:56:21 CEST 2014


Author: Armin Rigo <arigo at tunes.org>
Branch: 
Changeset: r72407:1f0c59905c74
Date: 2014-07-09 19:55 +0200
http://bitbucket.org/pypy/pypy/changeset/1f0c59905c74/

Log:	Reintroduce rclass.alloc_array_name() and revert some changes to use
	it again.

diff --git a/rpython/jit/backend/test/test_ll_random.py b/rpython/jit/backend/test/test_ll_random.py
--- a/rpython/jit/backend/test/test_ll_random.py
+++ b/rpython/jit/backend/test/test_ll_random.py
@@ -112,7 +112,7 @@
         self.vtable_counter += 1
         S = self.get_random_structure_type(r, with_vtable=vtable, cache=False)
         name = S._name
-        vtable.name = rstr.string_repr.convert_const(name)
+        vtable.name = rclass.alloc_array_name(name)
         self.structure_types_and_vtables.append((S, vtable))
         #
         heaptracker.register_known_gctype(self.cpu, vtable, S)
diff --git a/rpython/jit/codewriter/heaptracker.py b/rpython/jit/codewriter/heaptracker.py
--- a/rpython/jit/codewriter/heaptracker.py
+++ b/rpython/jit/codewriter/heaptracker.py
@@ -1,4 +1,4 @@
-from rpython.rtyper.lltypesystem import lltype, llmemory, rclass, rstr
+from rpython.rtyper.lltypesystem import lltype, llmemory, rclass
 from rpython.rlib.objectmodel import we_are_translated
 
 
@@ -66,7 +66,7 @@
 def set_testing_vtable_for_gcstruct(GCSTRUCT, vtable, name):
     # only for tests that need to register the vtable of their malloc'ed
     # structures in case they are GcStruct inheriting from OBJECT.
-    vtable.name = rstr.string_repr.convert_const(name)
+    vtable.name = rclass.alloc_array_name(name)
     testing_gcstruct2vtable[GCSTRUCT] = vtable
 
 testing_gcstruct2vtable = {}
diff --git a/rpython/jit/metainterp/optimizeopt/test/test_util.py b/rpython/jit/metainterp/optimizeopt/test/test_util.py
--- a/rpython/jit/metainterp/optimizeopt/test/test_util.py
+++ b/rpython/jit/metainterp/optimizeopt/test/test_util.py
@@ -1,6 +1,6 @@
 import py, random
 
-from rpython.rtyper.lltypesystem import lltype, llmemory, rclass, rstr, rffi
+from rpython.rtyper.lltypesystem import lltype, llmemory, rclass, rffi
 from rpython.rtyper.lltypesystem.rclass import OBJECT, OBJECT_VTABLE
 from rpython.rtyper.rclass import FieldListAccessor, IR_QUASIIMMUTABLE
 
@@ -81,10 +81,10 @@
         return box.getref(rclass.OBJECTPTR).typeptr
 
     node_vtable = lltype.malloc(OBJECT_VTABLE, immortal=True)
-    node_vtable.name = rstr.string_repr.convert_const('node')
+    node_vtable.name = rclass.alloc_array_name('node')
     node_vtable_adr = llmemory.cast_ptr_to_adr(node_vtable)
     node_vtable2 = lltype.malloc(OBJECT_VTABLE, immortal=True)
-    node_vtable2.name = rstr.string_repr.convert_const('node2')
+    node_vtable2.name = rclass.alloc_array_name('node2')
     node_vtable_adr2 = llmemory.cast_ptr_to_adr(node_vtable2)
     cpu = runner.LLGraphCPU(None)
 
diff --git a/rpython/jit/metainterp/virtualref.py b/rpython/jit/metainterp/virtualref.py
--- a/rpython/jit/metainterp/virtualref.py
+++ b/rpython/jit/metainterp/virtualref.py
@@ -1,5 +1,5 @@
 from rpython.rtyper.rmodel import inputconst, log
-from rpython.rtyper.lltypesystem import lltype, llmemory, rclass, rstr
+from rpython.rtyper.lltypesystem import lltype, llmemory, rclass
 from rpython.jit.metainterp import history
 from rpython.jit.metainterp.virtualizable import TOKEN_NONE
 from rpython.jit.metainterp.virtualizable import TOKEN_TRACING_RESCALL
@@ -19,7 +19,7 @@
         self.jit_virtual_ref_vtable = lltype.malloc(rclass.OBJECT_VTABLE,
                                                     zero=True, flavor='raw',
                                                     immortal=True)
-        self.jit_virtual_ref_vtable.name = rstr.string_repr.convert_const(
+        self.jit_virtual_ref_vtable.name = rclass.alloc_array_name(
             'jit_virtual_ref')
         # build some constants
         adr = llmemory.cast_ptr_to_adr(self.jit_virtual_ref_vtable)
diff --git a/rpython/rtyper/lltypesystem/rclass.py b/rpython/rtyper/lltypesystem/rclass.py
--- a/rpython/rtyper/lltypesystem/rclass.py
+++ b/rpython/rtyper/lltypesystem/rclass.py
@@ -90,6 +90,9 @@
         vtable = vtable.super
     return vtable
 
+def alloc_array_name(name):
+    return rstr.string_repr.convert_const(name)
+
 
 class ClassRepr(AbstractClassRepr):
     def __init__(self, rtyper, classdef):
@@ -197,7 +200,7 @@
                 name = 'object'
             else:
                 name = rsubcls.classdef.shortname
-            vtable.name = rstr.string_repr.convert_const(name)
+            vtable.name = alloc_array_name(name)
             if hasattr(rsubcls.classdef, 'my_instantiate_graph'):
                 graph = rsubcls.classdef.my_instantiate_graph
                 vtable.instantiate = self.rtyper.getcallable(graph)


More information about the pypy-commit mailing list