From 871eec13aa12dc22303d291cd22abf942c559532 Mon Sep 17 00:00:00 2001 From: Ilya Trubachev Date: Thu, 1 Sep 2022 19:06:41 +0300 Subject: [PATCH 1/2] apply clang tidy to runtime/mem Signed-off-by: Ilya Trubachev --- runtime/mem/barriers.h | 6 +++--- runtime/mem/ecma_string.h | 6 +++--- runtime/mem/machine_code.h | 6 +++--- runtime/mem/mem_manager-inl.h | 10 +++++----- runtime/mem/mem_manager.cpp | 2 +- runtime/mem/mem_manager.h | 2 +- runtime/mem/object_xray-inl.h | 4 ++-- runtime/mem/object_xray.h | 6 +++--- runtime/mem/slots.h | 26 +++++++++++++------------- 9 files changed, 34 insertions(+), 34 deletions(-) diff --git a/runtime/mem/barriers.h b/runtime/mem/barriers.h index 746a2a3d9..8b35f3130 100644 --- a/runtime/mem/barriers.h +++ b/runtime/mem/barriers.h @@ -20,10 +20,10 @@ namespace panda::ecmascript { class Barriers { public: template - static inline bool AtomicSetDynPrimitive(volatile void *obj, size_t offset, T oldValue, T value) + static inline bool AtomicSetDynPrimitive(volatile void *obj, size_t offset, T old_value, T value) { - volatile auto atomicField = reinterpret_cast *>(ToUintPtr(obj) + offset); - return std::atomic_compare_exchange_strong_explicit(atomicField, &oldValue, value, std::memory_order_release, + volatile auto atomic_field = reinterpret_cast *>(ToUintPtr(obj) + offset); + return std::atomic_compare_exchange_strong_explicit(atomic_field, &old_value, value, std::memory_order_release, std::memory_order_relaxed); } diff --git a/runtime/mem/ecma_string.h b/runtime/mem/ecma_string.h index afe6dc475..770aa266f 100644 --- a/runtime/mem/ecma_string.h +++ b/runtime/mem/ecma_string.h @@ -40,10 +40,10 @@ std::enable_if_t, PandaString> ToPandaString(T number) if (number == 0) { return PandaString("0"); } - bool IsNeg = false; + bool is_neg = false; if (number < 0) { number = -number; - IsNeg = true; + is_neg = true; } static constexpr uint32_t BUFF_SIZE = std::numeric_limits::digits10 + 3; // 3: Reserved for sign bit and '\0'. @@ -56,7 +56,7 @@ std::enable_if_t, PandaString> ToPandaString(T number) // NOLINTNEXTLINE(readability-magic-numbers) number /= 10; // 10 : decimal } - if (IsNeg) { + if (is_neg) { buf[--position] = '-'; } return PandaString(&buf[position]); diff --git a/runtime/mem/machine_code.h b/runtime/mem/machine_code.h index 44a2a3fd9..f3351ee8a 100644 --- a/runtime/mem/machine_code.h +++ b/runtime/mem/machine_code.h @@ -43,14 +43,14 @@ public: return reinterpret_cast(this) + DATA_OFFSET; } - void SetData(const uint8_t *stackMapData, size_t codeLength) + void SetData(const uint8_t *stack_map_data, size_t code_length) { - if (stackMapData == nullptr) { + if (stack_map_data == nullptr) { LOG_ECMA_MEM(ERROR) << "data is null in creating new code object"; return; } if (memcpy_s(reinterpret_cast(this->GetDataOffsetAddress()), this->GetInstructionSizeInBytes().GetInt(), - stackMapData, codeLength) != EOK) { + stack_map_data, code_length) != EOK) { LOG_ECMA_MEM(ERROR) << "memcpy fail in creating new code object "; return; } diff --git a/runtime/mem/mem_manager-inl.h b/runtime/mem/mem_manager-inl.h index bb070a4c4..a80fcbc62 100644 --- a/runtime/mem/mem_manager-inl.h +++ b/runtime/mem/mem_manager-inl.h @@ -32,7 +32,7 @@ TaggedObject *MemManager::AllocateYoungGenerationOrHugeObject(JSHClass *hclass) TaggedObject *MemManager::AllocateYoungGenerationOrHugeObject(JSHClass *hclass, size_t size) { - auto object = heapManager_->AllocateObject(hclass->GetHClass(), size, DEFAULT_ALIGNMENT, thread_); + auto object = heap_manager_->AllocateObject(hclass->GetHClass(), size, DEFAULT_ALIGNMENT, thread_); // SUPPRESS_CSA_NEXTLINE(alpha.core.WasteObjHeader) return TaggedObject::Cast(object); } @@ -46,9 +46,9 @@ TaggedObject *MemManager::AllocateNonMovableOrHugeObject(JSHClass *hclass, size_ { ObjectHeader *object = nullptr; if (hclass == nullptr) { - object = heapManager_->AllocateNonMovableObject(nullptr, size, DEFAULT_ALIGNMENT, thread_); + object = heap_manager_->AllocateNonMovableObject(nullptr, size, DEFAULT_ALIGNMENT, thread_); } else { - object = heapManager_->AllocateNonMovableObject(hclass->GetHClass(), size, DEFAULT_ALIGNMENT, thread_); + object = heap_manager_->AllocateNonMovableObject(hclass->GetHClass(), size, DEFAULT_ALIGNMENT, thread_); } // SUPPRESS_CSA_NEXTLINE(alpha.core.WasteObjHeader) return TaggedObject::Cast(object); @@ -67,14 +67,14 @@ TaggedObject *MemManager::AllocateNonMovableOrHugeObject(JSHClass *hclass) TaggedObject *MemManager::AllocateOldGenerationOrHugeObject(JSHClass *hclass, size_t size) { - auto object = heapManager_->AllocateObject(hclass->GetHClass(), size, DEFAULT_ALIGNMENT, thread_); + auto object = heap_manager_->AllocateObject(hclass->GetHClass(), size, DEFAULT_ALIGNMENT, thread_); // SUPPRESS_CSA_NEXTLINE(alpha.core.WasteObjHeader) return TaggedObject::Cast(object); } TaggedObject *MemManager::AllocateHugeObject(JSHClass *hclass, size_t size) { - auto object = heapManager_->AllocateObject(hclass->GetHClass(), size, DEFAULT_ALIGNMENT, thread_); + auto object = heap_manager_->AllocateObject(hclass->GetHClass(), size, DEFAULT_ALIGNMENT, thread_); // SUPPRESS_CSA_NEXTLINE(alpha.core.WasteObjHeader) return TaggedObject::Cast(object); } diff --git a/runtime/mem/mem_manager.cpp b/runtime/mem/mem_manager.cpp index 538d70935..4776b01c0 100644 --- a/runtime/mem/mem_manager.cpp +++ b/runtime/mem/mem_manager.cpp @@ -18,7 +18,7 @@ namespace panda::ecmascript { MemManager::MemManager(EcmaVM *vm) { - heapManager_ = vm->GetHeapManager(); + heap_manager_ = vm->GetHeapManager(); thread_ = vm->GetAssociatedJSThread(); } } // namespace panda::ecmascript diff --git a/runtime/mem/mem_manager.h b/runtime/mem/mem_manager.h index 325fd1a60..e4264763f 100644 --- a/runtime/mem/mem_manager.h +++ b/runtime/mem/mem_manager.h @@ -38,7 +38,7 @@ public: inline void SetClass(TaggedObject *header, JSHClass *hclass); private: - mem::HeapManager *heapManager_; + mem::HeapManager *heap_manager_; ManagedThread *thread_; }; } // namespace panda::ecmascript diff --git a/runtime/mem/object_xray-inl.h b/runtime/mem/object_xray-inl.h index 004be244a..ba12971e9 100644 --- a/runtime/mem/object_xray-inl.h +++ b/runtime/mem/object_xray-inl.h @@ -66,8 +66,8 @@ namespace panda::ecmascript { void ObjectXRay::VisitVMRoots(const RootVisitor &visitor, const RootRangeVisitor &range_visitor) const { - ecmaVm_->Iterate(visitor); - ecmaVm_->GetJSThread()->Iterate(visitor, range_visitor); + ecma_vm_->Iterate(visitor); + ecma_vm_->GetJSThread()->Iterate(visitor, range_visitor); } template diff --git a/runtime/mem/object_xray.h b/runtime/mem/object_xray.h index 9fe7bc375..c980a38db 100644 --- a/runtime/mem/object_xray.h +++ b/runtime/mem/object_xray.h @@ -44,18 +44,18 @@ using WeakRootVisitor = std::function; class ObjectXRay { public: - explicit ObjectXRay(EcmaVM *ecmaVm) : ecmaVm_(ecmaVm) {} + explicit ObjectXRay(EcmaVM *ecma_vm) : ecma_vm_(ecma_vm) {} ~ObjectXRay() = default; inline void VisitVMRoots(const RootVisitor &visitor, const RootRangeVisitor &range_visitor) const; - template + template inline void VisitObjectBody(TaggedObject *object, JSHClass *klass, const EcmaObjectRangeVisitor &visitor); DEFAULT_MOVE_SEMANTIC(ObjectXRay); DEFAULT_COPY_SEMANTIC(ObjectXRay); private: - EcmaVM *ecmaVm_ {nullptr}; + EcmaVM *ecma_vm_ {nullptr}; }; } // namespace panda::ecmascript diff --git a/runtime/mem/slots.h b/runtime/mem/slots.h index a2d3c37ef..d22a0f0cb 100644 --- a/runtime/mem/slots.h +++ b/runtime/mem/slots.h @@ -22,7 +22,7 @@ namespace panda::ecmascript { class ObjectSlot { public: - explicit ObjectSlot(uintptr_t slotAddr) : slotAddress_(slotAddr) {} + explicit ObjectSlot(uintptr_t slot_addr) : slot_address_(slot_addr) {} ~ObjectSlot() = default; DEFAULT_COPY_SEMANTIC(ObjectSlot); @@ -36,7 +36,7 @@ public: void Update(JSTaggedType value) { // NOLINTNEXTLINE(clang-analyzer-core.NullDereference) - *reinterpret_cast(slotAddress_) = value; + *reinterpret_cast(slot_address_) = value; } TaggedObject *GetTaggedObjectHeader() const @@ -47,12 +47,12 @@ public: JSTaggedType GetTaggedType() const { // NOLINTNEXTLINE(clang-analyzer-core.NullDereference) - return *reinterpret_cast(slotAddress_); + return *reinterpret_cast(slot_address_); } ObjectSlot &operator++() { - slotAddress_ += sizeof(JSTaggedType); + slot_address_ += sizeof(JSTaggedType); return *this; } @@ -60,42 +60,42 @@ public: ObjectSlot operator++(int) { ObjectSlot ret = *this; - slotAddress_ += sizeof(JSTaggedType); + slot_address_ += sizeof(JSTaggedType); return ret; } uintptr_t SlotAddress() const { - return slotAddress_; + return slot_address_; } bool operator<(const ObjectSlot &other) const { - return slotAddress_ < other.slotAddress_; + return slot_address_ < other.slot_address_; } bool operator<=(const ObjectSlot &other) const { - return slotAddress_ <= other.slotAddress_; + return slot_address_ <= other.slot_address_; } bool operator>(const ObjectSlot &other) const { - return slotAddress_ > other.slotAddress_; + return slot_address_ > other.slot_address_; } bool operator>=(const ObjectSlot &other) const { - return slotAddress_ >= other.slotAddress_; + return slot_address_ >= other.slot_address_; } bool operator==(const ObjectSlot &other) const { - return slotAddress_ == other.slotAddress_; + return slot_address_ == other.slot_address_; } bool operator!=(const ObjectSlot &other) const { - return slotAddress_ != other.slotAddress_; + return slot_address_ != other.slot_address_; } private: - uintptr_t slotAddress_; + uintptr_t slot_address_; }; } // namespace panda::ecmascript -- Gitee From d9c65d8fd197d90412c38ffd9f495d418cc8142f Mon Sep 17 00:00:00 2001 From: Ilya Trubachev Date: Tue, 6 Sep 2022 17:25:34 +0300 Subject: [PATCH 2/2] remove MachineCode class Signed-off-by: Ilya Trubachev --- runtime/dump.cpp | 21 --------- runtime/global_env_constants.cpp | 2 - runtime/global_env_constants.h | 1 - runtime/js_hclass-inl.h | 29 ------------ runtime/js_hclass.h | 7 --- runtime/js_tagged_value-inl.h | 5 -- runtime/js_tagged_value.h | 1 - runtime/js_thread.cpp | 1 - runtime/mem/machine_code.h | 79 -------------------------------- runtime/mem/object_xray-inl.h | 4 -- runtime/object_factory.cpp | 1 - runtime/object_factory.h | 3 -- 12 files changed, 154 deletions(-) delete mode 100644 runtime/mem/machine_code.h diff --git a/runtime/dump.cpp b/runtime/dump.cpp index 6c79386fa..5fe42692f 100644 --- a/runtime/dump.cpp +++ b/runtime/dump.cpp @@ -258,8 +258,6 @@ PandaString JSHClass::DumpJSType(JSType type) return "LexicalFunction"; case JSType::FUNCTION_EXTRA_INFO: return "FunctionExtraInfo"; - case JSType::MACHINE_CODE_OBJECT: - return "MachineCode"; case JSType::ECMA_MODULE: return "EcmaModule"; case JSType::CLASS_INFO_EXTRACTOR: @@ -611,9 +609,6 @@ static void DumpObject(JSThread *thread, TaggedObject *obj, std::ostream &os) case JSType::FUNCTION_EXTRA_INFO: JSFunctionExtraInfo::Cast(obj)->Dump(thread, os); break; - case JSType::MACHINE_CODE_OBJECT: - MachineCode::Cast(obj)->Dump(thread, os); - break; case JSType::ECMA_MODULE: EcmaModule::Cast(obj)->Dump(thread, os); break; @@ -1951,13 +1946,6 @@ void JSFunctionExtraInfo::Dump([[maybe_unused]] JSThread *thread, std::ostream & os << "\n"; } -void MachineCode::Dump([[maybe_unused]] JSThread *thread, std::ostream &os) const -{ - os << " - InstructionSizeInBytes: "; - GetInstructionSizeInBytes().D(); - os << "\n"; -} - void EcmaModule::Dump([[maybe_unused]] JSThread *thread, std::ostream &os) const { os << " - NameDictionary: "; @@ -2245,9 +2233,6 @@ static void DumpObject(JSThread *thread, TaggedObject *obj, std::vectorDumpForSnapshot(thread, vec); return; - case JSType::MACHINE_CODE_OBJECT: - MachineCode::Cast(obj)->DumpForSnapshot(thread, vec); - return; case JSType::TRANSITION_HANDLER: TransitionHandler::Cast(obj)->DumpForSnapshot(thread, vec); return; @@ -3099,12 +3084,6 @@ void JSFunctionExtraInfo::DumpForSnapshot([[maybe_unused]] JSThread *thread, vec.emplace_back(std::make_pair(PandaString("Data"), GetData())); } -void MachineCode::DumpForSnapshot([[maybe_unused]] JSThread *thread, - std::vector> &vec) const -{ - vec.emplace_back(std::make_pair(PandaString("InstructionSizeInBytes"), GetInstructionSizeInBytes())); -} - void EcmaModule::DumpForSnapshot([[maybe_unused]] JSThread *thread, std::vector> &vec) const { diff --git a/runtime/global_env_constants.cpp b/runtime/global_env_constants.cpp index 496267fec..8ecb034f4 100644 --- a/runtime/global_env_constants.cpp +++ b/runtime/global_env_constants.cpp @@ -169,8 +169,6 @@ void GlobalEnvConstants::InitRootsClass([[maybe_unused]] JSThread *thread, JSHCl SetConstant(ConstantIndex::JS_REALM_CLASS_INDEX, factory->NewEcmaDynClass(dynClassClass, JSRealm::SIZE, JSType::JS_REALM).GetTaggedValue()); - SetConstant(ConstantIndex::MACHINE_CODE_CLASS_INDEX, - factory->NewEcmaDynClass(dynClassClass, 0, JSType::MACHINE_CODE_OBJECT).GetTaggedValue()); JSHClass *classInfoExtractorClass = *factory->NewEcmaDynClass(dynClassClass, ClassInfoExtractor::SIZE, JSType::CLASS_INFO_EXTRACTOR); diff --git a/runtime/global_env_constants.h b/runtime/global_env_constants.h index f8eb51e53..d0d7e705c 100644 --- a/runtime/global_env_constants.h +++ b/runtime/global_env_constants.h @@ -73,7 +73,6 @@ class JSThread; V(JSTaggedValue, LinkedHashMapClass, LINKED_HASH_MAP_CLASS_INDEX, ecma_roots_class) \ V(JSTaggedValue, WeakLinkedHashMapClass, WEAK_LINKED_HASH_MAP_CLASS_INDEX, ecma_roots_class) \ V(JSTaggedValue, JSRegExpClass, JS_REGEXP_CLASS_INDEX, ecma_roots_class) \ - V(JSTaggedValue, MachineCodeClass, MACHINE_CODE_CLASS_INDEX, ecma_roots_class) \ V(JSTaggedValue, ClassInfoExtractorHClass, CLASS_INFO_EXTRACTOR_HCLASS_INDEX, ecma_roots_class) \ V(JSTaggedValue, FinalizationRegistryClass, FINALIZATION_REGISTRY_CLASS_INDEX, ecma_root_class) diff --git a/runtime/js_hclass-inl.h b/runtime/js_hclass-inl.h index c7b011b0d..e72c04820 100644 --- a/runtime/js_hclass-inl.h +++ b/runtime/js_hclass-inl.h @@ -148,35 +148,6 @@ inline bool JSHClass::HasReferenceField() auto type = GetObjectType(); return type != JSType::STRING && type != JSType::JS_NATIVE_POINTER; } - -inline size_t JSHClass::SizeFromJSHClass(TaggedObject *header) -{ - auto type = GetObjectType(); - size_t size = 0; - switch (type) { - case JSType::TAGGED_ARRAY: - case JSType::TAGGED_DICTIONARY: - case JSType::LINKED_HASH_SET: - case JSType::LINKED_HASH_MAP: - size = TaggedArray::ComputeSize(JSTaggedValue::TaggedTypeSize(), - reinterpret_cast(header)->GetLength()); - break; - case JSType::STRING: - size = reinterpret_cast(header)->ObjectSize(); - size = AlignUp(size, static_cast(MemAlignment::MEM_ALIGN_OBJECT)); - break; - case JSType::MACHINE_CODE_OBJECT: - size = reinterpret_cast(header)->GetMachineCodeObjectSize(); - size = AlignUp(size, static_cast(MemAlignment::MEM_ALIGN_OBJECT)); - break; - default: - ASSERT(GetObjectSize() != 0); - size = GetObjectSize(); - break; - } - ASSERT(AlignUp(size, static_cast(MemAlignment::MEM_ALIGN_OBJECT)) == size); - return size; -} } // namespace panda::ecmascript #endif // ECMASCRIPT_JS_HCLASS_INL_H diff --git a/runtime/js_hclass.h b/runtime/js_hclass.h index 7b28c15bc..bead4887c 100644 --- a/runtime/js_hclass.h +++ b/runtime/js_hclass.h @@ -172,7 +172,6 @@ class ProtoChangeDetails; PENDING_JOB, /* /////////////////////////////////////////////////////////////////////////////-PADDING */ \ FUNCTION_EXTRA_INFO, /* ////////////////////////////////////////////////////////////////////////-PADDING */ \ COMPLETION_RECORD, /* JS_RECORD_END /////////////////////////////////////////////////////////////////////// */ \ - MACHINE_CODE_OBJECT, /* ///////////////////////////////////////////////////////////////////////////-PADDING */ \ ECMA_MODULE, /* /////////////////////////////////////////////////////////////////////////////////-PADDING */ \ CLASS_INFO_EXTRACTOR, /* //////////////////////////////////////////////////////////////////////////-PADDING */ \ JS_TYPE_LAST = CLASS_INFO_EXTRACTOR, /* ///////////////////////////////////////////////////////////-PADDING */ \ @@ -239,7 +238,6 @@ public: static JSHClass *Cast(const TaggedObject *object); - inline size_t SizeFromJSHClass(TaggedObject *header); inline bool HasReferenceField(); // size need to add inlined property numbers @@ -917,11 +915,6 @@ public: return GetObjectType() == JSType::FREE_OBJECT_WITH_TWO_FIELD; } - inline bool IsMachineCodeObject() const - { - return GetObjectType() == JSType::MACHINE_CODE_OBJECT; - } - inline void SetElementRepresentation(Representation representation) { uint32_t bits = GetBitField(); diff --git a/runtime/js_tagged_value-inl.h b/runtime/js_tagged_value-inl.h index e84459350..67d1db572 100644 --- a/runtime/js_tagged_value-inl.h +++ b/runtime/js_tagged_value-inl.h @@ -884,11 +884,6 @@ inline bool JSTaggedValue::IsJSGlobalObject() const return IsHeapObject() && GetTaggedObject()->GetClass()->IsJSGlobalObject(); } -inline bool JSTaggedValue::IsMachineCodeObject() const -{ - return IsHeapObject() && GetTaggedObject()->GetClass()->IsMachineCodeObject(); -} - inline bool JSTaggedValue::IsClassInfoExtractor() const { return IsHeapObject() && GetTaggedObject()->GetClass()->IsClassInfoExtractor(); diff --git a/runtime/js_tagged_value.h b/runtime/js_tagged_value.h index ebf9662c0..65334f5bd 100644 --- a/runtime/js_tagged_value.h +++ b/runtime/js_tagged_value.h @@ -320,7 +320,6 @@ public: bool IsPropertyBox() const; bool IsProtoChangeMarker() const; bool IsProtoChangeDetails() const; - bool IsMachineCodeObject() const; bool IsClassInfoExtractor() const; bool IsJSFinalizationRegistry() const; static bool IsSameTypeOrHClass(JSTaggedValue x, JSTaggedValue y); diff --git a/runtime/js_thread.cpp b/runtime/js_thread.cpp index 6c6d126c1..ef273661a 100644 --- a/runtime/js_thread.cpp +++ b/runtime/js_thread.cpp @@ -19,7 +19,6 @@ #include "plugins/ecmascript/runtime/ic/properties_cache-inl.h" #include "plugins/ecmascript/runtime/internal_call_params.h" #include "plugins/ecmascript/runtime/interpreter/interpreter-inl.h" -#include "plugins/ecmascript/runtime/mem/machine_code.h" #include "runtime/include/panda_vm.h" #include "runtime/include/stack_walker-inl.h" diff --git a/runtime/mem/machine_code.h b/runtime/mem/machine_code.h deleted file mode 100644 index f3351ee8a..000000000 --- a/runtime/mem/machine_code.h +++ /dev/null @@ -1,79 +0,0 @@ -/* - * Copyright (c) 2021-2022 Huawei Device Co., Ltd. - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#ifndef PANDA_RUNTIME_ECMASCRIPT_MEM_MACHINE_CODE_H -#define PANDA_RUNTIME_ECMASCRIPT_MEM_MACHINE_CODE_H - -#include "plugins/ecmascript/runtime/ecma_macros.h" -#include "plugins/ecmascript/runtime/js_tagged_value.h" -#include "plugins/ecmascript/runtime/mem/tagged_object.h" - -namespace panda::ecmascript { -class MachineCode : public TaggedObject { -public: - static MachineCode *Cast(ObjectHeader *object) - { - ASSERT(JSTaggedValue(object).IsMachineCodeObject()); - return static_cast(object); - } - - MachineCode() = default; - ~MachineCode() = default; - - static constexpr size_t INS_SIZE_OFFSET = TaggedObjectSize(); - ACCESSORS(InstructionSizeInBytes, INS_SIZE_OFFSET, DATA_OFFSET); - static constexpr size_t SIZE = DATA_OFFSET; - - DECL_DUMP() - - uintptr_t GetDataOffsetAddress() - { - return reinterpret_cast(this) + DATA_OFFSET; - } - - void SetData(const uint8_t *stack_map_data, size_t code_length) - { - if (stack_map_data == nullptr) { - LOG_ECMA_MEM(ERROR) << "data is null in creating new code object"; - return; - } - if (memcpy_s(reinterpret_cast(this->GetDataOffsetAddress()), this->GetInstructionSizeInBytes().GetInt(), - stack_map_data, code_length) != EOK) { - LOG_ECMA_MEM(ERROR) << "memcpy fail in creating new code object "; - return; - } - } - - void VisitRangeSlot([[maybe_unused]] const EcmaObjectRangeVisitor &v) - { - // left blank deliberately,only need to visit TaggedObject type object. - } - - void VisitObjects([[maybe_unused]] const EcmaObjectRangeVisitor &visitor) const - { - // left blank deliberately,only need to visit TaggedObject type object. - } - - size_t GetMachineCodeObjectSize() - { - return SIZE + this->GetInstructionSizeInBytes().GetInt(); - } - - NO_COPY_SEMANTIC(MachineCode); - NO_MOVE_SEMANTIC(MachineCode); -}; -} // namespace panda::ecmascript - -#endif // PANDA_RUNTIME_ECMASCRIPT_MEM_MACHINE_CODE_H diff --git a/runtime/mem/object_xray-inl.h b/runtime/mem/object_xray-inl.h index ba12971e9..1e2544a87 100644 --- a/runtime/mem/object_xray-inl.h +++ b/runtime/mem/object_xray-inl.h @@ -60,7 +60,6 @@ #include "plugins/ecmascript/runtime/js_typed_array.h" #include "plugins/ecmascript/runtime/js_weak_container.h" #include "plugins/ecmascript/runtime/mem/object_xray.h" -#include "plugins/ecmascript/runtime/mem/machine_code.h" #include "plugins/ecmascript/runtime/mem/mem.h" namespace panda::ecmascript { @@ -314,9 +313,6 @@ void ObjectXRay::VisitObjectBody(TaggedObject *object, JSHClass *klass, const Ec case JSType::JS_PLURAL_RULES: JSPluralRules::Cast(object)->VisitRangeSlot(visitor); break; - case JSType::MACHINE_CODE_OBJECT: - MachineCode::Cast(object)->VisitRangeSlot(visitor); - break; case JSType::CLASS_INFO_EXTRACTOR: ClassInfoExtractor::Cast(object)->VisitRangeSlot(visitor); break; diff --git a/runtime/object_factory.cpp b/runtime/object_factory.cpp index d90d851ea..9b64ef0a2 100644 --- a/runtime/object_factory.cpp +++ b/runtime/object_factory.cpp @@ -164,7 +164,6 @@ void ObjectFactory::ObtainRootClass([[maybe_unused]] const JSHandle & prototypeHandlerClass_ = JSHClass::Cast(globalConst->GetPrototypeHandlerClass().GetTaggedObject()); functionExtraInfo_ = JSHClass::Cast(globalConst->GetFunctionExtraInfoClass().GetTaggedObject()); jsRealmClass_ = JSHClass::Cast(globalConst->GetJSRealmClass().GetTaggedObject()); - machineCodeClass_ = JSHClass::Cast(globalConst->GetMachineCodeClass().GetTaggedObject()); classInfoExtractorHClass_ = JSHClass::Cast(globalConst->GetClassInfoExtractorHClass().GetTaggedObject()); linkedHashMapClass_ = JSHClass::Cast(globalConst->GetLinkedHashMapClass().GetTaggedObject()); diff --git a/runtime/object_factory.h b/runtime/object_factory.h index 01f1dfd16..b4bb35605 100644 --- a/runtime/object_factory.h +++ b/runtime/object_factory.h @@ -24,7 +24,6 @@ #include "plugins/ecmascript/runtime/js_hclass.h" #include "plugins/ecmascript/runtime/js_native_pointer.h" #include "plugins/ecmascript/runtime/js_tagged_value.h" -#include "plugins/ecmascript/runtime/mem/machine_code.h" #include "plugins/ecmascript/runtime/mem/mem_manager.h" #include "plugins/ecmascript/runtime/object_wrapper.h" #include "plugins/ecmascript/runtime/tagged_array.h" @@ -100,7 +99,6 @@ class PropertyBox; class ProtoChangeMarker; class ProtoChangeDetails; class ProfileTypeInfo; -class MachineCode; class ClassInfoExtractor; enum class PrimitiveType : uint8_t; @@ -443,7 +441,6 @@ private: JSHClass *functionExtraInfo_ {nullptr}; JSHClass *jsRealmClass_ {nullptr}; JSHClass *programClass_ {nullptr}; - JSHClass *machineCodeClass_ {nullptr}; JSHClass *ecmaModuleClass_ {nullptr}; JSHClass *classInfoExtractorHClass_ {nullptr}; JSHClass *linkedHashMapClass_ {nullptr}; -- Gitee