Author: Armin Rigo <[email protected]>
Branch: stmgc-c7
Changeset: r70087:9846f4e476df
Date: 2014-03-19 10:50 +0100
http://bitbucket.org/pypy/pypy/changeset/9846f4e476df/
Log: tweaks
diff --git a/rpython/memory/gctransform/stmframework.py
b/rpython/memory/gctransform/stmframework.py
--- a/rpython/memory/gctransform/stmframework.py
+++ b/rpython/memory/gctransform/stmframework.py
@@ -71,7 +71,12 @@
v_struct = hop.spaceop.args[0]
assert opname in ('setfield', 'setarrayitem', 'setinteriorfield',
'raw_store')
- if var_needsgc(v_struct) and hop.spaceop not in self.clean_sets:
+ if not var_needsgc(v_struct):
+ if (var_needsgc(hop.spaceop.args[-1]) and
+ 'is_excdata' not in
hop.spaceop.args[0].concretetype.TO._hints):
+ raise Exception("%s: GC pointer written into a non-GC location"
+ % (hop.spaceop,))
+ elif hop.spaceop not in self.clean_sets:
if self.in_stm_ignored:
# detect if we're inside a 'stm_ignored' block and in
# that case don't call stm_write(). This only works for
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
@@ -906,6 +906,13 @@
**cur = stm_setup_prebuilt(**cur);
}
}
+
+void pypy_stm_register_thread_local(void)
+{
+ stm_register_thread_local(&stm_thread_local);
+ stm_thread_local.mem_clear_on_abort = &pypy_g_ExcData;
+ stm_thread_local.mem_bytes_to_clear_on_abort = sizeof(pypy_g_ExcData);
+}
'''
def commondefs(defines):
diff --git a/rpython/translator/exceptiontransform.py
b/rpython/translator/exceptiontransform.py
--- a/rpython/translator/exceptiontransform.py
+++ b/rpython/translator/exceptiontransform.py
@@ -464,7 +464,8 @@
('exc_type', self.lltype_of_exception_type),
('exc_value', self.lltype_of_exception_value),
hints={'stm_thread_local': True,
- 'stm_dont_track_raw_accesses':True})
+ 'stm_dont_track_raw_accesses':True,
+ 'is_excdata': True})
self.EXCDATA = EXCDATA
exc_data = lltype.malloc(EXCDATA, immortal=True)
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
@@ -44,10 +44,7 @@
def stm_register_thread_local(funcgen, op):
- return (
- 'stm_register_thread_local(&stm_thread_local);\n\t'
- 'stm_thread_local.mem_clear_on_abort = &pypy_g_ExcData;\n\t'
- 'stm_thread_local.mem_bytes_to_clear_on_abort = sizeof(pypy_g_ExcData);')
+ return 'pypy_stm_register_thread_local();'
def stm_unregister_thread_local(funcgen, op):
return 'stm_unregister_thread_local(&stm_thread_local);'
diff --git a/rpython/translator/stm/src_stm/stmgcintf.c
b/rpython/translator/stm/src_stm/stmgcintf.c
--- a/rpython/translator/stm/src_stm/stmgcintf.c
+++ b/rpython/translator/stm/src_stm/stmgcintf.c
@@ -48,7 +48,7 @@
void pypy_stm_setup(void)
{
stm_setup();
- stm_register_thread_local(&stm_thread_local);
+ pypy_stm_register_thread_local();
pypy_stm_ready_atomic = 1;
pypy_stm_set_transaction_length(100);
pypy_stm_start_inevitable_if_not_atomic();
@@ -59,7 +59,7 @@
if (pypy_stm_ready_atomic == 0) {
/* first time we see this thread */
int e = errno;
- stm_register_thread_local(&stm_thread_local);
+ pypy_stm_register_thread_local();
errno = e;
pypy_stm_ready_atomic = 1;
pypy_stm_start_inevitable_if_not_atomic();
diff --git a/rpython/translator/stm/src_stm/stmgcintf.h
b/rpython/translator/stm/src_stm/stmgcintf.h
--- a/rpython/translator/stm/src_stm/stmgcintf.h
+++ b/rpython/translator/stm/src_stm/stmgcintf.h
@@ -13,7 +13,8 @@
extern __thread uintptr_t pypy_stm_nursery_low_fill_mark;
void pypy_stm_setup(void);
-void pypy_stm_setup_prebuilt(void); /* generated into stm_prebuilt.c */
+void pypy_stm_setup_prebuilt(void); /* generated into stm_prebuilt.c */
+void pypy_stm_register_thread_local(void); /* generated into stm_prebuilt.c */
static inline void pypy_stm_commit_if_not_atomic(void) {
int e = errno;
_______________________________________________
pypy-commit mailing list
[email protected]
https://mail.python.org/mailman/listinfo/pypy-commit