← Index
NYTProf Performance Profile   « block view • line view • sub view »
For /usr/share/koha/opac/cgi-bin/opac/opac-search.pl
  Run on Tue Oct 15 17:10:45 2013
Reported on Tue Oct 15 17:12:47 2013

Filename/usr/share/perl5/Convert/ASN1/parser.pm
StatementsExecuted 76189 statements in 75.2ms
Subroutines
Calls P F Exclusive
Time
Inclusive
Time
Subroutine
11133.6ms64.7msConvert::ASN1::parser::::yyparseConvert::ASN1::parser::yyparse
12441120.9ms31.1msConvert::ASN1::parser::::yylexConvert::ASN1::parser::yylex
2470318.69ms8.69msConvert::ASN1::parser::::CORE:matchConvert::ASN1::parser::CORE:match (opcode)
320314.28ms4.47msConvert::ASN1::parser::::compile_oneConvert::ASN1::parser::compile_one (recurses: max depth 10, inclusive time 11.7ms)
1111.52ms1.58msConvert::ASN1::parser::::verifyConvert::ASN1::parser::verify
237911964µs964µsConvert::ASN1::parser::::CORE:regcompConvert::ASN1::parser::CORE:regcomp (opcode)
111233µs4.70msConvert::ASN1::parser::::compileConvert::ASN1::parser::compile
1811127µs127µsConvert::ASN1::parser::::CORE:substConvert::ASN1::parser::CORE:subst (opcode)
41152µs52µsConvert::ASN1::parser::::expand_opsConvert::ASN1::parser::expand_ops
11141µs71.0msConvert::ASN1::parser::::parseConvert::ASN1::parser::parse
11120µs25µsConvert::ASN1::parser::::BEGIN@9Convert::ASN1::parser::BEGIN@9
11117µs588µsConvert::ASN1::parser::::BEGIN@10Convert::ASN1::parser::BEGIN@10
11116µs204µsConvert::ASN1::parser::::BEGIN@11Convert::ASN1::parser::BEGIN@11
11112µs106µsConvert::ASN1::parser::::BEGIN@16Convert::ASN1::parser::BEGIN@16
1118µs8µsConvert::ASN1::parser::::CORE:sortConvert::ASN1::parser::CORE:sort (opcode)
0000s0sConvert::ASN1::parser::::YYERRORConvert::ASN1::parser::YYERROR
0000s0sConvert::ASN1::parser::::_yylexConvert::ASN1::parser::_yylex
0000s0sConvert::ASN1::parser::::explicitConvert::ASN1::parser::explicit
0000s0sConvert::ASN1::parser::::yy_err_recoverConvert::ASN1::parser::yy_err_recover
0000s0sConvert::ASN1::parser::::yyclearinConvert::ASN1::parser::yyclearin
0000s0sConvert::ASN1::parser::::yyerrokConvert::ASN1::parser::yyerrok
0000s0sConvert::ASN1::parser::::yyerrorConvert::ASN1::parser::yyerror
Call graph for these subroutines as a Graphviz dot language file.
Line State
ments
Time
on line
Calls Time
in subs
Code
1#$yysccsid = "@(#)yaccpar 1.8 (Berkeley) 01/20/91 (Perl 2.0 12/31/92)";
2# 23 "parser.y"
3;# Copyright (c) 2000-2005 Graham Barr <gbarr@pobox.com>. All rights reserved.
4;# This program is free software; you can redistribute it and/or
5;# modify it under the same terms as Perl itself.
6
7package Convert::ASN1::parser;
8
9334µs230µs
# spent 25µs (20+5) within Convert::ASN1::parser::BEGIN@9 which was called: # once (20µs+5µs) by Convert::ASN1::BEGIN@415 at line 9
use strict;
# spent 25µs making 1 call to Convert::ASN1::parser::BEGIN@9 # spent 5µs making 1 call to strict::import
10349µs21.16ms
# spent 588µs (17+570) within Convert::ASN1::parser::BEGIN@10 which was called: # once (17µs+570µs) by Convert::ASN1::BEGIN@415 at line 10
use Convert::ASN1 qw(:all);
# spent 588µs making 1 call to Convert::ASN1::parser::BEGIN@10 # spent 570µs making 1 call to Exporter::import
11111µs1188µs
# spent 204µs (16+188) within Convert::ASN1::parser::BEGIN@11 which was called: # once (16µs+188µs) by Convert::ASN1::BEGIN@415 at line 14
use vars qw(
# spent 188µs making 1 call to vars::import
12 $asn $yychar $yyerrflag $yynerrs $yyn @yyss
13 $yyssp $yystate @yyvs $yyvsp $yylval $yys $yym $yyval
14233µs1204µs);
# spent 204µs making 1 call to Convert::ASN1::parser::BEGIN@11
15
1614.33ms2199µs
# spent 106µs (12+94) within Convert::ASN1::parser::BEGIN@16 which was called: # once (12µs+94µs) by Convert::ASN1::BEGIN@415 at line 16
BEGIN { Convert::ASN1->_internal_syms }
# spent 106µs making 1 call to Convert::ASN1::parser::BEGIN@16 # spent 94µs making 1 call to Convert::ASN1::_internal_syms
17
1811µsmy $yydebug=0;
191300nsmy %yystate;
20
21198µs3158µsmy %base_type = (
# spent 58µs making 31 calls to Convert::ASN1::asn_encode_tag, avg 2µs/call
22 BOOLEAN => [ asn_encode_tag(ASN_BOOLEAN), opBOOLEAN ],
23 INTEGER => [ asn_encode_tag(ASN_INTEGER), opINTEGER ],
24 BIT_STRING => [ asn_encode_tag(ASN_BIT_STR), opBITSTR ],
25 OCTET_STRING => [ asn_encode_tag(ASN_OCTET_STR), opSTRING ],
26 STRING => [ asn_encode_tag(ASN_OCTET_STR), opSTRING ],
27 NULL => [ asn_encode_tag(ASN_NULL), opNULL ],
28 OBJECT_IDENTIFIER => [ asn_encode_tag(ASN_OBJECT_ID), opOBJID ],
29 REAL => [ asn_encode_tag(ASN_REAL), opREAL ],
30 ENUMERATED => [ asn_encode_tag(ASN_ENUMERATED), opINTEGER ],
31 ENUM => [ asn_encode_tag(ASN_ENUMERATED), opINTEGER ],
32 'RELATIVE-OID' => [ asn_encode_tag(ASN_RELATIVE_OID), opROID ],
33
34 SEQUENCE => [ asn_encode_tag(ASN_SEQUENCE | ASN_CONSTRUCTOR), opSEQUENCE ],
35 SET => [ asn_encode_tag(ASN_SET | ASN_CONSTRUCTOR), opSET ],
36
37 ObjectDescriptor => [ asn_encode_tag(ASN_UNIVERSAL | 7), opSTRING ],
38 UTF8String => [ asn_encode_tag(ASN_UNIVERSAL | 12), opUTF8 ],
39 NumericString => [ asn_encode_tag(ASN_UNIVERSAL | 18), opSTRING ],
40 PrintableString => [ asn_encode_tag(ASN_UNIVERSAL | 19), opSTRING ],
41 TeletexString => [ asn_encode_tag(ASN_UNIVERSAL | 20), opSTRING ],
42 T61String => [ asn_encode_tag(ASN_UNIVERSAL | 20), opSTRING ],
43 VideotexString => [ asn_encode_tag(ASN_UNIVERSAL | 21), opSTRING ],
44 IA5String => [ asn_encode_tag(ASN_UNIVERSAL | 22), opSTRING ],
45 UTCTime => [ asn_encode_tag(ASN_UNIVERSAL | 23), opUTIME ],
46 GeneralizedTime => [ asn_encode_tag(ASN_UNIVERSAL | 24), opGTIME ],
47 GraphicString => [ asn_encode_tag(ASN_UNIVERSAL | 25), opSTRING ],
48 VisibleString => [ asn_encode_tag(ASN_UNIVERSAL | 26), opSTRING ],
49 ISO646String => [ asn_encode_tag(ASN_UNIVERSAL | 26), opSTRING ],
50 GeneralString => [ asn_encode_tag(ASN_UNIVERSAL | 27), opSTRING ],
51 CharacterString => [ asn_encode_tag(ASN_UNIVERSAL | 28), opSTRING ],
52 UniversalString => [ asn_encode_tag(ASN_UNIVERSAL | 28), opSTRING ],
53 BMPString => [ asn_encode_tag(ASN_UNIVERSAL | 30), opSTRING ],
54 BCDString => [ asn_encode_tag(ASN_OCTET_STR), opBCD ],
55
56 CHOICE => [ '', opCHOICE ],
57 ANY => [ '', opANY ],
58);
59
60;# Given an OP, wrap it in a SEQUENCE
61
62sub explicit {
63 my $op = shift;
64 my @seq = @$op;
65
66 @seq[cTYPE,cCHILD,cVAR,cLOOP] = ('SEQUENCE',[$op],undef,undef);
67 @{$op}[cTAG,cOPT] = ();
68
69 \@seq;
70}
71
72sub constWORD () { 1 }
73sub constCLASS () { 2 }
74sub constSEQUENCE () { 3 }
75sub constSET () { 4 }
76sub constCHOICE () { 5 }
77sub constOF () { 6 }
78sub constIMPLICIT () { 7 }
79sub constEXPLICIT () { 8 }
80sub constOPTIONAL () { 9 }
81sub constLBRACE () { 10 }
82sub constRBRACE () { 11 }
83sub constCOMMA () { 12 }
84sub constANY () { 13 }
85sub constASSIGN () { 14 }
86sub constNUMBER () { 15 }
87sub constENUM () { 16 }
88sub constCOMPONENTS () { 17 }
89sub constPOSTRBRACE () { 18 }
90sub constDEFINED () { 19 }
91sub constBY () { 20 }
92sub constYYERRCODE () { 256 }
9314µsmy @yylhs = ( -1,
94 0, 0, 2, 2, 3, 3, 6, 6, 6, 6,
95 8, 13, 13, 12, 14, 14, 14, 9, 9, 9,
96 10, 18, 18, 18, 18, 18, 19, 19, 11, 16,
97 16, 20, 20, 20, 21, 1, 1, 1, 22, 22,
98 22, 24, 24, 24, 24, 23, 23, 23, 15, 15,
99 4, 4, 5, 5, 5, 17, 17, 25, 7, 7,
100);
10113µsmy @yylen = ( 2,
102 1, 1, 3, 4, 4, 1, 1, 1, 1, 1,
103 3, 1, 1, 6, 1, 1, 1, 4, 4, 4,
104 4, 1, 1, 1, 2, 1, 0, 3, 1, 1,
105 2, 1, 3, 3, 4, 0, 1, 2, 1, 3,
106 3, 2, 1, 1, 1, 4, 1, 3, 0, 1,
107 0, 1, 0, 1, 1, 1, 3, 2, 0, 1,
108);
10915µsmy @yydefred = ( 0,
110 0, 52, 0, 0, 1, 0, 0, 47, 0, 39,
111 0, 0, 0, 0, 55, 54, 0, 0, 0, 3,
112 0, 6, 0, 11, 0, 0, 0, 0, 48, 0,
113 40, 41, 0, 22, 0, 0, 0, 0, 45, 43,
114 0, 44, 0, 29, 46, 4, 0, 0, 0, 0,
115 7, 8, 9, 10, 0, 25, 0, 50, 42, 0,
116 0, 0, 0, 0, 0, 32, 60, 5, 0, 0,
117 0, 56, 0, 18, 19, 0, 20, 0, 0, 28,
118 58, 21, 0, 0, 0, 34, 33, 57, 0, 0,
119 17, 15, 16, 0, 35, 14,
120);
12112µsmy @yydgoto = ( 4,
122 5, 6, 20, 7, 17, 50, 68, 8, 51, 52,
123 53, 54, 43, 94, 59, 64, 71, 44, 56, 65,
124 66, 9, 10, 45, 72,
125);
126111µsmy @yysindex = ( 7,
127 9, 0, 12, 0, 0, 19, 51, 0, 34, 0,
128 75, 51, 31, -1, 0, 0, 90, 55, 55, 0,
129 51, 0, 114, 0, 75, 26, 53, 61, 0, 77,
130 0, 0, 114, 0, 26, 53, 64, 76, 0, 0,
131 89, 0, 96, 0, 0, 0, 55, 55, 111, 103,
132 0, 0, 0, 0, 94, 0, 130, 0, 0, 77,
133 122, 128, 77, 141, 78, 0, 0, 0, 155, 147,
134 33, 0, 51, 0, 0, 51, 0, 111, 111, 0,
135 0, 0, 130, 119, 114, 0, 0, 0, 26, 53,
136 0, 0, 0, 89, 0, 0,
137);
13817µsmy @yyrindex = ( 150,
139 100, 0, 0, 0, 0, 166, 106, 0, 39, 0,
140 100, 133, 0, 0, 0, 0, 0, 165, 140, 0,
141 133, 0, 0, 0, 100, 0, 0, 0, 0, 100,
142 0, 0, 0, 0, 16, 29, 42, 69, 0, 0,
143 37, 0, 0, 0, 0, 0, 156, 156, 0, 125,
144 0, 0, 0, 0, 0, 0, 0, 0, 0, 100,
145 0, 0, 100, 0, 154, 0, 0, 0, 0, 0,
146 0, 0, 133, 0, 0, 133, 0, 0, 160, 0,
147 0, 0, 0, 0, 0, 0, 0, 0, 73, 88,
148 0, 0, 0, 3, 0, 0,
149);
15012µsmy @yygindex = ( 0,
151 28, 0, 149, 1, -11, 91, 0, 8, -17, -18,
152 -16, 152, 0, 0, 83, 0, 0, 0, 0, 0,
153 50, 0, 123, 0, 95,
154);
155sub constYYTABLESIZE () { 178 }
156112µsmy @yytable = ( 29,
157 23, 12, 49, 49, 40, 39, 41, 1, 2, 33,
158 2, 21, 25, 49, 49, 23, 23, 13, 22, 14,
159 49, 12, 11, 3, 23, 21, 23, 23, 24, 24,
160 12, 24, 22, 23, 13, 47, 49, 24, 37, 24,
161 24, 27, 27, 82, 83, 18, 24, 49, 49, 37,
162 27, 19, 27, 27, 49, 30, 2, 15, 16, 27,
163 73, 84, 48, 76, 85, 92, 91, 93, 26, 26,
164 49, 3, 23, 23, 61, 62, 2, 26, 2, 26,
165 26, 23, 55, 23, 23, 57, 26, 24, 24, 78,
166 23, 3, 26, 27, 28, 79, 24, 58, 24, 24,
167 51, 60, 51, 51, 51, 24, 51, 51, 53, 53,
168 53, 63, 51, 69, 34, 51, 35, 36, 28, 34,
169 67, 89, 90, 28, 59, 59, 37, 86, 87, 38,
170 70, 37, 74, 53, 38, 53, 53, 53, 75, 38,
171 31, 32, 51, 51, 51, 53, 51, 51, 53, 36,
172 38, 77, 51, 51, 51, 80, 51, 51, 51, 51,
173 51, 81, 51, 51, 30, 2, 36, 51, 51, 51,
174 31, 51, 51, 46, 42, 95, 96, 88,
175);
176117µsmy @yycheck = ( 17,
177 12, 1, 0, 1, 23, 23, 23, 1, 2, 21,
178 2, 11, 14, 11, 12, 0, 1, 6, 11, 1,
179 18, 6, 14, 17, 9, 25, 11, 12, 0, 1,
180 30, 1, 25, 18, 6, 10, 0, 9, 0, 11,
181 12, 0, 1, 11, 12, 12, 18, 11, 12, 11,
182 9, 18, 11, 12, 18, 1, 2, 7, 8, 18,
183 60, 73, 10, 63, 76, 84, 84, 84, 0, 1,
184 10, 17, 0, 1, 47, 48, 2, 9, 2, 11,
185 12, 9, 19, 11, 12, 10, 18, 0, 1, 12,
186 18, 17, 3, 4, 5, 18, 9, 9, 11, 12,
187 1, 6, 3, 4, 5, 18, 7, 8, 3, 4,
188 5, 1, 13, 20, 1, 16, 3, 4, 5, 1,
189 18, 3, 4, 5, 0, 1, 13, 78, 79, 16,
190 1, 13, 11, 1, 16, 3, 4, 5, 11, 0,
191 18, 19, 3, 4, 5, 13, 7, 8, 16, 0,
192 11, 11, 3, 4, 5, 1, 7, 8, 3, 4,
193 5, 15, 7, 8, 11, 0, 11, 3, 4, 5,
194 11, 7, 8, 25, 23, 85, 94, 83,
195);
196sub constYYFINAL () { 4 }
197
- -
200sub constYYMAXTOKEN () { 20 }
201sub yyclearin { $yychar = -1; }
202sub yyerrok { $yyerrflag = 0; }
203sub YYERROR { ++$yynerrs; &yy_err_recover; }
204sub yy_err_recover
205{
206 if ($yyerrflag < 3)
207 {
208 $yyerrflag = 3;
209 while (1)
210 {
211 if (($yyn = $yysindex[$yyss[$yyssp]]) &&
212 ($yyn += constYYERRCODE()) >= 0 &&
213 $yyn <= $#yycheck && $yycheck[$yyn] == constYYERRCODE())
214 {
215
- -
219 $yyss[++$yyssp] = $yystate = $yytable[$yyn];
220 $yyvs[++$yyvsp] = $yylval;
221 next yyloop;
222 }
223 else
224 {
225
- -
229 return(1) if $yyssp <= 0;
230 --$yyssp;
231 --$yyvsp;
232 }
233 }
234 }
235 else
236 {
237 return (1) if $yychar == 0;
238 $yychar = -1;
239 next yyloop;
240 }
2410;
242} # yy_err_recover
243
244sub yyparse
245
# spent 64.7ms (33.6+31.1) within Convert::ASN1::parser::yyparse which was called: # once (33.6ms+31.1ms) by Convert::ASN1::parser::parse at line 650
{
246
24713µs if ($yys = $ENV{'YYDEBUG'})
248 {
249 $yydebug = int($1) if $yys =~ /^(\d)/;
250 }
251
252
25311µs $yynerrs = 0;
2541900ns $yyerrflag = 0;
2551500ns $yychar = (-1);
256
2571300ns $yyssp = 0;
2581300ns $yyvsp = 0;
25912µs $yyss[$yyssp] = $yystate = 0;
260
2611212µsyyloop: while(1)
262 {
26333191.30ms yyreduce: {
2643319797µs last yyreduce if ($yyn = $yydefred[$yystate]);
2651836906µs if ($yychar < 0)
266 {
26712443.07ms124431.1ms if (($yychar = &yylex) < 0) { $yychar = 0; }
# spent 31.1ms making 1244 calls to Convert::ASN1::parser::yylex, avg 25µs/call
268 }
26918363.01ms if (($yyn = $yysindex[$yystate]) && ($yyn += $yychar) >= 0 &&
270 $yyn <= $#yycheck && $yycheck[$yyn] == $yychar)
271 {
272
- -
2761243689µs $yyss[++$yyssp] = $yystate = $yytable[$yyn];
2771243735µs $yyvs[++$yyvsp] = $yylval;
2781243310µs $yychar = (-1);
2791243400µs --$yyerrflag if $yyerrflag > 0;
2801243597µs next yyloop;
281 }
282593590µs if (($yyn = $yyrindex[$yystate]) && ($yyn += $yychar) >= 0 &&
283 $yyn <= $#yycheck && $yycheck[$yyn] == $yychar)
284 {
285593180µs $yyn = $yytable[$yyn];
286593271µs last yyreduce;
287 }
288 if (! $yyerrflag) {
289 &yyerror('syntax error');
290 ++$yynerrs;
291 }
292 return undef if &yy_err_recover;
293 } # yyreduce
294
- -
2982076566µs $yym = $yylen[$yyn];
29920761.54ms $yyval = $yyvs[$yyvsp+1-$yym];
30020761.33ms switch:
301 {
3022076475µsmy $label = "State$yyn";
30320763.09msgoto $label if exists $yystate{$label};
304423137µslast switch;
305State1: {
306# 96 "parser.y"
307{ $yyval = { '' => $yyvs[$yyvsp-0] };
308last switch;
309} }
310State3: {
311# 101 "parser.y"
3121400ns{
31324µs $yyval = { $yyvs[$yyvsp-2], [$yyvs[$yyvsp-0]] };
314
3151500nslast switch;
316} }
317State4: {
318# 105 "parser.y"
3197217µs{
32014460µs $yyval=$yyvs[$yyvsp-3];
32172293µs $yyval->{$yyvs[$yyvsp-2]} = [$yyvs[$yyvsp-0]];
322
3237232µslast switch;
324} }
325State5: {
326# 112 "parser.y"
3277116µs{
328142108µs $yyvs[$yyvsp-1]->[cTAG] = $yyvs[$yyvsp-3];
3297160µs $yyval = $yyvs[$yyvsp-2] ? explicit($yyvs[$yyvsp-1]) : $yyvs[$yyvsp-1];
330
3317127µslast switch;
332} }
333State11: {
334# 126 "parser.y"
33541µs{
3361230µs @{$yyval = []}[cTYPE,cCHILD] = ('COMPONENTS', $yyvs[$yyvsp-0]);
337
33842µslast switch;
339} }
340State14: {
341# 136 "parser.y"
342173µs{
3433427µs $yyvs[$yyvsp-1]->[cTAG] = $yyvs[$yyvsp-3];
34434127µs @{$yyval = []}[cTYPE,cCHILD,cLOOP,cOPT] = ($yyvs[$yyvsp-5], [$yyvs[$yyvsp-1]], 1, $yyvs[$yyvsp-0]);
3451711µs $yyval = explicit($yyval) if $yyvs[$yyvsp-2];
346
347178µslast switch;
348} }
349State18: {
350# 149 "parser.y"
3514410µs{
352132226µs @{$yyval = []}[cTYPE,cCHILD] = ('SEQUENCE', $yyvs[$yyvsp-1]);
353
3544419µslast switch;
355} }
356State19: {
357# 153 "parser.y"
358{
359 @{$yyval = []}[cTYPE,cCHILD] = ('SET', $yyvs[$yyvsp-1]);
360
361last switch;
362} }
363State20: {
364# 157 "parser.y"
36594µs{
3662749µs @{$yyval = []}[cTYPE,cCHILD] = ('CHOICE', $yyvs[$yyvsp-1]);
367
36897µslast switch;
369} }
370State21: {
371# 163 "parser.y"
372104µs{
3733046µs @{$yyval = []}[cTYPE] = ('ENUM');
374
375105µslast switch;
376} }
377State22: {
378# 168 "parser.y"
379680806µs{ @{$yyval = []}[cTYPE] = $yyvs[$yyvsp-0];
38017068µslast switch;
381} }
382State23: {
383# 169 "parser.y"
384{ @{$yyval = []}[cTYPE] = $yyvs[$yyvsp-0];
385last switch;
386} }
387State24: {
388# 170 "parser.y"
389{ @{$yyval = []}[cTYPE] = $yyvs[$yyvsp-0];
390last switch;
391} }
392State25: {
393# 172 "parser.y"
394{
395 @{$yyval = []}[cTYPE,cCHILD,cDEFINE] = ('ANY',undef,$yyvs[$yyvsp-0]);
396
397last switch;
398} }
399State26: {
400# 175 "parser.y"
401{ @{$yyval = []}[cTYPE] = $yyvs[$yyvsp-0];
402last switch;
403} }
404State27: {
405# 178 "parser.y"
406{ $yyval=undef;
407last switch;
408} }
409State28: {
410# 179 "parser.y"
411{ $yyval=$yyvs[$yyvsp-0];
412last switch;
413} }
414State30: {
415# 185 "parser.y"
4162412µs{ $yyval = $yyvs[$yyvsp-0];
41787µslast switch;
418} }
419State31: {
420# 186 "parser.y"
42132µs{ $yyval = $yyvs[$yyvsp-1];
4221600nslast switch;
423} }
424State32: {
425# 190 "parser.y"
42692µs{
4271821µs $yyval = [ $yyvs[$yyvsp-0] ];
428
42994µslast switch;
430} }
431State33: {
432# 194 "parser.y"
43331µs{
43498µs push @{$yyval=$yyvs[$yyvsp-2]}, $yyvs[$yyvsp-0];
435
43631µslast switch;
437} }
438State34: {
439# 198 "parser.y"
440399µs{
44111788µs push @{$yyval=$yyvs[$yyvsp-2]}, $yyvs[$yyvsp-0];
442
4433915µslast switch;
444} }
445State35: {
446# 204 "parser.y"
4475113µs{
448153213µs @{$yyval=$yyvs[$yyvsp-0]}[cVAR,cTAG] = ($yyvs[$yyvsp-3],$yyvs[$yyvsp-2]);
4495128µs $yyval = explicit($yyval) if $yyvs[$yyvsp-1];
450
4515121µslast switch;
452} }
453State36: {
454# 211 "parser.y"
455{ $yyval = [];
456last switch;
457} }
458State37: {
459# 212 "parser.y"
46012342µs{ $yyval = $yyvs[$yyvsp-0];
4614116µslast switch;
462} }
463State38: {
464# 213 "parser.y"
46596µs{ $yyval = $yyvs[$yyvsp-1];
46632µslast switch;
467} }
468State39: {
469# 217 "parser.y"
4704411µs{
4718889µs $yyval = [ $yyvs[$yyvsp-0] ];
472
4734419µslast switch;
474} }
475State40: {
476# 221 "parser.y"
4775715µs{
478171155µs push @{$yyval=$yyvs[$yyvsp-2]}, $yyvs[$yyvsp-0];
479
4805723µslast switch;
481} }
482State41: {
483# 225 "parser.y"
484124µs{
4853638µs push @{$yyval=$yyvs[$yyvsp-2]}, $yyvs[$yyvsp-0];
486
487124µslast switch;
488} }
489State42: {
490# 231 "parser.y"
4919119µs{
492273282µs @{$yyval=$yyvs[$yyvsp-1]}[cOPT] = ($yyvs[$yyvsp-0]);
493
4949138µslast switch;
495} }
496State46: {
497# 240 "parser.y"
49810926µs{
499327412µs @{$yyval=$yyvs[$yyvsp-0]}[cVAR,cTAG] = ($yyvs[$yyvsp-3],$yyvs[$yyvsp-2]);
50010990µs $yyval->[cOPT] = $yyvs[$yyvsp-3] if $yyval->[cOPT];
50110950µs $yyval = explicit($yyval) if $yyvs[$yyvsp-1];
502
50310969µslast switch;
504} }
505State48: {
506# 247 "parser.y"
5072600ns{
50866µs @{$yyval=$yyvs[$yyvsp-0]}[cTAG] = ($yyvs[$yyvsp-2]);
50922µs $yyval = explicit($yyval) if $yyvs[$yyvsp-1];
510
51121µslast switch;
512} }
513State49: {
514# 253 "parser.y"
51520751µs{ $yyval = undef;
5166931µslast switch;
517} }
518State50: {
519# 254 "parser.y"
52011730µs{ $yyval = 1;
5213915µslast switch;
522} }
523State51: {
524# 258 "parser.y"
525528147µs{ $yyval = undef;
52617677µslast switch;
527} }
528State53: {
529# 262 "parser.y"
530750183µs{ $yyval = undef;
53125095µslast switch;
532} }
533State54: {
534# 263 "parser.y"
535{ $yyval = 1;
536last switch;
537} }
538State55: {
539# 264 "parser.y"
540{ $yyval = 0;
541last switch;
542} }
543State56: {
544# 267 "parser.y"
545103µs{
546207µslast switch;
547} }
548State57: {
549# 268 "parser.y"
5508017µs{
55116043µslast switch;
552} }
553State58: {
554# 271 "parser.y"
5559023µs{
55618062µslast switch;
557} }
558State59: {
559# 274 "parser.y"
560277µs{
5615417µslast switch;
562} }
563State60: {
564# 275 "parser.y"
5654410µs{
5668826µslast switch;
567} }
568 } # switch
5692076599µs $yyssp -= $yym;
5702076705µs $yystate = $yyss[$yyssp];
5712076518µs $yyvsp -= $yym;
5722076634µs $yym = $yylhs[$yyn];
5732076576µs if ($yystate == 0 && $yym == 0)
574 {
575
- -
5791400ns $yystate = constYYFINAL();
5801500ns $yyss[++$yyssp] = constYYFINAL();
5811700ns $yyvs[++$yyvsp] = $yyval;
5821500ns if ($yychar < 0)
583 {
584 if (($yychar = &yylex) < 0) { $yychar = 0; }
585 }
58618µs return $yyvs[$yyvsp] if $yychar == 0;
587 next yyloop;
588 }
58920752.42ms if (($yyn = $yygindex[$yym]) && ($yyn += $yystate) >= 0 &&
590 $yyn <= $#yycheck && $yycheck[$yyn] == $yystate)
591 {
5921001387µs $yystate = $yytable[$yyn];
593 } else {
5941074413µs $yystate = $yydgoto[$yym];
595 }
596
- -
6002075736µs $yyss[++$yyssp] = $yystate;
60120751.13ms $yyvs[++$yyvsp] = $yyval;
602 } # yyloop
603} # yyparse
604# 279 "parser.y"
605
606114µsmy %reserved = (
607 'OPTIONAL' => constOPTIONAL(),
608 'CHOICE' => constCHOICE(),
609 'OF' => constOF(),
610 'IMPLICIT' => constIMPLICIT(),
611 'EXPLICIT' => constEXPLICIT(),
612 'SEQUENCE' => constSEQUENCE(),
613 'SET' => constSET(),
614 'ANY' => constANY(),
615 'ENUM' => constENUM(),
616 'ENUMERATED' => constENUM(),
617 'COMPONENTS' => constCOMPONENTS(),
618 '{' => constLBRACE(),
619 '}' => constRBRACE(),
620 ',' => constCOMMA(),
621 '::=' => constASSIGN(),
622 'DEFINED' => constDEFINED(),
623 'BY' => constBY()
624);
625
6261878µs1827µsmy $reserved = join("|", reverse sort grep { /\w/ } keys %reserved);
# spent 19µs making 17 calls to Convert::ASN1::parser::CORE:match, avg 1µs/call # spent 8µs making 1 call to Convert::ASN1::parser::CORE:sort
627
62815µsmy %tag_class = (
629 APPLICATION => ASN_APPLICATION,
630 UNIVERSAL => ASN_UNIVERSAL,
631 PRIVATE => ASN_PRIVATE,
632 CONTEXT => ASN_CONTEXT,
633 '' => ASN_CONTEXT # if not specified, its CONTEXT
634);
635
636;##
637;## This is NOT thread safe !!!!!!
638;##
639
6401300nsmy $pos;
6411200nsmy $last_pos;
6421300nsmy @stacked;
643
644
# spent 71.0ms (41µs+71.0) within Convert::ASN1::parser::parse which was called: # once (41µs+71.0ms) by Convert::ASN1::prepare at line 154 of Convert/ASN1.pm
sub parse {
64512µs local(*asn) = \($_[0]);
64611µs ($pos,$last_pos,@stacked) = ();
647
64816µs eval {
64916µs local $SIG{__DIE__};
650116µs371.0ms compile(verify(yyparse()));
# spent 64.7ms making 1 call to Convert::ASN1::parser::yyparse # spent 4.70ms making 1 call to Convert::ASN1::parser::compile # spent 1.58ms making 1 call to Convert::ASN1::parser::verify
651 }
652}
653
654
# spent 4.47ms (4.28+194µs) within Convert::ASN1::parser::compile_one which was called 320 times, avg 14µs/call: # 124 times (2.59ms+-2.59ms) by Convert::ASN1::parser::compile_one at line 688, avg 0s/call # 123 times (1.01ms+-1.01ms) by Convert::ASN1::parser::compile_one at line 668, avg 0s/call # 73 times (678µs+3.79ms) by Convert::ASN1::parser::compile at line 736, avg 61µs/call
sub compile_one {
655320115µs my $tree = shift;
65632081µs my $ops = shift;
657320104µs my $name = shift;
658320421µs foreach my $op (@$ops) {
659555241µs next unless ref($op) eq 'ARRAY';
660250257µs bless $op;
661250121µs my $type = $op->[cTYPE];
662250162µs if (exists $base_type{$type}) {
66312780µs $op->[cTYPE] = $base_type{$type}->[1];
664127154µs29105µs $op->[cTAG] = defined($op->[cTAG]) ? asn_encode_tag($op->[cTAG]): $base_type{$type}->[0];
# spent 105µs making 29 calls to Convert::ASN1::asn_encode_tag, avg 4µs/call
665 }
666 else {
66712353µs die "Unknown type '$type'\n" unless exists $tree->{$type};
668123333µs1230s my $ref = compile_one(
# spent 2.49ms making 123 calls to Convert::ASN1::parser::compile_one, avg 20µs/call, recursion: max depth 10, sum of overlapping time 2.49ms
669 $tree,
670 $tree->{$type},
671 defined($op->[cVAR]) ? $name . "." . $op->[cVAR] : $name
672 );
673123107µs if (defined($op->[cTAG]) && $ref->[0][cTYPE] == opCHOICE) {
674 @{$op}[cTYPE,cCHILD] = (opSEQUENCE,$ref);
675 }
676 else {
677121205µs @{$op}[cTYPE,cCHILD,cLOOP] = @{$ref->[0]}[cTYPE,cCHILD,cLOOP];
678 }
679123183µs4590µs $op->[cTAG] = defined($op->[cTAG]) ? asn_encode_tag($op->[cTAG]): $ref->[0][cTAG];
# spent 90µs making 45 calls to Convert::ASN1::asn_encode_tag, avg 2µs/call
680 }
681250186µs $op->[cTAG] |= chr(ASN_CONSTRUCTOR)
682 if length $op->[cTAG] && ($op->[cTYPE] == opSET || $op->[cTYPE] == opSEQUENCE);
683
684250229µs if ($op->[cCHILD]) {
685 ;# If we have children we are one of
686 ;# opSET opSEQUENCE opCHOICE
687
688124263µs1240s compile_one($tree, $op->[cCHILD], defined($op->[cVAR]) ? $name . "." . $op->[cVAR] : $name);
# spent 9.22ms making 124 calls to Convert::ASN1::parser::compile_one, avg 74µs/call, recursion: max depth 9, sum of overlapping time 9.22ms
689
690 ;# If a CHOICE is given a tag, then it must be EXPLICIT
69112460µs if ($op->[cTYPE] == opCHOICE && defined($op->[cTAG]) && length($op->[cTAG])) {
692 $op = bless explicit($op);
693 $op->[cTYPE] = opSEQUENCE;
694 }
695
69612496µs if ( @{$op->[cCHILD]} > 1) {
697 ;#if ($op->[cTYPE] != opSEQUENCE) {
698 ;# Here we need to flatten CHOICEs and check that SET and CHOICE
699 ;# do not contain duplicate tags
700 ;#}
7019434µs if ($op->[cTYPE] == opSET) {
702 ;# In case we do CER encoding we order the SET elements by thier tags
703 my @tags = map {
704 length($_->[cTAG])
705 ? $_->[cTAG]
706 : $_->[cTYPE] == opCHOICE
707 ? (sort map { $_->[cTAG] } $_->[cCHILD])[0]
708 : ''
709 } @{$op->[cCHILD]};
710 @{$op->[cCHILD]} = @{$op->[cCHILD]}[sort { $tags[$a] cmp $tags[$b] } 0..$#tags];
711 }
712 }
713 else {
714 ;# A SET of one element can be treated the same as a SEQUENCE
7153014µs $op->[cTYPE] = opSEQUENCE if $op->[cTYPE] == opSET;
716 }
717 }
718 }
719320753µs $ops;
720}
721
722
# spent 4.70ms (233µs+4.47) within Convert::ASN1::parser::compile which was called: # once (233µs+4.47ms) by Convert::ASN1::parser::parse at line 650
sub compile {
72311µs my $tree = shift;
724
725 ;# The tree should be valid enough to be able to
726 ;# - resolve references
727 ;# - encode tags
728 ;# - verify CHOICEs do not contain duplicate tags
729
730 ;# once references have been resolved, and also due to
731 ;# flattening of COMPONENTS, it is possible for an op
732 ;# to appear in multiple places. So once an op is
733 ;# compiled we bless it. This ensure we dont try to
734 ;# compile it again.
735
7361184µs734.47ms while(my($k,$v) = each %$tree) {
# spent 4.47ms making 73 calls to Convert::ASN1::parser::compile_one, avg 61µs/call
737 compile_one($tree,$v,$k);
738 }
739
74016µs $tree;
741}
742
743
# spent 1.58ms (1.52+52µs) within Convert::ASN1::parser::verify which was called: # once (1.52ms+52µs) by Convert::ASN1::parser::parse at line 650
sub verify {
74412µs my $tree = shift or return;
7451800ns my $err = "";
746
747 ;# Well it parsed correctly, now we
748 ;# - check references exist
749 ;# - flatten COMPONENTS OF (checking for loops)
750 ;# - check for duplicate var names
751
7521109µs while(my($name,$ops) = each %$tree) {
7537333µs my $stash = {};
7547319µs my @scope = ();
7557319µs my $path = "";
7567318µs my $idx = 0;
757
7587320µs while($ops) {
759414291µs if ($idx < @$ops) {
760269121µs my $op = $ops->[$idx++];
76126949µs my $var;
762269276µs if (defined ($var = $op->[cVAR])) {
763
764 $err .= "$name: $path.$var used multiple times\n"
765 if $stash->{$var}++;
766
767 }
768269116µs if (defined $op->[cCHILD]) {
7697663µs452µs if (ref $op->[cCHILD]) {
# spent 52µs making 4 calls to Convert::ASN1::parser::expand_ops, avg 13µs/call
7707274µs push @scope, [$stash, $path, $ops, $idx];
7717220µs if (defined $var) {
772167µs $stash = {};
7731610µs $path .= "." . $var;
774 }
7757217µs $idx = 0;
7767231µs $ops = $op->[cCHILD];
777 }
778 elsif ($op->[cTYPE] eq 'COMPONENTS') {
779 splice(@$ops,--$idx,1,expand_ops($tree, $op->[cCHILD]));
780 }
781 else {
782 die "Internal error\n";
783 }
784 }
785 }
786 else {
787145106µs my $s = pop @scope
788 or last;
78972112µs ($stash,$path,$ops,$idx) = @$s;
790 }
791 }
792 }
7931600ns die $err if length $err;
79417µs $tree;
795}
796
797
# spent 52µs within Convert::ASN1::parser::expand_ops which was called 4 times, avg 13µs/call: # 4 times (52µs+0s) by Convert::ASN1::parser::verify at line 769, avg 13µs/call
sub expand_ops {
79842µs my $tree = shift;
79943µs my $want = shift;
80042µs my $seen = shift || { };
801
80244µs die "COMPONENTS OF loop $want\n" if $seen->{$want}++;
80342µs die "Undefined macro $want\n" unless exists $tree->{$want};
80442µs my $ops = $tree->{$want};
80546µs die "Bad macro for COMPUNENTS OF '$want'\n"
806 unless @$ops == 1
807 && ($ops->[0][cTYPE] eq 'SEQUENCE' || $ops->[0][cTYPE] eq 'SET')
808 && ref $ops->[0][cCHILD];
80942µs $ops = $ops->[0][cCHILD];
81043µs for(my $idx = 0 ; $idx < @$ops ; ) {
811114µs my $op = $ops->[$idx++];
812119µs if ($op->[cTYPE] eq 'COMPONENTS') {
813 splice(@$ops,--$idx,1,expand_ops($tree, $op->[cCHILD], $seen));
814 }
81541µs }
816
817421µs @$ops;
818}
819
820sub _yylex {
821 my $ret = &_yylex;
822 warn $ret;
823 $ret;
824}
825
826
# spent 31.1ms (20.9+10.1) within Convert::ASN1::parser::yylex which was called 1244 times, avg 25µs/call: # 1244 times (20.9ms+10.1ms) by Convert::ASN1::parser::yyparse at line 267, avg 25µs/call
sub yylex {
8271244821µs return shift @stacked if @stacked;
828
829118118.8ms47589.38ms while ($asn =~ /\G(?:
# spent 8.41ms making 2379 calls to Convert::ASN1::parser::CORE:match, avg 4µs/call # spent 964µs making 2379 calls to Convert::ASN1::parser::CORE:regcomp, avg 405ns/call
830 (\s+|--[^\n]*)
831 |
832 ([,{}]|::=)
833 |
834 ($reserved)\b
835 |
836 (
837 (?:OCTET|BIT)\s+STRING
838 |
839 OBJECT\s+IDENTIFIER
840 |
841 RELATIVE-OID
842 )\b
843 |
844 (\w+(?:-\w+)*)
845 |
846 \[\s*
847 (
848 (?:(?:APPLICATION|PRIVATE|UNIVERSAL|CONTEXT)\s+)?
849 \d+
850 )
851 \s*\]
852 |
853 \((\d+)\)
854 )/sxgo
855 ) {
856
85723782.02ms ($last_pos,$pos) = ($pos,pos($asn));
858
85923782.34ms next if defined $1; # comment or whitespace
860
8611180846µs if (defined $2 or defined $3) {
862 # A comma is not required after a '}' so to aid the
863 # parser we insert a fake token after any '}'
864519535µs push @stacked, constPOSTRBRACE() if defined $2 and $+ eq '}';
865
8665191.80ms return $reserved{$yylval = $+};
867 }
868
869661322µs if (defined $4) {
87018193µs18127µs ($yylval = $+) =~ s/\s+/_/g;
# spent 127µs making 18 calls to Convert::ASN1::parser::CORE:subst, avg 7µs/call
8711842µs return constWORD();
872 }
873
874643436µs if (defined $5) {
875479425µs $yylval = $+;
8764791.25ms return constWORD();
877 }
878
87916487µs if (defined $6) {
88074500µs74263µs my($class,$num) = ($+ =~ /^([A-Z]*)\s*(\d+)$/);
# spent 263µs making 74 calls to Convert::ASN1::parser::CORE:match, avg 4µs/call
88174218µs74374µs $yylval = asn_tag($tag_class{$class}, $num);
# spent 374µs making 74 calls to Convert::ASN1::asn_tag, avg 5µs/call
88274169µs return constCLASS();
883 }
884
8859065µs if (defined $7) {
8869062µs $yylval = $+;
88790232µs return constNUMBER();
888 }
889
890 die "Internal error\n";
891
892 }
893
8941900ns die "Parse error before ",substr($asn,$pos,40),"\n"
895 unless $pos == length($asn);
896
89712µs 0
898}
899
900sub yyerror {
901 die @_," ",substr($asn,$last_pos,40),"\n";
902}
903
9041100ns1;
905
906133µs%yystate = ('State51','','State34','','State11','','State33','','State24',
907'','State40','','State31','','State37','','State23','','State22','',
908'State21','','State57','','State39','','State56','','State20','','State25',
909'','State38','','State14','','State19','','State46','','State5','',
910'State53','','State26','','State27','','State50','','State36','','State4',
911'','State3','','State32','','State49','','State30','','State35','',
912'State48','','State55','','State42','','State28','','State58','','State41',
913'','State18','','State59','','State1','','State54','','State60',
914'');
915
916197µs1;
 
# spent 8.69ms within Convert::ASN1::parser::CORE:match which was called 2470 times, avg 4µs/call: # 2379 times (8.41ms+0s) by Convert::ASN1::parser::yylex at line 829, avg 4µs/call # 74 times (263µs+0s) by Convert::ASN1::parser::yylex at line 880, avg 4µs/call # 17 times (19µs+0s) by Convert::ASN1::BEGIN@415 at line 626, avg 1µs/call
sub Convert::ASN1::parser::CORE:match; # opcode
# spent 964µs within Convert::ASN1::parser::CORE:regcomp which was called 2379 times, avg 405ns/call: # 2379 times (964µs+0s) by Convert::ASN1::parser::yylex at line 829, avg 405ns/call
sub Convert::ASN1::parser::CORE:regcomp; # opcode
# spent 8µs within Convert::ASN1::parser::CORE:sort which was called: # once (8µs+0s) by Convert::ASN1::BEGIN@415 at line 626
sub Convert::ASN1::parser::CORE:sort; # opcode
# spent 127µs within Convert::ASN1::parser::CORE:subst which was called 18 times, avg 7µs/call: # 18 times (127µs+0s) by Convert::ASN1::parser::yylex at line 870, avg 7µs/call
sub Convert::ASN1::parser::CORE:subst; # opcode