Mercurial > hg > graal-compiler
comparison src/cpu/sparc/vm/interp_masm_sparc.cpp @ 10105:aeaca88565e6
8010862: The Method counter fields used for profiling can be allocated lazily.
Summary: Allocate the method's profiling related metadata until they are needed.
Reviewed-by: coleenp, roland
author | jiangli |
---|---|
date | Tue, 09 Apr 2013 17:17:41 -0400 |
parents | 5505fbbae3d3 |
children | 1ea6a35dcbe5 |
comparison
equal
deleted
inserted
replaced
9055:dcdeb150988c | 10105:aeaca88565e6 |
---|---|
1 /* | 1 /* |
2 * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved. | 2 * Copyright (c) 1997, 2013, 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. |
28 #include "interpreter/interpreterRuntime.hpp" | 28 #include "interpreter/interpreterRuntime.hpp" |
29 #include "oops/arrayOop.hpp" | 29 #include "oops/arrayOop.hpp" |
30 #include "oops/markOop.hpp" | 30 #include "oops/markOop.hpp" |
31 #include "oops/methodData.hpp" | 31 #include "oops/methodData.hpp" |
32 #include "oops/method.hpp" | 32 #include "oops/method.hpp" |
33 #include "oops/methodCounters.hpp" | |
33 #include "prims/jvmtiExport.hpp" | 34 #include "prims/jvmtiExport.hpp" |
34 #include "prims/jvmtiRedefineClassesTrace.hpp" | 35 #include "prims/jvmtiRedefineClassesTrace.hpp" |
35 #include "prims/jvmtiThreadState.hpp" | 36 #include "prims/jvmtiThreadState.hpp" |
36 #include "runtime/basicLock.hpp" | 37 #include "runtime/basicLock.hpp" |
37 #include "runtime/biasedLocking.hpp" | 38 #include "runtime/biasedLocking.hpp" |
2084 add( Lesp, wordSize, Rdest ); | 2085 add( Lesp, wordSize, Rdest ); |
2085 } | 2086 } |
2086 | 2087 |
2087 #endif /* CC_INTERP */ | 2088 #endif /* CC_INTERP */ |
2088 | 2089 |
2089 void InterpreterMacroAssembler::increment_invocation_counter( Register Rtmp, Register Rtmp2 ) { | 2090 void InterpreterMacroAssembler::get_method_counters(Register method, |
2091 Register Rcounters, | |
2092 Label& skip) { | |
2093 Label has_counters; | |
2094 Address method_counters(method, in_bytes(Method::method_counters_offset())); | |
2095 ld_ptr(method_counters, Rcounters); | |
2096 br_notnull_short(Rcounters, Assembler::pt, has_counters); | |
2097 call_VM(noreg, CAST_FROM_FN_PTR(address, | |
2098 InterpreterRuntime::build_method_counters), method); | |
2099 ld_ptr(method_counters, Rcounters); | |
2100 br_null_short(Rcounters, Assembler::pn, skip); // No MethodCounters, OutOfMemory | |
2101 bind(has_counters); | |
2102 } | |
2103 | |
2104 void InterpreterMacroAssembler::increment_invocation_counter( Register Rcounters, Register Rtmp, Register Rtmp2 ) { | |
2090 assert(UseCompiler, "incrementing must be useful"); | 2105 assert(UseCompiler, "incrementing must be useful"); |
2091 #ifdef CC_INTERP | 2106 assert_different_registers(Rcounters, Rtmp, Rtmp2); |
2092 Address inv_counter(G5_method, Method::invocation_counter_offset() + | 2107 |
2108 Address inv_counter(Rcounters, MethodCounters::invocation_counter_offset() + | |
2093 InvocationCounter::counter_offset()); | 2109 InvocationCounter::counter_offset()); |
2094 Address be_counter (G5_method, Method::backedge_counter_offset() + | 2110 Address be_counter (Rcounters, MethodCounters::backedge_counter_offset() + |
2095 InvocationCounter::counter_offset()); | 2111 InvocationCounter::counter_offset()); |
2096 #else | |
2097 Address inv_counter(Lmethod, Method::invocation_counter_offset() + | |
2098 InvocationCounter::counter_offset()); | |
2099 Address be_counter (Lmethod, Method::backedge_counter_offset() + | |
2100 InvocationCounter::counter_offset()); | |
2101 #endif /* CC_INTERP */ | |
2102 int delta = InvocationCounter::count_increment; | 2112 int delta = InvocationCounter::count_increment; |
2103 | 2113 |
2104 // Load each counter in a register | 2114 // Load each counter in a register |
2105 ld( inv_counter, Rtmp ); | 2115 ld( inv_counter, Rtmp ); |
2106 ld( be_counter, Rtmp2 ); | 2116 ld( be_counter, Rtmp2 ); |
2120 add( Rtmp, Rtmp2, Rtmp); | 2130 add( Rtmp, Rtmp2, Rtmp); |
2121 | 2131 |
2122 // Note that this macro must leave the backedge_count + invocation_count in Rtmp! | 2132 // Note that this macro must leave the backedge_count + invocation_count in Rtmp! |
2123 } | 2133 } |
2124 | 2134 |
2125 void InterpreterMacroAssembler::increment_backedge_counter( Register Rtmp, Register Rtmp2 ) { | 2135 void InterpreterMacroAssembler::increment_backedge_counter( Register Rcounters, Register Rtmp, Register Rtmp2 ) { |
2126 assert(UseCompiler, "incrementing must be useful"); | 2136 assert(UseCompiler, "incrementing must be useful"); |
2127 #ifdef CC_INTERP | 2137 assert_different_registers(Rcounters, Rtmp, Rtmp2); |
2128 Address be_counter (G5_method, Method::backedge_counter_offset() + | 2138 |
2139 Address be_counter (Rcounters, MethodCounters::backedge_counter_offset() + | |
2129 InvocationCounter::counter_offset()); | 2140 InvocationCounter::counter_offset()); |
2130 Address inv_counter(G5_method, Method::invocation_counter_offset() + | 2141 Address inv_counter(Rcounters, MethodCounters::invocation_counter_offset() + |
2131 InvocationCounter::counter_offset()); | 2142 InvocationCounter::counter_offset()); |
2132 #else | 2143 |
2133 Address be_counter (Lmethod, Method::backedge_counter_offset() + | |
2134 InvocationCounter::counter_offset()); | |
2135 Address inv_counter(Lmethod, Method::invocation_counter_offset() + | |
2136 InvocationCounter::counter_offset()); | |
2137 #endif /* CC_INTERP */ | |
2138 int delta = InvocationCounter::count_increment; | 2144 int delta = InvocationCounter::count_increment; |
2139 // Load each counter in a register | 2145 // Load each counter in a register |
2140 ld( be_counter, Rtmp ); | 2146 ld( be_counter, Rtmp ); |
2141 ld( inv_counter, Rtmp2 ); | 2147 ld( inv_counter, Rtmp2 ); |
2142 | 2148 |