Mercurial > hg > graal-jvmci-8
comparison src/share/vm/memory/genCollectedHeap.cpp @ 12030:330dfb0476f4
8022800: Use specific generations rather than generation iteration
Reviewed-by: jmasa, ehelin
author | brutisso |
---|---|
date | Wed, 14 Aug 2013 09:02:32 +0200 |
parents | 71180a6e5080 |
children | 1a8fb39bdbc4 |
comparison
equal
deleted
inserted
replaced
12009:39127bb12d32 | 12030:330dfb0476f4 |
---|---|
1068 return _gch; | 1068 return _gch; |
1069 } | 1069 } |
1070 | 1070 |
1071 | 1071 |
1072 void GenCollectedHeap::prepare_for_compaction() { | 1072 void GenCollectedHeap::prepare_for_compaction() { |
1073 Generation* scanning_gen = _gens[_n_gens-1]; | 1073 guarantee(_n_gens = 2, "Wrong number of generations"); |
1074 Generation* old_gen = _gens[1]; | |
1074 // Start by compacting into same gen. | 1075 // Start by compacting into same gen. |
1075 CompactPoint cp(scanning_gen, NULL, NULL); | 1076 CompactPoint cp(old_gen, NULL, NULL); |
1076 while (scanning_gen != NULL) { | 1077 old_gen->prepare_for_compaction(&cp); |
1077 scanning_gen->prepare_for_compaction(&cp); | 1078 Generation* young_gen = _gens[0]; |
1078 scanning_gen = prev_gen(scanning_gen); | 1079 young_gen->prepare_for_compaction(&cp); |
1079 } | |
1080 } | 1080 } |
1081 | 1081 |
1082 GCStats* GenCollectedHeap::gc_stats(int level) const { | 1082 GCStats* GenCollectedHeap::gc_stats(int level) const { |
1083 return _gens[level]->gc_stats(); | 1083 return _gens[level]->gc_stats(); |
1084 } | 1084 } |
1243 CollectedHeap::ensure_parsability(retire_tlabs); | 1243 CollectedHeap::ensure_parsability(retire_tlabs); |
1244 GenEnsureParsabilityClosure ep_cl; | 1244 GenEnsureParsabilityClosure ep_cl; |
1245 generation_iterate(&ep_cl, false); | 1245 generation_iterate(&ep_cl, false); |
1246 } | 1246 } |
1247 | 1247 |
1248 oop GenCollectedHeap::handle_failed_promotion(Generation* gen, | 1248 oop GenCollectedHeap::handle_failed_promotion(Generation* old_gen, |
1249 oop obj, | 1249 oop obj, |
1250 size_t obj_size) { | 1250 size_t obj_size) { |
1251 guarantee(old_gen->level() == 1, "We only get here with an old generation"); | |
1251 assert(obj_size == (size_t)obj->size(), "bad obj_size passed in"); | 1252 assert(obj_size == (size_t)obj->size(), "bad obj_size passed in"); |
1252 HeapWord* result = NULL; | 1253 HeapWord* result = NULL; |
1253 | 1254 |
1254 // First give each higher generation a chance to allocate the promoted object. | 1255 result = old_gen->expand_and_allocate(obj_size, false); |
1255 Generation* allocator = next_gen(gen); | |
1256 if (allocator != NULL) { | |
1257 do { | |
1258 result = allocator->allocate(obj_size, false); | |
1259 } while (result == NULL && (allocator = next_gen(allocator)) != NULL); | |
1260 } | |
1261 | |
1262 if (result == NULL) { | |
1263 // Then give gen and higher generations a chance to expand and allocate the | |
1264 // object. | |
1265 do { | |
1266 result = gen->expand_and_allocate(obj_size, false); | |
1267 } while (result == NULL && (gen = next_gen(gen)) != NULL); | |
1268 } | |
1269 | 1256 |
1270 if (result != NULL) { | 1257 if (result != NULL) { |
1271 Copy::aligned_disjoint_words((HeapWord*)obj, result, obj_size); | 1258 Copy::aligned_disjoint_words((HeapWord*)obj, result, obj_size); |
1272 } | 1259 } |
1273 return oop(result); | 1260 return oop(result); |