Add CPAN Phase 1-3: Core modules and IPC::Open2/Open3#313
Merged
Conversation
Phase 3 CPAN work: - Import IPC::Open2.pm and IPC::Open3.pm from perl5 tree - Implement pipe() autovivification like open() does - Add fcntl() and ioctl() operators (stub + native via jnr-posix) - Fix prototype parsing for typeglob arguments (use =~ precedence) - Fix RuntimeScalar.getIntRef()/getDoubleRef() to use this.hashCode() instead of value.hashCode() - fixes NPE when comparing \undef and makes reference numeric values consistent with other types The reference fix resolves the crash: `\$_[0] == \undef` which is used in IPC::Open3.pm to detect literal undef arguments. Generated with [Devin](https://cli.devin.ai/docs) Co-Authored-By: Devin <noreply@cognition.ai>
Generated with [Devin](https://cli.devin.ai/docs) Co-Authored-By: Devin <noreply@cognition.ai>
- Add IPCOpen3.java XS module loaded via XSLoader - Create ProcessInputHandle and ProcessOutputHandle for process I/O - Custom Open2.pm and Open3.pm wrappers (not imported from perl5) - Works on both Windows and POSIX (uses WaitpidOperator on Windows) - Supports separate stdout/stderr handles in open3 - Remove IPC::Open2/Open3 from sync.pl config to prevent overwrite Generated with [Devin](https://cli.devin.ai/docs) Co-Authored-By: Devin <noreply@cognition.ai>
Generated with [Devin](https://cli.devin.ai/docs) Co-Authored-By: Devin <noreply@cognition.ai>
Generated with [Devin](https://cli.devin.ai/docs) Co-Authored-By: Devin <noreply@cognition.ai>
Generated with [Devin](https://cli.devin.ai/docs) Co-Authored-By: Devin <noreply@cognition.ai>
pipe() should fail when passed a reference to a scalar. This fixes io/pvbm.t tests 6-7. Net change: +1 test passing (26/28 -> 27/28) - Tests 4,5 now pass (pipe with PVBM works) - Tests 6,7 now pass (pipe with reference fails) - Test 16 now fails (side effect: $pvbm becomes filehandle) Generated with [Devin](https://cli.devin.ai/docs) Co-Authored-By: Devin <noreply@cognition.ai>
This replaces MethodHandle-based invocation with a type-safe functional interface, fixing MethodHandle conversion errors that occurred at runtime. Key changes: - Create PerlSubroutine @FunctionalInterface with apply(RuntimeArray, int) - EmitterMethodCreator: generated classes implement PerlSubroutine - InterpretedCode: implements PerlSubroutine interface - RuntimeCode: add subroutine field, prefer it over methodHandle in apply() - SubroutineParser: set subroutine field for deferred compilation - callCached(): prefer subroutine.apply() in inline cache The methodHandle field is kept for backward compatibility with PerlModuleBase which still uses it to preserve caller() stack behavior. comp/require.t now passes 1743/1747 tests with no MethodHandle conversion errors. Generated with [Devin](https://cli.devin.ai/docs) Co-Authored-By: Devin <noreply@cognition.ai>
Since we now set the subroutine field (PerlSubroutine interface), the methodHandle lookups are no longer needed for deferred compilation. Both JVM-compiled and InterpretedCode paths now use subroutine directly. Generated with [Devin](https://cli.devin.ai/docs) Co-Authored-By: Devin <noreply@cognition.ai>
Generated with [Devin](https://cli.devin.ai/docs) Co-Authored-By: Devin <noreply@cognition.ai>
- InternalPipeHandle.doRead(): Always use polling instead of blocking reads PipedInputStream.read() uses Object.wait() which does not respond to Thread.interrupt(), so we poll with available() and short sleeps - InternalPipeHandle.syswrite(): Add implementation for system-level writes Previously missing, caused syswrite to fail on pipes - InternalPipeHandle.sysread(): Use same polling approach This fixes op/readline.t tests that use pipe() with alarm() to test interrupted reads. Test results improved from 9/36 to 19/36 passing. Generated with [Devin](https://cli.devin.ai/docs) Co-Authored-By: Devin <noreply@cognition.ai>
- readline() on undefined filehandle now warns and returns undef instead of throwing exception (matches Perl behavior) - defined *$var now works under strict refs without throwing error (Perl allows this as a way to probe glob existence) - Added DEFINED_GLOB opcode (386) for interpreter backend - Added GlobalVariable.definedGlob() to check glob slots without auto-vivifying - Added RuntimeGlob.defined() to check if any slot has content Test improvements: - op/readline.t: 19 -> 23 passing tests - Tests 26-27 now pass (autovivification checks) Generated with [Devin](https://cli.devin.ai/docs) Co-Authored-By: Devin <noreply@cognition.ai>
The fix for 'defined *$var' under strict refs incorrectly checked
if the scalar VALUE was defined. In Perl, 'defined *glob' returns
true if the glob exists (any slot is initialized), not if the
scalar value is defined.
Changes:
- GlobalVariable.definedGlob(): Check slot existence, not value definedness
- RuntimeGlob.defined(): Same fix for glob references
- Recognize numeric capture variables ($1, $42, etc.) algorithmically
- Initialize additional magic variables: ${^UTF8LOCALE}, ${^WARNING_BITS},
${^UTF8CACHE}, $[, $~, $%, $1-$9
This restores op/magic.t from 129 to 170 passing tests.
Generated with [Devin](https://cli.devin.ai/docs)
Co-Authored-By: Devin <noreply@cognition.ai>
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
Implements CPAN client support phases 1-3, adding essential Perl modules for CPAN compatibility.
Phase 1: Low-hanging fruit
Phase 2: Archive/Network modules
Phase 3: Process Control
PerlSubroutine Functional Interface
Fixes MethodHandle conversion errors by replacing MethodHandle-based subroutine
invocation with a type-safe
PerlSubroutinefunctional interface:PerlSubroutineinterfaceInterpretedCodeimplementsPerlSubroutineinterfaceRuntimeCode.apply()preferssubroutine.apply()overmethodHandle.invoke()callCached) updated to use functional interfaceBug fixes
\$x == \undefno longer crashes (NPE fix)\10-\377now work correctly::in package variables@{${...}}nested dereference in push/unshiftNew files
IPCOpen3.java- XS module for open2/open3ProcessInputHandle.java,ProcessOutputHandle.java- process stream I/OSysHostname.java- XS module for Sys::HostnamePerlSubroutine.java- functional interface for subroutine dispatchTest plan
./gradlew testpassesGenerated with Devin