line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package PJVM::Class::Method; |
2
|
|
|
|
|
|
|
|
3
|
3
|
|
|
3
|
|
15
|
use strict; |
|
3
|
|
|
|
|
6
|
|
|
3
|
|
|
|
|
97
|
|
4
|
3
|
|
|
3
|
|
14
|
use warnings; |
|
3
|
|
|
|
|
7
|
|
|
3
|
|
|
|
|
82
|
|
5
|
|
|
|
|
|
|
|
6
|
3
|
|
|
3
|
|
16
|
use Scalar::Util qw(weaken); |
|
3
|
|
|
|
|
44
|
|
|
3
|
|
|
|
|
218
|
|
7
|
|
|
|
|
|
|
|
8
|
3
|
|
|
3
|
|
1652
|
use PJVM::Access qw(:flags); |
|
3
|
|
|
|
|
7
|
|
|
3
|
|
|
|
|
599
|
|
9
|
3
|
|
|
3
|
|
19
|
use PJVM::Class::Attribute; |
|
3
|
|
|
|
|
6
|
|
|
3
|
|
|
|
|
83
|
|
10
|
|
|
|
|
|
|
|
11
|
3
|
|
|
|
|
20
|
use Object::Tiny qw( |
12
|
|
|
|
|
|
|
access_flags |
13
|
|
|
|
|
|
|
name_index |
14
|
|
|
|
|
|
|
descriptor_index |
15
|
|
|
|
|
|
|
attributes |
16
|
|
|
|
|
|
|
parent_class |
17
|
3
|
|
|
3
|
|
15
|
); |
|
3
|
|
|
|
|
4
|
|
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
sub new_from_io { |
20
|
9
|
|
|
9
|
0
|
17
|
my ($pkg, $io, $cp, $parent_class) = @_; |
21
|
|
|
|
|
|
|
|
22
|
9
|
|
|
|
|
12
|
my $buff; |
23
|
|
|
|
|
|
|
|
24
|
9
|
|
|
|
|
18
|
read $io, $buff, 8; |
25
|
|
|
|
|
|
|
|
26
|
9
|
|
|
|
|
32
|
my ($access_flags, $name_index, $descriptor_index, $attributes_count) = unpack("nnnn", $buff); |
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
# Read attributes |
29
|
9
|
|
|
|
|
11
|
my @attributes; |
30
|
9
|
50
|
|
|
|
58
|
if ($attributes_count) { |
31
|
9
|
|
|
|
|
33
|
while ($attributes_count--) { |
32
|
9
|
|
|
|
|
44
|
push @attributes, PJVM::Class::Attribute->new_from_io($io, $cp); |
33
|
|
|
|
|
|
|
} |
34
|
|
|
|
|
|
|
} |
35
|
|
|
|
|
|
|
|
36
|
9
|
|
|
|
|
69
|
my $self = $pkg->new( |
37
|
|
|
|
|
|
|
access_flags => $access_flags, |
38
|
|
|
|
|
|
|
name_index => $name_index, |
39
|
|
|
|
|
|
|
descriptor_index => $descriptor_index, |
40
|
|
|
|
|
|
|
attributes => \@attributes, |
41
|
|
|
|
|
|
|
parent_class => $parent_class, |
42
|
|
|
|
|
|
|
); |
43
|
|
|
|
|
|
|
|
44
|
9
|
|
|
|
|
334
|
weaken $self->parent_class; |
45
|
|
|
|
|
|
|
|
46
|
9
|
|
|
|
|
83
|
return $self; |
47
|
|
|
|
|
|
|
} |
48
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
sub name { |
50
|
7
|
|
|
7
|
0
|
1606
|
my $self = shift; |
51
|
7
|
|
|
|
|
179
|
my $name = $self->parent_class->constant_pool->get($self->name_index); |
52
|
7
|
|
|
|
|
169
|
return $name->value; |
53
|
|
|
|
|
|
|
} |
54
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
sub signature { |
56
|
9
|
|
|
9
|
0
|
2358
|
my $self = shift; |
57
|
9
|
|
|
|
|
265
|
my $signature = $self->parent_class->constant_pool->get($self->descriptor_index); |
58
|
9
|
|
|
|
|
201
|
return $signature->value; |
59
|
|
|
|
|
|
|
} |
60
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
sub code { |
62
|
1
|
|
|
1
|
0
|
2
|
my $self = shift; |
63
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
# Locate first attribute which is a code |
65
|
1
|
|
|
|
|
3
|
for my $attribute (@{$self->attributes}) { |
|
1
|
|
|
|
|
27
|
|
66
|
1
|
50
|
|
|
|
34
|
if ($attribute->isa("PJVM::Class::Attribute::Code")) { |
67
|
1
|
|
|
|
|
3
|
return $attribute; |
68
|
|
|
|
|
|
|
} |
69
|
|
|
|
|
|
|
} |
70
|
|
|
|
|
|
|
|
71
|
0
|
0
|
0
|
|
|
0
|
if ($self->access_flags & ACC_NATIVE || $self->access_flags & ACC_ABSTRACT) { |
72
|
0
|
|
|
|
|
0
|
return; |
73
|
|
|
|
|
|
|
} |
74
|
|
|
|
|
|
|
|
75
|
0
|
|
|
|
|
0
|
die "Method has no 'Code' attribute.. that is very very bad" |
76
|
|
|
|
|
|
|
} |
77
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
sub bytecode { |
79
|
1
|
|
|
1
|
0
|
479
|
my $self = shift; |
80
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
# Locate first attribute which is a code |
82
|
1
|
|
|
|
|
13
|
my $code = $self->code; |
83
|
1
|
50
|
|
|
|
32
|
return $code->code if $code; |
84
|
|
|
|
|
|
|
|
85
|
0
|
|
|
|
|
|
return ''; |
86
|
|
|
|
|
|
|
} |
87
|
|
|
|
|
|
|
|
88
|
|
|
|
|
|
|
1; |
89
|
|
|
|
|
|
|
__END__ |