-
Notifications
You must be signed in to change notification settings - Fork 173
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Java: create junk objects #187
Comments
📝 This was fixed completely in ANTLR 4. For ANTLR 3, you can avoid the rewrite overhead in many placed by using AST operators instead. The // This code:
ACCESS_SPEC -> SIMPLE_NAME[$ACCESS_SPEC]
// Is the same as this code (but this one doesn't have the rewriter overhead):
ACCESS_SPEC<type=SIMPLE_NAME> The specific templates affected are |
I do not understand - If I rewrite this code as you say then this must worked in Java or not? |
@Enyby In the current release of ANTLR 3, only the C# target will allow you to do that. The Java target would support it only if you modify the code generation templates I mentioned above. |
I translate this file https://github.com/JesusFreke/smali/blob/master/smali/src/main/antlr/smaliParser.g
And get next Java code:
As you see it create many new object RewriteRuleTokenStream but use only one from it.
It is waste memory and cause run of garbage collector. This is slow down work parser.
For solve this issue need rewrite code to lazy init.
For example:
The text was updated successfully, but these errors were encountered: