Skip to content

Commit

Permalink
[compiler][rfc] Hacky retry pipeline for fire (facebook#32164)
Browse files Browse the repository at this point in the history
Hacky retry pipeline for when transforming `fire(...)` calls encounters
validation, todo, or memoization invariant bailouts. Would love feedback
on how we implement this to be extensible to other compiler
non-memoization features (e.g. inlineJSX)

Some observations:
- Compiler "front-end" passes (e.g. lower, type, effect, and mutability
inferences) should be shared for all compiler features -- memo and
otherwise
- Many passes (anything dealing with reactive scope ranges, scope blocks
/ dependencies, and optimizations such as ReactiveIR facebook#31974) can be left
out of the retry pipeline. This PR hackily skips memoization features by
removing reactive scope creation, but we probably should restructure the
pipeline to skip these entirely on a retry
- We should maintain a canonical set of "validation flags"

Note the newly added fixtures are prefixed with `bailout-...` when the
retry fire pipeline is used. These fixture outputs contain correctly
inserted `useFire` calls and no memoization.

DiffTrain build for [152bfe3](facebook@152bfe3)
  • Loading branch information
addcx1developer committed Feb 1, 2025
1 parent aa102d1 commit ee2f852
Show file tree
Hide file tree
Showing 27 changed files with 5,500 additions and 5,311 deletions.
2 changes: 1 addition & 1 deletion compiled-rn/VERSION_NATIVE_FB
Original file line number Diff line number Diff line change
@@ -1 +1 @@
19.1.0-native-fb-0bf1f39e-20250110
19.1.0-native-fb-152bfe37-20250131
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
* @noflow
* @nolint
* @preventMunge
* @generated SignedSource<<b57d260398996604ce144f77869f967c>>
* @generated SignedSource<<e65e27c285e286a4414394e196ebba85>>
*/

"use strict";
Expand All @@ -23,12 +23,17 @@ __DEV__ &&
_key2++
)
args[_key2 - 1] = arguments[_key2];
_len2 = format;
ReactSharedInternals.getCurrentStack &&
((_key2 = ReactSharedInternals.getCurrentStack()),
"" !== _key2 && ((_len2 += "%s"), (args = args.concat([_key2]))));
args.unshift(_len2);
Function.prototype.apply.call(console.error, console, args);
if (enableRemoveConsolePatches) {
var _console2;
(_console2 = console).error.apply(_console2, [format].concat(args));
} else
(_len2 = format),
enableRemoveConsolePatches ||
(ReactSharedInternals.getCurrentStack &&
((_key2 = ReactSharedInternals.getCurrentStack()),
"" !== _key2 && ((_len2 += "%s"), (args = args.concat([_key2])))),
args.unshift(_len2),
Function.prototype.apply.call(console.error, console, args));
}
function testStringCoercion(value) {
return "" + value;
Expand Down Expand Up @@ -96,6 +101,7 @@ __DEV__ &&
return dispatcher;
}
var React = require("react"),
dynamicFlagsUntyped = require("ReactNativeInternalFeatureFlags"),
Internals = {
d: {
f: noop,
Expand All @@ -117,6 +123,8 @@ __DEV__ &&
},
ReactSharedInternals =
React.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,
enableRemoveConsolePatches =
dynamicFlagsUntyped && dynamicFlagsUntyped.enableRemoveConsolePatches,
REACT_PORTAL_TYPE = Symbol.for("react.portal");
("function" === typeof Map &&
null != Map.prototype &&
Expand Down Expand Up @@ -420,5 +428,5 @@ __DEV__ &&
exports.useFormStatus = function () {
return resolveDispatcher().useHostTransitionStatus();
};
exports.version = "19.1.0-native-fb-0bf1f39e-20250110";
exports.version = "19.1.0-native-fb-152bfe37-20250131";
})();
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
* @noflow
* @nolint
* @preventMunge
* @generated SignedSource<<d68d8f9b1bea78f147f97a6fc1d03018>>
* @generated SignedSource<<cb2932bc6701a2e5317ce3baf8fda071>>
*/

"use strict";
Expand Down Expand Up @@ -203,4 +203,4 @@ exports.useFormState = function (action, initialState, permalink) {
exports.useFormStatus = function () {
return ReactSharedInternals.H.useHostTransitionStatus();
};
exports.version = "19.1.0-native-fb-0bf1f39e-20250110";
exports.version = "19.1.0-native-fb-152bfe37-20250131";
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
* @noflow
* @nolint
* @preventMunge
* @generated SignedSource<<d68d8f9b1bea78f147f97a6fc1d03018>>
* @generated SignedSource<<cb2932bc6701a2e5317ce3baf8fda071>>
*/

"use strict";
Expand Down Expand Up @@ -203,4 +203,4 @@ exports.useFormState = function (action, initialState, permalink) {
exports.useFormStatus = function () {
return ReactSharedInternals.H.useHostTransitionStatus();
};
exports.version = "19.1.0-native-fb-0bf1f39e-20250110";
exports.version = "19.1.0-native-fb-152bfe37-20250131";
Loading

0 comments on commit ee2f852

Please sign in to comment.