59
60 genFactory = new GenerationFactory();
61 }
62
63 public GenCollectedHeap(Address addr) {
64 super(addr);
65 }
66
67 public int nGens() {
68 return (int) nGensField.getValue(addr);
69 }
70
71 public Generation getGen(int i) {
72 if (Assert.ASSERTS_ENABLED) {
73 Assert.that((i == 0) || (i == 1), "Index " + i +
74 " out of range (should be 0 or 1)");
75 }
76
77 switch (i) {
78 case 0:
79 return genFactory.newObject(youngGenField.getAddress());
80 case 1:
81 return genFactory.newObject(oldGenField.getAddress());
82 default:
83 // no generation for i, and assertions disabled.
84 return null;
85 }
86 }
87
88 public boolean isIn(Address a) {
89 for (int i = 0; i < nGens(); i++) {
90 Generation gen = getGen(i);
91 if (gen.isIn(a)) {
92 return true;
93 }
94 }
95
96 return false;
97 }
98
99 public long capacity() {
100 long capacity = 0;
101 for (int i = 0; i < nGens(); i++) {
|
59
60 genFactory = new GenerationFactory();
61 }
62
63 public GenCollectedHeap(Address addr) {
64 super(addr);
65 }
66
67 public int nGens() {
68 return (int) nGensField.getValue(addr);
69 }
70
71 public Generation getGen(int i) {
72 if (Assert.ASSERTS_ENABLED) {
73 Assert.that((i == 0) || (i == 1), "Index " + i +
74 " out of range (should be 0 or 1)");
75 }
76
77 switch (i) {
78 case 0:
79 return genFactory.newObject(youngGenField.getValue(addr));
80 case 1:
81 return genFactory.newObject(oldGenField.getValue(addr));
82 default:
83 // no generation for i, and assertions disabled.
84 return null;
85 }
86 }
87
88 public boolean isIn(Address a) {
89 for (int i = 0; i < nGens(); i++) {
90 Generation gen = getGen(i);
91 if (gen.isIn(a)) {
92 return true;
93 }
94 }
95
96 return false;
97 }
98
99 public long capacity() {
100 long capacity = 0;
101 for (int i = 0; i < nGens(); i++) {
|