Col-E / recaf-3x-issues

This was the temporary issue tracking for 3x. Focus is now on 4x and all issues are tracked on the main repo going forward.
35 stars 5 forks source link

Virtualize menu not available #120

Closed KTibow closed 2 years ago

KTibow commented 2 years ago

Sorry if this is the wrong place, but after heavy Googling I can't figure out why the virtualize menu isn't showing up. What causes it not to appear? How can I get it to show up? I only see this: image

Col-E commented 2 years ago

Saw you commented on YT, but can't seem to reply there unless you deleted it.

Anyways, the visualize menu only appears when the feature is supported for the given method:

private boolean canUseVm() {
    // Can only be run on JVM classes
    if (!isOwnerJvmClass())
        return false;
    // SSVM must have been initialized
    SsvmIntegration ssvm = RecafUI.getController().getServices().getSsvmIntegration();
    if (!ssvm.isInitialized())
        return false;
    // Cannot run on abstract/native methods
    int access = methodInfo.getAccess();
    return !AccessFlag.isAbstract(access) && !AccessFlag.isNative(access);
}

SSVM has its own page in the config menu. You can check if its active in there, which it should be by default.

Amejonah1200 commented 2 years ago

To avoid confusion, it would be probably be a good idea on disabling the action instead of removing it. On click, we could tell then the requirements for it.

KTibow commented 2 years ago

It would probably be better if it said why exactly. I got the menu to pull up on a hello world .class, but it appeared to crash Recaf for a bit: image Then the window pulled up. When I clicked optimize it lagged out again for a bit, then gave this error:

SSVM optimize thread encountered VM error
java.lang.UnsatisfiedLinkError: sun/nio/fs/UnixNativeDispatcher.stat0(JLsun/nio/fs/UnixFileAttributes;)V
    at sun.nio.fs.UnixNativeDispatcher.stat0(Native Method)
    at sun.nio.fs.UnixNativeDispatcher.stat(UnixNativeDispatcher.java:301)
    at sun.nio.fs.UnixFileAttributes.get(UnixFileAttributes.java:70)
    at sun.nio.fs.UnixFileAttributeViews$Basic.readAttributes(UnixFileAttributeViews.java:52)
    at sun.nio.fs.UnixFileSystemProvider.readAttributes(UnixFileSystemProvider.java:149)
    at sun.nio.fs.LinuxFileSystemProvider.readAttributes(LinuxFileSystemProvider.java:99)
    at java.nio.file.Files.readAttributes(Files.java:1764)
    at java.util.zip.ZipFile$Source.get(ZipFile.java:1259)
    at java.util.zip.ZipFile$CleanableResource.<init>(ZipFile.java:733)
    at java.util.zip.ZipFile$CleanableResource.get(ZipFile.java:850)
    at java.util.zip.ZipFile.<init>(ZipFile.java:248)
    at java.util.zip.ZipFile.<init>(ZipFile.java:177)
    at java.util.jar.JarFile.<init>(JarFile.java:350)
    at jdk.internal.loader.URLClassPath$JarLoader.getJarFile(URLClassPath.java:814)
    at jdk.internal.loader.URLClassPath$JarLoader$1.run(URLClassPath.java:759)
    at jdk.internal.loader.URLClassPath$JarLoader$1.run(URLClassPath.java:752)
    at java.security.AccessController.doPrivileged(Native Method)
    at jdk.internal.loader.URLClassPath$JarLoader.ensureOpen(URLClassPath.java:751)
    at jdk.internal.loader.URLClassPath$JarLoader.<init>(URLClassPath.java:726)
    at jdk.internal.loader.URLClassPath$3.run(URLClassPath.java:494)
    at jdk.internal.loader.URLClassPath$3.run(URLClassPath.java:477)
    at java.security.AccessController.doPrivileged(Native Method)
    at jdk.internal.loader.URLClassPath.getLoader(URLClassPath.java:476)
    at jdk.internal.loader.URLClassPath.getLoader(URLClassPath.java:445)
    at jdk.internal.loader.URLClassPath.getResource(URLClassPath.java:314)
    at jdk.internal.loader.BuiltinClassLoader.findClassOnClassPathOrNull(BuiltinClassLoader.java:695)
    at jdk.internal.loader.BuiltinClassLoader.loadClassOrNull(BuiltinClassLoader.java:621)
    at jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:579)
    at jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:178)

Update: I turned off the "remote vm" thing and it seemed to optimize fine.

KTibow commented 2 years ago

Optimizing isn't working everywhere where I want it to be but it's working good enough.