mirror of
				https://github.com/janet-lang/janet
				synced 2025-10-31 07:33:01 +00:00 
			
		
		
		
	symbolslots should be gc'd, local_symbols always pushed in case *debug* is set in middle of function
This commit is contained in:
		| @@ -218,7 +218,7 @@ JanetFuncDef *janet_funcdef_alloc(void) { | |||||||
|     def->closure_bitset = NULL; |     def->closure_bitset = NULL; | ||||||
|     def->flags = 0; |     def->flags = 0; | ||||||
|     def->slotcount = 0; |     def->slotcount = 0; | ||||||
|     def->symbolslots = 0; |     def->symbolslots = NULL; | ||||||
|     def->arity = 0; |     def->arity = 0; | ||||||
|     def->min_arity = 0; |     def->min_arity = 0; | ||||||
|     def->max_arity = INT32_MAX; |     def->max_arity = INT32_MAX; | ||||||
|   | |||||||
| @@ -1012,9 +1012,7 @@ JanetCompileResult janet_compile_lint(Janet source, | |||||||
|     janetc_init(&c, env, where, lints); |     janetc_init(&c, env, where, lints); | ||||||
|  |  | ||||||
|     /* Push a function scope */ |     /* Push a function scope */ | ||||||
|     if (janet_truthy(janet_dyn("debug"))) { |     janet_v_push(c.local_symbols, NULL); | ||||||
|         janet_v_push(c.local_symbols, NULL); |  | ||||||
|     } |  | ||||||
|     janetc_scope(&rootscope, &c, JANET_SCOPE_FUNCTION | JANET_SCOPE_TOP, "root"); |     janetc_scope(&rootscope, &c, JANET_SCOPE_FUNCTION | JANET_SCOPE_TOP, "root"); | ||||||
|  |  | ||||||
|     /* Set initial form options */ |     /* Set initial form options */ | ||||||
|   | |||||||
| @@ -314,6 +314,7 @@ static void janet_deinit_block(JanetGCObject *mem) { | |||||||
|             janet_free(def->bytecode); |             janet_free(def->bytecode); | ||||||
|             janet_free(def->sourcemap); |             janet_free(def->sourcemap); | ||||||
|             janet_free(def->closure_bitset); |             janet_free(def->closure_bitset); | ||||||
|  |             janet_free(def->symbolslots); | ||||||
|         } |         } | ||||||
|         break; |         break; | ||||||
|     } |     } | ||||||
|   | |||||||
| @@ -824,6 +824,8 @@ static const uint8_t *unmarshal_one_def( | |||||||
|         def->constants = NULL; |         def->constants = NULL; | ||||||
|         def->bytecode = NULL; |         def->bytecode = NULL; | ||||||
|         def->sourcemap = NULL; |         def->sourcemap = NULL; | ||||||
|  |         def->symbolslots = NULL; | ||||||
|  |         def->symbolslots_length = 0; | ||||||
|         janet_v_push(st->lookup_defs, def); |         janet_v_push(st->lookup_defs, def); | ||||||
|  |  | ||||||
|         /* Set default lengths to zero */ |         /* Set default lengths to zero */ | ||||||
|   | |||||||
| @@ -753,10 +753,7 @@ static JanetSlot janetc_while(JanetFopts opts, int32_t argn, const Janet *argv) | |||||||
|         if (c->buffer) janet_v__cnt(c->buffer) = labelwt; |         if (c->buffer) janet_v__cnt(c->buffer) = labelwt; | ||||||
|         if (c->mapbuffer) janet_v__cnt(c->mapbuffer) = labelwt; |         if (c->mapbuffer) janet_v__cnt(c->mapbuffer) = labelwt; | ||||||
|  |  | ||||||
|  |         janet_v_push(c->local_symbols, NULL); | ||||||
|         if (janet_truthy(janet_dyn("debug"))) { |  | ||||||
|             janet_v_push(c->local_symbols, NULL); |  | ||||||
|         } |  | ||||||
|         janetc_scope(&tempscope, c, JANET_SCOPE_FUNCTION, "while-iife"); |         janetc_scope(&tempscope, c, JANET_SCOPE_FUNCTION, "while-iife"); | ||||||
|  |  | ||||||
|         /* Recompile in the function scope */ |         /* Recompile in the function scope */ | ||||||
| @@ -833,9 +830,7 @@ static JanetSlot janetc_fn(JanetFopts opts, int32_t argn, const Janet *argv) { | |||||||
|  |  | ||||||
|     /* Begin function */ |     /* Begin function */ | ||||||
|     c->scope->flags |= JANET_SCOPE_CLOSURE; |     c->scope->flags |= JANET_SCOPE_CLOSURE; | ||||||
|     if (janet_truthy(janet_dyn("debug"))) { |     janet_v_push(c->local_symbols, NULL); | ||||||
|         janet_v_push(c->local_symbols, NULL); |  | ||||||
|     } |  | ||||||
|     janetc_scope(&fnscope, c, JANET_SCOPE_FUNCTION, "function"); |     janetc_scope(&fnscope, c, JANET_SCOPE_FUNCTION, "function"); | ||||||
|  |  | ||||||
|     if (argn == 0) { |     if (argn == 0) { | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user
	 Jona Ekenberg
					Jona Ekenberg