mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
Add getglobal to yjit
Adds getglobal to yjit and a test for it. Co-authored-by: Aaron Patterson <tenderlove@ruby-lang.org>
This commit is contained in:
parent
6aa4637272
commit
50029fb127
3 changed files with 37 additions and 0 deletions
|
@ -1,3 +1,15 @@
|
||||||
|
# Check that global variables work
|
||||||
|
|
||||||
|
assert_equal 'string', %q{
|
||||||
|
$foo = "string"
|
||||||
|
|
||||||
|
def foo
|
||||||
|
$foo
|
||||||
|
end
|
||||||
|
|
||||||
|
foo
|
||||||
|
}
|
||||||
|
|
||||||
# Check that global tracepoints work
|
# Check that global tracepoints work
|
||||||
assert_equal 'true', %q{
|
assert_equal 'true', %q{
|
||||||
def foo
|
def foo
|
||||||
|
|
|
@ -16724,6 +16724,7 @@ yjit_codegen.$(OBJEXT): $(top_srcdir)/internal/object.h
|
||||||
yjit_codegen.$(OBJEXT): $(top_srcdir)/internal/serial.h
|
yjit_codegen.$(OBJEXT): $(top_srcdir)/internal/serial.h
|
||||||
yjit_codegen.$(OBJEXT): $(top_srcdir)/internal/static_assert.h
|
yjit_codegen.$(OBJEXT): $(top_srcdir)/internal/static_assert.h
|
||||||
yjit_codegen.$(OBJEXT): $(top_srcdir)/internal/string.h
|
yjit_codegen.$(OBJEXT): $(top_srcdir)/internal/string.h
|
||||||
|
yjit_codegen.$(OBJEXT): $(top_srcdir)/internal/variable.h
|
||||||
yjit_codegen.$(OBJEXT): $(top_srcdir)/internal/vm.h
|
yjit_codegen.$(OBJEXT): $(top_srcdir)/internal/vm.h
|
||||||
yjit_codegen.$(OBJEXT): $(top_srcdir)/internal/warnings.h
|
yjit_codegen.$(OBJEXT): $(top_srcdir)/internal/warnings.h
|
||||||
yjit_codegen.$(OBJEXT): {$(VPATH)}assert.h
|
yjit_codegen.$(OBJEXT): {$(VPATH)}assert.h
|
||||||
|
@ -16739,6 +16740,7 @@ yjit_codegen.$(OBJEXT): {$(VPATH)}backward/2/stdalign.h
|
||||||
yjit_codegen.$(OBJEXT): {$(VPATH)}backward/2/stdarg.h
|
yjit_codegen.$(OBJEXT): {$(VPATH)}backward/2/stdarg.h
|
||||||
yjit_codegen.$(OBJEXT): {$(VPATH)}builtin.h
|
yjit_codegen.$(OBJEXT): {$(VPATH)}builtin.h
|
||||||
yjit_codegen.$(OBJEXT): {$(VPATH)}config.h
|
yjit_codegen.$(OBJEXT): {$(VPATH)}config.h
|
||||||
|
yjit_codegen.$(OBJEXT): {$(VPATH)}constant.h
|
||||||
yjit_codegen.$(OBJEXT): {$(VPATH)}darray.h
|
yjit_codegen.$(OBJEXT): {$(VPATH)}darray.h
|
||||||
yjit_codegen.$(OBJEXT): {$(VPATH)}debug_counter.h
|
yjit_codegen.$(OBJEXT): {$(VPATH)}debug_counter.h
|
||||||
yjit_codegen.$(OBJEXT): {$(VPATH)}defines.h
|
yjit_codegen.$(OBJEXT): {$(VPATH)}defines.h
|
||||||
|
|
|
@ -9,6 +9,7 @@
|
||||||
#include "internal/class.h"
|
#include "internal/class.h"
|
||||||
#include "internal/object.h"
|
#include "internal/object.h"
|
||||||
#include "internal/string.h"
|
#include "internal/string.h"
|
||||||
|
#include "internal/variable.h"
|
||||||
#include "insns_info.inc"
|
#include "insns_info.inc"
|
||||||
#include "yjit.h"
|
#include "yjit.h"
|
||||||
#include "yjit_iface.h"
|
#include "yjit_iface.h"
|
||||||
|
@ -3425,6 +3426,27 @@ gen_leave(jitstate_t* jit, ctx_t* ctx)
|
||||||
|
|
||||||
RUBY_EXTERN rb_serial_t ruby_vm_global_constant_state;
|
RUBY_EXTERN rb_serial_t ruby_vm_global_constant_state;
|
||||||
|
|
||||||
|
static codegen_status_t
|
||||||
|
gen_getglobal(jitstate_t* jit, ctx_t* ctx)
|
||||||
|
{
|
||||||
|
ID gid = jit_get_arg(jit, 0);
|
||||||
|
|
||||||
|
// Save YJIT registers
|
||||||
|
yjit_save_regs(cb);
|
||||||
|
|
||||||
|
mov(cb, C_ARG_REGS[0], imm_opnd(gid));
|
||||||
|
|
||||||
|
call_ptr(cb, REG0, (void *)&rb_gvar_get);
|
||||||
|
|
||||||
|
// Load YJIT registers
|
||||||
|
yjit_load_regs(cb);
|
||||||
|
|
||||||
|
x86opnd_t top = ctx_stack_push(ctx, TYPE_UNKNOWN);
|
||||||
|
mov(cb, top, RAX);
|
||||||
|
|
||||||
|
return YJIT_KEEP_COMPILING;
|
||||||
|
}
|
||||||
|
|
||||||
static codegen_status_t
|
static codegen_status_t
|
||||||
gen_opt_getinlinecache(jitstate_t *jit, ctx_t *ctx)
|
gen_opt_getinlinecache(jitstate_t *jit, ctx_t *ctx)
|
||||||
{
|
{
|
||||||
|
@ -3667,6 +3689,7 @@ yjit_init_codegen(void)
|
||||||
yjit_reg_op(BIN(opt_send_without_block), gen_opt_send_without_block);
|
yjit_reg_op(BIN(opt_send_without_block), gen_opt_send_without_block);
|
||||||
yjit_reg_op(BIN(send), gen_send);
|
yjit_reg_op(BIN(send), gen_send);
|
||||||
yjit_reg_op(BIN(leave), gen_leave);
|
yjit_reg_op(BIN(leave), gen_leave);
|
||||||
|
yjit_reg_op(BIN(getglobal), gen_getglobal);
|
||||||
|
|
||||||
yjit_method_codegen_table = st_init_numtable();
|
yjit_method_codegen_table = st_init_numtable();
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue