Browse files

Rename StaticScope to ConstantScope... EVERYWHERE

StaticScope is (ehem, was) where constants were scoped to, so IMHO
ConstantScope makes for a much better name :)
  • Loading branch information...
1 parent 493ee4c commit a7b957a280ce08bdb67c2e90749f09b26eeb9d82 @txus txus committed with dbussink May 22, 2012
Showing with 287 additions and 288 deletions.
  1. +1 −1 kernel/bootstrap/block_environment.rb
  2. +6 −6 kernel/bootstrap/{static_scope.rb → constant_scope.rb}
  3. +1 −1 kernel/bootstrap/load_order18.txt
  4. +1 −1 kernel/bootstrap/load_order19.txt
  5. +1 −1 kernel/bootstrap/load_order20.txt
  6. +4 −4 kernel/common/binding.rb
  7. +1 −1 kernel/common/block_environment.rb
  8. +4 −4 kernel/common/compiled_method.rb
  9. +11 −11 kernel/common/{static_scope.rb → constant_scope.rb}
  10. +1 −1 kernel/common/{static_scope18.rb → constant_scope18.rb}
  11. +1 −1 kernel/common/{static_scope19.rb → constant_scope19.rb}
  12. +13 −13 kernel/common/eval.rb
  13. +11 −11 kernel/common/eval18.rb
  14. +11 −11 kernel/common/eval19.rb
  15. +1 −1 kernel/common/kernel19.rb
  16. +2 −2 kernel/common/load_order18.txt
  17. +2 −2 kernel/common/load_order19.txt
  18. +2 −2 kernel/common/load_order20.txt
  19. +1 −1 kernel/common/location.rb
  20. +1 −1 kernel/common/method_equality.rb
  21. +3 −3 kernel/common/module.rb
  22. +1 −1 kernel/common/range18.rb
  23. +8 −8 kernel/delta/rubinius.rb
  24. +1 −1 lib/compiler/compiler.rb
  25. +1 −1 lib/rubinius/debugger/frame.rb
  26. +0 −1 rakelib/jit.rake
  27. +1 −1 rakelib/vm.rake
  28. +3 −3 spec/ruby/CHANGES.before-2008-05-10
  29. +1 −1 vm/builtin/access_variable.hpp
  30. +5 −5 vm/builtin/block_environment.cpp
  31. +4 −4 vm/builtin/block_environment.hpp
  32. +1 −1 vm/builtin/class.cpp
  33. +1 −1 vm/builtin/class.hpp
  34. +1 −1 vm/builtin/compiledmethod.cpp
  35. +3 −3 vm/builtin/compiledmethod.hpp
  36. +19 −19 vm/builtin/{staticscope.cpp → constantscope.cpp}
  37. +12 −12 vm/builtin/{staticscope.hpp → constantscope.hpp}
  38. +4 −4 vm/builtin/global_cache_entry.cpp
  39. +6 −6 vm/builtin/global_cache_entry.hpp
  40. +1 −1 vm/builtin/location.cpp
  41. +3 −3 vm/builtin/location.hpp
  42. +1 −1 vm/builtin/object.cpp
  43. +5 −5 vm/builtin/system.cpp
  44. +5 −5 vm/builtin/system.hpp
  45. +1 −1 vm/call_frame.cpp
  46. +6 −6 vm/call_frame.hpp
  47. +1 −1 vm/codegen/field_extract.rb
  48. +2 −2 vm/compiled_file.cpp
  49. +6 −6 vm/gc/gc.cpp
  50. +2 −2 vm/globals.hpp
  51. +9 −9 vm/helpers.cpp
  52. +1 −1 vm/instructions.cpp
  53. +11 −11 vm/instructions.def
  54. +2 −2 vm/llvm/inline.cpp
  55. +1 −1 vm/llvm/inline.hpp
  56. +6 −6 vm/llvm/jit_block.cpp
  57. +3 −3 vm/llvm/jit_builder.cpp
  58. +1 −1 vm/llvm/jit_compiler.cpp
  59. +1 −1 vm/llvm/jit_method.cpp
  60. +9 −9 vm/llvm/jit_util.cpp
  61. +1 −1 vm/llvm/jit_visit.hpp
  62. +1 −1 vm/llvm/offset.hpp
  63. +2 −2 vm/llvm/offset_specific.hpp
  64. +4 −4 vm/llvm/state.cpp
  65. +7 −7 vm/llvm/types.cpp.gen
  66. +3 −3 vm/ontology.cpp
  67. +1 −1 vm/test/test_compiled_file.hpp
  68. +2 −2 vm/test/{test_staticscope.hpp → test_constantscope.hpp}
  69. +1 −1 web/404.html
  70. +1 −1 web/422.html
  71. +3 −3 web/_includes/instructions.markdown
  72. +1 −1 web/_site/404.html
  73. +1 −1 web/_site/422.html
  74. +3 −3 web/_site/doc/de/virtual-machine/instructions/index.html
  75. +3 −3 web/_site/doc/en/virtual-machine/instructions/index.html
  76. +3 −3 web/_site/doc/es/virtual-machine/instructions/index.html
  77. +3 −3 web/_site/doc/fr/virtual-machine/instructions/index.html
  78. +3 −3 web/_site/doc/it/virtual-machine/instructions/index.html
  79. +3 −3 web/_site/doc/ja/virtual-machine/instructions/index.html
  80. +3 −3 web/_site/doc/pl/virtual-machine/instructions/index.html
  81. +3 −3 web/_site/doc/pt-br/virtual-machine/instructions/index.html
  82. +3 −3 web/_site/doc/ru/virtual-machine/instructions/index.html
  83. +1 −1 web/_site/releases/1.2.2/index.html
  84. +1 −1 web/doc/pl/tools/memory-analysis.markdown
  85. +1 −1 web/doc/pt-br/contributing.markdown
  86. +1 −1 web/releases/1.2.2.markdown
View
2 kernel/bootstrap/block_environment.rb
@@ -12,7 +12,7 @@ def call(*args)
raise PrimitiveFailure, "BlockEnvironment#call primitive failed"
end
- def call_under(recv, static_scope, *args)
+ def call_under(recv, constant_scope, *args)
Rubinius.primitive :block_call_under
raise PrimitiveFailure, "BlockEnvironment#call_under primitive failed"
end
View
12 kernel/bootstrap/static_scope.rb → kernel/bootstrap/constant_scope.rb
@@ -1,32 +1,32 @@
# -*- encoding: us-ascii -*-
module Rubinius
- class StaticScope
+ class ConstantScope
def self.of_sender
- Rubinius.primitive :static_scope_of_sender
+ Rubinius.primitive :constant_scope_of_sender
raise PrimitiveFailure, "primitive failed"
end
def class_variable_get(sym)
- Rubinius.primitive :static_scope_cvar_get
+ Rubinius.primitive :constant_scope_cvar_get
raise NameError, "Invalid class variable name '#{sym}'"
end
def class_variable_set(sym, val)
- Rubinius.primitive :static_scope_cvar_set
+ Rubinius.primitive :constant_scope_cvar_set
raise NameError, "Invalid class variable name '#{sym}'"
end
def class_variable_defined?(sym)
- Rubinius.primitive :static_scope_cvar_defined
+ Rubinius.primitive :constant_scope_cvar_defined
raise NameError, "Invalid class variable name '#{sym}'"
end
def class_variable_get_or_set(sym, val)
- Rubinius.primitive :static_scope_cvar_get_or_set
+ Rubinius.primitive :constant_scope_cvar_get_or_set
raise NameError, "Invalid class variable name '#{sym}'"
end
View
2 kernel/bootstrap/load_order18.txt
@@ -29,7 +29,7 @@ process.rbc
regexp.rbc
rubinius.rbc
rubinius18.rbc
-static_scope.rbc
+constant_scope.rbc
string.rbc
symbol.rbc
thread.rbc
View
2 kernel/bootstrap/load_order19.txt
@@ -31,7 +31,7 @@ regexp.rbc
regexp19.rbc
rubinius.rbc
rubinius19.rbc
-static_scope.rbc
+constant_scope.rbc
string.rbc
string19.rbc
symbol.rbc
View
2 kernel/bootstrap/load_order20.txt
@@ -31,7 +31,7 @@ regexp.rbc
regexp19.rbc
rubinius.rbc
rubinius19.rbc
-static_scope.rbc
+constant_scope.rbc
string.rbc
string19.rbc
symbol.rbc
View
8 kernel/common/binding.rb
@@ -3,7 +3,7 @@
class Binding
attr_accessor :variables
attr_accessor :code
- attr_accessor :static_scope
+ attr_accessor :constant_scope
attr_accessor :proc_environment
attr_accessor :self
attr_accessor :line_number
@@ -18,18 +18,18 @@ def from_proc?
#
# +variables+ is a Rubinius::VariableScope object
# +code+ is a Rubinius::CompiledMethod object
- # +static_scope+ is a Rubinius::StaticScope object
+ # +constant_scope+ is a Rubinius::ConstantScope object
#
# See Kernel#binding in kernel/common/eval.rb for a simple example of
# creating a Binding object.
#
- def self.setup(variables, code, static_scope, recv=nil, location=nil)
+ def self.setup(variables, code, constant_scope, recv=nil, location=nil)
bind = allocate()
bind.self = recv || variables.self
bind.variables = variables
bind.code = code
- bind.static_scope = static_scope
+ bind.constant_scope = constant_scope
bind.line_number = location ? location.line : 1
return bind
View
2 kernel/common/block_environment.rb
@@ -41,7 +41,7 @@ def disable_scope!
@code.scope.using_disabled_scope
end
- def static_scope
+ def constant_scope
@code.scope
end
View
8 kernel/common/compiled_method.rb
@@ -165,13 +165,13 @@ def create_script(wrap=false)
script = CompiledMethod::Script.new(self)
# Setup the scoping.
- ss = StaticScope.new(Object)
- ss.script = script
+ cs = ConstantScope.new(Object)
+ cs.script = script
if wrap
- @scope = StaticScope.new(Module.new, ss)
+ @scope = ConstantScope.new(Module.new, cs)
else
- @scope = ss
+ @scope = cs
end
sc = Rubinius::Type.object_singleton_class(MAIN)
View
22 kernel/common/static_scope.rb → kernel/common/constant_scope.rb
@@ -7,7 +7,7 @@
# TODO: document
module Rubinius
- class StaticScope
+ class ConstantScope
#
# @todo Verify the recursion here does not cause problems. --rue
@@ -23,7 +23,7 @@ def initialize(mod, par = nil)
# Module or class this lexical scope enclosed into.
attr_reader :module
- # Static scope object this scope enclosed into.
+ # Constant scope object this scope enclosed into.
attr_reader :parent
# Module or class representing the 'current class'. MRI manipulates
@@ -50,24 +50,24 @@ def top_level?
!@parent
end
- # Use the same info as the current StaticScope, but set current_module to
- # +mod+. Chains off the current StaticScope.
+ # Use the same info as the current ConstantScope, but set current_module to
+ # +mod+. Chains off the current ConstantScope.
def using_current_as(mod)
if top_level?
# Don't chain up if this is a toplevel, create a new one.
- ss = dup
+ cs = dup
else
- ss = StaticScope.new @module, self
+ cs = ConstantScope.new @module, self
end
- ss.current_module = mod
- return ss
+ cs.current_module = mod
+ return cs
end
def using_disabled_scope
- ss = using_current_as(@module)
- ss.disabled_for_methods = true
- return ss
+ cs = using_current_as(@module)
+ cs.disabled_for_methods = true
+ return cs
end
def for_method_definition
View
2 kernel/common/static_scope18.rb → kernel/common/constant_scope18.rb
@@ -1,7 +1,7 @@
# -*- encoding: us-ascii -*-
module Rubinius
- class StaticScope
+ class ConstantScope
def const_defined?(name)
scope = self
View
2 kernel/common/static_scope19.rb → kernel/common/constant_scope19.rb
@@ -1,7 +1,7 @@
# -*- encoding: us-ascii -*-
module Rubinius
- class StaticScope
+ class ConstantScope
def const_defined?(name, search_parents=true)
scope = self
View
26 kernel/common/eval.rb
@@ -36,7 +36,7 @@ def binding
return Binding.setup(
Rubinius::VariableScope.of_sender,
Rubinius::CompiledMethod.of_sender,
- Rubinius::StaticScope.of_sender,
+ Rubinius::ConstantScope.of_sender,
self,
Rubinius::Location.of_closest_ruby_method
)
@@ -51,26 +51,26 @@ def eval(string, binding=nil, filename=nil, lineno=1)
if binding
binding = Rubinius::Type.coerce_to_binding binding
- filename ||= binding.static_scope.active_path
+ filename ||= binding.constant_scope.active_path
else
binding = Binding.setup(Rubinius::VariableScope.of_sender,
Rubinius::CompiledMethod.of_sender,
- Rubinius::StaticScope.of_sender,
+ Rubinius::ConstantScope.of_sender,
self)
filename ||= "(eval)"
end
- existing_scope = binding.static_scope
- binding.static_scope = existing_scope.dup
+ existing_scope = binding.constant_scope
+ binding.constant_scope = existing_scope.dup
be = Rubinius::Compiler.construct_block string, binding,
filename, lineno
be.set_eval_binding binding
result = be.call_on_instance(binding.self)
- binding.static_scope = existing_scope
+ binding.constant_scope = existing_scope
result
end
module_function :eval
@@ -87,34 +87,34 @@ class Module
def module_eval(string=undefined, filename="(eval)", line=1, &prc)
# we have a custom version with the prc, rather than using instance_exec
- # so that we can setup the StaticScope properly.
+ # so that we can setup the ConstantScope properly.
if prc
unless string.equal?(undefined)
raise ArgumentError, "cannot pass both string and proc"
end
# Return a copy of the BlockEnvironment with the receiver set to self
env = prc.block
- static_scope = env.repoint_scope self
- return env.call_under(self, static_scope, self)
+ constant_scope = env.repoint_scope self
+ return env.call_under(self, constant_scope, self)
elsif string.equal?(undefined)
raise ArgumentError, 'block not supplied'
end
string = StringValue(string)
filename = StringValue(filename)
- # The staticscope of a module_eval CM is the receiver of module_eval
- ss = Rubinius::StaticScope.new self, Rubinius::StaticScope.of_sender
+ # The constantscope of a module_eval CM is the receiver of module_eval
+ cs = Rubinius::ConstantScope.new self, Rubinius::ConstantScope.of_sender
binding = Binding.setup(Rubinius::VariableScope.of_sender,
Rubinius::CompiledMethod.of_sender,
- ss)
+ cs)
be = Rubinius::Compiler.construct_block string, binding,
filename, line
- be.call_under self, ss, self
+ be.call_under self, cs, self
end
alias_method :class_eval, :module_eval
View
22 kernel/common/eval18.rb
@@ -37,26 +37,26 @@ def instance_eval(string=nil, filename="(eval)", line=1, &prc)
env = prc.block
if sc
- static_scope = env.repoint_scope sc
+ constant_scope = env.repoint_scope sc
else
- static_scope = env.disable_scope!
+ constant_scope = env.disable_scope!
end
- return env.call_under(self, static_scope, self)
+ return env.call_under(self, constant_scope, self)
elsif string
string = StringValue(string)
- static_scope = Rubinius::StaticScope.of_sender
+ constant_scope = Rubinius::ConstantScope.of_sender
if sc
- static_scope = Rubinius::StaticScope.new(sc, static_scope)
+ constant_scope = Rubinius::ConstantScope.new(sc, constant_scope)
else
- static_scope = static_scope.using_disabled_scope
+ constant_scope = constant_scope.using_disabled_scope
end
binding = Binding.setup(Rubinius::VariableScope.of_sender,
Rubinius::CompiledMethod.of_sender,
- static_scope)
+ constant_scope)
be = Rubinius::Compiler.construct_block string, binding,
filename, line
@@ -95,14 +95,14 @@ def instance_exec(*args, &prc)
env = prc.block
- static_scope = env.static_scope
+ constant_scope = env.constant_scope
if ImmediateValue === self
- static_scope = static_scope.using_disabled_scope
+ constant_scope = constant_scope.using_disabled_scope
else
sc = Rubinius::Type.object_singleton_class(self)
- static_scope = static_scope.using_current_as(sc)
+ constant_scope = constant_scope.using_current_as(sc)
end
- return env.call_under(self, static_scope, *args)
+ return env.call_under(self, constant_scope, *args)
end
end
View
22 kernel/common/eval19.rb
@@ -37,26 +37,26 @@ def instance_eval(string=nil, filename="(eval)", line=1, &prc)
env = prc.block
if sc
- static_scope = env.repoint_scope sc
+ constant_scope = env.repoint_scope sc
else
- static_scope = env.disable_scope!
+ constant_scope = env.disable_scope!
end
- return env.call_under(self, static_scope, self)
+ return env.call_under(self, constant_scope, self)
elsif string
string = StringValue(string)
- static_scope = Rubinius::StaticScope.of_sender
+ constant_scope = Rubinius::ConstantScope.of_sender
if sc
- static_scope = Rubinius::StaticScope.new(sc, static_scope)
+ constant_scope = Rubinius::ConstantScope.new(sc, constant_scope)
else
- static_scope = static_scope.using_disabled_scope
+ constant_scope = constant_scope.using_disabled_scope
end
binding = Binding.setup(Rubinius::VariableScope.of_sender,
Rubinius::CompiledMethod.of_sender,
- static_scope)
+ constant_scope)
be = Rubinius::Compiler.construct_block string, binding,
filename, line
@@ -94,14 +94,14 @@ def instance_exec(*args, &prc)
return prc.bound_method.call(*args)
end
- static_scope = env.static_scope
+ constant_scope = env.constant_scope
if ImmediateValue === self
- static_scope = static_scope.using_disabled_scope
+ constant_scope = constant_scope.using_disabled_scope
else
sc = Rubinius::Type.object_singleton_class(self)
- static_scope = static_scope.using_current_as(sc)
+ constant_scope = constant_scope.using_current_as(sc)
end
- return env.call_under(self, static_scope, *args)
+ return env.call_under(self, constant_scope, *args)
end
end
View
2 kernel/common/kernel19.rb
@@ -172,7 +172,7 @@ def open(obj, *rest, &block)
# directory.
#
def require_relative(name)
- scope = Rubinius::StaticScope.of_sender
+ scope = Rubinius::ConstantScope.of_sender
Rubinius::CodeLoader.require_relative(name, scope)
end
module_function :require_relative
View
4 kernel/common/load_order18.txt
@@ -43,8 +43,8 @@ bytearray.rbc
bytearray18.rbc
channel.rbc
executable.rbc
-static_scope.rbc
-static_scope18.rbc
+constant_scope.rbc
+constant_scope18.rbc
hook.rbc
codeloader.rbc
codeloader18.rbc
View
4 kernel/common/load_order19.txt
@@ -45,8 +45,8 @@ bytearray.rbc
bytearray19.rbc
channel.rbc
executable.rbc
-static_scope.rbc
-static_scope19.rbc
+constant_scope.rbc
+constant_scope19.rbc
hook.rbc
codeloader.rbc
codeloader19.rbc
View
4 kernel/common/load_order20.txt
@@ -40,8 +40,8 @@ bytearray.rbc
bytearray19.rbc
channel.rbc
executable.rbc
-static_scope.rbc
-static_scope19.rbc
+constant_scope.rbc
+constant_scope19.rbc
hook.rbc
codeloader.rbc
codeloader19.rbc
View
2 kernel/common/location.rb
@@ -8,7 +8,7 @@ class Location
attr_reader :ip
attr_reader :variables
- attr_reader :static_scope
+ attr_reader :constant_scope
def self.of_closest_ruby_method
Rubinius.primitive :location_of_closest_ruby_method
View
2 kernel/common/method_equality.rb
@@ -15,4 +15,4 @@ def self.delegated_receiver_for(meth)
meth.executable.receiver if meth.executable.kind_of?(Rubinius::DelegatedMethod)
end
end
-end
+end
View
6 kernel/common/module.rb
@@ -437,8 +437,8 @@ def module_exec(*args, &prc)
raise LocalJumpError, "Missing block" unless block_given?
env = prc.block
- static_scope = env.repoint_scope self
- return env.call_under(self, static_scope, *args)
+ constant_scope = env.repoint_scope self
+ return env.call_under(self, constant_scope, *args)
end
alias_method :class_exec, :module_exec
@@ -633,7 +633,7 @@ def dynamic_method(name, file="(dynamic)", line=1)
cm = g.package Rubinius::CompiledMethod
cm.scope =
- Rubinius::StaticScope.new(self, Rubinius::StaticScope.new(Object))
+ Rubinius::ConstantScope.new(self, Rubinius::ConstantScope.new(Object))
Rubinius.add_method name, cm, self, :public
View
2 kernel/common/range18.rb
@@ -6,4 +6,4 @@ class Range
def can_iterate_from?(object)
object.respond_to? :succ
end
-end
+end
View
16 kernel/delta/rubinius.rb
@@ -80,21 +80,21 @@ def self.open_module(name, scope)
open_module_under name, under
end
- def self.add_defn_method(name, executable, static_scope, vis)
+ def self.add_defn_method(name, executable, constant_scope, vis)
executable.serial = 1
if executable.respond_to? :scope=
# If we're adding a method inside ane eval, dup it so that
# we don't share the CompiledMethod with the eval, since
# we're going to mutate it.
- if static_scope and script = static_scope.current_script
+ if constant_scope and script = constant_scope.current_script
if script.eval?
executable = executable.dup
end
end
- executable.scope = static_scope
+ executable.scope = constant_scope
end
- mod = static_scope.for_method_definition
+ mod = constant_scope.for_method_definition
if Type.object_kind_of?(mod, Class) and ai = Type.singleton_class_object(mod)
if Type.object_kind_of? ai, Numeric
@@ -171,18 +171,18 @@ def self.add_method(name, executable, mod, vis)
# Must be AFTER add_method, because otherwise we'll run this attach_method to add
# add_method itself and fail.
- def self.attach_method(name, executable, static_scope, recv)
+ def self.attach_method(name, executable, constant_scope, recv)
executable.serial = 1
if executable.respond_to? :scope=
# If we're adding a method inside ane eval, dup it so that
# we don't share the CompiledMethod with the eval, since
# we're going to mutate it.
- if static_scope and script = static_scope.current_script
+ if constant_scope and script = constant_scope.current_script
if script.eval?
executable = executable.dup
end
end
- executable.scope = static_scope
+ executable.scope = constant_scope
end
mod = Rubinius::Type.object_singleton_class recv
@@ -272,7 +272,7 @@ def self.allocation_site(obj)
# Returns nil if there is no file, such as inside eval.
#
def self.current_file
- ss = Rubinius::StaticScope.of_sender
+ cs = Rubinius::ConstantScope.of_sender
return ss.absolute_active_path
end
end
View
2 lib/compiler/compiler.rb
@@ -313,7 +313,7 @@ def self.compile_eval(string, variable_scope, file="(eval)", line=1)
def self.construct_block(string, binding, file="(eval)", line=1)
cm = compile_eval string, binding.variables, file, line
- cm.scope = binding.static_scope
+ cm.scope = binding.constant_scope
cm.name = binding.variables.method.name
# This has to be setup so __FILE__ works in eval.
View
2 lib/rubinius/debugger/frame.rb
@@ -16,7 +16,7 @@ def binding
@binding ||= Binding.setup(
@location.variables,
@location.method,
- @location.static_scope)
+ @location.constant_scope)
end
def method
View
1 rakelib/jit.rake
@@ -1,5 +1,4 @@
namespace :jit do
-
task :generate_header do
puts "GEN vm/llvm/types.cpp.gen"
`vendor/llvm/Release/bin/llvm-as < vm/llvm/types.ll > vm/gen/types.bc`
View
2 rakelib/vm.rake
@@ -87,7 +87,7 @@ field_extract_headers = %w[
vm/builtin/packed_object.hpp
vm/builtin/randomizer.hpp
vm/builtin/regexp.hpp
- vm/builtin/staticscope.hpp
+ vm/builtin/constantscope.hpp
vm/builtin/encoding.hpp
vm/builtin/string.hpp
vm/builtin/symbol.hpp
View
6 spec/ruby/CHANGES.before-2008-05-10
@@ -309,7 +309,7 @@ Date: Thu May 1 10:48:20 2008 -0700
This is the result of ping-pong between Evan and Wilson. It refactors
out enclosing_class from being used, and instead information is always
- pulled directly from the StaticScope object. This lets us inject proper
+ pulled directly from the ConstantScope object. This lets us inject proper
scoping changes in ruby.
commit 2db27aef88e2ca7752beba846d172ede276275e0
@@ -10207,8 +10207,8 @@ Date: Wed Dec 5 14:42:27 2007 -0800
Vastly simplify and fix constant lookup
* New constant lookup specs to test behavior
- * Added StaticScope object and field on CompiledMethod which stores
- a StaticScope instance which indicates the lexical scope of the CM.
+ * Added ConstantScope object and field on CompiledMethod which stores
+ a ConstantScope instance which indicates the lexical scope of the CM.
commit 163e56646a817301201af843b45c973da058688c
Author: Tilman Sauerbeck <tilman@code-monkey.de>
View
2 vm/builtin/access_variable.hpp
@@ -8,7 +8,7 @@ namespace rubinius {
class InstructionSequence;
class VMMethod;
- class StaticScope;
+ class ConstantScope;
class AccessVariable : public Executable {
public:
View
10 vm/builtin/block_environment.cpp
@@ -19,7 +19,7 @@
#include "builtin/fixnum.hpp"
#include "builtin/tuple.hpp"
#include "builtin/system.hpp"
-#include "builtin/staticscope.hpp"
+#include "builtin/constantscope.hpp"
#include "builtin/location.hpp"
#include "builtin/nativemethod.hpp"
@@ -294,14 +294,14 @@ namespace rubinius {
frame->prepare(vmm->stack_size);
frame->previous = previous;
- frame->static_scope_ = invocation.static_scope;
+ frame->constant_scope_ = invocation.constant_scope;
frame->arguments = &args;
frame->dispatch_data = reinterpret_cast<BlockEnvironment*>(env);
frame->cm = env->code_;
frame->scope = scope;
frame->top_scope_ = env->top_scope_;
- frame->flags = invocation.flags | CallFrame::cCustomStaticScope
+ frame->flags = invocation.flags | CallFrame::cCustomConstantScope
| CallFrame::cMultipleScopes
| CallFrame::cBlock;
@@ -388,9 +388,9 @@ namespace rubinius {
}
Object* recv = args.shift(state);
- StaticScope* static_scope = as<StaticScope>(args.shift(state));
+ ConstantScope* constant_scope = as<ConstantScope>(args.shift(state));
- BlockInvocation invocation(recv, static_scope, 0);
+ BlockInvocation invocation(recv, constant_scope, 0);
return invoke(state, call_frame, this, args, invocation);
}
View
8 vm/builtin/block_environment.hpp
@@ -13,18 +13,18 @@ namespace rubinius {
class VMExecutable;
class BlockEnvironment;
- class StaticScope;
+ class ConstantScope;
struct BlockInvocation {
int flags;
Object* self;
- StaticScope* static_scope;
+ ConstantScope* constant_scope;
Module* module;
- BlockInvocation(Object* self, StaticScope* static_scope, int flags)
+ BlockInvocation(Object* self, ConstantScope* constant_scope, int flags)
: flags(flags)
, self(self)
- , static_scope(static_scope)
+ , constant_scope(constant_scope)
, module(0)
{}
};
View
2 vm/builtin/class.cpp
@@ -11,7 +11,7 @@
#include "builtin/methodtable.hpp"
#include "builtin/module.hpp"
#include "builtin/symbol.hpp"
-#include "builtin/staticscope.hpp"
+#include "builtin/constantscope.hpp"
#include "builtin/string.hpp"
#include "builtin/system.hpp"
#include "builtin/packed_object.hpp"
View
2 vm/builtin/class.hpp
@@ -83,7 +83,7 @@ namespace rubinius {
};
class CompiledMethod;
- class StaticScope;
+ class ConstantScope;
class SingletonClass : public Class {
public:
View
2 vm/builtin/compiledmethod.cpp
@@ -4,7 +4,7 @@
#include "builtin/class.hpp"
#include "builtin/fixnum.hpp"
#include "builtin/iseq.hpp"
-#include "builtin/staticscope.hpp"
+#include "builtin/constantscope.hpp"
#include "builtin/symbol.hpp"
#include "builtin/tuple.hpp"
#include "builtin/string.hpp"
View
6 vm/builtin/compiledmethod.hpp
@@ -10,7 +10,7 @@ namespace rubinius {
class InstructionSequence;
class VMMethod;
- class StaticScope;
+ class ConstantScope;
namespace jit {
class RuntimeDataHolder;
@@ -33,7 +33,7 @@ namespace rubinius {
Tuple* lines_; // slot
Tuple* local_names_; // slot
Symbol* file_; // slot
- StaticScope* scope_; // slot
+ ConstantScope* scope_; // slot
LookupTable* breakpoints_; // slot
VMMethod* backend_method_;
@@ -77,7 +77,7 @@ namespace rubinius {
attr_accessor(lines, Tuple);
attr_accessor(local_names, Tuple);
attr_accessor(file, Symbol);
- attr_accessor(scope, StaticScope);
+ attr_accessor(scope, ConstantScope);
attr_accessor(breakpoints, LookupTable);
/* interface */
View
38 vm/builtin/staticscope.cpp → vm/builtin/constantscope.cpp
@@ -1,7 +1,7 @@
#include "vm.hpp"
#include "prelude.hpp"
#include "builtin/class.hpp"
-#include "builtin/staticscope.hpp"
+#include "builtin/constantscope.hpp"
#include "builtin/system.hpp"
#include "builtin/symbol.hpp"
#include "builtin/lookuptable.hpp"
@@ -14,63 +14,63 @@
#include <sstream>
namespace rubinius {
- void StaticScope::init(STATE) {
- GO(staticscope).set(ontology::new_class(state,
- "StaticScope", G(object), G(rubinius)));
- G(staticscope)->set_object_type(state, StaticScopeType);
+ void ConstantScope::init(STATE) {
+ GO(constantscope).set(ontology::new_class(state,
+ "ConstantScope", G(object), G(rubinius)));
+ G(constantscope)->set_object_type(state, ConstantScopeType);
}
- void StaticScope::bootstrap_methods(STATE) {
+ void ConstantScope::bootstrap_methods(STATE) {
GCTokenImpl gct;
System::attach_primitive(state, gct,
- G(staticscope), false,
+ G(constantscope), false,
state->symbol("const_set"),
- state->symbol("static_scope_const_set"));
+ state->symbol("constant_scope_const_set"));
}
- StaticScope* StaticScope::create(STATE) {
- return state->new_object<StaticScope>(G(staticscope));
+ ConstantScope* ConstantScope::create(STATE) {
+ return state->new_object<ConstantScope>(G(constantscope));
}
- Module* StaticScope::for_method_definition() {
+ Module* ConstantScope::for_method_definition() {
if(current_module_->nil_p()) {
return module_;
}
return current_module_;
}
- StaticScope* StaticScope::of_sender(STATE, CallFrame* calling_environment) {
+ ConstantScope* ConstantScope::of_sender(STATE, CallFrame* calling_environment) {
if(calling_environment->previous) {
- return calling_environment->previous->top_ruby_frame()->static_scope();
+ return calling_environment->previous->top_ruby_frame()->constant_scope();
}
- return nil<StaticScope>();
+ return nil<ConstantScope>();
}
- Object* StaticScope::const_set(STATE, Object* name, Object* value) {
+ Object* ConstantScope::const_set(STATE, Object* name, Object* value) {
module_->set_const(state, name, value);
return value;
}
- Object* StaticScope::cvar_get(STATE, Symbol* name) {
+ Object* ConstantScope::cvar_get(STATE, Symbol* name) {
if(!name->is_cvar_p(state)->true_p()) return Primitives::failure();
return module_->cvar_get(state, name);
}
- Object* StaticScope::cvar_defined(STATE, Symbol* name) {
+ Object* ConstantScope::cvar_defined(STATE, Symbol* name) {
if(!name->is_cvar_p(state)->true_p()) return Primitives::failure();
return module_->cvar_defined(state, name);
}
- Object* StaticScope::cvar_set(STATE, Symbol* name, Object* value) {
+ Object* ConstantScope::cvar_set(STATE, Symbol* name, Object* value) {
if(!name->is_cvar_p(state)->true_p()) return Primitives::failure();
return module_->cvar_set(state, name, value);
}
- Object* StaticScope::cvar_get_or_set(STATE, Symbol* name, Object* value) {
+ Object* ConstantScope::cvar_get_or_set(STATE, Symbol* name, Object* value) {
if(!name->is_cvar_p(state)->true_p()) return Primitives::failure();
return module_->cvar_get_or_set(state, name, value);
View
24 vm/builtin/staticscope.hpp → vm/builtin/constantscope.hpp
@@ -8,9 +8,9 @@ namespace rubinius {
class Module;
- class StaticScope : public Object {
+ class ConstantScope : public Object {
public:
- const static object_type type = StaticScopeType;
+ const static object_type type = ConstantScopeType;
private:
Module* module_; // slot
@@ -20,40 +20,40 @@ namespace rubinius {
// without having to change module also.
Module* current_module_; // slot
- StaticScope* parent_; // slot
+ ConstantScope* parent_; // slot
public:
/* accessors */
attr_accessor(module, Module);
attr_accessor(current_module, Module);
- attr_accessor(parent, StaticScope);
+ attr_accessor(parent, ConstantScope);
/* interface */
static void init(STATE);
static void bootstrap_methods(STATE);
- static StaticScope* create(STATE);
+ static ConstantScope* create(STATE);
- // Rubinius.primitive :static_scope_of_sender
- static StaticScope* of_sender(STATE, CallFrame* calling_environment);
+ // Rubinius.primitive :constant_scope_of_sender
+ static ConstantScope* of_sender(STATE, CallFrame* calling_environment);
- // Rubinius.primitive :static_scope_const_set
+ // Rubinius.primitive :constant_scope_const_set
Object* const_set(STATE, Object* name, Object* value);
// The module to use when adding and removing methods
Module* for_method_definition();
- // Rubinius.primitive :static_scope_cvar_defined
+ // Rubinius.primitive :constant_scope_cvar_defined
Object* cvar_defined(STATE, Symbol* name);
- // Rubinius.primitive :static_scope_cvar_get
+ // Rubinius.primitive :constant_scope_cvar_get
Object* cvar_get(STATE, Symbol* name);
- // Rubinius.primitive :static_scope_cvar_set
+ // Rubinius.primitive :constant_scope_cvar_set
Object* cvar_set(STATE, Symbol* name, Object* value);
- // Rubinius.primitive :static_scope_cvar_get_or_set
+ // Rubinius.primitive :constant_scope_cvar_get_or_set
Object* cvar_get_or_set(STATE, Symbol* name, Object* value);
bool top_level_p(STATE) {
View
8 vm/builtin/global_cache_entry.cpp
@@ -1,6 +1,6 @@
#include "builtin/global_cache_entry.hpp"
#include "builtin/class.hpp"
-#include "builtin/staticscope.hpp"
+#include "builtin/constantscope.hpp"
#include "ontology.hpp"
@@ -12,7 +12,7 @@ namespace rubinius {
}
GlobalCacheEntry* GlobalCacheEntry::create(STATE, Object *value,
- StaticScope* scope)
+ ConstantScope* scope)
{
GlobalCacheEntry *entry =
state->vm()->new_object_mature<GlobalCacheEntry>(G(global_cache_entry));
@@ -29,12 +29,12 @@ namespace rubinius {
return entry;
}
- bool GlobalCacheEntry::valid_p(STATE, StaticScope* scope) {
+ bool GlobalCacheEntry::valid_p(STATE, ConstantScope* scope) {
return serial_ == state->shared().global_serial() &&
scope_ == scope;
}
- void GlobalCacheEntry::update(STATE, Object* val, StaticScope* sc) {
+ void GlobalCacheEntry::update(STATE, Object* val, ConstantScope* sc) {
value(state, val);
scope(state, sc);
serial_ = state->shared().global_serial();
View
12 vm/builtin/global_cache_entry.hpp
@@ -5,20 +5,20 @@
#include "builtin/fixnum.hpp"
namespace rubinius {
- class StaticScope;
+ class ConstantScope;
class GlobalCacheEntry : public Object {
public:
const static object_type type = GlobalCacheEntryType;
private:
Object* value_; // slot
- StaticScope* scope_; // slot
+ ConstantScope* scope_; // slot
int serial_;
public:
attr_accessor(value, Object);
- attr_accessor(scope, StaticScope);
+ attr_accessor(scope, ConstantScope);
int serial() { return serial_; }
@@ -31,11 +31,11 @@ namespace rubinius {
}
static void init(STATE);
- static GlobalCacheEntry* create(STATE, Object* value, StaticScope* scope);
+ static GlobalCacheEntry* create(STATE, Object* value, ConstantScope* scope);
static GlobalCacheEntry* empty(STATE);
- void update(STATE, Object* value, StaticScope* scope);
- bool valid_p(STATE, StaticScope* scope);
+ void update(STATE, Object* value, ConstantScope* scope);
+ bool valid_p(STATE, ConstantScope* scope);
class Info : public TypeInfo {
public:
View
2 vm/builtin/location.cpp
@@ -54,7 +54,7 @@ namespace rubinius {
loc->variables(state, call_frame->promote_scope(state));
}
- loc->static_scope(state, call_frame->static_scope());
+ loc->constant_scope(state, call_frame->constant_scope());
return loc;
}
View
6 vm/builtin/location.hpp
@@ -7,7 +7,7 @@
namespace rubinius {
class NativeMethodFrame;
- class StaticScope;
+ class ConstantScope;
class Location : public Object {
Module* method_module_; // slot
@@ -17,7 +17,7 @@ namespace rubinius {
Fixnum* ip_; // slot
Fixnum* flags_; // slot
VariableScope* variables_; // slot
- StaticScope* static_scope_; // slot
+ ConstantScope* constant_scope_; // slot
public:
const static object_type type = LocationType;
@@ -29,7 +29,7 @@ namespace rubinius {
attr_accessor(ip, Fixnum);
attr_accessor(flags, Fixnum);
attr_accessor(variables, VariableScope);
- attr_accessor(static_scope, StaticScope);
+ attr_accessor(constant_scope, ConstantScope);
void set_is_block(STATE) {
flags(state, Fixnum::from(flags()->to_native() | 1));
View
2 vm/builtin/object.cpp
@@ -14,7 +14,7 @@
#include "builtin/tuple.hpp"
#include "builtin/array.hpp"
#include "builtin/float.hpp"
-#include "builtin/staticscope.hpp"
+#include "builtin/constantscope.hpp"
#include "builtin/system.hpp"
#include "builtin/methodtable.hpp"
#include "builtin/packed_object.hpp"
View
10 vm/builtin/system.cpp
@@ -52,7 +52,7 @@
#include "builtin/channel.hpp"
-#include "builtin/staticscope.hpp"
+#include "builtin/constantscope.hpp"
#include "builtin/block_environment.hpp"
#include "builtin/system.hpp"
@@ -823,7 +823,7 @@ namespace rubinius {
}
Class* System::vm_open_class(STATE, Symbol* name, Object* sup,
- StaticScope* scope)
+ ConstantScope* scope)
{
Module* under;
@@ -875,7 +875,7 @@ namespace rubinius {
return cls;
}
- Module* System::vm_open_module(STATE, Symbol* name, StaticScope* scope) {
+ Module* System::vm_open_module(STATE, Symbol* name, ConstantScope* scope) {
Module* under = G(object);
if(!scope->nil_p()) {
@@ -922,7 +922,7 @@ namespace rubinius {
Object* System::vm_add_method(STATE, GCToken gct, Symbol* name,
CompiledMethod* method,
- StaticScope* scope, Object* vis)
+ ConstantScope* scope, Object* vis)
{
Module* mod = scope->for_method_definition();
@@ -981,7 +981,7 @@ namespace rubinius {
Object* System::vm_attach_method(STATE, GCToken gct, Symbol* name,
CompiledMethod* method,
- StaticScope* scope, Object* recv)
+ ConstantScope* scope, Object* recv)
{
Module* mod = recv->singleton_class(state);
View
10 vm/builtin/system.hpp
@@ -12,7 +12,7 @@ namespace rubinius {
class String;
class BlockEnvironment;
class CompiledMethod;
- class StaticScope;
+ class ConstantScope;
class IO;
struct CallFrame;
@@ -173,13 +173,13 @@ namespace rubinius {
static Array* vm_times(STATE);
// Rubinius.primitive :vm_open_class
- static Class* vm_open_class(STATE, Symbol* name, Object* super, StaticScope* scope);
+ static Class* vm_open_class(STATE, Symbol* name, Object* super, ConstantScope* scope);
// Rubinius.primitive :vm_open_class_under
static Class* vm_open_class_under(STATE, Symbol* name, Object* super, Module* under);
// Rubinius.primitive :vm_open_module
- static Module* vm_open_module(STATE, Symbol* name, StaticScope* scope);
+ static Module* vm_open_module(STATE, Symbol* name, ConstantScope* scope);
// Rubinius.primitive :vm_open_module_under
static Module* vm_open_module_under(STATE, Symbol* name, Module* under);
@@ -191,10 +191,10 @@ namespace rubinius {
static Tuple* vm_find_public_method(STATE, Object* recv, Symbol* name);
// Rubinius.primitive :vm_add_method
- static Object* vm_add_method(STATE, GCToken gct, Symbol* name, CompiledMethod* meth, StaticScope* scope, Object* vis);
+ static Object* vm_add_method(STATE, GCToken gct, Symbol* name, CompiledMethod* meth, ConstantScope* scope, Object* vis);
// Rubinius.primitive :vm_attach_method
- static Object* vm_attach_method(STATE, GCToken gct, Symbol* name, CompiledMethod* meth, StaticScope* scope, Object* recv);
+ static Object* vm_attach_method(STATE, GCToken gct, Symbol* name, CompiledMethod* meth, ConstantScope* scope, Object* recv);
// A robust way to get the class of an object, since Object#class can be redefined.
// Rubinius.primitive :vm_object_class
View
2 vm/call_frame.cpp
@@ -7,7 +7,7 @@
#include "builtin/symbol.hpp"
#include "builtin/compiledmethod.hpp"
#include "builtin/tuple.hpp"
-#include "builtin/staticscope.hpp"
+#include "builtin/constantscope.hpp"
#include "builtin/lookuptable.hpp"
#include "builtin/nativemethod.hpp"
View
12 vm/call_frame.hpp
@@ -29,7 +29,7 @@ namespace rubinius {
struct CallFrame {
enum Flags {
cIsLambda = 1 << 0,
- cCustomStaticScope = 1 << 1,
+ cCustomConstantScope = 1 << 1,
cMultipleScopes = 1 << 2,
cInlineFrame = 1 << 3,
cClosedScope = 1 << 4,
@@ -41,7 +41,7 @@ namespace rubinius {
};
CallFrame* previous;
- StaticScope* static_scope_;
+ ConstantScope* constant_scope_;
void* dispatch_data;
CompiledMethod* cm;
@@ -136,8 +136,8 @@ namespace rubinius {
return cm->name();
}
- bool custom_static_scope_p() {
- return flags & cCustomStaticScope;
+ bool custom_constant_scope_p() {
+ return flags & cCustomConstantScope;
}
bool inline_method_p() {
@@ -152,8 +152,8 @@ namespace rubinius {
return flags & cBlock;
}
- StaticScope* static_scope() {
- if(custom_static_scope_p()) return static_scope_;
+ ConstantScope* constant_scope() {
+ if(custom_constant_scope_p()) return constant_scope_;
return cm->scope();
}
View
2 vm/codegen/field_extract.rb
@@ -844,7 +844,7 @@ def initialize
"Object" => :Object,
"Tuple" => :Tuple,
"MemoryPointer" => :MemoryPointer,
- "StaticScope" => :StaticScope,
+ "ConstantScope" => :ConstantScope,
"Integer" => :Integer,
"Fixnum" => :Fixnum,
"CompiledMethod" => :CompiledMethod,
View
4 vm/compiled_file.cpp
@@ -12,7 +12,7 @@
#include "call_frame.hpp"
#include "objectmemory.hpp"
#include "object_utils.hpp"
-#include "builtin/staticscope.hpp"
+#include "builtin/constantscope.hpp"
#include "builtin/compiledmethod.hpp"
#include "builtin/class.hpp"
#include "builtin/thread.hpp"
@@ -43,7 +43,7 @@ namespace rubinius {
Arguments args(state->symbol("script"), G(main), 0, 0);
- cm.get()->scope(state, StaticScope::create(state));
+ cm.get()->scope(state, ConstantScope::create(state));
cm.get()->scope()->module(state, G(object));
cm->execute(state, NULL, cm.get(), G(object), args);
View
12 vm/gc/gc.cpp
@@ -14,7 +14,7 @@
#include "builtin/compiledmethod.hpp"
#include "call_frame.hpp"
#include "builtin/variable_scope.hpp"
-#include "builtin/staticscope.hpp"
+#include "builtin/constantscope.hpp"
#include "builtin/block_environment.hpp"
#include "capi/handle.hpp"
@@ -182,11 +182,11 @@ namespace rubinius {
continue;
}
- if(call_frame->custom_static_scope_p() &&
- call_frame->static_scope_ &&
- call_frame->static_scope_->reference_p()) {
- call_frame->static_scope_ =
- (StaticScope*)mark_object(call_frame->static_scope_);
+ if(call_frame->custom_constant_scope_p() &&
+ call_frame->constant_scope_ &&
+ call_frame->constant_scope_->reference_p()) {
+ call_frame->constant_scope_ =
+ (ConstantScope*)mark_object(call_frame->constant_scope_);
}
if(call_frame->cm && call_frame->cm->reference_p()) {
View
4 vm/globals.hpp
@@ -52,7 +52,7 @@ namespace rubinius {
TypedRoot<Class*> string, symbol, io;
TypedRoot<Class*> nil_class, true_class, false_class, fixnum_class, undef_class;
TypedRoot<Class*> floatpoint, nmc, list, list_node;
- TypedRoot<Class*> channel, thread, staticscope, lookuptable;
+ TypedRoot<Class*> channel, thread, constantscope, lookuptable;
TypedRoot<Class*> iseq, executable, native_function, iobuffer;
TypedRoot<Class*> included_module;
@@ -146,7 +146,7 @@ namespace rubinius {
list_node(&roots),
channel(&roots),
thread(&roots),
- staticscope(&roots),
+ constantscope(&roots),
lookuptable(&roots),
iseq(&roots),
executable(&roots),
View
18 vm/helpers.cpp
@@ -6,7 +6,7 @@
#include "builtin/module.hpp"
#include "builtin/compiledmethod.hpp"
#include "builtin/class.hpp"
-#include "builtin/staticscope.hpp"
+#include "builtin/constantscope.hpp"
#include "builtin/lookuptable.hpp"
#include "global_cache.hpp"
#include "objectmemory.hpp"
@@ -48,7 +48,7 @@ namespace rubinius {
}
Object* const_get(STATE, CallFrame* call_frame, Symbol* name, bool* found) {
- StaticScope *cur;
+ ConstantScope *cur;
Object* result;
*found = false;
@@ -85,7 +85,7 @@ namespace rubinius {
//
// So, in this case, foo would print "1", not "2".
//
- cur = call_frame->static_scope();
+ cur = call_frame->constant_scope();
while(!cur->nil_p()) {
// Detect the toplevel scope (the default) and get outta dodge.
if(cur->top_level_p(state)) break;
@@ -97,7 +97,7 @@ namespace rubinius {
}
// Now look up the superclass chain.
- cur = call_frame->static_scope();
+ cur = call_frame->constant_scope();
if(!cur->nil_p()) {
Module* mod = cur->module();
while(!mod->nil_p()) {
@@ -126,7 +126,7 @@ namespace rubinius {
call_frame = call_frame->top_ruby_frame();
- StaticScope* scope = call_frame->static_scope();
+ ConstantScope* scope = call_frame->constant_scope();
if(scope->nil_p()) {
under = G(object);
} else {
@@ -155,10 +155,10 @@ namespace rubinius {
call_frame = call_frame->top_ruby_frame();
- if(call_frame->static_scope()->nil_p()) {
+ if(call_frame->constant_scope()->nil_p()) {
under = G(object);
} else {
- under = call_frame->static_scope()->module();
+ under = call_frame->constant_scope()->module();
}
return open_class(state, call_frame, under, super, name, created);
@@ -224,8 +224,8 @@ namespace rubinius {
call_frame = call_frame->top_ruby_frame();
- if(!call_frame->static_scope()->nil_p()) {
- under = call_frame->static_scope()->module();
+ if(!call_frame->constant_scope()->nil_p()) {
+ under = call_frame->constant_scope()->module();
}
return open_module(state, call_frame, under, name);
View
2 vm/instructions.cpp
@@ -11,7 +11,7 @@
#include "builtin/symbol.hpp"
#include "builtin/tuple.hpp"
#include "builtin/iseq.hpp"
-#include "builtin/staticscope.hpp"
+#include "builtin/constantscope.hpp"
#include "builtin/nativemethod.hpp"
#include "builtin/lookuptable.hpp"
#include "builtin/proc.hpp"
View
22 vm/instructions.def
@@ -760,7 +760,7 @@ end
instruction set_const(index) [ value -- value ]
Symbol* sym = as<Symbol>(call_frame->cm->literals()->at(state, index));
- call_frame->static_scope()->module()->set_const(state, sym, stack_top());
+ call_frame->constant_scope()->module()->set_const(state, sym, stack_top());
end
# [Description]
@@ -835,7 +835,7 @@ instruction push_const_fast(literal association) [ -- constant ]
GlobalCacheEntry* cache;
if((cache = try_as<GlobalCacheEntry>(val)) != NULL) {
- if(cache->valid_p(state, call_frame->static_scope())) {
+ if(cache->valid_p(state, call_frame->constant_scope())) {
res = cache->value();
}
} else {
@@ -857,7 +857,7 @@ instruction push_const_fast(literal association) [ -- constant ]
}
if(res) {
- cache->update(state, res, call_frame->static_scope());
+ cache->update(state, res, call_frame->constant_scope());
}
} else {
res = Helpers::const_missing(state, sym, call_frame);
@@ -1159,7 +1159,7 @@ instruction create_block(literal) [ -- block ]
CompiledMethod* cm = as<CompiledMethod>(_lit);
// TODO: We do not need to be doing this everytime.
- cm->scope(state, call_frame->static_scope());
+ cm->scope(state, call_frame->constant_scope());
Object* be = BlockEnvironment::under_call_frame(state, gct, cm, vmm, call_frame);
@@ -1575,29 +1575,29 @@ end
section "Manipulate scope"
# [Description]
-# Pushes the current `StaticScope` object on the stack. Many operations are
+# Pushes the current `ConstantScope` object on the stack. Many operations are
# defered to the current scope. This operation retrieves the current scope
# so methods can be called on it.
instruction push_scope() [ -- scope ]
- stack_push(call_frame->static_scope());
+ stack_push(call_frame->constant_scope());
end
# [Description]
-# Create a new `StaticScope` object for the given Module on the stack.
+# Create a new `ConstantScope` object for the given Module on the stack.
# This scope is chained off the current scope of the method.
#
# This also sets the scope of the current `CompiledMethod` to the new
-# `StaticScope`.
+# `ConstantScope`.
instruction add_scope() [ module -- ]
Object* obj = stack_pop();
Module* mod = as<Module>(obj);
- StaticScope* scope = StaticScope::create(state);
+ ConstantScope* scope = ConstantScope::create(state);
scope->module(state, mod);
- scope->parent(state, call_frame->static_scope());
+ scope->parent(state, call_frame->constant_scope());
call_frame->cm->scope(state, scope);
- call_frame->static_scope_ = scope;
+ call_frame->constant_scope_ = scope;
end
# [Description]
View
4 vm/llvm/inline.cpp
@@ -236,8 +236,8 @@ namespace rubinius {
<< " into "
<< ops_.state()->symbol_debug_str(ops_.method_name());
- StaticScope* ss = cm->scope();
- if(kind_of<StaticScope>(ss) && klass != ss->module() && !klass->module_name()->nil_p()) {
+ ConstantScope* cs = cm->scope();
+ if(kind_of<ConstantScope>(cs) && klass != cs->module() && !klass->module_name()->nil_p()) {
ops_.state()->log() << " ("
<< ops_.state()->symbol_debug_str(klass->module_name()) << ")";
}
View
2 vm/llvm/inline.hpp
@@ -2,7 +2,7 @@
#include "builtin/access_variable.hpp"
#include "builtin/iseq.hpp"
-#include "builtin/staticscope.hpp"
+#include "builtin/constantscope.hpp"
#include "builtin/module.hpp"
namespace rubinius {
View
12 vm/llvm/jit_block.cpp
@@ -6,7 +6,7 @@
#include "call_frame.hpp"
#include "stack_variables.hpp"
-#include "builtin/staticscope.hpp"
+#include "builtin/constantscope.hpp"
#include "builtin/module.hpp"
#include "instruments/tooling.hpp"
@@ -154,11 +154,11 @@ namespace jit {
// previous
b().CreateStore(info_.previous(), get_field(call_frame, offset::CallFrame::previous));
- // static_scope
- Value* ss = b().CreateLoad(get_field(block_inv, offset::blockinv_static_scope),
- "invocation.static_scope");
+ // constant_scope
+ Value* cs = b().CreateLoad(get_field(block_inv, offset::blockinv_constant_scope),
+ "invocation.constant_scope");
- b().CreateStore(ss, get_field(call_frame, offset::CallFrame::static_scope));
+ b().CreateStore(cs, get_field(call_frame, offset::CallFrame::constant_scope));
// arguments
b().CreateStore(info_.args(), get_field(call_frame, offset::CallFrame::arguments));
@@ -174,7 +174,7 @@ namespace jit {
inv_flags_ = b().CreateLoad(get_field(block_inv, offset::blockinv_flags),
"invocation.flags");
- int block_flags = CallFrame::cCustomStaticScope |
+ int block_flags = CallFrame::cCustomConstantScope |
CallFrame::cMultipleScopes |
CallFrame::cBlock |
CallFrame::cJITed;
View
6 vm/llvm/jit_builder.cpp
@@ -127,9 +127,9 @@ namespace jit {
void Builder::check_self_type() {
int klass_id = 0;
- StaticScope* ss = info_.method()->scope();
- if(!kind_of<StaticScope>(ss)) return;
- if(Class* cls = try_as<Class>(ss->module())) {
+ ConstantScope* cs = info_.method()->scope();
+ if(!kind_of<ConstantScope>(cs)) return;
+ if(Class* cls = try_as<Class>(cs->module())) {
klass_id = cls->class_id();
} else {
return;
View
2 vm/llvm/jit_compiler.cpp
@@ -4,7 +4,7 @@
#include "llvm/jit_context.hpp"
#include "builtin/fixnum.hpp"
-#include "builtin/staticscope.hpp"
+#include "builtin/constantscope.hpp"
#include "builtin/module.hpp"
#include "builtin/block_environment.hpp"
#include "field_offset.hpp"
View
2 vm/llvm/jit_method.cpp
@@ -9,7 +9,7 @@
#include "vmmethod.hpp"
#include "instruments/tooling.hpp"
-#include "builtin/staticscope.hpp"
+#include "builtin/constantscope.hpp"
#include "builtin/module.hpp"
using namespace llvm;
View
18 vm/llvm/jit_util.cpp
@@ -14,7 +14,7 @@
#include "builtin/class.hpp"
#include "builtin/string.hpp"
#include "builtin/block_environment.hpp"
-#include "builtin/staticscope.hpp"
+#include "builtin/constantscope.hpp"
#include "builtin/proc.hpp"
#include "builtin/autoload.hpp"
#include "builtin/global_cache_entry.hpp"
@@ -255,7 +255,7 @@ extern "C" {
// TODO: We don't need to be doing this everytime.
if(cm->scope()->nil_p()) {
- cm->scope(state, call_frame->static_scope());
+ cm->scope(state, call_frame->constant_scope());
}
VMMethod* vmm = call_frame->cm->backend_method();
@@ -288,7 +288,7 @@ extern "C" {
va_end(ap);
// TODO: We don't need to be doing this everytime.
- cm->scope(state, closest->static_scope());
+ cm->scope(state, closest->constant_scope());
VMMethod* vmm = closest->cm->backend_method();
GCTokenImpl gct;
@@ -386,11 +386,11 @@ extern "C" {
CPP_TRY
Module* mod = as<Module>(top);
- StaticScope* scope = StaticScope::create(state);
+ ConstantScope* scope = ConstantScope::create(state);
scope->module(state, mod);
- scope->parent(state, call_frame->static_scope());
+ scope->parent(state, call_frame->constant_scope());
call_frame->cm->scope(state, scope);
- // call_frame->static_scope_ = scope;
+ // call_frame->constant_scope_ = scope;
return cNil;
@@ -785,7 +785,7 @@ extern "C" {
// See if the cache is present, if so, validate it and use the value
GlobalCacheEntry* cache;
if((cache = try_as<GlobalCacheEntry>(val)) != NULL) {
- if(cache->valid_p(state, call_frame->static_scope())) {
+ if(cache->valid_p(state, call_frame->constant_scope())) {
res = cache->value();
}
} else {
@@ -803,7 +803,7 @@ extern "C" {
}
if(res) {
- cache->update(state, res, call_frame->static_scope());
+ cache->update(state, res, call_frame->constant_scope());
}
} else {
res = Helpers::const_missing(state, sym, call_frame);
@@ -1046,7 +1046,7 @@ extern "C" {
}
Object* rbx_set_const(STATE, CallFrame* call_frame, Symbol* name, Object* val) {
- call_frame->static_scope()->module()->set_const(state, name, val);
+ call_frame->constant_scope()->module()->set_const(state, name, val);
return val;
}
View
2 vm/llvm/jit_visit.hpp
@@ -2250,7 +2250,7 @@ namespace rubinius {
if(info().is_block && !in_inlined_block()) {
Value* scope = b().CreateLoad(
b().CreateConstGEP2_32(call_frame_, 0,
- offset::CallFrame::static_scope, "scope_pos"),
+ offset::CallFrame::constant_scope, "scope_pos"),
"cm");
stack_push(scope);
View
2 vm/llvm/offset.hpp
@@ -39,7 +39,7 @@ namespace offset {
const static int blockinv_flags = 0;
const static int blockinv_self = 1;
- const static int blockinv_static_scope = 2;
+ const static int blockinv_constant_scope = 2;
const static int blockinv_module = 3;
const static int runtime_data_method = 0;
View
4 vm/llvm/offset_specific.hpp
@@ -77,7 +77,7 @@ namespace Class {
}
namespace CallFrame {
const static int previous = 0;
- const static int static_scope = 1;
+ const static int constant_scope = 1;
const static int dispatch_data = 2;
const static int cm = 3;
const static int flags = 4;
@@ -156,7 +156,7 @@ namespace CompiledMethod {
namespace BlockInvocation {
const static int flags = 0;
const static int self = 1;
- const static int static_scope = 2;
+ const static int constant_scope = 2;
const static int module = 3;
}
namespace ObjectFlags {
View
8 vm/llvm/state.cpp
@@ -13,7 +13,7 @@
#include "vm/config.h"
#include "builtin/fixnum.hpp"
-#include "builtin/staticscope.hpp"
+#include "builtin/constantscope.hpp"
#include "builtin/module.hpp"
#include "builtin/compiledmethod.hpp"
#include "builtin/class.hpp"
@@ -649,12 +649,12 @@ namespace rubinius {
}
std::string LLVMState::enclosure_name(CompiledMethod* cm) {
- StaticScope* ss = cm->scope();
- if(!kind_of<StaticScope>(ss) || !kind_of<Module>(ss->module())) {
+ ConstantScope* cs = cm->scope();
+ if(!kind_of<ConstantScope>(cs) || !kind_of<Module>(cs->module())) {
return "ANONYMOUS";