Author: Armin Rigo <[email protected]>
Branch: stmgc-c4
Changeset: r65104:a35b41057209
Date: 2013-06-29 20:23 +0200
http://bitbucket.org/pypy/pypy/changeset/a35b41057209/
Log: always in-progress
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,19 +38,23 @@
hdr._obj.typeid16 = typeid16
hdr._obj.prebuilt_hash = prebuilt_hash
- def malloc_fixedsize_clear(self, typeid, size,
+ def malloc_fixedsize_clear(self, typeid16, size,
needs_finalizer=False,
is_finalizer_light=False,
contains_weakptr=False):
ll_assert(not needs_finalizer, 'XXX')
ll_assert(not is_finalizer_light, 'XXX')
ll_assert(not contains_weakptr, 'XXX')
- return llop.stm_allocate(llmemory.GCREF, size, typeid)
+ # XXX call optimized versions, e.g. if size < GC_NURSERY_SECTION
+ return llop.stm_allocate(llmemory.GCREF, size, typeid16)
- def malloc_varsize_clear(self, typeid, length, size, itemsize,
+ def malloc_varsize_clear(self, typeid16, length, size, itemsize,
offset_to_length):
- ll_assert(False, 'XXX')
- return llop.stm_allocate(llmemory.GCREF)
+ # XXX be careful about overflows, and call optimized versions
+ totalsize = size + itemsize * length
+ obj = llop.stm_allocate(llmemory.Address, typeid16, totalsize)
+ (obj + offset_to_length).signed[0] = length
+ return llmemory.cast_adr_to_ptr(obj, llmemory.GCREF)
def collect(self, gen=1):
"""Do a minor (gen=0) or major (gen>0) collection."""
diff --git a/rpython/translator/c/funcgen.py b/rpython/translator/c/funcgen.py
--- a/rpython/translator/c/funcgen.py
+++ b/rpython/translator/c/funcgen.py
@@ -584,16 +584,12 @@
from rpython.translator.stm.funcgen import op_stm
self.__class__.op_stm = op_stm
return self.op_stm(op)
- OP_STM_START_TRANSACTION = _OP_STM
- OP_STM_STOP_TRANSACTION = _OP_STM
OP_STM_BECOME_INEVITABLE = _OP_STM
OP_STM_BARRIER = _OP_STM
OP_STM_PTR_EQ = _OP_STM
- OP_STM_ABORT_INFO_PUSH = _OP_STM
- OP_STM_EXTRAREF_LLCOUNT = _OP_STM
- OP_STM_EXTRAREF_LLADDR = _OP_STM
OP_STM_PUSH_ROOT = _OP_STM
OP_STM_POP_ROOT_INTO = _OP_STM
+ OP_STM_ALLOCATE = _OP_STM
def OP_PTR_NONZERO(self, op):
diff --git a/rpython/translator/c/src/debug_print.c
b/rpython/translator/c/src/debug_print.c
--- a/rpython/translator/c/src/debug_print.c
+++ b/rpython/translator/c/src/debug_print.c
@@ -135,10 +135,10 @@
debug_stop_colors);
}
-typedef Unsigned revision_t;
#ifdef RPY_STM
# include <src_stm/atomic_ops.h>
#else
+ typedef long revision_t;
# define bool_cas(vp, o, n) (*(vp)=(n), 1)
#endif
static volatile revision_t threadcounter = 0;
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
@@ -57,7 +57,6 @@
funcname, arg)
def stm_ptr_eq(funcgen, op):
- xxx
arg0 = funcgen.expr(op.args[0])
arg1 = funcgen.expr(op.args[1])
result = funcgen.expr(op.result)
@@ -71,32 +70,6 @@
string_literal = c_string_constant(info)
return 'stm_become_inevitable(%s);' % (string_literal,)
-##def stm_jit_invoke_code(funcgen, op):
-## return funcgen.OP_DIRECT_CALL(op)
-
-def stm_abort_info_push(funcgen, op):
- xxx
- arg0 = funcgen.expr(op.args[0])
- arg1 = funcgen.expr(op.args[1])
- return 'stm_abort_info_push(%s, %s);' % (arg0, arg1)
-
-def stm_extraref_llcount(funcgen, op):
- xxx
- result = funcgen.expr(op.result)
- return '%s = stm_extraref_llcount();' % (result,)
-
-def stm_extraref_lladdr(funcgen, op):
- xxx
- arg0 = funcgen.expr(op.args[0])
- result = funcgen.expr(op.result)
- return '%s = (char *)stm_extraref_lladdr(%s);' % (result, arg0)
-
-def _stm_nogc_init_function():
- """Called at process start-up when running with no GC."""
- xxx
- StmOperations.descriptor_init()
- StmOperations.begin_inevitable_transaction()
-
def stm_push_root(funcgen, op):
arg0 = funcgen.expr(op.args[0])
return 'stm_push_root((gcptr)%s);' % (arg0,)
@@ -106,6 +79,12 @@
return '%s = (%s)stm_pop_root();' % (
arg0, cdecl(funcgen.lltypename(op.args[0]), ''))
+def stm_allocate(funcgen, op):
+ arg0 = funcgen.expr(op.args[0])
+ arg1 = funcgen.expr(op.args[1])
+ result = funcgen.expr(op.result)
+ return '%s = stm_allocate(%s, %s);' % (result, arg0, arg1)
+
def op_stm(funcgen, op):
func = globals()[op.opname]
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
@@ -8,4 +8,5 @@
eci = ExternalCompilationInfo(
include_dirs = [cdir, cdir2],
includes = ['src_stm/stmgc.h'],
+ pre_include_bits = ['#define RPY_STM 1'],
)
_______________________________________________
pypy-commit mailing list
[email protected]
http://mail.python.org/mailman/listinfo/pypy-commit