Author: Armin Rigo <[email protected]>
Branch:
Changeset: r46474:9741bff7ba67
Date: 2011-08-13 11:38 +0200
http://bitbucket.org/pypy/pypy/changeset/9741bff7ba67/
Log: Add a debugging check earlier, to make it easier to track errors in
asmgcc.
diff --git a/pypy/rpython/lltypesystem/lloperation.py
b/pypy/rpython/lltypesystem/lloperation.py
--- a/pypy/rpython/lltypesystem/lloperation.py
+++ b/pypy/rpython/lltypesystem/lloperation.py
@@ -561,6 +561,7 @@
'debug_catch_exception': LLOp(),
'debug_reraise_traceback': LLOp(),
'debug_print_traceback': LLOp(),
+ 'debug_nonnull_pointer': LLOp(canrun=True),
# __________ instrumentation _________
'instrument_count': LLOp(),
diff --git a/pypy/rpython/lltypesystem/opimpl.py
b/pypy/rpython/lltypesystem/opimpl.py
--- a/pypy/rpython/lltypesystem/opimpl.py
+++ b/pypy/rpython/lltypesystem/opimpl.py
@@ -526,6 +526,9 @@
def op_have_debug_prints():
return debug.have_debug_prints()
+def op_debug_nonnull_pointer(x):
+ assert x
+
def op_gc_stack_bottom():
pass # marker for trackgcroot.py
diff --git a/pypy/rpython/memory/gc/minimark.py
b/pypy/rpython/memory/gc/minimark.py
--- a/pypy/rpython/memory/gc/minimark.py
+++ b/pypy/rpython/memory/gc/minimark.py
@@ -1699,8 +1699,8 @@
#
# Add the roots from the other sources.
self.root_walker.walk_roots(
- MiniMarkGC._collect_ref, # stack roots
- MiniMarkGC._collect_ref, # static in prebuilt non-gc structures
+ MiniMarkGC._collect_ref_stk, # stack roots
+ MiniMarkGC._collect_ref_stk, # static in prebuilt non-gc structures
None) # we don't need the static in all prebuilt gc objects
#
# If we are in an inner collection caused by a call to a finalizer,
@@ -1717,8 +1717,10 @@
def _collect_obj(obj, objects_to_trace):
objects_to_trace.append(obj)
- def _collect_ref(self, root):
- self.objects_to_trace.append(root.address[0])
+ def _collect_ref_stk(self, root):
+ obj = root.address[0]
+ llop.debug_nonnull_pointer(lltype.Void, obj)
+ self.objects_to_trace.append(obj)
def _collect_ref_rec(self, root, ignored):
self.objects_to_trace.append(root.address[0])
diff --git a/pypy/translator/c/funcgen.py b/pypy/translator/c/funcgen.py
--- a/pypy/translator/c/funcgen.py
+++ b/pypy/translator/c/funcgen.py
@@ -823,6 +823,11 @@
cdecl(typename, ''))
return result
+ def OP_DEBUG_NONNULL_POINTER(self, op):
+ expr = self.expr(op.args[0])
+ return 'if ((-8192 <= (long)%s) && (((long)%s) < 8192)) abort();' % (
+ expr, expr)
+
def OP_INSTRUMENT_COUNT(self, op):
counter_label = op.args[1].value
self.db.instrument_ncounter = max(self.db.instrument_ncounter,
_______________________________________________
pypy-commit mailing list
[email protected]
http://mail.python.org/mailman/listinfo/pypy-commit