From 4aaa844b8b749d9fe55727dc47224d972c60ea40 Mon Sep 17 00:00:00 2001 From: Luke Gorrie Date: Fri, 28 Jul 2017 10:01:18 +0000 Subject: [PATCH 1/2] lj_jit.h: Save 'parent' and 'exitno' fields in GCtrace For debugging purposes it is very useful to be able to refer to the origin of a trace (parent/exit) and so this change stores that information persistently in GCtrace instead of only ephemerally in jit_State. These fields are now duplicated in jit_State (valid while recording) and GCtrace (valid after recording.) This duplication could be avoided by putting them only in GCtrace and accessing them via J->cur but this would be a more noisy change since the existing fields are accessed from many places including DynASM macros. --- src/lj_jit.h | 2 ++ src/lj_trace.c | 2 ++ 2 files changed, 4 insertions(+) diff --git a/src/lj_jit.h b/src/lj_jit.h index b3408e9bb2..8a522973bb 100644 --- a/src/lj_jit.h +++ b/src/lj_jit.h @@ -199,6 +199,8 @@ typedef struct GCtrace { TraceNo1 root; /* Root trace of side trace (or 0 for root traces). */ TraceNo1 nextroot; /* Next root trace for same prototype. */ TraceNo1 nextside; /* Next side trace of same root trace. */ + TraceNo1 parent; /* Parent of this trace (or 0 for root traces). */ + ExitNo exitno; /* Exit number in parent (valid for side-traces only). */ uint8_t sinktags; /* Trace has SINK tags. */ uint8_t unused1; } GCtrace; diff --git a/src/lj_trace.c b/src/lj_trace.c index 0b674ec276..99c49fa0a9 100644 --- a/src/lj_trace.c +++ b/src/lj_trace.c @@ -109,6 +109,8 @@ static void trace_save(jit_State *J, GCtrace *T) size_t szins = (J->cur.nins-J->cur.nk)*sizeof(IRIns); char *p = (char *)T + sztr; memcpy(T, &J->cur, sizeof(GCtrace)); + T->parent = J->parent; + T->exitno = J->exitno; setgcrefr(T->nextgc, J2G(J)->gc.root); setgcrefp(J2G(J)->gc.root, T); newwhite(J2G(J), T); From fcf7053ddd8da467b90038f499cc8eb21e75c672 Mon Sep 17 00:00:00 2001 From: Luke Gorrie Date: Fri, 28 Jul 2017 10:23:51 +0000 Subject: [PATCH 2/2] check-generated-code.nix: Add more verbosity Just to be clear about what is actually being checked. --- check-generated-code.nix | 2 ++ 1 file changed, 2 insertions(+) diff --git a/check-generated-code.nix b/check-generated-code.nix index 46efe67f84..78ff51b2f8 100644 --- a/check-generated-code.nix +++ b/check-generated-code.nix @@ -11,8 +11,10 @@ overrideDerivation raptorjit (as: { checkPhase = '' for f in ${generatedFiles}; do + echo "checking $f.." diff -u src/reusevm/$f src/$f done + echo "all files ok" ''; doCheck = true; })