fix paths shown in error stacktraces
This commit is contained in:
parent
7bf379a44e
commit
a3a9403b59
13
src/load.c
13
src/load.c
@ -127,12 +127,13 @@ HArr* comps_curr;
|
|||||||
|
|
||||||
B rt_undo, rt_select, rt_slash, rt_insert, rt_depth,
|
B rt_undo, rt_select, rt_slash, rt_insert, rt_depth,
|
||||||
rt_group, rt_under, rt_find;
|
rt_group, rt_under, rt_find;
|
||||||
Block* load_buildBlock(B x, B src, B path, Scope* sc, i32 nsResult) { // consumes x,src
|
Block* load_buildBlock(B x, B src, B path, B name, Scope* sc, i32 nsResult) { // consumes x,src
|
||||||
|
B fullpath = q_N(name)? inc(path) : q_N(path)? inc(name) : path_rel(path, inc(name), "(load_buildBlock)");
|
||||||
SGet(x)
|
SGet(x)
|
||||||
usz xia = IA(x);
|
usz xia = IA(x);
|
||||||
if (xia!=6 & xia!=4) thrM("load_buildBlock: bad item count");
|
if (xia!=6 & xia!=4) thrM("load_buildBlock: bad item count");
|
||||||
Block* r = xia==6? compileAll(Get(x,0),Get(x,1),Get(x,2),Get(x,3),Get(x,4),Get(x,5), src, inc(path), sc, nsResult)
|
Block* r = xia==6? compileAll(Get(x,0),Get(x,1),Get(x,2),Get(x,3),Get(x,4),Get(x,5), src, fullpath, sc, nsResult)
|
||||||
: compileAll(Get(x,0),Get(x,1),Get(x,2),Get(x,3),bi_N, bi_N, src, inc(path), sc, nsResult);
|
: compileAll(Get(x,0),Get(x,1),Get(x,2),Get(x,3),bi_N, bi_N, src, fullpath, sc, nsResult);
|
||||||
decG(x);
|
decG(x);
|
||||||
return r;
|
return r;
|
||||||
}
|
}
|
||||||
@ -170,7 +171,7 @@ void switchComp(void) {
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
B compObj_c1(B t, B x) {
|
B compObj_c1(B t, B x) {
|
||||||
return evalFunBlockConsume(load_buildBlock(x, bi_N, bi_N, NULL, 0));
|
return evalFunBlockConsume(load_buildBlock(x, bi_N, bi_N, bi_N, NULL, 0));
|
||||||
}
|
}
|
||||||
B compObj_c2(B t, B w, B x) {
|
B compObj_c2(B t, B w, B x) {
|
||||||
change_def_comp(x);
|
change_def_comp(x);
|
||||||
@ -214,7 +215,7 @@ static NOINLINE Block* bqn_compc(B str, B state, B re) { // consumes str,state
|
|||||||
str = chr_squeeze(str);
|
str = chr_squeeze(str);
|
||||||
COMPS_PUSH(str, state, re);
|
COMPS_PUSH(str, state, re);
|
||||||
B* o = harr_ptr(re);
|
B* o = harr_ptr(re);
|
||||||
Block* r = load_buildBlock(c2G(o[re_comp], incG(o[re_compOpts]), inc(str)), str, COMPS_CREF(path), NULL, 0);
|
Block* r = load_buildBlock(c2G(o[re_comp], incG(o[re_compOpts]), inc(str)), str, COMPS_CREF(path), COMPS_CREF(name), NULL, 0);
|
||||||
COMPS_POP; popCatch();
|
COMPS_POP; popCatch();
|
||||||
return r;
|
return r;
|
||||||
}
|
}
|
||||||
@ -238,7 +239,7 @@ Block* bqn_compScc(B str, B state, B re, Scope* sc, bool loose, bool noNS) {
|
|||||||
csc = csc->psc;
|
csc = csc->psc;
|
||||||
depth++;
|
depth++;
|
||||||
}
|
}
|
||||||
Block* r = load_buildBlock(c2G(o[re_comp], m_lvB_4(incG(o[re_rt]), incG(bi_sys), vName, vDepth), inc(str)), str, COMPS_CREF(path), sc, sc!=NULL? (noNS? -1 : 1) : 0);
|
Block* r = load_buildBlock(c2G(o[re_comp], m_lvB_4(incG(o[re_rt]), incG(bi_sys), vName, vDepth), inc(str)), str, COMPS_CREF(path), COMPS_CREF(name), sc, sc!=NULL? (noNS? -1 : 1) : 0);
|
||||||
COMPS_POP; popCatch();
|
COMPS_POP; popCatch();
|
||||||
return r;
|
return r;
|
||||||
}
|
}
|
||||||
|
|||||||
2
src/ns.c
2
src/ns.c
@ -112,7 +112,7 @@ Body* m_nnsDescF(i32 n, char** names) {
|
|||||||
Comp* comp = mm_alloc(sizeof(Comp), t_comp);
|
Comp* comp = mm_alloc(sizeof(Comp), t_comp);
|
||||||
comp->indices = bi_N;
|
comp->indices = bi_N;
|
||||||
comp->src = bi_N;
|
comp->src = bi_N;
|
||||||
comp->path = bi_N;
|
comp->fullpath = bi_N;
|
||||||
comp->objs = c(HArr, emptyHVec());
|
comp->objs = c(HArr, emptyHVec());
|
||||||
comp->blockAm = 0;
|
comp->blockAm = 0;
|
||||||
comp->nameList = HARR_FV(nl);
|
comp->nameList = HARR_FV(nl);
|
||||||
|
|||||||
18
src/vm.c
18
src/vm.c
@ -453,7 +453,7 @@ Block* compileBlock(B block, Comp* comp, bool* bDone, u32* bc, usz bcIA, B allBl
|
|||||||
|
|
||||||
// consumes all; assumes arguments are valid (verifies some stuff, but definitely not everything)
|
// consumes all; assumes arguments are valid (verifies some stuff, but definitely not everything)
|
||||||
// if sc isn't NULL, this block must only be evaluated directly in that scope precisely once
|
// if sc isn't NULL, this block must only be evaluated directly in that scope precisely once
|
||||||
NOINLINE Block* compileAll(B bcq, B objs, B allBlocks, B allBodies, B indices, B tokenInfo, B src, B path, Scope* sc, i32 nsResult) {
|
NOINLINE Block* compileAll(B bcq, B objs, B allBlocks, B allBodies, B indices, B tokenInfo, B src, B fullpath, Scope* sc, i32 nsResult) {
|
||||||
usz bIA = IA(allBlocks);
|
usz bIA = IA(allBlocks);
|
||||||
I32Arr* bca = toI32Arr(bcq);
|
I32Arr* bca = toI32Arr(bcq);
|
||||||
u32* bc = (u32*)bca->a;
|
u32* bc = (u32*)bca->a;
|
||||||
@ -462,7 +462,7 @@ NOINLINE Block* compileAll(B bcq, B objs, B allBlocks, B allBodies, B indices, B
|
|||||||
NOGC_S;
|
NOGC_S;
|
||||||
comp->indices = indices;
|
comp->indices = indices;
|
||||||
comp->src = src;
|
comp->src = src;
|
||||||
comp->path = path;
|
comp->fullpath = fullpath;
|
||||||
B nameList;
|
B nameList;
|
||||||
if (q_N(tokenInfo)) {
|
if (q_N(tokenInfo)) {
|
||||||
nameList = emptyHVec();
|
nameList = emptyHVec();
|
||||||
@ -1088,7 +1088,7 @@ DEF_FREE(block) {
|
|||||||
i32 am = c->bodyCount;
|
i32 am = c->bodyCount;
|
||||||
for (i32 i = 0; i < am; i++) ptr_decR(c->bodies[i]);
|
for (i32 i = 0; i < am; i++) ptr_decR(c->bodies[i]);
|
||||||
}
|
}
|
||||||
DEF_FREE(comp) { Comp* c = (Comp *)x; if (c->objs!=NULL) ptr_decR(c->objs); decR(c->src); decR(c->indices); decR(c->path); decR(c->nameList); }
|
DEF_FREE(comp) { Comp* c = (Comp *)x; if (c->objs!=NULL) ptr_decR(c->objs); decR(c->src); decR(c->indices); decR(c->fullpath); decR(c->nameList); }
|
||||||
DEF_FREE(funBl) { FunBlock* c = (FunBlock*)x; ptr_dec(c->sc); ptr_decR(c->bl); }
|
DEF_FREE(funBl) { FunBlock* c = (FunBlock*)x; ptr_dec(c->sc); ptr_decR(c->bl); }
|
||||||
DEF_FREE(md1Bl) { Md1Block* c = (Md1Block*)x; ptr_dec(c->sc); ptr_decR(c->bl); }
|
DEF_FREE(md1Bl) { Md1Block* c = (Md1Block*)x; ptr_dec(c->sc); ptr_decR(c->bl); }
|
||||||
DEF_FREE(md2Bl) { Md2Block* c = (Md2Block*)x; ptr_dec(c->sc); ptr_decR(c->bl); }
|
DEF_FREE(md2Bl) { Md2Block* c = (Md2Block*)x; ptr_dec(c->sc); ptr_decR(c->bl); }
|
||||||
@ -1122,7 +1122,7 @@ void block_visit(Value* x) {
|
|||||||
i32 am = c->bodyCount;
|
i32 am = c->bodyCount;
|
||||||
for (i32 i = 0; i < am; i++) mm_visitP(c->bodies[i]);
|
for (i32 i = 0; i < am; i++) mm_visitP(c->bodies[i]);
|
||||||
}
|
}
|
||||||
void comp_visit(Value* x) { Comp* c = (Comp *)x; if (c->objs!=NULL) mm_visitP(c->objs); mm_visit(c->src); mm_visit(c->indices); mm_visit(c->path); mm_visit(c->nameList); }
|
void comp_visit(Value* x) { Comp* c = (Comp *)x; if (c->objs!=NULL) mm_visitP(c->objs); mm_visit(c->src); mm_visit(c->indices); mm_visit(c->fullpath); mm_visit(c->nameList); }
|
||||||
void funBl_visit(Value* x) { FunBlock* c = (FunBlock*)x; mm_visitP(c->sc); mm_visitP(c->bl); }
|
void funBl_visit(Value* x) { FunBlock* c = (FunBlock*)x; mm_visitP(c->sc); mm_visitP(c->bl); }
|
||||||
void md1Bl_visit(Value* x) { Md1Block* c = (Md1Block*)x; mm_visitP(c->sc); mm_visitP(c->bl); }
|
void md1Bl_visit(Value* x) { Md1Block* c = (Md1Block*)x; mm_visitP(c->sc); mm_visitP(c->bl); }
|
||||||
void md2Bl_visit(Value* x) { Md2Block* c = (Md2Block*)x; mm_visitP(c->sc); mm_visitP(c->bl); }
|
void md2Bl_visit(Value* x) { Md2Block* c = (Md2Block*)x; mm_visitP(c->sc); mm_visitP(c->bl); }
|
||||||
@ -1371,7 +1371,7 @@ NOINLINE void vm_printPos(Comp* comp, i32 bcPos, i64 pos) {
|
|||||||
#endif
|
#endif
|
||||||
if (CATCH) { freeThrown(); goto native_print; }
|
if (CATCH) { freeThrown(); goto native_print; }
|
||||||
|
|
||||||
B msg = vm_fmtPoint(src, emptyCVec(), comp->path, cs, ce);
|
B msg = vm_fmtPoint(src, emptyCVec(), comp->fullpath, cs, ce);
|
||||||
fprintsB(stderr, msg);
|
fprintsB(stderr, msg);
|
||||||
dec(msg);
|
dec(msg);
|
||||||
fputc('\n', stderr);
|
fputc('\n', stderr);
|
||||||
@ -1557,7 +1557,7 @@ usz profiler_getResults(B* compListRes, B* mapListRes, bool keyPath) {
|
|||||||
while (c!=profiler_buf_c) {
|
while (c!=profiler_buf_c) {
|
||||||
usz bcPos = c->bcPos;
|
usz bcPos = c->bcPos;
|
||||||
Comp* comp = c->comp;
|
Comp* comp = c->comp;
|
||||||
B path = comp->path;
|
B path = comp->fullpath;
|
||||||
i32 idx = profiler_index(&map, q_N(path) || isPathREPL(path)? tag(comp, OBJ_TAG) : path);
|
i32 idx = profiler_index(&map, q_N(path) || isPathREPL(path)? tag(comp, OBJ_TAG) : path);
|
||||||
if (idx == compCount) {
|
if (idx == compCount) {
|
||||||
compList = vec_addN(compList, tag(comp, OBJ_TAG));
|
compList = vec_addN(compList, tag(comp, OBJ_TAG));
|
||||||
@ -1602,9 +1602,9 @@ void profiler_displayResults(void) {
|
|||||||
usz ia = IA(mapObj);
|
usz ia = IA(mapObj);
|
||||||
for (usz i = 0; i < ia; i++) sum+= m[i];
|
for (usz i = 0; i < ia; i++) sum+= m[i];
|
||||||
|
|
||||||
if (q_N(c->path)) printf("(anonymous)");
|
if (q_N(c->fullpath)) printf("(anonymous)");
|
||||||
else if (isPathREPL(c->path)) printf("(REPL)");
|
else if (isPathREPL(c->fullpath)) printf("(REPL)");
|
||||||
else printsB(c->path);
|
else printsB(c->fullpath);
|
||||||
if (q_N(c->src)) {
|
if (q_N(c->src)) {
|
||||||
printf(": "N64d" samples\n", sum);
|
printf(": "N64d" samples\n", sum);
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user