Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Add literals to the rootset

  • Loading branch information...
commit 298a3c55279bd919a56f71e94c9f2e74dcd0b9ae 1 parent 82c4981
@txus authored
View
2  src/terror/call_frame.c
@@ -9,7 +9,6 @@ CallFrame*
CallFrame_new(VALUE self, Function *fn, int *ret)
{
CallFrame* cf = calloc(1, sizeof(CallFrame));
- debug("Created call frame %p with function %p", cf, fn);
cf->self = self;
cf->fn = fn;
cf->name = NULL;
@@ -30,7 +29,6 @@ CallFrame_destroy(CallFrame *frame)
}
}
-
VALUE
CallFrame_getlocal(CallFrame *frame, int idx)
{
View
6 src/terror/gc.c
@@ -74,6 +74,9 @@ GC_rootset(TmStateHeader *state_header)
for(int i=0; i < DArray_count(parent->locals); i++) {
ROOT(DArray_at(parent->locals, i));
}
+ for(int i=0; i < DArray_count(parent->fn->literals); i++) {
+ ROOT(DArray_at(parent->fn->literals, i));
+ }
}
if(frame->fn->scope) {
@@ -86,6 +89,9 @@ GC_rootset(TmStateHeader *state_header)
for(int i=0; i < DArray_count(frame->locals); i++) {
ROOT(DArray_at(frame->locals, i));
}
+ for(int i=0; i < DArray_count(frame->fn->literals); i++) {
+ ROOT(DArray_at(frame->fn->literals, i));
+ }
}
}
View
4 src/terror/primitives.c
@@ -131,8 +131,6 @@ Primitive_require(STATE, void *a, void *_, void *__)
CHECK_TYPE(filename, StringType);
bstring filename_str = bfromcstr(VAL2STR(filename));
- Hashmap *fns = state->functions;
-
Function *main = NULL; // entry point
BytecodeFile *file = BytecodeFile_new(state, filename_str);
@@ -144,7 +142,7 @@ Primitive_require(STATE, void *a, void *_, void *__)
if(bstrcmp(fn_name, bfromcstr("0_main")) == 0) {
main = fn;
} else {
- Hashmap_set(fns, fn_name, fn);
+ Hashmap_set(state->functions, fn_name, fn);
}
}
View
4 src/terror/vm.c
@@ -158,6 +158,10 @@ VALUE VM_run(STATE)
VALUE slot = LITERAL(*ip);
check(receiver->type != NilType, "Tried to get a slot from nil.");
+ printf("Receiver is ");
+ Value_print(state, receiver);
+ printf("\n");
+ printf("Slot is %p, type %i\n", slot, slot->type);
check(slot->type == StringType, "Slot name must be a String.");
VALUE value = Value_get(receiver, VAL2STR(slot));
Please sign in to comment.
Something went wrong with that request. Please try again.