comparison src/share/vm/memory/genCollectedHeap.cpp @ 18041:52b4284cb496

Merge with jdk8u20-b26
author Gilles Duboscq <duboscq@ssw.jku.at>
date Wed, 15 Oct 2014 16:02:50 +0200
parents 4ca6dc0799b6 78bbf4d43a14
children 7848fc12602b
comparison
equal deleted inserted replaced
17606:45d7b2c7029d 18041:52b4284cb496
1 /* 1 /*
2 * Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved. 2 * Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 * 4 *
5 * This code is free software; you can redistribute it and/or modify it 5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as 6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation. 7 * published by the Free Software Foundation.
372 const bool do_clear_all_soft_refs = clear_all_soft_refs || 372 const bool do_clear_all_soft_refs = clear_all_soft_refs ||
373 collector_policy()->should_clear_all_soft_refs(); 373 collector_policy()->should_clear_all_soft_refs();
374 374
375 ClearedAllSoftRefs casr(do_clear_all_soft_refs, collector_policy()); 375 ClearedAllSoftRefs casr(do_clear_all_soft_refs, collector_policy());
376 376
377 const size_t metadata_prev_used = MetaspaceAux::allocated_used_bytes(); 377 const size_t metadata_prev_used = MetaspaceAux::used_bytes();
378 378
379 print_heap_before_gc(); 379 print_heap_before_gc();
380 380
381 { 381 {
382 FlagSetting fl(_is_gc_active, true); 382 FlagSetting fl(_is_gc_active, true);
807 } 807 }
808 808
809 bool GenCollectedHeap::is_in_young(oop p) { 809 bool GenCollectedHeap::is_in_young(oop p) {
810 bool result = ((HeapWord*)p) < _gens[_n_gens - 1]->reserved().start(); 810 bool result = ((HeapWord*)p) < _gens[_n_gens - 1]->reserved().start();
811 assert(result == _gens[0]->is_in_reserved(p), 811 assert(result == _gens[0]->is_in_reserved(p),
812 err_msg("incorrect test - result=%d, p=" PTR_FORMAT, result, (void*)p)); 812 err_msg("incorrect test - result=%d, p=" PTR_FORMAT, result, p2i((void*)p)));
813 return result; 813 return result;
814 } 814 }
815 815
816 // Returns "TRUE" iff "p" points into the committed areas of the heap. 816 // Returns "TRUE" iff "p" points into the committed areas of the heap.
817 bool GenCollectedHeap::is_in(const void* p) const { 817 bool GenCollectedHeap::is_in(const void* p) const {
930 size_t GenCollectedHeap::tlab_capacity(Thread* thr) const { 930 size_t GenCollectedHeap::tlab_capacity(Thread* thr) const {
931 size_t result = 0; 931 size_t result = 0;
932 for (int i = 0; i < _n_gens; i += 1) { 932 for (int i = 0; i < _n_gens; i += 1) {
933 if (_gens[i]->supports_tlab_allocation()) { 933 if (_gens[i]->supports_tlab_allocation()) {
934 result += _gens[i]->tlab_capacity(); 934 result += _gens[i]->tlab_capacity();
935 }
936 }
937 return result;
938 }
939
940 size_t GenCollectedHeap::tlab_used(Thread* thr) const {
941 size_t result = 0;
942 for (int i = 0; i < _n_gens; i += 1) {
943 if (_gens[i]->supports_tlab_allocation()) {
944 result += _gens[i]->tlab_used();
935 } 945 }
936 } 946 }
937 return result; 947 return result;
938 } 948 }
939 949
1076 1086
1077 void GenCollectedHeap::verify(bool silent, VerifyOption option /* ignored */) { 1087 void GenCollectedHeap::verify(bool silent, VerifyOption option /* ignored */) {
1078 for (int i = _n_gens-1; i >= 0; i--) { 1088 for (int i = _n_gens-1; i >= 0; i--) {
1079 Generation* g = _gens[i]; 1089 Generation* g = _gens[i];
1080 if (!silent) { 1090 if (!silent) {
1081 gclog_or_tty->print(g->name()); 1091 gclog_or_tty->print("%s", g->name());
1082 gclog_or_tty->print(" "); 1092 gclog_or_tty->print(" ");
1083 } 1093 }
1084 g->verify(); 1094 g->verify();
1085 } 1095 }
1086 if (!silent) { 1096 if (!silent) {
1279 // provided the underlying platform provides such a time source 1289 // provided the underlying platform provides such a time source
1280 // (and it is bug free). So we still have to guard against getting 1290 // (and it is bug free). So we still have to guard against getting
1281 // back a time later than 'now'. 1291 // back a time later than 'now'.
1282 jlong retVal = now - tolgc_cl.time(); 1292 jlong retVal = now - tolgc_cl.time();
1283 if (retVal < 0) { 1293 if (retVal < 0) {
1284 NOT_PRODUCT(warning("time warp: "INT64_FORMAT, retVal);) 1294 NOT_PRODUCT(warning("time warp: "INT64_FORMAT, (int64_t) retVal);)
1285 return 0; 1295 return 0;
1286 } 1296 }
1287 return retVal; 1297 return retVal;
1288 } 1298 }