Skip to content
This repository has been archived by the owner on Feb 12, 2022. It is now read-only.

Commit

Permalink
Removing --serialize and --residual options (#2504)
Browse files Browse the repository at this point in the history
Summary:
Release notes: Removing --serialize and --residual options from Prepack (CLI)

Pull Request resolved: #2504

Reviewed By: trueadm

Differential Revision: D9582602

Pulled By: NTillmann

fbshipit-source-id: d30a6ef662de5ebddd5e7d615ea37b3f772ce93d
  • Loading branch information
NTillmann authored and facebook-github-bot committed Aug 31, 2018
1 parent 3f2445d commit 12ae403
Show file tree
Hide file tree
Showing 5 changed files with 4 additions and 29 deletions.
11 changes: 0 additions & 11 deletions scripts/test-runner.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 }]]);
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -793,7 +791,6 @@ function run(args) {
delayInitializations,
inlineExpressions,
lazyObjectsRuntime,
residual: args && args.residual,
};
return () =>
runTest(test.name, test.file, options, args).then(testResult => {
Expand Down Expand Up @@ -831,7 +828,6 @@ class ProgramArgs {
lazyObjectsRuntime: string;
noLazySupport: boolean;
fast: boolean;
residual: boolean;
cpuprofilePath: string;
constructor(
debugNames: boolean,
Expand All @@ -843,7 +839,6 @@ class ProgramArgs {
lazyObjectsRuntime: string,
noLazySupport: boolean,
fast: boolean,
residual: boolean,
cpuProfilePath: string
) {
this.debugNames = debugNames;
Expand All @@ -855,7 +850,6 @@ class ProgramArgs {
this.lazyObjectsRuntime = lazyObjectsRuntime;
this.noLazySupport = noLazySupport;
this.fast = fast;
this.residual = residual;
this.cpuprofilePath = cpuProfilePath;
}
}
Expand Down Expand Up @@ -920,7 +914,6 @@ function argsParse(): ProgramArgs {
lazyObjectsRuntime: LAZY_OBJECTS_RUNTIME_NAME,
noLazySupport: false,
fast: false,
residual: false,
cpuprofilePath: "",
},
});
Expand Down Expand Up @@ -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");
}
Expand All @@ -969,7 +959,6 @@ function argsParse(): ProgramArgs {
parsedArgs.lazyObjectsRuntime,
parsedArgs.noLazySupport,
parsedArgs.fast,
parsedArgs.residual,
parsedArgs.cpuprofilePath
);
return programArgs;
Expand Down
1 change: 0 additions & 1 deletion src/options.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,6 @@ export type RealmOptions = {
invariantMode?: InvariantModeTypes,
emitConcreteModel?: boolean,
uniqueSuffix?: string,
residual?: boolean,
serialize?: boolean,
strictlyMonotonicDateNow?: boolean,
timeout?: number,
Expand Down
14 changes: 2 additions & 12 deletions src/prepack-cli.js
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -120,8 +117,6 @@ function run(
delayInitializations: false,
internalDebug: false,
debugScopes: false,
serialize: false,
residual: false,
profile: false,
instantRender: false,
reactEnabled: false,
Expand Down Expand Up @@ -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(
{},
{
Expand All @@ -353,6 +342,7 @@ function run(
timeout,
debugIdentifiers,
check,
serialize: !check,
lazyObjectsRuntime,
debugInFilePath,
debugOutFilePath,
Expand Down
5 changes: 1 addition & 4 deletions src/prepack-options.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@ export type PrepackOptions = {|
reactOutput?: ReactOutputTypes,
reactVerbose?: boolean,
reactOptimizeNestedFunctions?: boolean,
residual?: boolean,
serialize?: boolean,
check?: Array<number>,
inlineExpressions?: boolean,
Expand Down Expand Up @@ -76,8 +75,7 @@ export function getRealmOptions({
reactOutput,
reactVerbose,
reactOptimizeNestedFunctions,
residual,
serialize = !residual,
serialize,
check,
strictlyMonotonicDateNow,
stripFlow,
Expand All @@ -102,7 +100,6 @@ export function getRealmOptions({
reactOutput,
reactVerbose,
reactOptimizeNestedFunctions,
residual,
serialize,
check,
strictlyMonotonicDateNow,
Expand Down
2 changes: 1 addition & 1 deletion src/realm.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down

0 comments on commit 12ae403

Please sign in to comment.