Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Cleaned up debris from CompiledMethod rename.

  • Loading branch information...
commit 149a3642abded597128dd1c516613f5a67387485 1 parent 6fce2f6
@brixen brixen authored
Showing with 608 additions and 603 deletions.
  1. +6 −6 kernel/bootstrap/block_environment.rb
  2. +4 −4 kernel/bootstrap/compiled_code.rb
  3. +4 −4 kernel/bootstrap/rubinius.rb
  4. +2 −2 kernel/common/binding.rb
  5. +19 −18 kernel/common/block_environment.rb
  6. +1 −1  kernel/common/codeloader.rb
  7. +12 −12 kernel/common/compiled_code.rb
  8. +3 −3 kernel/common/kernel.rb
  9. +6 −6 kernel/common/kernel18.rb
  10. +6 −6 kernel/common/kernel19.rb
  11. +17 −17 kernel/common/module.rb
  12. +6 −6 kernel/common/proc.rb
  13. +2 −2 kernel/common/sprinter.rb
  14. +2 −2 kernel/common/thread.rb
  15. +2 −2 kernel/delta/class.rb
  16. +11 −11 kernel/delta/codeloader.rb
  17. +19 −19 lib/compiler/compiled_file.rb
  18. +12 −12 lib/compiler/compiler.rb
  19. +18 −18 lib/compiler/generator.rb
  20. +18 −18 lib/compiler/printers.rb
  21. +1 −1  spec/core/kernel/fixtures/classes.rb
  22. +4 −4 vm/builtin/block_as_method.cpp
  23. +18 −18 vm/builtin/block_environment.cpp
  24. +5 −5 vm/builtin/block_environment.hpp
  25. +50 −50 vm/builtin/compiledcode.cpp
  26. +1 −1  vm/builtin/compiledcode.hpp
  27. +2 −2 vm/builtin/exception.cpp
  28. +1 −1  vm/builtin/exception.hpp
  29. +5 −5 vm/builtin/executable.cpp
  30. +1 −1  vm/builtin/executable.hpp
  31. +11 −10 vm/builtin/location.cpp
  32. +1 −1  vm/builtin/nativemethod.cpp
  33. +4 −4 vm/builtin/proc.cpp
  34. +12 −12 vm/builtin/system.cpp
  35. +1 −1  vm/builtin/system.hpp
  36. +1 −1  vm/builtin/thread.cpp
  37. +2 −2 vm/bytecode_verification.cpp
  38. +1 −1  vm/bytecode_verification.hpp
  39. +11 −10 vm/call_frame.cpp
  40. +4 −4 vm/call_frame.hpp
  41. +3 −3 vm/capi/18/include/rbxti.hpp
  42. +3 −3 vm/capi/19/include/rbxti.hpp
  43. +4 −4 vm/compiled_file.cpp
  44. +6 −6 vm/gc/gc.cpp
  45. +2 −2 vm/globals.hpp
  46. +8 −8 vm/inline_cache.cpp
  47. +2 −2 vm/instructions.cpp
  48. +16 −16 vm/instructions.def
  49. +6 −6 vm/instruments/rbxti.cpp
  50. +5 −5 vm/instruments/tooling.cpp
  51. +6 −6 vm/instruments/tooling.hpp
  52. +2 −2 vm/llvm/background_compile_request.hpp
  53. +26 −26 vm/llvm/inline.cpp
  54. +6 −6 vm/llvm/inline.hpp
  55. +2 −2 vm/llvm/inline_block.cpp
  56. +1 −1  vm/llvm/inline_block.hpp
  57. +17 −17 vm/llvm/inline_primitive.cpp
  58. +3 −3 vm/llvm/jit_block.cpp
  59. +9 −9 vm/llvm/jit_compiler.cpp
  60. +1 −1  vm/llvm/jit_compiler.hpp
  61. +4 −4 vm/llvm/jit_inline_block.cpp
  62. +4 −4 vm/llvm/jit_inline_method.cpp
  63. +4 −4 vm/llvm/jit_method.cpp
  64. +22 −22 vm/llvm/jit_util.cpp
  65. +14 −12 vm/llvm/jit_visit.hpp
  66. +2 −2 vm/llvm/method_info.cpp
  67. +1 −1  vm/llvm/method_info.hpp
  68. +1 −1  vm/llvm/offset_specific.hpp
  69. +23 −23 vm/llvm/state.cpp
  70. +2 −2 vm/llvm/state.hpp
  71. +12 −12 vm/machine_code.cpp
  72. +2 −2 vm/machine_code.hpp
  73. +22 −22 vm/marshal.cpp
  74. +1 −1  vm/marshal.hpp
  75. +2 −2 vm/stack_variables.cpp
  76. +4 −4 vm/super-instruction/analyze.rb
  77. +2 −2 vm/test/test_compiled_file.hpp
  78. +13 −13 vm/test/test_machine_code.hpp
  79. +10 −10 vm/test/test_message.hpp
  80. +9 −9 vm/test/test_object.hpp
  81. +3 −3 vm/test/test_ontology.hpp
  82. +17 −17 vm/test/test_unmarshal.hpp
View
12 kernel/bootstrap/block_environment.rb
@@ -29,27 +29,27 @@ def self.new(block_env)
end
def arity
- @block_env.code.arity
+ @block_env.compiled_code.arity
end
def local_names
- @block_env.code.local_names
+ @block_env.compiled_code.local_names
end
def required_args
- @block_env.code.required_args
+ @block_env.compiled_code.required_args
end
def total_args
- @block_env.code.total_args
+ @block_env.compiled_code.total_args
end
def post_args
- @block_env.code.post_args
+ @block_env.compiled_code.post_args
end
def splat
- @block_env.code.splat
+ @block_env.compiled_code.splat
end
def file
View
8 kernel/bootstrap/compiled_code.rb
@@ -21,14 +21,14 @@ def dup
# For example:
#
# def g
- # f_cm = Rubinius::CompiledCode.of_sender
+ # f_code = Rubinius::CompiledCode.of_sender
# end
#
# def f
# g
# end
#
- # f_cm is the CompiledCode of f as requested by g.
+ # f_code is the CompiledCode of f as requested by g.
#
def self.of_sender
Rubinius.primitive :compiledcode_of_sender
@@ -48,8 +48,8 @@ def self.current
end
end
- # NOTE: Temporary alias for backwards compatibility. CompiledMethod will
- # eventually be deprecated in favor of CompiledCode.
+ # NOTE: Temporary alias for backwards compatibility. CompiledMethod is
+ # deprecated. Client code should use CompiledCode.
CompiledMethod = CompiledCode
end
View
8 kernel/bootstrap/rubinius.rb
@@ -193,10 +193,10 @@ def self.thread_state
raise PrimitiveFailure, "Rubinius.thread_state primitive failed"
end
- # Used to invoke a CompiledCode +cm+ as a script body.
- # Sets up the MAIN object as self and bypasses JIT'ing
- # (because why JIT a script you only run once).
- def self.run_script(cm)
+ # Used to invoke a CompiledCode instance as a script body. Sets up the MAIN
+ # object as self and bypasses JIT'ing (because why JIT a script you only run
+ # once).
+ def self.run_script(compiled_code)
Rubinius.primitive :vm_run_script
raise PrimitiveFailure, "Rubinius.run_script primitive failed"
end
View
4 kernel/common/binding.rb
@@ -2,7 +2,7 @@
class Binding
attr_accessor :variables
- attr_accessor :code
+ attr_accessor :compiled_code
attr_accessor :constant_scope
attr_accessor :proc_environment
attr_accessor :self
@@ -28,7 +28,7 @@ def self.setup(variables, code, constant_scope, recv=nil, location=nil)
bind.self = recv || variables.self
bind.variables = variables
- bind.code = code
+ bind.compiled_code = code
bind.constant_scope = constant_scope
bind.location = location
View
37 kernel/common/block_environment.rb
@@ -11,7 +11,7 @@ class BlockEnvironment
attr_reader :module
# The CompiledCode that implements the code for the block
- attr_reader :code
+ attr_reader :compiled_code
attr_accessor :proc_environment
attr_reader :metadata_container
@@ -20,37 +20,37 @@ def from_proc?
@proc_environment
end
- def under_context(scope, cmethod)
+ def under_context(scope, code)
@top_scope = scope
@scope = scope
- @code = cmethod
- @module = cmethod.scope.module
+ @compiled_code = code
+ @module = code.scope.module
return self
end
def change_name(name)
- @code = @code.change_name name
+ @compiled_code = @compiled_code.change_name name
end
def repoint_scope(where)
- @code.scope.using_current_as where
+ @compiled_code.scope.using_current_as where
end
def disable_scope!
- @code.scope.using_disabled_scope
+ @compiled_code.scope.using_disabled_scope
end
def constant_scope
- @code.scope
+ @compiled_code.scope
end
def to_binding
- Binding.setup @scope, @code, @code.scope
+ Binding.setup @scope, @compiled_code, @compiled_code.scope
end
def set_eval_binding(bind)
- @code.scope.script.eval_binding = bind
+ @compiled_code.scope.script.eval_binding = bind
end
##
@@ -72,23 +72,24 @@ def make_independent
end
def call_on_instance(obj, *args)
- call_under obj, @code.scope, *args
+ call_under obj, @compiled_code.scope, *args
end
def arity
- if @code.splat and (@code.splat >= 0 or @code.splat == -2)
- -(@code.required_args + 1)
+ if @compiled_code.splat and
+ (@compiled_code.splat >= 0 or @compiled_code.splat == -2)
+ -(@compiled_code.required_args + 1)
else
- @code.required_args
+ @compiled_code.required_args
end
end
def file
- @code.file
+ @compiled_code.file
end
def line
- @code.defined_line
+ @compiled_code.defined_line
end
class AsMethod < Executable
@@ -112,8 +113,8 @@ def ==(other)
# The BEs are identical otherwise, except for the
# name of the CompiledCode.
- other_code = other.block_env.code
- code = block_env.code
+ other_code = other.block_env.compiled_code
+ code = block_env.compiled_code
block_env.scope == other.block_env.scope &&
block_env.top_scope == other.block_env.top_scope &&
View
2  kernel/common/codeloader.rb
@@ -209,7 +209,7 @@ def require(name)
case req.type
when :ruby
begin
- Rubinius.run_script loader.cm
+ Rubinius.run_script loader.compiled_code
else
req.passed!
ensure
View
24 kernel/common/compiled_code.rb
@@ -341,11 +341,11 @@ def child_methods
end
def change_name(name)
- cm = dup
- cm.name = name
+ code = dup
+ code.name = name
- lits = Tuple.new(cm.literals.size)
- cm.literals.each_with_index do |lit, idx|
+ lits = Tuple.new(code.literals.size)
+ code.literals.each_with_index do |lit, idx|
if lit.kind_of? CompiledCode and lit.is_block?
lit = lit.change_name name
end
@@ -353,8 +353,8 @@ def change_name(name)
lits[idx] = lit
end
- cm.literals = lits
- return cm
+ code.literals = lits
+ return code
end
##
@@ -516,7 +516,7 @@ def parameters
# To generate VM opcodes documentation
# use rake doc:vm task.
class Instruction
- def initialize(inst, cm, ip)
+ def initialize(inst, code, ip)
@instruction = inst[0]
@args = inst[1..-1]
@comment = nil
@@ -524,17 +524,17 @@ def initialize(inst, cm, ip)
@args.each_index do |i|
case @instruction.args[i]
when :literal
- @args[i] = cm.literals[@args[i]]
+ @args[i] = code.literals[@args[i]]
when :local
# TODO: Blocks should be able to retrieve local names as well,
# but need access to method corresponding to home context
- if cm.local_names and !cm.is_block?
- @comment = cm.local_names[args[i]].to_s
+ if code.local_names and !code.is_block?
+ @comment = code.local_names[args[i]].to_s
end
end
end
- @cm = cm
+ @compiled_code = code
@ip = ip
end
@@ -545,7 +545,7 @@ def initialize(inst, cm, ip)
# Return the line that this instruction is on in the method
#
def line
- @cm.line_from_ip(ip)
+ @compiled_code.line_from_ip(ip)
end
##
View
6 kernel/common/kernel.rb
@@ -166,12 +166,12 @@ def lambda(&prc)
def caller(start=1, exclude_kernel=true)
# The + 1 is to skip this frame
Rubinius.mri_backtrace(start + 1).map do |tup|
- cm = tup[0]
+ code = tup[0]
line = tup[1]
is_block = tup[2]
name = tup[3]
- "#{cm.active_path}:#{line}:in `#{name}'"
+ "#{code.active_path}:#{line}:in `#{name}'"
end
end
module_function :caller
@@ -577,7 +577,7 @@ def load(name, wrap=false)
cl = Rubinius::CodeLoader.new(name)
cl.load(wrap)
- Rubinius.run_script cl.cm
+ Rubinius.run_script cl.compiled_code
Rubinius::CodeLoader.loaded_hook.trigger!(name)
View
12 kernel/common/kernel18.rb
@@ -3,10 +3,10 @@
module Kernel
def method(name)
name = Rubinius::Type.coerce_to_symbol name
- cm = Rubinius.find_method(self, name)
+ code = Rubinius.find_method(self, name)
- if cm
- Method.new(self, cm[1], cm[0], name)
+ if code
+ Method.new(self, code[1], code[0], name)
else
raise NameError, "undefined method `#{name}' for #{self.inspect}"
end
@@ -155,10 +155,10 @@ def type
def method(name)
name = Rubinius::Type.coerce_to_symbol name
- cm = Rubinius.find_method(self, name)
+ code = Rubinius.find_method(self, name)
- if cm
- return Method.new(self, cm[1], cm[0], name)
+ if code
+ return Method.new(self, code[1], code[0], name)
else
raise NameError, "undefined method `#{name}' for #{self.inspect}"
end
View
12 kernel/common/kernel19.rb
@@ -3,10 +3,10 @@
module Kernel
def method(name)
name = Rubinius::Type.coerce_to_symbol name
- cm = Rubinius.find_method(self, name)
+ code = Rubinius.find_method(self, name)
- if cm
- Method.new(self, cm[1], cm[0], name)
+ if code
+ Method.new(self, code[1], code[0], name)
elsif respond_to_missing?(name, true)
Method.new(self, self.class, Rubinius::MissingMethod.new(self, name), name)
else
@@ -16,10 +16,10 @@ def method(name)
def public_method(name)
name = Rubinius::Type.coerce_to_symbol name
- cm = Rubinius.find_public_method(self, name)
+ code = Rubinius.find_public_method(self, name)
- if cm
- Method.new(self, cm[1], cm[0], name)
+ if code
+ Method.new(self, code[1], code[0], name)
elsif respond_to_missing?(name, false)
Method.new(self, self.class, Rubinius::MissingMethod.new(self, name), name)
else
View
34 kernel/common/module.rb
@@ -306,11 +306,11 @@ def define_method(name, meth = undefined, &prc)
case meth
when Proc::Method
- cm = Rubinius::DelegatedMethod.new(name, :call, meth, false)
+ code = Rubinius::DelegatedMethod.new(name, :call, meth, false)
when Proc
be = meth.block.dup
be.change_name name
- cm = Rubinius::BlockEnvironment::AsMethod.new(be)
+ code = Rubinius::BlockEnvironment::AsMethod.new(be)
meth = lambda(&meth)
when Method
exec = meth.executable
@@ -319,23 +319,23 @@ def define_method(name, meth = undefined, &prc)
# a huge delegated method chain. So instead, just see through them at one
# level always.
if exec.kind_of? Rubinius::DelegatedMethod
- cm = exec
+ code = exec
else
- cm = Rubinius::DelegatedMethod.new(name, :call_on_instance, meth.unbind, true)
+ code = Rubinius::DelegatedMethod.new(name, :call_on_instance, meth.unbind, true)
end
when UnboundMethod
exec = meth.executable
# Same reasoning as above.
if exec.kind_of? Rubinius::DelegatedMethod
- cm = exec
+ code = exec
else
- cm = Rubinius::DelegatedMethod.new(name, :call_on_instance, meth, true)
+ code = Rubinius::DelegatedMethod.new(name, :call_on_instance, meth, true)
end
else
raise TypeError, "wrong argument type #{meth.class} (expected Proc/Method)"
end
- Rubinius.add_method name, cm, self, :public
+ Rubinius.add_method name, code, self, :public
meth
end
@@ -601,10 +601,10 @@ def initialize_copy(other)
private :initialize_copy
- def add_ivars(cm)
- case cm
+ def add_ivars(code)
+ case code
when Rubinius::CompiledCode
- new_ivars = cm.literals.select { |l| l.kind_of?(Symbol) and l.is_ivar? }
+ new_ivars = code.literals.select { |l| l.kind_of?(Symbol) and l.is_ivar? }
return if new_ivars.empty?
if @seen_ivars
@@ -618,12 +618,12 @@ def add_ivars(cm)
end
when Rubinius::AccessVariable
if @seen_ivars
- @seen_ivars << cm.name
+ @seen_ivars << code.name
else
- @seen_ivars = [cm.name]
+ @seen_ivars = [code.name]
end
else
- raise "Unknown type of method to learn ivars - #{cm.class}"
+ raise "Unknown type of method to learn ivars - #{code.class}"
end
end
@@ -640,14 +640,14 @@ def dynamic_method(name, file="(dynamic)", line=1)
g.use_detected
g.encode
- cm = g.package Rubinius::CompiledCode
+ code = g.package Rubinius::CompiledCode
- cm.scope =
+ code.scope =
Rubinius::ConstantScope.new(self, Rubinius::ConstantScope.new(Object))
- Rubinius.add_method name, cm, self, :public
+ Rubinius.add_method name, code, self, :public
- return cm
+ return code
end
def freeze
View
12 kernel/common/proc.rb
@@ -75,7 +75,7 @@ def parameters
return @bound_method.parameters
end
- code = @block.code
+ code = @block.compiled_code
return [] unless code.respond_to? :local_names
@@ -149,14 +149,14 @@ def self.new(meth)
end
def inspect
- cm = @bound_method.executable
- if cm.respond_to? :file
- if cm.lines
- line = cm.first_line
+ code = @bound_method.executable
+ if code.respond_to? :file
+ if code.lines
+ line = code.first_line
else
line = "-1"
end
- file = cm.file
+ file = code.file
else
line = "-1"
file = "(unknown)"
View
4 kernel/common/sprinter.rb
@@ -37,14 +37,14 @@ def self.get(format)
end
def initialize(format)
- cm = Rubinius::Type.object_singleton_class(self).dynamic_method :call do |g|
+ code = Rubinius::Type.object_singleton_class(self).dynamic_method :call do |g|
Builder.new(self, format, g).build
end
if false
puts
puts format.inspect
- puts cm.decode
+ puts code.decode
puts
end
end
View
4 kernel/common/thread.rb
@@ -123,12 +123,12 @@ def randomizer
def backtrace
mri_backtrace.map do |tup|
- cm = tup[0]
+ code = tup[0]
line = tup[1]
is_block = tup[2]
name = tup[3]
- "#{cm.active_path}:#{line}:in `#{name}'"
+ "#{code.active_path}:#{line}:in `#{name}'"
end
end
View
4 kernel/delta/class.rb
@@ -1,7 +1,7 @@
# -*- encoding: us-ascii -*-
-cm = Class.method_table.lookup(:new).method
-cm.serial = Rubinius::CompiledCode::KernelMethodSerial
+code = Class.method_table.lookup(:new).method
+code.serial = Rubinius::CompiledCode::KernelMethodSerial
class Class
undef_method :extend_object
View
22 kernel/delta/codeloader.rb
@@ -36,7 +36,7 @@ def require_compiled(check_version=true)
req = self.require
- Rubinius.run_script self.cm
+ Rubinius.run_script self.compiled_code
CodeLoader.loaded_hook.trigger!(@path)
@@ -65,7 +65,7 @@ def load_script(debug)
script.make_main!
- Rubinius.run_script self.cm
+ Rubinius.run_script self.compiled_code
CodeLoader.loaded_hook.trigger!(@path)
end
@@ -130,7 +130,7 @@ def load_file(wrap=false)
version = Rubinius::RUBY_LIB_VERSION
if CodeLoader.load_compiled
- cm = load_compiled_file @load_path, signature, version
+ code = load_compiled_file @load_path, signature, version
else
compiled_name = Compiler.compiled_name @load_path
@@ -139,32 +139,32 @@ def load_file(wrap=false)
compiled_stat = File::Stat.stat compiled_name
if compiled_stat and @stat.mtime > compiled_stat.mtime
- cm = compile_file @load_path, compiled_name
+ code = compile_file @load_path, compiled_name
else
begin
- cm = load_compiled_file compiled_name, signature, version
+ code = load_compiled_file compiled_name, signature, version
rescue TypeError, InvalidRBC
- cm = compile_file @load_path, compiled_name
+ code = compile_file @load_path, compiled_name
end
end
rescue Errno::ENOENT
- cm = compile_file @load_path, compiled_name
+ code = compile_file @load_path, compiled_name
end
else
- cm = compile_file @load_path, compiled_name
+ code = compile_file @load_path, compiled_name
end
end
- script = cm.create_script(wrap)
+ script = code.create_script(wrap)
script.file_path = @file_path
script.data_path = @load_path
- @cm = cm
+ @compiled_code = code
CodeLoader.compiled_hook.trigger! script
return script
end
- attr_reader :cm
+ attr_reader :compiled_code
# Compile a Ruby source file and save the compiled file. Return the
# internal representation (CompiledCode) of the Ruby source file.
View
38 lib/compiler/compiled_file.rb
@@ -37,10 +37,10 @@ def self.load(stream)
end
##
- # Writes the CompiledFile +cm+ to +file+.
- def self.dump(cm, file, signature, version)
+ # Writes the CompiledFile +code+ to +file+.
+ def self.dump(code, file, signature, version)
File.open(file, "wb") do |f|
- new("!RBIX", signature, version).encode_to(f, cm)
+ new("!RBIX", signature, version).encode_to(f, code)
end
rescue SystemCallError
# just skip writing the compiled file if we don't have permissions
@@ -174,22 +174,22 @@ def unmarshal_data
if version != 1
raise "Unknown CompiledCode version #{version}"
end
- cm = CompiledCode.new
- cm.metadata = unmarshal_data
- cm.primitive = unmarshal_data
- cm.name = unmarshal_data
- cm.iseq = unmarshal_data
- cm.stack_size = unmarshal_data
- cm.local_count = unmarshal_data
- cm.required_args = unmarshal_data
- cm.post_args = unmarshal_data
- cm.total_args = unmarshal_data
- cm.splat = unmarshal_data
- cm.literals = unmarshal_data
- cm.lines = unmarshal_data
- cm.file = unmarshal_data
- cm.local_names = unmarshal_data
- return cm
+ code = CompiledCode.new
+ code.metadata = unmarshal_data
+ code.primitive = unmarshal_data
+ code.name = unmarshal_data
+ code.iseq = unmarshal_data
+ code.stack_size = unmarshal_data
+ code.local_count = unmarshal_data
+ code.required_args = unmarshal_data
+ code.post_args = unmarshal_data
+ code.total_args = unmarshal_data
+ code.splat = unmarshal_data
+ code.literals = unmarshal_data
+ code.lines = unmarshal_data
+ code.file = unmarshal_data
+ code.local_names = unmarshal_data
+ return code
else
raise "Unknown type '#{kind.chr}'"
end
View
24 lib/compiler/compiler.rb
@@ -285,8 +285,8 @@ def self.eval_cache
def self.compile_eval(string, variable_scope, file="(eval)", line=1)
if ec = @eval_cache
layout = variable_scope.local_layout
- if cm = ec.retrieve([string, layout, line])
- return cm
+ if code = ec.retrieve([string, layout, line])
+ return code
end
end
@@ -299,31 +299,31 @@ def self.compile_eval(string, variable_scope, file="(eval)", line=1)
compiler.generator.variable_scope = variable_scope
- cm = compiler.run
+ code = compiler.run
- cm.add_metadata :for_eval, true
+ code.add_metadata :for_eval, true
if ec and parser.should_cache?
- ec.set([string.dup, layout, line], cm)
+ ec.set([string.dup, layout, line], code)
end
- return cm
+ return code
end
def self.construct_block(string, binding, file="(eval)", line=1)
- cm = compile_eval string, binding.variables, file, line
+ code = compile_eval string, binding.variables, file, line
- cm.scope = binding.constant_scope
- cm.name = binding.variables.method.name
+ code.scope = binding.constant_scope
+ code.name = binding.variables.method.name
# This has to be setup so __FILE__ works in eval.
- script = Rubinius::CompiledCode::Script.new(cm, file, true)
+ script = Rubinius::CompiledCode::Script.new(code, file, true)
script.eval_source = string
- cm.scope.script = script
+ code.scope.script = script
be = Rubinius::BlockEnvironment.new
- be.under_context binding.variables, cm
+ be.under_context binding.variables, code
# Pass the BlockEnvironment this binding was created from
# down into the new BlockEnvironment we just created.
View
36 lib/compiler/generator.rb
@@ -311,28 +311,28 @@ def encode
def package(klass)
@generators.each { |x| @literals[x] = @literals[x].package klass }
- cm = klass.new
- cm.iseq = @iseq
- cm.literals = @literals.to_tuple
- cm.lines = @lines.to_tuple
-
- cm.required_args = @required_args
- cm.post_args = @post_args
- cm.total_args = @total_args
- cm.splat = @splat_index
- cm.local_count = @local_count
- cm.local_names = @local_names.to_tuple if @local_names
-
- cm.stack_size = max_stack_size
- cm.file = @file
- cm.name = @name
- cm.primitive = @primitive
+ code = klass.new
+ code.iseq = @iseq
+ code.literals = @literals.to_tuple
+ code.lines = @lines.to_tuple
+
+ code.required_args = @required_args
+ code.post_args = @post_args
+ code.total_args = @total_args
+ code.splat = @splat_index
+ code.local_count = @local_count
+ code.local_names = @local_names.to_tuple if @local_names
+
+ code.stack_size = max_stack_size
+ code.file = @file
+ code.name = @name
+ code.primitive = @primitive
if @for_block
- cm.add_metadata :for_block, true
+ code.add_metadata :for_block, true
end
- cm
+ code
end
def use_detected
View
36 lib/compiler/printers.rb
@@ -40,21 +40,21 @@ def match?(name)
@method_names.include? name
end
- def print_header(cm)
- name = cm.name.inspect
+ def print_header(code)
+ name = code.name.inspect
size = (SEPARATOR_SIZE - name.size - 2) / 2
size = 1 if size <= 0
puts "\n#{"=" * size} #{name} #{"=" * (size + name.size % 2)}"
print "Arguments: "
- print "#{cm.required_args} required, "
- print "#{cm.post_args} post, "
- print "#{cm.total_args} total"
- print cm.splat ? ", (splat #{cm.splat})\n" : "\n"
- puts "Arity: #{cm.arity}"
- print "Locals: #{cm.local_count}"
- print cm.local_count > 0 ? ": #{cm.local_names.join ", "}\n" : "\n"
- puts "Stack size: #{cm.stack_size}"
- print_lines cm
+ print "#{code.required_args} required, "
+ print "#{code.post_args} post, "
+ print "#{code.total_args} total"
+ print code.splat ? ", (splat #{code.splat})\n" : "\n"
+ puts "Arity: #{code.arity}"
+ print "Locals: #{code.local_count}"
+ print code.local_count > 0 ? ": #{code.local_names.join ", "}\n" : "\n"
+ puts "Stack size: #{code.stack_size}"
+ print_lines code
puts
end
@@ -62,8 +62,8 @@ def print_footer
puts "-" * SEPARATOR_SIZE
end
- def print_lines(cm)
- lines = cm.lines
+ def print_lines(code)
+ lines = code.lines
size = lines.size - 1
i = 1
@@ -81,14 +81,14 @@ def print_lines(cm)
puts
end
- def print_method(cm)
- if match? cm.name
- print_header cm
- puts cm.decode if @bytecode
+ def print_method(code)
+ if match? code.name
+ print_header code
+ puts code.decode if @bytecode
print_footer
end
- cm.literals.each do |m|
+ code.literals.each do |m|
next unless m.kind_of? Rubinius::CompiledCode
print_method m
end
View
2  spec/core/kernel/fixtures/classes.rb
@@ -25,7 +25,7 @@ def self.cache_file(name, cache)
code = File.read name
be = Rubinius::Compiler.construct_block code, empty_binding, name
- Rubinius::CompiledFile.dump be.code, cache, 0, 0
+ Rubinius::CompiledFile.dump be.compiled_code, cache, 0, 0
end
def self.run_cache(cache)
View
8 vm/builtin/block_as_method.cpp
@@ -26,9 +26,9 @@ namespace rubinius {
{
BlockAsMethod* bm = as<BlockAsMethod>(exec);
- Object* splat = bm->block_env()->code()->splat();
- size_t required = bm->block_env()->code()->required_args()->to_native();
- size_t total_args = bm->block_env()->code()->total_args()->to_native();
+ Object* splat = bm->block_env()->compiled_code()->splat();
+ size_t required = bm->block_env()->compiled_code()->required_args()->to_native();
+ size_t total_args = bm->block_env()->compiled_code()->total_args()->to_native();
/*
* These are the block shapes, required args, and splat that we may see,
@@ -77,7 +77,7 @@ namespace rubinius {
}
BlockInvocation invocation(args.recv(),
- bm->block_env()->code()->scope(),
+ bm->block_env()->compiled_code()->scope(),
CallFrame::cIsLambda | CallFrame::cBlockAsMethod);
invocation.module = mod;
View
36 vm/builtin/block_environment.cpp
@@ -53,14 +53,14 @@ namespace rubinius {
}
MachineCode* BlockEnvironment::machine_code(STATE, GCToken gct) {
- return code_->internalize(state, gct);
+ return compiled_code_->internalize(state, gct);
}
Object* BlockEnvironment::invoke(STATE, CallFrame* previous,
BlockEnvironment* env, Arguments& args,
BlockInvocation& invocation)
{
- MachineCode* mcode = env->code_->machine_code();
+ MachineCode* mcode = env->compiled_code_->machine_code();
if(!mcode) {
OnStack<2> os(state, env, args.argument_container_location());
@@ -261,7 +261,7 @@ namespace rubinius {
{
// Don't use env->machine_code() because it might lock and the work should
// already be done.
- MachineCode* const mcode = env->code_->machine_code();
+ MachineCode* const mcode = env->compiled_code_->machine_code();
if(!mcode) {
Exception::internal_error(state, previous, "invalid bytecode method");
@@ -273,7 +273,7 @@ namespace rubinius {
if(mcode->call_count >= state->shared().config.jit_call_til_compile) {
LLVMState* ls = LLVMState::get(state);
- ls->compile_soon(state, env->code(), env, true);
+ ls->compile_soon(state, env->compiled_code(), env, true);
} else {
mcode->call_count++;
@@ -298,12 +298,12 @@ namespace rubinius {
frame->arguments = &args;
frame->dispatch_data = reinterpret_cast<BlockEnvironment*>(env);
- frame->cm = env->code_;
- frame->scope = scope;
+ frame->compiled_code = env->compiled_code_;
+ frame->scope = scope;
frame->top_scope_ = env->top_scope_;
- frame->flags = invocation.flags | CallFrame::cCustomConstantScope
- | CallFrame::cMultipleScopes
- | CallFrame::cBlock;
+ frame->flags = invocation.flags | CallFrame::cCustomConstantScope
+ | CallFrame::cMultipleScopes
+ | CallFrame::cBlock;
// TODO: this is a quick hack to process block arguments in 1.9.
if(!LANGUAGE_18_ENABLED(state)) {
@@ -345,7 +345,7 @@ namespace rubinius {
Object* BlockEnvironment::call(STATE, CallFrame* call_frame,
Arguments& args, int flags)
{
- BlockInvocation invocation(scope_->self(), code_->scope(), flags);
+ BlockInvocation invocation(scope_->self(), compiled_code_->scope(), flags);
return invoke(state, call_frame, this, args, invocation);
}
@@ -370,7 +370,7 @@ namespace rubinius {
Object* recv = args.shift(state);
- BlockInvocation invocation(recv, code_->scope(), flags);
+ BlockInvocation invocation(recv, compiled_code_->scope(), flags);
return invoke(state, call_frame, this, args, invocation);
}
@@ -396,14 +396,14 @@ namespace rubinius {
BlockEnvironment* BlockEnvironment::under_call_frame(STATE, GCToken gct,
- CompiledCode* cm, MachineCode* caller,
+ CompiledCode* ccode, MachineCode* caller,
CallFrame* call_frame)
{
- OnStack<1> os(state, cm);
+ OnStack<1> os(state, ccode);
state->set_call_frame(call_frame);
- MachineCode* mcode = cm->internalize(state, gct);
+ MachineCode* mcode = ccode->internalize(state, gct);
if(!mcode) {
Exception::internal_error(state, call_frame, "invalid bytecode method");
return 0;
@@ -414,7 +414,7 @@ namespace rubinius {
BlockEnvironment* be = state->new_object<BlockEnvironment>(G(blokenv));
be->scope(state, call_frame->promote_scope(state));
be->top_scope(state, call_frame->top_scope(state));
- be->code(state, cm);
+ be->compiled_code(state, ccode);
be->module(state, call_frame->module());
return be;
}
@@ -424,7 +424,7 @@ namespace rubinius {
be->scope(state, scope_);
be->top_scope(state, top_scope_);
- be->code(state, code_);
+ be->compiled_code(state, compiled_code_);
return be;
}
@@ -444,7 +444,7 @@ namespace rubinius {
return cNil;
}
- target->cm->machine_code()->set_no_inline();
+ target->compiled_code->machine_code()->set_no_inline();
if(target->scope) {
return target->scope->block();
@@ -459,7 +459,7 @@ namespace rubinius {
class_header(state, self);
//indent_attribute(++level, "scope"); be->scope()->show(state, level);
// indent_attribute(level, "top_scope"); be->top_scope()->show(state, level);
- indent_attribute(level, "code"); be->code()->show(state, level);
+ indent_attribute(level, "compiled_code"); be->compiled_code()->show(state, level);
close_body(level);
}
}
View
10 vm/builtin/block_environment.hpp
@@ -37,16 +37,16 @@ namespace rubinius {
const static object_type type = BlockEnvironmentType;
private:
- VariableScope* scope_; // slot
- VariableScope* top_scope_; // slot
- CompiledCode* code_; // slot
- Module* module_; // slot
+ VariableScope* scope_; // slot
+ VariableScope* top_scope_; // slot
+ CompiledCode* compiled_code_; // slot
+ Module* module_; // slot
public:
/* accessors */
attr_accessor(scope, VariableScope);
attr_accessor(top_scope, VariableScope);
- attr_accessor(code, CompiledCode);
+ attr_accessor(compiled_code, CompiledCode);
attr_accessor(module, Module);
/* interface */
View
100 vm/builtin/compiledcode.cpp
@@ -40,35 +40,35 @@
namespace rubinius {
void CompiledCode::init(STATE) {
- GO(cmethod).set(ontology::new_class(state,
+ GO(compiled_code).set(ontology::new_class(state,
"CompiledCode", G(executable), G(rubinius)));
- G(cmethod)->set_object_type(state, CompiledCodeType);
+ G(compiled_code)->set_object_type(state, CompiledCodeType);
}
CompiledCode* CompiledCode::create(STATE) {
- CompiledCode* cm = state->new_object<CompiledCode>(G(cmethod));
- cm->local_count(state, Fixnum::from(0));
- cm->set_executor(CompiledCode::default_executor);
- cm->machine_code_ = NULL;
- cm->inliners_ = 0;
- cm->prim_index_ = -1;
+ CompiledCode* code = state->new_object<CompiledCode>(G(compiled_code));
+ code->local_count(state, Fixnum::from(0));
+ code->set_executor(CompiledCode::default_executor);
+ code->machine_code_ = NULL;
+ code->inliners_ = 0;
+ code->prim_index_ = -1;
#ifdef ENABLE_LLVM
- cm->jit_data_ = NULL;
+ code->jit_data_ = NULL;
#endif
- return cm;
+ return code;
}
- CompiledCode* CompiledCode::dup_cm(STATE) {
- CompiledCode* cm = CompiledCode::create(state);
- cm->copy_object(state, this);
+ CompiledCode* CompiledCode::dup(STATE) {
+ CompiledCode* code = CompiledCode::create(state);
+ code->copy_object(state, this);
- cm->set_executor(CompiledCode::default_executor);
- cm->jit_data_ = NULL;
- cm->machine_code_ = NULL;
+ code->set_executor(CompiledCode::default_executor);
+ code->jit_data_ = NULL;
+ code->machine_code_ = NULL;
- return cm;
+ return code;
}
int CompiledCode::start_line(STATE) {
@@ -169,34 +169,34 @@ namespace rubinius {
{
LockableScopedLock lg(state, &state->shared(), __FILE__, __LINE__);
- CompiledCode* cm = as<CompiledCode>(exec);
- if(cm->execute == default_executor) {
+ CompiledCode* code = as<CompiledCode>(exec);
+ if(code->execute == default_executor) {
const char* reason = 0;
int ip = -1;
- OnStack<4> os(state, cm, exec, mod, args.argument_container_location());
+ OnStack<4> os(state, code, exec, mod, args.argument_container_location());
GCTokenImpl gct;
- if(!cm->internalize(state, gct, &reason, &ip)) {
- Exception::bytecode_error(state, call_frame, cm, ip, reason);
+ if(!code->internalize(state, gct, &reason, &ip)) {
+ Exception::bytecode_error(state, call_frame, code, ip, reason);
return 0;
}
}
lg.unlock();
- return cm->execute(state, call_frame, exec, mod, args);
+ return code->execute(state, call_frame, exec, mod, args);
}
Object* CompiledCode::specialized_executor(STATE, CallFrame* call_frame,
Executable* exec, Module* mod, Arguments& args)
{
- CompiledCode* cm = as<CompiledCode>(exec);
+ CompiledCode* code = as<CompiledCode>(exec);
Class* cls = args.recv()->class_object(state);
int id = cls->class_id();
- MachineCode* v = cm->machine_code();
+ MachineCode* v = code->machine_code();
executor target = v->unspecialized;
@@ -363,8 +363,8 @@ namespace rubinius {
CompiledCode* CompiledCode::of_sender(STATE, CallFrame* calling_environment) {
CallFrame* caller = calling_environment->previous;
if(caller) {
- if(caller->cm) {
- return caller->cm;
+ if(caller->compiled_code) {
+ return caller->compiled_code;
}
}
@@ -372,7 +372,7 @@ namespace rubinius {
}
CompiledCode* CompiledCode::current(STATE, CallFrame* calling_environment) {
- return calling_environment->cm;
+ return calling_environment->compiled_code;
}
void CompiledCode::Info::mark(Object* obj, ObjectMark& mark) {
@@ -380,25 +380,25 @@ namespace rubinius {
mark_inliners(obj, mark);
- CompiledCode* cm = as<CompiledCode>(obj);
- if(!cm->machine_code_) return;
+ CompiledCode* code = as<CompiledCode>(obj);
+ if(!code->machine_code_) return;
- MachineCode* mcode = cm->machine_code_;
+ MachineCode* mcode = code->machine_code_;
mcode->set_mark();
Object* tmp;
#ifdef ENABLE_LLVM
- if(cm->jit_data()) {
- cm->jit_data()->set_mark();
- cm->jit_data()->mark_all(cm, mark);
+ if(code->jit_data()) {
+ code->jit_data()->set_mark();
+ code->jit_data()->mark_all(code, mark);
}
for(int i = 0; i < MachineCode::cMaxSpecializations; i++) {
if(mcode->specializations[i].jit_data) {
mcode->specializations[i].jit_data->set_mark();
- mcode->specializations[i].jit_data->mark_all(cm, mark);
+ mcode->specializations[i].jit_data->mark_all(code, mark);
}
}
#endif
@@ -428,30 +428,30 @@ namespace rubinius {
}
void CompiledCode::Info::show(STATE, Object* self, int level) {
- CompiledCode* cm = as<CompiledCode>(self);
+ CompiledCode* code = as<CompiledCode>(self);
class_header(state, self);
- indent_attribute(++level, "file"); cm->file()->show(state, level);
- indent_attribute(level, "iseq"); cm->iseq()->show(state, level);
- indent_attribute(level, "lines"); cm->lines()->show_simple(state, level);
- indent_attribute(level, "literals"); cm->literals()->show_simple(state, level);
- indent_attribute(level, "local_count"); cm->local_count()->show(state, level);
- indent_attribute(level, "local_names"); cm->local_names()->show_simple(state, level);
- indent_attribute(level, "name"); cm->name()->show(state, level);
- indent_attribute(level, "required_args"); cm->required_args()->show(state, level);
- indent_attribute(level, "scope"); cm->scope()->show(state, level);
- indent_attribute(level, "splat"); cm->splat()->show(state, level);
- indent_attribute(level, "stack_size"); cm->stack_size()->show(state, level);
- indent_attribute(level, "total_args"); cm->total_args()->show(state, level);
+ indent_attribute(++level, "file"); code->file()->show(state, level);
+ indent_attribute(level, "iseq"); code->iseq()->show(state, level);
+ indent_attribute(level, "lines"); code->lines()->show_simple(state, level);
+ indent_attribute(level, "literals"); code->literals()->show_simple(state, level);
+ indent_attribute(level, "local_count"); code->local_count()->show(state, level);
+ indent_attribute(level, "local_names"); code->local_names()->show_simple(state, level);
+ indent_attribute(level, "name"); code->name()->show(state, level);
+ indent_attribute(level, "required_args"); code->required_args()->show(state, level);
+ indent_attribute(level, "scope"); code->scope()->show(state, level);
+ indent_attribute(level, "splat"); code->splat()->show(state, level);
+ indent_attribute(level, "stack_size"); code->stack_size()->show(state, level);
+ indent_attribute(level, "total_args"); code->total_args()->show(state, level);
indent_attribute(level, "internalized");
- if(!cm->machine_code_) {
+ if(!code->machine_code_) {
std::cout << "no\n";
} else {
std::cout << "yes\n";
#ifdef ENABLE_LLVM
- MachineCode* v = cm->machine_code();
+ MachineCode* v = code->machine_code();
for(int i = 0; i < MachineCode::cMaxSpecializations; i++) {
if(!v->specializations[i].jit_data) continue;
View
2  vm/builtin/compiledcode.hpp
@@ -117,7 +117,7 @@ namespace rubinius {
static CompiledCode* current(STATE, CallFrame* calling_environment);
// Rubinius.primitive :compiledcode_dup
- CompiledCode* dup_cm(STATE);
+ CompiledCode* dup(STATE);
String* full_name(STATE);
View
4 vm/builtin/exception.cpp
@@ -94,10 +94,10 @@ namespace rubinius {
}
void Exception::bytecode_error(STATE, CallFrame* call_frame,
- CompiledCode* cm, int ip, const char* reason)
+ CompiledCode* code, int ip, const char* reason)
{
Exception* exc = Exception::make_exception(state, G(exc_vm_bad_bytecode), reason);
- exc->set_ivar(state, state->symbol("@compiled_code"), cm);
+ exc->set_ivar(state, state->symbol("@compiled_code"), code);
exc->set_ivar(state, state->symbol("@ip"), Fixnum::from(ip));
exc->locations(state, Location::from_call_stack(state, call_frame));
state->raise_exception(exc);
View
2  vm/builtin/exception.hpp
@@ -79,7 +79,7 @@ namespace rubinius {
static Exception* make_lje(STATE, CallFrame* frame);
static void internal_error(STATE, CallFrame* frame, const char* reason);
- static void bytecode_error(STATE, CallFrame* frame, CompiledCode* cm,
+ static void bytecode_error(STATE, CallFrame* frame, CompiledCode* code,
int ip, const char* reason);
static void frozen_error(STATE, CallFrame* frame);
View
10 vm/builtin/executable.cpp
@@ -68,11 +68,11 @@ namespace rubinius {
return dis.send(state, call_frame, args);
}
- void Executable::add_inliner(ObjectMemory* om, CompiledCode* cm) {
+ void Executable::add_inliner(ObjectMemory* om, CompiledCode* code) {
if(!inliners_ || inliners_ == (Inliners*)cNil) inliners_ = new Inliners(om);
- inliners_->inliners().push_back(cm);
+ inliners_->inliners().push_back(code);
- om->write_barrier(this, cm);
+ om->write_barrier(this, code);
}
void Executable::clear_inliners(STATE) {
@@ -103,9 +103,9 @@ namespace rubinius {
for(std::list<CompiledCode*>::iterator i = inl->inliners().begin();
i != inl->inliners().end();
++i) {
- CompiledCode* cm = *i;
+ CompiledCode* code = *i;
- Object* tmp = mark.call(cm);
+ Object* tmp = mark.call(code);
if(tmp) {
assert(kind_of<CompiledCode>(tmp));
*i = (CompiledCode*)tmp;
View
2  vm/builtin/executable.hpp
@@ -73,7 +73,7 @@ namespace rubinius {
bool resolve_primitive(STATE);
- void add_inliner(ObjectMemory* om, CompiledCode* cm);
+ void add_inliner(ObjectMemory* om, CompiledCode* code);
void clear_inliners(STATE);
class Info : public TypeInfo {
View
21 vm/builtin/location.cpp
@@ -31,7 +31,7 @@ namespace rubinius {
Location* loc = state->new_object<Location>(G(location));
loc->method_module(state, call_frame->module());
loc->receiver(state, call_frame->self());
- loc->method(state, call_frame->cm);
+ loc->method(state, call_frame->compiled_code);
loc->ip(state, Fixnum::from(call_frame->ip()));
loc->flags(state, Fixnum::from(0));
@@ -42,7 +42,7 @@ namespace rubinius {
loc->name(state, call_frame->name());
}
- MachineCode* mcode = call_frame->cm->machine_code();
+ MachineCode* mcode = call_frame->compiled_code->machine_code();
if(mcode && mcode->jitted()) {
loc->set_is_jit(state);
}
@@ -95,7 +95,7 @@ namespace rubinius {
if(!call_frame) return bt;
// First the first normal frame
- while(!call_frame->cm) {
+ while(!call_frame->compiled_code) {
call_frame = call_frame->previous;
// Weird edge case.
if(!call_frame) return bt;
@@ -110,7 +110,7 @@ namespace rubinius {
while(call_frame) {
// Ignore synthetic frames
- if(call_frame->cm) {
+ if(call_frame->compiled_code) {
bt->append(state, Location::create(state, call_frame, include_vars));
} else if(NativeMethodFrame* nmf = call_frame->native_method_frame()) {
Location* loc = Location::create(state, nmf);
@@ -123,8 +123,8 @@ namespace rubinius {
return bt;
}
- static bool kernel_method(STATE, CompiledCode* cm) {
- std::string s = cm->file()->cpp_str(state);
+ static bool kernel_method(STATE, CompiledCode* code) {
+ std::string s = code->file()->cpp_str(state);
if(s.size() >= 7 && strncmp(s.data(), "kernel/", 7) == 0) return true;
return false;
}
@@ -134,7 +134,7 @@ namespace rubinius {
CallFrame* c = call_frame;
while(c) {
- if(c->cm) count++;
+ if(c->compiled_code) count++;
c = c->previous;
}
@@ -142,7 +142,8 @@ namespace rubinius {
while(call_frame) {
// Ignore synthetic frames
- if(call_frame->cm && !kernel_method(state, call_frame->cm)) {
+ if(call_frame->compiled_code &&
+ !kernel_method(state, call_frame->compiled_code)) {
Symbol* name;
Object* block = cFalse;
Fixnum* line = Fixnum::from(call_frame->line(state));
@@ -152,7 +153,7 @@ namespace rubinius {
name = call_frame->top_scope(state)->method()->name();
} else {
Symbol* current_name = call_frame->name();
- Symbol* method_name = call_frame->cm->name();
+ Symbol* method_name = call_frame->compiled_code->name();
if(current_name->nil_p()) {
if(method_name->nil_p()) {
@@ -166,7 +167,7 @@ namespace rubinius {
}
bt->append(state,
- Tuple::from(state, 4, call_frame->cm, line, block, name));
+ Tuple::from(state, 4, call_frame->compiled_code, line, block, name));
}
call_frame = call_frame->previous;
View
2  vm/builtin/nativemethod.cpp
@@ -635,7 +635,7 @@ namespace rubinius {
NativeMethodFrame nmf(env->current_native_frame());
CallFrame cf;
cf.previous = call_frame;
- cf.cm = 0;
+ cf.compiled_code = 0;
cf.scope = 0;
cf.optional_jit_data = 0;
cf.arguments = 0;
View
8 vm/builtin/proc.cpp
@@ -60,11 +60,11 @@ namespace rubinius {
// Check the arity in lambda mode
if(lambda_style && !block_->nil_p()) {
flags = CallFrame::cIsLambda;
- int total = self->block_->code()->total_args()->to_native();
- int required = self->block_->code()->required_args()->to_native();
+ int total = self->block_->compiled_code()->total_args()->to_native();
+ int required = self->block_->compiled_code()->required_args()->to_native();
bool arity_ok = false;
- if(Fixnum* fix = try_as<Fixnum>(self->block_->code()->splat())) {
+ if(Fixnum* fix = try_as<Fixnum>(self->block_->compiled_code()->splat())) {
switch(fix->to_native()) {
case -2:
arity_ok = true;
@@ -174,7 +174,7 @@ namespace rubinius {
// Check the arity in lambda mode
if(lambda_style) {
flags = CallFrame::cIsLambda;
- int required = block_->code()->required_args()->to_native();
+ int required = block_->compiled_code()->required_args()->to_native();
if(args.total() < 1 || (required >= 0 && (size_t)required != args.total() - 1)) {
Exception* exc =
View
24 vm/builtin/system.cpp
@@ -1054,7 +1054,7 @@ namespace rubinius {
MachineCode* mcode = env->machine_code(state, gct);
jit::Compiler jit(ls);
- jit.compile_block(ls, env->code(), mcode);
+ jit.compile_block(ls, env->compiled_code(), mcode);
if(show->true_p()) {
jit.show_machine_code();
@@ -1083,9 +1083,9 @@ namespace rubinius {
bool disable = CBOOL(o_disable);
while(obj) {
- if(CompiledCode* cm = try_as<CompiledCode>(obj)) {
- if(MachineCode* mcode = cm->machine_code()) {
- mcode->deoptimize(state, cm, 0, disable);
+ if(CompiledCode* code = try_as<CompiledCode>(obj)) {
+ if(MachineCode* mcode = code->machine_code()) {
+ mcode->deoptimize(state, code, 0, disable);
}
total++;
}
@@ -1570,25 +1570,25 @@ namespace rubinius {
return tuple;
}
- Object* System::vm_run_script(STATE, GCToken gct, CompiledCode* cm,
+ Object* System::vm_run_script(STATE, GCToken gct, CompiledCode* code,
CallFrame* calling_environment)
{
- Dispatch msg(state->symbol("__script__"), G(object), cm);
+ Dispatch msg(state->symbol("__script__"), G(object), code);
Arguments args(state->symbol("__script__"), G(main), cNil, 0, 0);
- OnStack<1> os(state, cm);
+ OnStack<1> os(state, code);
- cm->internalize(state, gct, 0, 0);
+ code->internalize(state, gct, 0, 0);
#ifdef RBX_PROFILER
if(unlikely(state->vm()->tooling())) {
- tooling::ScriptEntry me(state, cm);
- return cm->machine_code()->execute_as_script(state, cm, calling_environment);
+ tooling::ScriptEntry me(state, code);
+ return code->machine_code()->execute_as_script(state, code, calling_environment);
} else {
- return cm->machine_code()->execute_as_script(state, cm, calling_environment);
+ return code->machine_code()->execute_as_script(state, code, calling_environment);
}
#else
- return cm->machine_code()->execute_as_script(state, cm, calling_environment);
+ return code->machine_code()->execute_as_script(state, code, calling_environment);
#endif
}
View
2  vm/builtin/system.hpp
@@ -366,7 +366,7 @@ namespace rubinius {
static Tuple* vm_thread_state(STATE);
// Rubinius.primitive :vm_run_script
- static Object* vm_run_script(STATE, GCToken gct, CompiledCode* cm, CallFrame* calling_environment);
+ static Object* vm_run_script(STATE, GCToken gct, CompiledCode* code, CallFrame* calling_environment);
// Rubinius.primitive :vm_hash_trie_item_index
static Fixnum* vm_hash_trie_item_index(STATE, Fixnum* hash, Fixnum* level, Integer* map);
View
2  vm/builtin/thread.cpp
@@ -340,7 +340,7 @@ namespace rubinius {
VariableScope* scope = cf->promote_scope(state);
- return Tuple::from(state, 3, Fixnum::from(cf->ip()), cf->cm, scope);
+ return Tuple::from(state, 3, Fixnum::from(cf->ip()), cf->compiled_code, scope);
}
Array* Thread::mri_backtrace(STATE, GCToken gct, CallFrame* calling_environment) {
View
4 vm/bytecode_verification.cpp
@@ -15,8 +15,8 @@
#include "configuration.hpp"
namespace rubinius {
- BytecodeVerification::BytecodeVerification(CompiledCode* cm)
- : method_(cm)
+ BytecodeVerification::BytecodeVerification(CompiledCode* code)
+ : method_(code)
, max_stack_seen_(0)
, stack_(0)
, locals_(0)
View
2  vm/bytecode_verification.hpp
@@ -41,7 +41,7 @@ namespace rubinius {
};
public:
- BytecodeVerification(CompiledCode* cm);
+ BytecodeVerification(CompiledCode* code);
~BytecodeVerification();
bool verify(STATE);
View
21 vm/call_frame.cpp
@@ -95,7 +95,7 @@ namespace rubinius {
continue;
}
- if(!cf->cm) {
+ if(!cf->compiled_code) {
cf = cf->previous;
continue;
}
@@ -123,11 +123,12 @@ namespace rubinius {
std::string mod_name;
if(cf->module()->nil_p()) {
- mod_name = cf->cm->scope()->module()->debug_str(state);
+ mod_name = cf->compiled_code->scope()->module()->debug_str(state);
} else {
if((name = try_as<Symbol>(cf->module()->module_name()))) {
mod_name = name->debug_str(state);
- } else if((name = try_as<Symbol>(cf->cm->scope()->module()->module_name()))) {
+ } else if((name = try_as<Symbol>(
+ cf->compiled_code->scope()->module()->module_name()))) {
mod_name = name->debug_str(state);
} else {
mod_name = "<anonymous module>";
@@ -140,12 +141,12 @@ namespace rubinius {
if(name) {
stream << name->debug_str(state);
} else {
- stream << cf->cm->name()->debug_str(state);
+ stream << cf->compiled_code->name()->debug_str(state);
}
}
stream << " in ";
- if(Symbol* file_sym = try_as<Symbol>(cf->cm->file())) {
+ if(Symbol* file_sym = try_as<Symbol>(cf->compiled_code->file())) {
stream << file_sym->debug_str(state) << ":" << cf->line(state);
} else {
stream << "<unknown>";
@@ -166,8 +167,8 @@ namespace rubinius {
}
int CallFrame::line(STATE) {
- if(!cm) return -2; // trampoline context
- return cm->line(state, ip());
+ if(!compiled_code) return -2; // trampoline context
+ return compiled_code->line(state, ip());
}
// Walks the CallFrame list to see if +scope+ is still running
@@ -201,7 +202,7 @@ namespace rubinius {
} else if(dispatch_data) {
std::cout << "name=" << name()->debug_str(state) << " ";
} else {
- std::cout << "name=" << cm->name()->debug_str(state) << " ";
+ std::cout << "name=" << compiled_code->name()->debug_str(state) << " ";
}
std::cout << "ip=" << ip_ << " ";
@@ -212,9 +213,9 @@ namespace rubinius {
}
Object* CallFrame::find_breakpoint(STATE) {
- if(!cm) return 0;
+ if(!compiled_code) return 0;
- LookupTable* tbl = cm->breakpoints();
+ LookupTable* tbl = compiled_code->breakpoints();
if(tbl->nil_p()) return 0;
bool found = false;
View
8 vm/call_frame.hpp
@@ -44,7 +44,7 @@ namespace rubinius {
ConstantScope* constant_scope_;
void* dispatch_data;
- CompiledCode* cm;
+ CompiledCode* compiled_code;
int flags;
int ip_;
@@ -133,7 +133,7 @@ namespace rubinius {
#endif
Symbol* original_name() {
- return cm->name();
+ return compiled_code->name();
}
bool custom_constant_scope_p() {
@@ -154,7 +154,7 @@ namespace rubinius {
ConstantScope* constant_scope() {
if(custom_constant_scope_p()) return constant_scope_;
- return cm->scope();
+ return compiled_code->scope();
}
bool is_block_p(STATE) {
@@ -226,7 +226,7 @@ namespace rubinius {
}
void calculate_ip(void** pos) {
- ip_ = pos - cm->machine_code()->addresses;
+ ip_ = pos - compiled_code->machine_code()->addresses;
}
VariableScope* promote_scope_full(STATE);
View
6 vm/capi/18/include/rbxti.hpp
@@ -36,11 +36,11 @@ namespace rbxti {
typedef robject (*results_func)(Env* env);
typedef void (*enable_func)(Env* env);
- typedef void* (*enter_method)(Env* env, robject recv, rsymbol name, rmodule mod, rmethod cm);
- typedef void* (*enter_block)(Env* env, rsymbol name, rmodule module, rmethod cm);
+ typedef void* (*enter_method)(Env* env, robject recv, rsymbol name, rmodule mod, rmethod code);
+ typedef void* (*enter_block)(Env* env, rsymbol name, rmodule module, rmethod code);
typedef void (*leave_func)(Env* env, void* tag);
typedef void* (*enter_gc)(Env* env, int level);
- typedef void* (*enter_script)(Env* env, rmethod cm);
+ typedef void* (*enter_script)(Env* env, rmethod code);
typedef void (*shutdown_func)(Env* env);
typedef void (*thread_start_func)(Env* env);
View
6 vm/capi/19/include/rbxti.hpp
@@ -36,11 +36,11 @@ namespace rbxti {
typedef robject (*results_func)(Env* env);
typedef void (*enable_func)(Env* env);
- typedef void* (*enter_method)(Env* env, robject recv, rsymbol name, rmodule mod, rmethod cm);
- typedef void* (*enter_block)(Env* env, rsymbol name, rmodule module, rmethod cm);
+ typedef void* (*enter_method)(Env* env, robject recv, rsymbol name, rmodule mod, rmethod code);
+ typedef void* (*enter_block)(Env* env, rsymbol name, rmodule module, rmethod code);
typedef void (*leave_func)(Env* env, void* tag);
typedef void* (*enter_gc)(Env* env, int level);
- typedef void* (*enter_script)(Env* env, rmethod cm);
+ typedef void* (*enter_script)(Env* env, rmethod code);
typedef void (*shutdown_func)(Env* env);
typedef void (*thread_start_func)(Env* env);
View
8 vm/compiled_file.cpp
@@ -37,16 +37,16 @@ namespace rubinius {
}
bool CompiledFile::execute(STATE) {
- TypedRoot<CompiledCode*> cm(state, as<CompiledCode>(body(state)));
+ TypedRoot<CompiledCode*> code(state, as<CompiledCode>(body(state)));
state->thread_state()->clear();
Arguments args(state->symbol("script"), G(main), 0, 0);
- cm.get()->scope(state, ConstantScope::create(state));
- cm.get()->scope()->module(state, G(object));
+ code.get()->scope(state, ConstantScope::create(state));
+ code.get()->scope()->module(state, G(object));
- cm->execute(state, NULL, cm.get(), G(object), args);
+ code->execute(state, NULL, code.get(), G(object), args);
return true;
}
View
12 vm/gc/gc.cpp
@@ -136,7 +136,7 @@ namespace rubinius {
scope->block_ = mark_object(scope->block());
scope->module_ = (Module*)mark_object(scope->module());
- int locals = call_frame->cm->machine_code()->number_of_locals;
+ int locals = call_frame->compiled_code->machine_code()->number_of_locals;
for(int i = 0; i < locals; i++) {
Object* local = scope->get_local(i);
if(local->reference_p()) {
@@ -177,7 +177,7 @@ namespace rubinius {
call_frame = displace(call_frame, offset);
// Skip synthetic, non CompiledCode frames
- if(!call_frame->cm) {
+ if(!call_frame->compiled_code) {
call_frame = call_frame->previous;
continue;
}
@@ -189,12 +189,12 @@ namespace rubinius {
(ConstantScope*)mark_object(call_frame->constant_scope_);
}
- if(call_frame->cm && call_frame->cm->reference_p()) {
- call_frame->cm = (CompiledCode*)mark_object(call_frame->cm);
+ if(call_frame->compiled_code && call_frame->compiled_code->reference_p()) {
+ call_frame->compiled_code = (CompiledCode*)mark_object(call_frame->compiled_code);
}
- if(call_frame->cm && call_frame->stk) {
- native_int stack_size = call_frame->cm->stack_size()->to_native();
+ if(call_frame->compiled_code && call_frame->stk) {
+ native_int stack_size = call_frame->compiled_code->stack_size()->to_native();
for(native_int i = 0; i < stack_size; i++) {
Object* obj = call_frame->stk[i];
if(obj && obj->reference_p()) {
View
4 vm/globals.hpp
@@ -46,7 +46,7 @@ namespace rubinius {
* the constructor for Globals, again, at the END of the list. */
/* classes for the core 'types' */
- TypedRoot<Class*> cmethod, tuple, module, basicobject, object, array;
+ TypedRoot<Class*> compiled_code, tuple, module, basicobject, object, array;
TypedRoot<Class*> klass, methtbl, bytearray;
TypedRoot<Class*> blokenv, bignum, regexp, matchdata;
TypedRoot<Class*> string, symbol, io;
@@ -119,7 +119,7 @@ namespace rubinius {
TypedRoot<Class*> special_classes[SPECIAL_CLASS_SIZE];
Globals() :
- cmethod(&roots),
+ compiled_code(&roots),
tuple(&roots),
module(&roots),
basicobject(&roots),
View
16 vm/inline_cache.cpp
@@ -261,7 +261,7 @@ namespace rubinius {
set_cache(mce);
- call_frame->cm->write_barrier(state, mce);
+ call_frame->compiled_code->write_barrier(state, mce);
return mce;
}
@@ -280,7 +280,7 @@ namespace rubinius {
}
set_cache(mce);
- call_frame->cm->write_barrier(state, mce);
+ call_frame->compiled_code->write_barrier(state, mce);
return mce;
}
@@ -311,10 +311,10 @@ namespace rubinius {
cache->set_cache(mce);
- call_frame->cm->write_barrier(state, mce);
+ call_frame->compiled_code->write_barrier(state, mce);
cache->call_unit_ = cu;
- call_frame->cm->write_barrier(state, cu);
+ call_frame->compiled_code->write_barrier(state, cu);
cache->execute_backend_ = check_cache_custom;
@@ -382,7 +382,7 @@ namespace rubinius {
cache->set_cache(mce);
- call_frame->cm->write_barrier(state, mce);
+ call_frame->compiled_code->write_barrier(state, mce);
Executable* meth = mce->method();
Module* mod = mce->stored_module();
@@ -423,7 +423,7 @@ namespace rubinius {
cache->set_cache(mce);
- call_frame->cm->write_barrier(state, mce);
+ call_frame->compiled_code->write_barrier(state, mce);
Executable* meth = mce->method();
Module* mod = mce->stored_module();
@@ -464,7 +464,7 @@ namespace rubinius {
cache->set_cache(mce);
- call_frame->cm->write_barrier(state, mce);
+ call_frame->compiled_code->write_barrier(state, mce);
Executable* meth = mce->method();
Module* mod = mce->stored_module();
@@ -516,7 +516,7 @@ namespace rubinius {
cache->set_cache(mce);
- call_frame->cm->write_barrier(state, mce);
+ call_frame->compiled_code->write_barrier(state, mce);
Executable* meth = mce->method();
Module* mod = mce->stored_module();
View
4 vm/instructions.cpp
@@ -215,7 +215,7 @@ Object* MachineCode::uncommon_interpreter(STATE,
int32_t* input_unwinds)
{
- MachineCode* mc = method_call_frame->cm->machine_code();
+ MachineCode* mc = method_call_frame->compiled_code->machine_code();
if(++mc->uncommon_count > state->shared().config.jit_deoptimize_threshold) {
if(state->shared().config.jit_uncommon_print) {
@@ -227,7 +227,7 @@ Object* MachineCode::uncommon_interpreter(STATE,
}
mc->uncommon_count = 0;
- mc->deoptimize(state, method_call_frame->cm, rd);
+ mc->deoptimize(state, method_call_frame->compiled_code, rd);