Commits

Armin Rigo committed 1f0c599

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

Comments (0)

Files changed (5)

rpython/jit/backend/test/test_ll_random.py

         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)

rpython/jit/codewriter/heaptracker.py

-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
 
 
 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 = {}

rpython/jit/metainterp/optimizeopt/test/test_util.py

 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
 
         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)
 

rpython/jit/metainterp/virtualref.py

 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
         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)

rpython/rtyper/lltypesystem/rclass.py

         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):
                 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)