equal
deleted
inserted
replaced
47 |
47 |
48 |
48 |
49 public abstract class Generation extends VMObject { |
49 public abstract class Generation extends VMObject { |
50 private static long reservedFieldOffset; |
50 private static long reservedFieldOffset; |
51 private static long virtualSpaceFieldOffset; |
51 private static long virtualSpaceFieldOffset; |
52 private static CIntegerField levelField; |
|
53 protected static final int K = 1024; |
52 protected static final int K = 1024; |
54 // Fields for class StatRecord |
53 // Fields for class StatRecord |
55 private static Field statRecordField; |
54 private static Field statRecordField; |
56 private static CIntegerField invocationField; |
55 private static CIntegerField invocationField; |
57 |
56 |
73 private static synchronized void initialize(TypeDataBase db) { |
72 private static synchronized void initialize(TypeDataBase db) { |
74 Type type = db.lookupType("Generation"); |
73 Type type = db.lookupType("Generation"); |
75 |
74 |
76 reservedFieldOffset = type.getField("_reserved").getOffset(); |
75 reservedFieldOffset = type.getField("_reserved").getOffset(); |
77 virtualSpaceFieldOffset = type.getField("_virtual_space").getOffset(); |
76 virtualSpaceFieldOffset = type.getField("_virtual_space").getOffset(); |
78 levelField = type.getCIntegerField("_level"); |
|
79 // StatRecord |
77 // StatRecord |
80 statRecordField = type.getField("_stat_record"); |
78 statRecordField = type.getField("_stat_record"); |
81 type = db.lookupType("Generation::StatRecord"); |
79 type = db.lookupType("Generation::StatRecord"); |
82 invocationField = type.getCIntegerField("invocations"); |
80 invocationField = type.getCIntegerField("invocations"); |
83 |
81 |
128 } else { |
126 } else { |
129 throw new RuntimeException("should not reach here"); |
127 throw new RuntimeException("should not reach here"); |
130 } |
128 } |
131 } |
129 } |
132 |
130 |
133 public GenerationSpec spec() { |
|
134 return ((GenCollectedHeap) VM.getVM().getUniverse().heap()).spec(level()); |
|
135 } |
|
136 |
|
137 public int level() { |
|
138 return (int) levelField.getValue(addr); |
|
139 } |
|
140 |
|
141 public int invocations() { |
131 public int invocations() { |
142 return getStatRecord().getInvocations(); |
132 return getStatRecord().getInvocations(); |
143 } |
133 } |
144 |
134 |
145 /** The maximum number of object bytes the generation can currently |
135 /** The maximum number of object bytes the generation can currently |