11package myworld .hummingbird ;
22
3+ import myworld .hummingbird .util .BitFieldAllocator ;
34import myworld .hummingbird .util .TrackingAllocator ;
45
56import java .util .*;
@@ -13,14 +14,18 @@ public final class HummingbirdVM {
1314 public static final int YIELD_INTERPRETER_CONTROL = -Integer .MAX_VALUE ;
1415
1516 private final Executable exe ;
16- private Allocator allocator ;
17+ public final ForeignFunction [] foreign ;
18+
1719 public MemoryLimits limits ;
1820 private int [] memory ;
21+ private Allocator allocator ;
1922 private Object [] objMemory ;
23+ private BitFieldAllocator objAllocator ;
24+
2025 private Fiber currentFiber ;
21- private List <Function <Throwable , Integer >> trapCodes ;
2226 private final Deque <Fiber > runQueue ;
23- public final ForeignFunction [] foreign ;
27+
28+ private List <Function <Throwable , Integer >> trapCodes ;
2429
2530 private DebugHandler debugHandler ;
2631
@@ -36,6 +41,7 @@ public HummingbirdVM(Executable exe, MemoryLimits limits) {
3641
3742 memory = new int [limits .words ()];
3843 objMemory = new Object [limits .objects ()];
44+ objAllocator = new BitFieldAllocator (limits .objects ());
3945
4046 runQueue = new LinkedList <>();
4147 trapCodes = new ArrayList <>();
@@ -81,6 +87,14 @@ public Symbol findForeignFunction(String name, TypeFlag rType){
8187 return null ;
8288 }
8389
90+ public Allocator getAllocator (){
91+ return allocator ;
92+ }
93+
94+ public BitFieldAllocator getObjAllocator (){
95+ return objAllocator ;
96+ }
97+
8498 public Object run (){
8599 return run (null , null );
86100 }
0 commit comments