| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package B::Utils::OP; |
|
2
|
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
require 5.006; |
|
4
|
1
|
|
|
1
|
|
4404
|
use Carp 'croak'; |
|
|
1
|
|
|
|
|
2
|
|
|
|
1
|
|
|
|
|
75
|
|
|
5
|
1
|
|
|
1
|
|
6
|
use strict; |
|
|
1
|
|
|
|
|
2
|
|
|
|
1
|
|
|
|
|
31
|
|
|
6
|
1
|
|
|
1
|
|
4
|
use warnings; |
|
|
1
|
|
|
|
|
2
|
|
|
|
1
|
|
|
|
|
28
|
|
|
7
|
1
|
|
|
1
|
|
5
|
use B::Utils (); |
|
|
1
|
|
|
|
|
1
|
|
|
|
1
|
|
|
|
|
154
|
|
|
8
|
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
our @ISA = 'Exporter'; |
|
10
|
|
|
|
|
|
|
require Exporter; |
|
11
|
|
|
|
|
|
|
our $VERSION = '0.25'; |
|
12
|
|
|
|
|
|
|
our @EXPORT = qw(parent_op return_op); |
|
13
|
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
push @ISA, 'DynaLoader'; |
|
16
|
|
|
|
|
|
|
# the boot symbol is in B::Utils. bootstrap doesn't like it, so we |
|
17
|
|
|
|
|
|
|
# need to load it manually. |
|
18
|
|
|
|
|
|
|
my $bootname = 'boot_B__Utils__OP'; |
|
19
|
|
|
|
|
|
|
if (my $boot_symbol_ref = DynaLoader::dl_find_symbol_anywhere($bootname)) { |
|
20
|
|
|
|
|
|
|
DynaLoader::dl_install_xsub(__PACKAGE__."::bootstrap", $boot_symbol_ref, __FILE__)->(__PACKAGE__, $VERSION); |
|
21
|
|
|
|
|
|
|
} |
|
22
|
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
=head1 NAME |
|
24
|
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
B::Utils::OP - op related utility functions for perl |
|
26
|
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
=head1 SYNOPSIS |
|
28
|
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
use B::Utils::OP qw(parent_op return_op); |
|
30
|
|
|
|
|
|
|
sub foo { |
|
31
|
|
|
|
|
|
|
my $pop = parent_op(0); |
|
32
|
|
|
|
|
|
|
my $rop = return_op(0); |
|
33
|
|
|
|
|
|
|
} |
|
34
|
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
=head1 DESCRIPTION |
|
36
|
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
sub foo { |
|
38
|
|
|
|
|
|
|
dothis(1); |
|
39
|
|
|
|
|
|
|
find_things(); |
|
40
|
|
|
|
|
|
|
return; |
|
41
|
|
|
|
|
|
|
} |
|
42
|
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
has the following optree: |
|
44
|
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
d <1> leavesub[1 ref] K/REFC,1 ->(end) |
|
46
|
|
|
|
|
|
|
- <@> lineseq KP ->d |
|
47
|
|
|
|
|
|
|
1 <;> nextstate(main -371 bah.pl:8) v/2 ->2 |
|
48
|
|
|
|
|
|
|
5 <1> entersub[t2] vKS/TARG,3 ->6 |
|
49
|
|
|
|
|
|
|
- <1> ex-list K ->5 |
|
50
|
|
|
|
|
|
|
2 <0> pushmark s ->3 |
|
51
|
|
|
|
|
|
|
3 <$> const[IV 1] sM ->4 |
|
52
|
|
|
|
|
|
|
- <1> ex-rv2cv sK/3 ->- |
|
53
|
|
|
|
|
|
|
4 <#> gv[*dothis] s ->5 |
|
54
|
|
|
|
|
|
|
6 <;> nextstate(main -371 bah.pl:9) v/2 ->7 |
|
55
|
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
9 <1> entersub[t4] vKS/TARG,3 ->a |
|
57
|
|
|
|
|
|
|
- <1> ex-list K ->9 |
|
58
|
|
|
|
|
|
|
7 <0> pushmark s ->8 |
|
59
|
|
|
|
|
|
|
- <1> ex-rv2cv sK/3 ->- |
|
60
|
|
|
|
|
|
|
8 <#> gv[*find_things] s/EARLYCV ->9 |
|
61
|
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
a <;> nextstate(main -371 bah.pl:10) v/2 ->b |
|
63
|
|
|
|
|
|
|
c <@> return K ->d |
|
64
|
|
|
|
|
|
|
b <0> pushmark s ->c |
|
65
|
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
The C in C is called in the C in #9. If |
|
67
|
|
|
|
|
|
|
you call C function with level 0, you get the C |
|
68
|
|
|
|
|
|
|
op that is before the entersub, which is #6. And C gives |
|
69
|
|
|
|
|
|
|
you the next op that the caller is returning to, in this case, the |
|
70
|
|
|
|
|
|
|
C in #a. |
|
71
|
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
=head2 EXPORTED PERL FUNCTIONS |
|
73
|
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
=over |
|
75
|
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
=item parent_op($lv) |
|
77
|
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
In runtime, returns the L object whose next is the C of the current context up level C<$lv> |
|
79
|
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
=item return_op($lv) |
|
81
|
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
In runtime, returns the L object that the current context is returning to at level C<$lv> |
|
83
|
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
=back |
|
85
|
|
|
|
|
|
|
|
|
86
|
|
|
|
|
|
|
=head2 B::CV METHODS |
|
87
|
|
|
|
|
|
|
|
|
88
|
|
|
|
|
|
|
=over |
|
89
|
|
|
|
|
|
|
|
|
90
|
|
|
|
|
|
|
=item $cv->NEW_with_start($root, $start) |
|
91
|
|
|
|
|
|
|
|
|
92
|
|
|
|
|
|
|
Clone the C<$cv> but with different C<$root> and C<$start> |
|
93
|
|
|
|
|
|
|
|
|
94
|
|
|
|
|
|
|
=back |
|
95
|
|
|
|
|
|
|
|
|
96
|
|
|
|
|
|
|
=head1 AUTHORS |
|
97
|
|
|
|
|
|
|
|
|
98
|
|
|
|
|
|
|
Chia-liang Kao Eclkao@clkao.orgE |
|
99
|
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
=head1 COPYRIGHT |
|
101
|
|
|
|
|
|
|
|
|
102
|
|
|
|
|
|
|
Copyright 2008 by Chia-liang Kao |
|
103
|
|
|
|
|
|
|
|
|
104
|
|
|
|
|
|
|
This program is free software; you can redistribute it and/or modify it |
|
105
|
|
|
|
|
|
|
under the same terms as Perl itself. |
|
106
|
|
|
|
|
|
|
|
|
107
|
|
|
|
|
|
|
See L |
|
108
|
|
|
|
|
|
|
|
|
109
|
|
|
|
|
|
|
=cut |
|
110
|
|
|
|
|
|
|
|
|
111
|
|
|
|
|
|
|
1; |