Skip to content

Commit

Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
WIP
Browse files Browse the repository at this point in the history
evanphx committed Oct 26, 2011

Verified

This commit was signed with the committer’s verified signature.
headius Charles Oliver Nutter
1 parent 501e318 commit c2036f9
Showing 2 changed files with 68 additions and 0 deletions.
12 changes: 12 additions & 0 deletions spec/jit/fixtures/tier1.rb
Original file line number Diff line number Diff line change
@@ -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
56 changes: 56 additions & 0 deletions vm/jit/tier1/compiler.cpp
Original file line number Diff line number Diff line change
@@ -529,6 +529,62 @@ namespace tier1 {
set_stack_top(rax);
}

void visit_meta_send_op_equal(opcode name) {
InlineCache* cache = reinterpret_cast<InlineCache*>(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) {

0 comments on commit c2036f9

Please sign in to comment.