Conversation
When the JVM bytecode verifier rejects a generated class (e.g. due to uninitialized local variable slots in complex subroutines), catch VerifyError alongside MethodTooLargeException and compile the AST to interpreter bytecode instead. This unblocks ExifTool.pm module loading which triggers VerifyError in anon787 (the module body with 22 captured hash variables). Generated with [Devin](https://cli.devin.ai/docs) Co-Authored-By: Devin <noreply@cognition.ai>
…t modifier my
Three fixes for the eval interpreter catchup:
1. Pass EmitterContext to BytecodeCompiler.compile() so interpreter fallback
inherits the correct package context. Unqualified sub calls now resolve
in the correct package instead of main::.
2. Handle delete with arrow dereference ($$ref{key} parsed as $ref->{key})
in the interpreter bytecode compiler. Previously fell through to
unimplemented slow path.
3. Fix 'my $x = expr if COND' in void context: extract the my declaration
before the short-circuit jump so the variable is always initialized to
undef, even when the condition is false.
Also update SubroutineParser to update placeholder in-place for
InterpretedCode subs, ensuring hash copies see the compiled code.
Generated with [Devin](https://cli.devin.ai/docs)
Co-Authored-By: Devin <noreply@cognition.ai>
4 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Relates to #93
This branch contains a series of fixes to bring the bytecode interpreter closer to full compatibility with the JVM backend, focused on enabling ExifTool to run correctly.
Key fixes in this PR:
compileToInterpreter()now passesEmitterContexttoBytecodeCompiler.compile()so unqualified sub calls resolve in the correct packagedelete $$ref{key}support — Arrow dereference handling in the interpreter's delete compiler (was hitting unimplemented slow path)my $x = expr if CONDfix — VOID context path inEmitLogicalOperatornow extractsmydeclarations before the short-circuit jump, preventing Java null NPE when condition is falselocal *globassignment — Fixed restore behavior when glob.set() aliases slotsExifTool test results:
Before: Only test 1 passed, tests crashed on VerifyError
After: Tests 1, 4, 5, 7-15 pass (15 of 17 tests before VerboseInfo crash)
Test plan
./gradlew testpasses (all unit tests)my $x = expr if CONDcorrectly initializes $x to undef when condition is falsedelete $$ref{key}works in interpreter modeGenerated with Devin