Commit 3a3bb3f
fix: Hash::MultiValue + blib/arch — splice spill, deref slice, dclone hooks (#478)
* fix: Hash::MultiValue test failures — splice spill, deref slice, dclone hooks
Three bugs fixed:
1. JVM backend: splice with constant sub causes ASM frame crash
handleSpliceBuiltin left the first arg on the JVM operand stack
while evaluating remaining args. When those contained a function
call (constant sub), the blockDispatcher's GOTOs created
inconsistent stack depths at merge points. Fixed with register
spilling, matching handlePushOperator's existing pattern.
2. Interpreter backend: @$ref[@idx] = ... unsupported
The array slice assignment handler only supported @array[@idx]
with plain IdentifierNode. Added a branch to handle dereferenced
array refs using DEREF_ARRAY/DEREF_ARRAY_NONSTRICT opcodes.
3. Storable::dclone: shared refs from STORABLE_freeze hooks
dclone passed extra refs from STORABLE_freeze directly to
STORABLE_thaw without cloning them. Inside-out objects like
Hash::MultiValue ended up sharing internal arrays between
original and clone. Fixed by deep-cloning extra refs (indices 1+).
Generated with [Devin](https://cli.devin.ai/docs)
Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
* fix: create blib/arch in generated Makefile for -Mblib compatibility
The generated Makefile pure_all target only created blib/lib/
but not blib/arch/. The blib.pm pragma requires both directories
to exist (-d blib && -d blib/lib && -d blib/arch), so use blib
and -Mblib would die with Cannot find blib even in ...
This caused CPAN module test suites (e.g. HTTP::Thin) to fail when
they use open3 with -Mblib to verify modules load cleanly.
Add mkdir -p blib/arch to the pure_all target so the directory
always exists alongside blib/lib.
Generated with [Devin](https://cli.devin.ai/docs)
Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
* fix: JPERL_UNIMPLEMENTED=warn should only downgrade unimplemented features
The regex error catch block was downgrading ALL exceptions to warnings
when JPERL_UNIMPLEMENTED=warn was set, including real compilation errors
like "Invalid Unicode character name". Now only PerlJavaUnimplementedException
is downgraded to a warning; other regex errors remain fatal.
This fixes a hang in lib/croak.t where `qr/(?{})\N{}/;while(my($0)=0){}`
would continue past the \N{} error into an infinite while loop when
JPERL_UNIMPLEMENTED=warn was set by the test runner.
Generated with [Devin](https://cli.devin.ai/docs)
Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
* fix: reject my/state of global-only variables at compile time
Perl requires that forced-global variables ($_, @_, %_, $0, $1, $!,
$/, $^W, etc.) cannot be lexicalized with 'my' or 'state'. Previously
jperl silently allowed this, which could cause infinite loops when
my($0) returned truthy in a while condition.
Now emits: Can't use global $X in "my" (matching Perl's error message.
The check covers:
- Underscore variables: src/main/java/org/perlonjava/frontend/parser/OperatorParser.java, @_, %_
- Digit-only names: bash, , , ...
- Single punctuation names: , $/, , $;, $,, $., $|, etc.
- Caret/control variables: $^W, $^H, $^O, etc.
'our' and 'local' are unaffected (they correctly alias/localize globals).
Generated with [Devin](https://cli.devin.ai/docs)
Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
EOF
)
* fix: regex error handling regressions and Unicode var check
- RegexPreprocessor: use regexUnimplemented() (not regexError()) for
control verbs, (?@...), and lookbehind >255 so JPERL_UNIMPLEMENTED=warn
can downgrade them (fixes pat_rt_report.t: 196 -> 2397)
- RuntimeRegex: restructure catch block to distinguish
PerlJavaUnimplementedException (extends PerlCompilerException) from
real PerlCompilerException syntax errors. Wrap Java
PatternSyntaxException as unimplemented so it can be downgraded.
(fixes pat_advanced.t: 54 -> 63)
- RegexPreprocessor.handleCodeBlock: don't consume closing paren - let
handleParentheses consume it, matching the protocol used by all other
group handlers. Fixes code blocks causing "Unmatched (" errors.
(fixes pat.t: 239 -> 428)
- OperatorParser.isGlobalOnlyVariable: restrict single-char punctuation
check to ASCII (< 128) so Unicode characters that Java doesn't
recognize as letters aren't rejected.
(fixes uni/variables.t: 66803 -> 66880)
Generated with [Devin](https://cli.devin.ai/docs)
Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
* fix: regex preprocessing -- brace quantifier, hex escapes, NPE
- Fix handleQuantifier consuming regex metacharacters inside invalid
brace expressions (e.g., {(?>...)*} was consumed as a single literal
brace expression). Now only escapes the opening { and lets the main
loop process subsequent characters.
- Fix \x{...} hex escapes with non-hex characters to extract valid
hex prefix like Perl does (e.g., \x{9bq} -> 0x9B). Fixes fatal
crash in pat_advanced.t at line 321.
- Handle bare \xNN with non-hex chars (e.g., \xk -> \x00 + literal k)
instead of passing through to Java Pattern which rejects it.
- Fix NullPointerException when regex with (?{...}) code blocks fails
with JPERL_UNIMPLEMENTED=warn: set regex.patternString in catch
block and add null guard in preProcessRegex.
Test improvements:
pat_advanced.t: 63 -> 731 passing (+668)
pat.t: 428 -> 533 passing (+105)
Generated with [Devin](https://cli.devin.ai/docs)
Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
* docs: categorize all remaining regex test failures with priorities
Analyzed pat.t (99 failures + 666 blocked), pat_advanced.t (107 failures),
and pat_rt_report.t (77 failures) into 16 categories (A-P) with difficulty
ratings and priority recommendations.
Key findings:
- \p{isAlpha} alias crash blocks 666 pat.t tests (quick fix)
- Bug 41010 conditional+$ anchor accounts for 48 pat_rt_report.t failures
- $^N not updated = 20 pat_advanced.t failures
- \N{name} charnames = 25 pat_advanced.t failures
- (?{...}) code blocks = 46 failures (very hard, engine limitation)
Generated with [Devin](https://cli.devin.ai/docs)
Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
* fix: Unicode property aliases, Property=Value syntax, underscore group names
Three regex fixes that unblock 543 additional pat.t tests:
1. \p{isAlpha} POSIX-style aliases: make Is/is prefix stripping
case-insensitive, add Space/Alnum/Punct/White_Space aliases
to the switch statement
2. \p{Property=Value} syntax: split on '=' and pass property name
and value separately to ICU4J. Handle True/False/Yes/No values.
3. Named capture groups with underscores: Java regex only allows
[a-zA-Z][a-zA-Z0-9]* for group names but Perl allows \w+.
Encode underscores as "U95" in Java regex names, decode back
when accessing %+/%- hashes. Also handle \k<name> backrefs.
Test results:
- pat.t: 533/632 -> 1076/1298 (all 1298 now run, +543 passing)
- pat_advanced.t: 731/838 (unchanged)
- pat_rt_report.t: 2431/2508 (unchanged)
- uni/variables.t: 66880/66880 (unchanged)
- make: all unit tests pass
Generated with [Devin](https://cli.devin.ai/docs)
Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
* docs: update design doc -- pat.t fully unblocked, 1076/1298 passing
Generated with [Devin](https://cli.devin.ai/docs)
Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
* fix: user-defined Unicode properties, regex cache, and unimplemented sequence handling
Major fixes:
- Refactor user-defined property resolution to use UnicodeSet directly
instead of Java regex patterns, fixing properties that use +utf8::
references (e.g., +utf8::Uppercase, &utf8::ASCII)
- Cache user-defined property sub results (matching Perl behavior of
calling each property sub only once)
- Fix regex cache preventing deferred property recompilation by evicting
stale entries in ensureCompiledForRuntime()
- Add Titlecase/TitlecaseLetter/Lt property aliases
- Make (?&name) named group recursion downgradable with JPERL_UNIMPLEMENTED=warn
- Make (?digit) numbered recursion downgradable (regexError -> regexUnimplemented)
Test improvements:
- pat_advanced.t: 731/838 -> 1308/1625 (+577 passes, +787 more tests run)
- regexp_unicode_prop.t: 1000/1110 -> 1017/1096 (+17 passes, above baseline)
- pat.t: 1076/1298 -> 1077/1298 (stable, +1 pass)
Generated with [Devin](https://cli.devin.ai/docs)
Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
* docs: update design doc with new problems Q/R/S and progress tracking
- Add categories Q (package-scoped user properties), R (invalid \pX),
S (/i caseless flag for user property subs)
- Update test pass rates: pat_advanced 1308/1625, regexp_unicode_prop 1017/1096
- Update early termination table with new crash points
- Document fixes 8-13 in progress tracking
- Update priority recommendations
Generated with [Devin](https://cli.devin.ai/docs)
Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
* fix: handle Is/In-prefixed Unicode properties with non-uppercase chars
- Relax user-defined property regex patterns to accept any character
after Is/In prefix (e.g., Is_q, Is_foo), matching Perl behavior
where ANY Is/In-prefixed name triggers user-defined property lookup
- Clamp code points > U+10FFFF to JVM limit instead of throwing
fatal errors (Perl supports 31-bit code points, JVM does not)
- Fixes pat_advanced.t crash at test 1625 (Is_q) and 1639 (Is_31_Bit_Super)
- pat_advanced.t: 1324/1678 (was 1308/1625, +16 passed, all tests reached)
Generated with [Devin](https://cli.devin.ai/docs)
Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
---------
Co-authored-by: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>1 parent e6849c6 commit 3a3bb3f
13 files changed
Lines changed: 903 additions & 124 deletions
File tree
- dev/design
- src/main
- java/org/perlonjava
- backend
- bytecode
- jvm
- core
- frontend/parser
- runtime
- perlmodule
- regex
- runtimetypes
- perl/lib/ExtUtils
Large diffs are not rendered by default.
Lines changed: 45 additions & 22 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1189 | 1189 | | |
1190 | 1190 | | |
1191 | 1191 | | |
1192 | | - | |
1193 | | - | |
1194 | | - | |
1195 | | - | |
| 1192 | + | |
| 1193 | + | |
1196 | 1194 | | |
1197 | | - | |
1198 | | - | |
| 1195 | + | |
| 1196 | + | |
| 1197 | + | |
| 1198 | + | |
| 1199 | + | |
| 1200 | + | |
| 1201 | + | |
| 1202 | + | |
| 1203 | + | |
| 1204 | + | |
| 1205 | + | |
| 1206 | + | |
| 1207 | + | |
| 1208 | + | |
| 1209 | + | |
| 1210 | + | |
| 1211 | + | |
| 1212 | + | |
| 1213 | + | |
| 1214 | + | |
| 1215 | + | |
| 1216 | + | |
| 1217 | + | |
| 1218 | + | |
| 1219 | + | |
| 1220 | + | |
| 1221 | + | |
| 1222 | + | |
| 1223 | + | |
| 1224 | + | |
1199 | 1225 | | |
1200 | | - | |
1201 | | - | |
1202 | | - | |
1203 | | - | |
1204 | | - | |
1205 | | - | |
1206 | | - | |
| 1226 | + | |
| 1227 | + | |
| 1228 | + | |
| 1229 | + | |
| 1230 | + | |
| 1231 | + | |
| 1232 | + | |
| 1233 | + | |
| 1234 | + | |
| 1235 | + | |
| 1236 | + | |
1207 | 1237 | | |
1208 | | - | |
1209 | | - | |
1210 | | - | |
1211 | | - | |
1212 | | - | |
1213 | | - | |
1214 | | - | |
1215 | | - | |
1216 | | - | |
| 1238 | + | |
| 1239 | + | |
1217 | 1240 | | |
1218 | 1241 | | |
1219 | 1242 | | |
| |||
Lines changed: 19 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
534 | 534 | | |
535 | 535 | | |
536 | 536 | | |
| 537 | + | |
537 | 538 | | |
| 539 | + | |
| 540 | + | |
| 541 | + | |
| 542 | + | |
| 543 | + | |
| 544 | + | |
| 545 | + | |
| 546 | + | |
| 547 | + | |
| 548 | + | |
| 549 | + | |
538 | 550 | | |
539 | 551 | | |
| 552 | + | |
| 553 | + | |
| 554 | + | |
| 555 | + | |
| 556 | + | |
| 557 | + | |
| 558 | + | |
540 | 559 | | |
541 | 560 | | |
542 | 561 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
33 | 33 | | |
34 | 34 | | |
35 | 35 | | |
36 | | - | |
| 36 | + | |
37 | 37 | | |
38 | 38 | | |
39 | 39 | | |
| |||
48 | 48 | | |
49 | 49 | | |
50 | 50 | | |
51 | | - | |
| 51 | + | |
52 | 52 | | |
53 | 53 | | |
54 | 54 | | |
| |||
Lines changed: 68 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
252 | 252 | | |
253 | 253 | | |
254 | 254 | | |
| 255 | + | |
| 256 | + | |
| 257 | + | |
| 258 | + | |
| 259 | + | |
| 260 | + | |
| 261 | + | |
| 262 | + | |
| 263 | + | |
| 264 | + | |
| 265 | + | |
| 266 | + | |
| 267 | + | |
| 268 | + | |
| 269 | + | |
| 270 | + | |
| 271 | + | |
| 272 | + | |
| 273 | + | |
| 274 | + | |
| 275 | + | |
| 276 | + | |
| 277 | + | |
| 278 | + | |
| 279 | + | |
| 280 | + | |
| 281 | + | |
| 282 | + | |
| 283 | + | |
| 284 | + | |
| 285 | + | |
| 286 | + | |
| 287 | + | |
| 288 | + | |
| 289 | + | |
| 290 | + | |
| 291 | + | |
| 292 | + | |
| 293 | + | |
| 294 | + | |
| 295 | + | |
| 296 | + | |
| 297 | + | |
| 298 | + | |
| 299 | + | |
| 300 | + | |
| 301 | + | |
| 302 | + | |
| 303 | + | |
| 304 | + | |
| 305 | + | |
| 306 | + | |
| 307 | + | |
| 308 | + | |
| 309 | + | |
255 | 310 | | |
256 | 311 | | |
257 | 312 | | |
| |||
260 | 315 | | |
261 | 316 | | |
262 | 317 | | |
263 | | - | |
| 318 | + | |
| 319 | + | |
| 320 | + | |
| 321 | + | |
| 322 | + | |
| 323 | + | |
| 324 | + | |
| 325 | + | |
| 326 | + | |
| 327 | + | |
| 328 | + | |
| 329 | + | |
| 330 | + | |
264 | 331 | | |
265 | 332 | | |
266 | 333 | | |
| |||
Lines changed: 6 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
548 | 548 | | |
549 | 549 | | |
550 | 550 | | |
551 | | - | |
552 | | - | |
553 | | - | |
| 551 | + | |
| 552 | + | |
| 553 | + | |
| 554 | + | |
| 555 | + | |
| 556 | + | |
554 | 557 | | |
555 | 558 | | |
556 | 559 | | |
| |||
Lines changed: 58 additions & 9 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
161 | 161 | | |
162 | 162 | | |
163 | 163 | | |
164 | | - | |
165 | | - | |
166 | | - | |
167 | | - | |
168 | | - | |
| 164 | + | |
169 | 165 | | |
170 | | - | |
171 | | - | |
172 | | - | |
| 166 | + | |
| 167 | + | |
173 | 168 | | |
174 | | - | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
| 193 | + | |
| 194 | + | |
| 195 | + | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
| 203 | + | |
| 204 | + | |
| 205 | + | |
| 206 | + | |
| 207 | + | |
| 208 | + | |
| 209 | + | |
| 210 | + | |
| 211 | + | |
| 212 | + | |
| 213 | + | |
| 214 | + | |
| 215 | + | |
| 216 | + | |
| 217 | + | |
| 218 | + | |
| 219 | + | |
| 220 | + | |
| 221 | + | |
| 222 | + | |
| 223 | + | |
175 | 224 | | |
0 commit comments