[pypy-commit] pypy shadowstack-perf: Temporarily add debugging aids. Should either be reverted or

arigo noreply at buildbot.pypy.org
Wed Jul 27 20:01:16 CEST 2011


Author: Armin Rigo <arigo at tunes.org>
Branch: shadowstack-perf
Changeset: r46026:1b41b4ab3600
Date: 2011-07-27 19:03 +0200
http://bitbucket.org/pypy/pypy/changeset/1b41b4ab3600/

Log:	Temporarily add debugging aids. Should either be reverted or made
	more official...

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
@@ -483,6 +483,9 @@
     'gc_dump_rpy_heap'    : LLOp(),
     'gc_typeids_z'        : LLOp(),
 
+    '_d_incr': LLOp(sideeffects=False),
+    '_d_decr': LLOp(sideeffects=False),
+
     # ------- JIT & GC interaction, only for some GCs ----------
 
     'gc_adr_of_nursery_free' : LLOp(),
diff --git a/pypy/rpython/memory/gctransform/shadowstack.py b/pypy/rpython/memory/gctransform/shadowstack.py
--- a/pypy/rpython/memory/gctransform/shadowstack.py
+++ b/pypy/rpython/memory/gctransform/shadowstack.py
@@ -393,12 +393,14 @@
                 llops.genop("direct_call", [gct.decr_stack_ptr, c_numcolors],
                             resulttype=llmemory.Address)
                 i = blocks_pop_roots[block]
+                llops.genop("_d_decr", [])
                 block.operations[i:i] = llops
                 # ^^^ important: done first, in case it's a startstop block,
                 #     otherwise the index in 'blocks_push_roots[block]' is
                 #     off by one
             if "start" in blockstate[block]:    # "start" or "startstop"
                 llops = LowLevelOpList()
+                llops.genop("_d_incr", [])
                 llops.genop("direct_call", [gct.incr_stack_ptr, c_numcolors],
                             resulttype=llmemory.Address)
                 top_addr = llops.genop("direct_call",
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
@@ -210,6 +210,7 @@
 
     def cfunction_body(self):
         graph = self.graph
+        yield 'void *dbg=0;'
         yield 'goto block0;'    # to avoid a warning "this label is not used"
 
         # generate the body of each block
diff --git a/pypy/translator/c/src/mem.h b/pypy/translator/c/src/mem.h
--- a/pypy/translator/c/src/mem.h
+++ b/pypy/translator/c/src/mem.h
@@ -246,3 +246,9 @@
 #define OP_GC_GET_RPY_TYPE_INDEX(x, r)   r = -1
 #define OP_GC_IS_RPY_INSTANCE(x, r)      r = 0
 #define OP_GC_DUMP_RPY_HEAP(fd, r)       r = 0
+
+
+
+
+#define OP__D_INCR(r)  assert(!dbg); dbg = (&pypy_g_pypy_rpython_memory_gctypelayout_GCData)->gcd_inst_root_stack_top
+#define OP__D_DECR(r)  assert(dbg==(&pypy_g_pypy_rpython_memory_gctypelayout_GCData)->gcd_inst_root_stack_top); dbg = 0


More information about the pypy-commit mailing list