diff --git a/patch/ets_runtime.diff b/patch/ets_runtime.diff index fe4e1b755b5e90e6fb50d6a7a32e0984991921f9..f53265db74eeff9c2f753b26f201292bccaee008 100644 --- a/patch/ets_runtime.diff +++ b/patch/ets_runtime.diff @@ -1,8 +1,8 @@ diff --git a/BUILD.gn b/BUILD.gn -index 95cb26c32..981af9770 100644 +index 130f36f95..a2267684a 100644 --- a/BUILD.gn +++ b/BUILD.gn -@@ -1021,6 +1021,91 @@ libark_jsruntime_common_set("libark_jsruntime_arm_set") { +@@ -1133,6 +1133,91 @@ libark_jsruntime_common_set("libark_jsruntime_arm_set") { } } @@ -94,20 +94,27 @@ index 95cb26c32..981af9770 100644 libark_jsruntime_intl_common_set("libark_js_intl_set") { } -@@ -1135,7 +1220,7 @@ ohos_source_set("libark_jsruntime_static") { - - deps = [ - ":libark_js_intl_arm_set", -- ":libark_jsruntime_arm_set", -+ ":libark_jsruntime_set_cov" - ] +@@ -1250,13 +1335,13 @@ ohos_source_set("libark_jsruntime_static") { + if (is_ohos && is_standard_system) { + deps = [ + ":libark_js_intl_arm_set", +- ":libark_jsruntime_arm_set", ++ ":libark_jsruntime_set_cov", + ] + } else { + # in this case libark_jsruntime_arm_set and libark_jsruntime_set are identical + deps = [ + ":libark_js_intl_set", +- ":libark_jsruntime_set", ++ ":libark_jsruntime_set_cov", + ] + } external_deps = [] - if (!is_arkui_x) { diff --git a/ecmascript/ecma_context.cpp b/ecmascript/ecma_context.cpp -index b00cfe81a..f89ca208d 100644 +index 63cc7552b..b9e6981ca 100644 --- a/ecmascript/ecma_context.cpp +++ b/ecmascript/ecma_context.cpp -@@ -375,10 +375,10 @@ Expected EcmaContext::InvokeEcmaEntrypointForHotReload( +@@ -427,10 +427,10 @@ Expected EcmaContext::InvokeEcmaEntrypointForHotReload( AddPatchModule(recordName, moduleRecordHandle); // print exception information @@ -123,10 +130,10 @@ index b00cfe81a..f89ca208d 100644 } diff --git a/ecmascript/js_arraybuffer.cpp b/ecmascript/js_arraybuffer.cpp -index 178d0e14a..018bcd374 100644 +index 8e6c55a10..7a7007e58 100644 --- a/ecmascript/js_arraybuffer.cpp +++ b/ecmascript/js_arraybuffer.cpp -@@ -46,7 +46,7 @@ void JSArrayBuffer::CopyDataPointBytes(void *toBuf, void *fromBuf, int32_t fromI +@@ -41,7 +41,7 @@ void JSArrayBuffer::CopyDataPointBytes(void *toBuf, void *fromBuf, int32_t fromI void JSArrayBuffer::Attach(JSThread *thread, uint32_t arrayBufferByteLength, JSTaggedValue arrayBufferData, bool transferWithNativeAreaAllocator) { @@ -135,7 +142,7 @@ index 178d0e14a..018bcd374 100644 // only in transition, should the JSArrayBuffer with NativeAreaAllocator increase mem usage if (transferWithNativeAreaAllocator) { LOG_FULL(DEBUG) << "attaching for transfer"; -@@ -78,4 +78,4 @@ void JSArrayBuffer::Detach(JSThread *thread, bool transferWithNativeAreaAllocato +@@ -76,4 +76,4 @@ void JSArrayBuffer::Detach(JSThread *thread, bool transferWithNativeAreaAllocato SetArrayBufferData(thread, JSTaggedValue::Null()); SetArrayBufferByteLength(0); } @@ -143,7 +150,7 @@ index 178d0e14a..018bcd374 100644 \ No newline at end of file +} // namespace panda::ecmascript diff --git a/ecmascript/js_native_pointer.h b/ecmascript/js_native_pointer.h -index ce0981f6f..136d09ba3 100644 +index 8157917d4..be94c8c99 100644 --- a/ecmascript/js_native_pointer.h +++ b/ecmascript/js_native_pointer.h @@ -28,7 +28,7 @@ class JSNativePointer : public TaggedObject { @@ -156,49 +163,145 @@ index ce0981f6f..136d09ba3 100644 } diff --git a/ecmascript/js_thread.cpp b/ecmascript/js_thread.cpp -index 6c66de8f1..056bb1cf9 100644 +index d2ecab7c9..397dce0c9 100644 --- a/ecmascript/js_thread.cpp +++ b/ecmascript/js_thread.cpp -@@ -561,12 +561,14 @@ bool JSThread::CheckSafepoint() +@@ -794,12 +794,15 @@ bool JSThread::CheckSafepoint() } #endif // ECMASCRIPT_SUPPORT_CPUPROFILER bool gcTriggered = false; +/* #ifndef NDEBUG - if (vm_->GetJSOptions().EnableForceGC()) { +- if (vm_->GetJSOptions().EnableForceGC()) { ++ ++#endif ++*/ ++if (vm_->GetJSOptions().EnableForceGC()) { GetEcmaVM()->CollectGarbage(TriggerGCType::FULL_GC); gcTriggered = true; } - #endif -+*/ +-#endif auto heap = const_cast(GetEcmaVM()->GetHeap()); // Handle exit app senstive scene heap->HandleExitHighSensitiveEvent(); -diff --git a/ecmascript/mem/machine_code.cpp b/ecmascript/mem/machine_code.cpp -index 2b88f7449..a47415fc5 100644 ---- a/ecmascript/mem/machine_code.cpp -+++ b/ecmascript/mem/machine_code.cpp -@@ -18,6 +18,7 @@ - #include "ecmascript/compiler/aot_file/func_entry_des.h" - #include "ecmascript/stackmap/ark_stackmap.h" - #include "ecmascript/js_handle.h" -+#include "ecmascript/js_tagged_value-inl.h" +@@ -1318,7 +1321,7 @@ void JSThread::PostFork() + ASSERT(GetState() == ThreadState::NATIVE); + } + } +-#ifndef NDEBUG ++// #ifndef NDEBUG + bool JSThread::IsInManagedState() const + { + ASSERT(this == JSThread::GetCurrent()); +@@ -1334,5 +1337,5 @@ void JSThread::SetMutatorLockState(MutatorLock::MutatorLockState newState) + { + mutatorLockState_ = newState; + } +-#endif ++// #endif + } // namespace panda::ecmascript +diff --git a/ecmascript/js_thread.h b/ecmascript/js_thread.h +index c45a5f266..21a3d4566 100644 +--- a/ecmascript/js_thread.h ++++ b/ecmascript/js_thread.h +@@ -1356,11 +1356,9 @@ public: + static bool IsMainThread(); + PUBLIC_API void ManagedCodeBegin(); + PUBLIC_API void ManagedCodeEnd(); +-#ifndef NDEBUG + bool IsInManagedState() const; + MutatorLock::MutatorLockState GetMutatorLockState() const; + void SetMutatorLockState(MutatorLock::MutatorLockState newState); +-#endif + void SetWeakFinalizeTaskCallback(const WeakFinalizeTaskCallback &callback) + { + finalizeTaskCallback_ = callback; +@@ -1461,7 +1459,7 @@ public: + + + +-#ifndef NDEBUG ++ + inline void LaunchSuspendAll() + { + launchedSuspendAll_ = true; +@@ -1476,7 +1474,7 @@ public: + { + launchedSuspendAll_ = false; + } +-#endif ++ + + protected: + void SetThreadId() +@@ -1606,10 +1604,10 @@ private: + + uint64_t jobId_ {0}; + +-#ifndef NDEBUG ++ + MutatorLock::MutatorLockState mutatorLockState_ = MutatorLock::MutatorLockState::UNLOCKED; + std::atomic launchedSuspendAll_ {false}; +-#endif ++ + // Collect a map from JsError to MachineCode objects, JsError objects with stack frame generated by jit in the map. + // It will be used to keep MachineCode objects alive (for dump) before JsError object be free. + std::map jitCodeMaps_; +diff --git a/ecmascript/mutator_lock.cpp b/ecmascript/mutator_lock.cpp +index 6e6408cc0..ddf1f2f3a 100644 +--- a/ecmascript/mutator_lock.cpp ++++ b/ecmascript/mutator_lock.cpp +@@ -17,7 +17,7 @@ + #include "ecmascript/js_thread.h" namespace panda::ecmascript { - void MachineCode::SetData(const MachineCodeDesc *desc, JSHandle &method, size_t dataSize) +-#ifndef NDEBUG ++ + void MutatorLock::ReadLock() + { + ASSERT(!HasLock()); +@@ -73,7 +73,6 @@ void MutatorLock::SetState(MutatorLock::MutatorLockState newState) + { + JSThread::GetCurrent()->SetMutatorLockState(newState); + } +-#endif + + void SuspendBarrier::Wait() + { +diff --git a/ecmascript/mutator_lock.h b/ecmascript/mutator_lock.h +index 75b235715..dd9773b02 100644 +--- a/ecmascript/mutator_lock.h ++++ b/ecmascript/mutator_lock.h +@@ -21,7 +21,7 @@ + namespace panda::ecmascript { + + class MutatorLock : public RWLock { +-#ifndef NDEBUG ++ + public: + enum MutatorLockState { UNLOCKED, RDLOCK, WRLOCK }; + void ReadLock(); +@@ -34,7 +34,6 @@ public: + private: + MutatorLockState GetState() const; + void SetState(MutatorLockState newState); +-#endif + }; + + class SuspendBarrier { diff --git a/ecmascript/object_factory.cpp b/ecmascript/object_factory.cpp -index 9852bab3d..c88b243f1 100644 +index f93f64cbe..f3093d349 100644 --- a/ecmascript/object_factory.cpp +++ b/ecmascript/object_factory.cpp -@@ -3148,6 +3148,7 @@ JSHandle ObjectFactory::NewBigInt(uint32_t length) - // static +@@ -3314,6 +3314,7 @@ JSHandle ObjectFactory::NewBigInt(uint32_t length) void ObjectFactory::NewObjectHook() const { -+ /* + CHECK_NO_HEAP_ALLOC; ++/* #ifndef NDEBUG - if (vm_->GetJSOptions().EnableForceGC() && vm_->IsInitialized() && thread_->IsAllContextsInitialized()) { - if (vm_->GetJSOptions().ForceFullGC()) { -@@ -3160,6 +3161,7 @@ void ObjectFactory::NewObjectHook() const + if (vm_->GetJSOptions().EnableForceGC() && vm_->IsInitialized() && thread_->IsAllContextsInitialized() + && !heap_->InSensitiveStatus()) { +@@ -3327,6 +3328,7 @@ void ObjectFactory::NewObjectHook() const } } #endif @@ -206,3 +309,18 @@ index 9852bab3d..c88b243f1 100644 } JSHandle ObjectFactory::NewTaggedQueue(uint32_t length) +diff --git a/ecmascript/runtime_lock.cpp b/ecmascript/runtime_lock.cpp +index dbe4b5e16..949b0598a 100644 +--- a/ecmascript/runtime_lock.cpp ++++ b/ecmascript/runtime_lock.cpp +@@ -23,9 +23,8 @@ RuntimeLockHolder::RuntimeLockHolder(JSThread *thread, Mutex &mtx) + if (mtx_.TryLock()) { + return; + } +-#ifndef NDEBUG ++ + SharedHeap::GetInstance()->CollectGarbage(thread_); +-#endif + ThreadStateTransitionScope ts(thread_); + mtx.Lock(); + }