[pypy-commit] pypy default: More places that need to be fixed for the new 'name' field type.

arigo noreply at buildbot.pypy.org
Wed Jul 9 19:08:06 CEST 2014


Author: Armin Rigo <arigo at tunes.org>
Branch: 
Changeset: r72405:2982c4350071
Date: 2014-07-09 19:07 +0200
http://bitbucket.org/pypy/pypy/changeset/2982c4350071/

Log:	More places that need to be fixed for the new 'name' field type.

diff --git a/rpython/jit/codewriter/assembler.py b/rpython/jit/codewriter/assembler.py
--- a/rpython/jit/codewriter/assembler.py
+++ b/rpython/jit/codewriter/assembler.py
@@ -248,7 +248,7 @@
             if isinstance(TYPE, lltype.FuncType):
                 name = value._obj._name
             elif TYPE == rclass.OBJECT_VTABLE:
-                name = ''.join(value.name).rstrip('\x00')
+                name = ''.join(value.name.chars)
             else:
                 return
             addr = llmemory.cast_ptr_to_adr(value)
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
+from rpython.rtyper.lltypesystem import lltype, llmemory, rclass, rstr
 from rpython.rlib.objectmodel import we_are_translated
 
 
@@ -66,11 +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.
-    namez = name + '\x00'
-    vtable.name = lltype.malloc(rclass.OBJECT_VTABLE.name.TO, len(namez),
-                                immortal=True)
-    for i in range(len(namez)):
-        vtable.name[i] = namez[i]
+    vtable.name = rstr.string_repr.convert_const(name)
     testing_gcstruct2vtable[GCSTRUCT] = vtable
 
 testing_gcstruct2vtable = {}


More information about the pypy-commit mailing list