< prev index next >

src/jdk.internal.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotResolvedJavaMethodImpl.java

Print this page

        

*** 71,81 **** private final HotSpotResolvedObjectTypeImpl holder; private final HotSpotConstantPool constantPool; private final HotSpotSignature signature; private HotSpotMethodData methodData; private byte[] code; ! private Executable toJavaCache; /** * Only 30% of {@link HotSpotResolvedJavaMethodImpl}s have their name accessed so compute it * lazily and cache it. */ --- 71,87 ---- private final HotSpotResolvedObjectTypeImpl holder; private final HotSpotConstantPool constantPool; private final HotSpotSignature signature; private HotSpotMethodData methodData; private byte[] code; ! ! /** ! * Cache for {@link #toJava()}. Set to {@link #signature} when resolving reflection object fails ! * due to reflection filtering (see {@code Reflection.fieldFilterMap} and ! * {@code Reflection.methodFilterMap}). ! */ ! private Object toJavaCache; /** * Only 30% of {@link HotSpotResolvedJavaMethodImpl}s have their name accessed so compute it * lazily and cache it. */
*** 320,330 **** public boolean hasReservedStackAccess() { return (getFlags() & config().methodFlagsReservedStackAccess) != 0; } /** ! * Sets flags on {@code method} indicating that it should never be inlined or compiled by the VM. */ @Override public void setNotInlinableOrCompilable() { compilerToVM().setNotInlinableOrCompilable(this); } --- 326,337 ---- public boolean hasReservedStackAccess() { return (getFlags() & config().methodFlagsReservedStackAccess) != 0; } /** ! * Sets flags on {@code method} indicating that it should never be inlined or compiled by the ! * VM. */ @Override public void setNotInlinableOrCompilable() { compilerToVM().setNotInlinableOrCompilable(this); }
*** 579,607 **** return null; } private Executable toJava() { if (toJavaCache != null) { ! return toJavaCache; } - try { Class<?>[] parameterTypes = signatureToTypes(); Class<?> returnType = ((HotSpotResolvedJavaType) getSignature().getReturnType(holder).resolve(holder)).mirror(); Executable result; if (isConstructor()) { result = holder.mirror().getDeclaredConstructor(parameterTypes); } else { // Do not use Method.getDeclaredMethod() as it can return a bridge method // when this.isBridge() is false and vice versa. result = searchMethods(holder.mirror().getDeclaredMethods(), getName(), returnType, parameterTypes); } toJavaCache = result; return result; - } catch (NoSuchMethodException | NoClassDefFoundError e) { - return null; - } } @Override public boolean canBeInlined() { if (hasNeverInlineDirective()) { --- 586,622 ---- return null; } private Executable toJava() { if (toJavaCache != null) { ! if (toJavaCache == signature) { ! return null; ! } ! return (Executable) toJavaCache; } Class<?>[] parameterTypes = signatureToTypes(); Class<?> returnType = ((HotSpotResolvedJavaType) getSignature().getReturnType(holder).resolve(holder)).mirror(); Executable result; if (isConstructor()) { + try { result = holder.mirror().getDeclaredConstructor(parameterTypes); + } catch (NoSuchMethodException e) { + toJavaCache = signature; + return null; + } } else { // Do not use Method.getDeclaredMethod() as it can return a bridge method // when this.isBridge() is false and vice versa. result = searchMethods(holder.mirror().getDeclaredMethods(), getName(), returnType, parameterTypes); + if (result == null) { + toJavaCache = signature; + return null; + } } toJavaCache = result; return result; } @Override public boolean canBeInlined() { if (hasNeverInlineDirective()) {
*** 744,754 **** * One implication is that we will preserve {@link SpeculationLog}s for methods that have been * redefined via class redefinition. It's tempting to periodically flush such logs but we cannot * read the JVM_ACC_IS_OBSOLETE bit (or anything else) via the raw pointer as obsoleted methods * are subject to clean up and deletion (see InstanceKlass::purge_previous_versions_internal). */ ! private static final ClassValue<Map<Long, SpeculationLog>> SpeculationLogs = new ClassValue<Map<Long, SpeculationLog>>() { @Override protected Map<Long, SpeculationLog> computeValue(java.lang.Class<?> type) { return new HashMap<>(4); } }; --- 759,769 ---- * One implication is that we will preserve {@link SpeculationLog}s for methods that have been * redefined via class redefinition. It's tempting to periodically flush such logs but we cannot * read the JVM_ACC_IS_OBSOLETE bit (or anything else) via the raw pointer as obsoleted methods * are subject to clean up and deletion (see InstanceKlass::purge_previous_versions_internal). */ ! private static final ClassValue<Map<Long, SpeculationLog>> SpeculationLogs = new ClassValue<>() { @Override protected Map<Long, SpeculationLog> computeValue(java.lang.Class<?> type) { return new HashMap<>(4); } };
*** 794,802 **** --- 809,818 ---- return hasCompiledCodeAtLevel(level); } return compilerToVM().hasCompiledCodeForOSR(this, entryBCI, level); } + @Override public int methodIdnum() { return UNSAFE.getChar(getConstMethod() + config().constMethodMethodIdnumOffset); } }
< prev index next >