Mercurial > hg > graal-compiler
comparison src/cpu/x86/vm/methodHandles_x86.cpp @ 3336:2e038ad0c1d0
7009361: JSR 292 Invalid value on stack on solaris-sparc with -Xcomp
Reviewed-by: kvn, twisti
author | never |
---|---|
date | Mon, 02 May 2011 18:53:37 -0700 |
parents | 8033953d67ff |
children | 167b70ff3abc |
comparison
equal
deleted
inserted
replaced
3335:49d67a090fe2 | 3336:2e038ad0c1d0 |
---|---|
313 } | 313 } |
314 | 314 |
315 #ifndef PRODUCT | 315 #ifndef PRODUCT |
316 extern "C" void print_method_handle(oop mh); | 316 extern "C" void print_method_handle(oop mh); |
317 void trace_method_handle_stub(const char* adaptername, | 317 void trace_method_handle_stub(const char* adaptername, |
318 intptr_t* saved_sp, | |
318 oop mh, | 319 oop mh, |
319 intptr_t* saved_regs, | 320 intptr_t* sp) { |
320 intptr_t* entry_sp, | |
321 intptr_t* saved_sp, | |
322 intptr_t* saved_bp) { | |
323 // called as a leaf from native code: do not block the JVM! | 321 // called as a leaf from native code: do not block the JVM! |
324 intptr_t* last_sp = (intptr_t*) saved_bp[frame::interpreter_frame_last_sp_offset]; | 322 intptr_t* entry_sp = sp + LP64_ONLY(16) NOT_LP64(8); |
325 intptr_t* base_sp = (intptr_t*) saved_bp[frame::interpreter_frame_monitor_block_top_offset]; | 323 tty->print_cr("MH %s mh="INTPTR_FORMAT" sp="INTPTR_FORMAT" saved_sp="INTPTR_FORMAT")", |
326 printf("MH %s mh="INTPTR_FORMAT" sp=("INTPTR_FORMAT"+"INTX_FORMAT") stack_size="INTX_FORMAT" bp="INTPTR_FORMAT"\n", | 324 adaptername, (intptr_t)mh, (intptr_t)entry_sp, saved_sp); |
327 adaptername, (intptr_t)mh, (intptr_t)entry_sp, (intptr_t)(saved_sp - entry_sp), (intptr_t)(base_sp - last_sp), (intptr_t)saved_bp); | |
328 if (last_sp != saved_sp && last_sp != NULL) | |
329 printf("*** last_sp="INTPTR_FORMAT"\n", (intptr_t)last_sp); | |
330 if (Verbose) { | 325 if (Verbose) { |
331 printf(" reg dump: "); | |
332 int saved_regs_count = (entry_sp-1) - saved_regs; | |
333 // 32 bit: rdi rsi rbp rsp; rbx rdx rcx (*) rax | |
334 int i; | |
335 for (i = 0; i <= saved_regs_count; i++) { | |
336 if (i > 0 && i % 4 == 0 && i != saved_regs_count) | |
337 printf("\n + dump: "); | |
338 printf(" %d: "INTPTR_FORMAT, i, saved_regs[i]); | |
339 } | |
340 printf("\n"); | |
341 int stack_dump_count = 16; | |
342 if (stack_dump_count < (int)(saved_bp + 2 - saved_sp)) | |
343 stack_dump_count = (int)(saved_bp + 2 - saved_sp); | |
344 if (stack_dump_count > 64) stack_dump_count = 48; | |
345 for (i = 0; i < stack_dump_count; i += 4) { | |
346 printf(" dump at SP[%d] "INTPTR_FORMAT": "INTPTR_FORMAT" "INTPTR_FORMAT" "INTPTR_FORMAT" "INTPTR_FORMAT"\n", | |
347 i, (intptr_t) &entry_sp[i+0], entry_sp[i+0], entry_sp[i+1], entry_sp[i+2], entry_sp[i+3]); | |
348 } | |
349 print_method_handle(mh); | 326 print_method_handle(mh); |
350 } | 327 } |
351 } | 328 } |
352 void MethodHandles::trace_method_handle(MacroAssembler* _masm, const char* adaptername) { | 329 void MethodHandles::trace_method_handle(MacroAssembler* _masm, const char* adaptername) { |
353 if (!TraceMethodHandles) return; | 330 if (!TraceMethodHandles) return; |
354 BLOCK_COMMENT("trace_method_handle {"); | 331 BLOCK_COMMENT("trace_method_handle {"); |
355 __ push(rax); | |
356 __ lea(rax, Address(rsp, wordSize*6)); // entry_sp | |
357 __ pusha(); | 332 __ pusha(); |
333 #ifdef _LP64 | |
334 // Pass arguments carefully since the registers overlap with the calling convention. | |
335 // rcx: method handle | |
336 // r13: saved sp | |
337 __ mov(c_rarg2, rcx); // mh | |
338 __ mov(c_rarg1, r13); // saved sp | |
339 __ mov(c_rarg3, rsp); // sp | |
340 __ movptr(c_rarg0, (intptr_t) adaptername); | |
341 __ super_call_VM_leaf(CAST_FROM_FN_PTR(address, trace_method_handle_stub), c_rarg0, c_rarg1, c_rarg2, c_rarg3); | |
342 #else | |
358 // arguments: | 343 // arguments: |
359 __ push(rbp); // interpreter frame pointer | 344 // rcx: method handle |
360 __ push(rsi); // saved_sp | 345 // rsi: saved sp |
361 __ push(rax); // entry_sp | 346 __ movptr(rbx, (intptr_t) adaptername); |
362 __ push(rcx); // mh | 347 __ super_call_VM_leaf(CAST_FROM_FN_PTR(address, trace_method_handle_stub), rbx, rsi, rcx, rsp); |
363 __ push(rcx); | 348 #endif |
364 __ movptr(Address(rsp, 0), (intptr_t) adaptername); | |
365 __ call_VM_leaf(CAST_FROM_FN_PTR(address, trace_method_handle_stub), 5); | |
366 __ popa(); | 349 __ popa(); |
367 __ pop(rax); | |
368 BLOCK_COMMENT("} trace_method_handle"); | 350 BLOCK_COMMENT("} trace_method_handle"); |
369 } | 351 } |
370 #endif //PRODUCT | 352 #endif //PRODUCT |
371 | 353 |
372 // which conversion op types are implemented here? | 354 // which conversion op types are implemented here? |