Skip to content

Commit

Permalink
changed getmem/setmem, bumped hl & bytecode versions
Browse files Browse the repository at this point in the history
  • Loading branch information
ncannasse committed Apr 3, 2017
1 parent b725aa7 commit c07d480
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 33 deletions.
4 changes: 2 additions & 2 deletions src/code.c
Original file line number Diff line number Diff line change
Expand Up @@ -431,9 +431,9 @@ hl_code *hl_code_read( const unsigned char *data, int size ) {
EXIT("Invalid header");
r->code = c;
c->version = READ();
if( c->version <= 0 || c->version > 1 ) {
if( c->version <= 1 || c->version > 2 ) {
printf("VER=%d\n",c->version);
EXIT("Unsupported version");
EXIT("Unsupported bytecode version");
}
flags = UINDEX();
c->nints = UINDEX();
Expand Down
2 changes: 1 addition & 1 deletion src/hl.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
#ifndef HL_H
#define HL_H

#define HL_VERSION 0x110
#define HL_VERSION 0x120

#ifdef _WIN32
# define HL_WIN
Expand Down
42 changes: 20 additions & 22 deletions src/jit.c
Original file line number Diff line number Diff line change
Expand Up @@ -2885,9 +2885,7 @@ int hl_jit_function( jit_ctx *ctx, hl_module *m, hl_function *f ) {
store(ctx, dst, r, true);
}
break;
case OGetI32:
case OGetF32:
case OGetF64:
case OGetMem:
{
preg *base = alloc_cpu(ctx, ra, true);
preg *offset = alloc_cpu(ctx, rb, true);
Expand All @@ -2910,28 +2908,28 @@ int hl_jit_function( jit_ctx *ctx, hl_module *m, hl_function *f ) {
op32(ctx,MOV16,pmem2(&p,base->id,offset->id,1,0),value);
}
break;
case OSetI32:
case OSetMem:
{
preg *base = alloc_cpu(ctx, dst, true);
preg *offset = alloc_cpu(ctx, ra, true);
preg *value = alloc_cpu(ctx, rb, true);
op32(ctx,MOV,pmem2(&p,base->id,offset->id,1,0),value);
}
break;
case OSetF32:
{
preg *base = alloc_cpu(ctx, dst, true);
preg *offset = alloc_cpu(ctx, ra, true);
preg *value = alloc_fpu(ctx, rb, true);
op32(ctx,MOVSS,pmem2(&p,base->id,offset->id,1,0),value);
}
break;
case OSetF64:
{
preg *base = alloc_cpu(ctx, dst, true);
preg *offset = alloc_cpu(ctx, ra, true);
preg *value = alloc_fpu(ctx, rb, true);
op32(ctx,MOVSD,pmem2(&p,base->id,offset->id,1,0),value);
preg *value;
switch( rb->t->kind ) {
case HI32:
value = alloc_cpu(ctx, rb, true);
op32(ctx,MOV,pmem2(&p,base->id,offset->id,1,0),value);
break;
case HF32:
value = alloc_fpu(ctx, rb, true);
op32(ctx,MOVSS,pmem2(&p,base->id,offset->id,1,0),value);
break;
case HF64:
value = alloc_fpu(ctx, rb, true);
op32(ctx,MOVSD,pmem2(&p,base->id,offset->id,1,0),value);
break;
default:
ASSERT(rb->t->kind);
break;
}
}
break;
case OType:
Expand Down
10 changes: 2 additions & 8 deletions src/opcodes.h
Original file line number Diff line number Diff line change
Expand Up @@ -113,17 +113,11 @@ OP_BEGIN

OP(OGetI8,3)
OP(OGetI16,3)
OP(OGetI32,3)
OP(OGetI64,3)
OP(OGetF32,3)
OP(OGetF64,3)
OP(OGetMem,3)
OP(OGetArray,3)
OP(OSetI8,3)
OP(OSetI16,3)
OP(OSetI32,3)
OP(OSetI64,3)
OP(OSetF32,3)
OP(OSetF64,3)
OP(OSetMem,3)
OP(OSetArray,3)

OP(ONew,1)
Expand Down

0 comments on commit c07d480

Please sign in to comment.