mirror of
https://github.com/openjdk/jdk.git
synced 2026-06-06 02:33:12 +00:00
8161930: Cleanup ScriptObject warnings
Reviewed-by: hannesw, sundar
This commit is contained in:
parent
1fa516e4cc
commit
6feda5c50f
@ -1108,7 +1108,7 @@ public abstract class ScriptObject implements PropertyAccess, Cloneable {
|
||||
*
|
||||
* @return value of property as a MethodHandle or null.
|
||||
*/
|
||||
protected MethodHandle getCallMethodHandle(final FindProperty find, final MethodType type, final String bindName) {
|
||||
protected static MethodHandle getCallMethodHandle(final FindProperty find, final MethodType type, final String bindName) {
|
||||
return getCallMethodHandle(find.getObjectValue(), type, bindName);
|
||||
}
|
||||
|
||||
@ -1121,7 +1121,7 @@ public abstract class ScriptObject implements PropertyAccess, Cloneable {
|
||||
*
|
||||
* @return value of property as a MethodHandle or null.
|
||||
*/
|
||||
protected static MethodHandle getCallMethodHandle(final Object value, final MethodType type, final String bindName) {
|
||||
private static MethodHandle getCallMethodHandle(final Object value, final MethodType type, final String bindName) {
|
||||
return value instanceof ScriptFunction ? ((ScriptFunction)value).getCallMethodHandle(type, bindName) : null;
|
||||
}
|
||||
|
||||
@ -2107,13 +2107,13 @@ public abstract class ScriptObject implements PropertyAccess, Cloneable {
|
||||
* @param desc call site descriptor
|
||||
* @return method handle for getter
|
||||
*/
|
||||
protected MethodHandle findGetIndexMethodHandle(final Class<?> returnType, final String name, final Class<?> elementType, final CallSiteDescriptor desc) {
|
||||
private static MethodHandle findGetIndexMethodHandle(final Class<?> returnType, final String name, final Class<?> elementType, final CallSiteDescriptor desc) {
|
||||
if (!returnType.isPrimitive()) {
|
||||
return findOwnMH_V(getClass(), name, returnType, elementType);
|
||||
return findOwnMH_V(name, returnType, elementType);
|
||||
}
|
||||
|
||||
return MH.insertArguments(
|
||||
findOwnMH_V(getClass(), name, returnType, elementType, int.class),
|
||||
findOwnMH_V(name, returnType, elementType, int.class),
|
||||
2,
|
||||
NashornCallSiteDescriptor.isOptimistic(desc) ?
|
||||
NashornCallSiteDescriptor.getProgramPoint(desc) :
|
||||
@ -2257,11 +2257,11 @@ public abstract class ScriptObject implements PropertyAccess, Cloneable {
|
||||
}
|
||||
}
|
||||
|
||||
private GuardedInvocation findMegaMorphicSetMethod(final CallSiteDescriptor desc, final String name) {
|
||||
private static GuardedInvocation findMegaMorphicSetMethod(final CallSiteDescriptor desc, final String name) {
|
||||
Context.getContextTrusted().getLogger(ObjectClassGenerator.class).warning("Megamorphic setter: ", desc, " ", name);
|
||||
final MethodType type = desc.getMethodType().insertParameterTypes(1, Object.class);
|
||||
//never bother with ClassCastExceptionGuard for megamorphic callsites
|
||||
final GuardedInvocation inv = findSetIndexMethod(getClass(), desc, false, type);
|
||||
final GuardedInvocation inv = findSetIndexMethod(desc, false, type);
|
||||
return inv.replaceMethods(MH.insertArguments(inv.getInvocation(), 1, name), inv.getGuard());
|
||||
}
|
||||
|
||||
@ -2284,25 +2284,24 @@ public abstract class ScriptObject implements PropertyAccess, Cloneable {
|
||||
* @return GuardedInvocation to be invoked at call site.
|
||||
*/
|
||||
protected GuardedInvocation findSetIndexMethod(final CallSiteDescriptor desc, final LinkRequest request) { // array, index, value
|
||||
return findSetIndexMethod(getClass(), desc, explicitInstanceOfCheck(desc, request), desc.getMethodType());
|
||||
return findSetIndexMethod(desc, explicitInstanceOfCheck(desc, request), desc.getMethodType());
|
||||
}
|
||||
|
||||
/**
|
||||
* Find the appropriate SETINDEX method for an invoke dynamic call.
|
||||
*
|
||||
* @param clazz the receiver class
|
||||
* @param desc the call site descriptor
|
||||
* @param explicitInstanceOfCheck add an explicit instanceof check?
|
||||
* @param callType the method type at the call site
|
||||
*
|
||||
* @return GuardedInvocation to be invoked at call site.
|
||||
*/
|
||||
private static GuardedInvocation findSetIndexMethod(final Class<? extends ScriptObject> clazz, final CallSiteDescriptor desc, final boolean explicitInstanceOfCheck, final MethodType callType) {
|
||||
private static GuardedInvocation findSetIndexMethod(final CallSiteDescriptor desc, final boolean explicitInstanceOfCheck, final MethodType callType) {
|
||||
assert callType.parameterCount() == 3;
|
||||
final Class<?> keyClass = callType.parameterType(1);
|
||||
final Class<?> valueClass = callType.parameterType(2);
|
||||
|
||||
MethodHandle methodHandle = findOwnMH_V(clazz, "set", void.class, keyClass, valueClass, int.class);
|
||||
MethodHandle methodHandle = findOwnMH_V("set", void.class, keyClass, valueClass, int.class);
|
||||
methodHandle = MH.insertArguments(methodHandle, 3, NashornCallSiteDescriptor.getFlags(desc));
|
||||
|
||||
return new GuardedInvocation(methodHandle, getScriptObjectGuard(callType, explicitInstanceOfCheck), (SwitchPoint)null, explicitInstanceOfCheck ? null : ClassCastException.class);
|
||||
@ -2953,18 +2952,6 @@ public abstract class ScriptObject implements PropertyAccess, Cloneable {
|
||||
return false;
|
||||
}
|
||||
|
||||
private boolean doesNotHaveCheckArrayKeys(final long longIndex, final long value, final int callSiteFlags) {
|
||||
if (getMap().containsArrayKeys()) {
|
||||
final String key = JSType.toString(longIndex);
|
||||
final FindProperty find = findProperty(key, true);
|
||||
if (find != null) {
|
||||
setObject(find, callSiteFlags, key, value);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
private boolean doesNotHaveCheckArrayKeys(final long longIndex, final double value, final int callSiteFlags) {
|
||||
if (getMap().containsArrayKeys()) {
|
||||
final String key = JSType.toString(longIndex);
|
||||
@ -3467,13 +3454,8 @@ public abstract class ScriptObject implements PropertyAccess, Cloneable {
|
||||
return this;
|
||||
}
|
||||
|
||||
private static MethodHandle findOwnMH_V(final Class<? extends ScriptObject> clazz, final String name, final Class<?> rtype, final Class<?>... types) {
|
||||
// TODO: figure out how can it work for NativeArray$Prototype etc.
|
||||
return MH.findVirtual(MethodHandles.lookup(), ScriptObject.class, name, MH.type(rtype, types));
|
||||
}
|
||||
|
||||
private static MethodHandle findOwnMH_V(final String name, final Class<?> rtype, final Class<?>... types) {
|
||||
return findOwnMH_V(ScriptObject.class, name, rtype, types);
|
||||
return MH.findVirtual(MethodHandles.lookup(), ScriptObject.class, name, MH.type(rtype, types));
|
||||
}
|
||||
|
||||
private static MethodHandle findOwnMH_S(final String name, final Class<?> rtype, final Class<?>... types) {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user