Commit bf00f44
fix(B,Sub::Name): honor Sub::Name-assigned CV names in B::GV->NAME
B::svref_2object($cv)->GV->NAME previously returned "__ANON__" for CVs
renamed via Sub::Name::subname or Sub::Util::set_subname, because B.pm
required `defined &{$fqn}` to trust the name. Real-Perl XS Sub::Name
updates the CV's CvGV/CvNAME_HEK directly and B reads those fields
without consulting any stash entry, so the name is honored even when
the sub was never installed as a glob.
The `defined &{$fqn}` check was originally added to handle stash
deletion/clearing (op/stash.t, uni/stash.t), so it cannot be removed
outright. Instead, track an explicit `explicitlyRenamed` flag on
RuntimeCode that is set by Sub::Name::subname and Sub::Util::set_subname,
and have B.pm trust the name whenever that flag is set.
- RuntimeCode: add `explicitlyRenamed` field
- SubName.java / SubUtil.java: set the flag when renaming
- SubName: expose private helper `Sub::Name::_is_renamed($cv)`
- B.pm: consult the flag before falling back to the stash check
Impact on Sub-Name-0.28 t/exotic_names.t: 1038 more tests now pass
(0 -> 1038 pass out of 1560). Remaining 522 failures are unrelated to
Sub::Name and stem from stash-aliasing semantics
(`*palatable:: = *{"aliased::native::..."}`).
No regressions in op/stash.t / uni/stash.t (75/105 before and after).
Generated with [Devin](https://cli.devin.ai/docs)
Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>1 parent a97176f commit bf00f44
5 files changed
Lines changed: 47 additions & 3 deletions
File tree
- src/main
- java/org/perlonjava
- core
- runtime
- perlmodule
- runtimetypes
- perl/lib
| 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: 27 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2 | 2 | | |
3 | 3 | | |
4 | 4 | | |
| 5 | + | |
| 6 | + | |
5 | 7 | | |
6 | 8 | | |
7 | 9 | | |
| |||
35 | 37 | | |
36 | 38 | | |
37 | 39 | | |
| 40 | + | |
| 41 | + | |
38 | 42 | | |
39 | 43 | | |
40 | 44 | | |
| |||
81 | 85 | | |
82 | 86 | | |
83 | 87 | | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
84 | 91 | | |
85 | 92 | | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
86 | 113 | | |
Lines changed: 3 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
142 | 142 | | |
143 | 143 | | |
144 | 144 | | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
145 | 148 | | |
146 | 149 | | |
147 | 150 | | |
Lines changed: 6 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
343 | 343 | | |
344 | 344 | | |
345 | 345 | | |
| 346 | + | |
| 347 | + | |
| 348 | + | |
| 349 | + | |
| 350 | + | |
| 351 | + | |
346 | 352 | | |
347 | 353 | | |
348 | 354 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
139 | 139 | | |
140 | 140 | | |
141 | 141 | | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
142 | 146 | | |
143 | | - | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
144 | 152 | | |
145 | 153 | | |
146 | 154 | | |
| |||
0 commit comments