comparison ppc_patches/0201_C_interpreter-implement_bytecode_profiling.patch @ 4881:edf2bb42e70f

Recent changes to patch queue
author goetz
date Fri, 28 Jun 2013 16:31:09 +0200
parents df79d76c17ab
children 874e94d3b21d
comparison
equal deleted inserted replaced
0:6cd923ee3165 1:b966dbc0b516
1 # HG changeset patch 1 # HG changeset patch
2 # Parent 84fd980e69ee155f80ae36002f29703ea7d16205 2 # Parent 738d32552a9693f1f440426756e7b4906b3b7552
3 C-interpreter: implement bytecode profiling. 3 C-interpreter: implement bytecode profiling.
4 4
5 diff -r 84fd980e69ee src/share/vm/interpreter/bytecodeInterpreter.cpp 5 diff -r 738d32552a96 src/share/vm/interpreter/bytecodeInterpreter.cpp
6 --- a/src/share/vm/interpreter/bytecodeInterpreter.cpp Fri Jun 07 12:50:21 2013 +0200 6 --- a/src/share/vm/interpreter/bytecodeInterpreter.cpp Fri Jun 28 14:17:32 2013 +0200
7 +++ b/src/share/vm/interpreter/bytecodeInterpreter.cpp Fri Jun 07 12:51:22 2013 +0200 7 +++ b/src/share/vm/interpreter/bytecodeInterpreter.cpp Fri Jun 28 14:34:21 2013 +0200
8 @@ -28,6 +28,7 @@ 8 @@ -28,6 +28,7 @@
9 #include "interpreter/bytecodeHistogram.hpp" 9 #include "interpreter/bytecodeHistogram.hpp"
10 #include "interpreter/bytecodeInterpreter.hpp" 10 #include "interpreter/bytecodeInterpreter.hpp"
11 #include "interpreter/bytecodeInterpreter.inline.hpp" 11 #include "interpreter/bytecodeInterpreter.inline.hpp"
12 +#include "interpreter/bytecodeInterpreterProfiling.hpp" 12 +#include "interpreter/bytecodeInterpreterProfiling.hpp"
35 +#define VM_JAVA_ERROR(name, msg, note_a_trap) \ 35 +#define VM_JAVA_ERROR(name, msg, note_a_trap) \
36 + VM_JAVA_ERROR_NO_JUMP(name, msg, note_a_trap) \ 36 + VM_JAVA_ERROR_NO_JUMP(name, msg, note_a_trap) \
37 goto handle_exception; 37 goto handle_exception;
38 38
39 #ifdef PRODUCT 39 #ifdef PRODUCT
40 @@ -346,7 +348,22 @@ 40 @@ -341,7 +343,23 @@
41 if (UseLoopCounter) { \ 41 if (UseLoopCounter) { \
42 bool do_OSR = UseOnStackReplacement; \ 42 bool do_OSR = UseOnStackReplacement; \
43 INCR_BACKEDGE_COUNT(mcs); \ 43 mcs->backedge_counter()->increment(); \
44 - if (do_OSR) do_OSR = BACKEDGE_COUNT(mcs)->reached_InvocationLimit(); \ 44 - if (do_OSR) do_OSR = mcs->backedge_counter()->reached_InvocationLimit(); \
45 + if (ProfileInterpreter) { \ 45 + if (ProfileInterpreter) { \
46 + BI_PROFILE_GET_OR_CREATE_METHOD_DATA(handle_exception); \ 46 + BI_PROFILE_GET_OR_CREATE_METHOD_DATA(handle_exception); \
47 + /* Check for overflow against MDO count. */ \ 47 + /* Check for overflow against MDO count. */ \
48 + do_OSR = do_OSR \ 48 + do_OSR = do_OSR \
49 + && (mdo_last_branch_taken_count >= (uint)InvocationCounter::InterpreterBackwardBranchLimit)\ 49 + && (mdo_last_branch_taken_count >= (uint)InvocationCounter::InterpreterBackwardBranchLimit)\
54 + /* being compiled, add a second test to make sure the overflow */ \ 54 + /* being compiled, add a second test to make sure the overflow */ \
55 + /* function is called only once every overflow_frequency. */ \ 55 + /* function is called only once every overflow_frequency. */ \
56 + && (!(mdo_last_branch_taken_count & 1023)); \ 56 + && (!(mdo_last_branch_taken_count & 1023)); \
57 + } else { \ 57 + } else { \
58 + /* check for overflow of backedge counter */ \ 58 + /* check for overflow of backedge counter */ \
59 + do_OSR = do_OSR && INVOCATION_COUNT(mcs)->reached_InvocationLimit(BACKEDGE_COUNT(mcs)); \ 59 + do_OSR = do_OSR \
60 + && mcs->invocation_counter()->reached_InvocationLimit(mcs->backedge_counter()); \
60 + } \ 61 + } \
61 if (do_OSR) { \ 62 if (do_OSR) { \
62 nmethod* osr_nmethod; \ 63 nmethod* osr_nmethod; \
63 OSR_REQUEST(osr_nmethod, branch_pc); \ 64 OSR_REQUEST(osr_nmethod, branch_pc); \
64 @@ -359,7 +376,6 @@ 65 @@ -354,7 +372,6 @@
65 } \ 66 } \
66 } \ 67 } \
67 } /* UseCompiler ... */ \ 68 } /* UseCompiler ... */ \
68 - mcs->invocation_counter()->increment(); \ 69 - mcs->invocation_counter()->increment(); \
69 SAFEPOINT; \ 70 SAFEPOINT; \
70 } 71 }
71 72
72 @@ -392,16 +408,20 @@ 73 @@ -387,16 +404,20 @@
73 #undef CACHE_FRAME 74 #undef CACHE_FRAME
74 #define CACHE_FRAME() 75 #define CACHE_FRAME()
75 76
76 +// BCI() returns the current bytecode-index. 77 +// BCI() returns the current bytecode-index.
77 +#undef BCI 78 +#undef BCI
92 + VM_JAVA_ERROR(vmSymbols::java_lang_NullPointerException(), "", note_nullCheck_trap); \ 93 + VM_JAVA_ERROR(vmSymbols::java_lang_NullPointerException(), "", note_nullCheck_trap); \
93 + } \ 94 + } \
94 VERIFY_OOP(obj_) 95 VERIFY_OOP(obj_)
95 96
96 #define VMdoubleConstZero() 0.0 97 #define VMdoubleConstZero() 0.0
97 @@ -636,6 +656,13 @@ 98 @@ -630,6 +651,13 @@
98 topOfStack < istate->stack_base(), 99 topOfStack < istate->stack_base(),
99 "Stack top out of range"); 100 "Stack top out of range");
100 101
101 +#ifdef CC_INTERP_PROFILE 102 +#ifdef CC_INTERP_PROFILE
102 + // MethodData's last branch taken count. 103 + // MethodData's last branch taken count.
106 +#endif 107 +#endif
107 + 108 +
108 switch (istate->msg()) { 109 switch (istate->msg()) {
109 case initialize: { 110 case initialize: {
110 if (initialized++) ShouldNotReachHere(); // Only one initialize call 111 if (initialized++) ShouldNotReachHere(); // Only one initialize call
111 @@ -657,15 +684,12 @@ 112 @@ -651,15 +679,12 @@
112 METHOD->increment_interpreter_invocation_count(THREAD); 113 METHOD->increment_interpreter_invocation_count(THREAD);
113 } 114 }
114 INCR_INVOCATION_COUNT(mcs); 115 mcs->invocation_counter()->increment();
115 - if (INVOCATION_COUNT(mcs)->reached_InvocationLimit()) { 116 - if (mcs->invocation_counter()->reached_InvocationLimit()) {
116 - CALL_VM((void)InterpreterRuntime::frequency_counter_overflow(THREAD, NULL), handle_exception); 117 - CALL_VM((void)InterpreterRuntime::frequency_counter_overflow(THREAD, NULL), handle_exception);
117 - 118 -
118 - // We no longer retry on a counter overflow 119 - // We no longer retry on a counter overflow
119 - 120 -
120 - // istate->set_msg(retry_method); 121 - // istate->set_msg(retry_method);
121 - // THREAD->clr_do_not_unlock(); 122 - // THREAD->clr_do_not_unlock();
122 - // return; 123 - // return;
123 + if (INVOCATION_COUNT(mcs)->reached_InvocationLimit(BACKEDGE_COUNT(mcs))) { 124 + if (mcs->invocation_counter()->reached_InvocationLimit(mcs->backedge_counter())) {
124 + CALL_VM((void)InterpreterRuntime::frequency_counter_overflow(THREAD, NULL), handle_exception); 125 + CALL_VM((void)InterpreterRuntime::frequency_counter_overflow(THREAD, NULL), handle_exception);
125 + // We no longer retry on a counter overflow 126 + // We no longer retry on a counter overflow
126 } 127 }
127 + // Get or create profile data. Check for pending (async) exceptions. 128 + // Get or create profile data. Check for pending (async) exceptions.
128 + BI_PROFILE_GET_OR_CREATE_METHOD_DATA(handle_exception); 129 + BI_PROFILE_GET_OR_CREATE_METHOD_DATA(handle_exception);
129 SAFEPOINT; 130 SAFEPOINT;
130 } 131 }
131 132
132 @@ -806,9 +830,18 @@ 133 @@ -681,7 +706,6 @@
134 }
135 #endif // HACK
136
137 -
138 // lock method if synchronized
139 if (METHOD->is_synchronized()) {
140 // oop rcvr = locals[0].j.r;
141 @@ -796,9 +820,18 @@
133 case popping_frame: { 142 case popping_frame: {
134 // returned from a java call to pop the frame, restart the call 143 // returned from a java call to pop the frame, restart the call
135 // clear the message so we don't confuse ourselves later 144 // clear the message so we don't confuse ourselves later
136 - ShouldNotReachHere(); // we don't return this. 145 - ShouldNotReachHere(); // we don't return this.
137 + // Commented out ShouldNotReachHere() below, because we do reach 146 + // Commented out ShouldNotReachHere() below, because we do reach
147 + BI_PROFILE_GET_OR_CREATE_METHOD_DATA(handle_exception); 156 + BI_PROFILE_GET_OR_CREATE_METHOD_DATA(handle_exception);
148 + } 157 + }
149 THREAD->clr_pop_frame_in_process(); 158 THREAD->clr_pop_frame_in_process();
150 goto run; 159 goto run;
151 } 160 }
152 @@ -842,6 +875,11 @@ 161 @@ -832,6 +865,11 @@
153 if (THREAD->has_pending_exception()) goto handle_exception; 162 if (THREAD->has_pending_exception()) goto handle_exception;
154 // Update the pc by the saved amount of the invoke bytecode size 163 // Update the pc by the saved amount of the invoke bytecode size
155 UPDATE_PC(istate->bcp_advance()); 164 UPDATE_PC(istate->bcp_advance());
156 + 165 +
157 + if (_compiling) { 166 + if (_compiling) {
159 + BI_PROFILE_GET_OR_CREATE_METHOD_DATA(handle_exception); 168 + BI_PROFILE_GET_OR_CREATE_METHOD_DATA(handle_exception);
160 + } 169 + }
161 goto run; 170 goto run;
162 } 171 }
163 172
164 @@ -849,6 +887,11 @@ 173 @@ -839,6 +877,11 @@
165 // Returned from an opcode that will reexecute. Deopt was 174 // Returned from an opcode that will reexecute. Deopt was
166 // a result of a PopFrame request. 175 // a result of a PopFrame request.
167 // 176 //
168 + 177 +
169 + if (_compiling) { 178 + if (_compiling) {
171 + BI_PROFILE_GET_OR_CREATE_METHOD_DATA(handle_exception); 180 + BI_PROFILE_GET_OR_CREATE_METHOD_DATA(handle_exception);
172 + } 181 + }
173 goto run; 182 goto run;
174 } 183 }
175 184
176 @@ -871,6 +914,11 @@ 185 @@ -861,6 +904,11 @@
177 } 186 }
178 UPDATE_PC(Bytecodes::length_at(METHOD, pc)); 187 UPDATE_PC(Bytecodes::length_at(METHOD, pc));
179 if (THREAD->has_pending_exception()) goto handle_exception; 188 if (THREAD->has_pending_exception()) goto handle_exception;
180 + 189 +
181 + if (_compiling) { 190 + if (_compiling) {
183 + BI_PROFILE_GET_OR_CREATE_METHOD_DATA(handle_exception); 192 + BI_PROFILE_GET_OR_CREATE_METHOD_DATA(handle_exception);
184 + } 193 + }
185 goto run; 194 goto run;
186 } 195 }
187 case got_monitors: { 196 case got_monitors: {
188 @@ -1124,6 +1172,11 @@ 197 @@ -1111,6 +1159,11 @@
189 uint16_t reg = Bytes::get_Java_u2(pc + 2); 198 uint16_t reg = Bytes::get_Java_u2(pc + 2);
190 199
191 opcode = pc[1]; 200 opcode = pc[1];
192 + 201 +
193 + // Wide and it's sub-bytecode are counted as separate instructions. If we 202 + // Wide and it's sub-bytecode are counted as separate instructions. If we
195 + DO_UPDATE_INSTRUCTION_COUNT(opcode); 204 + DO_UPDATE_INSTRUCTION_COUNT(opcode);
196 + 205 +
197 switch(opcode) { 206 switch(opcode) {
198 case Bytecodes::_aload: 207 case Bytecodes::_aload:
199 VERIFY_OOP(LOCALS_OBJECT(reg)); 208 VERIFY_OOP(LOCALS_OBJECT(reg));
200 @@ -1167,10 +1220,13 @@ 209 @@ -1154,10 +1207,13 @@
201 UPDATE_PC_AND_CONTINUE(6); 210 UPDATE_PC_AND_CONTINUE(6);
202 } 211 }
203 case Bytecodes::_ret: 212 case Bytecodes::_ret:
204 + // Profile ret. 213 + // Profile ret.
205 + BI_PROFILE_UPDATE_RET(/*bci=*/((int)(intptr_t)(LOCALS_ADDR(reg)))); 214 + BI_PROFILE_UPDATE_RET(/*bci=*/((int)(intptr_t)(LOCALS_ADDR(reg))));
210 - VM_JAVA_ERROR(vmSymbols::java_lang_InternalError(), "undefined opcode"); 219 - VM_JAVA_ERROR(vmSymbols::java_lang_InternalError(), "undefined opcode");
211 + VM_JAVA_ERROR(vmSymbols::java_lang_InternalError(), "undefined opcode", note_no_trap); 220 + VM_JAVA_ERROR(vmSymbols::java_lang_InternalError(), "undefined opcode", note_no_trap);
212 } 221 }
213 } 222 }
214 223
215 @@ -1251,7 +1307,7 @@ 224 @@ -1238,7 +1294,7 @@
216 CASE(_i##opcname): \ 225 CASE(_i##opcname): \
217 if (test && (STACK_INT(-1) == 0)) { \ 226 if (test && (STACK_INT(-1) == 0)) { \
218 VM_JAVA_ERROR(vmSymbols::java_lang_ArithmeticException(), \ 227 VM_JAVA_ERROR(vmSymbols::java_lang_ArithmeticException(), \
219 - "/ by zero"); \ 228 - "/ by zero"); \
220 + "/ by zero", note_div0Check_trap); \ 229 + "/ by zero", note_div0Check_trap); \
221 } \ 230 } \
222 SET_STACK_INT(VMint##opname(STACK_INT(-2), \ 231 SET_STACK_INT(VMint##opname(STACK_INT(-2), \
223 STACK_INT(-1)), \ 232 STACK_INT(-1)), \
224 @@ -1263,7 +1319,7 @@ 233 @@ -1250,7 +1306,7 @@
225 jlong l1 = STACK_LONG(-1); \ 234 jlong l1 = STACK_LONG(-1); \
226 if (VMlongEqz(l1)) { \ 235 if (VMlongEqz(l1)) { \
227 VM_JAVA_ERROR(vmSymbols::java_lang_ArithmeticException(), \ 236 VM_JAVA_ERROR(vmSymbols::java_lang_ArithmeticException(), \
228 - "/ by long zero"); \ 237 - "/ by long zero"); \
229 + "/ by long zero", note_div0Check_trap); \ 238 + "/ by long zero", note_div0Check_trap); \
230 } \ 239 } \
231 } \ 240 } \
232 /* First long at (-1,-2) next long at (-3,-4) */ \ 241 /* First long at (-1,-2) next long at (-3,-4) */ \
233 @@ -1476,17 +1532,23 @@ 242 @@ -1463,17 +1519,23 @@
234 243
235 #define COMPARISON_OP(name, comparison) \ 244 #define COMPARISON_OP(name, comparison) \
236 CASE(_if_icmp##name): { \ 245 CASE(_if_icmp##name): { \
237 - int skip = (STACK_INT(-2) comparison STACK_INT(-1)) \ 246 - int skip = (STACK_INT(-2) comparison STACK_INT(-1)) \
238 + const bool cmp = (STACK_INT(-2) comparison STACK_INT(-1)); \ 247 + const bool cmp = (STACK_INT(-2) comparison STACK_INT(-1)); \
254 + /* Profile branch. */ \ 263 + /* Profile branch. */ \
255 + BI_PROFILE_UPDATE_BRANCH(/*is_taken=*/cmp); \ 264 + BI_PROFILE_UPDATE_BRANCH(/*is_taken=*/cmp); \
256 UPDATE_PC_AND_TOS(skip, -1); \ 265 UPDATE_PC_AND_TOS(skip, -1); \
257 DO_BACKEDGE_CHECKS(skip, branch_pc); \ 266 DO_BACKEDGE_CHECKS(skip, branch_pc); \
258 CONTINUE; \ 267 CONTINUE; \
259 @@ -1495,9 +1557,12 @@ 268 @@ -1482,9 +1544,12 @@
260 #define COMPARISON_OP2(name, comparison) \ 269 #define COMPARISON_OP2(name, comparison) \
261 COMPARISON_OP(name, comparison) \ 270 COMPARISON_OP(name, comparison) \
262 CASE(_if_acmp##name): { \ 271 CASE(_if_acmp##name): { \
263 - int skip = (STACK_OBJECT(-2) comparison STACK_OBJECT(-1)) \ 272 - int skip = (STACK_OBJECT(-2) comparison STACK_OBJECT(-1)) \
264 + const bool cmp = (STACK_OBJECT(-2) comparison STACK_OBJECT(-1)); \ 273 + const bool cmp = (STACK_OBJECT(-2) comparison STACK_OBJECT(-1)); \
268 + /* Profile branch. */ \ 277 + /* Profile branch. */ \
269 + BI_PROFILE_UPDATE_BRANCH(/*is_taken=*/cmp); \ 278 + BI_PROFILE_UPDATE_BRANCH(/*is_taken=*/cmp); \
270 UPDATE_PC_AND_TOS(skip, -2); \ 279 UPDATE_PC_AND_TOS(skip, -2); \
271 DO_BACKEDGE_CHECKS(skip, branch_pc); \ 280 DO_BACKEDGE_CHECKS(skip, branch_pc); \
272 CONTINUE; \ 281 CONTINUE; \
273 @@ -1505,9 +1570,12 @@ 282 @@ -1492,9 +1557,12 @@
274 283
275 #define NULL_COMPARISON_NOT_OP(name) \ 284 #define NULL_COMPARISON_NOT_OP(name) \
276 CASE(_if##name): { \ 285 CASE(_if##name): { \
277 - int skip = (!(STACK_OBJECT(-1) == NULL)) \ 286 - int skip = (!(STACK_OBJECT(-1) == NULL)) \
278 + const bool cmp = (!(STACK_OBJECT(-1) == NULL)); \ 287 + const bool cmp = (!(STACK_OBJECT(-1) == NULL)); \
282 + /* Profile branch. */ \ 291 + /* Profile branch. */ \
283 + BI_PROFILE_UPDATE_BRANCH(/*is_taken=*/cmp); \ 292 + BI_PROFILE_UPDATE_BRANCH(/*is_taken=*/cmp); \
284 UPDATE_PC_AND_TOS(skip, -1); \ 293 UPDATE_PC_AND_TOS(skip, -1); \
285 DO_BACKEDGE_CHECKS(skip, branch_pc); \ 294 DO_BACKEDGE_CHECKS(skip, branch_pc); \
286 CONTINUE; \ 295 CONTINUE; \
287 @@ -1515,9 +1583,12 @@ 296 @@ -1502,9 +1570,12 @@
288 297
289 #define NULL_COMPARISON_OP(name) \ 298 #define NULL_COMPARISON_OP(name) \
290 CASE(_if##name): { \ 299 CASE(_if##name): { \
291 - int skip = ((STACK_OBJECT(-1) == NULL)) \ 300 - int skip = ((STACK_OBJECT(-1) == NULL)) \
292 + const bool cmp = ((STACK_OBJECT(-1) == NULL)); \ 301 + const bool cmp = ((STACK_OBJECT(-1) == NULL)); \
296 + /* Profile branch. */ \ 305 + /* Profile branch. */ \
297 + BI_PROFILE_UPDATE_BRANCH(/*is_taken=*/cmp); \ 306 + BI_PROFILE_UPDATE_BRANCH(/*is_taken=*/cmp); \
298 UPDATE_PC_AND_TOS(skip, -1); \ 307 UPDATE_PC_AND_TOS(skip, -1); \
299 DO_BACKEDGE_CHECKS(skip, branch_pc); \ 308 DO_BACKEDGE_CHECKS(skip, branch_pc); \
300 CONTINUE; \ 309 CONTINUE; \
301 @@ -1540,9 +1611,14 @@ 310 @@ -1527,9 +1598,14 @@
302 int32_t high = Bytes::get_Java_u4((address)&lpc[2]); 311 int32_t high = Bytes::get_Java_u4((address)&lpc[2]);
303 int32_t skip; 312 int32_t skip;
304 key -= low; 313 key -= low;
305 - skip = ((uint32_t) key > (uint32_t)(high - low)) 314 - skip = ((uint32_t) key > (uint32_t)(high - low))
306 - ? Bytes::get_Java_u4((address)&lpc[0]) 315 - ? Bytes::get_Java_u4((address)&lpc[0])
314 + // Profile switch. 323 + // Profile switch.
315 + BI_PROFILE_UPDATE_SWITCH(/*switch_index=*/key); 324 + BI_PROFILE_UPDATE_SWITCH(/*switch_index=*/key);
316 // Does this really need a full backedge check (osr?) 325 // Does this really need a full backedge check (osr?)
317 address branch_pc = pc; 326 address branch_pc = pc;
318 UPDATE_PC_AND_TOS(skip, -1); 327 UPDATE_PC_AND_TOS(skip, -1);
319 @@ -1556,14 +1632,21 @@ 328 @@ -1543,14 +1619,21 @@
320 jint* lpc = (jint*)VMalignWordUp(pc+1); 329 jint* lpc = (jint*)VMalignWordUp(pc+1);
321 int32_t key = STACK_INT(-1); 330 int32_t key = STACK_INT(-1);
322 int32_t skip = Bytes::get_Java_u4((address) lpc); /* default amount */ 331 int32_t skip = Bytes::get_Java_u4((address) lpc); /* default amount */
323 + // Remember index. 332 + // Remember index.
324 + int index = -1; 333 + int index = -1;
341 + // Profile switch. 350 + // Profile switch.
342 + BI_PROFILE_UPDATE_SWITCH(/*switch_index=*/index); 351 + BI_PROFILE_UPDATE_SWITCH(/*switch_index=*/index);
343 address branch_pc = pc; 352 address branch_pc = pc;
344 UPDATE_PC_AND_TOS(skip, -1); 353 UPDATE_PC_AND_TOS(skip, -1);
345 DO_BACKEDGE_CHECKS(skip, branch_pc); 354 DO_BACKEDGE_CHECKS(skip, branch_pc);
346 @@ -1648,7 +1731,7 @@ 355 @@ -1635,7 +1718,7 @@
347 if ((uint32_t)index >= (uint32_t)arrObj->length()) { \ 356 if ((uint32_t)index >= (uint32_t)arrObj->length()) { \
348 sprintf(message, "%d", index); \ 357 sprintf(message, "%d", index); \
349 VM_JAVA_ERROR(vmSymbols::java_lang_ArrayIndexOutOfBoundsException(), \ 358 VM_JAVA_ERROR(vmSymbols::java_lang_ArrayIndexOutOfBoundsException(), \
350 - message); \ 359 - message); \
351 + message, note_rangeCheck_trap); \ 360 + message, note_rangeCheck_trap); \
352 } 361 }
353 362
354 /* 32-bit loads. These handle conversion from < 32-bit types */ 363 /* 32-bit loads. These handle conversion from < 32-bit types */
355 @@ -1729,15 +1812,22 @@ 364 @@ -1716,15 +1799,22 @@
356 // arrObj, index are set 365 // arrObj, index are set
357 if (rhsObject != NULL) { 366 if (rhsObject != NULL) {
358 /* Check assignability of rhsObject into arrObj */ 367 /* Check assignability of rhsObject into arrObj */
359 - Klass* rhsKlassOop = rhsObject->klass(); // EBX (subclass) 368 - Klass* rhsKlassOop = rhsObject->klass(); // EBX (subclass)
360 - Klass* elemKlassOop = ObjArrayKlass::cast(arrObj->klass())->element_klass(); // superklass EAX 369 - Klass* elemKlassOop = ObjArrayKlass::cast(arrObj->klass())->element_klass(); // superklass EAX
377 + // Profile checkcast with null_seen and receiver. 386 + // Profile checkcast with null_seen and receiver.
378 + BI_PROFILE_UPDATE_CHECKCAST(/*null_seen=*/true, NULL); 387 + BI_PROFILE_UPDATE_CHECKCAST(/*null_seen=*/true, NULL);
379 } 388 }
380 // G1GC port. Use accessor instead of storing manually. 389 // G1GC port. Use accessor instead of storing manually.
381 // Takes care of write barriers internally and replaces the code above. 390 // Takes care of write barriers internally and replaces the code above.
382 @@ -2139,10 +2229,14 @@ 391 @@ -2124,10 +2214,14 @@
383 if (UseTLAB) { 392 if (UseTLAB) {
384 result = (oop) THREAD->tlab().allocate(obj_size); 393 result = (oop) THREAD->tlab().allocate(obj_size);
385 } 394 }
386 + // Disable non-TLAB-based fast-path, because profiling requires that all 395 + // Disable non-TLAB-based fast-path, because profiling requires that all
387 + // allocations go through InterpreterRuntime::_new() if THREAD->tlab().allocate 396 + // allocations go through InterpreterRuntime::_new() if THREAD->tlab().allocate
393 - retry: 402 - retry:
394 + retry: 403 + retry:
395 HeapWord* compare_to = *Universe::heap()->top_addr(); 404 HeapWord* compare_to = *Universe::heap()->top_addr();
396 HeapWord* new_top = compare_to + obj_size; 405 HeapWord* new_top = compare_to + obj_size;
397 if (new_top <= *Universe::heap()->end_addr()) { 406 if (new_top <= *Universe::heap()->end_addr()) {
398 @@ -2152,6 +2246,7 @@ 407 @@ -2137,6 +2231,7 @@
399 result = (oop) compare_to; 408 result = (oop) compare_to;
400 } 409 }
401 } 410 }
402 +#endif 411 +#endif
403 if (result != NULL) { 412 if (result != NULL) {
404 // Initialize object (if nonzero size and need) and then the header 413 // Initialize object (if nonzero size and need) and then the header
405 if (need_zero ) { 414 if (need_zero ) {
406 @@ -2207,42 +2302,40 @@ 415 @@ -2192,42 +2287,40 @@
407 if (STACK_OBJECT(-1) != NULL) { 416 if (STACK_OBJECT(-1) != NULL) {
408 VERIFY_OOP(STACK_OBJECT(-1)); 417 VERIFY_OOP(STACK_OBJECT(-1));
409 u2 index = Bytes::get_Java_u2(pc+1); 418 u2 index = Bytes::get_Java_u2(pc+1);
410 - if (ProfileInterpreter) { 419 - if (ProfileInterpreter) {
411 - // needs Profile_checkcast QQQ 420 - // needs Profile_checkcast QQQ
456 + // Profile instanceof with null_seen and receiver. 465 + // Profile instanceof with null_seen and receiver.
457 + BI_PROFILE_UPDATE_INSTANCEOF(/*null_seen=*/true, NULL); 466 + BI_PROFILE_UPDATE_INSTANCEOF(/*null_seen=*/true, NULL);
458 } else { 467 } else {
459 VERIFY_OOP(STACK_OBJECT(-1)); 468 VERIFY_OOP(STACK_OBJECT(-1));
460 u2 index = Bytes::get_Java_u2(pc+1); 469 u2 index = Bytes::get_Java_u2(pc+1);
461 @@ -2252,16 +2345,20 @@ 470 @@ -2237,16 +2330,20 @@
462 CALL_VM(InterpreterRuntime::quicken_io_cc(THREAD), handle_exception); 471 CALL_VM(InterpreterRuntime::quicken_io_cc(THREAD), handle_exception);
463 } 472 }
464 Klass* klassOf = (Klass*) METHOD->constants()->slot_at(index).get_klass(); 473 Klass* klassOf = (Klass*) METHOD->constants()->slot_at(index).get_klass();
465 - Klass* objKlassOop = STACK_OBJECT(-1)->klass(); 474 - Klass* objKlassOop = STACK_OBJECT(-1)->klass();
466 + Klass* objKlass = STACK_OBJECT(-1)->klass(); 475 + Klass* objKlass = STACK_OBJECT(-1)->klass();
479 + // Profile instanceof with null_seen and receiver. 488 + // Profile instanceof with null_seen and receiver.
480 + BI_PROFILE_UPDATE_INSTANCEOF(/*null_seen=*/false, objKlass); 489 + BI_PROFILE_UPDATE_INSTANCEOF(/*null_seen=*/false, objKlass);
481 } 490 }
482 UPDATE_PC_AND_CONTINUE(3); 491 UPDATE_PC_AND_CONTINUE(3);
483 492
484 @@ -2404,6 +2501,9 @@ 493 @@ -2389,6 +2486,9 @@
485 istate->set_callee_entry_point(method->from_interpreted_entry()); 494 istate->set_callee_entry_point(method->from_interpreted_entry());
486 istate->set_bcp_advance(5); 495 istate->set_bcp_advance(5);
487 496
488 + // Invokedynamic has got a call counter, just like an invokestatic -> increment! 497 + // Invokedynamic has got a call counter, just like an invokestatic -> increment!
489 + BI_PROFILE_UPDATE_CALL(); 498 + BI_PROFILE_UPDATE_CALL();
490 + 499 +
491 UPDATE_PC_AND_RETURN(0); // I'll be back... 500 UPDATE_PC_AND_RETURN(0); // I'll be back...
492 } 501 }
493 502
494 @@ -2437,6 +2537,9 @@ 503 @@ -2421,6 +2521,9 @@
495 istate->set_callee_entry_point(method->from_interpreted_entry()); 504 istate->set_callee_entry_point(method->from_interpreted_entry());
496 istate->set_bcp_advance(3); 505 istate->set_bcp_advance(3);
497 506
498 + // Invokehandle has got a call counter, just like a final call -> increment! 507 + // Invokehandle has got a call counter, just like a final call -> increment!
499 + BI_PROFILE_UPDATE_FINALCALL(); 508 + BI_PROFILE_UPDATE_FINALCALL();
500 + 509 +
501 UPDATE_PC_AND_RETURN(0); // I'll be back... 510 UPDATE_PC_AND_RETURN(0); // I'll be back...
502 } 511 }
503 512
504 @@ -2464,14 +2567,18 @@ 513 @@ -2448,14 +2551,18 @@
505 CHECK_NULL(STACK_OBJECT(-(cache->parameter_size()))); 514 CHECK_NULL(STACK_OBJECT(-(cache->parameter_size())));
506 if (cache->is_vfinal()) { 515 if (cache->is_vfinal()) {
507 callee = cache->f2_as_vfinal_method(); 516 callee = cache->f2_as_vfinal_method();
508 + // Profile 'special case of invokeinterface' final call. 517 + // Profile 'special case of invokeinterface' final call.
509 + BI_PROFILE_UPDATE_FINALCALL(); 518 + BI_PROFILE_UPDATE_FINALCALL();
521 + // Profile 'special case of invokeinterface' virtual call. 530 + // Profile 'special case of invokeinterface' virtual call.
522 + BI_PROFILE_UPDATE_VIRTUALCALL(rcvr->klass()); 531 + BI_PROFILE_UPDATE_VIRTUALCALL(rcvr->klass());
523 } 532 }
524 istate->set_callee(callee); 533 istate->set_callee(callee);
525 istate->set_callee_entry_point(callee->from_interpreted_entry()); 534 istate->set_callee_entry_point(callee->from_interpreted_entry());
526 @@ -2502,15 +2609,18 @@ 535 @@ -2486,15 +2593,18 @@
527 // interface. The link resolver checks this but only for the first 536 // interface. The link resolver checks this but only for the first
528 // time this interface is called. 537 // time this interface is called.
529 if (i == int2->itable_length()) { 538 if (i == int2->itable_length()) {
530 - VM_JAVA_ERROR(vmSymbols::java_lang_IncompatibleClassChangeError(), ""); 539 - VM_JAVA_ERROR(vmSymbols::java_lang_IncompatibleClassChangeError(), "");
531 + VM_JAVA_ERROR(vmSymbols::java_lang_IncompatibleClassChangeError(), "", note_no_trap); 540 + VM_JAVA_ERROR(vmSymbols::java_lang_IncompatibleClassChangeError(), "", note_no_trap);
542 + BI_PROFILE_UPDATE_VIRTUALCALL(rcvr->klass()); 551 + BI_PROFILE_UPDATE_VIRTUALCALL(rcvr->klass());
543 + 552 +
544 istate->set_callee(callee); 553 istate->set_callee(callee);
545 istate->set_callee_entry_point(callee->from_interpreted_entry()); 554 istate->set_callee_entry_point(callee->from_interpreted_entry());
546 #ifdef VM_JVMTI 555 #ifdef VM_JVMTI
547 @@ -2542,8 +2652,11 @@ 556 @@ -2526,8 +2636,11 @@
548 Method* callee; 557 Method* callee;
549 if ((Bytecodes::Code)opcode == Bytecodes::_invokevirtual) { 558 if ((Bytecodes::Code)opcode == Bytecodes::_invokevirtual) {
550 CHECK_NULL(STACK_OBJECT(-(cache->parameter_size()))); 559 CHECK_NULL(STACK_OBJECT(-(cache->parameter_size())));
551 - if (cache->is_vfinal()) callee = cache->f2_as_vfinal_method(); 560 - if (cache->is_vfinal()) callee = cache->f2_as_vfinal_method();
552 - else { 561 - else {
556 + BI_PROFILE_UPDATE_FINALCALL(); 565 + BI_PROFILE_UPDATE_FINALCALL();
557 + } else { 566 + } else {
558 // get receiver 567 // get receiver
559 int parms = cache->parameter_size(); 568 int parms = cache->parameter_size();
560 // this works but needs a resourcemark and seems to create a vtable on every call: 569 // this works but needs a resourcemark and seems to create a vtable on every call:
561 @@ -2552,8 +2665,9 @@ 570 @@ -2536,8 +2649,9 @@
562 // this fails with an assert 571 // this fails with an assert
563 // InstanceKlass* rcvrKlass = InstanceKlass::cast(STACK_OBJECT(-parms)->klass()); 572 // InstanceKlass* rcvrKlass = InstanceKlass::cast(STACK_OBJECT(-parms)->klass());
564 // but this works 573 // but this works
565 - VERIFY_OOP(STACK_OBJECT(-parms)); 574 - VERIFY_OOP(STACK_OBJECT(-parms));
566 - InstanceKlass* rcvrKlass = (InstanceKlass*) STACK_OBJECT(-parms)->klass(); 575 - InstanceKlass* rcvrKlass = (InstanceKlass*) STACK_OBJECT(-parms)->klass();
568 + VERIFY_OOP(rcvr); 577 + VERIFY_OOP(rcvr);
569 + InstanceKlass* rcvrKlass = (InstanceKlass*)rcvr->klass(); 578 + InstanceKlass* rcvrKlass = (InstanceKlass*)rcvr->klass();
570 /* 579 /*
571 Executing this code in java.lang.String: 580 Executing this code in java.lang.String:
572 public String(char value[]) { 581 public String(char value[]) {
573 @@ -2571,12 +2685,17 @@ 582 @@ -2555,12 +2669,17 @@
574 583
575 */ 584 */
576 callee = (Method*) rcvrKlass->start_of_vtable()[ cache->f2_as_index()]; 585 callee = (Method*) rcvrKlass->start_of_vtable()[ cache->f2_as_index()];
577 + // Profile virtual call. 586 + // Profile virtual call.
578 + BI_PROFILE_UPDATE_VIRTUALCALL(rcvr->klass()); 587 + BI_PROFILE_UPDATE_VIRTUALCALL(rcvr->klass());
586 + // Profile call. 595 + // Profile call.
587 + BI_PROFILE_UPDATE_CALL(); 596 + BI_PROFILE_UPDATE_CALL();
588 } 597 }
589 598
590 istate->set_callee(callee); 599 istate->set_callee(callee);
591 @@ -2628,6 +2747,8 @@ 600 @@ -2612,6 +2731,8 @@
592 CASE(_goto): 601 CASE(_goto):
593 { 602 {
594 int16_t offset = (int16_t)Bytes::get_Java_u2(pc + 1); 603 int16_t offset = (int16_t)Bytes::get_Java_u2(pc + 1);
595 + // Profile jump. 604 + // Profile jump.
596 + BI_PROFILE_UPDATE_JUMP(); 605 + BI_PROFILE_UPDATE_JUMP();
597 address branch_pc = pc; 606 address branch_pc = pc;
598 UPDATE_PC(offset); 607 UPDATE_PC(offset);
599 DO_BACKEDGE_CHECKS(offset, branch_pc); 608 DO_BACKEDGE_CHECKS(offset, branch_pc);
600 @@ -2644,6 +2765,8 @@ 609 @@ -2628,6 +2749,8 @@
601 CASE(_goto_w): 610 CASE(_goto_w):
602 { 611 {
603 int32_t offset = Bytes::get_Java_u4(pc + 1); 612 int32_t offset = Bytes::get_Java_u4(pc + 1);
604 + // Profile jump. 613 + // Profile jump.
605 + BI_PROFILE_UPDATE_JUMP(); 614 + BI_PROFILE_UPDATE_JUMP();
606 address branch_pc = pc; 615 address branch_pc = pc;
607 UPDATE_PC(offset); 616 UPDATE_PC(offset);
608 DO_BACKEDGE_CHECKS(offset, branch_pc); 617 DO_BACKEDGE_CHECKS(offset, branch_pc);
609 @@ -2653,6 +2776,9 @@ 618 @@ -2637,6 +2760,9 @@
610 /* return from a jsr or jsr_w */ 619 /* return from a jsr or jsr_w */
611 620
612 CASE(_ret): { 621 CASE(_ret): {
613 + // Profile ret. 622 + // Profile ret.
614 + BI_PROFILE_UPDATE_RET(/*bci=*/((int)(intptr_t)(LOCALS_ADDR(pc[1])))); 623 + BI_PROFILE_UPDATE_RET(/*bci=*/((int)(intptr_t)(LOCALS_ADDR(pc[1]))));
615 + // now, update the pc 624 + // now, update the pc
616 pc = istate->method()->code_base() + (intptr_t)(LOCALS_ADDR(pc[1])); 625 pc = istate->method()->code_base() + (intptr_t)(LOCALS_ADDR(pc[1]));
617 UPDATE_PC_AND_CONTINUE(0); 626 UPDATE_PC_AND_CONTINUE(0);
618 } 627 }
619 @@ -2734,6 +2860,9 @@ 628 @@ -2718,6 +2844,9 @@
620 } 629 }
621 // for AbortVMOnException flag 630 // for AbortVMOnException flag
622 NOT_PRODUCT(Exceptions::debug_check_abort(except_oop)); 631 NOT_PRODUCT(Exceptions::debug_check_abort(except_oop));
623 + 632 +
624 + // Update profiling data. 633 + // Update profiling data.
625 + BI_PROFILE_ALIGN_TO_CURRENT_BCI(); 634 + BI_PROFILE_ALIGN_TO_CURRENT_BCI();
626 goto run; 635 goto run;
627 } 636 }
628 if (TraceExceptions) { 637 if (TraceExceptions) {
629 @@ -2936,7 +3065,7 @@ 638 @@ -2920,7 +3049,7 @@
630 oop rcvr = base->obj(); 639 oop rcvr = base->obj();
631 if (rcvr == NULL) { 640 if (rcvr == NULL) {
632 if (!suppress_error) { 641 if (!suppress_error) {
633 - VM_JAVA_ERROR_NO_JUMP(vmSymbols::java_lang_NullPointerException(), ""); 642 - VM_JAVA_ERROR_NO_JUMP(vmSymbols::java_lang_NullPointerException(), "");
634 + VM_JAVA_ERROR_NO_JUMP(vmSymbols::java_lang_NullPointerException(), "", note_nullCheck_trap); 643 + VM_JAVA_ERROR_NO_JUMP(vmSymbols::java_lang_NullPointerException(), "", note_nullCheck_trap);
635 illegal_state_oop = THREAD->pending_exception(); 644 illegal_state_oop = THREAD->pending_exception();
636 THREAD->clear_pending_exception(); 645 THREAD->clear_pending_exception();
637 } 646 }
638 @@ -3014,7 +3143,7 @@ 647 @@ -3008,7 +3137,7 @@
639 // A pending exception that was pending prior to a possible popping frame 648 // A pending exception that was pending prior to a possible popping frame
640 // overrides the popping frame. 649 // overrides the popping frame.
641 // 650 //
642 - assert(!suppress_error || suppress_error && illegal_state_oop() == NULL, "Error was not suppressed"); 651 - assert(!suppress_error || suppress_error && illegal_state_oop() == NULL, "Error was not suppressed");
643 + assert(!suppress_error || (suppress_error && illegal_state_oop() == NULL), "Error was not suppressed"); 652 + assert(!suppress_error || (suppress_error && illegal_state_oop() == NULL), "Error was not suppressed");
644 if (illegal_state_oop() != NULL || original_exception() != NULL) { 653 if (illegal_state_oop() != NULL || original_exception() != NULL) {
645 // inform the frame manager we have no result 654 // inform the frame manager we have no result
646 istate->set_msg(throwing_exception); 655 istate->set_msg(throwing_exception);
647 diff -r 84fd980e69ee src/share/vm/interpreter/bytecodeInterpreterProfiling.hpp 656 diff -r 738d32552a96 src/share/vm/interpreter/bytecodeInterpreterProfiling.hpp
648 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 657 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
649 +++ b/src/share/vm/interpreter/bytecodeInterpreterProfiling.hpp Fri Jun 07 12:51:22 2013 +0200 658 +++ b/src/share/vm/interpreter/bytecodeInterpreterProfiling.hpp Fri Jun 28 14:34:21 2013 +0200
650 @@ -0,0 +1,307 @@ 659 @@ -0,0 +1,308 @@
651 +/* 660 +/*
652 + * Copyright (c) 2002, 2011, Oracle and/or its affiliates. All rights reserved. 661 + * Copyright (c) 2002, 2011, Oracle and/or its affiliates. All rights reserved.
653 + * Copyright 2012 SAP AG. All rights reserved. 662 + * Copyright 2012 SAP AG. All rights reserved.
654 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 663 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
655 + * 664 + *
783 + if (md == NULL) { \ 792 + if (md == NULL) { \
784 + MethodCounters* mcs; \ 793 + MethodCounters* mcs; \
785 + GET_METHOD_COUNTERS(mcs); \ 794 + GET_METHOD_COUNTERS(mcs); \
786 + /* The profiling method data doesn't exist for this method, */ \ 795 + /* The profiling method data doesn't exist for this method, */ \
787 + /* create it if the counters have overflowed. */ \ 796 + /* create it if the counters have overflowed. */ \
788 + if (INVOCATION_COUNT(mcs)->reached_ProfileLimit(BACKEDGE_COUNT(mcs))) { \ 797 + if (mcs->invocation_counter() \
798 + ->reached_ProfileLimit(mcs->backedge_counter())) { \
789 + /* Must use CALL_VM, because an async exception may be pending. */ \ 799 + /* Must use CALL_VM, because an async exception may be pending. */ \
790 + CALL_VM((InterpreterRuntime::profile_method(THREAD)), \ 800 + CALL_VM((InterpreterRuntime::profile_method(THREAD)), \
791 + exception_handler); \ 801 + exception_handler); \
792 + md = istate->method()->method_data(); \ 802 + md = istate->method()->method_data(); \
793 + if (md != NULL) { \ 803 + if (md != NULL) { \
953 +#endif // CC_INTERP_PROFILE 963 +#endif // CC_INTERP_PROFILE
954 + 964 +
955 +#endif // CC_INTERP 965 +#endif // CC_INTERP
956 + 966 +
957 +#endif // SHARE_VM_INTERPRETER_BYTECODECINTERPRETERPROFILING_HPP 967 +#endif // SHARE_VM_INTERPRETER_BYTECODECINTERPRETERPROFILING_HPP
958 diff -r 84fd980e69ee src/share/vm/interpreter/interpreterRuntime.cpp 968 diff -r 738d32552a96 src/share/vm/interpreter/interpreterRuntime.cpp
959 --- a/src/share/vm/interpreter/interpreterRuntime.cpp Fri Jun 07 12:50:21 2013 +0200 969 --- a/src/share/vm/interpreter/interpreterRuntime.cpp Fri Jun 28 14:17:32 2013 +0200
960 +++ b/src/share/vm/interpreter/interpreterRuntime.cpp Fri Jun 07 12:51:22 2013 +0200 970 +++ b/src/share/vm/interpreter/interpreterRuntime.cpp Fri Jun 28 14:34:21 2013 +0200
961 @@ -267,6 +267,49 @@ 971 @@ -267,6 +267,49 @@
962 } 972 }
963 } 973 }
964 974
965 +#ifdef CC_INTERP 975 +#ifdef CC_INTERP
1006 + 1016 +
1007 + 1017 +
1008 static Handle get_preinitialized_exception(Klass* k, TRAPS) { 1018 static Handle get_preinitialized_exception(Klass* k, TRAPS) {
1009 // get klass 1019 // get klass
1010 InstanceKlass* klass = InstanceKlass::cast(k); 1020 InstanceKlass* klass = InstanceKlass::cast(k);
1011 diff -r 84fd980e69ee src/share/vm/interpreter/interpreterRuntime.hpp 1021 diff -r 738d32552a96 src/share/vm/interpreter/interpreterRuntime.hpp
1012 --- a/src/share/vm/interpreter/interpreterRuntime.hpp Fri Jun 07 12:50:21 2013 +0200 1022 --- a/src/share/vm/interpreter/interpreterRuntime.hpp Fri Jun 28 14:17:32 2013 +0200
1013 +++ b/src/share/vm/interpreter/interpreterRuntime.hpp Fri Jun 07 12:51:22 2013 +0200 1023 +++ b/src/share/vm/interpreter/interpreterRuntime.hpp Fri Jun 28 14:34:21 2013 +0200
1014 @@ -67,6 +67,10 @@ 1024 @@ -67,6 +67,10 @@
1015 static ConstantPoolCacheEntry* cache_entry_at(JavaThread *thread, int i) { return method(thread)->constants()->cache()->entry_at(i); } 1025 static ConstantPoolCacheEntry* cache_entry_at(JavaThread *thread, int i) { return method(thread)->constants()->cache()->entry_at(i); }
1016 static ConstantPoolCacheEntry* cache_entry(JavaThread *thread) { return cache_entry_at(thread, Bytes::get_native_u2(bcp(thread) + 1)); } 1026 static ConstantPoolCacheEntry* cache_entry(JavaThread *thread) { return cache_entry_at(thread, Bytes::get_native_u2(bcp(thread) + 1)); }
1017 static void note_trap(JavaThread *thread, int reason, TRAPS); 1027 static void note_trap(JavaThread *thread, int reason, TRAPS);
1018 +#ifdef CC_INTERP 1028 +#ifdef CC_INTERP
1038 +#endif // CC_INTERP 1048 +#endif // CC_INTERP
1039 + 1049 +
1040 // Statics & fields 1050 // Statics & fields
1041 static void resolve_get_put(JavaThread* thread, Bytecodes::Code bytecode); 1051 static void resolve_get_put(JavaThread* thread, Bytecodes::Code bytecode);
1042 1052
1043 diff -r 84fd980e69ee src/share/vm/interpreter/invocationCounter.hpp 1053 diff -r 738d32552a96 src/share/vm/interpreter/invocationCounter.hpp
1044 --- a/src/share/vm/interpreter/invocationCounter.hpp Fri Jun 07 12:50:21 2013 +0200 1054 --- a/src/share/vm/interpreter/invocationCounter.hpp Fri Jun 28 14:17:32 2013 +0200
1045 +++ b/src/share/vm/interpreter/invocationCounter.hpp Fri Jun 07 12:51:22 2013 +0200 1055 +++ b/src/share/vm/interpreter/invocationCounter.hpp Fri Jun 28 14:34:21 2013 +0200
1046 @@ -101,13 +101,17 @@ 1056 @@ -101,13 +101,17 @@
1047 1057
1048 // Test counter using scaled limits like the asm interpreter would do rather than doing 1058 // Test counter using scaled limits like the asm interpreter would do rather than doing
1049 // the shifts to normalize the counter. 1059 // the shifts to normalize the counter.
1050 - 1060 -
1064 + bool reached_ProfileLimit(InvocationCounter *back_edge_count) const { 1074 + bool reached_ProfileLimit(InvocationCounter *back_edge_count) const {
1065 + return (_counter & count_mask) + (back_edge_count->_counter & count_mask) >= (unsigned int) InterpreterProfileLimit; 1075 + return (_counter & count_mask) + (back_edge_count->_counter & count_mask) >= (unsigned int) InterpreterProfileLimit;
1066 } 1076 }
1067 1077
1068 void increment() { _counter += count_increment; } 1078 void increment() { _counter += count_increment; }
1069 diff -r 84fd980e69ee src/share/vm/oops/methodData.cpp 1079 diff -r 738d32552a96 src/share/vm/oops/methodData.cpp
1070 --- a/src/share/vm/oops/methodData.cpp Fri Jun 07 12:50:21 2013 +0200 1080 --- a/src/share/vm/oops/methodData.cpp Fri Jun 28 14:17:32 2013 +0200
1071 +++ b/src/share/vm/oops/methodData.cpp Fri Jun 07 12:51:22 2013 +0200 1081 +++ b/src/share/vm/oops/methodData.cpp Fri Jun 28 14:34:21 2013 +0200
1072 @@ -244,6 +244,11 @@ 1082 @@ -244,6 +244,11 @@
1073 return mdp; 1083 return mdp;
1074 } 1084 }
1075 1085
1076 +#ifdef CC_INTERP 1086 +#ifdef CC_INTERP
1079 +} 1089 +}
1080 +#endif // CC_INTERP 1090 +#endif // CC_INTERP
1081 1091
1082 #ifndef PRODUCT 1092 #ifndef PRODUCT
1083 void RetData::print_data_on(outputStream* st) { 1093 void RetData::print_data_on(outputStream* st) {
1084 diff -r 84fd980e69ee src/share/vm/oops/methodData.hpp 1094 diff -r 738d32552a96 src/share/vm/oops/methodData.hpp
1085 --- a/src/share/vm/oops/methodData.hpp Fri Jun 07 12:50:21 2013 +0200 1095 --- a/src/share/vm/oops/methodData.hpp Fri Jun 28 14:17:32 2013 +0200
1086 +++ b/src/share/vm/oops/methodData.hpp Fri Jun 07 12:51:22 2013 +0200 1096 +++ b/src/share/vm/oops/methodData.hpp Fri Jun 28 14:34:21 2013 +0200
1087 @@ -225,6 +225,11 @@ 1097 @@ -225,6 +225,11 @@
1088 static ByteSize cell_offset(int index) { 1098 static ByteSize cell_offset(int index) {
1089 return byte_offset_of(DataLayout, _cells) + in_ByteSize(index * cell_size); 1099 return byte_offset_of(DataLayout, _cells) + in_ByteSize(index * cell_size);
1090 } 1100 }
1091 +#ifdef CC_INTERP 1101 +#ifdef CC_INTERP
1359 friend class VMStructs; 1369 friend class VMStructs;
1360 + CC_INTERP_ONLY(friend class BytecodeInterpreter;) 1370 + CC_INTERP_ONLY(friend class BytecodeInterpreter;)
1361 private: 1371 private:
1362 friend class ProfileData; 1372 friend class ProfileData;
1363 1373
1364 diff -r 84fd980e69ee src/share/vm/runtime/arguments.cpp 1374 diff -r 738d32552a96 src/share/vm/runtime/arguments.cpp
1365 --- a/src/share/vm/runtime/arguments.cpp Fri Jun 07 12:50:21 2013 +0200 1375 --- a/src/share/vm/runtime/arguments.cpp Fri Jun 28 14:17:32 2013 +0200
1366 +++ b/src/share/vm/runtime/arguments.cpp Fri Jun 07 12:51:22 2013 +0200 1376 +++ b/src/share/vm/runtime/arguments.cpp Fri Jun 28 14:34:21 2013 +0200
1367 @@ -3578,10 +3578,10 @@ 1377 @@ -3578,10 +3578,10 @@
1368 // Clear flags not supported by the C++ interpreter 1378 // Clear flags not supported by the C++ interpreter
1369 #if !defined(PPC64) 1379 #if !defined(PPC64)
1370 FLAG_SET_DEFAULT(UseBiasedLocking, false); 1380 FLAG_SET_DEFAULT(UseBiasedLocking, false);
1371 + FLAG_SET_DEFAULT(ProfileInterpreter, false); 1381 + FLAG_SET_DEFAULT(ProfileInterpreter, false);
1374 #endif // !PPC64 1384 #endif // !PPC64
1375 - FLAG_SET_DEFAULT(ProfileInterpreter, false); 1385 - FLAG_SET_DEFAULT(ProfileInterpreter, false);
1376 #endif // CC_INTERP 1386 #endif // CC_INTERP
1377 1387
1378 #ifdef COMPILER2 1388 #ifdef COMPILER2
1379 diff -r 84fd980e69ee src/share/vm/runtime/globals.hpp 1389 diff -r 738d32552a96 src/share/vm/runtime/globals.hpp
1380 --- a/src/share/vm/runtime/globals.hpp Fri Jun 07 12:50:21 2013 +0200 1390 --- a/src/share/vm/runtime/globals.hpp Fri Jun 28 14:17:32 2013 +0200
1381 +++ b/src/share/vm/runtime/globals.hpp Fri Jun 07 12:51:22 2013 +0200 1391 +++ b/src/share/vm/runtime/globals.hpp Fri Jun 28 14:34:21 2013 +0200
1382 @@ -2708,6 +2708,9 @@ 1392 @@ -2712,6 +2712,9 @@
1383 product_pd(bool, ProfileInterpreter, \ 1393 product_pd(bool, ProfileInterpreter, \
1384 "Profile at the bytecode level during interpretation") \ 1394 "Profile at the bytecode level during interpretation") \
1385 \ 1395 \
1386 + develop(bool, TraceProfileInterpreter, false, \ 1396 + develop(bool, TraceProfileInterpreter, false, \
1387 + "Trace profiling at the bytecode level during interpretation") \ 1397 + "Trace profiling at the bytecode level during interpretation") \