Skip to content
Permalink
Browse files

Remove $RAKUDO-VERBOSE-STACKFRAME from CORE::

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 ed074cd17f218d5b64774d8de572cd45362f7f59
Showing with 10 additions and 6 deletions.
  1. +10 −5 src/core/Backtrace.pm6
  2. +0 −1 t/08-performance/03-corekeys.t
@@ -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;
@@ -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;
@@ -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
}
@@ -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},

0 comments on commit ed074cd

Please sign in to comment.
You can’t perform that action at this time.