Join GitHub today
GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together.Sign up
Pre-generate DynamicScope shapes at build time #5761
This PR pregenerates all DynamicScope subclasses we normally generate at runtime. The classes are included in the JRuby jar file so none of these classes are generated at runtime.
The logic here uses the max generated size as the max to pregenerate, resulting in no runtime generation happening. Currently, we generate up to 50-wide, so this PR currently generates 51 classes into JRuby.jar. Typical Ruby code will use only the smallest sizes, so this may be wasteful. The full set of 51 classes increases the size of my local jruby.jar by about 90k.
We may want to consider pregenerating fewer classes (if the size of the jar is important) as well as possibly generating fewer shapes overall (since there are diminishing returns to create e.g. a 50-wide scope class that's only used for one method).