Skip to content

fix: Improve interpreter eval mode operator support (320→341 tests)#218

Merged
fglock merged 4 commits into
masterfrom
fix/interpreter-eval-operators
Feb 21, 2026
Merged

fix: Improve interpreter eval mode operator support (320→341 tests)#218
fglock merged 4 commits into
masterfrom
fix/interpreter-eval-operators

Conversation

@fglock
Copy link
Copy Markdown
Owner

@fglock fglock commented Feb 20, 2026

Summary

Improved interpreter eval mode from 320/353 to 341/353 passing tests (+21 tests, +6.6%)

Target was 346/353 (5 more tests needed)

Changes

1. Added Missing Operators (320 → 323, +3)

  • Added process control operators: getppid, getpgrp, setpgrp, getpriority, atan2
  • Created handlers in interpreter eval mode

2. Fixed ClassCastException (323 → 339, +16)

  • Root cause: Operators expecting RuntimeList received scalars/other types
  • Solution: Ensured list context evaluation with SCALAR_TO_LIST wrapping
  • Fixed 18 operators: chmod, unlink, utime, rename, link, readlink, umask, getc, fileno, qx, system, caller, each, pack, vec, localtime, gmtime, crypt
  • Created MiscOpcodeHandler for context-sensitive operators

3. Fixed Operator Validation (339 → 340, +1)

  • chmod: Return 0 instead of throwing on insufficient arguments (Perl-compatible)

4. Fixed crypt Determinism (340 → 341, +1)

  • Pad 1-character salt with '.' for deterministic results
  • Ensures crypt $n, $n returns same value each call

Infrastructure Improvements

  • Updated opcode generator (generate_opcode_handlers.pl) for refactored BytecodeCompiler
  • Generated ScalarUnaryOpcodeHandler and ScalarBinaryOpcodeHandler (43 opcodes)
  • Added opcodes 241-301 for misc operators

Testing

JPERL_EVAL_USE_INTERPRETER=1 perl dev/tools/perl_test_runner.pl perl5_t/t/op/lex_assign.t
# Result: 341/353 passing

Remaining Issues (12 tests)

  • 2 tests: push/unshift (need opcode implementation)
  • 2 tests: chop/chomp (readonly modification)
  • 2 tests: select (ClassCastException)
  • 1 test: each %h (variable scope in eval)
  • 1 test: setpgrp (validation - defaults to 0,0)
  • 1 test: split (ClassCastException)
  • 1 test: warn (CODE reference)
  • 1 test: %$href (hash dereference)
  • 1 test: DESTROY mechanism

Files Modified

  • Opcodes.java - Added opcodes 241-301
  • BytecodeInterpreter.java - Added MiscOpcodeHandler dispatch
  • CompileOperator.java - Added operator compilation
  • MiscOpcodeHandler.java - New handler for misc operators
  • ScalarUnaryOpcodeHandler.java, ScalarBinaryOpcodeHandler.java - Generated
  • Operator.java - Fixed chmod validation
  • Crypt.java - Fixed salt padding
  • generate_opcode_handlers.pl - Updated for refactored code

🤖 Generated with Claude Code

fglock and others added 4 commits February 20, 2026 23:35
- Updated opcode generator to use bytecodeCompiler prefix
- Added 18 miscellaneous operators as manual opcodes (241-258)
- Created MiscOpcodeHandler for context-sensitive operators
- Added handlers to BytecodeInterpreter
- Generated scalar unary/binary handlers via generator tool

Operators added: chmod, unlink, utime, rename, link, readlink, umask,
getc, fileno, qx, system, caller, each, pack, vec, localtime, gmtime, crypt

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Convert operands to list context and wrap with SCALAR_TO_LIST to prevent
ClassCastException errors in MiscOpcodeHandler.

Progress: 323 → 339 tests passing (+16)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Fix chmod to return 0 instead of throwing on insufficient args
- Fix crypt to pad 1-char salt with '.' for deterministic results
- Improve EACH handler to accept container directly

Progress: 339 → 341 tests passing (+2)
Target: 346/353 (need +5 more)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Added report showing progress from 320 to 341 tests passing (+21 tests).

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@fglock fglock merged commit 1ed88fc into master Feb 21, 2026
2 checks passed
@fglock fglock deleted the fix/interpreter-eval-operators branch February 21, 2026 07:19
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

Successfully merging this pull request may close these issues.

1 participant