fix: do not fix extra root if it points to lama stack; uncomment extra roots registration; rise error if binary operation is done over pointers

This commit is contained in:
danyaberezun 2023-07-03 17:58:55 +02:00
parent 8bc173762d
commit ce0b369958
3 changed files with 134 additions and 43 deletions

View file

@ -890,10 +890,10 @@ extern void *Bclosure (int bn, void *entry, ...) {
fflush(stdout);
#endif
argss = (ebp + 12);
// for (i = 0; i < n; i++, argss++) { push_extra_root((void **)argss); }
for (i = 0; i < n; i++, argss++) { push_extra_root((void **)argss); }
r = (data *)alloc_closure(n + 1);
// push_extra_root(&r);
push_extra_root(&r);
((void **)r->contents)[0] = entry;
va_start(args, entry);
@ -907,9 +907,9 @@ extern void *Bclosure (int bn, void *entry, ...) {
__post_gc();
// pop_extra_root(&r);
pop_extra_root(&r);
argss--;
//for (i = 0; i < n; i++, argss--) { pop_extra_root((void **)argss); }
for (i = 0; i < n; i++, argss--) { pop_extra_root((void **)argss); }
#ifdef DEBUG_PRINT
print_indent();
@ -1346,6 +1346,16 @@ extern int Lread () {
return BOX(result);
}
extern int Lbinoperror (void) {
fprintf(stderr, "ERROR: POINTER ARITHMETICS is forbidden; EXIT\n");
exit(1);
}
extern int Lbinoperror2 (void) {
fprintf(stderr, "ERROR: Comparing BOXED and UNBOXED value ; EXIT\n");
exit(1);
}
/* Lwrite is an implementation of the "write" construct */
extern int Lwrite (int n) {
printf("%d\n", UNBOX(n));