comparison src/cpu/x86/vm/sharedRuntime_x86_32.cpp @ 2245:638119ce7cfd

7009309: JSR 292: compiler/6991596/Test6991596.java crashes on fastdebug JDK7/b122 Reviewed-by: kvn, never
author twisti
date Tue, 01 Feb 2011 03:38:44 -0800
parents 3582bf76420e
children 3d58a4983660
comparison
equal deleted inserted replaced
2244:4f26f535a225 2245:638119ce7cfd
1 /* 1 /*
2 * Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved. 2 * Copyright (c) 2003, 2011, 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.
658 static void gen_i2c_adapter(MacroAssembler *masm, 658 static void gen_i2c_adapter(MacroAssembler *masm,
659 int total_args_passed, 659 int total_args_passed,
660 int comp_args_on_stack, 660 int comp_args_on_stack,
661 const BasicType *sig_bt, 661 const BasicType *sig_bt,
662 const VMRegPair *regs) { 662 const VMRegPair *regs) {
663 // we're being called from the interpreter but need to find the
664 // compiled return entry point. The return address on the stack
665 // should point at it and we just need to pull the old value out.
666 // load up the pointer to the compiled return entry point and
667 // rewrite our return pc. The code is arranged like so:
668 //
669 // .word Interpreter::return_sentinel
670 // .word address_of_compiled_return_point
671 // return_entry_point: blah_blah_blah
672 //
673 // So we can find the appropriate return point by loading up the word
674 // just prior to the current return address we have on the stack.
675 //
676 // We will only enter here from an interpreted frame and never from after
677 // passing thru a c2i. Azul allowed this but we do not. If we lose the
678 // race and use a c2i we will remain interpreted for the race loser(s).
679 // This removes all sorts of headaches on the x86 side and also eliminates
680 // the possibility of having c2i -> i2c -> c2i -> ... endless transitions.
681
682 663
683 // Note: rsi contains the senderSP on entry. We must preserve it since 664 // Note: rsi contains the senderSP on entry. We must preserve it since
684 // we may do a i2c -> c2i transition if we lose a race where compiled 665 // we may do a i2c -> c2i transition if we lose a race where compiled
685 // code goes non-entrant while we get args ready. 666 // code goes non-entrant while we get args ready.
686 667
687 // Pick up the return address 668 // Pick up the return address
688 __ movptr(rax, Address(rsp, 0)); 669 __ movptr(rax, Address(rsp, 0));
689
690 // If UseSSE >= 2 then no cleanup is needed on the return to the
691 // interpreter so skip fixing up the return entry point unless
692 // VerifyFPU is enabled.
693 if (UseSSE < 2 || VerifyFPU) {
694 Label skip, chk_int;
695 // If we were called from the call stub we need to do a little bit different
696 // cleanup than if the interpreter returned to the call stub.
697
698 ExternalAddress stub_return_address(StubRoutines::_call_stub_return_address);
699 __ cmpptr(rax, stub_return_address.addr());
700 __ jcc(Assembler::notEqual, chk_int);
701 assert(StubRoutines::x86::get_call_stub_compiled_return() != NULL, "must be set");
702 __ lea(rax, ExternalAddress(StubRoutines::x86::get_call_stub_compiled_return()));
703 __ jmp(skip);
704
705 // It must be the interpreter since we never get here via a c2i (unlike Azul)
706
707 __ bind(chk_int);
708 #ifdef ASSERT
709 {
710 Label ok;
711 __ cmpl(Address(rax, -2*wordSize), Interpreter::return_sentinel);
712 __ jcc(Assembler::equal, ok);
713 __ int3();
714 __ bind(ok);
715 }
716 #endif // ASSERT
717 __ movptr(rax, Address(rax, -wordSize));
718 __ bind(skip);
719 }
720
721 // rax, now contains the compiled return entry point which will do an
722 // cleanup needed for the return from compiled to interpreted.
723 670
724 // Must preserve original SP for loading incoming arguments because 671 // Must preserve original SP for loading incoming arguments because
725 // we need to align the outgoing SP for compiled code. 672 // we need to align the outgoing SP for compiled code.
726 __ movptr(rdi, rsp); 673 __ movptr(rdi, rsp);
727 674