Bug 127435 - Basic framework for a modern jsc CLI
Summary: Basic framework for a modern jsc CLI
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: JavaScriptCore (show other bugs)
Version: 528+ (Nightly build)
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Mark Hahnenberg
URL:
Keywords:
Depends on: 127488
Blocks: 127432
  Show dependency treegraph
 
Reported: 2014-01-22 11:11 PST by Mark Hahnenberg
Modified: 2014-02-12 14:49 PST (History)
2 users (show)

See Also:


Attachments
Patch (60.39 KB, patch)
2014-01-22 13:03 PST, Mark Hahnenberg
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Mark Hahnenberg 2014-01-22 11:11:51 PST
The most basic components of a modern jsc command line interface consist of the following:

- A simple REPL to enter commands and receive results
- The ability to define a module (which consists of various internal methods as well as a set of externally visible methods)
- The ability to load other modules at runtime
- The ability to interact with the underlying platform to perform various "privileged" functions (e.g. opening files, printing to the stdout, etc.)

The basic architecture will look something like the following:
- If the tool is run in REPL mode (i.e. no command line arguments), it will start the REPL on the main thread and start a secondary thread with a run loop to handle various inputs from the REPL thread.
- If the tool is given a script to run, it will evaluate that script (and any scripts that it might transitively load) within the run loop on the main thread.
Comment 1 Mark Hahnenberg 2014-01-22 13:03:36 PST
Created attachment 221896 [details]
Patch
Comment 2 Oliver Hunt 2014-01-22 13:16:34 PST
Comment on attachment 221896 [details]
Patch

the existing jsc prompt supports multiline input which this does not appear to :(
Comment 3 Mark Hahnenberg 2014-01-22 13:35:07 PST
(In reply to comment #2)
> (From update of attachment 221896 [details])
> the existing jsc prompt supports multiline input which this does not appear to :(

I'll file a bug for it. This will probably never replace the old jsc since other platforms can't compile Objective-C.
Comment 4 Mark Hahnenberg 2014-01-22 13:48:53 PST
(In reply to comment #3)
> (In reply to comment #2)
> > (From update of attachment 221896 [details] [details])
> > the existing jsc prompt supports multiline input which this does not appear to :(
> 
> I'll file a bug for it. This will probably never replace the old jsc since other platforms can't compile Objective-C.

I sort of skipped a sentence there. I meant to also say that this will probably not replace jsc on our own platforms for some time until the new jsc-cli reaches feature parity with the old jsc. In addition, the old jsc will probably stick around indefinitely anyways due to the absence of Objective-C on other platforms.
Comment 5 Geoffrey Garen 2014-01-22 22:36:37 PST
Comment on attachment 221896 [details]
Patch

rs=me
Comment 6 Mark Hahnenberg 2014-01-23 08:39:50 PST
(In reply to comment #2)
> (From update of attachment 221896 [details])
> the existing jsc prompt supports multiline input which this does not appear to :(

I filed bug 127484 to track this.
Comment 7 WebKit Commit Bot 2014-01-23 09:04:33 PST
Comment on attachment 221896 [details]
Patch

Clearing flags on attachment: 221896

Committed r162612: <http://trac.webkit.org/changeset/162612>
Comment 8 WebKit Commit Bot 2014-01-23 09:04:36 PST
All reviewed patches have been landed.  Closing bug.
Comment 9 WebKit Commit Bot 2014-01-23 09:12:22 PST
Re-opened since this is blocked by bug 127488
Comment 10 Mark Hahnenberg 2014-01-23 09:21:48 PST
Had to roll it back out because I forgot that EWS doesn't test changes to the Tools directory, and thus this patch broke several platforms.
Comment 11 Mark Hahnenberg 2014-02-12 14:49:26 PST
Committed r163991: <http://trac.webkit.org/changeset/163991>