|
|
@ -324,7 +324,7 @@ int ink_destroy(struct context* ctx) { |
|
|
for (i = 0; i < ctx->types_top; ++i) { |
|
|
for (i = 0; i < ctx->types_top; ++i) { |
|
|
struct ink_type* t = ctx->types + i; |
|
|
struct ink_type* t = ctx->types + i; |
|
|
if (t->element_size > 0 && t->elements_top > 0) { |
|
|
if (t->element_size > 0 && t->elements_top > 0) { |
|
|
for (j = 0; i < t->element_size; ++j) { |
|
|
|
|
|
|
|
|
for (j = 0; j < t->elements_top; ++j) { |
|
|
if (t->elements[j].in_use) { |
|
|
if (t->elements[j].in_use) { |
|
|
t->collect(ctx, t->elements[j].data); |
|
|
t->collect(ctx, t->elements[j].data); |
|
|
ctx->free(ctx, t->elements[j].data); |
|
|
ctx->free(ctx, t->elements[j].data); |
|
|
@ -343,8 +343,8 @@ int ink_destroy(struct context* ctx) { |
|
|
ctx->inner_free(ctx, ctx->native_words[i].name); |
|
|
ctx->inner_free(ctx, ctx->native_words[i].name); |
|
|
} |
|
|
} |
|
|
for (i = 0; i < ctx->routines_top; ++i) { |
|
|
for (i = 0; i < ctx->routines_top; ++i) { |
|
|
ctx->free(ctx, ctx->routines[i].function_stack); |
|
|
|
|
|
ctx->free(ctx, ctx->routines[i].stack); |
|
|
|
|
|
|
|
|
k">if(ctx->routines[i].function_stack) ctx->free(ctx, ctx->routines[i].function_stack); |
|
|
|
|
|
k">if(ctx->routines[i].stack) ctx->free(ctx, ctx->routines[i].stack); |
|
|
} |
|
|
} |
|
|
for (i = 0; i < ctx->lex_reserved_words_top; ++i) { |
|
|
for (i = 0; i < ctx->lex_reserved_words_top; ++i) { |
|
|
ctx->free(ctx, ctx->lex_reserved_words[i]); |
|
|
ctx->free(ctx, ctx->lex_reserved_words[i]); |
|
|
@ -454,7 +454,7 @@ static void ink_free(struct context* _, void* ptr) { |
|
|
free(ptr); |
|
|
free(ptr); |
|
|
} |
|
|
} |
|
|
static int ink_putchar(struct context* _, int c) { |
|
|
static int ink_putchar(struct context* _, int c) { |
|
|
n">_=_; |
|
|
|
|
|
|
|
|
p">(void)(_); |
|
|
return putchar(c); |
|
|
return putchar(c); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
@ -1458,7 +1458,11 @@ void ink_gc(struct context* ctx) { |
|
|
for (i = 0; i < ctx->types_top; ++i) { |
|
|
for (i = 0; i < ctx->types_top; ++i) { |
|
|
for (j = 0; j < ctx->types[i].elements_top; ++j) { |
|
|
for (j = 0; j < ctx->types[i].elements_top; ++j) { |
|
|
/* Only mark from things that are active and detected as in use */ |
|
|
/* Only mark from things that are active and detected as in use */ |
|
|
if (ctx->types[i].elements[j].in_use && ctx->types[i].elements[j].is_protected && ctx->types[i].elements[j].uses) { |
|
|
|
|
|
|
|
|
if(ctx->types[i].elements[j].in_use && ctx->types[i].elements[j].is_protected && !ctx->types[i].elements[j].uses) { |
|
|
|
|
|
ctx->types[i].elements[j].uses = 1; |
|
|
|
|
|
marked = 1; |
|
|
|
|
|
} |
|
|
|
|
|
if (ctx->types[i].elements[j].in_use && ctx->types[i].elements[j].uses) { |
|
|
struct ink_collection_list c; |
|
|
struct ink_collection_list c; |
|
|
c = ctx->types[i].gc(ctx, ctx->types[i].elements[j].data); |
|
|
c = ctx->types[i].gc(ctx, ctx->types[i].elements[j].data); |
|
|
for (k = 0; k < c.count; ++k) { |
|
|
for (k = 0; k < c.count; ++k) { |
|
|
@ -2087,7 +2091,6 @@ static void dump_stack(struct context* ctx) { |
|
|
if(idx != NULL) ctx->free(ctx, idx); |
|
|
if(idx != NULL) ctx->free(ctx, idx); |
|
|
value = type = idx = NULL; |
|
|
value = type = idx = NULL; |
|
|
} |
|
|
} |
|
|
return; |
|
|
|
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
static void collect_noop(struct context* ctx, void* array) { |
|
|
static void collect_noop(struct context* ctx, void* array) { |
|
|
|