File tree 4 files changed +63
-3
lines changed
4 files changed +63
-3
lines changed Original file line number Diff line number Diff line change @@ -119,3 +119,8 @@ Revision history for Perl extension Want.
119
119
0.24 Tue 2 Dec 2014 10:22:39 GMT
120
120
- Accommodate another bleadperl change. Patch provided by Father Chrysostomos at
121
121
https://rt.cpan.org/Public/Bug/Display.html?id=100626
122
+
123
+ 0.25 Wed 10 Dec 2014 19:31:03 GMT
124
+ - Add support for the new OP_MULTIDEREF
125
+ Perl has a new op, added as a performance optimisation in fedf30e1c349130b23648c022f5f3cb4ad7928f3,
126
+ to represent a sequence of array/hash dereferences. This patch adds support for the new op.
Original file line number Diff line number Diff line change 1
1
-----------------------------------------------------------------------------
2
- | Want v0.24 - Robin Houston, 2014-12-02
2
+ | Want v0.25 - Robin Houston, 2014-12-10
3
3
-----------------------------------------------------------------------------
4
4
5
5
For full documentation, see the POD included with the module.
Original file line number Diff line number Diff line change @@ -12,7 +12,7 @@ our @ISA = qw(Exporter DynaLoader);
12
12
13
13
our @EXPORT = qw( want rreturn lnoreturn) ;
14
14
our @EXPORT_OK = qw( howmany wantref) ;
15
- our $VERSION = ' 0.24 ' ;
15
+ our $VERSION = ' 0.25 ' ;
16
16
17
17
bootstrap Want $VERSION ;
18
18
@@ -128,7 +128,8 @@ sub howmany () {
128
128
}
129
129
130
130
sub wantref {
131
- my $n = parent_op_name(bump_level(@_ , 1));
131
+ my $level = bump_level(@_ , 1);
132
+ my $n = parent_op_name($level );
132
133
if ($n eq ' rv2av' ) {
133
134
return " ARRAY" ;
134
135
}
@@ -147,6 +148,9 @@ sub wantref {
147
148
elsif ($n eq ' method_call' ) {
148
149
return ' OBJECT' ;
149
150
}
151
+ elsif ($n eq ' multideref' ) {
152
+ return first_multideref_type($level );
153
+ }
150
154
else {
151
155
return " " ;
152
156
}
Original file line number Diff line number Diff line change @@ -543,6 +543,57 @@ I32 uplevel;
543
543
PUSHs (sv_2mortal (newSVpv (retval , 0 )));
544
544
}
545
545
546
+ #ifdef OPpMULTIDEREF_EXISTS
547
+ char *
548
+ first_multideref_type (uplevel )
549
+ I32 uplevel ;
550
+ PREINIT :
551
+ OP * r ;
552
+ OP * o = parent_op (uplevel , & r );
553
+ UNOP_AUX_item * items ;
554
+ UV actions ;
555
+ bool repeat ;
556
+ char * retval ;
557
+ PPCODE :
558
+ if (o -> op_type != OP_MULTIDEREF ) Perl_croak (aTHX_ "Not a multideref op!" );
559
+ items = cUNOP_AUXx (o )-> op_aux ;
560
+ actions = items -> uv ;
561
+
562
+ do {
563
+ repeat = FALSE;
564
+ switch (actions & MDEREF_ACTION_MASK ) {
565
+ case MDEREF_reload :
566
+ actions = (++ items )-> uv ;
567
+ repeat = TRUE;
568
+ continue ;
569
+
570
+ case MDEREF_AV_pop_rv2av_aelem :
571
+ case MDEREF_AV_gvsv_vivify_rv2av_aelem :
572
+ case MDEREF_AV_padsv_vivify_rv2av_aelem :
573
+ case MDEREF_AV_vivify_rv2av_aelem :
574
+ case MDEREF_AV_padav_aelem :
575
+ case MDEREF_AV_gvav_aelem :
576
+ retval = "ARRAY" ;
577
+ break ;
578
+
579
+ case MDEREF_HV_pop_rv2hv_helem :
580
+ case MDEREF_HV_gvsv_vivify_rv2hv_helem :
581
+ case MDEREF_HV_padsv_vivify_rv2hv_helem :
582
+ case MDEREF_HV_vivify_rv2hv_helem :
583
+ case MDEREF_HV_padhv_helem :
584
+ case MDEREF_HV_gvhv_helem :
585
+ retval = "HASH" ;
586
+ break ;
587
+
588
+ default :
589
+ Perl_croak (aTHX_ "Unrecognised OP_MULTIDEREF action (%lu)!" , actions & MDEREF_ACTION_MASK );
590
+ }
591
+ } while (repeat );
592
+
593
+ EXTEND (SP , 1 );
594
+ PUSHs (sv_2mortal (newSVpv (retval , 0 )));
595
+
596
+ #endif
546
597
547
598
I32
548
599
want_count (uplevel )
You can’t perform that action at this time.
0 commit comments