Mercurial > hg > graal-jvmci-8
comparison src/cpu/sparc/vm/templateTable_sparc.cpp @ 2100:b1a2afa37ec4
7003271: Hotspot should track cumulative Java heap bytes allocated on a per-thread basis
Summary: Track allocated bytes in Thread's, update on TLAB retirement and direct allocation in Eden and tenured, add JNI methods for ThreadMXBean.
Reviewed-by: coleenp, kvn, dholmes, ysr
author | phh |
---|---|
date | Fri, 07 Jan 2011 10:42:32 -0500 |
parents | f95d63e2154a |
children | bb8e3b66bde6 5577848f5923 |
comparison
equal
deleted
inserted
replaced
2097:039eb4201e06 | 2100:b1a2afa37ec4 |
---|---|
1 /* | 1 /* |
2 * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved. | 2 * Copyright (c) 1997, 2011, 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. |
3391 __ brx(Assembler::lessEqualUnsigned, true, Assembler::pt, initialize_object); | 3391 __ brx(Assembler::lessEqualUnsigned, true, Assembler::pt, initialize_object); |
3392 } | 3392 } |
3393 __ delayed()->st_ptr(RnewTopValue, G2_thread, in_bytes(JavaThread::tlab_top_offset())); | 3393 __ delayed()->st_ptr(RnewTopValue, G2_thread, in_bytes(JavaThread::tlab_top_offset())); |
3394 | 3394 |
3395 if (allow_shared_alloc) { | 3395 if (allow_shared_alloc) { |
3396 // Check if tlab should be discarded (refill_waste_limit >= free) | 3396 // Check if tlab should be discarded (refill_waste_limit >= free) |
3397 __ ld_ptr(G2_thread, in_bytes(JavaThread::tlab_refill_waste_limit_offset()), RtlabWasteLimitValue); | 3397 __ ld_ptr(G2_thread, in_bytes(JavaThread::tlab_refill_waste_limit_offset()), RtlabWasteLimitValue); |
3398 __ sub(RendValue, RoldTopValue, RfreeValue); | 3398 __ sub(RendValue, RoldTopValue, RfreeValue); |
3399 #ifdef _LP64 | 3399 #ifdef _LP64 |
3400 __ srlx(RfreeValue, LogHeapWordSize, RfreeValue); | 3400 __ srlx(RfreeValue, LogHeapWordSize, RfreeValue); |
3401 #else | 3401 #else |
3402 __ srl(RfreeValue, LogHeapWordSize, RfreeValue); | 3402 __ srl(RfreeValue, LogHeapWordSize, RfreeValue); |
3403 #endif | 3403 #endif |
3404 __ cmp(RtlabWasteLimitValue, RfreeValue); | 3404 __ cmp(RtlabWasteLimitValue, RfreeValue); |
3405 __ brx(Assembler::greaterEqualUnsigned, false, Assembler::pt, slow_case); // tlab waste is small | 3405 __ brx(Assembler::greaterEqualUnsigned, false, Assembler::pt, slow_case); // tlab waste is small |
3406 __ delayed()->nop(); | 3406 __ delayed()->nop(); |
3407 | 3407 |
3408 // increment waste limit to prevent getting stuck on this slow path | 3408 // increment waste limit to prevent getting stuck on this slow path |
3409 __ add(RtlabWasteLimitValue, ThreadLocalAllocBuffer::refill_waste_limit_increment(), RtlabWasteLimitValue); | 3409 __ add(RtlabWasteLimitValue, ThreadLocalAllocBuffer::refill_waste_limit_increment(), RtlabWasteLimitValue); |
3410 __ st_ptr(RtlabWasteLimitValue, G2_thread, in_bytes(JavaThread::tlab_refill_waste_limit_offset())); | 3410 __ st_ptr(RtlabWasteLimitValue, G2_thread, in_bytes(JavaThread::tlab_refill_waste_limit_offset())); |
3411 } else { | 3411 } else { |
3412 // No allocation in the shared eden. | 3412 // No allocation in the shared eden. |
3413 __ br(Assembler::always, false, Assembler::pt, slow_case); | 3413 __ br(Assembler::always, false, Assembler::pt, slow_case); |
3414 __ delayed()->nop(); | 3414 __ delayed()->nop(); |
3415 } | 3415 } |
3443 | 3443 |
3444 // if someone beat us on the allocation, try again, otherwise continue | 3444 // if someone beat us on the allocation, try again, otherwise continue |
3445 __ cmp(RoldTopValue, RnewTopValue); | 3445 __ cmp(RoldTopValue, RnewTopValue); |
3446 __ brx(Assembler::notEqual, false, Assembler::pn, retry); | 3446 __ brx(Assembler::notEqual, false, Assembler::pn, retry); |
3447 __ delayed()->nop(); | 3447 __ delayed()->nop(); |
3448 | |
3449 // bump total bytes allocated by this thread | |
3450 __ incr_allocated_bytes(Roffset, 0, G1_scratch); | |
3448 } | 3451 } |
3449 | 3452 |
3450 if (UseTLAB || Universe::heap()->supports_inline_contig_alloc()) { | 3453 if (UseTLAB || Universe::heap()->supports_inline_contig_alloc()) { |
3451 // clear object fields | 3454 // clear object fields |
3452 __ bind(initialize_object); | 3455 __ bind(initialize_object); |