mirror of
https://github.com/openjdk/jdk.git
synced 2025-08-27 06:45:07 +02:00
7003271: Hotspot should track cumulative Java heap bytes allocated on a per-thread basis
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
This commit is contained in:
parent
6f2c2c3272
commit
7b0134a7cb
26 changed files with 447 additions and 212 deletions
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
|
@ -4083,11 +4083,15 @@ void MacroAssembler::tlab_refill(Label& retry, Label& try_eden, Label& slow_case
|
|||
store_klass(t2, top);
|
||||
verify_oop(top);
|
||||
|
||||
ld_ptr(G2_thread, in_bytes(JavaThread::tlab_start_offset()), t1);
|
||||
sub(top, t1, t1); // size of tlab's allocated portion
|
||||
incr_allocated_bytes(t1, 0, t2);
|
||||
|
||||
// refill the tlab with an eden allocation
|
||||
bind(do_refill);
|
||||
ld_ptr(G2_thread, in_bytes(JavaThread::tlab_size_offset()), t1);
|
||||
sll_ptr(t1, LogHeapWordSize, t1);
|
||||
// add object_size ??
|
||||
// allocate new tlab, address returned in top
|
||||
eden_allocate(top, t1, 0, t2, t3, slow_case);
|
||||
|
||||
st_ptr(top, G2_thread, in_bytes(JavaThread::tlab_start_offset()));
|
||||
|
@ -4115,6 +4119,22 @@ void MacroAssembler::tlab_refill(Label& retry, Label& try_eden, Label& slow_case
|
|||
delayed()->nop();
|
||||
}
|
||||
|
||||
void MacroAssembler::incr_allocated_bytes(Register var_size_in_bytes,
|
||||
int con_size_in_bytes,
|
||||
Register t1) {
|
||||
// Bump total bytes allocated by this thread
|
||||
assert(t1->is_global(), "must be global reg"); // so all 64 bits are saved on a context switch
|
||||
assert_different_registers(var_size_in_bytes, t1);
|
||||
// v8 support has gone the way of the dodo
|
||||
ldx(G2_thread, in_bytes(JavaThread::allocated_bytes_offset()), t1);
|
||||
if (var_size_in_bytes->is_valid()) {
|
||||
add(t1, var_size_in_bytes, t1);
|
||||
} else {
|
||||
add(t1, con_size_in_bytes, t1);
|
||||
}
|
||||
stx(t1, G2_thread, in_bytes(JavaThread::allocated_bytes_offset()));
|
||||
}
|
||||
|
||||
Assembler::Condition MacroAssembler::negate_condition(Assembler::Condition cond) {
|
||||
switch (cond) {
|
||||
// Note some conditions are synonyms for others
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue