Objects Initial

This commit is contained in:
IlushaShurupov 2023-07-24 21:55:19 +03:00 committed by Ilya Shurupov
parent 0f639ba3b1
commit 94057d2a66
76 changed files with 7895 additions and 17 deletions

View file

@ -0,0 +1,39 @@
#pragma once
#include "bytecode.h"
#include "core/object.h"
namespace obj {
// can be other aligned value as well
typedef obj::Object* Operand;
class OperandStack {
enum : tp::alni {
MAX_STACK_SIZE = 512
};
public:
Operand* mBuff;
tp::ualni mIdx;
OperandStack();
void push(Operand operand);
void pop();
Operand getOperand();
template <typename ObjectType>
ObjectType* getOperand() {
auto operand = getOperand();
auto ret = NDO_CAST(ObjectType, operand);
ASSERT(ret && "Operand Has Invalid Object Type");
return ret;
}
~OperandStack();
};
};