Skip to content

Commit

Permalink
Remove $RAKUDO-VERBOSE-STACKFRAME from CORE::
Browse files Browse the repository at this point in the history
Keep marker inside the Backtrace class, accessible by a method.  This also
gets rid of one more race-condition "once".  Also internally use the
RAKUDO_VERBOSE_STACKFRAME rather than RAKUDO-VERBOSE-STACKFRAME, so that
it matches the environment variable's name.
  • Loading branch information
lizmat committed Mar 20, 2019
1 parent 45eb1c5 commit ed074cd
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 6 deletions.
15 changes: 10 additions & 5 deletions src/core/Backtrace.pm6
Expand Up @@ -3,8 +3,6 @@ my class Exception { ... }
my class Backtrace { ... }
my class CompUnit::RepositoryRegistry is repr('Uninstantiable') { ... }

my $RAKUDO-VERBOSE-STACKFRAME;

my class Backtrace::Frame {
has Str $.file;
has Int $.line;
Expand Down Expand Up @@ -36,7 +34,7 @@ my class Backtrace::Frame {
$s ~= ' ' if $s.chars;
my $text = " in {$s}$.subname at {$.file} line $.line\n";

if $RAKUDO-VERBOSE-STACKFRAME -> $extra {
if Backtrace.RAKUDO_VERBOSE_STACKFRAME -> $extra {
my $io = $!file.IO;
if $io.e {
my @lines = $io.lines;
Expand Down Expand Up @@ -75,9 +73,16 @@ my class Backtrace {
has Mu $!frames;
has Int $!bt-next; # next bt index to vivify

my $RAKUDO_VERBOSE_STACKFRAME := nqp::null;
method RAKUDO_VERBOSE_STACKFRAME() {
nqp::ifnull(
$RAKUDO_VERBOSE_STACKFRAME,
$RAKUDO_VERBOSE_STACKFRAME :=
(%*ENV<RAKUDO_VERBOSE_STACKFRAME> // 0).Int
)
}

method !SET-SELF($!bt,$!bt-next) {
once $RAKUDO-VERBOSE-STACKFRAME =
(%*ENV<RAKUDO_VERBOSE_STACKFRAME> // 0).Num;
$!frames := nqp::list;
self
}
Expand Down
1 change: 0 additions & 1 deletion t/08-performance/03-corekeys.t
Expand Up @@ -13,7 +13,6 @@ my %allowed = (
Q{$?NL},
Q{$?TABSTOP},
Q{$CORE_METAOP_ASSIGN},
Q{$RAKUDO-VERBOSE-STACKFRAME},
Q{$_},
Q{%DEPRECATIONS},
Q{&CLONE-HASH-DECONTAINERIZED},
Expand Down

0 comments on commit ed074cd

Please sign in to comment.