Skip to content

Commit

Permalink
profiler: make sure no scope is exited after prof_enter
Browse files Browse the repository at this point in the history
exiting that if/else scope caused the profiler to leave
the first frame it entered immediately, making it reach
an odd state where it was writing all of its data into
the void.
  • Loading branch information
timo committed May 29, 2019
1 parent d1537d3 commit bb1811a
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/vm/moar/HLL/Backend.nqp
Expand Up @@ -71,22 +71,26 @@ class HLL::Backend::MoarVM {

self.ensure_prof_routines();

my $conf-hash;

if $kind eq "heap" {
unless $filename {
$filename := 'heap-snapshot-' ~ nqp::time_n() ~ '.mvmheap';
}
$prof_start_sub(nqp::hash('kind', $kind, 'path', $filename));
$conf-hash := nqp::hash('kind', $kind, 'path', $filename);
} else {
unless $filename {
$filename := 'profile-' ~ nqp::time_n() ~ '.html';
}
$prof_start_sub(nqp::hash('kind', $kind));
$conf-hash := nqp::hash('kind', $kind);
}

my @END := nqp::gethllsym('perl6', '@END_PHASERS');
@END.push(-> { self.dump_profile_data($prof_end_sub(), $kind, $filename) })
if nqp::defined(@END);

$prof_start_sub($conf-hash);

my $res := $what();
unless nqp::defined(@END) {
my $data := $prof_end_sub();
Expand Down

0 comments on commit bb1811a

Please sign in to comment.