Skip to content

Commit

Permalink
Remove unused compile transforms
Browse files Browse the repository at this point in the history
The __kind_of__ call was only used in one place and can be replaced with
using Rubinius::Type that we now have. The JIT can also optimize these
regular methods well now, so having this doesn't give us anything
anymore.
  • Loading branch information
dbussink committed Mar 8, 2013
1 parent c4d2e58 commit 777ca1d
Show file tree
Hide file tree
Showing 5 changed files with 1 addition and 94 deletions.
2 changes: 0 additions & 2 deletions kernel/bootstrap/nil.rb
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,6 @@ def nil?
true
end

alias_method :__nil__, :nil?

def to_a
[]
end
Expand Down
4 changes: 0 additions & 4 deletions kernel/common/kernel.rb
Original file line number Diff line number Diff line change
Expand Up @@ -345,8 +345,6 @@ def instance_of?(cls)
Rubinius::Type.object_class(self) == cls
end

alias_method :__instance_of__, :instance_of?

def instance_variable_get(sym)
Rubinius.primitive :object_get_ivar

Expand Down Expand Up @@ -425,8 +423,6 @@ def nil?
false
end

alias_method :__nil__, :nil?

def methods(all=true)
methods = singleton_methods(all)

Expand Down
2 changes: 1 addition & 1 deletion kernel/delta/kernel.rb
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ def method_missing(meth, *args)

object_class = Rubinius::Type.object_class(self)

if __kind_of__(Module)
if Rubinius::Type.object_kind_of?(self, Module)
msg << " on #{self} (#{object_class})"

# A separate case for nil, because people like to patch methods to
Expand Down
34 changes: 0 additions & 34 deletions lib/compiler/ast/transforms.rb
Original file line number Diff line number Diff line change
Expand Up @@ -328,40 +328,6 @@ def bytecode(g)
end
end

##
# Maps various methods to VM instructions
#
class SendInstructionMethod < SendWithArguments
transform :default, :fast_system, "VM instructions for certain methods"

Methods = {
:__kind_of__ => :kind_of,
:__instance_of__ => :instance_of,
:__nil__ => :is_nil,
}

Arguments = {
:__kind_of__ => 1,
:__instance_of__ => 1,
:__nil__ => 0,
}

def self.match?(line, receiver, name, arguments, privately)
return false unless rename = Methods[name]
if match_arguments? arguments, Arguments[name]
new line, receiver, rename, arguments, privately
end
end

def bytecode(g)
pos(g)
@arguments.bytecode(g)
@receiver.bytecode(g)

g.__send__ @name
end
end

##
# Speeds up certain forms of Type.coerce_to
#
Expand Down
53 changes: 0 additions & 53 deletions spec/compiler/transforms/fast_system_spec.rb

This file was deleted.

0 comments on commit 777ca1d

Please sign in to comment.