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 *
23 */
24
25 #include "precompiled.hpp"
26 #include "jvm.h"
27 #include "code/codeCache.hpp"
28 #include "compiler/compileBroker.hpp"
29 #include "compiler/disassembler.hpp"
30 #include "gc/shared/collectedHeap.hpp"
31 #include "logging/logConfiguration.hpp"
32 #include "memory/resourceArea.hpp"
33 #include "prims/whitebox.hpp"
34 #include "runtime/arguments.hpp"
35 #include "runtime/atomic.hpp"
36 #include "runtime/frame.inline.hpp"
37 #include "runtime/init.hpp"
38 #include "runtime/os.hpp"
39 #include "runtime/thread.inline.hpp"
40 #include "runtime/threadSMR.hpp"
41 #include "runtime/vmThread.hpp"
42 #include "runtime/vm_operations.hpp"
43 #include "runtime/vm_version.hpp"
44 #include "services/memTracker.hpp"
45 #include "trace/traceMacros.hpp"
46 #include "utilities/debug.hpp"
47 #include "utilities/decoder.hpp"
48 #include "utilities/defaultStream.hpp"
49 #include "utilities/errorReporter.hpp"
50 #include "utilities/events.hpp"
287 switch (Universe::narrow_oop_mode()) {
288 case Universe::UnscaledNarrowOop:
289 st->print_cr("# JVM is running with Unscaled Compressed Oops mode in which the Java heap is");
290 st->print_cr("# placed in the first 4GB address space. The Java Heap base address is the");
291 st->print_cr("# maximum limit for the native heap growth. Please use -XX:HeapBaseMinAddress");
292 st->print_cr("# to set the Java Heap base and to place the Java Heap above 4GB virtual address.");
293 break;
294 case Universe::ZeroBasedNarrowOop:
295 st->print_cr("# JVM is running with Zero Based Compressed Oops mode in which the Java heap is");
296 st->print_cr("# placed in the first 32GB address space. The Java Heap base address is the");
297 st->print_cr("# maximum limit for the native heap growth. Please use -XX:HeapBaseMinAddress");
298 st->print_cr("# to set the Java Heap base and to place the Java Heap above 32GB virtual address.");
299 break;
300 default:
301 break;
302 }
303 }
304 st->print_cr("# This output file may be truncated or incomplete.");
305 }
306
307 static const char* gc_mode() {
308 if (UseG1GC) return "g1 gc";
309 if (UseParallelGC) return "parallel gc";
310 if (UseConcMarkSweepGC) return "concurrent mark sweep gc";
311 if (UseSerialGC) return "serial gc";
312 return "ERROR in GC mode";
313 }
314
315 static void report_vm_version(outputStream* st, char* buf, int buflen) {
316 // VM version
317 st->print_cr("#");
318 JDK_Version::current().to_string(buf, buflen);
319 const char* runtime_name = JDK_Version::runtime_name() != NULL ?
320 JDK_Version::runtime_name() : "";
321 const char* runtime_version = JDK_Version::runtime_version() != NULL ?
322 JDK_Version::runtime_version() : "";
323 const char* jdk_debug_level = Abstract_VM_Version::printable_jdk_debug_level() != NULL ?
324 Abstract_VM_Version::printable_jdk_debug_level() : "";
325
326 st->print_cr("# JRE version: %s (%s) (%sbuild %s)", runtime_name, buf,
327 jdk_debug_level, runtime_version);
328
329 // This is the long version with some default settings added
330 st->print_cr("# Java VM: %s (%s%s, %s%s%s%s%s, %s, %s)",
331 Abstract_VM_Version::vm_name(),
332 jdk_debug_level,
333 Abstract_VM_Version::vm_release(),
334 Abstract_VM_Version::vm_info_string(),
335 TieredCompilation ? ", tiered" : "",
336 #if INCLUDE_JVMCI
337 EnableJVMCI ? ", jvmci" : "",
338 UseJVMCICompiler ? ", jvmci compiler" : "",
339 #else
340 "", "",
341 #endif
342 UseCompressedOops ? ", compressed oops" : "",
343 gc_mode(),
344 Abstract_VM_Version::vm_platform_string()
345 );
346 }
347
348 // This is the main function to report a fatal error. Only one thread can
349 // call this function, so we don't need to worry about MT-safety. But it's
350 // possible that the error handler itself may crash or die on an internal
351 // error, for example, when the stack/heap is badly damaged. We must be
352 // able to handle recursive errors that happen inside error handler.
353 //
354 // Error reporting is done in several steps. If a crash or internal error
355 // occurred when reporting an error, the nested signal/exception handler
356 // can skip steps that are already (or partially) done. Error reporting will
357 // continue from the next step. This allows us to retrieve and print
358 // information that may be unsafe to get after a fatal error. If it happens,
359 // you may find nested report_and_die() frames when you look at the stack
360 // in a debugger.
361 //
362 // In general, a hang in error handler is much worse than a crash or internal
363 // error, as it's harder to recover from a hang. Deadlock can happen if we
|
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 *
23 */
24
25 #include "precompiled.hpp"
26 #include "jvm.h"
27 #include "code/codeCache.hpp"
28 #include "compiler/compileBroker.hpp"
29 #include "compiler/disassembler.hpp"
30 #include "gc/shared/gcConfig.hpp"
31 #include "logging/logConfiguration.hpp"
32 #include "memory/resourceArea.hpp"
33 #include "prims/whitebox.hpp"
34 #include "runtime/arguments.hpp"
35 #include "runtime/atomic.hpp"
36 #include "runtime/frame.inline.hpp"
37 #include "runtime/init.hpp"
38 #include "runtime/os.hpp"
39 #include "runtime/thread.inline.hpp"
40 #include "runtime/threadSMR.hpp"
41 #include "runtime/vmThread.hpp"
42 #include "runtime/vm_operations.hpp"
43 #include "runtime/vm_version.hpp"
44 #include "services/memTracker.hpp"
45 #include "trace/traceMacros.hpp"
46 #include "utilities/debug.hpp"
47 #include "utilities/decoder.hpp"
48 #include "utilities/defaultStream.hpp"
49 #include "utilities/errorReporter.hpp"
50 #include "utilities/events.hpp"
287 switch (Universe::narrow_oop_mode()) {
288 case Universe::UnscaledNarrowOop:
289 st->print_cr("# JVM is running with Unscaled Compressed Oops mode in which the Java heap is");
290 st->print_cr("# placed in the first 4GB address space. The Java Heap base address is the");
291 st->print_cr("# maximum limit for the native heap growth. Please use -XX:HeapBaseMinAddress");
292 st->print_cr("# to set the Java Heap base and to place the Java Heap above 4GB virtual address.");
293 break;
294 case Universe::ZeroBasedNarrowOop:
295 st->print_cr("# JVM is running with Zero Based Compressed Oops mode in which the Java heap is");
296 st->print_cr("# placed in the first 32GB address space. The Java Heap base address is the");
297 st->print_cr("# maximum limit for the native heap growth. Please use -XX:HeapBaseMinAddress");
298 st->print_cr("# to set the Java Heap base and to place the Java Heap above 32GB virtual address.");
299 break;
300 default:
301 break;
302 }
303 }
304 st->print_cr("# This output file may be truncated or incomplete.");
305 }
306
307 static void report_vm_version(outputStream* st, char* buf, int buflen) {
308 // VM version
309 st->print_cr("#");
310 JDK_Version::current().to_string(buf, buflen);
311 const char* runtime_name = JDK_Version::runtime_name() != NULL ?
312 JDK_Version::runtime_name() : "";
313 const char* runtime_version = JDK_Version::runtime_version() != NULL ?
314 JDK_Version::runtime_version() : "";
315 const char* jdk_debug_level = Abstract_VM_Version::printable_jdk_debug_level() != NULL ?
316 Abstract_VM_Version::printable_jdk_debug_level() : "";
317
318 st->print_cr("# JRE version: %s (%s) (%sbuild %s)", runtime_name, buf,
319 jdk_debug_level, runtime_version);
320
321 // This is the long version with some default settings added
322 st->print_cr("# Java VM: %s (%s%s, %s%s%s%s%s, %s, %s)",
323 Abstract_VM_Version::vm_name(),
324 jdk_debug_level,
325 Abstract_VM_Version::vm_release(),
326 Abstract_VM_Version::vm_info_string(),
327 TieredCompilation ? ", tiered" : "",
328 #if INCLUDE_JVMCI
329 EnableJVMCI ? ", jvmci" : "",
330 UseJVMCICompiler ? ", jvmci compiler" : "",
331 #else
332 "", "",
333 #endif
334 UseCompressedOops ? ", compressed oops" : "",
335 GCConfig::hs_err_name(),
336 Abstract_VM_Version::vm_platform_string()
337 );
338 }
339
340 // This is the main function to report a fatal error. Only one thread can
341 // call this function, so we don't need to worry about MT-safety. But it's
342 // possible that the error handler itself may crash or die on an internal
343 // error, for example, when the stack/heap is badly damaged. We must be
344 // able to handle recursive errors that happen inside error handler.
345 //
346 // Error reporting is done in several steps. If a crash or internal error
347 // occurred when reporting an error, the nested signal/exception handler
348 // can skip steps that are already (or partially) done. Error reporting will
349 // continue from the next step. This allows us to retrieve and print
350 // information that may be unsafe to get after a fatal error. If it happens,
351 // you may find nested report_and_die() frames when you look at the stack
352 // in a debugger.
353 //
354 // In general, a hang in error handler is much worse than a crash or internal
355 // error, as it's harder to recover from a hang. Deadlock can happen if we
|