瀏覽代碼

additional fixes for dynamic enum

Nicolas Cannasse 8 年之前
父節點
當前提交
e4d0ba4a3d
共有 2 個文件被更改,包括 8 次插入3 次删除
  1. 8 2
      src/jit.c
  2. 0 1
      src/std/buffer.c

+ 8 - 2
src/jit.c

@@ -158,6 +158,12 @@ static int SIB_MULT[] = {-1, 0, 1, -1, 2, -1, -1, -1, 3};
 #define BUF_POS()				((int)(ctx->buf.b - ctx->startBuf))
 #define RTYPE(r)				r->t->kind
 
+#ifdef HL_64
+#	define RESERVE_ADDRESS	0x8000000000000000
+#else
+#	define RESERVE_ADDRESS	0x80000000
+#endif
+
 typedef struct jlist jlist;
 struct jlist {
 	int pos;
@@ -2531,7 +2537,7 @@ int hl_jit_function( jit_ctx *ctx, hl_module *m, hl_function *f ) {
 				j->next = ctx->calls;
 				ctx->calls = j;
 
-				op64(ctx,MOV,r,pconst64(&p,0));
+				op64(ctx,MOV,r,pconst64(&p,RESERVE_ADDRESS));
 				op64(ctx,PUSH,r,UNUSED);
 				op64(ctx,MOV,r,pconst64(&p,(int_val)m->code->functions[m->functions_indexes[o->p2]].type));
 				op64(ctx,PUSH,r,UNUSED);
@@ -3201,7 +3207,7 @@ int hl_jit_function( jit_ctx *ctx, hl_module *m, hl_function *f ) {
 				op32(ctx, MOV, r2, r);
 				op32(ctx, SHL, r2, pconst(&p,2));
 				op32(ctx, ADD, r2, r);
-				op64(ctx, ADD, r2, pconst64(&p,0));
+				op64(ctx, ADD, r2, pconst64(&p,RESERVE_ADDRESS));
 				{
 					jlist *s = (jlist*)hl_malloc(&ctx->galloc, sizeof(jlist));
 					s->pos = BUF_POS() - sizeof(void*);

+ 0 - 1
src/std/buffer.c

@@ -161,7 +161,6 @@ static void hl_buffer_addr( hl_buffer *b, void *data, hl_type *t, vlist *stack )
 	case HBYTES:
 		hl_buffer_str(b,*(uchar**)data);
 		break;
-	case HENUM:
 	case HTYPE:
 	case HREF:
 	case HABSTRACT: