[pypy-commit] pypy ec-threadlocal: Fixes
arigo
noreply at buildbot.pypy.org
Sun Jun 22 18:08:14 CEST 2014
Author: Armin Rigo <arigo at tunes.org>
Branch: ec-threadlocal
Changeset: r72135:50f6c8e8814e
Date: 2014-06-22 18:07 +0200
http://bitbucket.org/pypy/pypy/changeset/50f6c8e8814e/
Log: Fixes
diff --git a/rpython/rlib/rthread.py b/rpython/rlib/rthread.py
--- a/rpython/rlib/rthread.py
+++ b/rpython/rlib/rthread.py
@@ -282,7 +282,9 @@
class ThreadLocalReference(object):
_COUNT = 1
OPAQUEID = lltype.OpaqueType("ThreadLocalRef",
- hints={"threadlocalref": True})
+ hints={"threadlocalref": True,
+ "external": "C",
+ "c_name": "RPyThreadStaticTLS"})
def __init__(self, Cls):
"NOT_RPYTHON: must be prebuilt"
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
@@ -969,7 +969,7 @@
return []
def initializationexpr(self, decoration=''):
- return ['{ NULL }']
+ return ['0']
def startupcode(self):
p = self.getptrname()
diff --git a/rpython/translator/c/src/g_include.h b/rpython/translator/c/src/g_include.h
--- a/rpython/translator/c/src/g_include.h
+++ b/rpython/translator/c/src/g_include.h
@@ -19,7 +19,6 @@
#include "src/address.h"
#include "src/unichar.h"
#include "src/llgroup.h"
-#include "src/threadlocal.h"
#include "src/instrument.h"
#include "src/asm.h"
diff --git a/rpython/translator/c/src/g_prerequisite.h b/rpython/translator/c/src/g_prerequisite.h
--- a/rpython/translator/c/src/g_prerequisite.h
+++ b/rpython/translator/c/src/g_prerequisite.h
@@ -23,3 +23,6 @@
# define RPY_LENGTH0 1 /* array decl [0] are bad */
# define RPY_DUMMY_VARLENGTH /* nothing */
#endif
+
+
+#include "src/threadlocal.h"
diff --git a/rpython/translator/c/src/threadlocal.h b/rpython/translator/c/src/threadlocal.h
--- a/rpython/translator/c/src/threadlocal.h
+++ b/rpython/translator/c/src/threadlocal.h
@@ -42,10 +42,8 @@
#endif
-struct pypy_opaque_ThreadLocalRef { void *gcref; };
-
-#define OP_THREADLOCALREF_SET(tlref, ptr, _) tlref->gcref = ptr
-#define OP_THREADLOCALREF_GET(tlref, ptr) ptr = tlref->gcref
+#define OP_THREADLOCALREF_SET(tlref, ptr, _) RPyThreadStaticTLS_Set(*tlref, ptr)
+#define OP_THREADLOCALREF_GET(tlref, ptr) ptr = RPyThreadStaticTLS_Get(*tlref)
#endif /* _SRC_THREADLOCAL_H */
More information about the pypy-commit
mailing list