Skip to content

Commit

Permalink
[compiler] Option to always take the non-memo branch
Browse files Browse the repository at this point in the history
Summary: This adds a debugging mode to the compiler that simply adds a `|| true` to the guard on all memoization blocks, which results in the generated code never using memoized values and always recomputing them. This is designed as a validation tool for the compiler's correctness--every program *should* behave exactly the same with this option enabled as it would with it disabled, and so any difference in behavior should be investigated as either a compiler bug or a pipeline issue.

(We add `|| true` rather than dropping the conditional block entirely because we still want to exercise the guard tests, in case the guards themselves are the source of an error, like reading a property from undefined in a guard.)

ghstack-source-id: 955a47ec1689842da82552225a19a1008c57fe2c
Pull Request resolved: #29655

DiffTrain build for commit 8b01a2e.
  • Loading branch information
mvitousek committed May 31, 2024
1 parent d0d9492 commit f50a231
Show file tree
Hide file tree
Showing 13 changed files with 35 additions and 35 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
* @noflow
* @nolint
* @preventMunge
* @generated SignedSource<<d9285fd06971a6f9cfc18fa70dc67a2b>>
* @generated SignedSource<<b0cc5c4d6fedee7f4ad0da5a4287ec9e>>
*/

'use strict';
Expand Down Expand Up @@ -23471,7 +23471,7 @@ identifierPrefix, onUncaughtError, onCaughtError, onRecoverableError, transition
return root;
}

var ReactVersion = '19.0.0-rc-28fe581bac-20240531';
var ReactVersion = '19.0.0-rc-8b01a2e0bf-20240531';

/*
* The `'' + value` pattern (used in perf-sensitive code) throws for Symbol
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
* @noflow
* @nolint
* @preventMunge
* @generated SignedSource<<57e88f8e6d00adbb37f13703f55d92ea>>
* @generated SignedSource<<7a10cc1042dd4bdcad6d1a3fff738699>>
*/

"use strict";
Expand Down Expand Up @@ -9298,7 +9298,7 @@ var devToolsConfig$jscomp$inline_1047 = {
throw Error("TestRenderer does not support findFiberByHostInstance()");
},
bundleType: 0,
version: "19.0.0-rc-28fe581bac-20240531",
version: "19.0.0-rc-8b01a2e0bf-20240531",
rendererPackageName: "react-test-renderer"
};
var internals$jscomp$inline_1234 = {
Expand Down Expand Up @@ -9329,7 +9329,7 @@ var internals$jscomp$inline_1234 = {
scheduleRoot: null,
setRefreshHandler: null,
getCurrentFiber: null,
reconcilerVersion: "19.0.0-rc-28fe581bac-20240531"
reconcilerVersion: "19.0.0-rc-8b01a2e0bf-20240531"
};
if ("undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__) {
var hook$jscomp$inline_1235 = __REACT_DEVTOOLS_GLOBAL_HOOK__;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
* @noflow
* @nolint
* @preventMunge
* @generated SignedSource<<37b7169a75924b061b2b0339859ab8ca>>
* @generated SignedSource<<b54b5c707946ed4ed58878492bf71f2f>>
*/

"use strict";
Expand Down Expand Up @@ -9920,7 +9920,7 @@ var devToolsConfig$jscomp$inline_1130 = {
throw Error("TestRenderer does not support findFiberByHostInstance()");
},
bundleType: 0,
version: "19.0.0-rc-28fe581bac-20240531",
version: "19.0.0-rc-8b01a2e0bf-20240531",
rendererPackageName: "react-test-renderer"
};
(function (internals) {
Expand Down Expand Up @@ -9964,7 +9964,7 @@ var devToolsConfig$jscomp$inline_1130 = {
scheduleRoot: null,
setRefreshHandler: null,
getCurrentFiber: null,
reconcilerVersion: "19.0.0-rc-28fe581bac-20240531"
reconcilerVersion: "19.0.0-rc-8b01a2e0bf-20240531"
});
exports._Scheduler = Scheduler;
exports.act = act;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
* @noflow
* @nolint
* @preventMunge
* @generated SignedSource<<157f443607888a05b53d9d23d8a2d840>>
* @generated SignedSource<<475b4fd7ea9a70bf7bfe31f1e178a18b>>
*/

'use strict';
Expand All @@ -24,7 +24,7 @@ if (
}
var dynamicFlagsUntyped = require('ReactNativeInternalFeatureFlags');

var ReactVersion = '19.0.0-rc-28fe581bac-20240531';
var ReactVersion = '19.0.0-rc-8b01a2e0bf-20240531';

// Re-export dynamic flags from the internal module.
var dynamicFlags = dynamicFlagsUntyped; // We destructure each value before re-exporting to avoid a dynamic look-up on
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
* @noflow
* @nolint
* @preventMunge
* @generated SignedSource<<f604af31fab5d9ed18da2f9bc1623c9f>>
* @generated SignedSource<<eb0b86b207aef55edefc359a6a746af9>>
*/

"use strict";
Expand Down Expand Up @@ -604,4 +604,4 @@ exports.useSyncExternalStore = function (
exports.useTransition = function () {
return ReactSharedInternals.H.useTransition();
};
exports.version = "19.0.0-rc-28fe581bac-20240531";
exports.version = "19.0.0-rc-8b01a2e0bf-20240531";
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
* @noflow
* @nolint
* @preventMunge
* @generated SignedSource<<82497046cf2b0f32f7d52ceb09a02386>>
* @generated SignedSource<<4a17c8a462ff52305c35ef0f626bf522>>
*/

"use strict";
Expand Down Expand Up @@ -608,7 +608,7 @@ exports.useSyncExternalStore = function (
exports.useTransition = function () {
return ReactSharedInternals.H.useTransition();
};
exports.version = "19.0.0-rc-28fe581bac-20240531";
exports.version = "19.0.0-rc-8b01a2e0bf-20240531";
"undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ &&
"function" ===
typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop &&
Expand Down
Original file line number Diff line number Diff line change
@@ -1 +1 @@
28fe581bac10ca91b0d12d95beb034cfe790f3d0
8b01a2e0bf17adc6bb7b81d1d0063c7efe9ea8b1
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
* @noflow
* @nolint
* @preventMunge
* @generated SignedSource<<7af656b7f088d3769616934b1b2e642b>>
* @generated SignedSource<<9f6f4c948cebb7f671aab7f24cab034e>>
*/

'use strict';
Expand Down Expand Up @@ -26206,7 +26206,7 @@ identifierPrefix, onUncaughtError, onCaughtError, onRecoverableError, transition
return root;
}

var ReactVersion = '19.0.0-rc-28fe581bac-20240531';
var ReactVersion = '19.0.0-rc-8b01a2e0bf-20240531';

/*
* The `'' + value` pattern (used in perf-sensitive code) throws for Symbol
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
* @noflow
* @nolint
* @preventMunge
* @generated SignedSource<<8ede2fc599f1edc4462dade6134f7392>>
* @generated SignedSource<<42682435d91d8913a033807ada30a816>>
*/

"use strict";
Expand Down Expand Up @@ -10551,7 +10551,7 @@ var roots = new Map(),
devToolsConfig$jscomp$inline_1124 = {
findFiberByHostInstance: getInstanceFromNode,
bundleType: 0,
version: "19.0.0-rc-28fe581bac-20240531",
version: "19.0.0-rc-8b01a2e0bf-20240531",
rendererPackageName: "react-native-renderer",
rendererConfig: {
getInspectorDataForInstance: getInspectorDataForInstance,
Expand Down Expand Up @@ -10594,7 +10594,7 @@ var internals$jscomp$inline_1350 = {
scheduleRoot: null,
setRefreshHandler: null,
getCurrentFiber: null,
reconcilerVersion: "19.0.0-rc-28fe581bac-20240531"
reconcilerVersion: "19.0.0-rc-8b01a2e0bf-20240531"
};
if ("undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__) {
var hook$jscomp$inline_1351 = __REACT_DEVTOOLS_GLOBAL_HOOK__;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
* @noflow
* @nolint
* @preventMunge
* @generated SignedSource<<972ed4c454ec9065518dc9ab2a94dc5c>>
* @generated SignedSource<<ce41707f3ee07509d2b83c84527bee87>>
*/

"use strict";
Expand Down Expand Up @@ -11257,7 +11257,7 @@ var roots = new Map(),
devToolsConfig$jscomp$inline_1205 = {
findFiberByHostInstance: getInstanceFromNode,
bundleType: 0,
version: "19.0.0-rc-28fe581bac-20240531",
version: "19.0.0-rc-8b01a2e0bf-20240531",
rendererPackageName: "react-native-renderer",
rendererConfig: {
getInspectorDataForInstance: getInspectorDataForInstance,
Expand Down Expand Up @@ -11313,7 +11313,7 @@ var roots = new Map(),
scheduleRoot: null,
setRefreshHandler: null,
getCurrentFiber: null,
reconcilerVersion: "19.0.0-rc-28fe581bac-20240531"
reconcilerVersion: "19.0.0-rc-8b01a2e0bf-20240531"
});
exports.createPortal = function (children, containerTag) {
return createPortal$1(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
* @noflow
* @nolint
* @preventMunge
* @generated SignedSource<<b4e8bb30431a24d682d1d4ae6e483add>>
* @generated SignedSource<<37c5203bf8c2fedad86f672d81095925>>
*/

'use strict';
Expand Down Expand Up @@ -26562,7 +26562,7 @@ identifierPrefix, onUncaughtError, onCaughtError, onRecoverableError, transition
return root;
}

var ReactVersion = '19.0.0-rc-28fe581bac-20240531';
var ReactVersion = '19.0.0-rc-8b01a2e0bf-20240531';

/*
* The `'' + value` pattern (used in perf-sensitive code) throws for Symbol
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
* @noflow
* @nolint
* @preventMunge
* @generated SignedSource<<e30a753954f25dc5c732535c005dae86>>
* @generated SignedSource<<3f4af6626156bb6a470717b63036037c>>
*/

"use strict";
Expand Down Expand Up @@ -10696,11 +10696,11 @@ function traverseOwnerTreeUp(hierarchy, instance) {
traverseOwnerTreeUp(hierarchy, instance);
}
var isomorphicReactPackageVersion = React.version;
if ("19.0.0-rc-28fe581bac-20240531" !== isomorphicReactPackageVersion)
if ("19.0.0-rc-8b01a2e0bf-20240531" !== isomorphicReactPackageVersion)
throw Error(
'Incompatible React versions: The "react" and "react-native-renderer" packages must have the exact same version. Instead got:\n - react: ' +
(isomorphicReactPackageVersion +
"\n - react-native-renderer: 19.0.0-rc-28fe581bac-20240531\nLearn more: https://react.dev/warnings/version-mismatch")
"\n - react-native-renderer: 19.0.0-rc-8b01a2e0bf-20240531\nLearn more: https://react.dev/warnings/version-mismatch")
);
if (
"function" !==
Expand Down Expand Up @@ -10750,7 +10750,7 @@ var roots = new Map(),
devToolsConfig$jscomp$inline_1192 = {
findFiberByHostInstance: getInstanceFromTag,
bundleType: 0,
version: "19.0.0-rc-28fe581bac-20240531",
version: "19.0.0-rc-8b01a2e0bf-20240531",
rendererPackageName: "react-native-renderer",
rendererConfig: {
getInspectorDataForInstance: getInspectorDataForInstance,
Expand Down Expand Up @@ -10793,7 +10793,7 @@ var internals$jscomp$inline_1439 = {
scheduleRoot: null,
setRefreshHandler: null,
getCurrentFiber: null,
reconcilerVersion: "19.0.0-rc-28fe581bac-20240531"
reconcilerVersion: "19.0.0-rc-8b01a2e0bf-20240531"
};
if ("undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__) {
var hook$jscomp$inline_1440 = __REACT_DEVTOOLS_GLOBAL_HOOK__;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
* @noflow
* @nolint
* @preventMunge
* @generated SignedSource<<649260d0b4acd3f5bcd00ec118168a30>>
* @generated SignedSource<<e8cb604a250411d61568d30bd0e3f160>>
*/

"use strict";
Expand Down Expand Up @@ -11403,11 +11403,11 @@ function traverseOwnerTreeUp(hierarchy, instance) {
traverseOwnerTreeUp(hierarchy, instance);
}
var isomorphicReactPackageVersion = React.version;
if ("19.0.0-rc-28fe581bac-20240531" !== isomorphicReactPackageVersion)
if ("19.0.0-rc-8b01a2e0bf-20240531" !== isomorphicReactPackageVersion)
throw Error(
'Incompatible React versions: The "react" and "react-native-renderer" packages must have the exact same version. Instead got:\n - react: ' +
(isomorphicReactPackageVersion +
"\n - react-native-renderer: 19.0.0-rc-28fe581bac-20240531\nLearn more: https://react.dev/warnings/version-mismatch")
"\n - react-native-renderer: 19.0.0-rc-8b01a2e0bf-20240531\nLearn more: https://react.dev/warnings/version-mismatch")
);
if (
"function" !==
Expand Down Expand Up @@ -11457,7 +11457,7 @@ var roots = new Map(),
devToolsConfig$jscomp$inline_1273 = {
findFiberByHostInstance: getInstanceFromTag,
bundleType: 0,
version: "19.0.0-rc-28fe581bac-20240531",
version: "19.0.0-rc-8b01a2e0bf-20240531",
rendererPackageName: "react-native-renderer",
rendererConfig: {
getInspectorDataForInstance: getInspectorDataForInstance,
Expand Down Expand Up @@ -11513,7 +11513,7 @@ var roots = new Map(),
scheduleRoot: null,
setRefreshHandler: null,
getCurrentFiber: null,
reconcilerVersion: "19.0.0-rc-28fe581bac-20240531"
reconcilerVersion: "19.0.0-rc-8b01a2e0bf-20240531"
});
exports.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED = {
computeComponentStackForErrorReporting: function (reactTag) {
Expand Down

0 comments on commit f50a231

Please sign in to comment.