2018 *
2019 * TODO: This should be a private method in a CompileTheWorld class.
2020 */
2021 static bool can_be_compiled(const methodHandle& m, int comp_level) {
2022 assert(CompileTheWorld, "must be");
2023
2024 // It's not valid to compile a native wrapper for MethodHandle methods
2025 // that take a MemberName appendix since the bytecode signature is not
2026 // correct.
2027 vmIntrinsics::ID iid = m->intrinsic_id();
2028 if (MethodHandles::is_signature_polymorphic(iid) && MethodHandles::has_member_arg(iid)) {
2029 return false;
2030 }
2031
2032 return CompilationPolicy::can_be_compiled(m, comp_level);
2033 }
2034
2035 void ClassLoader::compile_the_world_in(char* name, Handle loader, TRAPS) {
2036 if (string_ends_with(name, ".class")) {
2037 // We have a .class file
2038 int len = (int)strlen(name);
2039 char buffer[2048];
2040 strncpy(buffer, name, len - 6);
2041 buffer[len-6] = 0;
2042 // If the file has a period after removing .class, it's not really a
2043 // valid class file. The class loader will check everything else.
2044 if (strchr(buffer, '.') == NULL) {
2045 _compile_the_world_class_counter++;
2046 if (_compile_the_world_class_counter > CompileTheWorldStopAt) return;
2047
2048 // Construct name without extension
2049 TempNewSymbol sym = SymbolTable::new_symbol(buffer, CHECK);
2050 // Use loader to load and initialize class
2051 Klass* k = SystemDictionary::resolve_or_null(sym, loader, Handle(), THREAD);
2052 if (k != NULL && !HAS_PENDING_EXCEPTION) {
2053 k->initialize(THREAD);
2054 }
2055 bool exception_occurred = HAS_PENDING_EXCEPTION;
2056 clear_pending_exception_if_not_oom(CHECK);
2057 if (CompileTheWorldPreloadClasses && k != NULL) {
2058 InstanceKlass* ik = InstanceKlass::cast(k);
2059 ConstantPool::preload_and_initialize_all_classes(ik->constants(), THREAD);
2060 if (HAS_PENDING_EXCEPTION) {
2061 // If something went wrong in preloading we just ignore it
|
2018 *
2019 * TODO: This should be a private method in a CompileTheWorld class.
2020 */
2021 static bool can_be_compiled(const methodHandle& m, int comp_level) {
2022 assert(CompileTheWorld, "must be");
2023
2024 // It's not valid to compile a native wrapper for MethodHandle methods
2025 // that take a MemberName appendix since the bytecode signature is not
2026 // correct.
2027 vmIntrinsics::ID iid = m->intrinsic_id();
2028 if (MethodHandles::is_signature_polymorphic(iid) && MethodHandles::has_member_arg(iid)) {
2029 return false;
2030 }
2031
2032 return CompilationPolicy::can_be_compiled(m, comp_level);
2033 }
2034
2035 void ClassLoader::compile_the_world_in(char* name, Handle loader, TRAPS) {
2036 if (string_ends_with(name, ".class")) {
2037 // We have a .class file
2038 size_t len = strlen(name);
2039 char buffer[2048];
2040 if (len-6 >= sizeof(buffer)) return;
2041 strncpy(buffer, name, sizeof(buffer));
2042 buffer[len-6] = 0; // Truncate ".class" suffix.
2043 // If the file has a period after removing .class, it's not really a
2044 // valid class file. The class loader will check everything else.
2045 if (strchr(buffer, '.') == NULL) {
2046 _compile_the_world_class_counter++;
2047 if (_compile_the_world_class_counter > CompileTheWorldStopAt) return;
2048
2049 // Construct name without extension
2050 TempNewSymbol sym = SymbolTable::new_symbol(buffer, CHECK);
2051 // Use loader to load and initialize class
2052 Klass* k = SystemDictionary::resolve_or_null(sym, loader, Handle(), THREAD);
2053 if (k != NULL && !HAS_PENDING_EXCEPTION) {
2054 k->initialize(THREAD);
2055 }
2056 bool exception_occurred = HAS_PENDING_EXCEPTION;
2057 clear_pending_exception_if_not_oom(CHECK);
2058 if (CompileTheWorldPreloadClasses && k != NULL) {
2059 InstanceKlass* ik = InstanceKlass::cast(k);
2060 ConstantPool::preload_and_initialize_all_classes(ik->constants(), THREAD);
2061 if (HAS_PENDING_EXCEPTION) {
2062 // If something went wrong in preloading we just ignore it
|