wesgarland / gpsee

General Purpose Spidermonkey Embedding Ecosystem
https://github.com/wesgarland/gpsee
4 stars 0 forks source link

gsr help has mysterious "-z" option #47

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago

The gsr help list a "    gsr [-z #]", but there is no ref to -z, and using -z 
seems to make gsr 
angry.

$gsr -z 10 -c "xxx + yyy";
gsr: illegal option -- z
Fatal Error in gsr: Invalid option: z

$ gsr

gsr 1.0-pre1 - GPSEE Script Runner for GPSEE 0.2-pre1
Copyright (c) 2007-2009 PageMail, Inc. All Rights Reserved.

As an interpreter: #! gsr {-/*flags*/}
As a command:      gsr [-z #] [-n] <[-c code]|[-f filename]>  <------- HERE
                       {-/*flags*/} {[--] [arg...]}
Command Options:
    -c code     Specifies literal JavaScript code to execute
    -f filename Specifies the filename containing code to run
    -F filename Like -f, but skip shebang if present.
    -h          Display this help
    -n          Engine will load and parse, but not run, the script
    flags       A series of one-character flags which can be used
                in either file interpreter or command mode
    --          Arguments after -- are passed to the script

Valid Flags:
    a - Allow (read-only) access to caller's environment
    C - Disables compiler caching via JSScript XDR serialization
    d - Increase verbosity
    e - Do not limit regexps to n^3 levels of backtracking
    J - Disable nanojit
    S - Disable Strict mode
    R - Load RC file for interpreter (gsr) based on
        script filename.
    U - Disable UTF-8 C string processing
    W - Do not report warnings
    x - Parse <!-- comments --> as E4X tokens

Original issue reported on code.google.com by nickgsup...@gmail.com on 14 Mar 2010 at 5:31

GoogleCodeExporter commented 9 years ago
Not so mysterious; if you have a debug build of tracemonkey, it lets you enable
zealous garbage collection.

Looks like I missed one spot in the usage() for release builds, though -- good 
eye!

Original comment by wes%page...@gtempaccount.com on 15 Mar 2010 at 4:50

GoogleCodeExporter commented 9 years ago
We should check for -z whether or not gc zeal is available and print a less
mysterious error message if it's not available.

Original comment by donny.vi...@gmail.com on 16 Mar 2010 at 1:35

GoogleCodeExporter commented 9 years ago
Maybe a -z found in a shebang line should be ignored with a warning. Maybe -z 
should
in general just be a warning condition if gczeal isn't available.

Original comment by donny.vi...@gmail.com on 22 Mar 2010 at 10:01

GoogleCodeExporter commented 9 years ago
Agreed.  Let's allow -z in option flags all the time, and JS_ReportWarning() or
similar when gcZeal != 0 and #ifndef JS_GC_ZEAL, instead of calling 
JS_SetGCZeal().

Checking gcZeal level instead of looking at individual options reduces the 
number of
code paths, keeps program behaviour [close to] the same when RELEASE | DEBUG 
build
and reduces the number of special cases: overall, a good improvement I think.

Original comment by wes%page...@gtempaccount.com on 23 Mar 2010 at 2:26

GoogleCodeExporter commented 9 years ago
Fixed. Excellent support will have to wait for a JSFEATURE_* API from Mozilla, 
but -z
is now exposed all the time, and we complain at compile time if JSAPI was build
without it.

Original comment by wes%page...@gtempaccount.com on 2 Apr 2010 at 6:21