/* * Copyright (c) 2019, 2021, Oracle and/or its affiliates. All rights reserved. * 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. * * 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.
*/
bool JVMCI::can_initialize_JVMCI() { // Initializing JVMCI requires the module system to be initialized past phase 3. // The JVMCI API itself isn't available until phase 2 and ServiceLoader (which // JVMCI initialization requires) isn't usable until after phase 3. Testing // whether the system loader is initialized satisfies all these invariants. if (SystemDictionary::java_system_loader() == NULL) { returnfalse;
}
assert(Universe::is_module_initialized(), "must be"); returntrue;
}
void* JVMCI::get_shared_library(char*& path, bool load) { void* sl_handle = _shared_library_handle; if (sl_handle != NULL || !load) {
path = _shared_library_path; return sl_handle;
}
MutexLocker locker(JVMCI_lock);
path = NULL; if (_shared_library_handle == NULL) { char path[JVM_MAXPATHLEN]; char ebuf[1024]; if (JVMCILibPath != NULL) { if (!os::dll_locate_lib(path, sizeof(path), JVMCILibPath, JVMCI_SHARED_LIBRARY_NAME)) {
fatal("Unable to create path to JVMCI shared library based on value of JVMCILibPath (%s)", JVMCILibPath);
}
} else { if (!os::dll_locate_lib(path, sizeof(path), Arguments::get_dll_dir(), JVMCI_SHARED_LIBRARY_NAME)) {
fatal("Unable to create path to JVMCI shared library");
}
}
void* handle = os::dll_load(path, ebuf, sizeof ebuf); if (handle == NULL) {
fatal("Unable to load JVMCI shared library from %s: %s", path, ebuf);
}
_shared_library_handle = handle;
_shared_library_path = os::strdup(path);
void JVMCI::initialize_globals() {
jvmci_vmStructs_init(); if (LogEvents) { if (JVMCIEventLogLevel > 0) {
_events = new StringEventLog("JVMCI Events", "jvmci"); if (JVMCIEventLogLevel > 1) { int count = LogEventsBufferEntries; for (int i = 1; i < JVMCIEventLogLevel && i < max_EventLog_level; i++) { // Expand event buffer by 10x for each level above 1
count = count * 10;
}
_verbose_events = new StringEventLog("Verbose JVMCI Events", "verbose-jvmci", count);
}
}
}
_java_runtime = new JVMCIRuntime(nullptr, -1, false); if (using_singleton_shared_library_runtime()) {
JVMCI::_compiler_runtimes = new JVMCIRuntime(nullptr, 0, true);
}
}
void JVMCI::ensure_box_caches_initialized(TRAPS) { if (_box_caches_initialized) { return;
}
// While multiple threads may reach here, that's fine // since class initialization is synchronized.
Symbol* box_classes[] = {
java_lang_Boolean::symbol(),
java_lang_Byte_ByteCache::symbol(),
java_lang_Short_ShortCache::symbol(),
java_lang_Character_CharacterCache::symbol(),
java_lang_Integer_IntegerCache::symbol(),
java_lang_Long_LongCache::symbol()
};
for (unsigned i = 0; i < sizeof(box_classes) / sizeof(Symbol*); i++) {
Klass* k = SystemDictionary::resolve_or_fail(box_classes[i], true, CHECK);
InstanceKlass* ik = InstanceKlass::cast(k); if (ik->is_not_initialized()) {
ik->initialize(CHECK);
}
}
_box_caches_initialized = true;
}
void JVMCI::fatal_log(constchar* buf, size_t count) {
intx current_thread_id = os::current_thread_id();
intx invalid_id = -1; int log_fd; if (_fatal_log_init_thread == invalid_id && Atomic::cmpxchg(&_fatal_log_init_thread, invalid_id, current_thread_id) == invalid_id) { if (ErrorFileToStdout) {
log_fd = 1;
} elseif (ErrorFileToStderr) {
log_fd = 2;
} else { staticchar name_buffer[O_BUFLEN];
log_fd = VMError::prepare_log_file(JVMCINativeLibraryErrorFile, LIBJVMCI_ERR_FILE, true, name_buffer, sizeof(name_buffer)); if (log_fd != -1) {
_fatal_log_filename = name_buffer;
} else { int e = errno;
tty->print("Can't open JVMCI shared library error report file. Error: ");
tty->print_raw_cr(os::strerror(e));
tty->print_cr("JVMCI shared library error report will be written to console.");
// See notes in VMError::report_and_die about hard coding tty to 1
log_fd = 1;
}
}
_fatal_log_fd = log_fd;
} else { // Another thread won the race to initialize the stream. Give it time // to complete initialization. VM locks cannot be used as the current // thread might not be attached to the VM (e.g. a native thread started // within libjvmci). while (_fatal_log_fd == -1) {
os::naked_short_sleep(50);
}
}
fdStream log(_fatal_log_fd);
log.write(buf, count);
log.flush();
}
¤ Dauer der Verarbeitung: 0.13 Sekunden
(vorverarbeitet)
¤
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung ist noch experimentell.