Code Monkey home page Code Monkey logo

Comments (17)

CalebFenton avatar CalebFenton commented on May 18, 2024

Sorry, unfortunately optimizing native code is an entirely different and much more complex problem. It should be possible to optimize around native calls, but smalivm can't execute the actual JNI code.

There's already the smalivm equivalent for arm in the unicorn-engine, though, and there might be some projects that do something like that.

from simplify.

nospam2k avatar nospam2k commented on May 18, 2024

Sorry for the delay. Can you give an example of how to work around the native calls without having the corresponding code removed as unused? Ex.

private static native int NEngAddSearchProjector(D_AddFixedSearchInfo paramD_AddFixedSearchInfo);

If I change this to abstract, I imagine it would get dumped? I'm going to try this but should I make each call return a default value or is there a simpler way?

from simplify.

CalebFenton avatar CalebFenton commented on May 18, 2024

If it's removing calls to those methods as unused, that is a bug and I'd need to fix it.

How it should work: Whenever a method is invoked, but can't be because it's native, unsafe, or whatever, the invoke op will assume maximum ambiguity. This means any mutable objects passed as arguments and the return value, if there is one, are considered unknown. It should also assume that method had strong side effects (i.e. maybe it wrote to network or the file system) and shouldn't be removed.

If your experience varies, and it might because there aren't a whole lot of tests around native methods, let me know. Going to re-open this and you can close it if it's not an issue.

from simplify.

nospam2k avatar nospam2k commented on May 18, 2024

I'm going to try changing the native calls to just return some default value. I'll respond after tests.

from simplify.

nospam2k avatar nospam2k commented on May 18, 2024

Ok. Maybe I'm going about this wrong. What I have done is redo the startup activity to run a subset of methods from a few classes. I now want to remove everything that is unrelated to that subset (classes, methods, interfaces, etc.) I've removed "native" and made the methods return ints, or booleans or just log.d default text. It's running now and I'm piping to a log file as I noticed a number of stack traces flying by. Any input is greatly welcomed.

from simplify.

nospam2k avatar nospam2k commented on May 18, 2024

Command line: java -jar ../simplify.jar -it 'com/epson/iprojection/ui/activities/splash' ~/Desktop/in/ | grep -v WARN

directory in is the root with com/epson/iprojection... underneath.

Executing: Lcom/epson/iprojection/ui/activities/splash/Activity_Splash;->onPjFind(Lcom/epson/iprojection/engine/common/D_PjInfo;Z)V
Exception in thread "main" java.lang.NoSuchFieldError: $VALUES
at com.epson.iprojection.ui.engine_wrapper.StateMachine$State.(Unknown Source)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:497)
at java.lang.Class.getEnumConstantsShared(Class.java:3320)
at java.lang.Class.enumConstantDirectory(Class.java:3341)
at java.lang.Enum.valueOf(Enum.java:232)

from simplify.

nospam2k avatar nospam2k commented on May 18, 2024

StateMachine$State.smali is in engine_wrapper.

from simplify.

CalebFenton avatar CalebFenton commented on May 18, 2024

It looks like Emum.valueOf is being called on an instance of StateMachine.State but the compiler-generated $VALUES variable (which stores all the enum values) isn't present. This could be because the code is just wrong, related to modifications you made, or a bug in the dynamic class generation of smalivm.

If it's possible, could you share the files with me? If not, could you post more of the logs?

You may also need to change the method accessor such that it's no longer native. Not sure if it'll even compile with a method body if it's native though..

What you're doing sounds interesting and I'd like to know more about it. Maybe there's a better way.

from simplify.

nospam2k avatar nospam2k commented on May 18, 2024

I LOVE the help! I'm beating myself senseless for about 5 days now! Can we do this through normal email? I'd rather not post the apk here.

from simplify.

nospam2k avatar nospam2k commented on May 18, 2024

BTW... I'm able to reproduce the problem by trying other classes in the original, unmodified apk as well.

from simplify.

CalebFenton avatar CalebFenton commented on May 18, 2024

My email is [email protected]

from simplify.

nospam2k avatar nospam2k commented on May 18, 2024

Caleb, I thought you might find this humorous. Where is a good place to release the info I have gathered so far that would be the most beneficial?

David

On Apr 21, 2016, at 11:14 AM, [email protected] mailto:[email protected] wrote:

Hi David,

Thanks for your email and thank for your interest in Epson products. Unfortunately the information you are asking for is proprietary and controlled by our engineering team in Japan so we cannot share it with you. In addition, our legal departments in the US and Japan will not provide a release to reverse engineer the application either. I'm sorry we could not be of further assistance to you.

Thank you,

Jason Meyer
Sr. Product Manager, Projectors
Epson America, Inc.
3840 Kilroy Airport Way
Long Beach, CA 90806-2452
[email protected] mailto:[email protected]

Visit us at Epson http://www.epson.com/
Like us on Facebook http://www.facebook.com/home.php#!/EpsonAmerica
Follow us on Twitter http://twitter.com/#!/EpsonAmerica

On Apr 13, 2016, at 6:16 PM, Caleb Fenton [email protected] wrote:

My email is [email protected] mailto:[email protected]
ā€”
You are receiving this because you authored the thread.
Reply to this email directly or view it on GitHub #47 (comment)

from simplify.

CalebFenton avatar CalebFenton commented on May 18, 2024

I would have been very surprised if they would have helped.

Personally, I'd just collect everything and post it on GitHub and cross your fingers you don't get a takedown request.

I'm going to close this issue out since we worked stuff out over email.

from simplify.

nospam2k avatar nospam2k commented on May 18, 2024

Sounds good. Iā€™m going to work out a demo app and let it fly.

On Apr 21, 2016, at 9:38 PM, Caleb Fenton [email protected] wrote:

I would have been very surprised if they would have helped.

Personally, I'd just collect everything and post it on GitHub and cross your fingers you don't get a takedown request.

I'm going to close this issue out since we worked stuff out over email.

ā€”
You are receiving this because you authored the thread.
Reply to this email directly or view it on GitHub #47 (comment)

from simplify.

lewisdiamond avatar lewisdiamond commented on May 18, 2024

I get the same error, could you post your solution?

Exception in thread "main" java.lang.NoSuchFieldError: $VALUES

from simplify.

CalebFenton avatar CalebFenton commented on May 18, 2024

@lewisdiamond I have what I think is a fix for this error, but I needed to research it and make sure it's correct and add tests. I'll push the commit so you can try it though.

from simplify.

CalebFenton avatar CalebFenton commented on May 18, 2024

The fix I'm thinking of using is pretty simple: 71b52a3

I'm not sure why, but baksmali uses ENUM$VALUES as the field name for an enum class' values, but the JVM uses $VALUES. When the class builder tries to dynamically create an enum class, it fails. I basically did a blind fix, without understanding, so it may change.

Feel free to open a separate issue if you still have problems. A lot has changed since this issue was made.

from simplify.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    šŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. šŸ“ŠšŸ“ˆšŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ā¤ļø Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.