Skip to content

Commit

Permalink
Reworked call site, inline cache mechanism.
Browse files Browse the repository at this point in the history
  • Loading branch information
brixen committed Apr 16, 2016
1 parent 628fe1c commit fa16a43
Show file tree
Hide file tree
Showing 42 changed files with 885 additions and 1,769 deletions.
18 changes: 10 additions & 8 deletions core/call_site.rb
@@ -1,23 +1,25 @@
module Rubinius
class CallSite
attr_reader :name
attr_reader :executable

def hits
0
end
attr_reader :cache

def ip
Rubinius.primitive :call_site_ip
raise PrimitiveFailure, "CallSite#ip primitive failed"
end

def location
"#{@executable.file}:#{@executable.line_from_ip(ip)}"
def depth
Rubinius.primitive :call_site_depth
raise PrimitiveFailure, "CallSite#depth primitive failed"
end

def invokes
Rubinius.primitive :call_site_invokes
raise PrimitiveFailure, "CallSite#invokes primitive failed"
end

def inspect
"#<#{self.class.name}:0x#{self.object_id.to_s(16)} #{location}##{@name}(#{hits})>"
"#<#{self.class.name}:0x#{self.object_id.to_s(16)} name=#{@name} ip=#{ip}>"
end
end
end
28 changes: 28 additions & 0 deletions core/inline_cache.rb
@@ -0,0 +1,28 @@
module Rubinius
class InlineCache

attr_reader :receiver_class
attr_reader :stored_module
attr_reader :executable
attr_reader :next

def hits
Rubinius.primitive :inline_cache_hits
raise PrimitiveFailure, "InlineCache#hits primitive failed"
end

def misses
Rubinius.primitive :inline_cache_misses
raise PrimitiveFailure, "InlineCache#misses primitive failed"
end

def method_missing_reason
Rubinius.primitive :inline_cache_method_missing_reason
raise PrimitiveFailure, "InlineCache#method_missing_reason primitive failed"
end

def inspect
"#<#{self.class.name}:0x#{self.object_id.to_s(16)} hits=#{hits} misses=#{misses} receiver_class=#{@receiver_class} stored_module=#{@stored_module} executable=#{@executable.inspect} method_missing_reason=#{method_missing_reason}>"
end
end
end
3 changes: 1 addition & 2 deletions core/load_order.txt
Expand Up @@ -77,7 +77,7 @@ metrics.rb
mirror.rb
missing_method.rb
module.rb
mono_inline_cache.rb
inline_cache.rb
mutex.rb
native_method.rb
nil.rb
Expand All @@ -88,7 +88,6 @@ options.rb
pack.rb
pointer.rb
pointer_accessors.rb
poly_inline_cache.rb
proc.rb
proc_mirror.rb
process.rb
Expand Down
25 changes: 0 additions & 25 deletions core/mono_inline_cache.rb

This file was deleted.

52 changes: 0 additions & 52 deletions core/poly_inline_cache.rb

This file was deleted.

10 changes: 10 additions & 0 deletions library/rubinius/configuration.rb
Expand Up @@ -168,6 +168,16 @@
c.vm_variable "profiler.threshold", 1000000,
"The minimum number of nanoseconds a profiler node must have to be reported"

c.section "machine" do |s|
s.section "call_site" do |cs|
cs.vm_variable "cache", true,
"Cache executables at call sites"

cs.vm_variable "limit", 3,
"Maximum number of caches at call sites"
end
end

c.section "system" do |s|
s.vm_variable "tmp", "$TMPDIR",
"Default temp/fallback directory for the process"
Expand Down

0 comments on commit fa16a43

Please sign in to comment.