# New Ticket Created by  Stefan O'Rear 
# Please include the string:  [perl #75026]
# in the subject line of all future correspondence about this issue. 
# <URL: http://rt.perl.org/rt3/Ticket/Display.html?id=75026 >


PCT has support for timing individual stages of a long compilation, but this
functionality is not accessible in Rakudo because we overwrite the list of
command options instead of adding to it.  The attached patch fixes that, and
enables per-stage timing in time-instrumented builds.
>From 2836728f760725eca41d125f4af14d28dd1db3ba Mon Sep 17 00:00:00 2001
From: Stefan O'Rear <stefa...@cox.net>
Date: Mon, 10 May 2010 00:29:52 -0700
Subject: [PATCH] Enable support for --stagestats in Rakudo

This consists of a bugfix analogous to 9d4c8a9 in NQP-rx, and changes the
Makefile system to pass --stagestats to Rakudo when compiling the setting
and Test.pm in --makefile-timing builds.
---
 Configure.pl           |    1 +
 build/Makefile.in      |    6 ++++--
 src/Perl6/Compiler.pir |    6 +++---
 3 files changed, 8 insertions(+), 5 deletions(-)

diff --git a/Configure.pl b/Configure.pl
index 2809f15..9d5c0c3 100644
--- a/Configure.pl
+++ b/Configure.pl
@@ -163,6 +163,7 @@ sub create_makefile {
 
     my $maketext = slurp( 'build/Makefile.in' );
 
+    $config{'stagestats'} = $makefile_timing ? '--stagestats' : '';
     $config{'win32_libparrot_copy'} = $^O eq 'MSWin32' ? 'copy $(PARROT_BIN_DIR)\libparrot.dll .' : '';
     $maketext =~ s/@(\w+)@/$config{$1}/g;
     if ($^O eq 'MSWin32') {
diff --git a/build/Makefile.in b/build/Makefile.in
index 30c7acf..0e387ff 100644
--- a/build/Makefile.in
+++ b/build/Makefile.in
@@ -289,6 +289,8 @@ CLEANUPS = \
 HARNESS_WITH_FUDGE = $(PERL) t/harness --fudge --keep-exit-code --icu=$(HAS_ICU)
 HARNESS_WITH_FUDGE_JOBS = $(HARNESS_WITH_FUDGE) --jobs
 
+STAGESTATS = @stagestats@
+
 # the default target
 all: $(PERL6_EXE) Test.pir
 
@@ -313,7 +315,7 @@ $(PERL6_EXE): $(PERL6_PBC)
 
 # the complete compiler, including core/setting
 $(PERL6_PBC): $(S1_PERL6_PBC) src/gen/core.pm
-	$(PARROT) $(PARROT_ARGS) $(S1_PERL6_PBC) --target=pir \
+	$(PARROT) $(PARROT_ARGS) $(S1_PERL6_PBC) --target=pir $(STAGESTATS) \
 	    src/gen/core.pm > $(CORE_PIR)
 	$(PARROT) $(PARROT_ARGS) -o $(PERL6_PBC) src/Perl6/Compiler.pir
 
@@ -410,7 +412,7 @@ $(PMC_DIR)/objectref.pmc : $(PMC_DIR)/objectref_pmc.template build/gen_objectref
 
 ##  testing targets
 Test.pir: Test.pm perl6.pbc
-	$(PARROT) $(PARROT_ARGS) perl6.pbc --target=pir --output=Test.pir Test.pm
+	$(PARROT) $(PARROT_ARGS) perl6.pbc $(STAGESTATS) --target=pir --output=Test.pir Test.pm
 
 test    : coretest
 
diff --git a/src/Perl6/Compiler.pir b/src/Perl6/Compiler.pir
index f634780..4d69039 100644
--- a/src/Perl6/Compiler.pir
+++ b/src/Perl6/Compiler.pir
@@ -117,9 +117,9 @@ Perl6::Compiler - Perl6 compiler
     nqpproto.'parsegrammar'($P0)
     $P0 = get_hll_global ['Perl6'], 'Actions'
     nqpproto.'parseactions'($P0)
-    $P0 = split ' ', 'e=s help|h target=s dumper=s trace|t=s encoding=s output|o=s combine version|v parsetrace'
-    setattribute nqpproto, '@cmdoptions', $P0
-    
+    $P0 = getattribute nqpproto, '@cmdoptions'
+    push $P0, 'parsetrace'
+
     # Set up @*INC from $PERL6LIB, languages/perl6/lib and ~/.perl6/lib
     .local pmc env, interp, config
     # Convert PERL6LIB first
-- 
1.6.6

Reply via email to