Skip to content

Commit

Permalink
A little cleanup for transforms specs.
Browse files Browse the repository at this point in the history
  • Loading branch information
Brian Ford committed Nov 11, 2009
1 parent bf832d0 commit 68de861
Show file tree
Hide file tree
Showing 11 changed files with 32 additions and 38 deletions.
6 changes: 3 additions & 3 deletions lib/compiler/ast/transforms.rb
Expand Up @@ -111,7 +111,7 @@ def bytecode(g)
# Emits fast VM instructions for certain methods.
#
class SendFastMath < SendWithArguments
transform :default, :fastmath, "VM instructions for math, relational methods"
transform :default, :fast_math, "VM instructions for math, relational methods"

Operators = {
:+ => :meta_send_op_plus,
Expand Down Expand Up @@ -147,7 +147,7 @@ def bytecode(g)
# Emits a fast path for #new
#
class SendFastNew < SendWithArguments
transform :default, :fastnew, "Fast SomeClass.new path"
transform :default, :fast_new, "Fast SomeClass.new path"

# FIXME duplicated from kernel/common/compiled_method.rb
KernelMethodSerial = 47
Expand Down Expand Up @@ -225,7 +225,7 @@ def bytecode(g)
# Maps various methods to VM instructions
#
class SendInstructionMethod < SendWithArguments
transform :default, :fastsystem, "VM instructions for certain methods"
transform :default, :fast_system, "VM instructions for certain methods"

Methods = {
:__kind_of__ => :kind_of,
Expand Down
@@ -1,6 +1,6 @@
require File.dirname(__FILE__) + '/../../spec_helper'

describe "A Call node using InlineAssembly plugin" do
describe "A Call node using InlineAssembly transform" do
relates <<-ruby do
Rubinius.asm(a) do |m|
push 1
Expand Down
@@ -1,6 +1,6 @@
require File.dirname(__FILE__) + '/../../spec_helper'

describe "A Call node using BlockGiven plugin" do
describe "A Call node using BlockGiven transform" do
block_given = lambda do |g|
in_method :m do |d|
no_blk = d.new_label
Expand Down
File renamed without changes.
@@ -1,14 +1,14 @@
require File.dirname(__FILE__) + '/../../spec_helper'

describe "A Call node using FastMath plugin" do
describe "A Call node using FastMath transform" do
relates "1 + 1" do
compile do |g|
g.push 1
g.push 1
g.send :+, 1, false
end

compile :fastmath do |g|
compile :fast_math do |g|
g.push 1
g.push 1
g.meta_send_op_plus :+
Expand All @@ -25,7 +25,7 @@
g.send_with_splat :+, 0, false, false
end

compile :fastmath do |g|
compile :fast_math do |g|
g.push 1
g.push :self
g.send :a, 0, true
Expand All @@ -42,7 +42,7 @@
g.send :-, 1, false
end

compile :fastmath do |g|
compile :fast_math do |g|
g.push 1
g.push 1
g.meta_send_op_minus :-
Expand All @@ -56,7 +56,7 @@
g.send :==, 1, false
end

compile :fastmath do |g|
compile :fast_math do |g|
g.push 1
g.push 1
g.meta_send_op_equal :==
Expand All @@ -70,7 +70,7 @@
g.send :===, 1, false
end

compile :fastmath do |g|
compile :fast_math do |g|
g.push 1
g.push 1
g.meta_send_op_tequal :===
Expand All @@ -84,7 +84,7 @@
g.send :<, 1, false
end

compile :fastmath do |g|
compile :fast_math do |g|
g.push 1
g.push 1
g.meta_send_op_lt :<
Expand All @@ -98,7 +98,7 @@
g.send :>, 1, false
end

compile :fastmath do |g|
compile :fast_math do |g|
g.push 1
g.push 1
g.meta_send_op_gt :>
Expand Down
@@ -1,13 +1,13 @@
require File.dirname(__FILE__) + '/../../spec_helper'

describe "A Call node using FastNew plugin" do
describe "A Call node using FastNew transform" do
relates "new" do
compile do |g|
g.push :self
g.send :new, 0, true
end

compile :fastnew do |g|
compile :fast_new do |g|
slow = g.new_label
done = g.new_label

Expand Down Expand Up @@ -38,7 +38,7 @@
g.send :new, 1, true
end

compile :fastnew do |g|
compile :fast_new do |g|
slow = g.new_label
done = g.new_label

Expand Down Expand Up @@ -70,7 +70,7 @@
g.send :new, 0, false
end

compile :fastnew do |g|
compile :fast_new do |g|
slow = g.new_label
done = g.new_label

Expand Down Expand Up @@ -100,7 +100,7 @@
g.send :new, 1, false
end

compile :fastnew do |g|
compile :fast_new do |g|
slow = g.new_label
done = g.new_label

Expand Down
Expand Up @@ -10,7 +10,7 @@
g.send :__kind_of__, 1, false
end

compile :fastsystem do |g|
compile :fast_system do |g|
g.push :self
g.send :b, 0, true
g.push :self
Expand All @@ -28,7 +28,7 @@
g.send :__instance_of__, 1, false
end

compile :fastsystem do |g|
compile :fast_system do |g|
g.push :self
g.send :b, 0, true
g.push :self
Expand All @@ -44,7 +44,7 @@
g.send :__nil__, 0, false
end

compile :fastsystem do |g|
compile :fast_system do |g|
g.push :self
g.send :a, 0, true
g.is_nil
Expand Down
@@ -1,29 +1,17 @@
require File.dirname(__FILE__) + '/../../spec_helper'

describe "A Call node using kernel_methods plugin" do
describe "A Call node using kernel_methods transform" do
relates "4 / 2" do
compile :kernel_methods do |g|
compile do |g|
g.push 4
g.push 2
g.send :divide, 1, false
g.send :/, 1, false
end
end

relates "a.class" do
compile :kernel_methods do |g|
g.push :self
g.send :a, 0, true
g.send :__class__, 0, false
end
end
end

describe "A Call node NOT using kernel_methods plugin" do
relates "4 / 2" do
compile do |g|
g.push 4
g.push 2
g.send :/, 1, false
g.send :divide, 1, false
end
end

Expand All @@ -33,5 +21,11 @@
g.send :a, 0, true
g.send :class, 0, false
end

compile :kernel_methods do |g|
g.push :self
g.send :a, 0, true
g.send :__class__, 0, false
end
end
end
File renamed without changes.
@@ -1,6 +1,6 @@
require File.dirname(__FILE__) + '/../../spec_helper'

describe "A Call node using PrimitiveDeclaration plugin" do
describe "A Call node using PrimitiveDeclaration transform" do
relates <<-ruby do
def m
Ruby.primitive :prim
Expand Down
File renamed without changes.

0 comments on commit 68de861

Please sign in to comment.