mirror of
https://github.com/KarolS/millfork.git
synced 2024-12-23 23:30:22 +00:00
Single threaded mode
This commit is contained in:
parent
1909fd7154
commit
53245eb1e2
@ -126,6 +126,8 @@ object CompilationFlag extends Enumeration {
|
||||
VariableOverlap, CompactReturnDispatchParams,
|
||||
// runtime check options
|
||||
CheckIndexOutOfBounds,
|
||||
// special options
|
||||
SingleThreaded,
|
||||
// warning options
|
||||
ExtraComparisonWarnings,
|
||||
RorWarning,
|
||||
|
@ -301,6 +301,10 @@ object Main {
|
||||
|
||||
fluff("", "Other options:", "")
|
||||
|
||||
flag("--single-threaded").action(c =>
|
||||
c.changeFlag(CompilationFlag.SingleThreaded, true)
|
||||
).description("Run the compiler in a single thread.")
|
||||
|
||||
flag("--help").action(c => {
|
||||
printHelp(20).foreach(println(_))
|
||||
assumeStatus(CliStatus.Quit)
|
||||
|
@ -52,7 +52,8 @@ object SuperOptimizer extends AssemblyOptimization {
|
||||
while(queue.nonEmpty) {
|
||||
val (optsSoFar, codeSoFar) = queue.dequeue()
|
||||
var isLeaf = true
|
||||
allOptimizers.par.foreach { o =>
|
||||
(if (options.flag(CompilationFlag.SingleThreaded)) allOptimizers
|
||||
else allOptimizers.par).foreach { o =>
|
||||
val optimized = o.optimize(m, codeSoFar, options)
|
||||
val view = viewCode(optimized)
|
||||
seenSoFar.synchronized{
|
||||
|
@ -194,7 +194,7 @@ object VariableToRegisterOptimization extends AssemblyOptimization {
|
||||
val aCandidateSets = NonOverlappingIntervals.apply[(String, Range, Int)](aCandidates, _._2.start, _._2.end)
|
||||
|
||||
val variants = for {
|
||||
vx <- xCandidateSets.par
|
||||
vx <- if (options.flag(CompilationFlag.SingleThreaded)) xCandidateSets else xCandidateSets.par
|
||||
nx = vx.map(_._1)
|
||||
|
||||
vy <- yCandidateSets
|
||||
|
@ -30,7 +30,11 @@ class SourceLoadingQueue(val initialFilenames: List[String], val includePath: Li
|
||||
moduleQueue.enqueue(() => parseModule("zp_reg", includePath, Left(None), options))
|
||||
}
|
||||
while (moduleQueue.nonEmpty) {
|
||||
moduleQueue.dequeueAll(_ => true).par.foreach(_())
|
||||
if (options.flag(CompilationFlag.SingleThreaded)) {
|
||||
moduleQueue.dequeueAll(_ => true).foreach(_())
|
||||
} else {
|
||||
moduleQueue.dequeueAll(_ => true).par.foreach(_())
|
||||
}
|
||||
}
|
||||
ErrorReporting.assertNoErrors("Parse failed")
|
||||
parsedModules.values.reduce(_ + _)
|
||||
|
Loading…
Reference in New Issue
Block a user