2
0
Эх сурвалжийг харах

fixed stack_top issue in release

Nicolas Cannasse 8 жил өмнө
parent
commit
bddf143d3b
3 өөрчлөгдсөн 4 нэмэгдсэн , 4 устгасан
  1. 1 1
      src/hlmodule.h
  2. 1 1
      src/main.c
  3. 2 2
      src/module.c

+ 1 - 1
src/hlmodule.h

@@ -103,7 +103,7 @@ const uchar *hl_get_ustring( hl_code *c, int index );
 const char* hl_op_name( int op );
 
 hl_module *hl_module_alloc( hl_code *code );
-int hl_module_init( hl_module *m );
+int hl_module_init( hl_module *m, void *stack_top );
 void hl_module_free( hl_module *m );
 bool hl_module_debug( hl_module *m, int port, bool wait );
 void *hl_module_stack_top();

+ 1 - 1
src/main.c

@@ -132,7 +132,7 @@ int main(int argc, pchar *argv[]) {
 	ctx.m = hl_module_alloc(ctx.code);
 	if( ctx.m == NULL )
 		return 2;
-	if( !hl_module_init(ctx.m) )
+	if( !hl_module_init(ctx.m, &argc) )
 		return 3;
 	hl_code_free(ctx.code);
 	if( debug_port > 0 && !hl_module_debug(ctx.m,debug_port,debug_wait) ) {

+ 2 - 2
src/module.c

@@ -219,7 +219,7 @@ static void append_type( char **p, hl_type *t ) {
 	}
 }
 
-int hl_module_init( hl_module *m ) {
+int hl_module_init( hl_module *m, void *stack_top_val ) {
 	int i, entry;
 	jit_ctx *ctx;
 	// RESET globals
@@ -337,7 +337,7 @@ int hl_module_init( hl_module *m ) {
 	}
 	hl_callback_init(((unsigned char*)m->jit_code) + entry);
 	cur_module = m;
-	stack_top = &m;
+	stack_top = stack_top_val;
 	hl_setup_exception(module_resolve_symbol, module_capture_stack);
 	hl_jit_free(ctx);
 	return 1;