Class: ShadowStack
- Inherits:
-
Object
- Object
- ShadowStack
- Defined in:
- lib/ShadowStack.rb
Overview
Track the executions in a shadow call stack.
Instance Method Summary collapse
- #base ⇒ Object
-
#initialize ⇒ ShadowStack
constructor
A new instance of ShadowStack.
- #peek ⇒ Object
-
#push(execution) ⇒ Execution
Place Execution at the top of stack.
Constructor Details
#initialize ⇒ ShadowStack
Returns a new instance of ShadowStack.
9 10 11 12 |
# File 'lib/ShadowStack.rb', line 9 def initialize() @bottom = nil @top = nil end |
Instance Method Details
#base ⇒ Object
18 19 20 |
# File 'lib/ShadowStack.rb', line 18 def base() @bottom end |
#peek ⇒ Object
14 15 16 |
# File 'lib/ShadowStack.rb', line 14 def peek() @top end |
#push(execution) ⇒ Execution
Place Execution at the top of stack.
28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 |
# File 'lib/ShadowStack.rb', line 28 def push(execution) # Place first execution at bottom of stack. if @bottom.nil? @bottom = execution # Connect subsequent executions to each other. else @top.parent = execution execution.child = @top end # Place execution at top of stack. @top = execution end |