浏览代码

jit gc ok, fixed jit release (no security cookie on stack)

Nicolas Cannasse 9 年之前
父节点
当前提交
181e18c377
共有 5 个文件被更改,包括 9 次插入3 次删除
  1. 2 0
      hl.vcxproj
  2. 1 0
      hlc.vcxproj
  3. 1 0
      hldll.vcxproj
  4. 2 2
      src/jit.c
  5. 3 1
      src/module.c

+ 2 - 0
hl.vcxproj

@@ -135,6 +135,7 @@
       <EnableEnhancedInstructionSet>StreamingSIMDExtensions2</EnableEnhancedInstructionSet>
       <WholeProgramOptimization>false</WholeProgramOptimization>
       <AdditionalOptions>/wd4456 /wd4100 /wd4204 /wd4702 /wd4457 %(AdditionalOptions)</AdditionalOptions>
+      <BufferSecurityCheck>false</BufferSecurityCheck>
     </ClCompile>
     <Link>
       <SubSystem>Console</SubSystem>
@@ -156,6 +157,7 @@
       <PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <WholeProgramOptimization>false</WholeProgramOptimization>
       <AdditionalOptions>/wd4456 /wd4100 /wd4204 /wd4702 /wd4457 %(AdditionalOptions)</AdditionalOptions>
+      <BufferSecurityCheck>false</BufferSecurityCheck>
     </ClCompile>
     <Link>
       <SubSystem>Console</SubSystem>

+ 1 - 0
hlc.vcxproj

@@ -127,6 +127,7 @@
       <PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <EnableEnhancedInstructionSet>StreamingSIMDExtensions2</EnableEnhancedInstructionSet>
       <WholeProgramOptimization>false</WholeProgramOptimization>
+      <BufferSecurityCheck>false</BufferSecurityCheck>
     </ClCompile>
     <Link>
       <SubSystem>Console</SubSystem>

+ 1 - 0
hldll.vcxproj

@@ -137,6 +137,7 @@
       <IntrinsicFunctions>true</IntrinsicFunctions>
       <PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;_USRDLL;HLDLL_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <AdditionalOptions>/wd4054 /wd4456 /wd4702 /wd4100 /wd4457 %(AdditionalOptions)</AdditionalOptions>
+      <BufferSecurityCheck>false</BufferSecurityCheck>
     </ClCompile>
     <Link>
       <SubSystem>Windows</SubSystem>

+ 2 - 2
src/jit.c

@@ -1277,7 +1277,7 @@ static void op_ret( jit_ctx *ctx, vreg *r ) {
 	preg p;
 	switch( r->t->kind ) {
 	case HF32:
-		jit_error("TODO");
+		op64(ctx, MOVSS, PXMM(0), fetch(r));
 		break;
 	case HF64:
 		op64(ctx, MOVSD, PXMM(0), fetch(r));
@@ -2148,7 +2148,7 @@ int hl_jit_function( jit_ctx *ctx, hl_module *m, hl_function *f ) {
 		case OToDyn:
 			{
 				int_val rt = (int_val)ra->t;
-				int jskip;
+				int jskip = 0;
 				if( hl_is_ptr(ra->t) ) {
 					int jnz;
 					preg *a = alloc_cpu(ctx,ra,true);

+ 3 - 1
src/module.c

@@ -78,7 +78,7 @@ static void hl_init_enum( hl_type_enum *e ) {
 			hl_type *t = c->params[j];
 			c->size += hl_pad_size(c->size,t);
 			c->offsets[j] = c->size;
-			if( hl_is_gc_ptr(t) ) c->hasptr = true;
+			if( hl_is_ptr(t) ) c->hasptr = true;
 			c->size += hl_type_size(t);
 		}
 	}
@@ -167,6 +167,8 @@ int hl_module_init( hl_module *m ) {
 	for(i=0;i<m->code->nglobals;i++) {
 		hl_type *t = m->code->globals[i];
 		if( t->kind == HFUN ) *(void**)(m->globals_data + m->globals_indexes[i]) = null_function;
+		if( hl_is_ptr(t) )
+			hl_add_root((void**)(m->globals_data+m->globals_indexes[i]));
 	}
 	// INIT natives
 	{