Fix interpreter eval regressions (JPERL_EVAL_USE_INTERPRETER=1)#233
Merged
Conversation
afeb04a to
fde7b02
Compare
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
Fixes regressions in the bytecode interpreter's
eval STRINGfunctionality compared to the JVM compiler. All changes ensure the interpreter produces identical results to the JVM compiler whenJPERL_EVAL_USE_INTERPRETER=1is set.Fixes
CompileAssignment.java
chop/chompused as lvalues now throwCan't modify chop in scalar assignment(matches JVM compiler)= 'x') now returns the global variable lvalue (not the rhs copy), so($_ = 'x') =~ s///correctly modifies$_in-placeCompileBinaryOperator.java
!~ s///rand!~ y///rerror checks matching JVMEmitRegex.handleNotBindRegex=~/!~in the generic fall-through path, force SCALAR context soCALL_SUB(e.g.use constant quire => qr/.../) emitsctx=SCALARand returns a scalarCompileOperator.java
<>diamond operator support viaREADLINEopcode routing toDiamondIOreplaceRegex/matchRegexbound string (element from=~binding) compiled in SCALAR contextm//(no=~binding) now matches against$_instead of returning the regex object unusedOpcodes.java
LOAD_VSTRING(337): loads v-string literals withVSTRINGtype, sorequire v5.5.640works ineval STRINGLIST_TO_SCALAR→LIST_TO_COUNT(count semantics, opcode 60)LIST_TO_SCALAR(338): returns last element (correct Perl list-in-scalar semantics)BytecodeInterpreter.java
LOAD_VSTRINGand newLIST_TO_SCALARopcodesHASH_KEYS/HASH_VALUES: call.keys()/.values()onRuntimeBaseinstead of blindly casting toRuntimeHash, sokeys undefthrows the proper Perl errorOpcodeHandlerExtended.java
executeReadline: routes non-glob scalar filehandles toDiamondIO.readlinefor the<>operatorInterpretedCode.java
LIST_TO_COUNT,LIST_TO_SCALAR, andLOAD_VSTRINGTests fixed
op/chop.t: 137/137 ✅re/subst.t: 183/183 ✅ (was 182)re/substT.t: 183/183 ✅re/subst_wamp.t: 183/183 ✅op/tr.t: 277/277 ✅op/dor.t: 29/29 ✅op/ver.t: 54/54 ✅op/smartkve.t: 6/6 ✅ (was 4)op/index.t: 414/415 (improved from 413)