[pypy-commit] pypy stmgc-c7: in-progress
arigo
noreply at buildbot.pypy.org
Sat Mar 8 12:01:56 CET 2014
Author: Armin Rigo <arigo at tunes.org>
Branch: stmgc-c7
Changeset: r69795:73a1beb10939
Date: 2014-03-08 10:42 +0100
http://bitbucket.org/pypy/pypy/changeset/73a1beb10939/
Log: 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
@@ -14,21 +14,9 @@
WORD = LONG_BIT // 8
NULL = llmemory.NULL
-first_gcflag = 1 << (LONG_BIT//2)
-
-def get_hdr_tid(addr):
- return llmemory.cast_adr_to_ptr(addr + StmGC.H_TID, rffi.SIGNEDP)
-
-def get_hdr_revision(addr):
- return llmemory.cast_adr_to_ptr(addr + StmGC.H_REVISION, rffi.SIGNEDP)
-
-def get_hdr_original(addr):
- return llmemory.cast_adr_to_ptr(addr + StmGC.H_ORIGINAL, rffi.SIGNEDP)
-
-
class StmGC(MovingGCBase):
_alloc_flavor_ = "raw"
inline_simple_malloc = True
@@ -51,34 +39,6 @@
TRANSLATION_PARAMS = {
}
- # keep in sync with stmgc.h & et.h:
- GCFLAG_OLD = first_gcflag << 0
- GCFLAG_VISITED = first_gcflag << 1
- GCFLAG_PUBLIC = first_gcflag << 2
- GCFLAG_PREBUILT_ORIGINAL = first_gcflag << 3
- GCFLAG_PUBLIC_TO_PRIVATE = first_gcflag << 4
- GCFLAG_WRITE_BARRIER = first_gcflag << 5 # stmgc.h
- GCFLAG_MOVED = first_gcflag << 6
- GCFLAG_BACKUP_COPY = first_gcflag << 7 # debug
- GCFLAG_STUB = first_gcflag << 8 # debug
- GCFLAG_PRIVATE_FROM_PROTECTED = first_gcflag << 9
- GCFLAG_HAS_ID = first_gcflag << 10
- GCFLAG_IMMUTABLE = first_gcflag << 11
- GCFLAG_SMALLSTUB = first_gcflag << 12
- GCFLAG_MARKED = first_gcflag << 13
-
- PREBUILT_FLAGS = first_gcflag * ((1<<0) | (1<<1) | (1<<2) | (1<<3) | (1<<13))
- PREBUILT_REVISION = r_uint(1)
-
- FX_MASK = 65535
-
- # keep in sync with nursery.h:
-
- # maximum size of object in nursery (is actually dependent on
- # nursery size, but this should work)
- GC_NURSERY_SECTION = 135168
-
-
def get_type_id(self, obj):
return llop.stm_get_tid(llgroup.HALFWORD, obj)
@@ -87,21 +47,8 @@
# we implement differently anyway. So directly call GCBase.setup().
GCBase.setup(self)
#
- llop.stm_initialize(lltype.Void)
+ llop.stm_setup(lltype.Void)
-
- def get_original_copy(self, obj):
- addr = llmemory.cast_ptr_to_adr(obj)
- if bool(get_hdr_tid(addr)[0] & StmGC.GCFLAG_PREBUILT_ORIGINAL):
- return obj
- #
- orig = get_hdr_original(addr)[0]
- if orig == 0:
- return obj
- #
- return llmemory.cast_adr_to_ptr(llmemory.cast_int_to_adr(orig),
- llmemory.GCREF)
-
def init_gc_object_immortal(self, addr, typeid16, flags=0):
assert flags == 0
assert isinstance(typeid16, llgroup.GroupMemberOffset)
@@ -142,12 +89,8 @@
def can_move(self, obj):
"""Means the reference will stay valid, except if not
seen by the GC, then it can get collected."""
- tid = get_hdr_tid(obj)[0]
- if bool(tid & StmGC.GCFLAG_OLD):
- return False # XXX wrong so far. We should add a flag to the
- # object that means "don't ever kill this copy"
- return True
-
+ return llop.stm_can_move(lltype.Bool, obj)
+
@classmethod
def JIT_max_size_of_young_obj(cls):
diff --git a/rpython/rtyper/lltypesystem/lloperation.py b/rpython/rtyper/lltypesystem/lloperation.py
--- a/rpython/rtyper/lltypesystem/lloperation.py
+++ b/rpython/rtyper/lltypesystem/lloperation.py
@@ -406,16 +406,12 @@
'cast_opaque_ptr': LLOp(sideeffects=False),
# __________ Software Transactional Memory __________
- # (Note that these operations could also be decomposed into individual
- # direct_calls and maybe several casts, but it looks less heavy-weight
- # to keep them as operations until the genc stage)
-
# NOTE: use canmallocgc for all operations that can contain a collection.
# that includes all that do 'BecomeInevitable' or otherwise contain
# possible GC safe-points! (also sync with stmframework.py)
# (some ops like stm_commit_transaction don't need it because there
# must be no gc-var access afterwards anyway)
- 'stm_initialize': LLOp(canmallocgc=True),
+ 'stm_setup': LLOp(),
'stm_finalize': LLOp(canmallocgc=True),
'stm_barrier': LLOp(sideeffects=False),
'stm_allocate': LLOp(sideeffects=False, canmallocgc=True),
@@ -463,6 +459,8 @@
'stm_ignored_start': LLOp(canrun=True),
'stm_ignored_stop': LLOp(canrun=True),
+ 'stm_can_move': LLOp(),
+
# __________ address operations __________
'boehm_malloc': LLOp(),
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
@@ -625,6 +625,8 @@
OP_JIT_STM_TRANSACTION_BREAK_POINT = _OP_STM
OP_JIT_STM_SHOULD_BREAK_TRANSACTION = _OP_STM
+ OP_STM_CAN_MOVE = _OP_STM
+
def OP_STM_IGNORED_START(self, op):
return '/* stm_ignored_start */'
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
@@ -187,7 +187,7 @@
def stm_get_tid(funcgen, op):
arg0 = funcgen.expr(op.args[0])
result = funcgen.expr(op.result)
- return '%s = stm_get_tid((gcptr)%s);' % (result, arg0)
+ return '%s = ((struct rpyobj_s*)%s)->tid;' % (result, arg0)
def stm_hash(funcgen, op):
arg0 = funcgen.expr(op.args[0])
@@ -265,6 +265,11 @@
def stm_major_collect(funcgen, op):
return 'stm_major_collect();'
+def stm_can_move(funcop, op):
+ arg0 = funcgen.expr(op.args[0])
+ result = funcgen.expr(op.result)
+ return '%s = stm_can_move(%s);' % (result, arg0)
+
def op_stm(funcgen, op):
func = globals()[op.opname]
diff --git a/rpython/translator/stm/writebarrier.py b/rpython/translator/stm/writebarrier.py
--- a/rpython/translator/stm/writebarrier.py
+++ b/rpython/translator/stm/writebarrier.py
@@ -370,6 +370,8 @@
def insert_stm_barrier(stmtransformer, graph):
+ return #XXX
+
"""This function uses the following characters for 'categories':
* 'A': any general pointer
More information about the pypy-commit
mailing list