< prev index next > src/hotspot/share/cds/classListParser.cpp
Print this page
#include "cds/aotConstantPoolResolver.hpp"
#include "cds/aotLogging.hpp"
#include "cds/aotMetaspace.hpp"
#include "cds/archiveUtils.hpp"
+ #include "cds/cdsConfig.hpp"
#include "cds/classListParser.hpp"
#include "cds/lambdaFormInvokers.hpp"
#include "cds/lambdaProxyClassDictionary.hpp"
#include "cds/unregisteredClasses.hpp"
#include "classfile/classLoader.hpp"
#include "classfile/systemDictionary.hpp"
#include "classfile/systemDictionaryShared.hpp"
#include "classfile/vmClasses.hpp"
#include "classfile/vmSymbols.hpp"
#include "interpreter/bytecode.hpp"
- #include "interpreter/bytecodeStream.hpp"
+ #include "interpreter/interpreterRuntime.hpp"
#include "interpreter/linkResolver.hpp"
#include "jimage.hpp"
#include "jvm.h"
#include "logging/log.hpp"
#include "logging/logTag.hpp"
#include "utilities/utf8.hpp"
const char* ClassListParser::CONSTANT_POOL_TAG = "@cp";
const char* ClassListParser::LAMBDA_FORM_TAG = "@lambda-form-invoker";
const char* ClassListParser::LAMBDA_PROXY_TAG = "@lambda-proxy";
+ const char* ClassListParser::LOADER_NEGATIVE_CACHE_TAG = "@loader-negative-cache";
volatile Thread* ClassListParser::_parsing_thread = nullptr;
ClassListParser* ClassListParser::_instance = nullptr;
ClassListParser::ClassListParser(const char* file, ParseMode parse_mode) :
} else if (strcmp(_token, LAMBDA_FORM_TAG) == 0) {
LambdaFormInvokers::append(os::strdup((const char*)(_line + offset), mtInternal));
} else if (strcmp(_token, CONSTANT_POOL_TAG) == 0) {
_token = _line + offset;
parse_constant_pool_tag();
+ } else if (strcmp(_token, LOADER_NEGATIVE_CACHE_TAG) == 0) {
+ _token = _line + offset;
+ parse_loader_negative_cache_tag();
} else {
error("Invalid @ tag at the beginning of line \"%s\" line #%zu", _token, lineno());
}
}
}
if (preresolve_indy) {
AOTConstantPoolResolver::preresolve_indy_cp_entries(THREAD, ik, &preresolve_list);
}
}
+
+ void ClassListParser::parse_loader_negative_cache_tag() {
+ skip_whitespaces();
+ char* loader_type = _token;
+ skip_non_whitespaces();
+ *_token = '\0';
+ _token ++;
+
+ oop loader;
+ Klass* loader_klass;
+ if (!strcmp(loader_type, "app")) {
+ loader = SystemDictionary::java_system_loader();
+ loader_klass = vmClasses::jdk_internal_loader_ClassLoaders_AppClassLoader_klass();
+ } else if (!strcmp(loader_type, "platform")) {
+ loader = SystemDictionary::java_platform_loader();
+ loader_klass = vmClasses::jdk_internal_loader_ClassLoaders_PlatformClassLoader_klass();
+ } else {
+ warning("%s: unrecognized loader type %s is ignored", LOADER_NEGATIVE_CACHE_TAG, loader_type);
+ return;
+ }
+
+ char* contents = _token;
+ skip_non_whitespaces();
+ *_token = '\0';
+ _token ++;
+
+ if (ArchiveLoaderLookupCache) {
+ TempNewSymbol method = SymbolTable::new_symbol("generateNegativeLookupCache");
+ TempNewSymbol signature = SymbolTable::new_symbol("(Ljava/lang/String;)V");
+
+ EXCEPTION_MARK;
+ HandleMark hm(THREAD);
+ JavaCallArguments args(Handle(THREAD, loader));
+ Handle contents_h = java_lang_String::create_from_str(contents, THREAD);
+ args.push_oop(contents_h);
+ JavaValue result(T_VOID);
+ JavaCalls::call_virtual(&result,
+ loader_klass,
+ method,
+ signature,
+ &args, THREAD);
+ if (HAS_PENDING_EXCEPTION) {
+ Handle exc_handle(THREAD, PENDING_EXCEPTION);
+ CLEAR_PENDING_EXCEPTION;
+
+ log_warning(cds)("Exception during BuiltinClassLoader::generateNegativeLookupCache() call for %s loader", loader_type);
+ LogStreamHandle(Debug, cds) log;
+ if (log.is_enabled()) {
+ java_lang_Throwable::print_stack_trace(exc_handle, &log);
+ }
+ }
+ }
+ }
+
< prev index next >