1 /*
2 * Copyright (c) 1997, 2014, 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 *
216 void report_vm_error(const char* file, int line, const char* error_msg,
217 const char* detail_msg = NULL);
218 void report_fatal(const char* file, int line, const char* message);
219 void report_vm_out_of_memory(const char* file, int line, size_t size,
220 VMErrorType vm_err_type, const char* message);
221 void report_should_not_call(const char* file, int line);
222 void report_should_not_reach_here(const char* file, int line);
223 void report_unimplemented(const char* file, int line);
224 void report_untested(const char* file, int line, const char* message);
225
226 void warning(const char* format, ...) ATTRIBUTE_PRINTF(1, 2);
227
228 // Compile-time asserts. Cond must be a compile-time constant expression that
229 // is convertible to bool. STATIC_ASSERT() can be used anywhere a declaration
230 // may appear.
231 //
232 // Implementation Note: STATIC_ASSERT_FAILURE<true> provides a value member
233 // rather than type member that could be used directly in the typedef, because
234 // a type member would require conditional use of "typename", depending on
235 // whether Cond is dependent or not. The use of a value member leads to the
236 // use of an array type. Terniary operator because, purportedly, some old
237 // compilers don't handle implict conversion properly in this context. it
238 // also deals with C++11 constexpr explict conversion to bool :)
239
240 template<bool x> struct STATIC_ASSERT_FAILURE;
241 template<> struct STATIC_ASSERT_FAILURE<true> { enum { value = 1 }; };
242
243 #define STATIC_ASSERT(Cond) \
244 typedef char STATIC_ASSERT_FAILURE_ ## __LINE__ [ \
245 STATIC_ASSERT_FAILURE< (Cond) ? true : false >::value ]
246
247 // out of shared space reporting
248 enum SharedSpaceType {
249 SharedReadOnly,
250 SharedReadWrite,
251 SharedMiscData,
252 SharedMiscCode
253 };
254
255 void report_out_of_shared_space(SharedSpaceType space_type);
256
257 // out of memory reporting
258 void report_java_out_of_memory(const char* message);
259
260 // Support for self-destruct
261 bool is_error_reported();
262 void set_error_reported();
263
264 /* Test assert(), fatal(), guarantee(), etc. */
265 NOT_PRODUCT(void test_error_handler();)
|
1 /*
2 * Copyright (c) 1997, 2015, 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 *
216 void report_vm_error(const char* file, int line, const char* error_msg,
217 const char* detail_msg = NULL);
218 void report_fatal(const char* file, int line, const char* message);
219 void report_vm_out_of_memory(const char* file, int line, size_t size,
220 VMErrorType vm_err_type, const char* message);
221 void report_should_not_call(const char* file, int line);
222 void report_should_not_reach_here(const char* file, int line);
223 void report_unimplemented(const char* file, int line);
224 void report_untested(const char* file, int line, const char* message);
225
226 void warning(const char* format, ...) ATTRIBUTE_PRINTF(1, 2);
227
228 // Compile-time asserts. Cond must be a compile-time constant expression that
229 // is convertible to bool. STATIC_ASSERT() can be used anywhere a declaration
230 // may appear.
231 //
232 // Implementation Note: STATIC_ASSERT_FAILURE<true> provides a value member
233 // rather than type member that could be used directly in the typedef, because
234 // a type member would require conditional use of "typename", depending on
235 // whether Cond is dependent or not. The use of a value member leads to the
236 // use of an array type.
237
238 template<bool x> struct STATIC_ASSERT_FAILURE;
239 template<> struct STATIC_ASSERT_FAILURE<true> { enum { value = 1 }; };
240
241 #define STATIC_ASSERT(Cond) \
242 typedef char STATIC_ASSERT_FAILURE_ ## __LINE__ [ \
243 STATIC_ASSERT_FAILURE< (Cond) >::value ]
244
245 // out of shared space reporting
246 enum SharedSpaceType {
247 SharedReadOnly,
248 SharedReadWrite,
249 SharedMiscData,
250 SharedMiscCode
251 };
252
253 void report_out_of_shared_space(SharedSpaceType space_type);
254
255 // out of memory reporting
256 void report_java_out_of_memory(const char* message);
257
258 // Support for self-destruct
259 bool is_error_reported();
260 void set_error_reported();
261
262 /* Test assert(), fatal(), guarantee(), etc. */
263 NOT_PRODUCT(void test_error_handler();)
|