| Filename | /usr/share/perl/5.28/warnings.pm |
| Statements | Executed 1138 statements in 1.63ms |
| Calls | P | F | Exclusive Time |
Inclusive Time |
Subroutine |
|---|---|---|---|---|---|
| 43 | 1 | 1 | 569µs | 730µs | warnings::_bits |
| 43 | 43 | 43 | 344µs | 1.07ms | warnings::import |
| 56 | 2 | 1 | 222µs | 222µs | warnings::_expand_bits |
| 13 | 13 | 8 | 196µs | 256µs | warnings::unimport |
| 4 | 1 | 1 | 64µs | 97µs | warnings::register_categories |
| 8 | 2 | 1 | 32µs | 32µs | warnings::_mkMask |
| 1 | 1 | 1 | 3µs | 3µs | warnings::CORE:match (opcode) |
| 0 | 0 | 0 | 0s | 0s | warnings::Croaker |
| 0 | 0 | 0 | 0s | 0s | warnings::__chk |
| 0 | 0 | 0 | 0s | 0s | warnings::_error_loc |
| 0 | 0 | 0 | 0s | 0s | warnings::bits |
| 0 | 0 | 0 | 0s | 0s | warnings::enabled |
| 0 | 0 | 0 | 0s | 0s | warnings::enabled_at_level |
| 0 | 0 | 0 | 0s | 0s | warnings::fatal_enabled |
| 0 | 0 | 0 | 0s | 0s | warnings::fatal_enabled_at_level |
| 0 | 0 | 0 | 0s | 0s | warnings::warn |
| 0 | 0 | 0 | 0s | 0s | warnings::warn_at_level |
| 0 | 0 | 0 | 0s | 0s | warnings::warnif |
| 0 | 0 | 0 | 0s | 0s | warnings::warnif_at_level |
| Line | State ments |
Time on line |
Calls | Time in subs |
Code |
|---|---|---|---|---|---|
| 1 | # -*- buffer-read-only: t -*- | ||||
| 2 | # !!!!!!! DO NOT EDIT THIS FILE !!!!!!! | ||||
| 3 | # This file is built by regen/warnings.pl. | ||||
| 4 | # Any changes made here will be lost! | ||||
| 5 | |||||
| 6 | package warnings; | ||||
| 7 | |||||
| 8 | 1 | 300ns | our $VERSION = "1.42"; | ||
| 9 | |||||
| 10 | # Verify that we're called correctly so that warnings will work. | ||||
| 11 | # Can't use Carp, since Carp uses us! | ||||
| 12 | # String regexps because constant folding = smaller optree = less memory vs regexp literal | ||||
| 13 | # see also strict.pm. | ||||
| 14 | 1 | 9µs | 1 | 3µs | die sprintf "Incorrect use of pragma '%s' at %s line %d.\n", __PACKAGE__, +(caller)[1,2] # spent 3µs making 1 call to warnings::CORE:match |
| 15 | if __FILE__ !~ ( '(?x) \b '.__PACKAGE__.' \.pmc? \z' ) | ||||
| 16 | && __FILE__ =~ ( '(?x) \b (?i:'.__PACKAGE__.') \.pmc? \z' ); | ||||
| 17 | |||||
| 18 | 1 | 24µs | our %Offsets = ( | ||
| 19 | # Warnings Categories added in Perl 5.008 | ||||
| 20 | 'all' => 0, | ||||
| 21 | 'closure' => 2, | ||||
| 22 | 'deprecated' => 4, | ||||
| 23 | 'exiting' => 6, | ||||
| 24 | 'glob' => 8, | ||||
| 25 | 'io' => 10, | ||||
| 26 | 'closed' => 12, | ||||
| 27 | 'exec' => 14, | ||||
| 28 | 'layer' => 16, | ||||
| 29 | 'newline' => 18, | ||||
| 30 | 'pipe' => 20, | ||||
| 31 | 'unopened' => 22, | ||||
| 32 | 'misc' => 24, | ||||
| 33 | 'numeric' => 26, | ||||
| 34 | 'once' => 28, | ||||
| 35 | 'overflow' => 30, | ||||
| 36 | 'pack' => 32, | ||||
| 37 | 'portable' => 34, | ||||
| 38 | 'recursion' => 36, | ||||
| 39 | 'redefine' => 38, | ||||
| 40 | 'regexp' => 40, | ||||
| 41 | 'severe' => 42, | ||||
| 42 | 'debugging' => 44, | ||||
| 43 | 'inplace' => 46, | ||||
| 44 | 'internal' => 48, | ||||
| 45 | 'malloc' => 50, | ||||
| 46 | 'signal' => 52, | ||||
| 47 | 'substr' => 54, | ||||
| 48 | 'syntax' => 56, | ||||
| 49 | 'ambiguous' => 58, | ||||
| 50 | 'bareword' => 60, | ||||
| 51 | 'digit' => 62, | ||||
| 52 | 'parenthesis' => 64, | ||||
| 53 | 'precedence' => 66, | ||||
| 54 | 'printf' => 68, | ||||
| 55 | 'prototype' => 70, | ||||
| 56 | 'qw' => 72, | ||||
| 57 | 'reserved' => 74, | ||||
| 58 | 'semicolon' => 76, | ||||
| 59 | 'taint' => 78, | ||||
| 60 | 'threads' => 80, | ||||
| 61 | 'uninitialized' => 82, | ||||
| 62 | 'unpack' => 84, | ||||
| 63 | 'untie' => 86, | ||||
| 64 | 'utf8' => 88, | ||||
| 65 | 'void' => 90, | ||||
| 66 | |||||
| 67 | # Warnings Categories added in Perl 5.011 | ||||
| 68 | 'imprecision' => 92, | ||||
| 69 | 'illegalproto' => 94, | ||||
| 70 | |||||
| 71 | # Warnings Categories added in Perl 5.013 | ||||
| 72 | 'non_unicode' => 96, | ||||
| 73 | 'nonchar' => 98, | ||||
| 74 | 'surrogate' => 100, | ||||
| 75 | |||||
| 76 | # Warnings Categories added in Perl 5.017 | ||||
| 77 | 'experimental' => 102, | ||||
| 78 | 'experimental::lexical_subs' => 104, | ||||
| 79 | 'experimental::regex_sets' => 106, | ||||
| 80 | 'experimental::smartmatch' => 108, | ||||
| 81 | |||||
| 82 | # Warnings Categories added in Perl 5.019 | ||||
| 83 | 'experimental::postderef' => 110, | ||||
| 84 | 'experimental::signatures' => 112, | ||||
| 85 | 'syscalls' => 114, | ||||
| 86 | |||||
| 87 | # Warnings Categories added in Perl 5.021 | ||||
| 88 | 'experimental::bitwise' => 116, | ||||
| 89 | 'experimental::const_attr' => 118, | ||||
| 90 | 'experimental::re_strict' => 120, | ||||
| 91 | 'experimental::refaliasing' => 122, | ||||
| 92 | 'experimental::win32_perlio' => 124, | ||||
| 93 | 'locale' => 126, | ||||
| 94 | 'missing' => 128, | ||||
| 95 | 'redundant' => 130, | ||||
| 96 | |||||
| 97 | # Warnings Categories added in Perl 5.025 | ||||
| 98 | 'experimental::declared_refs' => 132, | ||||
| 99 | |||||
| 100 | # Warnings Categories added in Perl 5.027 | ||||
| 101 | 'experimental::alpha_assertions' => 134, | ||||
| 102 | 'experimental::script_run' => 136, | ||||
| 103 | 'shadow' => 138, | ||||
| 104 | ); | ||||
| 105 | |||||
| 106 | 1 | 15µs | our %Bits = ( | ||
| 107 | 'all' => "\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55", # [0..71] | ||||
| 108 | 'ambiguous' => "\x00\x00\x00\x00\x00\x00\x00\x04\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00", # [29] | ||||
| 109 | 'bareword' => "\x00\x00\x00\x00\x00\x00\x00\x10\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00", # [30] | ||||
| 110 | 'closed' => "\x00\x10\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00", # [6] | ||||
| 111 | 'closure' => "\x04\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00", # [1] | ||||
| 112 | 'debugging' => "\x00\x00\x00\x00\x00\x10\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00", # [22] | ||||
| 113 | 'deprecated' => "\x10\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00", # [2] | ||||
| 114 | 'digit' => "\x00\x00\x00\x00\x00\x00\x00\x40\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00", # [31] | ||||
| 115 | 'exec' => "\x00\x40\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00", # [7] | ||||
| 116 | 'exiting' => "\x40\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00", # [3] | ||||
| 117 | 'experimental' => "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x40\x55\x51\x15\x50\x01", # [51..56,58..62,66..68] | ||||
| 118 | 'experimental::alpha_assertions' => "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x40\x00", # [67] | ||||
| 119 | 'experimental::bitwise' => "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x10\x00\x00\x00", # [58] | ||||
| 120 | 'experimental::const_attr' => "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x40\x00\x00\x00", # [59] | ||||
| 121 | 'experimental::declared_refs' => "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x10\x00", # [66] | ||||
| 122 | 'experimental::lexical_subs' => "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01\x00\x00\x00\x00", # [52] | ||||
| 123 | 'experimental::postderef' => "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x40\x00\x00\x00\x00", # [55] | ||||
| 124 | 'experimental::re_strict' => "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01\x00\x00", # [60] | ||||
| 125 | 'experimental::refaliasing' => "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x04\x00\x00", # [61] | ||||
| 126 | 'experimental::regex_sets' => "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x04\x00\x00\x00\x00", # [53] | ||||
| 127 | 'experimental::script_run' => "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01", # [68] | ||||
| 128 | 'experimental::signatures' => "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01\x00\x00\x00", # [56] | ||||
| 129 | 'experimental::smartmatch' => "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x10\x00\x00\x00\x00", # [54] | ||||
| 130 | 'experimental::win32_perlio' => "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x10\x00\x00", # [62] | ||||
| 131 | 'glob' => "\x00\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00", # [4] | ||||
| 132 | 'illegalproto' => "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x40\x00\x00\x00\x00\x00\x00", # [47] | ||||
| 133 | 'imprecision' => "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x10\x00\x00\x00\x00\x00\x00", # [46] | ||||
| 134 | 'inplace' => "\x00\x00\x00\x00\x00\x40\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00", # [23] | ||||
| 135 | 'internal' => "\x00\x00\x00\x00\x00\x00\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00", # [24] | ||||
| 136 | 'io' => "\x00\x54\x55\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x04\x00\x00\x00", # [5..11,57] | ||||
| 137 | 'layer' => "\x00\x00\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00", # [8] | ||||
| 138 | 'locale' => "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x40\x00\x00", # [63] | ||||
| 139 | 'malloc' => "\x00\x00\x00\x00\x00\x00\x04\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00", # [25] | ||||
| 140 | 'misc' => "\x00\x00\x00\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00", # [12] | ||||
| 141 | 'missing' => "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01\x00", # [64] | ||||
| 142 | 'newline' => "\x00\x00\x04\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00", # [9] | ||||
| 143 | 'non_unicode' => "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01\x00\x00\x00\x00\x00", # [48] | ||||
| 144 | 'nonchar' => "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x04\x00\x00\x00\x00\x00", # [49] | ||||
| 145 | 'numeric' => "\x00\x00\x00\x04\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00", # [13] | ||||
| 146 | 'once' => "\x00\x00\x00\x10\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00", # [14] | ||||
| 147 | 'overflow' => "\x00\x00\x00\x40\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00", # [15] | ||||
| 148 | 'pack' => "\x00\x00\x00\x00\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00", # [16] | ||||
| 149 | 'parenthesis' => "\x00\x00\x00\x00\x00\x00\x00\x00\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00", # [32] | ||||
| 150 | 'pipe' => "\x00\x00\x10\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00", # [10] | ||||
| 151 | 'portable' => "\x00\x00\x00\x00\x04\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00", # [17] | ||||
| 152 | 'precedence' => "\x00\x00\x00\x00\x00\x00\x00\x00\x04\x00\x00\x00\x00\x00\x00\x00\x00\x00", # [33] | ||||
| 153 | 'printf' => "\x00\x00\x00\x00\x00\x00\x00\x00\x10\x00\x00\x00\x00\x00\x00\x00\x00\x00", # [34] | ||||
| 154 | 'prototype' => "\x00\x00\x00\x00\x00\x00\x00\x00\x40\x00\x00\x00\x00\x00\x00\x00\x00\x00", # [35] | ||||
| 155 | 'qw' => "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01\x00\x00\x00\x00\x00\x00\x00\x00", # [36] | ||||
| 156 | 'recursion' => "\x00\x00\x00\x00\x10\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00", # [18] | ||||
| 157 | 'redefine' => "\x00\x00\x00\x00\x40\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00", # [19] | ||||
| 158 | 'redundant' => "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x04\x00", # [65] | ||||
| 159 | 'regexp' => "\x00\x00\x00\x00\x00\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00", # [20] | ||||
| 160 | 'reserved' => "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x04\x00\x00\x00\x00\x00\x00\x00\x00", # [37] | ||||
| 161 | 'semicolon' => "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x10\x00\x00\x00\x00\x00\x00\x00\x00", # [38] | ||||
| 162 | 'severe' => "\x00\x00\x00\x00\x00\x54\x05\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00", # [21..25] | ||||
| 163 | 'shadow' => "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x04", # [69] | ||||
| 164 | 'signal' => "\x00\x00\x00\x00\x00\x00\x10\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00", # [26] | ||||
| 165 | 'substr' => "\x00\x00\x00\x00\x00\x00\x40\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00", # [27] | ||||
| 166 | 'surrogate' => "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x10\x00\x00\x00\x00\x00", # [50] | ||||
| 167 | 'syntax' => "\x00\x00\x00\x00\x00\x00\x00\x55\x55\x15\x00\x40\x00\x00\x00\x00\x00\x00", # [28..38,47] | ||||
| 168 | 'syscalls' => "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x04\x00\x00\x00", # [57] | ||||
| 169 | 'taint' => "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x40\x00\x00\x00\x00\x00\x00\x00\x00", # [39] | ||||
| 170 | 'threads' => "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01\x00\x00\x00\x00\x00\x00\x00", # [40] | ||||
| 171 | 'uninitialized' => "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x04\x00\x00\x00\x00\x00\x00\x00", # [41] | ||||
| 172 | 'unopened' => "\x00\x00\x40\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00", # [11] | ||||
| 173 | 'unpack' => "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x10\x00\x00\x00\x00\x00\x00\x00", # [42] | ||||
| 174 | 'untie' => "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x40\x00\x00\x00\x00\x00\x00\x00", # [43] | ||||
| 175 | 'utf8' => "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01\x15\x00\x00\x00\x00\x00", # [44,48..50] | ||||
| 176 | 'void' => "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x04\x00\x00\x00\x00\x00\x00", # [45] | ||||
| 177 | ); | ||||
| 178 | |||||
| 179 | 1 | 15µs | our %DeadBits = ( | ||
| 180 | 'all' => "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa", # [0..71] | ||||
| 181 | 'ambiguous' => "\x00\x00\x00\x00\x00\x00\x00\x08\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00", # [29] | ||||
| 182 | 'bareword' => "\x00\x00\x00\x00\x00\x00\x00\x20\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00", # [30] | ||||
| 183 | 'closed' => "\x00\x20\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00", # [6] | ||||
| 184 | 'closure' => "\x08\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00", # [1] | ||||
| 185 | 'debugging' => "\x00\x00\x00\x00\x00\x20\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00", # [22] | ||||
| 186 | 'deprecated' => "\x20\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00", # [2] | ||||
| 187 | 'digit' => "\x00\x00\x00\x00\x00\x00\x00\x80\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00", # [31] | ||||
| 188 | 'exec' => "\x00\x80\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00", # [7] | ||||
| 189 | 'exiting' => "\x80\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00", # [3] | ||||
| 190 | 'experimental' => "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x80\xaa\xa2\x2a\xa0\x02", # [51..56,58..62,66..68] | ||||
| 191 | 'experimental::alpha_assertions' => "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x80\x00", # [67] | ||||
| 192 | 'experimental::bitwise' => "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x20\x00\x00\x00", # [58] | ||||
| 193 | 'experimental::const_attr' => "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x80\x00\x00\x00", # [59] | ||||
| 194 | 'experimental::declared_refs' => "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x20\x00", # [66] | ||||
| 195 | 'experimental::lexical_subs' => "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x00\x00\x00", # [52] | ||||
| 196 | 'experimental::postderef' => "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x80\x00\x00\x00\x00", # [55] | ||||
| 197 | 'experimental::re_strict' => "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x00", # [60] | ||||
| 198 | 'experimental::refaliasing' => "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x08\x00\x00", # [61] | ||||
| 199 | 'experimental::regex_sets' => "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x08\x00\x00\x00\x00", # [53] | ||||
| 200 | 'experimental::script_run' => "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02", # [68] | ||||
| 201 | 'experimental::signatures' => "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x00\x00", # [56] | ||||
| 202 | 'experimental::smartmatch' => "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x20\x00\x00\x00\x00", # [54] | ||||
| 203 | 'experimental::win32_perlio' => "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x20\x00\x00", # [62] | ||||
| 204 | 'glob' => "\x00\x02\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00", # [4] | ||||
| 205 | 'illegalproto' => "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x80\x00\x00\x00\x00\x00\x00", # [47] | ||||
| 206 | 'imprecision' => "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x20\x00\x00\x00\x00\x00\x00", # [46] | ||||
| 207 | 'inplace' => "\x00\x00\x00\x00\x00\x80\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00", # [23] | ||||
| 208 | 'internal' => "\x00\x00\x00\x00\x00\x00\x02\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00", # [24] | ||||
| 209 | 'io' => "\x00\xa8\xaa\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x08\x00\x00\x00", # [5..11,57] | ||||
| 210 | 'layer' => "\x00\x00\x02\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00", # [8] | ||||
| 211 | 'locale' => "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x80\x00\x00", # [63] | ||||
| 212 | 'malloc' => "\x00\x00\x00\x00\x00\x00\x08\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00", # [25] | ||||
| 213 | 'misc' => "\x00\x00\x00\x02\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00", # [12] | ||||
| 214 | 'missing' => "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00", # [64] | ||||
| 215 | 'newline' => "\x00\x00\x08\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00", # [9] | ||||
| 216 | 'non_unicode' => "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x00\x00\x00\x00", # [48] | ||||
| 217 | 'nonchar' => "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x08\x00\x00\x00\x00\x00", # [49] | ||||
| 218 | 'numeric' => "\x00\x00\x00\x08\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00", # [13] | ||||
| 219 | 'once' => "\x00\x00\x00\x20\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00", # [14] | ||||
| 220 | 'overflow' => "\x00\x00\x00\x80\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00", # [15] | ||||
| 221 | 'pack' => "\x00\x00\x00\x00\x02\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00", # [16] | ||||
| 222 | 'parenthesis' => "\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x00\x00\x00\x00\x00\x00\x00\x00", # [32] | ||||
| 223 | 'pipe' => "\x00\x00\x20\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00", # [10] | ||||
| 224 | 'portable' => "\x00\x00\x00\x00\x08\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00", # [17] | ||||
| 225 | 'precedence' => "\x00\x00\x00\x00\x00\x00\x00\x00\x08\x00\x00\x00\x00\x00\x00\x00\x00\x00", # [33] | ||||
| 226 | 'printf' => "\x00\x00\x00\x00\x00\x00\x00\x00\x20\x00\x00\x00\x00\x00\x00\x00\x00\x00", # [34] | ||||
| 227 | 'prototype' => "\x00\x00\x00\x00\x00\x00\x00\x00\x80\x00\x00\x00\x00\x00\x00\x00\x00\x00", # [35] | ||||
| 228 | 'qw' => "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x00\x00\x00\x00\x00\x00\x00", # [36] | ||||
| 229 | 'recursion' => "\x00\x00\x00\x00\x20\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00", # [18] | ||||
| 230 | 'redefine' => "\x00\x00\x00\x00\x80\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00", # [19] | ||||
| 231 | 'redundant' => "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x08\x00", # [65] | ||||
| 232 | 'regexp' => "\x00\x00\x00\x00\x00\x02\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00", # [20] | ||||
| 233 | 'reserved' => "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x08\x00\x00\x00\x00\x00\x00\x00\x00", # [37] | ||||
| 234 | 'semicolon' => "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x20\x00\x00\x00\x00\x00\x00\x00\x00", # [38] | ||||
| 235 | 'severe' => "\x00\x00\x00\x00\x00\xa8\x0a\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00", # [21..25] | ||||
| 236 | 'shadow' => "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x08", # [69] | ||||
| 237 | 'signal' => "\x00\x00\x00\x00\x00\x00\x20\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00", # [26] | ||||
| 238 | 'substr' => "\x00\x00\x00\x00\x00\x00\x80\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00", # [27] | ||||
| 239 | 'surrogate' => "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x20\x00\x00\x00\x00\x00", # [50] | ||||
| 240 | 'syntax' => "\x00\x00\x00\x00\x00\x00\x00\xaa\xaa\x2a\x00\x80\x00\x00\x00\x00\x00\x00", # [28..38,47] | ||||
| 241 | 'syscalls' => "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x08\x00\x00\x00", # [57] | ||||
| 242 | 'taint' => "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x80\x00\x00\x00\x00\x00\x00\x00\x00", # [39] | ||||
| 243 | 'threads' => "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x00\x00\x00\x00\x00\x00", # [40] | ||||
| 244 | 'uninitialized' => "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x08\x00\x00\x00\x00\x00\x00\x00", # [41] | ||||
| 245 | 'unopened' => "\x00\x00\x80\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00", # [11] | ||||
| 246 | 'unpack' => "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x20\x00\x00\x00\x00\x00\x00\x00", # [42] | ||||
| 247 | 'untie' => "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x80\x00\x00\x00\x00\x00\x00\x00", # [43] | ||||
| 248 | 'utf8' => "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x2a\x00\x00\x00\x00\x00", # [44,48..50] | ||||
| 249 | 'void' => "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x08\x00\x00\x00\x00\x00\x00", # [45] | ||||
| 250 | ); | ||||
| 251 | |||||
| 252 | # These are used by various things, including our own tests | ||||
| 253 | 1 | 200ns | our $NONE = "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"; | ||
| 254 | 1 | 200ns | our $DEFAULT = "\x10\x01\x00\x00\x00\x50\x04\x00\x00\x00\x00\x00\x00\x55\x51\x55\x50\x01", # [2,4,22,23,25,52..56,58..63,66..68] | ||
| 255 | our $LAST_BIT = 140 ; | ||||
| 256 | 1 | 100ns | our $BYTES = 18 ; | ||
| 257 | |||||
| 258 | sub Croaker | ||||
| 259 | { | ||||
| 260 | require Carp; # this initializes %CarpInternal | ||||
| 261 | local $Carp::CarpInternal{'warnings'}; | ||||
| 262 | delete $Carp::CarpInternal{'warnings'}; | ||||
| 263 | Carp::croak(@_); | ||||
| 264 | } | ||||
| 265 | |||||
| 266 | sub _expand_bits { | ||||
| 267 | 56 | 28µs | my $bits = shift; | ||
| 268 | 56 | 39µs | my $want_len = ($LAST_BIT + 7) >> 3; | ||
| 269 | 56 | 15µs | my $len = length($bits); | ||
| 270 | 56 | 20µs | if ($len != $want_len) { | ||
| 271 | 7 | 5µs | if ($bits eq "") { | ||
| 272 | $bits = "\x00" x $want_len; | ||||
| 273 | } elsif ($len > $want_len) { | ||||
| 274 | substr $bits, $want_len, $len-$want_len, ""; | ||||
| 275 | } else { | ||||
| 276 | 7 | 8µs | my $a = vec($bits, $Offsets{all} >> 1, 2); | ||
| 277 | 7 | 3µs | $a |= $a << 2; | ||
| 278 | 7 | 1µs | $a |= $a << 4; | ||
| 279 | 7 | 8µs | $bits .= chr($a) x ($want_len - $len); | ||
| 280 | } | ||||
| 281 | } | ||||
| 282 | 56 | 181µs | return $bits; | ||
| 283 | } | ||||
| 284 | |||||
| 285 | # spent 730µs (569+161) within warnings::_bits which was called 43 times, avg 17µs/call:
# 43 times (569µs+161µs) by warnings::import at line 331, avg 17µs/call | ||||
| 286 | 43 | 16µs | my $mask = shift ; | ||
| 287 | 43 | 6µs | my $catmask ; | ||
| 288 | 43 | 11µs | my $fatal = 0 ; | ||
| 289 | 43 | 9µs | my $no_fatal = 0 ; | ||
| 290 | |||||
| 291 | 43 | 82µs | 43 | 162µs | $mask = _expand_bits($mask); # spent 162µs making 43 calls to warnings::_expand_bits, avg 4µs/call |
| 292 | 43 | 31µs | foreach my $word ( @_ ) { | ||
| 293 | 43 | 76µs | if ($word eq 'FATAL') { | ||
| 294 | $fatal = 1; | ||||
| 295 | $no_fatal = 0; | ||||
| 296 | } | ||||
| 297 | elsif ($word eq 'NONFATAL') { | ||||
| 298 | $fatal = 0; | ||||
| 299 | $no_fatal = 1; | ||||
| 300 | } | ||||
| 301 | elsif ($catmask = $Bits{$word}) { | ||||
| 302 | 43 | 27µs | $mask |= $catmask ; | ||
| 303 | 43 | 11µs | $mask |= $DeadBits{$word} if $fatal ; | ||
| 304 | 43 | 10µs | $mask = ~(~$mask | $DeadBits{$word}) if $no_fatal ; | ||
| 305 | } | ||||
| 306 | else | ||||
| 307 | { Croaker("Unknown warnings category '$word'")} | ||||
| 308 | } | ||||
| 309 | |||||
| 310 | 43 | 255µs | return $mask ; | ||
| 311 | } | ||||
| 312 | |||||
| 313 | sub bits | ||||
| 314 | { | ||||
| 315 | # called from B::Deparse.pm | ||||
| 316 | push @_, 'all' unless @_ ; | ||||
| 317 | return _bits("", @_) ; | ||||
| 318 | } | ||||
| 319 | |||||
| 320 | sub import | ||||
| 321 | # spent 1.07ms (344µs+730µs) within warnings::import which was called 43 times, avg 25µs/call:
# once (11µs+172µs) by overloading::BEGIN@2 at line 2 of overloading.pm
# once (18µs+28µs) by Template::Iterator::BEGIN@25 at line 25 of Template/Iterator.pm
# once (18µs+26µs) by Unicode::UTF8::BEGIN@4 at line 4 of Unicode/UTF8.pm
# once (17µs+23µs) by Template::Context::BEGIN@24 at line 24 of Template/Context.pm
# once (12µs+22µs) by main::BEGIN@16 at line 16 of Getopt/Long.pm
# once (12µs+22µs) by Config::BEGIN@6 at line 6 of Config_heavy.pl
# once (12µs+21µs) by File::Copy::BEGIN@12 at line 12 of File/Copy.pm
# once (13µs+19µs) by Sort::Versions::BEGIN@9 at line 9 of Sort/Versions.pm
# once (12µs+20µs) by Template::Plugins::BEGIN@27 at line 27 of Template/Plugins.pm
# once (12µs+19µs) by File::Copy::Recursive::BEGIN@9 at line 9 of File/Copy/Recursive.pm
# once (11µs+18µs) by Template::Stash::XS::BEGIN@15 at line 15 of Template/Stash/XS.pm
# once (9µs+19µs) by Carp::BEGIN@5 at line 5 of Carp.pm
# once (10µs+19µs) by Encode::Encoding::BEGIN@5 at line 5 of Encode/Encoding.pm
# once (12µs+16µs) by Template::Grammar::BEGIN@31 at line 31 of Template/Grammar.pm
# once (10µs+18µs) by Template::Service::BEGIN@24 at line 24 of Template/Service.pm
# once (10µs+17µs) by RBM::BEGIN@2.5 at line 2 of IO/CaptureOutput.pm
# once (10µs+16µs) by Template::Parser::BEGIN@36 at line 36 of Template/Parser.pm
# once (11µs+15µs) by IO::BEGIN@8 at line 8 of IO.pm
# once (9µs+16µs) by Encode::BEGIN@6 at line 6 of Encode.pm
# once (6µs+11µs) by File::Basename::BEGIN@14 at line 14 of File/Basename.pm
# once (5µs+11µs) by Template::Config::BEGIN@22 at line 22 of Template/Config.pm
# once (6µs+10µs) by Digest::SHA::BEGIN@6 at line 6 of Digest/SHA.pm
# once (5µs+11µs) by Config::BEGIN@10 at line 10 of Config.pm
# once (5µs+10µs) by Encode::MIME::Name::BEGIN@3 at line 3 of Encode/MIME/Name.pm
# once (5µs+9µs) by Template::Filters::BEGIN@23 at line 23 of Template/Filters.pm
# once (5µs+9µs) by Encode::Alias::BEGIN@3 at line 3 of Encode/Alias.pm
# once (5µs+9µs) by RBM::BEGIN@3 at line 3 of /root/tor-browser-build/rbm/lib/RBM.pm
# once (5µs+9µs) by RBM::DefaultConfig::BEGIN@4 at line 4 of /root/tor-browser-build/rbm/lib/RBM/DefaultConfig.pm
# once (5µs+9µs) by Encode::Config::BEGIN@8 at line 8 of Encode/Config.pm
# once (4µs+9µs) by YAML::XS::LibYAML::BEGIN@4 at line 4 of YAML/XS/LibYAML.pm
# once (5µs+9µs) by Template::BEGIN@23 at line 23 of Template.pm
# once (5µs+8µs) by Template::Directive::BEGIN@30 at line 30 of Template/Directive.pm
# once (5µs+8µs) by RBM::BEGIN@1.3 at line 1 of YAML/XS.pm
# once (4µs+8µs) by Scalar::Util::BEGIN@10 at line 10 of Scalar/Util.pm
# once (4µs+8µs) by List::Util::BEGIN@10 at line 10 of List/Util.pm
# once (4µs+8µs) by Template::Base::BEGIN@23 at line 23 of Template/Base.pm
# once (4µs+8µs) by Template::Document::BEGIN@25 at line 25 of Template/Document.pm
# once (4µs+8µs) by Template::Provider::BEGIN@42 at line 42 of Template/Provider.pm
# once (4µs+8µs) by Template::Exception::BEGIN@23 at line 23 of Template/Exception.pm
# once (4µs+7µs) by Template::Stash::BEGIN@23 at line 23 of Template/Stash.pm
# once (4µs+7µs) by Template::VMethods::BEGIN@25 at line 25 of Template/VMethods.pm
# once (4µs+7µs) by Template::Constants::BEGIN@23 at line 23 of Template/Constants.pm
# once (4µs+7µs) by RBM::BEGIN@3.1 at line 3 of Path/Tiny.pm | ||||
| 322 | 43 | 8µs | shift; | ||
| 323 | |||||
| 324 | 43 | 99µs | my $mask = ${^WARNING_BITS} // ($^W ? $Bits{all} : $DEFAULT) ; | ||
| 325 | |||||
| 326 | # append 'all' when implied (empty import list or after a lone | ||||
| 327 | # "FATAL" or "NONFATAL") | ||||
| 328 | 43 | 62µs | push @_, 'all' | ||
| 329 | if !@_ || (@_==1 && ($_[0] eq 'FATAL' || $_[0] eq 'NONFATAL')); | ||||
| 330 | |||||
| 331 | 43 | 222µs | 43 | 730µs | ${^WARNING_BITS} = _bits($mask, @_); # spent 730µs making 43 calls to warnings::_bits, avg 17µs/call |
| 332 | } | ||||
| 333 | |||||
| 334 | sub unimport | ||||
| 335 | # spent 256µs (196+60) within warnings::unimport which was called 13 times, avg 20µs/call:
# once (24µs+6µs) by Data::Dump::BEGIN@232 at line 232 of Data/Dump.pm
# once (22µs+5µs) by Carp::BEGIN@742 at line 742 of Carp.pm
# once (18µs+7µs) by Template::VMethods::BEGIN@118 at line 118 of Template/VMethods.pm
# once (17µs+7µs) by Template::Base::BEGIN@45 at line 45 of Template/Base.pm
# once (19µs+4µs) by Exporter::Heavy::BEGIN@188 at line 188 of Exporter/Heavy.pm
# once (15µs+6µs) by File::Copy::BEGIN@12.6 at line 12 of File/Copy.pm
# once (20µs+2µs) by Carp::BEGIN@6 at line 24 of Carp.pm
# once (17µs+3µs) by File::Glob::BEGIN@54 at line 54 of File/Glob.pm
# once (12µs+6µs) by Template::VMethods::BEGIN@469 at line 469 of Template/VMethods.pm
# once (12µs+3µs) by Path::Tiny::BEGIN@38 at line 38 of Path/Tiny.pm
# once (8µs+4µs) by Template::VMethods::BEGIN@496 at line 496 of Template/VMethods.pm
# once (7µs+4µs) by Template::VMethods::BEGIN@124 at line 124 of Template/VMethods.pm
# once (6µs+4µs) by Template::VMethods::BEGIN@502 at line 502 of Template/VMethods.pm | ||||
| 336 | 13 | 4µs | shift; | ||
| 337 | |||||
| 338 | 13 | 4µs | my $catmask ; | ||
| 339 | 13 | 24µs | my $mask = ${^WARNING_BITS} // ($^W ? $Bits{all} : $DEFAULT) ; | ||
| 340 | |||||
| 341 | # append 'all' when implied (empty import list or after a lone "FATAL") | ||||
| 342 | 13 | 20µs | push @_, 'all' if !@_ || @_==1 && $_[0] eq 'FATAL'; | ||
| 343 | |||||
| 344 | 13 | 23µs | 13 | 60µs | $mask = _expand_bits($mask); # spent 60µs making 13 calls to warnings::_expand_bits, avg 5µs/call |
| 345 | 13 | 12µs | foreach my $word ( @_ ) { | ||
| 346 | 13 | 53µs | if ($word eq 'FATAL') { | ||
| 347 | next; | ||||
| 348 | } | ||||
| 349 | elsif ($catmask = $Bits{$word}) { | ||||
| 350 | $mask = ~(~$mask | $catmask | $DeadBits{$word}); | ||||
| 351 | } | ||||
| 352 | else | ||||
| 353 | { Croaker("Unknown warnings category '$word'")} | ||||
| 354 | } | ||||
| 355 | |||||
| 356 | 13 | 54µs | ${^WARNING_BITS} = $mask ; | ||
| 357 | } | ||||
| 358 | |||||
| 359 | 2 | 2µs | my %builtin_type; @builtin_type{qw(SCALAR ARRAY HASH CODE REF GLOB LVALUE Regexp)} = (); | ||
| 360 | |||||
| 361 | sub LEVEL () { 8 }; | ||||
| 362 | sub MESSAGE () { 4 }; | ||||
| 363 | sub FATAL () { 2 }; | ||||
| 364 | sub NORMAL () { 1 }; | ||||
| 365 | |||||
| 366 | sub __chk | ||||
| 367 | { | ||||
| 368 | my $category ; | ||||
| 369 | my $offset ; | ||||
| 370 | my $isobj = 0 ; | ||||
| 371 | my $wanted = shift; | ||||
| 372 | my $has_message = $wanted & MESSAGE; | ||||
| 373 | my $has_level = $wanted & LEVEL ; | ||||
| 374 | |||||
| 375 | if ($has_level) { | ||||
| 376 | if (@_ != ($has_message ? 3 : 2)) { | ||||
| 377 | my $sub = (caller 1)[3]; | ||||
| 378 | my $syntax = $has_message | ||||
| 379 | ? "category, level, 'message'" | ||||
| 380 | : 'category, level'; | ||||
| 381 | Croaker("Usage: $sub($syntax)"); | ||||
| 382 | } | ||||
| 383 | } | ||||
| 384 | elsif (not @_ == 1 || @_ == ($has_message ? 2 : 0)) { | ||||
| 385 | my $sub = (caller 1)[3]; | ||||
| 386 | my $syntax = $has_message ? "[category,] 'message'" : '[category]'; | ||||
| 387 | Croaker("Usage: $sub($syntax)"); | ||||
| 388 | } | ||||
| 389 | |||||
| 390 | my $message = pop if $has_message; | ||||
| 391 | |||||
| 392 | if (@_) { | ||||
| 393 | # check the category supplied. | ||||
| 394 | $category = shift ; | ||||
| 395 | if (my $type = ref $category) { | ||||
| 396 | Croaker("not an object") | ||||
| 397 | if exists $builtin_type{$type}; | ||||
| 398 | $category = $type; | ||||
| 399 | $isobj = 1 ; | ||||
| 400 | } | ||||
| 401 | $offset = $Offsets{$category}; | ||||
| 402 | Croaker("Unknown warnings category '$category'") | ||||
| 403 | unless defined $offset; | ||||
| 404 | } | ||||
| 405 | else { | ||||
| 406 | $category = (caller(1))[0] ; | ||||
| 407 | $offset = $Offsets{$category}; | ||||
| 408 | Croaker("package '$category' not registered for warnings") | ||||
| 409 | unless defined $offset ; | ||||
| 410 | } | ||||
| 411 | |||||
| 412 | my $i; | ||||
| 413 | |||||
| 414 | if ($isobj) { | ||||
| 415 | my $pkg; | ||||
| 416 | $i = 2; | ||||
| 417 | while (do { { package DB; $pkg = (caller($i++))[0] } } ) { | ||||
| 418 | last unless @DB::args && $DB::args[0] =~ /^$category=/ ; | ||||
| 419 | } | ||||
| 420 | $i -= 2 ; | ||||
| 421 | } | ||||
| 422 | elsif ($has_level) { | ||||
| 423 | $i = 2 + shift; | ||||
| 424 | } | ||||
| 425 | else { | ||||
| 426 | $i = _error_loc(); # see where Carp will allocate the error | ||||
| 427 | } | ||||
| 428 | |||||
| 429 | # Default to 0 if caller returns nothing. Default to $DEFAULT if it | ||||
| 430 | # explicitly returns undef. | ||||
| 431 | my(@callers_bitmask) = (caller($i))[9] ; | ||||
| 432 | my $callers_bitmask = | ||||
| 433 | @callers_bitmask ? $callers_bitmask[0] // $DEFAULT : 0 ; | ||||
| 434 | length($callers_bitmask) > ($offset >> 3) or $offset = $Offsets{all}; | ||||
| 435 | |||||
| 436 | my @results; | ||||
| 437 | foreach my $type (FATAL, NORMAL) { | ||||
| 438 | next unless $wanted & $type; | ||||
| 439 | |||||
| 440 | push @results, vec($callers_bitmask, $offset + $type - 1, 1); | ||||
| 441 | } | ||||
| 442 | |||||
| 443 | # &enabled and &fatal_enabled | ||||
| 444 | return $results[0] unless $has_message; | ||||
| 445 | |||||
| 446 | # &warnif, and the category is neither enabled as warning nor as fatal | ||||
| 447 | return if ($wanted & (NORMAL | FATAL | MESSAGE)) | ||||
| 448 | == (NORMAL | FATAL | MESSAGE) | ||||
| 449 | && !($results[0] || $results[1]); | ||||
| 450 | |||||
| 451 | # If we have an explicit level, bypass Carp. | ||||
| 452 | if ($has_level and @callers_bitmask) { | ||||
| 453 | # logic copied from util.c:mess_sv | ||||
| 454 | my $stuff = " at " . join " line ", (caller $i)[1,2]; | ||||
| 455 | $stuff .= sprintf ", <%s> %s %d", | ||||
| 456 | *${^LAST_FH}{NAME}, | ||||
| 457 | ($/ eq "\n" ? "line" : "chunk"), $. | ||||
| 458 | if $. && ${^LAST_FH}; | ||||
| 459 | die "$message$stuff.\n" if $results[0]; | ||||
| 460 | return warn "$message$stuff.\n"; | ||||
| 461 | } | ||||
| 462 | |||||
| 463 | require Carp; | ||||
| 464 | Carp::croak($message) if $results[0]; | ||||
| 465 | # will always get here for &warn. will only get here for &warnif if the | ||||
| 466 | # category is enabled | ||||
| 467 | Carp::carp($message); | ||||
| 468 | } | ||||
| 469 | |||||
| 470 | sub _mkMask | ||||
| 471 | { | ||||
| 472 | 8 | 3µs | my ($bit) = @_; | ||
| 473 | 8 | 3µs | my $mask = ""; | ||
| 474 | |||||
| 475 | 8 | 14µs | vec($mask, $bit, 1) = 1; | ||
| 476 | 8 | 23µs | return $mask; | ||
| 477 | } | ||||
| 478 | |||||
| 479 | sub register_categories | ||||
| 480 | # spent 97µs (64+32) within warnings::register_categories which was called 4 times, avg 24µs/call:
# 4 times (64µs+32µs) by warnings::register::import at line 23 of warnings/register.pm, avg 24µs/call | ||||
| 481 | 4 | 4µs | my @names = @_; | ||
| 482 | |||||
| 483 | 4 | 11µs | for my $name (@names) { | ||
| 484 | 4 | 5µs | if (! defined $Bits{$name}) { | ||
| 485 | 4 | 4µs | $Offsets{$name} = $LAST_BIT; | ||
| 486 | 4 | 13µs | 4 | 24µs | $Bits{$name} = _mkMask($LAST_BIT++); # spent 24µs making 4 calls to warnings::_mkMask, avg 6µs/call |
| 487 | 4 | 8µs | 4 | 8µs | $DeadBits{$name} = _mkMask($LAST_BIT++); # spent 8µs making 4 calls to warnings::_mkMask, avg 2µs/call |
| 488 | 4 | 6µs | if (length($Bits{$name}) > length($Bits{all})) { | ||
| 489 | 1 | 500ns | $Bits{all} .= "\x55"; | ||
| 490 | 1 | 600ns | $DeadBits{all} .= "\xaa"; | ||
| 491 | } | ||||
| 492 | } | ||||
| 493 | } | ||||
| 494 | } | ||||
| 495 | |||||
| 496 | sub _error_loc { | ||||
| 497 | require Carp; | ||||
| 498 | goto &Carp::short_error_loc; # don't introduce another stack frame | ||||
| 499 | } | ||||
| 500 | |||||
| 501 | sub enabled | ||||
| 502 | { | ||||
| 503 | return __chk(NORMAL, @_); | ||||
| 504 | } | ||||
| 505 | |||||
| 506 | sub fatal_enabled | ||||
| 507 | { | ||||
| 508 | return __chk(FATAL, @_); | ||||
| 509 | } | ||||
| 510 | |||||
| 511 | sub warn | ||||
| 512 | { | ||||
| 513 | return __chk(FATAL | MESSAGE, @_); | ||||
| 514 | } | ||||
| 515 | |||||
| 516 | sub warnif | ||||
| 517 | { | ||||
| 518 | return __chk(NORMAL | FATAL | MESSAGE, @_); | ||||
| 519 | } | ||||
| 520 | |||||
| 521 | sub enabled_at_level | ||||
| 522 | { | ||||
| 523 | return __chk(NORMAL | LEVEL, @_); | ||||
| 524 | } | ||||
| 525 | |||||
| 526 | sub fatal_enabled_at_level | ||||
| 527 | { | ||||
| 528 | return __chk(FATAL | LEVEL, @_); | ||||
| 529 | } | ||||
| 530 | |||||
| 531 | sub warn_at_level | ||||
| 532 | { | ||||
| 533 | return __chk(FATAL | MESSAGE | LEVEL, @_); | ||||
| 534 | } | ||||
| 535 | |||||
| 536 | sub warnif_at_level | ||||
| 537 | { | ||||
| 538 | return __chk(NORMAL | FATAL | MESSAGE | LEVEL, @_); | ||||
| 539 | } | ||||
| 540 | |||||
| 541 | # These are not part of any public interface, so we can delete them to save | ||||
| 542 | # space. | ||||
| 543 | 1 | 4µs | delete @warnings::{qw(NORMAL FATAL MESSAGE LEVEL)}; | ||
| 544 | |||||
| 545 | 1 | 36µs | 1; | ||
| 546 | __END__ | ||||
# spent 3µs within warnings::CORE:match which was called:
# once (3µs+0s) by File::Basename::BEGIN@14 at line 14 |