From d65783ef5962a1e26afdc7c03ae57d8eebd4bf59 Mon Sep 17 00:00:00 2001 From: Sigmund Cherem Date: Wed, 13 May 2026 11:42:30 -0700 Subject: [PATCH] [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 Commit-Queue: Sigmund Cherem --- runtime/vm/interpreter.cc | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/runtime/vm/interpreter.cc b/runtime/vm/interpreter.cc index 9e8391f8b3a..aa83d53212a 100644 --- a/runtime/vm/interpreter.cc +++ b/runtime/vm/interpreter.cc @@ -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;