[DEV] continue integration

This commit is contained in:
Edouard DUPIN 2018-06-29 21:20:02 +02:00
parent aa49dbd05d
commit ff85991e11
27 changed files with 165 additions and 145 deletions

View File

@ -66,12 +66,8 @@ def configure(target, my_module):
'rabbit/WeakRef.cpp', 'rabbit/WeakRef.cpp',
'rabbit/sqapi.cpp', 'rabbit/sqapi.cpp',
'rabbit/sqbaselib.cpp', 'rabbit/sqbaselib.cpp',
'rabbit/sqcompiler.cpp',
'rabbit/sqdebug.cpp', 'rabbit/sqdebug.cpp',
'rabbit/sqfuncstate.cpp',
'rabbit/sqlexer.cpp',
'rabbit/sqmem.cpp', 'rabbit/sqmem.cpp',
'rabbit/sqobject.cpp',
]) ])
my_module.compile_version("c++", 2011) my_module.compile_version("c++", 2011)
my_module.add_depend([ my_module.add_depend([
@ -120,15 +116,8 @@ def configure(target, my_module):
'rabbit/VirtualMachine.hpp', 'rabbit/VirtualMachine.hpp',
'rabbit/WeakRef.hpp', 'rabbit/WeakRef.hpp',
'rabbit/rabbit.hpp', 'rabbit/rabbit.hpp',
'rabbit/sqclosure.hpp',
'rabbit/sqcompiler.hpp',
'rabbit/sqconfig.hpp', 'rabbit/sqconfig.hpp',
'rabbit/sqfuncproto.hpp',
'rabbit/sqfuncstate.hpp',
'rabbit/sqlexer.hpp',
'rabbit/sqobject.hpp',
'rabbit/sqopcodes.hpp', 'rabbit/sqopcodes.hpp',
'rabbit/sqpcheader.hpp',
'rabbit/squtils.hpp', 'rabbit/squtils.hpp',
]) ])

View File

@ -7,7 +7,11 @@
*/ */
#pragma once #pragma once
#include <rabbit/RefCounted.hpp>
#include <rabbit/ObjectPtr.hpp>
namespace rabbit { namespace rabbit {
class SharedState;
class Array : public rabbit::RefCounted class Array : public rabbit::RefCounted
{ {
private: private:

View File

@ -8,7 +8,7 @@
#pragma once #pragma once
#include <etk/types.hpp> #include <etk/types.hpp>
#include <rabbit/sqpcheader.hpp>
#include <rabbit/VirtualMachine.hpp> #include <rabbit/VirtualMachine.hpp>
#include <rabbit/sqfuncproto.hpp> #include <rabbit/sqfuncproto.hpp>

View File

@ -127,9 +127,56 @@ bool rabbit::Closure::load(rabbit::VirtualMachine *v,rabbit::UserPointer up,SQRE
return true; return true;
} }
rabbit::Closure::~Closure() rabbit::Closure::~Closure() {
{
__Objrelease(_root); __Objrelease(_root);
__Objrelease(_env); __Objrelease(_env);
__Objrelease(_base); __Objrelease(_base);
} }
rabbit::Closure::Closure(rabbit::SharedState *ss,rabbit::FunctionProto *func){
_function = func;
__ObjaddRef(_function); _base = NULL;
_env = NULL;
_root=NULL;
}
rabbit::Closure *rabbit::Closure::create(rabbit::SharedState *ss,rabbit::FunctionProto *func,rabbit::WeakRef *root){
int64_t size = _CALC_CLOSURE_SIZE(func);
rabbit::Closure *nc=(rabbit::Closure*)SQ_MALLOC(size);
new (nc) rabbit::Closure(ss,func);
nc->_outervalues = (rabbit::ObjectPtr *)(nc + 1);
nc->_defaultparams = &nc->_outervalues[func->_noutervalues];
nc->_root = root;
__ObjaddRef(nc->_root);
_CONSTRUCT_VECTOR(rabbit::ObjectPtr,func->_noutervalues,nc->_outervalues);
_CONSTRUCT_VECTOR(rabbit::ObjectPtr,func->_ndefaultparams,nc->_defaultparams);
return nc;
}
void rabbit::Closure::release(){
rabbit::FunctionProto *f = _function;
int64_t size = _CALC_CLOSURE_SIZE(f);
_DESTRUCT_VECTOR(ObjectPtr,f->_noutervalues,_outervalues);
_DESTRUCT_VECTOR(ObjectPtr,f->_ndefaultparams,_defaultparams);
__Objrelease(_function);
this->~Closure();
sq_vm_free(this,size);
}
void rabbit::Closure::setRoot(rabbit::WeakRef *r) {
__Objrelease(_root);
_root = r;
__ObjaddRef(_root);
}
Closure* rabbit::Closure::clone() {
rabbit::FunctionProto *f = _function;
rabbit::Closure * ret = rabbit::Closure::create(NULL,f,_root);
ret->_env = _env;
if(ret->_env) {
__ObjaddRef(ret->_env);
}
_COPY_VECTOR(ret->_outervalues,_outervalues,f->_noutervalues);
_COPY_VECTOR(ret->_defaultparams,_defaultparams,f->_ndefaultparams);
return ret;
}

View File

@ -7,57 +7,30 @@
*/ */
#pragma once #pragma once
#include <rabbit/RefCounted.hpp>
#include <rabbit/sqconfig.hpp>
#include <rabbit/rabbit.hpp>
namespace rabbit { namespace rabbit {
class SharedState;
class FunctionProto;
class VirtualMachine;
class WeakRef;
class ObjectPtr;
class Class;
#define _CALC_CLOSURE_SIZE(func) (sizeof(rabbit::Closure) + (func->_noutervalues*sizeof(rabbit::ObjectPtr)) + (func->_ndefaultparams*sizeof(rabbit::ObjectPtr))) #define _CALC_CLOSURE_SIZE(func) (sizeof(rabbit::Closure) + (func->_noutervalues*sizeof(rabbit::ObjectPtr)) + (func->_ndefaultparams*sizeof(rabbit::ObjectPtr)))
class Closure : public rabbit::RefCounted { class Closure : public rabbit::RefCounted {
private: private:
Closure(rabbit::SharedState *ss,rabbit::FunctionProto *func){ Closure(rabbit::SharedState *ss,rabbit::FunctionProto *func);
_function = func;
__ObjaddRef(_function); _base = NULL;
_env = NULL;
_root=NULL;
}
public: public:
static rabbit::Closure *create(rabbit::SharedState *ss,rabbit::FunctionProto *func,rabbit::WeakRef *root){ static Closure *create(rabbit::SharedState *ss,rabbit::FunctionProto *func,rabbit::WeakRef *root);
int64_t size = _CALC_CLOSURE_SIZE(func); void release();
rabbit::Closure *nc=(rabbit::Closure*)SQ_MALLOC(size); void setRoot(rabbit::WeakRef *r);
new (nc) rabbit::Closure(ss,func); Closure *clone();
nc->_outervalues = (rabbit::ObjectPtr *)(nc + 1); ~Closure();
nc->_defaultparams = &nc->_outervalues[func->_noutervalues];
nc->_root = root;
__ObjaddRef(nc->_root);
_CONSTRUCT_VECTOR(rabbit::ObjectPtr,func->_noutervalues,nc->_outervalues);
_CONSTRUCT_VECTOR(rabbit::ObjectPtr,func->_ndefaultparams,nc->_defaultparams);
return nc;
}
void release(){
rabbit::FunctionProto *f = _function;
int64_t size = _CALC_CLOSURE_SIZE(f);
_DESTRUCT_VECTOR(ObjectPtr,f->_noutervalues,_outervalues);
_DESTRUCT_VECTOR(ObjectPtr,f->_ndefaultparams,_defaultparams);
__Objrelease(_function);
this->~rabbit::Closure();
sq_vm_free(this,size);
}
void setRoot(rabbit::WeakRef *r)
{
__Objrelease(_root);
_root = r;
__ObjaddRef(_root);
}
rabbit::Closure *clone()
{
rabbit::FunctionProto *f = _function;
rabbit::Closure * ret = rabbit::Closure::create(NULL,f,_root);
ret->_env = _env;
if(ret->_env) __ObjaddRef(ret->_env);
_COPY_VECTOR(ret->_outervalues,_outervalues,f->_noutervalues);
_COPY_VECTOR(ret->_defaultparams,_defaultparams,f->_ndefaultparams);
return ret;
}
~rabbit::Closure();
bool save(rabbit::VirtualMachine *v,rabbit::UserPointer up,SQWRITEFUNC write); bool save(rabbit::VirtualMachine *v,rabbit::UserPointer up,SQWRITEFUNC write);
static bool load(rabbit::VirtualMachine *v,rabbit::UserPointer up,SQREADFUNC read,rabbit::ObjectPtr &ret); static bool load(rabbit::VirtualMachine *v,rabbit::UserPointer up,SQREADFUNC read,rabbit::ObjectPtr &ret);

View File

@ -7,7 +7,7 @@
*/ */
#include <rabbit/Compiler.hpp> #include <rabbit/Compiler.hpp>
#include <rabbit/sqpcheader.hpp>
#ifndef NO_COMPILER #ifndef NO_COMPILER
#include <stdarg.h> #include <stdarg.h>
#include <setjmp.h> #include <setjmp.h>
@ -1162,7 +1162,7 @@ public:
_fs->snoozeOpt(); _fs->snoozeOpt();
int64_t expend = _fs->getCurrentPos(); int64_t expend = _fs->getCurrentPos();
int64_t expsize = (expend - expstart) + 1; int64_t expsize = (expend - expstart) + 1;
rabbit::InstructionVec exp; etk::Vector<rabbit::Instruction> exp;
if(expsize > 0) { if(expsize > 0) {
for(int64_t i = 0; i < expsize; i++) for(int64_t i = 0; i < expsize; i++)
exp.pushBack(_fs->getInstruction(expstart + i)); exp.pushBack(_fs->getInstruction(expstart + i));

View File

@ -7,3 +7,19 @@
*/ */
#include <rabbit/ExceptionTrap.hpp> #include <rabbit/ExceptionTrap.hpp>
#include <rabbit/Instruction.hpp>
rabbit::ExceptionTrap::ExceptionTrap(int64_t ss,
int64_t stackbase,
rabbit::Instruction *ip,
int64_t ex_target) {
_stacksize = ss;
_stackbase = stackbase;
_ip = ip;
_extarget = ex_target;
}
rabbit::ExceptionTrap::ExceptionTrap(const rabbit::ExceptionTrap &et) {
(*this) = et;
}

View File

@ -10,29 +10,20 @@
#include <etk/types.hpp> #include <etk/types.hpp>
#include <rabbit/sqconfig.hpp> #include <rabbit/sqconfig.hpp>
struct rabbit::Instruction;
namespace rabbit { namespace rabbit {
class Instruction;
class ExceptionTrap { class ExceptionTrap {
public: public:
ExceptionTrap() { ExceptionTrap() = default;
}
ExceptionTrap(int64_t ss, ExceptionTrap(int64_t ss,
int64_t stackbase, int64_t stackbase,
rabbit::Instruction *ip, rabbit::Instruction *ip,
int64_t ex_target) { int64_t ex_target);
_stacksize = ss; ExceptionTrap(const rabbit::ExceptionTrap &et);
_stackbase = stackbase;
_ip = ip;
_extarget = ex_target;
}
ExceptionTrap(const rabbit::ExceptionTrap &et) {
(*this) = et;
}
int64_t _stackbase; int64_t _stackbase = 0;
int64_t _stacksize; int64_t _stacksize = 0;
rabbit::Instruction *_ip; rabbit::Instruction *_ip = nullptr;
int64_t _extarget; int64_t _extarget = 0;
}; };
} }

View File

@ -647,7 +647,7 @@ void FuncState::popChildState()
_childstates.popBack(); _childstates.popBack();
} }
FuncState::~rabbit::FuncState() FuncState::~FuncState()
{ {
while(_childstates.size() > 0) while(_childstates.size() > 0)
{ {

View File

@ -64,7 +64,7 @@ namespace rabbit {
etk::Vector<rabbit::ObjectPtr> _functions; etk::Vector<rabbit::ObjectPtr> _functions;
etk::Vector<rabbit::ObjectPtr> _parameters; etk::Vector<rabbit::ObjectPtr> _parameters;
etk::Vector<rabbit::OuterVar> _outervalues; etk::Vector<rabbit::OuterVar> _outervalues;
rabbit::InstructionVec _instructions; etk::Vector<rabbit::Instruction> _instructions;
etk::Vector<rabbit::LocalVarInfo> _localvarinfos; etk::Vector<rabbit::LocalVarInfo> _localvarinfos;
rabbit::ObjectPtr _literals; rabbit::ObjectPtr _literals;
rabbit::ObjectPtr _strings; rabbit::ObjectPtr _strings;

View File

@ -22,7 +22,7 @@ namespace rabbit {
~FunctionProto(); ~FunctionProto();
public: public:
static rabbit::FunctionProto *create(rabbit::SharedState *ss,int64_t ninstructions, FunctionProto *create(rabbit::SharedState *ss,int64_t ninstructions,
int64_t nliterals,int64_t nparameters, int64_t nliterals,int64_t nparameters,
int64_t nfunctions,int64_t noutervalues, int64_t nfunctions,int64_t noutervalues,
int64_t nlineinfos,int64_t nlocalvarinfos,int64_t ndefaultparams) int64_t nlineinfos,int64_t nlocalvarinfos,int64_t ndefaultparams)
@ -30,7 +30,7 @@ namespace rabbit {
rabbit::FunctionProto *f; rabbit::FunctionProto *f;
//I compact the whole class and members in a single memory allocation //I compact the whole class and members in a single memory allocation
f = (rabbit::FunctionProto *)sq_vm_malloc(_FUNC_SIZE(ninstructions,nliterals,nparameters,nfunctions,noutervalues,nlineinfos,nlocalvarinfos,ndefaultparams)); f = (rabbit::FunctionProto *)sq_vm_malloc(_FUNC_SIZE(ninstructions,nliterals,nparameters,nfunctions,noutervalues,nlineinfos,nlocalvarinfos,ndefaultparams));
new (f) rabbit::FunctionProto(ss); new ((char*)f) rabbit::FunctionProto(ss);
f->_ninstructions = ninstructions; f->_ninstructions = ninstructions;
f->_literals = (rabbit::ObjectPtr*)&f->_instructions[ninstructions]; f->_literals = (rabbit::ObjectPtr*)&f->_instructions[ninstructions];
f->_nliterals = nliterals; f->_nliterals = nliterals;
@ -63,7 +63,7 @@ namespace rabbit {
//_DESTRUCT_VECTOR(rabbit::LineInfo,_nlineinfos,_lineinfos); //not required are 2 integers //_DESTRUCT_VECTOR(rabbit::LineInfo,_nlineinfos,_lineinfos); //not required are 2 integers
_DESTRUCT_VECTOR(rabbit::LocalVarInfo,_nlocalvarinfos,_localvarinfos); _DESTRUCT_VECTOR(rabbit::LocalVarInfo,_nlocalvarinfos,_localvarinfos);
int64_t size = _FUNC_SIZE(_ninstructions,_nliterals,_nparameters,_nfunctions,_noutervalues,_nlineinfos,_nlocalvarinfos,_ndefaultparams); int64_t size = _FUNC_SIZE(_ninstructions,_nliterals,_nparameters,_nfunctions,_noutervalues,_nlineinfos,_nlocalvarinfos,_ndefaultparams);
this->~rabbit::FunctionProto(); this->~FunctionProto();
sq_vm_free(this,size); sq_vm_free(this,size);
} }

View File

@ -12,18 +12,18 @@ namespace rabbit {
public: public:
enum rabbit::GeneratorState{eRunning,eSuspended,eDead}; enum rabbit::GeneratorState{eRunning,eSuspended,eDead};
private: private:
rabbit::Generator(rabbit::SharedState *ss,rabbit::Closure *closure){ Generator(rabbit::SharedState *ss,rabbit::Closure *closure){
_closure=closure; _closure = closure;
_state=eRunning; _state = eRunning;
_ci._generator=NULL; _ci._generator = NULL;
} }
public: public:
static rabbit::Generator *create(rabbit::SharedState *ss,rabbit::Closure *closure){ static Generator *create(rabbit::SharedState *ss,rabbit::Closure *closure){
rabbit::Generator *nc=(rabbit::Generator*)SQ_MALLOC(sizeof(rabbit::Generator)); rabbit::Generator *nc=(rabbit::Generator*)SQ_MALLOC(sizeof(rabbit::Generator));
new (nc) rabbit::Generator(ss,closure); new ((char*)nc) rabbit::Generator(ss,closure);
return nc; return nc;
} }
~rabbit::Generator() ~Generator()
{ {
} }

View File

@ -8,7 +8,7 @@
#pragma once #pragma once
#include <etk/types.hpp> #include <etk/types.hpp>
#include <rabbit/sqpcheader.hpp>
#include <rabbit/VirtualMachine.hpp> #include <rabbit/VirtualMachine.hpp>

View File

@ -9,4 +9,24 @@
namespace rabbit { namespace rabbit {
class InstructionDesc {
public:
const rabbit::Char *name;
};
class Instruction {
Instruction(){};
Instruction(SQOpcode _op,int64_t a0=0,int64_t a1=0,int64_t a2=0,int64_t a3=0) {
op = (unsigned char)_op;
_arg0 = (unsigned char)a0;_arg1 = (int32_t)a1;
_arg2 = (unsigned char)a2;_arg3 = (unsigned char)a3;
}
int32_t _arg1;
unsigned char op;
unsigned char _arg0;
unsigned char _arg2;
unsigned char _arg3;
};
} }

View File

@ -39,14 +39,14 @@ namespace rabbit {
ret->_nparamscheck = _nparamscheck; ret->_nparamscheck = _nparamscheck;
return ret; return ret;
} }
~rabbit::NativeClosure() ~NativeClosure()
{ {
__Objrelease(_env); __Objrelease(_env);
} }
void release(){ void release(){
int64_t size = _CALC_NATVIVECLOSURE_SIZE(_noutervalues); int64_t size = _CALC_NATVIVECLOSURE_SIZE(_noutervalues);
_DESTRUCT_VECTOR(ObjectPtr,_noutervalues,_outervalues); _DESTRUCT_VECTOR(ObjectPtr,_noutervalues,_outervalues);
this->~rabbit::NativeClosure(); this->~NativeClosure();
sq_free(this,size); sq_free(this,size);
} }

View File

@ -133,7 +133,7 @@ void rabbit::ObjectPtr::Null() {
rabbit::ObjectType tOldType = _type; rabbit::ObjectType tOldType = _type;
rabbit::ObjectValue unOldVal = _unVal; rabbit::ObjectValue unOldVal = _unVal;
_type = rabbit::OT_NULL; _type = rabbit::OT_NULL;
_unVal.raw = (SQRawObjectVal)NULL; _unVal.raw = (rabbit::RawObjectVal)NULL;
__release(tOldType ,unOldVal); __release(tOldType ,unOldVal);
} }

View File

@ -13,14 +13,14 @@
namespace rabbit { namespace rabbit {
union ObjectValue { union ObjectValue {
struct rabbit::Closure *pClosure;
struct rabbit::Outer *pOuter;
struct rabbit::Generator *pGenerator;
struct rabbit::NativeClosure *pNativeClosure;
int64_t nInteger; int64_t nInteger;
float_t fFloat; float_t fFloat;
struct rabbit::FunctionProto *pFunctionProto;
rabbit::FunctionProto *pFunctionProto;
rabbit::Closure *pClosure;
rabbit::Outer *pOuter;
rabbit::Generator *pGenerator;
rabbit::NativeClosure *pNativeClosure;
rabbit::Table* pTable; rabbit::Table* pTable;
rabbit::String* pString; rabbit::String* pString;
rabbit::Class* pClass; rabbit::Class* pClass;
@ -33,7 +33,7 @@ namespace rabbit {
rabbit::Array* pArray; rabbit::Array* pArray;
rabbit::UserData* pUserData; rabbit::UserData* pUserData;
SQRawObjectVal raw; rabbit::RawObjectVal raw;
}; };
} }

View File

@ -25,7 +25,7 @@ namespace rabbit {
} }
void release() void release()
{ {
this->~rabbit::Outer(); this->~Outer();
sq_vm_free(this,sizeof(rabbit::Outer)); sq_vm_free(this,sizeof(rabbit::Outer));
} }
rabbit::ObjectPtr *_valptr; /* pointer to value on stack, or _value below */ rabbit::ObjectPtr *_valptr; /* pointer to value on stack, or _value below */

View File

@ -91,7 +91,7 @@ void rabbit::StringTable::remove(rabbit::String *bs)
_strings[h] = s->_next; _strings[h] = s->_next;
_slotused--; _slotused--;
int64_t slen = s->_len; int64_t slen = s->_len;
s->~rabbit::String(); s->~String();
SQ_FREE(s,sizeof(rabbit::String) + sq_rsl(slen)); SQ_FREE(s,sizeof(rabbit::String) + sq_rsl(slen));
return; return;
} }

View File

@ -5,7 +5,7 @@
* @copyright 2003-2017, Alberto DEMICHELIS, all right reserved * @copyright 2003-2017, Alberto DEMICHELIS, all right reserved
* @license MPL-2 (see license file) * @license MPL-2 (see license file)
*/ */
#include <rabbit/sqpcheader.hpp>
#include <math.h> #include <math.h>
#include <stdlib.h> #include <stdlib.h>
#include <rabbit/sqopcodes.hpp> #include <rabbit/sqopcodes.hpp>

View File

@ -7,13 +7,15 @@
*/ */
#pragma once #pragma once
#include <etk/Vector.hpp>
#include <rabbit/sqopcodes.hpp> #include <rabbit/sqopcodes.hpp>
#include <rabbit/sqobject.hpp>
#include <rabbit/AutoDec.hpp> #include <rabbit/AutoDec.hpp>
#include <rabbit/sqconfig.hpp> #include <rabbit/sqconfig.hpp>
#include <rabbit/ExceptionTrap.hpp> #include <rabbit/ExceptionTrap.hpp>
#include <rabbit/MetaMethod.hpp> #include <rabbit/MetaMethod.hpp>
#include <rabbit/ObjectPtr.hpp> #include <rabbit/ObjectPtr.hpp>
#include <rabbit/RefCounted.hpp>
#define MAX_NATIVE_CALLS 100 #define MAX_NATIVE_CALLS 100

View File

@ -5,7 +5,7 @@
* @copyright 2003-2017, Alberto DEMICHELIS, all right reserved * @copyright 2003-2017, Alberto DEMICHELIS, all right reserved
* @license MPL-2 (see license file) * @license MPL-2 (see license file)
*/ */
#include <rabbit/sqpcheader.hpp>
#include <rabbit/VirtualMachine.hpp> #include <rabbit/VirtualMachine.hpp>

View File

@ -5,7 +5,7 @@
* @copyright 2003-2017, Alberto DEMICHELIS, all right reserved * @copyright 2003-2017, Alberto DEMICHELIS, all right reserved
* @license MPL-2 (see license file) * @license MPL-2 (see license file)
*/ */
#include <rabbit/sqpcheader.hpp>
#include <rabbit/VirtualMachine.hpp> #include <rabbit/VirtualMachine.hpp>

View File

@ -15,13 +15,15 @@ typedef double float_t;
typedef float float_t; typedef float float_t;
#endif #endif
#if defined(SQUSEDOUBLE) && !defined(_SQ64) || !defined(SQUSEDOUBLE) && defined(_SQ64) namespace rabbit {
typedef uint64_t SQRawObjectVal; //must be 64bits #if defined(SQUSEDOUBLE) && !defined(_SQ64) || !defined(SQUSEDOUBLE) && defined(_SQ64)
#define SQ_OBJECT_RAWINIT() { _unVal.raw = 0; } using RawObjectVal = uint64_t; //must be 64bits
#else #define SQ_OBJECT_RAWINIT() { _unVal.raw = 0; }
typedef uint64_t SQRawObjectVal; //is 32 bits on 32 bits builds and 64 bits otherwise #else
#define SQ_OBJECT_RAWINIT() using RawObjectVal = uint64_t; //is 32 bits on 32 bits builds and 64 bits otherwise
#endif #define SQ_OBJECT_RAWINIT()
#endif
}
#ifndef SQ_ALIGNMENT #ifndef SQ_ALIGNMENT
#define SQ_ALIGNMENT 8 #define SQ_ALIGNMENT 8
@ -134,11 +136,6 @@ namespace rabbit {
struct rabbit::Closure;
struct rabbit::Generator;
struct rabbit::NativeClosure;
struct rabbit::FunctionProto;
struct rabbit::Outer;
namespace rabbit { namespace rabbit {
class UserData; class UserData;
class Array; class Array;
@ -154,4 +151,9 @@ namespace rabbit {
class Table; class Table;
class String; class String;
class SharedState; class SharedState;
class Closure;
class Generator;
class NativeClosure;
class FunctionProto;
class Outer;
} }

View File

@ -6,7 +6,7 @@
* @license MPL-2 (see license file) * @license MPL-2 (see license file)
*/ */
#include <rabbit/sqpcheader.hpp>
#include <stdarg.h> #include <stdarg.h>
#include <rabbit/VirtualMachine.hpp> #include <rabbit/VirtualMachine.hpp>
#include <rabbit/sqfuncproto.hpp> #include <rabbit/sqfuncproto.hpp>

View File

@ -6,7 +6,7 @@
* @license MPL-2 (see license file) * @license MPL-2 (see license file)
*/ */
#include <rabbit/sqpcheader.hpp>
#ifndef SQ_EXCLUDE_DEFAULT_MEMFUNCTIONS #ifndef SQ_EXCLUDE_DEFAULT_MEMFUNCTIONS
void *sq_vm_malloc(uint64_t size){ return malloc(size); } void *sq_vm_malloc(uint64_t size){ return malloc(size); }

View File

@ -107,30 +107,6 @@ enum SQOpcode
_OP_CLOSE= 0x3C _OP_CLOSE= 0x3C
}; };
struct rabbit::InstructionDesc {
const rabbit::Char *name;
};
struct rabbit::Instruction
{
rabbit::Instruction(){};
rabbit::Instruction(SQOpcode _op,int64_t a0=0,int64_t a1=0,int64_t a2=0,int64_t a3=0)
{ op = (unsigned char)_op;
_arg0 = (unsigned char)a0;_arg1 = (int32_t)a1;
_arg2 = (unsigned char)a2;_arg3 = (unsigned char)a3;
}
int32_t _arg1;
unsigned char op;
unsigned char _arg0;
unsigned char _arg2;
unsigned char _arg3;
};
#include <rabbit/squtils.hpp>
typedef etk::Vector<rabbit::Instruction> rabbit::InstructionVec;
#define NEW_SLOT_ATTRIBUTES_FLAG 0x01 #define NEW_SLOT_ATTRIBUTES_FLAG 0x01
#define NEW_SLOT_STATIC_FLAG 0x02 #define NEW_SLOT_STATIC_FLAG 0x02