-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
[BUG] DexRewriter sample code #738
Comments
i've verified that this is indeed a bug. i propose:
|
fix is here: that's probably the fastest solution that can be made, except -maybe- if want to use this incantation that i consider overkill:
i hereby cede copyright of the linked commit in your favor, as if we had both written the same piece of code independently. you can claim copyright, license the code, and/or do whatever you want with it. |
this is exactly what i did in the previously linked commit (DexPatcher/dexpatcher-tool@c69cd60), only my code performs better. your code:
go ahead and copy paste my code if you want. |
Thanks, I improved my implementation based on your comments (c1f2da0). One further improvement is the use of instance equality instead of value equality when comparing the input and output of rewriteUnwrappedType. I actually didn't even see your second comment or your commit until after I had pushed mine and was adding my previous comment here. As you say, looks very similar, except I didn't give proper attention to the performance of this super critical piece of code ;) |
lol i mentioned this in my earlier comment (#738 (comment)), you should read more! :) but i consider it unnecessary. i don't think u'd be able to measure any difference because i know that the first thing String.equals() implementation does is check for identity and String is final so that check is trivially inlined by any compiler. (regarding only checking identity and not content, i've got client code that can generate a new string with the same content for good reason. and again this is a hotspot case. in the rare cases when there's actually a type change, chances are the string comparison aborts early in the loop so avoiding StringBuilder in the hotspot case seems reasonable. but yes, this is all a matter of taste at this level.) thanks! |
@JesusFreke,
It looks like this sample code:
smali/dexlib2/src/main/java/org/jf/dexlib2/rewriter/DexRewriter.java
Lines 58 to 60 in bf65e57
does not map arrays of
MyBlah
.is this true? or does dexlib2 dig down array types to get to the base type before invoking the type rewriter? thanks!
The text was updated successfully, but these errors were encountered: