public
Description: Rubinius, the Ruby VM
Homepage: http://rubini.us
Clone URL: git://github.com/evanphx/rubinius.git
rubinius / lib / stepgc.rb
100644 37 lines (27 sloc) 0.575 kb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
require 'heap'
require 'object'
require 'gc'
 
class StepGC < ForwardingGC
  def initialize(steps, step_sz, older_gc)
    @num_steps = steps
    @step_size = step_sz
    @steps = []
    @older_gc = older_gc
    
    steps.times { add_step }
  end
  
  def add_step
    step = Heap.new(@step_size)
    @steps << step
  end
  
  def promote
    oldest = @steps.pop
    oldest.each_object do |obj|
      
    end
  end
  
  def mutate_object(obj)
    dest = @.copy_object obj
    
    set_forwarding_address obj, dest
    update_stack obj, dest
    
    return dest
  end
  
end