Class: Rubinius::CompiledCode
- Defined in:
- lib/rubinius/bridge/compiled_code.rb
Constant Summary collapse
- KernelMethodSerial =
47
Instance Attribute Summary collapse
-
#arity ⇒ Object
- Integer
-
number of arguments, negative if variadic.
-
#block_index ⇒ Object
Returns the value of attribute block_index.
-
#file ⇒ Object
- Symbol
-
the file where this comes from.
-
#hints ⇒ Object
added by the VM to indicate how it’s being used.
-
#iseq ⇒ Object
- Tuple
-
instructions to execute.
-
#keywords ⇒ Object
- Tuple
-
pairs of Symbol name, required flag.
-
#lines ⇒ Object
- Tuple
-
tuple of the lines where its found.
-
#literals ⇒ Object
- Tuple
-
tuple of the literals.
-
#local_count ⇒ Object
- Integer
-
number of local vars.
-
#local_names ⇒ Object
- Array<Symbol>
-
names of the local vars.
-
#metadata ⇒ Object
- Tuple
-
extra data.
-
#name ⇒ Object
- Symbol
-
name of the method.
-
#post_args ⇒ Object
- Integer
-
number of args after splat.
-
#primitive ⇒ Object
Returns the value of attribute primitive.
-
#required_args ⇒ Object
- Integer
-
number of required args.
-
#scope ⇒ Object
- ConstantScope
-
scope for looking up constants.
-
#splat ⇒ Object
- Integer
-
POSITION of the splat arg.
-
#stack_size ⇒ Object
- Integer
-
size of stack at compile time.
-
#total_args ⇒ Object
- Integer
-
number of total args.
Instance Method Summary collapse
Instance Attribute Details
#arity ⇒ Object
- Integer
-
number of arguments, negative if variadic.
21 22 23 |
# File 'lib/rubinius/bridge/compiled_code.rb', line 21 def arity @arity end |
#block_index ⇒ Object
Returns the value of attribute block_index.
23 24 25 |
# File 'lib/rubinius/bridge/compiled_code.rb', line 23 def block_index @block_index end |
#file ⇒ Object
- Symbol
-
the file where this comes from
17 18 19 |
# File 'lib/rubinius/bridge/compiled_code.rb', line 17 def file @file end |
#hints ⇒ Object
added by the VM to indicate how it’s being used.
5 6 7 |
# File 'lib/rubinius/bridge/compiled_code.rb', line 5 def hints @hints end |
#iseq ⇒ Object
- Tuple
-
instructions to execute
8 9 10 |
# File 'lib/rubinius/bridge/compiled_code.rb', line 8 def iseq @iseq end |
#keywords ⇒ Object
- Tuple
-
pairs of Symbol name, required flag
20 21 22 |
# File 'lib/rubinius/bridge/compiled_code.rb', line 20 def keywords @keywords end |
#lines ⇒ Object
- Tuple
-
tuple of the lines where its found
16 17 18 |
# File 'lib/rubinius/bridge/compiled_code.rb', line 16 def lines @lines end |
#literals ⇒ Object
- Tuple
-
tuple of the literals
15 16 17 |
# File 'lib/rubinius/bridge/compiled_code.rb', line 15 def literals @literals end |
#local_count ⇒ Object
- Integer
-
number of local vars
10 11 12 |
# File 'lib/rubinius/bridge/compiled_code.rb', line 10 def local_count @local_count end |
#local_names ⇒ Object
- Array<Symbol>
-
names of the local vars
18 19 20 |
# File 'lib/rubinius/bridge/compiled_code.rb', line 18 def local_names @local_names end |
#metadata ⇒ Object
- Tuple
-
extra data
6 7 8 |
# File 'lib/rubinius/bridge/compiled_code.rb', line 6 def @metadata end |
#name ⇒ Object
- Symbol
-
name of the method
7 8 9 |
# File 'lib/rubinius/bridge/compiled_code.rb', line 7 def name @name end |
#post_args ⇒ Object
- Integer
-
number of args after splat
12 13 14 |
# File 'lib/rubinius/bridge/compiled_code.rb', line 12 def post_args @post_args end |
#primitive ⇒ Object
Returns the value of attribute primitive.
22 23 24 |
# File 'lib/rubinius/bridge/compiled_code.rb', line 22 def primitive @primitive end |
#required_args ⇒ Object
- Integer
-
number of required args
11 12 13 |
# File 'lib/rubinius/bridge/compiled_code.rb', line 11 def required_args @required_args end |
#scope ⇒ Object
- ConstantScope
-
scope for looking up constants
19 20 21 |
# File 'lib/rubinius/bridge/compiled_code.rb', line 19 def scope @scope end |
#splat ⇒ Object
- Integer
-
POSITION of the splat arg
14 15 16 |
# File 'lib/rubinius/bridge/compiled_code.rb', line 14 def splat @splat end |
#stack_size ⇒ Object
- Integer
-
size of stack at compile time
9 10 11 |
# File 'lib/rubinius/bridge/compiled_code.rb', line 9 def stack_size @stack_size end |
#total_args ⇒ Object
- Integer
-
number of total args
13 14 15 |
# File 'lib/rubinius/bridge/compiled_code.rb', line 13 def total_args @total_args end |
Instance Method Details
#add_metadata(key, val) ⇒ Object
29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 |
# File 'lib/rubinius/bridge/compiled_code.rb', line 29 def (key, val) raise TypeError, "key must be a symbol" unless key.kind_of? Symbol case val when true, false, Symbol, Fixnum, String # ok else raise TypeError, "invalid type of value" end @metadata ||= nil # to deal with MRI seeing @metadata as not set unless @metadata @metadata = Tuple.new(2) @metadata[0] = key @metadata[1] = val return val end i = 0 fin = @metadata.size while i < fin if @metadata[i] == key @metadata[i + 1] = val return val end i += 2 end tup = Tuple.new(fin + 2) tup.copy_from @metadata, 0, fin, 0 tup[fin] = key tup[fin + 1] = val @metadata = tup return val end |
#decode(bytecodes = @iseq) ⇒ Object
25 26 27 |
# File 'lib/rubinius/bridge/compiled_code.rb', line 25 def decode(bytecodes = @iseq) # TODO end |