307 Commits

Author SHA1 Message Date
Connor Wakamo
ab2172cc97 [driver] Added support for executing a single Command without a TaskQueue.
Added swift::ExecuteInPlace(), which on Unix acts as a wrapper for execv()
and execve(). On other platforms, swift::ExecuteInPlace() is a wrapper for
llvm::sys::ExecuteAndWait(), so callers must be prepared for ExecuteInPlace()
to return in a non-error situation.

Added support in Compilation::performJobs() to detect that the Compilation has
exactly one Command to run. If that's the case, and buffered output isn't
required, execute that Command using swift::ExecuteInPlace() (instead of
creating a TaskQueue, which may unconditionally buffer output).

This change will allow the driver to invoke the frontend's REPL and immediate
modes without buffering output (and, on Unix, without a separate process being
spawned).

Also updated test/Driver/basic.swift to emit output with these changes in place.

Swift SVN r12544
2014-01-18 20:55:18 +00:00
Connor Wakamo
097f0e6a65 [driver] Updated Compilation::performJobsInList() to properly handle Commands which depend on peers.
Across recursive calls to performJobsInList(), keep track of ScheduledCommands
and FinishedCommands, so we can do the following:

  - Don’t schedule a Command which is already scheduled (since it may be
    scheduled as a peer before we try to schedule it as an input).
  - Don’t schedule a Command whose inputs have not all finished.

Swift SVN r12444
2014-01-17 00:47:21 +00:00
Connor Wakamo
d5f95cd574 [driver] Add a new -driver-skip-execution flag.
This instructs the driver to skip task execution by using a DummyTaskQueue in Compilation::performJobsInList().
This option should generally only be used for testing, as DummyTaskQueue may provide fake buffered output.

Swift SVN r12350
2014-01-15 21:27:56 +00:00
Connor Wakamo
163c0651f2 [driver] Added support for parallel execution.
In Compilation, perform Jobs by scheduling Commands which need to be run (currently
all Commands, but this can be refined later) on TaskQueues by doing the following:

1. Perform all inputs to all Jobs in the current JobList. (Treat a JobList as its
   own inputs for scheduling purposes.)
2. After each Command's inputs run, check to see if that Command needs to run.
   If so, schedule it for execution. (Currently, all Commands always need to run.)
3. Set up a TaskFinishedCallback which will check to see if any other Commands need
   to run as a result of executing a particular Command. (Currently, all Commands
   depend on all other Commands.) If a Command needs to run and it is not already
   scheduled for execution, schedule it for execution.
4. Ask the TaskQueue to execute. (This will call the TaskFinishedCallback as
   necessary).

Swift SVN r12060
2014-01-08 19:10:43 +00:00
Connor Wakamo
04b98c7d67 [driver] Move execution of Jobs from main() to Compilation.
Actual execution of Jobs is still performed under-the-covers by JobList::run(), but this abstraction will allow the Compilation to execute Jobs in parallel.

Swift SVN r11334
2013-12-15 21:47:36 +00:00
Connor Wakamo
44971d2e5a [driver] Added support for specifying the number of commands to execute in parallel.
The driver does not yet support parallel execution, but this sets the Compilation up with the necessary information to execute commands in parallel.

Swift SVN r11333
2013-12-15 21:47:35 +00:00
Connor Wakamo
ed2038585f Initial set of changes to add a new 'swift_driver' executable.
- Added a couple of new targets:
  - libswiftDriver, which contains most of the driver implementation
  - swift_driver, which produces the actual executable

- Added centralized version information into libswiftBasic.

- Added a new "Driver Design & Internals" document, which currently describes
  the high-level design of the Swift driver.

- Implemented an early version of the functionality of the driver, including
  versions of the Parse, Pipeline, Bind, Translate, and Execute driver stages.
  Parse, Pipeline, and Bind are largely implemented; Translate and Execute are
  early placeholders. (Translate produces "swift_driver --version" and "ld -v"
  commands, while Execute performs all subtasks sequentially, rather than in
  parallel.)

This is just the starting point for the Swift driver. Tests for the existing
behavior are forthcoming.

Swift SVN r10933
2013-12-06 21:23:01 +00:00