Created
December 10, 2010 18:37
-
-
Save matthewd/736581 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
From 2882f587c2c1468eb117a16f07542f50e531dda8 Mon Sep 17 00:00:00 2001 | |
From: Matthew Draper <matthew@trebex.net> | |
Date: Sat, 11 Dec 2010 05:05:23 +1030 | |
Subject: [PATCH] Remove meta_send_op_tequal; identical to meta_send_op_equal. | |
Presumably this instruction dates from a time when meta_send_op_* didn't | |
get passed the literal to use. | |
--- | |
lib/compiler/ast/transforms.rb | 2 +- | |
spec/compiler/transforms/fast_math_spec.rb | 2 +- | |
vm/instructions.def | 41 +-------------------------- | |
vm/llvm/jit_util.cpp | 11 ------- | |
vm/llvm/jit_visit.hpp | 37 ------------------------- | |
vm/vmmethod.cpp | 2 - | |
6 files changed, 4 insertions(+), 91 deletions(-) | |
diff --git a/lib/compiler/ast/transforms.rb b/lib/compiler/ast/transforms.rb | |
index da17128..4a36ab3 100644 | |
--- a/lib/compiler/ast/transforms.rb | |
+++ b/lib/compiler/ast/transforms.rb | |
@@ -206,7 +206,7 @@ module Rubinius | |
:+ => :meta_send_op_plus, | |
:- => :meta_send_op_minus, | |
:== => :meta_send_op_equal, | |
- :=== => :meta_send_op_tequal, | |
+ :=== => :meta_send_op_equal, | |
:< => :meta_send_op_lt, | |
:> => :meta_send_op_gt | |
} | |
diff --git a/spec/compiler/transforms/fast_math_spec.rb b/spec/compiler/transforms/fast_math_spec.rb | |
index c50af3e..cd28ee6 100644 | |
--- a/spec/compiler/transforms/fast_math_spec.rb | |
+++ b/spec/compiler/transforms/fast_math_spec.rb | |
@@ -73,7 +73,7 @@ describe "A Call node using FastMath transform" do | |
compile :fast_math do |g| | |
g.push 1 | |
g.push 1 | |
- g.meta_send_op_tequal :=== | |
+ g.meta_send_op_equal :=== | |
end | |
end | |
diff --git a/vm/instructions.def b/vm/instructions.def | |
index c76c4fa..2bfcdd0 100644 | |
--- a/vm/instructions.def | |
+++ b/vm/instructions.def | |
@@ -2432,8 +2432,6 @@ end | |
# is called on +value1+, passing +value2+ as the argument. | |
instruction meta_send_op_equal(literal) [ value1 value2 -- boolean ] => send | |
- InlineCache* cache = reinterpret_cast<InlineCache*>(literal); | |
- | |
Object* t1 = stack_back(1); | |
Object* t2 = stack_back(0); | |
@@ -2445,6 +2443,8 @@ instruction meta_send_op_equal(literal) [ value1 value2 -- boolean ] => send | |
flush_ip(); | |
Arguments out_args(t1, 1, stack_back_position(1)); | |
+ | |
+ InlineCache* cache = reinterpret_cast<InlineCache*>(literal); | |
Object* ret = cache->execute(state, call_frame, out_args); | |
stack_clear(2); | |
@@ -2525,43 +2525,6 @@ instruction meta_send_op_gt(literal) [ value1 value2 -- boolean ] | |
end | |
# [Operation] | |
-# Implementation of === (triple equal) optimised for fixnums and symbols | |
-# [Format] | |
-# \meta_send_op_tequal | |
-# [Stack Before] | |
-# * value2 | |
-# * value1 | |
-# * ... | |
-# [Stack After] | |
-# * true | false | |
-# * ... | |
-# [Description] | |
-# Pops +value1+ and +value2+ off the stack, and pushes the logical result | |
-# of (+value1+ === +value2+). If +value1+ and +value2+ are both fixnums or | |
-# both symbols, the comparison is done directly; otherwise, the === method | |
-# is called on +value1+, passing +value2+ as the argument. | |
-# [Notes] | |
-# Exactly like equal, except calls === if it can't handle it directly. | |
- | |
-instruction meta_send_op_tequal(literal) [ value1 value2 -- boolean ] => send | |
- Object* t1 = stack_back(1); | |
- Object* t2 = stack_back(0); | |
- /* If both are fixnums, or both are symbols, compare the ops directly. */ | |
- if((t1->fixnum_p() && t2->fixnum_p()) || (t1->symbol_p() && t2->symbol_p())) { | |
- (void)stack_pop(); | |
- stack_set_top((t1 == t2) ? Qtrue : Qfalse); | |
- } else { | |
- flush_ip(); | |
- Arguments out_args(t1, 1, stack_back_position(1)); | |
- InlineCache* cache = reinterpret_cast<InlineCache*>(literal); | |
- Object* ret = cache->execute(state, call_frame, out_args); | |
- stack_clear(2); | |
- | |
- CHECK_AND_PUSH(ret); | |
- } | |
-end | |
- | |
-# [Operation] | |
# Used for non-dynamic 'yield' calls and for simple calls with static args | |
# [Format] | |
# \meta_send_call count | |
diff --git a/vm/llvm/jit_util.cpp b/vm/llvm/jit_util.cpp | |
index 86773fe..ed16375 100644 | |
--- a/vm/llvm/jit_util.cpp | |
+++ b/vm/llvm/jit_util.cpp | |
@@ -578,17 +578,6 @@ extern "C" { | |
return rbx_simple_send(state, call_frame, G(sym_nequal), 1, stk); | |
} | |
- Object* rbx_meta_send_op_tequal(STATE, CallFrame* call_frame, Object** stk) { | |
- Object* t1 = stk[0]; | |
- Object* t2 = stk[1]; | |
- /* If both are fixnums, or both are symbols, compare the ops directly. */ | |
- if((t1->fixnum_p() && t2->fixnum_p()) || (t1->symbol_p() && t2->symbol_p())) { | |
- return (t1 == t2) ? Qfalse : Qtrue; | |
- } | |
- | |
- return rbx_simple_send(state, call_frame, G(sym_tequal), 1, stk); | |
- } | |
- | |
Object* rbx_passed_arg(STATE, Arguments& args, int index) { | |
return (index < (int)args.total()) ? Qtrue : Qfalse; | |
} | |
diff --git a/vm/llvm/jit_visit.hpp b/vm/llvm/jit_visit.hpp | |
index 3186834..df11b94 100644 | |
--- a/vm/llvm/jit_visit.hpp | |
+++ b/vm/llvm/jit_visit.hpp | |
@@ -861,43 +861,6 @@ namespace rubinius { | |
stack_push(phi); | |
} | |
- void visit_meta_send_op_tequal(opcode name) { | |
- InlineCache* cache = reinterpret_cast<InlineCache*>(name); | |
- set_has_side_effects(); | |
- | |
- Value* recv = stack_back(1); | |
- Value* arg = stack_top(); | |
- | |
- BasicBlock* fast = new_block("fast"); | |
- BasicBlock* dispatch = new_block("dispatch"); | |
- BasicBlock* cont = new_block(); | |
- | |
- check_fixnums(recv, arg, fast, dispatch); | |
- | |
- set_block(dispatch); | |
- | |
- Value* called_value = inline_cache_send(1, cache); | |
- BasicBlock* send_block = | |
- check_for_exception_then(called_value, cont); | |
- | |
- set_block(fast); | |
- | |
- Value* cmp = b().CreateICmpEQ(recv, arg, "imm_cmp"); | |
- Value* imm_value = b().CreateSelect(cmp, | |
- constant(Qtrue), constant(Qfalse), "select_bool"); | |
- | |
- b().CreateBr(cont); | |
- | |
- set_block(cont); | |
- | |
- PHINode* phi = b().CreatePHI(ObjType, "equal_value"); | |
- phi->addIncoming(called_value, send_block); | |
- phi->addIncoming(imm_value, fast); | |
- | |
- stack_remove(2); | |
- stack_push(phi); | |
- } | |
- | |
void visit_meta_send_op_lt(opcode name) { | |
InlineCache* cache = reinterpret_cast<InlineCache*>(name); | |
set_has_side_effects(); | |
diff --git a/vm/vmmethod.cpp b/vm/vmmethod.cpp | |
index 36e50a1..9fd53cf 100644 | |
--- a/vm/vmmethod.cpp | |
+++ b/vm/vmmethod.cpp | |
@@ -196,7 +196,6 @@ namespace rubinius { | |
case InstructionSequence::insn_meta_send_op_plus: | |
case InstructionSequence::insn_meta_send_op_minus: | |
case InstructionSequence::insn_meta_send_op_equal: | |
- case InstructionSequence::insn_meta_send_op_tequal: | |
case InstructionSequence::insn_meta_send_op_lt: | |
case InstructionSequence::insn_meta_send_op_gt: | |
case InstructionSequence::insn_meta_to_s: | |
@@ -254,7 +253,6 @@ namespace rubinius { | |
case InstructionSequence::insn_meta_send_op_plus: | |
case InstructionSequence::insn_meta_send_op_minus: | |
case InstructionSequence::insn_meta_send_op_equal: | |
- case InstructionSequence::insn_meta_send_op_tequal: | |
case InstructionSequence::insn_meta_send_op_lt: | |
case InstructionSequence::insn_meta_send_op_gt: | |
case InstructionSequence::insn_meta_to_s: | |
-- | |
1.7.2.3 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment