Commits

Armin Rigo committed 1b41b4a

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

  • Participants
  • Parent commits 3c87c92
  • Branches shadowstack-perf

Comments (0)

Files changed (4)

File pypy/rpython/lltypesystem/lloperation.py

     '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(),

File pypy/rpython/memory/gctransform/shadowstack.py

                 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",

File pypy/translator/c/funcgen.py

 
     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

File pypy/translator/c/src/mem.h

 #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