From d50ab710ab32ebc3bf87ce5c1f693f541c1f92e0 Mon Sep 17 00:00:00 2001 From: xiongluo Date: Thu, 21 Aug 2025 09:14:29 +0800 Subject: [PATCH] Add safepoint for module Issue: https://gitee.com/openharmony/arkcompiler_ets_runtime/issues/ICTY86?from=project-issue Signed-off-by: xiongluo Change-Id: I1ee31b154d8822c04b8b8b24dd26f13ff24b88f1 --- ecmascript/module/js_module_source_text.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/ecmascript/module/js_module_source_text.cpp b/ecmascript/module/js_module_source_text.cpp index 790050a045..d5367cd2da 100644 --- a/ecmascript/module/js_module_source_text.cpp +++ b/ecmascript/module/js_module_source_text.cpp @@ -645,8 +645,6 @@ bool SourceTextModule::PreModuleInstantiation(JSThread *thread, int SourceTextModule::FinishModuleInstantiation(JSThread *thread, JSHandle module, CVector> &stack, int index, JSHandle exception) { - // Add a safepoint here to check if a suspension is needed. - thread->CheckSafepointIfSuspended(); // ArkTS module doesn't implement other module Record, delete follow branch. // 1. If module is not a Source Text Module Record, then // a. Perform ? module.Instantiate(). @@ -711,6 +709,9 @@ int SourceTextModule::FinishModuleInstantiation(JSThread *thread, JSHandle &module) { + // Add a safepoint here to check if a suspension is needed. + thread->CheckSafepointIfSuspended(); + CheckResolvedBinding(thread, module); if (module->GetImportEntries(thread).IsUndefined()) { return; @@ -789,6 +790,9 @@ void SourceTextModule::ModuleDeclarationEnvironmentSetup(JSThread *thread, void SourceTextModule::ModuleDeclarationArrayEnvironmentSetup(JSThread *thread, const JSHandle &module) { + // Add a safepoint here to check if a suspension is needed. + thread->CheckSafepointIfSuspended(); + ModuleTraceScope moduleTraceScope(thread, "SourceTextModule::Instantiating:" + module->GetEcmaModuleRecordNameString()); if (IsSharedModule(module) && SharedModuleManager::GetInstance()->IsInstantiatedSModule(thread, module)) { -- Gitee