From 12ae403cefe193bf155c5c98aa68a3b7782cc3c8 Mon Sep 17 00:00:00 2001 From: Nikolai Tillmann Date: Fri, 31 Aug 2018 02:19:27 -0700 Subject: [PATCH] Removing --serialize and --residual options (#2504) Summary: Release notes: Removing --serialize and --residual options from Prepack (CLI) Pull Request resolved: https://github.com/facebook/prepack/pull/2504 Reviewed By: trueadm Differential Revision: D9582602 Pulled By: NTillmann fbshipit-source-id: d30a6ef662de5ebddd5e7d615ea37b3f772ce93d --- scripts/test-runner.js | 11 ----------- src/options.js | 1 - src/prepack-cli.js | 14 ++------------ src/prepack-options.js | 5 +---- src/realm.js | 2 +- 5 files changed, 4 insertions(+), 29 deletions(-) diff --git a/scripts/test-runner.js b/scripts/test-runner.js index 3030a68ea8..1627ed6f25 100644 --- a/scripts/test-runner.js +++ b/scripts/test-runner.js @@ -454,7 +454,6 @@ function runTest(name, code, options: PrepackOptions, args) { if (code.includes(injectAtRuntime)) { let i = code.indexOf(injectAtRuntime); addedCode = code.substring(i + injectAtRuntime.length, code.indexOf("\n", i)); - options.residual = false; } if (args.es5) { code = transformWithBabel(code, [], [["@babel/env", { forceAllTransforms: true, modules: false }]]); @@ -503,7 +502,6 @@ function runTest(name, code, options: PrepackOptions, args) { expectedDiagnostics.set(severity, errorCodeSet); errorCodeString.split(",").forEach(errorCode => errorCodeSet.add(errorCode.trim())); } - options.residual = false; } if (expectedDiagnostics.size > 0) options.errorHandler = getErrorHandlerWithWarningCapture(diagnosticOutput, args.verbose); @@ -793,7 +791,6 @@ function run(args) { delayInitializations, inlineExpressions, lazyObjectsRuntime, - residual: args && args.residual, }; return () => runTest(test.name, test.file, options, args).then(testResult => { @@ -831,7 +828,6 @@ class ProgramArgs { lazyObjectsRuntime: string; noLazySupport: boolean; fast: boolean; - residual: boolean; cpuprofilePath: string; constructor( debugNames: boolean, @@ -843,7 +839,6 @@ class ProgramArgs { lazyObjectsRuntime: string, noLazySupport: boolean, fast: boolean, - residual: boolean, cpuProfilePath: string ) { this.debugNames = debugNames; @@ -855,7 +850,6 @@ class ProgramArgs { this.lazyObjectsRuntime = lazyObjectsRuntime; this.noLazySupport = noLazySupport; this.fast = fast; - this.residual = residual; this.cpuprofilePath = cpuProfilePath; } } @@ -920,7 +914,6 @@ function argsParse(): ProgramArgs { lazyObjectsRuntime: LAZY_OBJECTS_RUNTIME_NAME, noLazySupport: false, fast: false, - residual: false, cpuprofilePath: "", }, }); @@ -953,9 +946,6 @@ function argsParse(): ProgramArgs { if (typeof parsedArgs.noLazySupport !== "boolean") { throw new ArgsParseError("noLazySupport must be a boolean (either --noLazySupport or not)"); } - if (typeof parsedArgs.residual !== "boolean") { - throw new ArgsParseError("residual must be a boolean (either --residual or not)"); - } if (typeof parsedArgs.cpuprofilePath !== "string") { throw new ArgsParseError("cpuprofilePath must be a string"); } @@ -969,7 +959,6 @@ function argsParse(): ProgramArgs { parsedArgs.lazyObjectsRuntime, parsedArgs.noLazySupport, parsedArgs.fast, - parsedArgs.residual, parsedArgs.cpuprofilePath ); return programArgs; diff --git a/src/options.js b/src/options.js index b0ecd80ec5..e0c10f034b 100644 --- a/src/options.js +++ b/src/options.js @@ -47,7 +47,6 @@ export type RealmOptions = { invariantMode?: InvariantModeTypes, emitConcreteModel?: boolean, uniqueSuffix?: string, - residual?: boolean, serialize?: boolean, strictlyMonotonicDateNow?: boolean, timeout?: number, diff --git a/src/prepack-cli.js b/src/prepack-cli.js index f18085f4e8..225610e059 100644 --- a/src/prepack-cli.js +++ b/src/prepack-cli.js @@ -62,10 +62,7 @@ function run( --initializeMoreModules Enable speculative initialization of modules (for the module system Prepack has builtin knowledge about). Prepack will try to execute all factory functions it is able to. --trace Traces the order of module initialization. - --serialize Serializes the partially evaluated global environment as a program that recreates it. - (default = true) - --check [start[, count]] Check residual functions for diagnostic messages. Do not serialize or produce residual code. - --residual Produces the residual program that results after constant folding. + --check [start[, count]] Check residual functions for diagnostic messages. Do not generate code. --profile Collect statistics about time and memory usage of the different internal passes --logStatistics Log statistics to console --statsFile The name of the output file where statistics will be written to. @@ -120,8 +117,6 @@ function run( delayInitializations: false, internalDebug: false, debugScopes: false, - serialize: false, - residual: false, profile: false, instantRender: false, reactEnabled: false, @@ -335,12 +330,6 @@ function run( } } - if (!flags.serialize && !flags.residual) flags.serialize = true; - if (check) { - flags.serialize = false; - flags.residual = false; - } - let resolvedOptions = Object.assign( {}, { @@ -353,6 +342,7 @@ function run( timeout, debugIdentifiers, check, + serialize: !check, lazyObjectsRuntime, debugInFilePath, debugOutFilePath, diff --git a/src/prepack-options.js b/src/prepack-options.js index d279f7ba55..75d8fd8dd1 100644 --- a/src/prepack-options.js +++ b/src/prepack-options.js @@ -40,7 +40,6 @@ export type PrepackOptions = {| reactOutput?: ReactOutputTypes, reactVerbose?: boolean, reactOptimizeNestedFunctions?: boolean, - residual?: boolean, serialize?: boolean, check?: Array, inlineExpressions?: boolean, @@ -76,8 +75,7 @@ export function getRealmOptions({ reactOutput, reactVerbose, reactOptimizeNestedFunctions, - residual, - serialize = !residual, + serialize, check, strictlyMonotonicDateNow, stripFlow, @@ -102,7 +100,6 @@ export function getRealmOptions({ reactOutput, reactVerbose, reactOptimizeNestedFunctions, - residual, serialize, check, strictlyMonotonicDateNow, diff --git a/src/realm.js b/src/realm.js index bb261665fd..0fb60375f3 100644 --- a/src/realm.js +++ b/src/realm.js @@ -229,7 +229,7 @@ export class Realm { constructor(opts: RealmOptions, statistics: RealmStatistics) { this.statistics = statistics; this.isReadOnly = false; - this.useAbstractInterpretation = opts.serialize === true || opts.residual === true || Array.isArray(opts.check); + this.useAbstractInterpretation = opts.serialize === true || Array.isArray(opts.check); this.ignoreLeakLogic = false; this.isInPureTryStatement = false; if (opts.mathRandomSeed !== undefined) {