@@ -3,19 +3,17 @@ import * as _ from 'lodash'
3
3
import type { RawSourceMap } from 'source-map'
4
4
5
5
import { type IOptions , type Result } from '..'
6
- import { JSSLANG_PROPERTIES , UNKNOWN_LOCATION } from '../constants'
6
+ import { JSSLANG_PROPERTIES } from '../constants'
7
7
import { CSEResultPromise , evaluate as CSEvaluate } from '../cse-machine/interpreter'
8
8
import { ExceptionError } from '../errors/errors'
9
9
import { RuntimeSourceError } from '../errors/runtimeSourceError'
10
10
import { TimeoutError } from '../errors/timeoutErrors'
11
11
import { isPotentialInfiniteLoop } from '../infiniteLoops/errors'
12
12
import { testForInfiniteLoop } from '../infiniteLoops/runtime'
13
- import { evaluateProgram as evaluate } from '../interpreter/interpreter'
14
13
import preprocessFileImports from '../modules/preprocessor'
15
14
import { defaultAnalysisOptions } from '../modules/preprocessor/analyzer'
16
15
import { defaultLinkerOptions } from '../modules/preprocessor/linker'
17
16
import { parse } from '../parser/parser'
18
- import { AsyncScheduler , PreemptiveScheduler } from '../schedulers'
19
17
import {
20
18
callee ,
21
19
getEvaluationSteps ,
@@ -25,12 +23,11 @@ import {
25
23
} from '../stepper/stepper'
26
24
import { sandboxedEval } from '../transpiler/evalContainer'
27
25
import { transpile } from '../transpiler/transpiler'
28
- import { Chapter , type Context , type RecursivePartial , type Scheduler , Variant } from '../types'
26
+ import { Chapter , type Context , type RecursivePartial , Variant } from '../types'
29
27
import { validateAndAnnotate } from '../validator/validator'
30
- import { compileForConcurrent } from '../vm/svml-compiler'
31
- import { runWithProgram } from '../vm/svml-machine'
32
28
import type { FileGetter } from '../modules/moduleTypes'
33
29
import { mapResult } from '../alt-langs/mapper'
30
+ import assert from '../utils/assert'
34
31
import { toSourceError } from './errors'
35
32
import { fullJSRunner } from './fullJSRunner'
36
33
import { determineExecutionMethod , determineVariant , resolvedErrorPromise } from './utils'
@@ -60,29 +57,6 @@ let previousCode: {
60
57
} | null = null
61
58
let isPreviousCodeTimeoutError = false
62
59
63
- function runConcurrent ( program : es . Program , context : Context , options : IOptions ) : Promise < Result > {
64
- if ( context . shouldIncreaseEvaluationTimeout ) {
65
- context . nativeStorage . maxExecTime *= JSSLANG_PROPERTIES . factorToIncreaseBy
66
- } else {
67
- context . nativeStorage . maxExecTime = options . originalMaxExecTime
68
- }
69
-
70
- try {
71
- return Promise . resolve ( {
72
- status : 'finished' ,
73
- context,
74
- value : runWithProgram ( compileForConcurrent ( program , context ) , context )
75
- } )
76
- } catch ( error ) {
77
- if ( error instanceof RuntimeSourceError || error instanceof ExceptionError ) {
78
- context . errors . push ( error ) // use ExceptionErrors for non Source Errors
79
- return resolvedErrorPromise
80
- }
81
- context . errors . push ( new ExceptionError ( error , UNKNOWN_LOCATION ) )
82
- return resolvedErrorPromise
83
- }
84
- }
85
-
86
60
function runSubstitution (
87
61
program : es . Program ,
88
62
context : Context ,
@@ -110,17 +84,6 @@ function runSubstitution(
110
84
} )
111
85
}
112
86
113
- function runInterpreter ( program : es . Program , context : Context , options : IOptions ) : Promise < Result > {
114
- let it = evaluate ( program , context )
115
- let scheduler : Scheduler
116
- if ( options . scheduler === 'async' ) {
117
- scheduler = new AsyncScheduler ( )
118
- } else {
119
- scheduler = new PreemptiveScheduler ( options . steps )
120
- }
121
- return scheduler . run ( it , context )
122
- }
123
-
124
87
async function runNative (
125
88
program : es . Program ,
126
89
context : Context ,
@@ -226,10 +189,6 @@ async function sourceRunner(
226
189
return resolvedErrorPromise
227
190
}
228
191
229
- if ( context . variant === Variant . CONCURRENT ) {
230
- return runConcurrent ( program , context , theOptions )
231
- }
232
-
233
192
if ( theOptions . useSubst ) {
234
193
return runSubstitution ( program , context , theOptions )
235
194
}
@@ -238,7 +197,7 @@ async function sourceRunner(
238
197
239
198
// native, don't evaluate prelude
240
199
if ( context . executionMethod === 'native' && context . variant === Variant . NATIVE ) {
241
- return await fullJSRunner ( program , context , theOptions . importOptions )
200
+ return fullJSRunner ( program , context , theOptions . importOptions )
242
201
}
243
202
244
203
// All runners after this point evaluate the prelude.
@@ -264,11 +223,8 @@ async function sourceRunner(
264
223
return runCSEMachine ( program , context , theOptions )
265
224
}
266
225
267
- if ( context . executionMethod === 'native' ) {
268
- return runNative ( program , context , theOptions )
269
- }
270
-
271
- return runInterpreter ( program , context , theOptions )
226
+ assert ( context . executionMethod !== 'auto' , 'Execution method should have been properly determined!' )
227
+ return runNative ( program , context , theOptions )
272
228
}
273
229
274
230
/**
0 commit comments