1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

use ctx_stack_push_self()

This commit is contained in:
Maxime Chevalier-Boisvert 2021-04-01 16:56:20 -04:00 committed by Alan Wu
parent 215a2f4010
commit c299112fd7
2 changed files with 9 additions and 4 deletions

View file

@ -429,7 +429,7 @@ gen_putobject(jitstate_t* jit, ctx_t* ctx)
}
else if (arg == Qtrue || arg == Qfalse)
{
x86opnd_t stack_top = ctx_stack_push(ctx, TYPE_UNKNOWN);
x86opnd_t stack_top = ctx_stack_push(ctx, TYPE_IMM);
mov(cb, stack_top, imm_opnd((int64_t)arg));
}
else
@ -440,6 +440,8 @@ gen_putobject(jitstate_t* jit, ctx_t* ctx)
mov(cb, RAX, pc_plus_one);
mov(cb, RAX, mem_opnd(64, RAX, 0));
// TODO: check if argument is a heap object
// Write argument at SP
x86opnd_t stack_top = ctx_stack_push(ctx, TYPE_UNKNOWN);
mov(cb, stack_top, RAX);
@ -468,7 +470,7 @@ gen_putself(jitstate_t* jit, ctx_t* ctx)
mov(cb, RAX, member_opnd(REG_CFP, rb_control_frame_t, self));
// Write it on the stack
x86opnd_t stack_top = ctx_stack_push(ctx, TYPE_UNKNOWN);
x86opnd_t stack_top = ctx_stack_push_self(ctx);
mov(cb, stack_top, RAX);
return YJIT_KEEP_COMPILING;

View file

@ -31,7 +31,8 @@ typedef enum yjit_type_enum
ETYPE_UNKNOWN = 0,
ETYPE_NIL,
ETYPE_FIXNUM,
//ETYPE_ARRAY
ETYPE_ARRAY,
ETYPE_HASH
//ETYPE_SYMBOL
//ETYPE_STRING
@ -63,9 +64,10 @@ STATIC_ASSERT(val_type_size, sizeof(val_type_t) == 1);
// Could be any immediate
#define TYPE_IMM ( (val_type_t){ .is_imm = 1 } )
// Immediate types
#define TYPE_NIL ( (val_type_t){ .is_imm = 1, .type = ETYPE_NIL } )
#define TYPE_FIXNUM ( (val_type_t){ .is_imm = 1, .type = ETYPE_FIXNUM } )
#define TYPE_ARRAY ( (val_type_t){ .is_heap = 1, .type = ETYPE_ARRAY } )
#define TYPE_HASH ( (val_type_t){ .is_heap = 1, .type = ETYPE_HASH } )
typedef enum yjit_temp_loc
{
@ -215,6 +217,7 @@ typedef struct yjit_block_version
// Context object methods
x86opnd_t ctx_sp_opnd(ctx_t* ctx, int32_t offset_bytes);
x86opnd_t ctx_stack_push(ctx_t* ctx, val_type_t type);
x86opnd_t ctx_stack_push_self(ctx_t* ctx);
x86opnd_t ctx_stack_pop(ctx_t* ctx, size_t n);
x86opnd_t ctx_stack_opnd(ctx_t* ctx, int32_t idx);
val_type_t ctx_get_temp_type(const ctx_t* ctx, size_t idx);