Mercurial > hg > truffle
annotate src/cpu/x86/vm/runtime_x86_32.cpp @ 18357:09550eb6ddfb
replace use of '==' with .equals()
author | Doug Simon <doug.simon@oracle.com> |
---|---|
date | Wed, 12 Nov 2014 15:33:20 +0100 |
parents | cd3d6a6b95d9 |
children |
rev | line source |
---|---|
0 | 1 /* |
3753
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
1972
diff
changeset
|
2 * Copyright (c) 1998, 2011, Oracle and/or its affiliates. All rights reserved. |
0 | 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 * | |
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 | |
7 * published by the Free Software Foundation. | |
8 * | |
9 * This code is distributed in the hope that it will be useful, but WITHOUT | |
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | |
12 * version 2 for more details (a copy is included in the LICENSE file that | |
13 * accompanied this code). | |
14 * | |
15 * You should have received a copy of the GNU General Public License version | |
16 * 2 along with this work; if not, write to the Free Software Foundation, | |
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. | |
18 * | |
1552
c18cbe5936b8
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
1368
diff
changeset
|
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
c18cbe5936b8
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
1368
diff
changeset
|
20 * or visit www.oracle.com if you need additional information or have any |
c18cbe5936b8
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
1368
diff
changeset
|
21 * questions. |
0 | 22 * |
23 */ | |
24 | |
1972 | 25 #include "precompiled.hpp" |
26 #ifdef COMPILER2 | |
7199
cd3d6a6b95d9
8003240: x86: move MacroAssembler into separate file
twisti
parents:
3753
diff
changeset
|
27 #include "asm/macroAssembler.hpp" |
cd3d6a6b95d9
8003240: x86: move MacroAssembler into separate file
twisti
parents:
3753
diff
changeset
|
28 #include "asm/macroAssembler.inline.hpp" |
1972 | 29 #include "classfile/systemDictionary.hpp" |
30 #include "code/vmreg.hpp" | |
31 #include "interpreter/interpreter.hpp" | |
32 #include "opto/runtime.hpp" | |
33 #include "runtime/interfaceSupport.hpp" | |
34 #include "runtime/sharedRuntime.hpp" | |
35 #include "runtime/stubRoutines.hpp" | |
36 #include "runtime/vframeArray.hpp" | |
37 #include "utilities/globalDefinitions.hpp" | |
38 #include "vmreg_x86.inline.hpp" | |
39 #endif | |
0 | 40 |
41 | |
42 #define __ masm-> | |
43 | |
44 //------------------------------generate_exception_blob--------------------------- | |
45 // creates exception blob at the end | |
46 // Using exception blob, this code is jumped from a compiled method. | |
47 // | |
48 // Given an exception pc at a call we call into the runtime for the | |
49 // handler in this method. This handler might merely restore state | |
50 // (i.e. callee save registers) unwind the frame and jump to the | |
51 // exception handler for the nmethod if there is no Java level handler | |
52 // for the nmethod. | |
53 // | |
54 // This code is entered with a jmp. | |
55 // | |
56 // Arguments: | |
1135
e66fd840cb6b
6893081: method handle & invokedynamic code needs additional cleanup (post 6815692, 6858164)
twisti
parents:
579
diff
changeset
|
57 // rax: exception oop |
0 | 58 // rdx: exception pc |
59 // | |
60 // Results: | |
1135
e66fd840cb6b
6893081: method handle & invokedynamic code needs additional cleanup (post 6815692, 6858164)
twisti
parents:
579
diff
changeset
|
61 // rax: exception oop |
0 | 62 // rdx: exception pc in caller or ??? |
63 // destination: exception handler of caller | |
64 // | |
65 // Note: the exception pc MUST be at a call (precise debug information) | |
66 // Only register rax, rdx, rcx are not callee saved. | |
67 // | |
68 | |
69 void OptoRuntime::generate_exception_blob() { | |
70 | |
71 // Capture info about frame layout | |
72 enum layout { | |
73 thread_off, // last_java_sp | |
74 // The frame sender code expects that rbp will be in the "natural" place and | |
75 // will override any oopMap setting for it. We must therefore force the layout | |
76 // so that it agrees with the frame sender code. | |
77 rbp_off, | |
78 return_off, // slot for return address | |
79 framesize | |
80 }; | |
81 | |
82 // allocate space for the code | |
83 ResourceMark rm; | |
84 // setup code generation tools | |
85 CodeBuffer buffer("exception_blob", 512, 512); | |
86 MacroAssembler* masm = new MacroAssembler(&buffer); | |
87 | |
88 OopMapSet *oop_maps = new OopMapSet(); | |
89 | |
90 address start = __ pc(); | |
91 | |
304 | 92 __ push(rdx); |
93 __ subptr(rsp, return_off * wordSize); // Prolog! | |
0 | 94 |
95 // rbp, location is implicitly known | |
304 | 96 __ movptr(Address(rsp,rbp_off *wordSize), rbp); |
0 | 97 |
98 // Store exception in Thread object. We cannot pass any arguments to the | |
99 // handle_exception call, since we do not want to make any assumption | |
100 // about the size of the frame where the exception happened in. | |
101 __ get_thread(rcx); | |
304 | 102 __ movptr(Address(rcx, JavaThread::exception_oop_offset()), rax); |
103 __ movptr(Address(rcx, JavaThread::exception_pc_offset()), rdx); | |
0 | 104 |
105 // This call does all the hard work. It checks if an exception handler | |
106 // exists in the method. | |
107 // If so, it returns the handler address. | |
108 // If not, it prepares for stack-unwinding, restoring the callee-save | |
109 // registers of the frame being removed. | |
110 // | |
304 | 111 __ movptr(Address(rsp, thread_off * wordSize), rcx); // Thread is first argument |
0 | 112 __ set_last_Java_frame(rcx, noreg, noreg, NULL); |
113 | |
114 __ call(RuntimeAddress(CAST_FROM_FN_PTR(address, OptoRuntime::handle_exception_C))); | |
115 | |
116 // No registers to map, rbp is known implicitly | |
117 oop_maps->add_gc_map( __ pc() - start, new OopMap( framesize, 0 )); | |
118 __ get_thread(rcx); | |
119 __ reset_last_Java_frame(rcx, false, false); | |
120 | |
121 // Restore callee-saved registers | |
304 | 122 __ movptr(rbp, Address(rsp, rbp_off * wordSize)); |
0 | 123 |
304 | 124 __ addptr(rsp, return_off * wordSize); // Epilog! |
125 __ pop(rdx); // Exception pc | |
0 | 126 |
1135
e66fd840cb6b
6893081: method handle & invokedynamic code needs additional cleanup (post 6815692, 6858164)
twisti
parents:
579
diff
changeset
|
127 // rax: exception handler for given <exception oop/exception pc> |
0 | 128 |
1368
93767e6a2dfd
6941529: SharedRuntime::raw_exception_handler_for_return_address must reset thread MethodHandle flag
twisti
parents:
1135
diff
changeset
|
129 // Restore SP from BP if the exception PC is a MethodHandle call site. |
93767e6a2dfd
6941529: SharedRuntime::raw_exception_handler_for_return_address must reset thread MethodHandle flag
twisti
parents:
1135
diff
changeset
|
130 __ cmpl(Address(rcx, JavaThread::is_method_handle_return_offset()), 0); |
1567 | 131 __ cmovptr(Assembler::notEqual, rsp, rbp_mh_SP_save); |
0 | 132 |
133 // We have a handler in rax, (could be deopt blob) | |
134 // rdx - throwing pc, deopt blob will need it. | |
135 | |
304 | 136 __ push(rax); |
0 | 137 |
138 // Get the exception | |
304 | 139 __ movptr(rax, Address(rcx, JavaThread::exception_oop_offset())); |
0 | 140 // Get the exception pc in case we are deoptimized |
304 | 141 __ movptr(rdx, Address(rcx, JavaThread::exception_pc_offset())); |
0 | 142 #ifdef ASSERT |
512
db4caa99ef11
6787106: Hotspot 32 bit build fails on platforms having different definitions for intptr_t & int32_t
xlu
parents:
337
diff
changeset
|
143 __ movptr(Address(rcx, JavaThread::exception_handler_pc_offset()), NULL_WORD); |
db4caa99ef11
6787106: Hotspot 32 bit build fails on platforms having different definitions for intptr_t & int32_t
xlu
parents:
337
diff
changeset
|
144 __ movptr(Address(rcx, JavaThread::exception_pc_offset()), NULL_WORD); |
0 | 145 #endif |
146 // Clear the exception oop so GC no longer processes it as a root. | |
512
db4caa99ef11
6787106: Hotspot 32 bit build fails on platforms having different definitions for intptr_t & int32_t
xlu
parents:
337
diff
changeset
|
147 __ movptr(Address(rcx, JavaThread::exception_oop_offset()), NULL_WORD); |
0 | 148 |
304 | 149 __ pop(rcx); |
0 | 150 |
1135
e66fd840cb6b
6893081: method handle & invokedynamic code needs additional cleanup (post 6815692, 6858164)
twisti
parents:
579
diff
changeset
|
151 // rax: exception oop |
0 | 152 // rcx: exception handler |
153 // rdx: exception pc | |
154 __ jmp (rcx); | |
155 | |
156 // ------------- | |
157 // make sure all code is generated | |
158 masm->flush(); | |
159 | |
160 _exception_blob = ExceptionBlob::create(&buffer, oop_maps, framesize); | |
161 } |