[pypy-commit] pypy stmgc-c7: More in-progress-ness
arigo
noreply at buildbot.pypy.org
Thu Mar 6 10:02:51 CET 2014
Author: Armin Rigo <arigo at tunes.org>
Branch: stmgc-c7
Changeset: r69751:1519a5a63ecf
Date: 2014-03-06 10:02 +0100
http://bitbucket.org/pypy/pypy/changeset/1519a5a63ecf/
Log: More in-progress-ness
diff --git a/rpython/memory/gc/stmgc.py b/rpython/memory/gc/stmgc.py
--- a/rpython/memory/gc/stmgc.py
+++ b/rpython/memory/gc/stmgc.py
@@ -38,14 +38,6 @@
malloc_zero_filled = True
#gcflag_extra = GCFLAG_EXTRA
- GCHDR = lltype.Struct(
- 'GCPTR',
- ('h_tid', lltype.Unsigned),
- ('h_revision', lltype.Signed),
- ('h_original', lltype.Unsigned))
- GCHDRP = lltype.Ptr(GCHDR)
- GCHDRSIZE = 3 * WORD
-
HDR = stmgcintf.GCPTR.TO
H_TID = 0
H_REVISION = WORD
diff --git a/rpython/translator/c/database.py b/rpython/translator/c/database.py
--- a/rpython/translator/c/database.py
+++ b/rpython/translator/c/database.py
@@ -68,8 +68,6 @@
return self.translator.config.translation.stm
def gettypedefnode(self, T, varlength=None):
- if self.with_stm():
- varlength = None
if varlength is None:
key = T
else:
@@ -102,8 +100,6 @@
return node
def gettype(self, T, varlength=None, who_asks=None, argnames=[]):
- if self.with_stm():
- varlength = None
if isinstance(T, Primitive) or T == GCREF:
return PrimitiveType[T]
elif isinstance(T, Typedef):
diff --git a/rpython/translator/c/genc.py b/rpython/translator/c/genc.py
--- a/rpython/translator/c/genc.py
+++ b/rpython/translator/c/genc.py
@@ -766,6 +766,13 @@
print >> f
print >> f, "#ifndef _PYPY_STRUCTDEF_H"
print >> f, "#define _PYPY_STRUCTDEF_H"
+ if database.with_stm():
+ print >> f
+ print >> f, 'typedef TLPREFIX struct rpyobj_s {'
+ print >> f, '\tstruct object_s lib;'
+ print >> f, '\tuint32_t tid;'
+ print >> f, '} rpyobj_t;'
+ print >> f
for node in structdeflist:
if hasattr(node, 'forward_decl'):
if node.forward_decl:
@@ -790,7 +797,7 @@
print >> f, "#endif"
def gen_preimpl(f, database):
- f.write('#ifndef _PY_PREIMPLE_H\n#define _PY_PREIMPL_H\n')
+ f.write('#ifndef _PY_PREIMPL_H\n#define _PY_PREIMPL_H\n')
if database.translator is None or database.translator.rtyper is None:
return
preimplementationlines = pre_include_code_lines(
diff --git a/rpython/translator/c/node.py b/rpython/translator/c/node.py
--- a/rpython/translator/c/node.py
+++ b/rpython/translator/c/node.py
@@ -43,33 +43,40 @@
Node.__init__(self, db)
self.dependencies = set()
+ def make_normalizedtypename(self):
+ if self.varlength is not None:
+ assert self.typetag == 'struct'
+ self.normalizedtypename = self.db.gettype(self.LLTYPE,
+ who_asks=self)
+ if not self.normalizedtypename.startswith('struct '):
+ assert self.db.with_stm()
+ assert self.normalizedtypename.endswith('_t @')
+ self.normalizedtypename = 'struct %s @' % (
+ self.normalizedtypename[:-4],)
+
def make_full_type_name(self):
if self.db.with_stm() and self.LLTYPE._gckind == 'gc':
assert self.typetag == 'struct'
self.fulltypename = '%s_t @' % (self.name,)
- if self.db.with_stm():
- tlprefix = ' TLPREFIX'
- else:
- tlprefix = ''
- self.forward_decl = 'typedef%s struct %s %s_t;' % (
- tlprefix, self.name, self.name)
+ self.forward_decl = 'typedef TLPREFIX struct %s %s_t;' % (
+ self.name, self.name)
else:
self.fulltypename = '%s %s @' % (self.typetag, self.name)
def getfieldtype(self, T, is_array=False):
+ if is_array:
+ varlength = self.varlength
+ else:
+ varlength = None
if self.db.with_stm():
if isinstance(T, GcStruct):
- node = self.db.gettypedefnode(T)
+ node = self.db.gettypedefnode(T, varlength=varlength)
self.dependencies.add(node)
return 'struct %s' % node.name
if isinstance(T, OpaqueType):
if T.hints.get("is_stm_header", False):
- return 'struct object_s @'
- if is_array:
- varlength = self.varlength
- else:
- varlength = None
- return self.db.gettype(T, varlength=self.varlength, who_asks=self)
+ return 'struct rpyobj_s @'
+ return self.db.gettype(T, varlength=varlength, who_asks=self)
class StructDefNode(NodeWithDependencies):
@@ -122,8 +129,7 @@
self.fields = []
db = self.db
STRUCT = self.STRUCT
- if self.varlength is not None:
- self.normalizedtypename = db.gettype(STRUCT, who_asks=self)
+ self.make_normalizedtypename()
if needs_gcheader(self.STRUCT):
HDR = db.gcpolicy.struct_gcheader_definition(self)
if HDR is not None:
@@ -245,8 +251,7 @@
db = self.db
ARRAY = self.ARRAY
self.gcinfo # force it to be computed
- if self.varlength is not None:
- self.normalizedtypename = db.gettype(ARRAY, who_asks=self)
+ self.make_normalizedtypename()
if needs_gcheader(ARRAY):
HDR = db.gcpolicy.array_gcheader_definition(self)
if HDR is not None:
@@ -527,9 +532,14 @@
def get_declaration(self):
if self.name[-2:] == '.b':
# xxx fish fish
- assert self.implementationtypename.startswith('struct ')
- assert self.implementationtypename.endswith(' @')
- uniontypename = 'union %su @' % self.implementationtypename[7:-2]
+ if self.implementationtypename.startswith('struct '):
+ assert self.implementationtypename.endswith(' @')
+ uniontypename = 'union %su @'%self.implementationtypename[7:-2]
+ else:
+ assert self.implementationtypename.endswith('_t @')
+ uniontypename = 'union %su @'%self.implementationtypename[:-4]
+ if self.db.with_stm():
+ uniontypename = 'TLPREFIX ' + uniontypename
return uniontypename, self.name[:-2]
else:
return self.implementationtypename, self.name
diff --git a/rpython/translator/stm/stmgcintf.py b/rpython/translator/stm/stmgcintf.py
--- a/rpython/translator/stm/stmgcintf.py
+++ b/rpython/translator/stm/stmgcintf.py
@@ -14,11 +14,11 @@
extern Signed pypy_stmcb_size(void*);
extern void pypy_stmcb_trace(void*, void(*)(void*));
-inline size_t stmcb_size(gcptr obj) {
+inline size_t stmcb_size(struct object_s *obj) {
return pypy_stmcb_size(obj);
}
-inline void stmcb_trace(gcptr obj, void visit(gcptr *)) {
+inline void stmcb_trace(struct object_s *obj, void visit(object_t **)) {
pypy_stmcb_trace(obj, (void(*)(void*))visit);
}
@@ -32,6 +32,7 @@
separate_module_sources = [separate_source],
)
-GCPTR = lltype.Ptr(rffi.COpaque('object_t', hints={"is_stm_header": True}))
+GCPTR = lltype.Ptr(rffi.COpaque('rpyobj_t',
+ hints={"is_stm_header": True}))
CALLBACK_TX = lltype.Ptr(lltype.FuncType([GCPTR, rffi.INT_real],
rffi.INT_real))
More information about the pypy-commit
mailing list