Implement deoptimize
This commit is contained in:
parent
9e360ea07e
commit
06c65a5a61
|
|
@ -38,6 +38,7 @@ import androidx.annotation.Nullable;
|
||||||
|
|
||||||
import org.lsposed.lspd.core.BuildConfig;
|
import org.lsposed.lspd.core.BuildConfig;
|
||||||
import org.lsposed.lspd.models.Module;
|
import org.lsposed.lspd.models.Module;
|
||||||
|
import org.lsposed.lspd.nativebridge.HookBridge;
|
||||||
import org.lsposed.lspd.service.ILSPInjectedModuleService;
|
import org.lsposed.lspd.service.ILSPInjectedModuleService;
|
||||||
import org.lsposed.lspd.util.LspModuleClassLoader;
|
import org.lsposed.lspd.util.LspModuleClassLoader;
|
||||||
|
|
||||||
|
|
@ -47,7 +48,10 @@ import java.io.FileNotFoundException;
|
||||||
import java.io.FileOutputStream;
|
import java.io.FileOutputStream;
|
||||||
import java.io.InputStream;
|
import java.io.InputStream;
|
||||||
import java.lang.reflect.Constructor;
|
import java.lang.reflect.Constructor;
|
||||||
|
import java.lang.reflect.Executable;
|
||||||
import java.lang.reflect.Method;
|
import java.lang.reflect.Method;
|
||||||
|
import java.lang.reflect.Modifier;
|
||||||
|
import java.lang.reflect.Proxy;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
import java.util.concurrent.ConcurrentHashMap;
|
import java.util.concurrent.ConcurrentHashMap;
|
||||||
|
|
@ -822,16 +826,23 @@ public class LSPosedContext extends XposedContext {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO
|
private static boolean deoptimize(@NonNull Executable method) {
|
||||||
@Override
|
if (Modifier.isAbstract(method.getModifiers())) {
|
||||||
public boolean deoptimize(@Nullable Method method) {
|
throw new IllegalArgumentException("Cannot deoptimize abstract methods: " + method);
|
||||||
return false;
|
} else if (Proxy.isProxyClass(method.getDeclaringClass())) {
|
||||||
|
throw new IllegalArgumentException("Cannot deoptimize methods from proxy class: " + method);
|
||||||
|
}
|
||||||
|
return HookBridge.deoptimizeMethod(method);
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO
|
|
||||||
@Override
|
@Override
|
||||||
public <T> boolean deoptimize(@Nullable Constructor<T> constructor) {
|
public boolean deoptimize(@NonNull Method method) {
|
||||||
return false;
|
return deoptimize((Executable) method);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public <T> boolean deoptimize(@NonNull Constructor<T> constructor) {
|
||||||
|
return deoptimize((Executable) constructor);
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO
|
// TODO
|
||||||
|
|
|
||||||
|
|
@ -106,12 +106,12 @@ public class XposedContextWrapper extends ContextWrapper implements XposedInterf
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean deoptimize(@Nullable Method method) {
|
public boolean deoptimize(@NonNull Method method) {
|
||||||
return getBaseContext().deoptimize(method);
|
return getBaseContext().deoptimize(method);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public <T> boolean deoptimize(@Nullable Constructor<T> constructor) {
|
public <T> boolean deoptimize(@NonNull Constructor<T> constructor) {
|
||||||
return getBaseContext().deoptimize(constructor);
|
return getBaseContext().deoptimize(constructor);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -112,9 +112,9 @@ public interface XposedInterface {
|
||||||
|
|
||||||
<T> MethodUnhooker<MethodHooker<Constructor<T>>, Constructor<T>> hook(@NonNull Constructor<T> origin, int priority, @NonNull MethodHooker<Constructor<T>> hooker);
|
<T> MethodUnhooker<MethodHooker<Constructor<T>>, Constructor<T>> hook(@NonNull Constructor<T> origin, int priority, @NonNull MethodHooker<Constructor<T>> hooker);
|
||||||
|
|
||||||
boolean deoptimize(@Nullable Method method);
|
boolean deoptimize(@NonNull Method method);
|
||||||
|
|
||||||
<T> boolean deoptimize(@Nullable Constructor<T> constructor);
|
<T> boolean deoptimize(@NonNull Constructor<T> constructor);
|
||||||
|
|
||||||
@Nullable
|
@Nullable
|
||||||
XposedUtils getUtils();
|
XposedUtils getUtils();
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue