Mercurial > hg > graal-compiler
annotate src/cpu/sparc/vm/runtime_sparc.cpp @ 6812:988bf00cc564
7200261: G1: Liveness counting inconsistencies during marking verification
Summary: The clipping code in the routine that sets the bits for a range of cards, in the liveness accounting verification code was incorrect. It set all the bits in the card bitmap from the given starting index which would lead to spurious marking verification failures.
Reviewed-by: brutisso, jwilhelm, jmasa
author | johnc |
---|---|
date | Thu, 27 Sep 2012 15:44:01 -0700 |
parents | cba7b5c2d53f |
children | f0c2369fda5a |
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:
727
diff
changeset
|
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
c18cbe5936b8
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
727
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:
727
diff
changeset
|
21 * questions. |
0 | 22 * |
23 */ | |
24 | |
1972 | 25 #include "precompiled.hpp" |
26 #ifdef COMPILER2 | |
27 #include "asm/assembler.hpp" | |
28 #include "assembler_sparc.inline.hpp" | |
29 #include "classfile/systemDictionary.hpp" | |
30 #include "code/vmreg.hpp" | |
31 #include "interpreter/interpreter.hpp" | |
32 #include "nativeInst_sparc.hpp" | |
33 #include "opto/runtime.hpp" | |
34 #include "runtime/interfaceSupport.hpp" | |
35 #include "runtime/sharedRuntime.hpp" | |
36 #include "runtime/stubRoutines.hpp" | |
37 #include "runtime/vframeArray.hpp" | |
38 #include "utilities/globalDefinitions.hpp" | |
39 #include "vmreg_sparc.inline.hpp" | |
40 #endif | |
0 | 41 |
42 | |
43 #define __ masm-> | |
44 | |
45 //------------------------------ generate_exception_blob --------------------------- | |
46 // creates exception blob at the end | |
47 // Using exception blob, this code is jumped from a compiled method. | |
48 // (see emit_exception_handler in sparc.ad file) | |
49 // | |
50 // Given an exception pc at a call we call into the runtime for the | |
51 // handler in this method. This handler might merely restore state | |
52 // (i.e. callee save registers) unwind the frame and jump to the | |
53 // exception handler for the nmethod if there is no Java level handler | |
54 // for the nmethod. | |
55 // | |
56 // This code is entered with a jmp. | |
57 // | |
58 // Arguments: | |
59 // O0: exception oop | |
60 // O1: exception pc | |
61 // | |
62 // Results: | |
63 // O0: exception oop | |
64 // O1: exception pc in caller or ??? | |
65 // destination: exception handler of caller | |
66 // | |
67 // Note: the exception pc MUST be at a call (precise debug information) | |
68 // | |
69 void OptoRuntime::generate_exception_blob() { | |
70 // allocate space for code | |
71 ResourceMark rm; | |
72 int pad = VerifyThread ? 256 : 0;// Extra slop space for more verify code | |
73 | |
74 // setup code generation tools | |
75 // Measured 8/7/03 at 256 in 32bit debug build (no VerifyThread) | |
76 // Measured 8/7/03 at 528 in 32bit debug build (VerifyThread) | |
77 CodeBuffer buffer("exception_blob", 600+pad, 512); | |
78 MacroAssembler* masm = new MacroAssembler(&buffer); | |
79 | |
80 int framesize_in_bytes = __ total_frame_size_in_bytes(0); | |
81 int framesize_in_words = framesize_in_bytes / wordSize; | |
82 int framesize_in_slots = framesize_in_bytes / sizeof(jint); | |
83 | |
84 Label L; | |
85 | |
86 int start = __ offset(); | |
87 | |
88 __ verify_thread(); | |
727 | 89 __ st_ptr(Oexception, G2_thread, JavaThread::exception_oop_offset()); |
90 __ st_ptr(Oissuing_pc, G2_thread, JavaThread::exception_pc_offset()); | |
0 | 91 |
92 // This call does all the hard work. It checks if an exception catch | |
93 // exists in the method. | |
94 // If so, it returns the handler address. | |
95 // If the nmethod has been deoptimized and it had a handler the handler | |
96 // address is the deopt blob unpack_with_exception entry. | |
97 // | |
98 // If no handler exists it prepares for stack-unwinding, restoring the callee-save | |
99 // registers of the frame being removed. | |
100 // | |
101 __ save_frame(0); | |
102 | |
103 __ mov(G2_thread, O0); | |
104 __ set_last_Java_frame(SP, noreg); | |
105 __ save_thread(L7_thread_cache); | |
106 | |
107 // This call can block at exit and nmethod can be deoptimized at that | |
108 // point. If the nmethod had a catch point we would jump to the | |
109 // now deoptimized catch point and fall thru the vanilla deopt | |
110 // path and lose the exception | |
111 // Sure would be simpler if this call didn't block! | |
112 __ call(CAST_FROM_FN_PTR(address, OptoRuntime::handle_exception_C), relocInfo::runtime_call_type); | |
113 __ delayed()->mov(L7_thread_cache, O0); | |
114 | |
115 // Set an oopmap for the call site. This oopmap will only be used if we | |
116 // are unwinding the stack. Hence, all locations will be dead. | |
117 // Callee-saved registers will be the same as the frame above (i.e., | |
118 // handle_exception_stub), since they were restored when we got the | |
119 // exception. | |
120 | |
121 OopMapSet *oop_maps = new OopMapSet(); | |
122 oop_maps->add_gc_map( __ offset()-start, new OopMap(framesize_in_slots, 0)); | |
123 | |
124 __ bind(L); | |
125 __ restore_thread(L7_thread_cache); | |
126 __ reset_last_Java_frame(); | |
127 | |
128 __ mov(O0, G3_scratch); // Move handler address to temp | |
129 __ restore(); | |
130 | |
1567 | 131 // Restore SP from L7 if the exception PC is a MethodHandle call site. |
132 __ lduw(Address(G2_thread, JavaThread::is_method_handle_return_offset()), O7); | |
133 __ tst(O7); | |
134 __ movcc(Assembler::notZero, false, Assembler::icc, L7_mh_SP_save, SP); | |
135 | |
0 | 136 // G3_scratch contains handler address |
137 // Since this may be the deopt blob we must set O7 to look like we returned | |
138 // from the original pc that threw the exception | |
139 | |
727 | 140 __ ld_ptr(G2_thread, JavaThread::exception_pc_offset(), O7); |
0 | 141 __ sub(O7, frame::pc_return_offset, O7); |
142 | |
143 | |
144 assert(Assembler::is_simm13(in_bytes(JavaThread::exception_oop_offset())), "exception offset overflows simm13, following ld instruction cannot be in delay slot"); | |
727 | 145 __ ld_ptr(G2_thread, JavaThread::exception_oop_offset(), Oexception); // O0 |
0 | 146 #ifdef ASSERT |
727 | 147 __ st_ptr(G0, G2_thread, JavaThread::exception_handler_pc_offset()); |
148 __ st_ptr(G0, G2_thread, JavaThread::exception_pc_offset()); | |
0 | 149 #endif |
150 __ JMP(G3_scratch, 0); | |
151 // Clear the exception oop so GC no longer processes it as a root. | |
727 | 152 __ delayed()->st_ptr(G0, G2_thread, JavaThread::exception_oop_offset()); |
0 | 153 |
154 // ------------- | |
155 // make sure all code is generated | |
156 masm->flush(); | |
157 | |
158 _exception_blob = ExceptionBlob::create(&buffer, oop_maps, framesize_in_words); | |
159 } |