Class: Maglev::Reflection::StackFrameMirror

Inherits:
ObjectMirror show all
Includes:
AbstractReflection::StackFrameMirror
Defined in:
lib/maglev/reflection/stack_frame_mirror.rb

Defined Under Namespace

Classes: FrameHash

Instance Attribute Summary collapse

Attributes included from AbstractReflection::Mirror

#reflection

Instance Method Summary collapse

Methods included from AbstractReflection::StackFrameMirror

#binding, #ip_offset

Methods included from AbstractReflection::Mirror

#mirrors?, #reflectee

Methods included from AbstractReflection::Mirror::ClassMethods

#included, #mirror_class, #new, #reflect, #reflect!, #reflects?, #register_mirror

Methods inherited from Ruby::Reflection::ObjectMirror

#target_class, #variables

Methods included from AbstractReflection::ObjectMirror

#class_variables, #instance_eval, #objects_with_references, #path_to, #target_class, #transitive_closure, #variables

Constructor Details

#initialize(obj) ⇒ StackFrameMirror

Returns a new instance of StackFrameMirror.



9
10
11
12
13
14
# File 'lib/maglev/reflection/stack_frame_mirror.rb', line 9

def initialize(obj)
  super
  @method = obj.method
  @index = obj.index
  @thread = obj.thread
end

Instance Attribute Details

#methodObject (readonly)

Returns the value of attribute method.



7
8
9
# File 'lib/maglev/reflection/stack_frame_mirror.rb', line 7

def method
  @method
end

Instance Method Details

#argumentsObject



32
33
34
# File 'lib/maglev/reflection/stack_frame_mirror.rb', line 32

def arguments
  args_and_temps(0, num_args - 1)
end

#inspectObject



68
69
70
# File 'lib/maglev/reflection/stack_frame_mirror.rb', line 68

def inspect
  "#<#{self.class}: #{@index}: #{@method.defining_class}##{@method.name}>"
end

#localsObject



36
37
38
# File 'lib/maglev/reflection/stack_frame_mirror.rb', line 36

def locals
  args_and_temps(num_args, -1)
end

#nameObject



16
17
18
# File 'lib/maglev/reflection/stack_frame_mirror.rb', line 16

def name
  @method.selector
end

#popObject



58
59
60
61
# File 'lib/maglev/reflection/stack_frame_mirror.rb', line 58

def pop
  @thread.reflectee.__trim_stack_to_level(@index + 1)
  true
end

#receiverObject



20
21
22
# File 'lib/maglev/reflection/stack_frame_mirror.rb', line 20

def receiver
  reflection.reflect detailed_report[1]
end

#restartObject



53
54
55
56
# File 'lib/maglev/reflection/stack_frame_mirror.rb', line 53

def restart
  @thread.reflectee.__trim_stack_to_level(@index)
  true
end

#selectorObject



28
29
30
# File 'lib/maglev/reflection/stack_frame_mirror.rb', line 28

def selector
  reflection.reflect detailed_report[3].to_s
end

#selfObject



24
25
26
# File 'lib/maglev/reflection/stack_frame_mirror.rb', line 24

def self
  reflection.reflect detailed_report[2]
end

#source_offsetObject



44
45
46
# File 'lib/maglev/reflection/stack_frame_mirror.rb', line 44

def source_offset
  detailed_report[5][step_offset - 1]
end

#step(*args) ⇒ Object



63
64
65
66
# File 'lib/maglev/reflection/stack_frame_mirror.rb', line 63

def step(*args)
  @thread.step(*args)
  true
end

#step_offsetObject



40
41
42
# File 'lib/maglev/reflection/stack_frame_mirror.rb', line 40

def step_offset
  detailed_report[4]
end

#variable_contextObject

Raises:

  • (NotImplementedError)


48
49
50
51
# File 'lib/maglev/reflection/stack_frame_mirror.rb', line 48

def variable_context
  raise NotImplementedError, "TODO"
  @thread.reflectee.__frame_contents_at(@index)[3]
end