Methods that compile to more than 32 KB of bytecode cannot be compiled
----------------------------------------------------------------------
Key: JANINO-115
URL:
http://jira.codehaus.org/browse/JANINO-115 Project: Janino
Issue Type: Bug
Reporter: Matt Fowles
Assignee: Arno Unkrig
Attachments: wide-branches.patch
Methods that compile to more than 32 KB of bytecode cannot be compiled.
The attached patch both implements and tests this behavior. The strategy is as follows:
When a branch requires >32K jump, it expands performing a negated jump as follows:
{code:title=Unexpanded}
[if cond offset]
{code}
expands to
{code:title=Expanded}
[if !cond skip_goto]
[GOTO_W offset]
{code}
\\
\\
\\
As a concrete example,
{code:title=Unexpanded}
IFGT offset
{code}
becomes
{code:title=Expanded}
IFLE 8
GOTO_W offset
{code}
This requires that branches be allowed to change the size of bytecode when relocate() is called. To account for this, in CodeContext the methods fixup() and relocate() are made private, and a public method fixUpAndRelocate() is added.
The fixUpAndRelocate() method handles check calling fixUpAndRelocate() in a loop while the branches stabilize. A loop is required because it is theoretically possible for the expansion of a later branch to push an earlier branch over the 32K limit and cause it to switch modes, which would then require it to grow, which could trigger an earlier branch to need to expand... In practice, the loop will almost always run 1 or 2 iterations (depending on whether anything needed to grow at all).
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://jira.codehaus.org/secure/Administrators.jspa-
For more information on JIRA, see:
http://www.atlassian.com/software/jira
---------------------------------------------------------------------
To unsubscribe from this list, please visit:
http://xircles.codehaus.org/manage_email