Modules/Objects/public/interpreter/ByteCode.hpp
2024-11-24 22:41:14 +03:00

34 lines
No EOL
634 B
C++

#pragma once
#include "OperatoinCodes.hpp"
#include "primitives/IntObject.hpp"
#include "primitives/StringObject.hpp"
#include "Buffer.hpp"
#include <string>
namespace tp::obj {
typedef Object* ConstData;
struct ByteCode {
Buffer<ConstData> mConstants;
Buffer<OpCode> mInstructions;
ualni mInstructionIdx = 0;
ualni mArgumentsLoaded = 0;
void updateRefCount() {
for (auto const_obj : mConstants) {
objects_api::setReferenceCount(const_obj.data(), 1);
}
}
~ByteCode() {
for (auto const_obj : mConstants) {
objects_api::destroy(const_obj.data());
}
}
};
}