Skip to content

Commit 125be96

Browse files
committed
Disallow profiling both compile and run time
I.e., using --profile and --profile-(compile|stage) at the same time. This might be possible in the future, isn't now.
1 parent 25114a3 commit 125be96

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

src/HLL/Compiler.nqp

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -178,8 +178,14 @@ class HLL::Compiler does HLL::Backend::Default {
178178
}
179179

180180
if nqp::existskey(%adverbs, 'profile') {
181-
$output := $!backend.run_profiled({ $output(|@args) },
182-
%adverbs<profile-filename> || %adverbs<profile>, %adverbs<profile-kind>);
181+
if nqp::existskey(%adverbs, 'profile-compile') || nqp::existskey(%adverbs, 'profile-stage') {
182+
note("Currently you cannot profile both compilation and runtime, ignoring --profile");
183+
$output := $output(|@args);
184+
}
185+
else {
186+
$output := $!backend.run_profiled({ $output(|@args) },
187+
%adverbs<profile-filename> || %adverbs<profile>, %adverbs<profile-kind>);
188+
}
183189
}
184190
elsif %adverbs<trace> {
185191
$output := $!backend.run_traced(%adverbs<trace>, { $output(|@args) });
@@ -488,7 +494,7 @@ class HLL::Compiler does HLL::Backend::Default {
488494
}
489495

490496
$result := %adverbs<profile-stage> eq $_
491-
?? $!backend.run_profiled(&run, %adverbs<profile-filename> || %adverbs<profile>, %adverbs<profile-kind>)
497+
?? $!backend.run_profiled(&run, %adverbs<profile-filename> || %adverbs<profile-compile>, %adverbs<profile-kind>)
492498
!! run();
493499

494500
my $diff := nqp::time_n() - $timestamp;

0 commit comments

Comments
 (0)