2007-12-01 00:00:00 +00:00
|
|
|
/*
|
2015-01-12 11:37:58 -08:00
|
|
|
* Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved.
|
2007-12-01 00:00:00 +00:00
|
|
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
|
|
|
*
|
|
|
|
* This code is free software; you can redistribute it and/or modify it
|
|
|
|
* under the terms of the GNU General Public License version 2 only, as
|
|
|
|
* published by the Free Software Foundation.
|
|
|
|
*
|
|
|
|
* This code is distributed in the hope that it will be useful, but WITHOUT
|
|
|
|
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
|
|
|
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
|
|
|
* version 2 for more details (a copy is included in the LICENSE file that
|
|
|
|
* accompanied this code).
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License version
|
|
|
|
* 2 along with this work; if not, write to the Free Software Foundation,
|
|
|
|
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
|
|
|
*
|
2010-05-27 19:08:38 -07:00
|
|
|
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
|
|
|
* or visit www.oracle.com if you need additional information or have any
|
|
|
|
* questions.
|
2007-12-01 00:00:00 +00:00
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
2010-11-23 13:22:55 -08:00
|
|
|
#include "precompiled.hpp"
|
|
|
|
#include "classfile/systemDictionary.hpp"
|
|
|
|
#include "code/codeCache.hpp"
|
|
|
|
#include "code/icBuffer.hpp"
|
|
|
|
#include "code/nmethod.hpp"
|
|
|
|
#include "code/vtableStubs.hpp"
|
|
|
|
#include "compiler/compileBroker.hpp"
|
|
|
|
#include "compiler/disassembler.hpp"
|
2015-05-13 15:16:06 +02:00
|
|
|
#include "gc/shared/collectedHeap.hpp"
|
2010-11-23 13:22:55 -08:00
|
|
|
#include "interpreter/bytecodeHistogram.hpp"
|
|
|
|
#include "interpreter/interpreter.hpp"
|
|
|
|
#include "memory/resourceArea.hpp"
|
|
|
|
#include "memory/universe.hpp"
|
|
|
|
#include "oops/oop.inline.hpp"
|
|
|
|
#include "prims/privilegedStack.hpp"
|
|
|
|
#include "runtime/arguments.hpp"
|
2014-06-04 11:56:44 +02:00
|
|
|
#include "runtime/atomic.inline.hpp"
|
2010-11-23 13:22:55 -08:00
|
|
|
#include "runtime/frame.hpp"
|
|
|
|
#include "runtime/java.hpp"
|
2014-06-26 16:05:15 +02:00
|
|
|
#include "runtime/os.hpp"
|
2010-11-23 13:22:55 -08:00
|
|
|
#include "runtime/sharedRuntime.hpp"
|
|
|
|
#include "runtime/stubCodeGenerator.hpp"
|
|
|
|
#include "runtime/stubRoutines.hpp"
|
2012-11-27 14:20:21 +01:00
|
|
|
#include "runtime/thread.inline.hpp"
|
2010-11-23 13:22:55 -08:00
|
|
|
#include "runtime/vframe.hpp"
|
2014-07-04 11:46:01 +02:00
|
|
|
#include "runtime/vm_version.hpp"
|
2010-11-23 13:22:55 -08:00
|
|
|
#include "services/heapDumper.hpp"
|
|
|
|
#include "utilities/defaultStream.hpp"
|
|
|
|
#include "utilities/events.hpp"
|
|
|
|
#include "utilities/top.hpp"
|
|
|
|
#include "utilities/vmError.hpp"
|
2007-12-01 00:00:00 +00:00
|
|
|
|
|
|
|
#ifndef ASSERT
|
|
|
|
# ifdef _DEBUG
|
|
|
|
// NOTE: don't turn the lines below into a comment -- if you're getting
|
|
|
|
// a compile error here, change the settings to define ASSERT
|
|
|
|
ASSERT should be defined when _DEBUG is defined. It is not intended to be used for debugging
|
|
|
|
functions that do not slow down the system too much and thus can be left in optimized code.
|
|
|
|
On the other hand, the code should not be included in a production version.
|
|
|
|
# endif // _DEBUG
|
|
|
|
#endif // ASSERT
|
|
|
|
|
|
|
|
|
|
|
|
#ifdef _DEBUG
|
|
|
|
# ifndef ASSERT
|
|
|
|
configuration error: ASSERT must be defined in debug version
|
|
|
|
# endif // ASSERT
|
|
|
|
#endif // _DEBUG
|
|
|
|
|
|
|
|
|
|
|
|
#ifdef PRODUCT
|
|
|
|
# if -defined _DEBUG || -defined ASSERT
|
|
|
|
configuration error: ASSERT et al. must not be defined in PRODUCT version
|
|
|
|
# endif
|
|
|
|
#endif // PRODUCT
|
|
|
|
|
2014-05-09 16:50:54 -04:00
|
|
|
PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC
|
|
|
|
|
2012-07-30 09:49:25 -07:00
|
|
|
FormatBufferResource::FormatBufferResource(const char * format, ...)
|
2015-09-29 11:02:08 +02:00
|
|
|
: FormatBufferBase((char*)resource_allocate_bytes(FormatBufferBase::BufferSize)) {
|
2012-07-30 09:49:25 -07:00
|
|
|
va_list argp;
|
|
|
|
va_start(argp, format);
|
2015-09-29 11:02:08 +02:00
|
|
|
jio_vsnprintf(_buf, FormatBufferBase::BufferSize, format, argp);
|
2012-07-30 09:49:25 -07:00
|
|
|
va_end(argp);
|
|
|
|
}
|
2007-12-01 00:00:00 +00:00
|
|
|
|
2014-05-09 16:50:54 -04:00
|
|
|
ATTRIBUTE_PRINTF(1, 2)
|
2007-12-01 00:00:00 +00:00
|
|
|
void warning(const char* format, ...) {
|
2010-10-12 10:57:33 -04:00
|
|
|
if (PrintWarnings) {
|
2012-09-20 16:27:51 -07:00
|
|
|
FILE* const err = defaultStream::error_stream();
|
|
|
|
jio_fprintf(err, "%s warning: ", VM_Version::vm_name());
|
2010-10-12 10:57:33 -04:00
|
|
|
va_list ap;
|
|
|
|
va_start(ap, format);
|
2012-09-20 16:27:51 -07:00
|
|
|
vfprintf(err, format, ap);
|
2010-10-12 10:57:33 -04:00
|
|
|
va_end(ap);
|
2012-09-20 16:27:51 -07:00
|
|
|
fputc('\n', err);
|
2010-10-12 10:57:33 -04:00
|
|
|
}
|
2007-12-01 00:00:00 +00:00
|
|
|
if (BreakAtWarning) BREAKPOINT;
|
|
|
|
}
|
|
|
|
|
|
|
|
#ifndef PRODUCT
|
|
|
|
|
|
|
|
#define is_token_break(ch) (isspace(ch) || (ch) == ',')
|
|
|
|
|
|
|
|
static const char* last_file_name = NULL;
|
|
|
|
static int last_line_no = -1;
|
|
|
|
|
|
|
|
// assert/guarantee/... may happen very early during VM initialization.
|
|
|
|
// Don't rely on anything that is initialized by Threads::create_vm(). For
|
|
|
|
// example, don't use tty.
|
2010-04-22 13:23:15 -07:00
|
|
|
bool error_is_suppressed(const char* file_name, int line_no) {
|
2007-12-01 00:00:00 +00:00
|
|
|
// The following 1-element cache requires that passed-in
|
|
|
|
// file names are always only constant literals.
|
|
|
|
if (file_name == last_file_name && line_no == last_line_no) return true;
|
|
|
|
|
|
|
|
int file_name_len = (int)strlen(file_name);
|
|
|
|
char separator = os::file_separator()[0];
|
|
|
|
const char* base_name = strrchr(file_name, separator);
|
|
|
|
if (base_name == NULL)
|
|
|
|
base_name = file_name;
|
|
|
|
|
|
|
|
// scan the SuppressErrorAt option
|
|
|
|
const char* cp = SuppressErrorAt;
|
|
|
|
for (;;) {
|
|
|
|
const char* sfile;
|
|
|
|
int sfile_len;
|
|
|
|
int sline;
|
|
|
|
bool noisy;
|
|
|
|
while ((*cp) != '\0' && is_token_break(*cp)) cp++;
|
|
|
|
if ((*cp) == '\0') break;
|
|
|
|
sfile = cp;
|
|
|
|
while ((*cp) != '\0' && !is_token_break(*cp) && (*cp) != ':') cp++;
|
|
|
|
sfile_len = cp - sfile;
|
|
|
|
if ((*cp) == ':') cp++;
|
|
|
|
sline = 0;
|
|
|
|
while ((*cp) != '\0' && isdigit(*cp)) {
|
|
|
|
sline *= 10;
|
|
|
|
sline += (*cp) - '0';
|
|
|
|
cp++;
|
|
|
|
}
|
|
|
|
// "file:line!" means the assert suppression is not silent
|
|
|
|
noisy = ((*cp) == '!');
|
|
|
|
while ((*cp) != '\0' && !is_token_break(*cp)) cp++;
|
|
|
|
// match the line
|
|
|
|
if (sline != 0) {
|
|
|
|
if (sline != line_no) continue;
|
|
|
|
}
|
|
|
|
// match the file
|
|
|
|
if (sfile_len > 0) {
|
|
|
|
const char* look = file_name;
|
|
|
|
const char* look_max = file_name + file_name_len - sfile_len;
|
|
|
|
const char* foundp;
|
|
|
|
bool match = false;
|
|
|
|
while (!match
|
|
|
|
&& (foundp = strchr(look, sfile[0])) != NULL
|
|
|
|
&& foundp <= look_max) {
|
|
|
|
match = true;
|
|
|
|
for (int i = 1; i < sfile_len; i++) {
|
|
|
|
if (sfile[i] != foundp[i]) {
|
|
|
|
match = false;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
look = foundp + 1;
|
|
|
|
}
|
|
|
|
if (!match) continue;
|
|
|
|
}
|
|
|
|
// got a match!
|
|
|
|
if (noisy) {
|
|
|
|
fdStream out(defaultStream::output_fd());
|
|
|
|
out.print_raw("[error suppressed at ");
|
|
|
|
out.print_raw(base_name);
|
|
|
|
char buf[16];
|
|
|
|
jio_snprintf(buf, sizeof(buf), ":%d]", line_no);
|
|
|
|
out.print_raw_cr(buf);
|
|
|
|
} else {
|
|
|
|
// update 1-element cache for fast silent matches
|
|
|
|
last_file_name = file_name;
|
|
|
|
last_line_no = line_no;
|
|
|
|
}
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!is_error_reported()) {
|
|
|
|
// print a friendly hint:
|
|
|
|
fdStream out(defaultStream::output_fd());
|
|
|
|
out.print_raw_cr("# To suppress the following error report, specify this argument");
|
|
|
|
out.print_raw ("# after -XX: or in .hotspotrc: SuppressErrorAt=");
|
|
|
|
out.print_raw (base_name);
|
|
|
|
char buf[16];
|
|
|
|
jio_snprintf(buf, sizeof(buf), ":%d", line_no);
|
|
|
|
out.print_raw_cr(buf);
|
|
|
|
}
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
#undef is_token_break
|
|
|
|
|
|
|
|
#else
|
|
|
|
|
|
|
|
// Place-holder for non-existent suppression check:
|
2010-04-22 13:23:15 -07:00
|
|
|
#define error_is_suppressed(file_name, line_no) (false)
|
2007-12-01 00:00:00 +00:00
|
|
|
|
2011-10-13 09:35:42 -07:00
|
|
|
#endif // !PRODUCT
|
2007-12-01 00:00:00 +00:00
|
|
|
|
2015-09-29 11:02:08 +02:00
|
|
|
void report_vm_error(const char* file, int line, const char* error_msg)
|
|
|
|
{
|
|
|
|
report_vm_error(file, line, error_msg, "%s", "");
|
|
|
|
}
|
|
|
|
|
|
|
|
void report_vm_error(const char* file, int line, const char* error_msg, const char* detail_fmt, ...)
|
2010-04-22 13:23:15 -07:00
|
|
|
{
|
|
|
|
if (Debugging || error_is_suppressed(file, line)) return;
|
2015-09-29 11:02:08 +02:00
|
|
|
va_list detail_args;
|
|
|
|
va_start(detail_args, detail_fmt);
|
|
|
|
VMError::report_and_die(ThreadLocalStorage::get_thread_slow(), file, line, error_msg, detail_fmt, detail_args);
|
|
|
|
va_end(detail_args);
|
2007-12-01 00:00:00 +00:00
|
|
|
}
|
|
|
|
|
2015-09-29 11:02:08 +02:00
|
|
|
void report_fatal(const char* file, int line, const char* detail_fmt, ...)
|
2010-04-22 13:23:15 -07:00
|
|
|
{
|
2015-09-29 11:02:08 +02:00
|
|
|
if (Debugging || error_is_suppressed(file, line)) return;
|
|
|
|
va_list detail_args;
|
|
|
|
va_start(detail_args, detail_fmt);
|
|
|
|
VMError::report_and_die(ThreadLocalStorage::get_thread_slow(), file, line, "fatal error", detail_fmt, detail_args);
|
|
|
|
va_end(detail_args);
|
2007-12-01 00:00:00 +00:00
|
|
|
}
|
|
|
|
|
2010-04-22 13:23:15 -07:00
|
|
|
void report_vm_out_of_memory(const char* file, int line, size_t size,
|
2015-09-29 11:02:08 +02:00
|
|
|
VMErrorType vm_err_type, const char* detail_fmt, ...) {
|
2011-01-03 14:09:11 -05:00
|
|
|
if (Debugging) return;
|
2015-09-29 11:02:08 +02:00
|
|
|
va_list detail_args;
|
|
|
|
va_start(detail_args, detail_fmt);
|
|
|
|
VMError::report_and_die(ThreadLocalStorage::get_thread_slow(), file, line, size, vm_err_type, detail_fmt, detail_args);
|
|
|
|
va_end(detail_args);
|
2008-06-22 20:07:58 -07:00
|
|
|
|
2013-02-20 19:36:25 -08:00
|
|
|
// The UseOSErrorReporting option in report_and_die() may allow a return
|
|
|
|
// to here. If so then we'll have to figure out how to handle it.
|
|
|
|
guarantee(false, "report_and_die() should not return here");
|
2007-12-01 00:00:00 +00:00
|
|
|
}
|
|
|
|
|
2010-04-22 13:23:15 -07:00
|
|
|
void report_should_not_call(const char* file, int line) {
|
|
|
|
report_vm_error(file, line, "ShouldNotCall()");
|
2007-12-01 00:00:00 +00:00
|
|
|
}
|
|
|
|
|
2010-04-22 13:23:15 -07:00
|
|
|
void report_should_not_reach_here(const char* file, int line) {
|
|
|
|
report_vm_error(file, line, "ShouldNotReachHere()");
|
2007-12-01 00:00:00 +00:00
|
|
|
}
|
|
|
|
|
2010-04-22 13:23:15 -07:00
|
|
|
void report_unimplemented(const char* file, int line) {
|
|
|
|
report_vm_error(file, line, "Unimplemented()");
|
2007-12-01 00:00:00 +00:00
|
|
|
}
|
|
|
|
|
2010-04-22 13:23:15 -07:00
|
|
|
void report_untested(const char* file, int line, const char* message) {
|
2007-12-01 00:00:00 +00:00
|
|
|
#ifndef PRODUCT
|
2010-04-22 13:23:15 -07:00
|
|
|
warning("Untested: %s in %s: %d\n", message, file, line);
|
2011-10-13 09:35:42 -07:00
|
|
|
#endif // !PRODUCT
|
2007-12-01 00:00:00 +00:00
|
|
|
}
|
|
|
|
|
2011-01-27 16:11:27 -08:00
|
|
|
void report_out_of_shared_space(SharedSpaceType shared_space) {
|
|
|
|
static const char* name[] = {
|
|
|
|
"shared read only space",
|
|
|
|
"shared read write space",
|
2014-10-23 10:08:02 -07:00
|
|
|
"shared miscellaneous data space",
|
|
|
|
"shared miscellaneous code space"
|
2011-01-27 16:11:27 -08:00
|
|
|
};
|
|
|
|
static const char* flag[] = {
|
|
|
|
"SharedReadOnlySize",
|
|
|
|
"SharedReadWriteSize",
|
2014-10-23 10:08:02 -07:00
|
|
|
"SharedMiscDataSize",
|
|
|
|
"SharedMiscCodeSize"
|
2011-01-27 16:11:27 -08:00
|
|
|
};
|
|
|
|
|
|
|
|
warning("\nThe %s is not large enough\n"
|
2014-10-23 10:08:02 -07:00
|
|
|
"to preload requested classes. Use -XX:%s=<size>\n"
|
2011-01-27 16:11:27 -08:00
|
|
|
"to increase the initial size of %s.\n",
|
|
|
|
name[shared_space], flag[shared_space], name[shared_space]);
|
|
|
|
exit(2);
|
|
|
|
}
|
|
|
|
|
2015-01-12 11:37:58 -08:00
|
|
|
void report_insufficient_metaspace(size_t required_size) {
|
2015-03-03 18:01:27 +01:00
|
|
|
warning("\nThe MaxMetaspaceSize of " SIZE_FORMAT " bytes is not large enough.\n"
|
2015-01-12 11:37:58 -08:00
|
|
|
"Either don't specify the -XX:MaxMetaspaceSize=<size>\n"
|
|
|
|
"or increase the size to at least " SIZE_FORMAT ".\n",
|
|
|
|
MaxMetaspaceSize, required_size);
|
|
|
|
exit(2);
|
|
|
|
}
|
|
|
|
|
2007-12-01 00:00:00 +00:00
|
|
|
void report_java_out_of_memory(const char* message) {
|
|
|
|
static jint out_of_memory_reported = 0;
|
|
|
|
|
|
|
|
// A number of threads may attempt to report OutOfMemoryError at around the
|
|
|
|
// same time. To avoid dumping the heap or executing the data collection
|
|
|
|
// commands multiple times we just do it once when the first threads reports
|
|
|
|
// the error.
|
|
|
|
if (Atomic::cmpxchg(1, &out_of_memory_reported, 0) == 0) {
|
|
|
|
// create heap dump before OnOutOfMemoryError commands are executed
|
|
|
|
if (HeapDumpOnOutOfMemoryError) {
|
|
|
|
tty->print_cr("java.lang.OutOfMemoryError: %s", message);
|
2010-09-11 08:18:31 +02:00
|
|
|
HeapDumper::dump_heap_from_oome();
|
2007-12-01 00:00:00 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if (OnOutOfMemoryError && OnOutOfMemoryError[0]) {
|
2015-09-29 11:02:08 +02:00
|
|
|
VMError::report_java_out_of_memory(message);
|
2007-12-01 00:00:00 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static bool error_reported = false;
|
|
|
|
|
|
|
|
// call this when the VM is dying--it might loosen some asserts
|
|
|
|
void set_error_reported() {
|
|
|
|
error_reported = true;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool is_error_reported() {
|
|
|
|
return error_reported;
|
|
|
|
}
|
|
|
|
|
2010-04-22 13:23:15 -07:00
|
|
|
#ifndef PRODUCT
|
|
|
|
#include <signal.h>
|
|
|
|
|
2015-02-04 18:47:42 -05:00
|
|
|
typedef void (*voidfun_t)();
|
|
|
|
// Crash with an authentic sigfpe
|
|
|
|
static void crash_with_sigfpe() {
|
|
|
|
// generate a native synchronous SIGFPE where possible;
|
|
|
|
// if that did not cause a signal (e.g. on ppc), just
|
|
|
|
// raise the signal.
|
|
|
|
volatile int x = 0;
|
|
|
|
volatile int y = 1/x;
|
|
|
|
#ifndef _WIN32
|
|
|
|
raise(SIGFPE);
|
|
|
|
#endif
|
|
|
|
} // end: crash_with_sigfpe
|
|
|
|
|
|
|
|
// crash with sigsegv at non-null address.
|
|
|
|
static void crash_with_segfault() {
|
|
|
|
|
|
|
|
char* const crash_addr = (char*) get_segfault_address();
|
|
|
|
*crash_addr = 'X';
|
|
|
|
|
|
|
|
} // end: crash_with_segfault
|
|
|
|
|
|
|
|
// returns an address which is guaranteed to generate a SIGSEGV on read,
|
|
|
|
// for test purposes, which is not NULL and contains bits in every word
|
|
|
|
void* get_segfault_address() {
|
|
|
|
return (void*)
|
|
|
|
#ifdef _LP64
|
|
|
|
0xABC0000000000ABCULL;
|
|
|
|
#else
|
|
|
|
0x00000ABC;
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
2013-07-04 21:10:17 -07:00
|
|
|
void test_error_handler() {
|
2015-02-04 18:47:42 -05:00
|
|
|
controlled_crash(ErrorHandlerTest);
|
|
|
|
}
|
|
|
|
|
|
|
|
void controlled_crash(int how) {
|
|
|
|
if (how == 0) return;
|
2010-04-22 13:23:15 -07:00
|
|
|
|
|
|
|
// If asserts are disabled, use the corresponding guarantee instead.
|
2015-02-04 18:47:42 -05:00
|
|
|
NOT_DEBUG(if (how <= 2) how += 2);
|
2010-04-22 13:23:15 -07:00
|
|
|
|
|
|
|
const char* const str = "hello";
|
|
|
|
const size_t num = (size_t)os::vm_page_size();
|
|
|
|
|
|
|
|
const char* const eol = os::line_separator();
|
|
|
|
const char* const msg = "this message should be truncated during formatting";
|
2013-07-04 21:10:17 -07:00
|
|
|
char * const dataPtr = NULL; // bad data pointer
|
|
|
|
const void (*funcPtr)(void) = (const void(*)()) 0xF; // bad function pointer
|
2010-04-22 13:23:15 -07:00
|
|
|
|
|
|
|
// Keep this in sync with test/runtime/6888954/vmerrors.sh.
|
2015-02-04 18:47:42 -05:00
|
|
|
switch (how) {
|
2015-01-13 14:30:53 -05:00
|
|
|
case 1: vmassert(str == NULL, "expected null");
|
|
|
|
case 2: vmassert(num == 1023 && *str == 'X',
|
2015-09-29 11:02:08 +02:00
|
|
|
"num=" SIZE_FORMAT " str=\"%s\"", num, str);
|
2010-04-22 13:23:15 -07:00
|
|
|
case 3: guarantee(str == NULL, "expected null");
|
|
|
|
case 4: guarantee(num == 1023 && *str == 'X',
|
2015-09-29 11:02:08 +02:00
|
|
|
"num=" SIZE_FORMAT " str=\"%s\"", num, str);
|
2010-04-22 13:23:15 -07:00
|
|
|
case 5: fatal("expected null");
|
2015-09-29 11:02:08 +02:00
|
|
|
case 6: fatal("num=" SIZE_FORMAT " str=\"%s\"", num, str);
|
|
|
|
case 7: fatal("%s%s# %s%s# %s%s# %s%s# %s%s# "
|
|
|
|
"%s%s# %s%s# %s%s# %s%s# %s%s# "
|
|
|
|
"%s%s# %s%s# %s%s# %s%s# %s",
|
|
|
|
msg, eol, msg, eol, msg, eol, msg, eol, msg, eol,
|
|
|
|
msg, eol, msg, eol, msg, eol, msg, eol, msg, eol,
|
|
|
|
msg, eol, msg, eol, msg, eol, msg, eol, msg);
|
2013-04-30 11:56:52 -07:00
|
|
|
case 8: vm_exit_out_of_memory(num, OOM_MALLOC_ERROR, "ChunkPool::allocate");
|
2010-04-22 13:23:15 -07:00
|
|
|
case 9: ShouldNotCallThis();
|
|
|
|
case 10: ShouldNotReachHere();
|
|
|
|
case 11: Unimplemented();
|
2013-07-04 21:10:17 -07:00
|
|
|
// There's no guarantee the bad data pointer will crash us
|
|
|
|
// so "break" out to the ShouldNotReachHere().
|
|
|
|
case 12: *dataPtr = '\0'; break;
|
|
|
|
// There's no guarantee the bad function pointer will crash us
|
|
|
|
// so "break" out to the ShouldNotReachHere().
|
|
|
|
case 13: (*funcPtr)(); break;
|
2015-02-04 18:47:42 -05:00
|
|
|
case 14: crash_with_segfault(); break;
|
|
|
|
case 15: crash_with_sigfpe(); break;
|
2013-07-04 21:10:17 -07:00
|
|
|
|
2015-02-04 18:47:42 -05:00
|
|
|
default: tty->print_cr("ERROR: %d: unexpected test_num value.", how);
|
2010-04-22 13:23:15 -07:00
|
|
|
}
|
2013-07-04 21:10:17 -07:00
|
|
|
ShouldNotReachHere();
|
2010-04-22 13:23:15 -07:00
|
|
|
}
|
2011-10-13 09:35:42 -07:00
|
|
|
#endif // !PRODUCT
|
2010-04-22 13:23:15 -07:00
|
|
|
|
2007-12-01 00:00:00 +00:00
|
|
|
// ------ helper functions for debugging go here ------------
|
|
|
|
|
|
|
|
// All debug entries should be wrapped with a stack allocated
|
|
|
|
// Command object. It makes sure a resource mark is set and
|
|
|
|
// flushes the logfile to prevent file sharing problems.
|
|
|
|
|
|
|
|
class Command : public StackObj {
|
|
|
|
private:
|
|
|
|
ResourceMark rm;
|
|
|
|
ResetNoHandleMark rnhm;
|
|
|
|
HandleMark hm;
|
|
|
|
bool debug_save;
|
|
|
|
public:
|
|
|
|
static int level;
|
|
|
|
Command(const char* str) {
|
|
|
|
debug_save = Debugging;
|
|
|
|
Debugging = true;
|
|
|
|
if (level++ > 0) return;
|
|
|
|
tty->cr();
|
|
|
|
tty->print_cr("\"Executing %s\"", str);
|
|
|
|
}
|
|
|
|
|
2011-10-13 09:35:42 -07:00
|
|
|
~Command() {
|
|
|
|
tty->flush();
|
|
|
|
Debugging = debug_save;
|
|
|
|
level--;
|
|
|
|
}
|
2007-12-01 00:00:00 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
int Command::level = 0;
|
|
|
|
|
2011-10-13 09:35:42 -07:00
|
|
|
#ifndef PRODUCT
|
|
|
|
|
2007-12-01 00:00:00 +00:00
|
|
|
extern "C" void blob(CodeBlob* cb) {
|
|
|
|
Command c("blob");
|
|
|
|
cb->print();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
extern "C" void dump_vtable(address p) {
|
|
|
|
Command c("dump_vtable");
|
6964458: Reimplement class meta-data storage to use native memory
Remove PermGen, allocate meta-data in metaspace linked to class loaders, rewrite GC walking, rewrite and rename metadata to be C++ classes
Co-authored-by: Stefan Karlsson <stefan.karlsson@oracle.com>
Co-authored-by: Mikael Gerdin <mikael.gerdin@oracle.com>
Co-authored-by: Tom Rodriguez <tom.rodriguez@oracle.com>
Reviewed-by: jmasa, stefank, never, coleenp, kvn, brutisso, mgerdin, dholmes, jrose, twisti, roland
2012-09-01 13:25:18 -04:00
|
|
|
Klass* k = (Klass*)p;
|
|
|
|
InstanceKlass::cast(k)->vtable()->print();
|
2007-12-01 00:00:00 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
extern "C" void nm(intptr_t p) {
|
|
|
|
// Actually we look through all CodeBlobs (the nm name has been kept for backwards compatability)
|
|
|
|
Command c("nm");
|
|
|
|
CodeBlob* cb = CodeCache::find_blob((address)p);
|
|
|
|
if (cb == NULL) {
|
|
|
|
tty->print_cr("NULL");
|
|
|
|
} else {
|
|
|
|
cb->print();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
extern "C" void disnm(intptr_t p) {
|
|
|
|
Command c("disnm");
|
|
|
|
CodeBlob* cb = CodeCache::find_blob((address) p);
|
2010-12-03 01:34:31 -08:00
|
|
|
nmethod* nm = cb->as_nmethod_or_null();
|
|
|
|
if (nm) {
|
|
|
|
nm->print();
|
|
|
|
Disassembler::decode(nm);
|
|
|
|
} else {
|
|
|
|
cb->print();
|
|
|
|
Disassembler::decode(cb);
|
|
|
|
}
|
2007-12-01 00:00:00 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
extern "C" void printnm(intptr_t p) {
|
|
|
|
char buffer[256];
|
|
|
|
sprintf(buffer, "printnm: " INTPTR_FORMAT, p);
|
|
|
|
Command c(buffer);
|
|
|
|
CodeBlob* cb = CodeCache::find_blob((address) p);
|
|
|
|
if (cb->is_nmethod()) {
|
|
|
|
nmethod* nm = (nmethod*)cb;
|
|
|
|
nm->print_nmethod(true);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
extern "C" void universe() {
|
|
|
|
Command c("universe");
|
|
|
|
Universe::print();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
extern "C" void verify() {
|
|
|
|
// try to run a verify on the entire system
|
|
|
|
// note: this may not be safe if we're not at a safepoint; for debugging,
|
|
|
|
// this manipulates the safepoint settings to avoid assertion failures
|
|
|
|
Command c("universe verify");
|
|
|
|
bool safe = SafepointSynchronize::is_at_safepoint();
|
|
|
|
if (!safe) {
|
|
|
|
tty->print_cr("warning: not at safepoint -- verify may fail");
|
|
|
|
SafepointSynchronize::set_is_at_safepoint();
|
|
|
|
}
|
|
|
|
// Ensure Eden top is correct before verification
|
|
|
|
Universe::heap()->prepare_for_verify();
|
2012-10-15 10:02:42 -07:00
|
|
|
Universe::verify();
|
2007-12-01 00:00:00 +00:00
|
|
|
if (!safe) SafepointSynchronize::set_is_not_at_safepoint();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
extern "C" void pp(void* p) {
|
|
|
|
Command c("pp");
|
|
|
|
FlagSetting fl(PrintVMMessages, true);
|
2011-05-02 18:53:37 -07:00
|
|
|
FlagSetting f2(DisplayVMOutput, true);
|
2007-12-01 00:00:00 +00:00
|
|
|
if (Universe::heap()->is_in(p)) {
|
|
|
|
oop obj = oop(p);
|
|
|
|
obj->print();
|
|
|
|
} else {
|
2011-10-13 09:35:42 -07:00
|
|
|
tty->print(PTR_FORMAT, p);
|
2007-12-01 00:00:00 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// pv: print vm-printable object
|
|
|
|
extern "C" void pa(intptr_t p) { ((AllocatedObj*) p)->print(); }
|
|
|
|
extern "C" void findpc(intptr_t x);
|
|
|
|
|
2011-10-13 09:35:42 -07:00
|
|
|
#endif // !PRODUCT
|
|
|
|
|
2007-12-01 00:00:00 +00:00
|
|
|
extern "C" void ps() { // print stack
|
2011-10-13 09:35:42 -07:00
|
|
|
if (Thread::current() == NULL) return;
|
2007-12-01 00:00:00 +00:00
|
|
|
Command c("ps");
|
|
|
|
|
|
|
|
|
|
|
|
// Prints the stack of the current Java thread
|
|
|
|
JavaThread* p = JavaThread::active();
|
|
|
|
tty->print(" for thread: ");
|
|
|
|
p->print();
|
|
|
|
tty->cr();
|
|
|
|
|
|
|
|
if (p->has_last_Java_frame()) {
|
|
|
|
// If the last_Java_fp is set we are in C land and
|
|
|
|
// can call the standard stack_trace function.
|
2011-10-13 09:35:42 -07:00
|
|
|
#ifdef PRODUCT
|
|
|
|
p->print_stack();
|
|
|
|
} else {
|
|
|
|
tty->print_cr("Cannot find the last Java frame, printing stack disabled.");
|
|
|
|
#else // !PRODUCT
|
2007-12-01 00:00:00 +00:00
|
|
|
p->trace_stack();
|
|
|
|
} else {
|
|
|
|
frame f = os::current_frame();
|
|
|
|
RegisterMap reg_map(p);
|
|
|
|
f = f.sender(®_map);
|
|
|
|
tty->print("(guessing starting frame id=%#p based on current fp)\n", f.id());
|
|
|
|
p->trace_stack_from(vframe::new_vframe(&f, ®_map, p));
|
|
|
|
pd_ps(f);
|
2011-10-13 09:35:42 -07:00
|
|
|
#endif // PRODUCT
|
2007-12-01 00:00:00 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2011-05-02 18:53:37 -07:00
|
|
|
extern "C" void pfl() {
|
|
|
|
// print frame layout
|
|
|
|
Command c("pfl");
|
|
|
|
JavaThread* p = JavaThread::active();
|
|
|
|
tty->print(" for thread: ");
|
|
|
|
p->print();
|
|
|
|
tty->cr();
|
|
|
|
if (p->has_last_Java_frame()) {
|
|
|
|
p->print_frame_layout();
|
|
|
|
}
|
|
|
|
}
|
2007-12-01 00:00:00 +00:00
|
|
|
|
2011-10-13 09:35:42 -07:00
|
|
|
#ifndef PRODUCT
|
|
|
|
|
2007-12-01 00:00:00 +00:00
|
|
|
extern "C" void psf() { // print stack frames
|
|
|
|
{
|
|
|
|
Command c("psf");
|
|
|
|
JavaThread* p = JavaThread::active();
|
|
|
|
tty->print(" for thread: ");
|
|
|
|
p->print();
|
|
|
|
tty->cr();
|
|
|
|
if (p->has_last_Java_frame()) {
|
|
|
|
p->trace_frames();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
extern "C" void threads() {
|
|
|
|
Command c("threads");
|
|
|
|
Threads::print(false, true);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
extern "C" void psd() {
|
|
|
|
Command c("psd");
|
|
|
|
SystemDictionary::print();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
extern "C" void safepoints() {
|
|
|
|
Command c("safepoints");
|
|
|
|
SafepointSynchronize::print_state();
|
|
|
|
}
|
|
|
|
|
2011-10-13 09:35:42 -07:00
|
|
|
#endif // !PRODUCT
|
2007-12-01 00:00:00 +00:00
|
|
|
|
|
|
|
extern "C" void pss() { // print all stacks
|
2011-10-13 09:35:42 -07:00
|
|
|
if (Thread::current() == NULL) return;
|
2007-12-01 00:00:00 +00:00
|
|
|
Command c("pss");
|
2011-10-13 09:35:42 -07:00
|
|
|
Threads::print(true, PRODUCT_ONLY(false) NOT_PRODUCT(true));
|
2007-12-01 00:00:00 +00:00
|
|
|
}
|
|
|
|
|
2011-10-13 09:35:42 -07:00
|
|
|
#ifndef PRODUCT
|
2007-12-01 00:00:00 +00:00
|
|
|
|
|
|
|
extern "C" void debug() { // to set things up for compiler debugging
|
|
|
|
Command c("debug");
|
|
|
|
WizardMode = true;
|
|
|
|
PrintVMMessages = PrintCompilation = true;
|
|
|
|
PrintInlining = PrintAssembly = true;
|
|
|
|
tty->flush();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
extern "C" void ndebug() { // undo debug()
|
|
|
|
Command c("ndebug");
|
|
|
|
PrintCompilation = false;
|
|
|
|
PrintInlining = PrintAssembly = false;
|
|
|
|
tty->flush();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
extern "C" void flush() {
|
|
|
|
Command c("flush");
|
|
|
|
tty->flush();
|
|
|
|
}
|
|
|
|
|
2012-02-15 10:12:55 -08:00
|
|
|
extern "C" void events() {
|
|
|
|
Command c("events");
|
|
|
|
Events::print();
|
|
|
|
}
|
2007-12-01 00:00:00 +00:00
|
|
|
|
6964458: Reimplement class meta-data storage to use native memory
Remove PermGen, allocate meta-data in metaspace linked to class loaders, rewrite GC walking, rewrite and rename metadata to be C++ classes
Co-authored-by: Stefan Karlsson <stefan.karlsson@oracle.com>
Co-authored-by: Mikael Gerdin <mikael.gerdin@oracle.com>
Co-authored-by: Tom Rodriguez <tom.rodriguez@oracle.com>
Reviewed-by: jmasa, stefank, never, coleenp, kvn, brutisso, mgerdin, dholmes, jrose, twisti, roland
2012-09-01 13:25:18 -04:00
|
|
|
extern "C" Method* findm(intptr_t pc) {
|
2007-12-01 00:00:00 +00:00
|
|
|
Command c("findm");
|
|
|
|
nmethod* nm = CodeCache::find_nmethod((address)pc);
|
6964458: Reimplement class meta-data storage to use native memory
Remove PermGen, allocate meta-data in metaspace linked to class loaders, rewrite GC walking, rewrite and rename metadata to be C++ classes
Co-authored-by: Stefan Karlsson <stefan.karlsson@oracle.com>
Co-authored-by: Mikael Gerdin <mikael.gerdin@oracle.com>
Co-authored-by: Tom Rodriguez <tom.rodriguez@oracle.com>
Reviewed-by: jmasa, stefank, never, coleenp, kvn, brutisso, mgerdin, dholmes, jrose, twisti, roland
2012-09-01 13:25:18 -04:00
|
|
|
return (nm == NULL) ? (Method*)NULL : nm->method();
|
2007-12-01 00:00:00 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
extern "C" nmethod* findnm(intptr_t addr) {
|
|
|
|
Command c("findnm");
|
|
|
|
return CodeCache::find_nmethod((address)addr);
|
|
|
|
}
|
|
|
|
|
|
|
|
// Another interface that isn't ambiguous in dbx.
|
|
|
|
// Can we someday rename the other find to hsfind?
|
|
|
|
extern "C" void hsfind(intptr_t x) {
|
|
|
|
Command c("hsfind");
|
2010-08-03 08:13:38 -04:00
|
|
|
os::print_location(tty, x, false);
|
2007-12-01 00:00:00 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
extern "C" void find(intptr_t x) {
|
|
|
|
Command c("find");
|
2010-08-03 08:13:38 -04:00
|
|
|
os::print_location(tty, x, false);
|
2007-12-01 00:00:00 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
extern "C" void findpc(intptr_t x) {
|
|
|
|
Command c("findpc");
|
2010-08-03 08:13:38 -04:00
|
|
|
os::print_location(tty, x, true);
|
2007-12-01 00:00:00 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
6964458: Reimplement class meta-data storage to use native memory
Remove PermGen, allocate meta-data in metaspace linked to class loaders, rewrite GC walking, rewrite and rename metadata to be C++ classes
Co-authored-by: Stefan Karlsson <stefan.karlsson@oracle.com>
Co-authored-by: Mikael Gerdin <mikael.gerdin@oracle.com>
Co-authored-by: Tom Rodriguez <tom.rodriguez@oracle.com>
Reviewed-by: jmasa, stefank, never, coleenp, kvn, brutisso, mgerdin, dholmes, jrose, twisti, roland
2012-09-01 13:25:18 -04:00
|
|
|
// Need method pointer to find bcp, when not in permgen.
|
|
|
|
extern "C" void findbcp(intptr_t method, intptr_t bcp) {
|
|
|
|
Command c("findbcp");
|
|
|
|
Method* mh = (Method*)method;
|
|
|
|
if (!mh->is_native()) {
|
|
|
|
tty->print_cr("bci_from(%p) = %d; print_codes():",
|
|
|
|
mh, mh->bci_from(address(bcp)));
|
|
|
|
mh->print_codes_on(tty);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2007-12-01 00:00:00 +00:00
|
|
|
// int versions of all methods to avoid having to type type casts in the debugger
|
|
|
|
|
|
|
|
void pp(intptr_t p) { pp((void*)p); }
|
|
|
|
void pp(oop p) { pp((void*)p); }
|
|
|
|
|
|
|
|
void help() {
|
|
|
|
Command c("help");
|
|
|
|
tty->print_cr("basic");
|
|
|
|
tty->print_cr(" pp(void* p) - try to make sense of p");
|
|
|
|
tty->print_cr(" pv(intptr_t p)- ((PrintableResourceObj*) p)->print()");
|
|
|
|
tty->print_cr(" ps() - print current thread stack");
|
|
|
|
tty->print_cr(" pss() - print all thread stacks");
|
6964458: Reimplement class meta-data storage to use native memory
Remove PermGen, allocate meta-data in metaspace linked to class loaders, rewrite GC walking, rewrite and rename metadata to be C++ classes
Co-authored-by: Stefan Karlsson <stefan.karlsson@oracle.com>
Co-authored-by: Mikael Gerdin <mikael.gerdin@oracle.com>
Co-authored-by: Tom Rodriguez <tom.rodriguez@oracle.com>
Reviewed-by: jmasa, stefank, never, coleenp, kvn, brutisso, mgerdin, dholmes, jrose, twisti, roland
2012-09-01 13:25:18 -04:00
|
|
|
tty->print_cr(" pm(int pc) - print Method* given compiled PC");
|
|
|
|
tty->print_cr(" findm(intptr_t pc) - finds Method*");
|
2007-12-01 00:00:00 +00:00
|
|
|
tty->print_cr(" find(intptr_t x) - finds & prints nmethod/stub/bytecode/oop based on pointer into it");
|
2014-09-24 12:19:07 -07:00
|
|
|
tty->print_cr(" pns(void* sp, void* fp, void* pc) - print native (i.e. mixed) stack trace. E.g.");
|
|
|
|
tty->print_cr(" pns($sp, $rbp, $pc) on Linux/amd64 and Solaris/amd64 or");
|
|
|
|
tty->print_cr(" pns($sp, $ebp, $pc) on Linux/x86 or");
|
|
|
|
tty->print_cr(" pns($sp, 0, $pc) on Linux/ppc64 or");
|
|
|
|
tty->print_cr(" pns($sp + 0x7ff, 0, $pc) on Solaris/SPARC");
|
|
|
|
tty->print_cr(" - in gdb do 'set overload-resolution off' before calling pns()");
|
|
|
|
tty->print_cr(" - in dbx do 'frame 1' before calling pns()");
|
2007-12-01 00:00:00 +00:00
|
|
|
|
|
|
|
tty->print_cr("misc.");
|
|
|
|
tty->print_cr(" flush() - flushes the log file");
|
2012-02-15 10:12:55 -08:00
|
|
|
tty->print_cr(" events() - dump events from ring buffers");
|
2007-12-01 00:00:00 +00:00
|
|
|
|
|
|
|
|
|
|
|
tty->print_cr("compiler debugging");
|
|
|
|
tty->print_cr(" debug() - to set things up for compiler debugging");
|
|
|
|
tty->print_cr(" ndebug() - undo debug");
|
|
|
|
}
|
|
|
|
|
2011-10-13 09:35:42 -07:00
|
|
|
#endif // !PRODUCT
|
2014-09-24 12:19:07 -07:00
|
|
|
|
|
|
|
void print_native_stack(outputStream* st, frame fr, Thread* t, char* buf, int buf_size) {
|
|
|
|
|
|
|
|
// see if it's a valid frame
|
|
|
|
if (fr.pc()) {
|
|
|
|
st->print_cr("Native frames: (J=compiled Java code, j=interpreted, Vv=VM code, C=native code)");
|
|
|
|
|
|
|
|
int count = 0;
|
|
|
|
while (count++ < StackPrintLimit) {
|
|
|
|
fr.print_on_error(st, buf, buf_size);
|
|
|
|
st->cr();
|
|
|
|
// Compiled code may use EBP register on x86 so it looks like
|
|
|
|
// non-walkable C frame. Use frame.sender() for java frames.
|
|
|
|
if (t && t->is_Java_thread()) {
|
|
|
|
// Catch very first native frame by using stack address.
|
|
|
|
// For JavaThread stack_base and stack_size should be set.
|
|
|
|
if (!t->on_local_stack((address)(fr.real_fp() + 1))) {
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
if (fr.is_java_frame() || fr.is_native_frame() || fr.is_runtime_frame()) {
|
|
|
|
RegisterMap map((JavaThread*)t, false); // No update
|
|
|
|
fr = fr.sender(&map);
|
|
|
|
} else {
|
|
|
|
fr = os::get_sender_for_C_frame(&fr);
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
// is_first_C_frame() does only simple checks for frame pointer,
|
|
|
|
// it will pass if java compiled code has a pointer in EBP.
|
|
|
|
if (os::is_first_C_frame(&fr)) break;
|
|
|
|
fr = os::get_sender_for_C_frame(&fr);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (count > StackPrintLimit) {
|
|
|
|
st->print_cr("...<more frames>...");
|
|
|
|
}
|
|
|
|
|
|
|
|
st->cr();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
#ifndef PRODUCT
|
|
|
|
|
|
|
|
extern "C" void pns(void* sp, void* fp, void* pc) { // print native stack
|
|
|
|
Command c("pns");
|
|
|
|
static char buf[O_BUFLEN];
|
|
|
|
Thread* t = ThreadLocalStorage::get_thread_slow();
|
|
|
|
// Call generic frame constructor (certain arguments may be ignored)
|
|
|
|
frame fr(sp, fp, pc);
|
|
|
|
print_native_stack(tty, fr, t, buf, sizeof(buf));
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif // !PRODUCT
|
2015-06-09 15:05:47 -04:00
|
|
|
|
|
|
|
//////////////////////////////////////////////////////////////////////////////
|
|
|
|
// Test multiple STATIC_ASSERT forms in various scopes.
|
|
|
|
|
|
|
|
#ifndef PRODUCT
|
|
|
|
|
|
|
|
// namespace scope
|
|
|
|
STATIC_ASSERT(true);
|
|
|
|
STATIC_ASSERT(true);
|
|
|
|
STATIC_ASSERT(1 == 1);
|
|
|
|
STATIC_ASSERT(0 == 0);
|
|
|
|
|
|
|
|
void test_multiple_static_assert_forms_in_function_scope() {
|
|
|
|
STATIC_ASSERT(true);
|
|
|
|
STATIC_ASSERT(true);
|
|
|
|
STATIC_ASSERT(0 == 0);
|
|
|
|
STATIC_ASSERT(1 == 1);
|
|
|
|
}
|
|
|
|
|
|
|
|
// class scope
|
|
|
|
struct TestMultipleStaticAssertFormsInClassScope {
|
|
|
|
STATIC_ASSERT(true);
|
|
|
|
STATIC_ASSERT(true);
|
|
|
|
STATIC_ASSERT(0 == 0);
|
|
|
|
STATIC_ASSERT(1 == 1);
|
|
|
|
};
|
|
|
|
|
|
|
|
#endif // !PRODUCT
|