
nick at ccl4
Oct 27, 2009, 3:07 AM
Post #2 of 9
(385 views)
Permalink
|
On Tue, Oct 27, 2009 at 01:29:40AM +0000, Zefram wrote: > The patch has one drawback that I'm aware of. Creating the rv2cv op > forces a ref stored in the package, as a space-saving representation of > a constant sub, to be upgraded to a full GV and CV. The preexisting code > carefully avoided forcing creation of a CV in this case. This causes two > test in t/op/gv.t, which are specifically looking for this behaviour, > to fail, so the patch marks them as TODO. It's not at all simple to > recover the space optimisation in the presence of the rv2cv-based logic. > The inlining of constant subs does still work, however. > > As far as I know, nothing else gets broken by the patch. All other > tests pass. My greatest suspicion of unintended breakage is around the > intuit_method() function, which I don't understand sufficiently to be > confident about. > > I'd really like to have package-independent lexical subroutine importation > fully working in 5.12. I'd really like *not* to loose that space saving though. That's a general memory performance regression, to allow a specialist new feature. I don't understand the tokeniser enough to quickly figure out a fix, and I'm unlikely to have time to in the next few months. Heck, I don't understand the tokeniser and op generation enough to figure out if this patch is safe, in that it doesn't have unintended side effects. > diff --git a/t/op/gv.t b/t/op/gv.t > index e04c2ca..f920113 100644 > --- a/t/op/gv.t > +++ b/t/op/gv.t > @@ -329,8 +329,11 @@ $::{oonk} = \"Value"; > is (ref $::{ga_shloip}, 'SCALAR', "Export of proxy constant as is"); > is (ref $::{oonk}, 'SCALAR', "Export doesn't affect original"); > is (eval 'ga_shloip', "Value", "Constant has correct value"); > -is (ref $::{ga_shloip}, 'SCALAR', > - "Inlining of constant doesn't change represenatation"); > +{ > + local $TODO = "ref-as-glob broken by rv2cv-based subroutine lookup"; > + is (ref $::{ga_shloip}, 'SCALAR', > + "Inlining of constant doesn't change represenatation"); > +} > > delete $::{ga_shloip}; > > @@ -433,7 +436,10 @@ sub non_dangling { > non_dangling(); > is (ref $::{oonk}, 'SCALAR', "Export doesn't affect original"); > is (eval 'zap', "Value", "Constant has correct value"); > -is (ref $::{zap}, 'SCALAR', "Exported target is also a PCS"); > +{ > + local $TODO = "ref-as-glob broken by rv2cv-based subroutine lookup"; > + is (ref $::{zap}, 'SCALAR', "Exported target is also a PCS"); > +} Nicholas Clark
|