Skip to content

Instantly share code, notes, and snippets.

@timo
Created November 3, 2014 17:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save timo/3dc2ff93c49e0fd241ae to your computer and use it in GitHub Desktop.
Save timo/3dc2ff93c49e0fd241ae to your computer and use it in GitHub Desktop.
unapplied diff i had lying around
diff --git a/src/vm/moar/HLL/Backend.nqp b/src/vm/moar/HLL/Backend.nqp
index cbdf7b4..dd0331b 100644
--- a/src/vm/moar/HLL/Backend.nqp
+++ b/src/vm/moar/HLL/Backend.nqp
@@ -40,9 +40,27 @@ class HLL::Backend::MoarVM {
method run_profiled($what) {
self.ensure_prof_routines();
$prof_start_sub(nqp::hash());
- my $res := $what();
+ my $an_exception;
+ my $res;
+
+ nqp::gethllsym('perl6', '@END_PHASERS').unshift({
+ my $data := $prof_end_sub();
+ self.dump_profile_data($data);
+ });
+
+ try {
+ $res := $what();
+ CATCH {
+ $an_exception := $_
+ }
+ }
+
my $data := $prof_end_sub();
self.dump_profile_data($data);
+
+ if $an_exception {
+ nqp::die($an_exception);
+ }
$res;
}
method dump_profile_data($data) {
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment