[dyn modules] add runtime flag for checking under JIT

At this time, this flag is mainly going to be used to enable partial
testing of the JIT runtime when loading applications from kernel
snapshots.

Bug: b/448095881

TEST=none yet, will be added in upcoming CL
Change-Id: I272d43cdab0c9a9c3653cccc9e96961c1122bbd7
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/503460
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Commit-Queue: Sigmund Cherem <sigmund@google.com>
This commit is contained in:
Sigmund Cherem
2026-05-13 11:42:30 -07:00
committed by dart-scoped@luci-project-accounts.iam.gserviceaccount.com
parent 2c5f7e1ab0
commit d65783ef59
+12 -6
View File
@@ -44,6 +44,16 @@ DEFINE_FLAG(uint64_t,
100 * MB,
"Maximum size in bytes of the interpreter trace file");
#if defined(DART_PRECOMPILED_RUNTIME)
constexpr bool kDefaultCheckDynamicCalls = true;
#else
constexpr bool kDefaultCheckDynamicCalls = false;
#endif
DEFINE_FLAG(bool,
check_dynamic_calls,
kDefaultCheckDynamicCalls,
"Whether to check dynamic calls from dynamic modules.");
// InterpreterSetjmpBuffer are linked together, and the last created one
// is referenced by the Interpreter. When an exception is thrown, the exception
// runtime looks at where to jump and finds the corresponding
@@ -2492,12 +2502,8 @@ SwitchDispatchNoSingleStep:
StringPtr target_name = String::RawCast(LOAD_CONSTANT(kidx));
argdesc_ = Array::RawCast(LOAD_CONSTANT(kidx + 1));
#if defined(DART_PRECOMPILED_RUNTIME)
bool caller_in_dynamic_module = true;
#else
// TODO(sigmund): track when caller is declared in a dynamic module.
bool caller_in_dynamic_module = false;
#endif
// TODO(b/448095881): track when caller is declared in a dynamic module.
bool caller_in_dynamic_module = FLAG_check_dynamic_calls;
if (!InstanceCall(thread, target_name, call_base, call_top, &pc, &FP, &SP,
/*check_dynamic_call=*/caller_in_dynamic_module)) {
HANDLE_EXCEPTION;