#ifndef MRT_MOBJECT_H
#define MRT_MOBJECT_H
#include "Common/BaseObject.h"
namespace MapleRuntime {
class ATTR_PACKED(4) MObject : public BaseObject {
public:
static MObject* NewFinalizer(const TypeInfo* ti, MSize size);
static MObject* NewObject(TypeInfo* ti, MSize objectSize, AllocType);
static MObject* NewPinnedObject(TypeInfo* ti, MSize objectSize);
inline bool IsSubType(TypeInfo& ti);
inline bool IsArray() const;
inline bool IsPrimitiveArray() const;
inline bool IsStructArray() const;
template<typename T>
inline T Load(size_t offset) const;
template<typename T>
inline void Store(size_t offset, T value);
inline MObject* LoadRef(size_t offset);
inline void StoreRef(size_t offset, MObject* value);
template<typename T0, typename T1>
static inline T0* Cast(T1 o);
template<typename T0, typename T1>
static inline T0* CastNonNull(T1 o);
private:
MObject() = delete;
~MObject() = delete;
MObject(MObject&&) = delete;
MObject& operator=(MObject&&) = delete;
};
}
#endif