1 /*
2 * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved.
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 *
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20 * or visit www.oracle.com if you need additional information or have any
21 * questions.
22 *
218 const char* detail_msg)
219 {
220 if (Debugging || error_is_suppressed(file, line)) return;
221 Thread* const thread = ThreadLocalStorage::get_thread_slow();
222 VMError err(thread, file, line, error_msg, detail_msg);
223 err.report_and_die();
224 }
225
226 void report_fatal(const char* file, int line, const char* message)
227 {
228 report_vm_error(file, line, "fatal error", message);
229 }
230
231 // Used by report_vm_out_of_memory to detect recursion.
232 static jint _exiting_out_of_mem = 0;
233
234 void report_vm_out_of_memory(const char* file, int line, size_t size,
235 const char* message) {
236 if (Debugging) return;
237
238 // We try to gather additional information for the first out of memory
239 // error only; gathering additional data might cause an allocation and a
240 // recursive out_of_memory condition.
241
242 const jint exiting = 1;
243 // If we succeed in changing the value, we're the first one in.
244 bool first_time_here = Atomic::xchg(exiting, &_exiting_out_of_mem) != exiting;
245
246 if (first_time_here) {
247 Thread* thread = ThreadLocalStorage::get_thread_slow();
248 VMError(thread, file, line, size, message).report_and_die();
249 }
250
251 // Dump core and abort
252 vm_abort(true);
253 }
254
255 void report_should_not_call(const char* file, int line) {
256 report_vm_error(file, line, "ShouldNotCall()");
257 }
258
259 void report_should_not_reach_here(const char* file, int line) {
260 report_vm_error(file, line, "ShouldNotReachHere()");
261 }
262
263 void report_should_not_reach_here2(const char* file, int line, const char* message) {
264 report_vm_error(file, line, "ShouldNotReachHere()", message);
265 }
266
267 void report_unimplemented(const char* file, int line) {
268 report_vm_error(file, line, "Unimplemented()");
269 }
270
271 void report_untested(const char* file, int line, const char* message) {
272 #ifndef PRODUCT
|
1 /*
2 * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
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 *
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20 * or visit www.oracle.com if you need additional information or have any
21 * questions.
22 *
218 const char* detail_msg)
219 {
220 if (Debugging || error_is_suppressed(file, line)) return;
221 Thread* const thread = ThreadLocalStorage::get_thread_slow();
222 VMError err(thread, file, line, error_msg, detail_msg);
223 err.report_and_die();
224 }
225
226 void report_fatal(const char* file, int line, const char* message)
227 {
228 report_vm_error(file, line, "fatal error", message);
229 }
230
231 // Used by report_vm_out_of_memory to detect recursion.
232 static jint _exiting_out_of_mem = 0;
233
234 void report_vm_out_of_memory(const char* file, int line, size_t size,
235 const char* message) {
236 if (Debugging) return;
237
238 Thread* thread = ThreadLocalStorage::get_thread_slow();
239 VMError(thread, file, line, size, message).report_and_die();
240
241 // The UseOSErrorReporting option in report_and_die() may allow a return to here.
242 // If so then we'll have to figure out how to handle it.
243 guarantee(false, "report_and_die() should not return here");
244 }
245
246 void report_should_not_call(const char* file, int line) {
247 report_vm_error(file, line, "ShouldNotCall()");
248 }
249
250 void report_should_not_reach_here(const char* file, int line) {
251 report_vm_error(file, line, "ShouldNotReachHere()");
252 }
253
254 void report_should_not_reach_here2(const char* file, int line, const char* message) {
255 report_vm_error(file, line, "ShouldNotReachHere()", message);
256 }
257
258 void report_unimplemented(const char* file, int line) {
259 report_vm_error(file, line, "Unimplemented()");
260 }
261
262 void report_untested(const char* file, int line, const char* message) {
263 #ifndef PRODUCT
|