[svn:parrot] r48655 - trunk/tools/dev

plobsing at svn.parrot.org plobsing at svn.parrot.org
Wed Aug 25 17:00:53 UTC 2010


Author: plobsing
Date: Wed Aug 25 17:00:53 2010
New Revision: 48655
URL: https://trac.parrot.org/parrot/changeset/48655

Log:
add --runcore option to pbc_to_exe in order to optionally use the slow core
fixes TT #1653

Modified:
   trunk/tools/dev/pbc_to_exe.pir

Modified: trunk/tools/dev/pbc_to_exe.pir
==============================================================================
--- trunk/tools/dev/pbc_to_exe.pir	Wed Aug 25 16:59:36 2010	(r48654)
+++ trunk/tools/dev/pbc_to_exe.pir	Wed Aug 25 17:00:53 2010	(r48655)
@@ -22,6 +22,8 @@
 
 =cut
 
+.include 'interpcores.pasm'
+
 .sub 'main' :main
     .param pmc    argv
 
@@ -31,8 +33,9 @@
     .local string cfile
     .local string objfile
     .local string exefile
+    .local int    runcore
 
-    (infile :optional, cfile :optional, objfile :optional, exefile :optional) = 'handle_args'(argv)
+    (infile, cfile, objfile, exefile, runcore) = 'handle_args'(argv)
     unless infile > '' goto err_infile
 
     .local string code_type
@@ -66,6 +69,10 @@
 
     print outfh, codestring
 
+    print outfh, '#define RUNCORE '
+    print outfh, runcore
+    print outfh, "\n"
+
     print outfh, <<'MAIN'
         int main(int argc, const char *argv[])
         {
@@ -86,6 +93,7 @@
             Parrot_init_stacktop(interp, &interp);
             Parrot_set_executable_name(interp,
                 Parrot_str_new(interp, argv[0], 0));
+            Parrot_set_run_core(interp, RUNCORE);
             Parrot_set_flag(interp, PARROT_DESTROY_FLAG);
 
             pf = PackFile_new(interp, 0);
@@ -147,6 +155,7 @@
     .local pmc getopt
     getopt = new ['Getopt';'Obj']
     push getopt, 'install|i'
+    push getopt, 'runcore|R:s'
 
     $P0 = shift argv # ignore program name
     .local pmc opts
@@ -165,7 +174,27 @@
         exefile = 'prepend_installable'(exefile)
     end_installable:
 
-    .return (infile, cfile, objfile, exefile)
+    .local int runcore
+    $S0 = opts['runcore']
+    unless $S0 == 'slow' goto end_slow_core
+        runcore = .PARROT_SLOW_CORE
+        goto done_runcore
+    end_slow_core:
+    unless $S0 == 'fast' goto end_fast_core
+        runcore = .PARROT_FAST_CORE
+        goto done_runcore
+    end_fast_core:
+    unless $S0 == '' goto end_unspecified_core
+        runcore = .PARROT_FAST_CORE
+        goto done_runcore
+    end_unspecified_core:
+        # invalid runcore name
+        $S0 = "Unsupported runcore: `" . $S0
+        $S0 = $S0 . "'"
+        die $S0
+    done_runcore:
+
+    .return (infile, cfile, objfile, exefile, runcore)
 .end
 
 .sub 'determine_code_type'


More information about the parrot-commits mailing list