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 *
205 } while (0);
206
207
208 // types of VM error - originally in vmError.hpp
209 enum VMErrorType {
210 INTERNAL_ERROR = 0xe0000000,
211 OOM_MALLOC_ERROR = 0xe0000001,
212 OOM_MMAP_ERROR = 0xe0000002
213 };
214
215 // error reporting helper functions
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 #ifdef ASSERT
229 // Compile-time asserts.
230 template <bool> struct StaticAssert;
231 template <> struct StaticAssert<true> {};
232
233 // Only StaticAssert<true> is defined, so if cond evaluates to false we get
234 // a compile time exception when trying to use StaticAssert<false>.
235 #define STATIC_ASSERT(cond) \
236 do { \
237 StaticAssert<(cond)> DUMMY_STATIC_ASSERT; \
238 (void)DUMMY_STATIC_ASSERT; /* ignore */ \
239 } while (false)
240 #else
241 #define STATIC_ASSERT(cond)
242 #endif
243
244 // out of shared space reporting
|
1 /*
2 * Copyright (c) 1997, 2017, 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 *
205 } while (0);
206
207
208 // types of VM error - originally in vmError.hpp
209 enum VMErrorType {
210 INTERNAL_ERROR = 0xe0000000,
211 OOM_MALLOC_ERROR = 0xe0000001,
212 OOM_MMAP_ERROR = 0xe0000002
213 };
214
215 // error reporting helper functions
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 void report_insufficient_metaspace(size_t required_size);
226
227 void warning(const char* format, ...) ATTRIBUTE_PRINTF(1, 2);
228
229 #ifdef ASSERT
230 // Compile-time asserts.
231 template <bool> struct StaticAssert;
232 template <> struct StaticAssert<true> {};
233
234 // Only StaticAssert<true> is defined, so if cond evaluates to false we get
235 // a compile time exception when trying to use StaticAssert<false>.
236 #define STATIC_ASSERT(cond) \
237 do { \
238 StaticAssert<(cond)> DUMMY_STATIC_ASSERT; \
239 (void)DUMMY_STATIC_ASSERT; /* ignore */ \
240 } while (false)
241 #else
242 #define STATIC_ASSERT(cond)
243 #endif
244
245 // out of shared space reporting
|