Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

WIP

  • Loading branch information...
commit c2036f967a20e4164fd043d4b0092bede7312df0 1 parent 501e318
@evanphx evanphx authored
Showing with 68 additions and 0 deletions.
  1. +12 −0 spec/jit/fixtures/tier1.rb
  2. +56 −0 vm/jit/tier1/compiler.cpp
View
12 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
View
56 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<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.
Something went wrong with that request. Please try again.