Fri, 07 Jan 2011 10:42:32 -0500
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
duke@435 | 1 | /* |
stefank@2314 | 2 | * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. |
duke@435 | 3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
duke@435 | 4 | * |
duke@435 | 5 | * This code is free software; you can redistribute it and/or modify it |
duke@435 | 6 | * under the terms of the GNU General Public License version 2 only, as |
duke@435 | 7 | * published by the Free Software Foundation. |
duke@435 | 8 | * |
duke@435 | 9 | * This code is distributed in the hope that it will be useful, but WITHOUT |
duke@435 | 10 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
duke@435 | 11 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
duke@435 | 12 | * version 2 for more details (a copy is included in the LICENSE file that |
duke@435 | 13 | * accompanied this code). |
duke@435 | 14 | * |
duke@435 | 15 | * You should have received a copy of the GNU General Public License version |
duke@435 | 16 | * 2 along with this work; if not, write to the Free Software Foundation, |
duke@435 | 17 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
duke@435 | 18 | * |
trims@1907 | 19 | * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
trims@1907 | 20 | * or visit www.oracle.com if you need additional information or have any |
trims@1907 | 21 | * questions. |
duke@435 | 22 | * |
duke@435 | 23 | */ |
duke@435 | 24 | |
stefank@2314 | 25 | #ifndef CPU_X86_VM_C1_FPUSTACKSIM_X86_HPP |
stefank@2314 | 26 | #define CPU_X86_VM_C1_FPUSTACKSIM_X86_HPP |
stefank@2314 | 27 | |
duke@435 | 28 | // Simulates the FPU stack and maintains mapping [fpu-register -> stack offset] |
duke@435 | 29 | // FPU registers are described as numbers from 0..nof_fpu_regs-1 |
duke@435 | 30 | |
duke@435 | 31 | class Compilation; |
duke@435 | 32 | |
duke@435 | 33 | class FpuStackSim VALUE_OBJ_CLASS_SPEC { |
duke@435 | 34 | private: |
duke@435 | 35 | Compilation* _compilation; |
duke@435 | 36 | int _stack_size; |
duke@435 | 37 | int _regs[FrameMap::nof_fpu_regs]; |
duke@435 | 38 | |
duke@435 | 39 | int tos_index() const { return _stack_size - 1; } |
duke@435 | 40 | |
duke@435 | 41 | int regs_at(int i) const; |
duke@435 | 42 | void set_regs_at(int i, int val); |
duke@435 | 43 | void dec_stack_size(); |
duke@435 | 44 | void inc_stack_size(); |
duke@435 | 45 | |
duke@435 | 46 | // unified bailout support |
duke@435 | 47 | Compilation* compilation() const { return _compilation; } |
duke@435 | 48 | void bailout(const char* msg) const { compilation()->bailout(msg); } |
duke@435 | 49 | bool bailed_out() const { return compilation()->bailed_out(); } |
duke@435 | 50 | |
duke@435 | 51 | public: |
duke@435 | 52 | FpuStackSim(Compilation* compilation); |
duke@435 | 53 | void pop (); |
duke@435 | 54 | void pop (int rnr); // rnr must be on tos |
duke@435 | 55 | void push(int rnr); |
duke@435 | 56 | void swap(int offset); // exchange tos with tos + offset |
duke@435 | 57 | int offset_from_tos(int rnr) const; // return the offset of the topmost instance of rnr from TOS |
duke@435 | 58 | int get_slot(int tos_offset) const; // return the entry at the given offset from TOS |
duke@435 | 59 | void set_slot(int tos_offset, int rnr); // set the entry at the given offset from TOS |
duke@435 | 60 | void rename(int old_rnr, int new_rnr); // rename all instances of old_rnr to new_rnr |
duke@435 | 61 | bool contains(int rnr); // debugging support only |
duke@435 | 62 | bool is_empty(); |
duke@435 | 63 | bool slot_is_empty(int tos_offset); |
duke@435 | 64 | int stack_size() const { return _stack_size; } |
duke@435 | 65 | void clear(); |
duke@435 | 66 | intArray* write_state(); |
duke@435 | 67 | void read_state(intArray* fpu_stack_state); |
duke@435 | 68 | |
duke@435 | 69 | void print() PRODUCT_RETURN; |
duke@435 | 70 | }; |
stefank@2314 | 71 | |
stefank@2314 | 72 | #endif // CPU_X86_VM_C1_FPUSTACKSIM_X86_HPP |