Author: Armin Rigo <[email protected]>
Branch: stmgc-c7
Changeset: r69797:f380d1adebbc
Date: 2014-03-08 12:13 +0100
http://bitbucket.org/pypy/pypy/changeset/f380d1adebbc/

Log:    Fixes. Now we enter the land of clang crashes.

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
@@ -772,7 +772,10 @@
         print >> f, '\tstruct object_s lib;'
         print >> f, '\tuint32_t tid;'
         print >> f, '} rpyobj_t;'
-        print >> f
+        print >> f, 'typedef TLPREFIX char rpygcchar_t;'
+    else:
+        print >> f, 'typedef char rpygcchar_t;'
+    print >> f
     for node in structdeflist:
         if hasattr(node, 'forward_decl'):
             if node.forward_decl:
diff --git a/rpython/translator/c/primitive.py 
b/rpython/translator/c/primitive.py
--- a/rpython/translator/c/primitive.py
+++ b/rpython/translator/c/primitive.py
@@ -237,7 +237,7 @@
     Bool:     'bool_t @',
     Void:     'void @',
     Address:  'void* @',
-    GCREF:    'rpy_gc_char *@',
+    GCREF:    'rpygcchar_t *@',
     }
 
 def define_c_primitive(ll_type, c_name, suffix=''):
diff --git a/rpython/translator/c/src/mem.h b/rpython/translator/c/src/mem.h
--- a/rpython/translator/c/src/mem.h
+++ b/rpython/translator/c/src/mem.h
@@ -12,13 +12,6 @@
 
 
 #ifdef RPY_STM
-typedef stm_char rpy_gc_char;
-#else
-typedef char rpy_gc_char;
-#endif
-
-
-#ifdef RPY_STM
 void _pypy_stm_free(void *);
 #define _OP_RAW_MALLOCED(r)         stm_call_on_abort(r, _pypy_stm_free)
 #define _OP_RAW_STM_UNREGISTER(r)   stm_call_on_abort(r, NULL)
diff --git a/rpython/translator/stm/funcgen.py 
b/rpython/translator/stm/funcgen.py
--- a/rpython/translator/stm/funcgen.py
+++ b/rpython/translator/stm/funcgen.py
@@ -61,8 +61,9 @@
     arg_size    = funcgen.expr(op.args[0])
     arg_type_id = funcgen.expr(op.args[1])
     result      = funcgen.expr(op.result)
-    return ('%s = stm_allocate(%s); ' % (result, arg_size) +
-            '((rpyobj_t *)%s)->type_id = %s;' % (result, arg_type_id))
+    # XXX NULL returns?
+    return ('%s = (rpygcchar_t *)stm_allocate(%s); ' % (result, arg_size) +
+            '((rpyobj_t *)%s)->tid = %s;' % (result, arg_type_id))
 
 def stm_get_from_obj(funcgen, op):
     assert op.args[0].concretetype == llmemory.GCREF
@@ -70,7 +71,8 @@
     arg_ofs = funcgen.expr(op.args[1])
     result  = funcgen.expr(op.result)
     resulttype = cdecl(funcgen.lltypename(op.result), '')
-    return '%s = *(%s *)(%s + %s);' % (result, resulttype, arg_obj, arg_ofs)
+    return '%s = *(TLPREFIX %s *)(%s + %s);' % (
+        result, resulttype, arg_obj, arg_ofs)
 
 stm_get_from_obj_const = stm_get_from_obj
 
@@ -80,7 +82,8 @@
     arg_ofs = funcgen.expr(op.args[1])
     arg_val = funcgen.expr(op.args[2])
     valtype = cdecl(funcgen.lltypename(op.args[2]), '')
-    return '*(%s *)(%s + %s) = %s;' % (valtype, arg_obj, arg_ofs, arg_val)
+    return '*(TLPREFIX %s *)(%s + %s) = %s;' % (
+        valtype, arg_obj, arg_ofs, arg_val)
 
 def stm_collect(funcgen, op):
     arg0 = funcgen.expr(op.args[0])
@@ -97,7 +100,7 @@
 def stm_addr_get_tid(funcgen, op):
     arg0   = funcgen.expr(op.args[0])
     result = funcgen.expr(op.result)
-    return '%s = ((struct rpyobj_s *)%s)->type_id;' % (result, arg0)
+    return '%s = ((struct rpyobj_s *)%s)->tid;' % (result, arg0)
 
 def stm_become_inevitable(funcgen, op):
     try:
_______________________________________________
pypy-commit mailing list
[email protected]
https://mail.python.org/mailman/listinfo/pypy-commit

Reply via email to