1
0
mirror of https://github.com/janet-lang/janet synced 2025-02-02 18:29:10 +00:00

Fix some gc mark issues and change dict to obj.

This commit is contained in:
Calvin Rose 2017-02-16 15:10:59 -05:00
parent 6677dff337
commit 69260fa3bd
5 changed files with 15 additions and 10 deletions

View File

@ -982,11 +982,6 @@ static SpecialFormHelper get_special(GstArray *form) {
if (gst_string_length(name) == 2 &&
name[1] == 'o') {
return compile_do;
} else if (gst_string_length(name) == 4 &&
name[1] == 'i' &&
name[2] == 'c' &&
name[3] == 't') {
return compile_object;
}
}
break;
@ -1014,6 +1009,15 @@ static SpecialFormHelper get_special(GstArray *form) {
return compile_not;
}
}
break;
case 'o':
{
if (gst_string_length(name) == 3 &&
name[1] == 'b' &&
name[2] == 'j') {
return compile_object;
}
}
case 'q':
{
if (gst_string_length(name) == 5 &&

View File

@ -176,7 +176,7 @@ void gst_dasm(FILE * out, uint16_t *byteCode, uint32_t len) {
current += dasm_varg_op(out, current, "array", 1);
break;
case GST_OP_DIC:
current += dasm_varg_op(out, current, "dictionary", 1);
current += dasm_varg_op(out, current, "object", 1);
break;
case GST_OP_TCL:
current += dasm_varg_op(out, current, "tailCall", 1);

6
main.c
View File

@ -87,9 +87,9 @@ void debugRepl() {
}
/* Print asm */
//printf("\n");
//dasmFunc(stdout, func.data.func);
//printf("\n");
printf("\n");
gst_dasm_function(stdout, func.data.function);
printf("\n");
/* Execute function */
gst_load(&vm, func);

View File

@ -89,7 +89,7 @@ static void parser_push(GstParser *p, ParseType type, uint8_t character) {
}
if (character == '{') {
top->buf.form.endDelimiter = '}';
gst_array_push(p->vm, top->buf.form.array, gst_load_cstring(p->vm, "dict"));
gst_array_push(p->vm, top->buf.form.array, gst_load_cstring(p->vm, "obj"));
}
break;
}

1
vm.c
View File

@ -223,6 +223,7 @@ static void gst_mark(Gst *vm, GstValue *x) {
for (i = 0; i < x->data.object->capacity; ++i) {
bucket = x->data.object->buckets[i];
while (bucket) {
gc_header(bucket)->color = vm->black;
gst_mark(vm, &bucket->key);
gst_mark(vm, &bucket->value);
bucket = bucket->next;