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

Removing --abstractEffectsInAdditionalFunctions option #1623

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion scripts/debug-fb-www.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,6 @@ let prepackOptions = {
reactVerbose: true,
inlineExpressions: true,
omitInvariants: true,
abstractEffectsInAdditionalFunctions: true,
simpleClosures: true,
abstractValueImpliesMax: 1000,
};
Expand Down
2 changes: 0 additions & 2 deletions scripts/test-error-handler.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,6 @@ function runTest(name: string, code: string): boolean {

let recover = code.includes("// recover-from-errors");
let delayUnsupportedRequires = code.includes("// delay unsupported requires");
let abstractEffects = code.includes("// abstract effects");
let compatibility = code.includes("// jsc") ? "jsc-600-1-4-17" : undefined;

let expectedErrors = code.match(/\/\/\s*expected errors:\s*(.*)/);
Expand All @@ -74,7 +73,6 @@ function runTest(name: string, code: string): boolean {
errorHandler: errorHandler.bind(null, recover ? "Recover" : "Fail", errors),
serialize: true,
initializeMoreModules: false,
abstractEffectsInAdditionalFunctions: abstractEffects,
compatibility,
};
prepackFileSync([name], options);
Expand Down
1 change: 0 additions & 1 deletion scripts/test-react.js
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,6 @@ function runTestSuite(outputJsx, shouldTranspileSource) {
reactOutput: outputJsx ? "jsx" : "create-element",
inlineExpressions: true,
omitInvariants: true,
abstractEffectsInAdditionalFunctions: true,
stripFlow: true,
};

Expand Down
1 change: 0 additions & 1 deletion scripts/test-runner.js
Original file line number Diff line number Diff line change
Expand Up @@ -268,7 +268,6 @@ function runTest(name, code, options: PrepackOptions, args) {
if (code.includes("// do not inline expressions")) options.inlineExpressions = false;
if (code.includes("// omit invariants")) options.omitInvariants = true;
if (code.includes("// emit concrete model")) options.emitConcreteModel = true;
if (code.includes("// abstract effects")) options.abstractEffectsInAdditionalFunctions = true;
if (code.includes("// exceeds stack limit")) options.maxStackDepth = 10;
if (code.includes("// react")) {
options.reactEnabled = true;
Expand Down
1 change: 0 additions & 1 deletion src/options.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,6 @@ export type RealmOptions = {
reactOutput?: ReactOutputTypes,
reactVerbose?: boolean,
stripFlow?: boolean,
abstractEffectsInAdditionalFunctions?: boolean,
abstractValueImpliesMax?: number,
};

Expand Down
2 changes: 0 additions & 2 deletions src/prepack-cli.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,6 @@ function run(
--srcmapOut The output sourcemap filename.
--maxStackDepth Specify the maximum call stack depth.
--timeout The amount of time in seconds until Prepack should time out.
--abstractEffectsInAdditionalFunctions Experimental flag to allow abstract effectful function calls.
--lazyObjectsRuntime Enable lazy objects feature and specify the JS runtime that support this feature.
--debugNames Changes the output of Prepack so that for named functions and variables that get emitted into
Prepack's output, the original name is appended as a suffix to Prepack's generated identifier.
Expand Down Expand Up @@ -97,7 +96,6 @@ function run(
emitConcreteModel: false,
inlineExpressions: false,
simpleClosures: false,
abstractEffectsInAdditionalFunctions: false,
logStatistics: false,
logModules: false,
delayInitializations: false,
Expand Down
3 changes: 0 additions & 3 deletions src/prepack-options.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ import invariant from "./invariant.js";

export type PrepackOptions = {|
additionalGlobals?: Realm => void,
abstractEffectsInAdditionalFunctions?: boolean,
lazyObjectsRuntime?: string,
heapGraphFormat?: "DotLanguage" | "VISJS",
compatibility?: Compatibility,
Expand Down Expand Up @@ -59,7 +58,6 @@ export type PrepackOptions = {|
|};

export function getRealmOptions({
abstractEffectsInAdditionalFunctions = false,
compatibility = "browser",
debugNames = false,
errorHandler,
Expand All @@ -80,7 +78,6 @@ export function getRealmOptions({
abstractValueImpliesMax,
}: PrepackOptions): RealmOptions {
return {
abstractEffectsInAdditionalFunctions,
compatibility,
debugNames,
errorHandler,
Expand Down
5 changes: 0 additions & 5 deletions src/realm.js
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,6 @@ export class Realm {
constructor(opts: RealmOptions) {
this.isReadOnly = false;
this.useAbstractInterpretation = !!opts.serialize || !!opts.residual || !!opts.check;
this.trackLeaks = !!opts.abstractEffectsInAdditionalFunctions;
this.ignoreLeakLogic = false;
this.isInPureTryStatement = false;
if (opts.mathRandomSeed !== undefined) {
Expand Down Expand Up @@ -227,7 +226,6 @@ export class Realm {
isReadOnly: boolean;
isStrict: boolean;
useAbstractInterpretation: boolean;
trackLeaks: boolean;
debugNames: void | boolean;
isInPureTryStatement: boolean; // TODO(1264): Remove this once we implement proper exception handling in abstract calls.
abstractValueImpliesMax: number;
Expand Down Expand Up @@ -508,9 +506,6 @@ export class Realm {
// also won't have effects on any objects or bindings that weren't created in this
// call.
evaluatePure<T>(f: () => T) {
if (!this.trackLeaks) {
return f();
}
let saved_createdObjectsTrackedForLeaks = this.createdObjectsTrackedForLeaks;
// Track all objects (including function closures) created during
// this call. This will be used to make the assumption that every
Expand Down
4 changes: 1 addition & 3 deletions test/serializer/abstract/ObjectAssign10.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
// abstract effects

var __evaluatePureFunction = this.__evaluatePureFunction || (f => f());
var obj = global.__abstract && global.__makePartial && global.__makeSimple ? __makeSimple(__makePartial(__abstract({}, "({foo:1})"))) : {foo:1};
var copyOfCopyOfObj;
Expand All @@ -10,6 +8,6 @@ __evaluatePureFunction(() => {
copyOfObj.x = 10;
});

inspect = function() {
inspect = function() {
return JSON.stringify(copyOfCopyOfObj);
}
4 changes: 1 addition & 3 deletions test/serializer/abstract/ObjectAssign11.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
// abstract effects

var __evaluatePureFunction = this.__evaluatePureFunction || (f => f());
var obj = global.__abstract && global.__makePartial && global.__makeSimple ? __makeSimple(__makePartial(__abstract({}, "({foo:1})"))) : {foo:1};
var copyOfObj;
Expand All @@ -10,6 +8,6 @@ __evaluatePureFunction(() => {
copyOfObj.x = 10;
});

inspect = function() {
inspect = function() {
return JSON.stringify(copyOfObj);
}
4 changes: 1 addition & 3 deletions test/serializer/abstract/ObjectAssign12.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
// abstract effects

var __evaluatePureFunction = this.__evaluatePureFunction || (f => f());
var obj = global.__abstract && global.__makePartial && global.__makeSimple ? __makeSimple(__makePartial(__abstract({foo: __abstract('number')}, "({foo:1})"))) : {foo:1};
var copyOfObj;
Expand All @@ -10,6 +8,6 @@ __evaluatePureFunction(() => {
copyOfObj.foo = 2;
});

inspect = function() {
inspect = function() {
return JSON.stringify(copyOfObj);
}
4 changes: 1 addition & 3 deletions test/serializer/abstract/ObjectAssign13.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
// abstract effects

var __evaluatePureFunction = this.__evaluatePureFunction || (f => f());
var obj = global.__abstract && global.__makePartial && global.__makeSimple ? __makeSimple(__makePartial(__abstract({}, "({foo:1})"))) : {foo:1};
var copyOfObj;
Expand All @@ -15,6 +13,6 @@ __evaluatePureFunction(() => {
});
});

inspect = function() {
inspect = function() {
return JSON.stringify(copyOfObj);
}
4 changes: 1 addition & 3 deletions test/serializer/abstract/ObjectAssign14.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
// abstract effects

var __evaluatePureFunction = this.__evaluatePureFunction || (f => f());
var obj = global.__abstract && global.__makePartial && global.__makeSimple ? __makeSimple(__makePartial(__abstract({foo: __abstract('number')}, "({foo:1})"))) : {foo:1};
var copyOfObj;
Expand All @@ -10,6 +8,6 @@ __evaluatePureFunction(() => {
copyOfObj.foo = 2;
});

inspect = function() {
inspect = function() {
return JSON.stringify(copyOfObj);
}
4 changes: 1 addition & 3 deletions test/serializer/abstract/ObjectAssign15.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
// abstract effects

var __evaluatePureFunction = this.__evaluatePureFunction || (f => f());
var obj = global.__abstract && global.__makePartial && global.__makeSimple ? __makeSimple(__makePartial(__abstract({foo: __abstract('number')}, "({foo:1})"))) : {foo:1};
var copyOfObj;
Expand All @@ -17,6 +15,6 @@ __evaluatePureFunction(() => {
});
});

inspect = function() {
inspect = function() {
return JSON.stringify(y);
}
4 changes: 1 addition & 3 deletions test/serializer/abstract/ObjectAssign16.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
// abstract effects

var __evaluatePureFunction = this.__evaluatePureFunction || (f => f());
var obj = global.__abstract && global.__makePartial && global.__makeSimple ? __makeSimple(__makePartial(__abstract({foo: __abstract('number')}, "({foo:1})"))) : {foo:1};
var copyOfObj;
Expand All @@ -10,6 +8,6 @@ __evaluatePureFunction(() => {
delete copyOfObj.foo;
});

inspect = function() {
inspect = function() {
return JSON.stringify(copyOfObj);
}
4 changes: 1 addition & 3 deletions test/serializer/abstract/ObjectAssign17.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
// abstract effects

var __evaluatePureFunction = this.__evaluatePureFunction || (f => f());
var obj = global.__abstract && global.__makePartial && global.__makeSimple ? __makeSimple(__makePartial(__abstract({}, "({foo:1})"))) : {foo:1};
var copyOfObj;
Expand All @@ -21,6 +19,6 @@ __evaluatePureFunction(() => {
copyOfObj.__proto__ = proto;
});

inspect = function() {
inspect = function() {
return JSON.stringify(y);
}
2 changes: 0 additions & 2 deletions test/serializer/abstract/ObjectAssign19.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
// abstract effects

var __evaluatePureFunction = this.__evaluatePureFunction || (f => f());
var obj = global.__abstract && global.__makePartial && global.__makeSimple ? __makeSimple(__makePartial(__abstract({}, "({foo:1})"))) : {foo:1};

Expand Down
4 changes: 1 addition & 3 deletions test/serializer/abstract/ObjectAssign6.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
// abstract effects

var __evaluatePureFunction = this.__evaluatePureFunction || (f => f());
var obj = global.__abstract && global.__makePartial && global.__makeSimple ? __makeSimple(__makePartial(__abstract({}, "({foo:1})"))) : {foo:1};
var copyOfObj;
Expand All @@ -8,6 +6,6 @@ __evaluatePureFunction(() => {
copyOfObj = Object.assign({}, obj, {foo: 2});
});

inspect = function() {
inspect = function() {
return JSON.stringify(copyOfObj);
}
4 changes: 1 addition & 3 deletions test/serializer/abstract/ObjectAssign7.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
// abstract effects

var __evaluatePureFunction = this.__evaluatePureFunction || (f => f());
var obj = global.__abstract && global.__makePartial && global.__makeSimple ? __makeSimple(__makePartial(__abstract({}, "({foo:1})"))) : {foo:1};
var copyOfObj;
Expand All @@ -8,6 +6,6 @@ __evaluatePureFunction(() => {
copyOfObj = Object.assign({}, {foo: 2}, obj);
});

inspect = function() {
inspect = function() {
return JSON.stringify(copyOfObj);
}
4 changes: 1 addition & 3 deletions test/serializer/abstract/ObjectAssign8.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
// abstract effects

var __evaluatePureFunction = this.__evaluatePureFunction || (f => f());
var obj = global.__abstract && global.__makePartial && global.__makeSimple ? __makeSimple(__makePartial(__abstract({}, "({foo:1})"))) : {foo:1};
var x;
Expand All @@ -11,6 +9,6 @@ __evaluatePureFunction(() => {
y.foo = 2;
});

inspect = function() {
inspect = function() {
return JSON.stringify(x);
}
2 changes: 0 additions & 2 deletions test/serializer/abstract/ObjectAssign9.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
// abstract effects

var __evaluatePureFunction = this.__evaluatePureFunction || (f => f());
__evaluatePureFunction(() => {
let dims = global.__abstract ? __abstract({
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
// abstract effects

global.f = function(x, y) {
if (y) Object.assign({}, x); else throw new Error();
};
Expand Down
2 changes: 0 additions & 2 deletions test/serializer/pure-functions/AbstractCall.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
// abstract effects

let forEach = global.__abstract ? __abstract('function', '(function(callback) { callback("a", 0); callback("b", 1); })') : function(callback) { callback("a", 0); callback("b", 1); };
let set = global.__abstract ? __abstract('function', '(function(obj, name, value) { obj[name] = value; })') : function(obj, name, value) { obj[name] = value; };

Expand Down
2 changes: 0 additions & 2 deletions test/serializer/pure-functions/AbstractCallUnknownType.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
// abstract effects

let obj = global.__abstract ? __abstract('object', '({foo: function() { return 1; }})') : {foo: function() { return 1; }};
if (global.__makeSimple) {
__makeSimple(obj);
Expand Down
2 changes: 0 additions & 2 deletions test/serializer/pure-functions/AbstractCallUnknownType2.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
// abstract effects

let obj = {};
if (global.__makeSimple) {
__makeSimple(obj);
Expand Down
2 changes: 0 additions & 2 deletions test/serializer/pure-functions/AbstractPropertyRead.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
// abstract effects

let obj1 = global.__abstract ? __abstract('object', '({get foo() { return "bar"; }})') : {get foo() { return "bar"; }};
let obj2 = global.__abstract ? __abstract('object', '({foo:{bar:"baz"}})') : {foo:{bar:"baz"}};
if (global.__makeSimple) {
Expand Down
2 changes: 0 additions & 2 deletions test/serializer/pure-functions/AbstractPropertyRead2.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
// abstract effects

let obj1 = global.__abstract ? __abstract('object', '({get foo() { return "bar"; }})') : {get foo() { return "bar"; }};
let obj2 = global.__abstract ? __abstract('object', '({foo:{extends:"baz"}})') : {foo:{"extends":"baz"}};
if (global.__makeSimple) {
Expand Down
1 change: 0 additions & 1 deletion test/serializer/pure-functions/AbstractPropertyRead3.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
// abstract effects
// does contain: "barone"

var __evaluatePureFunction = this.__evaluatePureFunction || (f => f());
Expand Down
1 change: 0 additions & 1 deletion test/serializer/pure-functions/AbstractPropertyRead4.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
// abstract effects
// does contain: "barone"
// does not contain: "23"

Expand Down
2 changes: 0 additions & 2 deletions test/serializer/pure-functions/BinaryExpressions.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
// abstract effects

let obj1 = global.__abstract ? __abstract('object', '({foo: {valueOf() { return 42; }}})') : {foo: {valueOf() { return 42; }}};
let obj2 = global.__abstract ? __abstract('object', '({foo: {bar: {valueOf() { return 42; }}}})') : {foo: {bar: {valueOf() { return 42; }}}};

Expand Down
2 changes: 0 additions & 2 deletions test/serializer/pure-functions/BinaryExpressions2.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
// abstract effects

let obj1 = global.__abstract ? __abstract('object', '({foo: {valueOf() { return 42; }}})') : {foo: {valueOf() { return 42; }}};
let obj2 = global.__abstract ? __abstract('object', '({foo: {bar: {valueOf() { return 42; }}}})') : {foo: {bar: {valueOf() { return 42; }}}};

Expand Down
4 changes: 1 addition & 3 deletions test/serializer/pure-functions/BinaryExpressions3.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
// abstract effects

let obj1 = global.__abstract ? __abstract('object', '({valueOf() { this.x = 10; return 42; }})') : {valueOf() { this.x = 10; return 42; }};

function additional1() {
Expand All @@ -12,7 +10,7 @@ function additional2() {
var x = {
valueOf:
(global.__abstract
? __abstract('function', '(function() { this.foo++; return 10; })')
? __abstract('function', '(function() { this.foo++; return 10; })')
: function() { this.foo++; return 10; }
),
foo: 0
Expand Down
2 changes: 0 additions & 2 deletions test/serializer/pure-functions/CastStringOnUnknown.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
// abstract effects

let obj1 = global.__abstract ? __abstract('object', '({get foo() { return "bar"; }})') : {get foo() { return "bar"; }};
let obj2 = global.__abstract ? __abstract('object', '({foo:{bar:"baz"}})') : {foo:{bar:"baz"}};
if (global.__makeSimple) {
Expand Down
8 changes: 3 additions & 5 deletions test/serializer/pure-functions/Invariants.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
// abstract effects

var invariant = function(condition, message) {
if (condition) return;
throw new Error(message);
Expand All @@ -10,8 +8,8 @@ if (!global.__evaluatePureFunction) {
}

__evaluatePureFunction(() => {
var x = global.__abstract
? __abstract("object", "({foo: {foo2: {}}, bar: {bar2: {}}})")
var x = global.__abstract
? __abstract("object", "({foo: {foo2: {}}, bar: {bar2: {}}})")
: {foo: {foo2: {}}, bar: {bar2: {}}};

if (global.__makeSimple) {
Expand All @@ -26,4 +24,4 @@ __evaluatePureFunction(() => {

foo2 || invariant(0, "Should not error 1!");
bar2 || invariant(0, "Should not error 2!");
});
});
2 changes: 0 additions & 2 deletions test/serializer/pure-functions/NewExpression.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
// abstract effects

var Foo = global.__abstract ? __abstract(undefined, "(function () { this.x = 10 })") : function () { this.x = 10 };

function additional1() {
Expand Down
2 changes: 0 additions & 2 deletions test/serializer/pure-functions/ObjectAssign.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
// abstract effects

var obj = global.__abstract && global.__makePartial ? __makePartial(__abstract({}, "({foo:1})")) : {foo:1};

function additional1() {
Expand Down
Loading