hopefully fix SETH refcounts
This commit is contained in:
parent
0af6895f4b
commit
521abe669d
6
makefile
6
makefile
@ -23,11 +23,11 @@ c: # custom
|
||||
b: gen
|
||||
|
||||
single-o3:
|
||||
$(CC) -std=gnu11 -Wall -Wno-unused-function -fms-extensions $(CCFLAGS) -no-pie -O3 -o BQN src/opt/single.c -lm
|
||||
$(CC) -std=gnu11 -Wall -Wno-unused-function -fms-extensions $(CCFLAGS) -no-pie $(f) -O3 -o BQN src/opt/single.c -lm
|
||||
single-o3g:
|
||||
$(CC) -std=gnu11 -Wall -Wno-unused-function -fms-extensions $(CCFLAGS) -no-pie -O3 -g -o BQN src/opt/single.c -lm
|
||||
$(CC) -std=gnu11 -Wall -Wno-unused-function -fms-extensions $(CCFLAGS) -no-pie $(f) -O3 -g -o BQN src/opt/single.c -lm
|
||||
single-debug:
|
||||
$(CC) -std=gnu11 -Wall -Wno-unused-function -fms-extensions $(CCFLAGS) -no-pie -DDEBUG -g -o BQN src/opt/single.c -lm
|
||||
$(CC) -std=gnu11 -Wall -Wno-unused-function -fms-extensions $(CCFLAGS) -no-pie $(f) -DDEBUG -g -o BQN src/opt/single.c -lm
|
||||
single-c:
|
||||
$(CC) -std=gnu11 -Wall -Wno-unused-function -fms-extensions $(CCFLAGS) -no-pie $(f) -o BQN src/opt/single.c -lm
|
||||
|
||||
|
||||
@ -531,13 +531,8 @@ B join_c1(B t, B x) {
|
||||
B xf = getFillE(x);
|
||||
if (isAtm(xf)) {
|
||||
decA(xf);
|
||||
if (!PROPER_FILLS) {
|
||||
B xfq = getFillR(x);
|
||||
bool no = noFill(xfq);
|
||||
decR(xfq);
|
||||
if (no) return x;
|
||||
}
|
||||
dec(x);
|
||||
if (!PROPER_FILLS) return emptyHVec();
|
||||
thrM("∾: Empty vector 𝕩 cannot have an atom fill element");
|
||||
}
|
||||
dec(x);
|
||||
|
||||
@ -567,6 +567,9 @@ NOINLINE void printAllocStats() {
|
||||
#ifdef DEBUG
|
||||
NOINLINE Value* VALIDATEP(Value* x) {
|
||||
if (x->refc<=0 || (x->refc>>28) == 'a' || x->type==t_empty) {
|
||||
#ifdef OBJ_COUNTER
|
||||
printf("Object ID: "N64u"\n", x->uid);
|
||||
#endif
|
||||
printf("bad refcount for type %d: %d\nattempting to print: ", x->type, x->refc); fflush(stdout);
|
||||
print(tag(x,OBJ_TAG)); putchar('\n'); fflush(stdout);
|
||||
err("");
|
||||
|
||||
7
src/h.h
7
src/h.h
@ -76,8 +76,8 @@
|
||||
#define PROPER_FILLS (EACH_FILLS&SFNS_FILLS)
|
||||
#else
|
||||
#undef EACH_FILLS
|
||||
#define EACH_FILLS false
|
||||
#define PROPER_FILLS false
|
||||
#define EACH_FILLS 0
|
||||
#define PROPER_FILLS 0
|
||||
#endif
|
||||
#if defined(RT_PERF) || defined(RT_VERIFY)
|
||||
#define RT_WRAP
|
||||
@ -85,6 +85,9 @@
|
||||
#error "can't have both RT_PERF and RT_VERIFY"
|
||||
#endif
|
||||
#endif
|
||||
#if defined(OBJ_TRACK)
|
||||
#define OBJ_COUNTER 1
|
||||
#endif
|
||||
|
||||
#define i8 int8_t
|
||||
#define u8 uint8_t
|
||||
|
||||
@ -38,7 +38,13 @@ static void* BN(allocL)(i64 bucket, u8 type) {
|
||||
while(s<e) *s++ = tag(NULL, OBJ_TAG).u;
|
||||
#endif
|
||||
#ifdef OBJ_COUNTER
|
||||
x->uid = currObjCounter++;
|
||||
x->uid = currObjCounter++;
|
||||
#ifdef OBJ_TRACK
|
||||
if (x->uid == OBJ_TRACK) {
|
||||
printf("Tracked object "N64u" created at:\n", (u64)OBJ_TRACK);
|
||||
vm_pstLive();
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
return x;
|
||||
}
|
||||
|
||||
2
src/vm.c
2
src/vm.c
@ -662,7 +662,7 @@ B evalBC(Block* bl, Body* b, Scope* sc) { // doesn't consume
|
||||
break;
|
||||
}
|
||||
case SETH: { P(s) P(x) GS_UPD; POS_UPD;
|
||||
bool ok = v_seth(pscs, s, x);
|
||||
bool ok = v_seth(pscs, s, x); dec(x); dec(s);
|
||||
if (!ok) thrM("VM: Header fallback NYI");
|
||||
break;
|
||||
}
|
||||
|
||||
10
src/vm.h
10
src/vm.h
@ -209,12 +209,8 @@ static inline void v_set(Scope* pscs[], B s, B x, bool upd) { // doesn't consume
|
||||
else v_setI(pscs[(u16)(s.u>>32)], (u32)s.u, inc(x), upd);
|
||||
}
|
||||
|
||||
static inline bool v_seth(Scope* pscs[], B s, B x) { // consumes both; s cannot contain extended variables
|
||||
if (RARE(!isVar(s))) {
|
||||
bool r = v_sethR(pscs, s, x);
|
||||
dec(s); dec(x);
|
||||
return r;
|
||||
}
|
||||
v_setI(pscs[(u16)(s.u>>32)], (u32)s.u, x, false);
|
||||
static inline bool v_seth(Scope* pscs[], B s, B x) { // doesn't consume; s cannot contain extended variables
|
||||
if (RARE(!isVar(s))) return v_sethR(pscs, s, x);
|
||||
v_setI(pscs[(u16)(s.u>>32)], (u32)s.u, inc(x), false);
|
||||
return true;
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user