mirror of
https://github.com/ProgramSnail/Lama.git
synced 2025-12-05 22:38:44 +00:00
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:
parent
8bc173762d
commit
ce0b369958
3 changed files with 134 additions and 43 deletions
|
|
@ -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));
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue