From c2036f967a20e4164fd043d4b0092bede7312df0 Mon Sep 17 00:00:00 2001 From: Evan Phoenix Date: Wed, 26 Oct 2011 12:02:07 -0700 Subject: [PATCH] WIP --- spec/jit/fixtures/tier1.rb | 12 ++++++++ vm/jit/tier1/compiler.cpp | 56 ++++++++++++++++++++++++++++++++++++++ 2 files changed, 68 insertions(+) diff --git a/spec/jit/fixtures/tier1.rb b/spec/jit/fixtures/tier1.rb index d100a994e3..80e60a8116 100644 --- a/spec/jit/fixtures/tier1.rb +++ b/spec/jit/fixtures/tier1.rb @@ -15,5 +15,17 @@ def strlit def str_build(obj) "-#{obj}-" end + + dynamic_method :check_frozen do |g| + g.push :self + g.check_frozen + g.pop + g.push :nil + g.ret + end + + def equal_compare(a, b) + a == b + end end end diff --git a/vm/jit/tier1/compiler.cpp b/vm/jit/tier1/compiler.cpp index 1b3b3e5a66..5de820a4cf 100644 --- a/vm/jit/tier1/compiler.cpp +++ b/vm/jit/tier1/compiler.cpp @@ -529,6 +529,62 @@ namespace tier1 { set_stack_top(rax); } + void visit_meta_send_op_equal(opcode name) { + InlineCache* cache = reinterpret_cast(name); + + _.mov(scratch, stack_back_position(1)); + load_stack_top(scratch2); + + _.mov(arg1, scratch); + _.or_(arg1, scratch2); + _.and_(arg1, 3); + + _.cmp(arg1, 0); + + Label use_cache = _.newLabel(); + Label done = _.newLabel(); + + _.je(use_cache); + + _.mov(rax, (sysint_t)Qfalse); + _.cmp(scratch, scratch2); + _.cmove(rax, (sysint_t)Qtrue); + + stack_remove(1); + set_stack_top(rax); + + _.jmp(done); + _.bind(use_cache); + + _.mov(scratch, stack_back_position(1)); + _.mov(fr(cOutArgsOffset + offset::Arguments::recv), scratch); + + _.mov(fr(cOutArgsOffset + offset::Arguments::block), (sysint_t)Qnil); + _.mov(fr(cOutArgsOffset + offset::Arguments::total), (sysint_t)1); + _.mov(fr(cOutArgsOffset + offset::Arguments::container), (sysint_t)Qnil); + + _.lea(scratch, stack_back_position(0)); + _.mov(fr(cOutArgsOffset + offset::Arguments::arguments), scratch); + + load_vm(arg1); + _.mov(arg2, (sysint_t)cache); + _.mov(scratch, p(arg2, offset::InlineCache:execute)); + load_callframe(arg3); + load_outargs(arg4); + + _.call(scratch); + stack_remove(1); + + _.cmp(rax, 0); + _.je(exit_label); + + + + + _.bind(done); + + } + }; bool Compiler::compile(STATE) {