Skip to content
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

Automatic class splitting #942

Open
rahulmutt opened this issue Jan 31, 2019 · 3 comments
Open

Automatic class splitting #942

rahulmutt opened this issue Jan 31, 2019 · 3 comments

Comments

@rahulmutt
Copy link
Member

When you have really large source files (2K+ lines), there's a chance that the generated class will be so huge that the constant pool size will exceed the 65,535 size limit. The compiler should change its code generation to avoid such problem - perhaps by shifting static methods definitions to individual classes instead of putting all the implementations into the Module class.

@rahulmutt
Copy link
Member Author

I've tried the mentioned suggestion and it made very little difference for the particular example I was working on. It turns out that the more general solution to this problem is to distribute constants more deeply in the generated classes. What's happening is that all the classes are being initialized inside the module class itself when they can be instantiated in the required closures that are demanded by the user.

By distributing class constants this way, we avoid hitting the classfile limits and avoid having to do workaround patches in packages like pandoc.

@jneira
Copy link
Collaborator

jneira commented Feb 1, 2019

Would it fix errors with too big methods?

@rahulmutt
Copy link
Member Author

Nope, which is why this is a separate issue. Overflowing the constant pool is a serious problem since the entire class file is considered invalid and will cause issues with tools like Proguard. Overflowing the bytecode limit is not as much of a problem - the bytecode size can be specified in a Word32 so the classfile is "valid" but the method itself will fail verification when called.

@rahulmutt rahulmutt pinned this issue Apr 23, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants