[DEV] remote _funcproto()

This commit is contained in:
Edouard DUPIN 2018-07-03 22:13:08 +02:00
parent 985ddbb7f2
commit 25e0b49c20
5 changed files with 5 additions and 6 deletions

View File

@ -137,7 +137,7 @@ bool rabbit::Closure::load(rabbit::VirtualMachine *v,rabbit::UserPointer up,SQRE
rabbit::ObjectPtr func; rabbit::ObjectPtr func;
_CHECK_IO(rabbit::FunctionProto::load(v,up,read,func)); _CHECK_IO(rabbit::FunctionProto::load(v,up,read,func));
_CHECK_IO(CheckTag(v,read,up,SQ_CLOSURESTREAM_TAIL)); _CHECK_IO(CheckTag(v,read,up,SQ_CLOSURESTREAM_TAIL));
ret = rabbit::Closure::create(_get_shared_state(v),_funcproto(func),v->_roottable.toTable()->getWeakRef(rabbit::OT_TABLE)); ret = rabbit::Closure::create(_get_shared_state(v),func.toFunctionProto(),v->_roottable.toTable()->getWeakRef(rabbit::OT_TABLE));
//FIXME: load an root for this closure //FIXME: load an root for this closure
return true; return true;
} }

View File

@ -205,7 +205,7 @@ public:
_fs->setStacksize(0); _fs->setStacksize(0);
o =_fs->buildProto(); o =_fs->buildProto();
#ifdef _DEBUG_DUMP #ifdef _DEBUG_DUMP
_fs->dump(_funcproto(o)); _fs->dump(o.toFunctionProto());
#endif #endif
} }
else { else {

View File

@ -189,7 +189,7 @@ bool rabbit::FunctionProto::save(rabbit::VirtualMachine *v,rabbit::UserPointer u
_CHECK_IO(WriteTag(v,write,up,SQ_CLOSURESTREAM_PART)); _CHECK_IO(WriteTag(v,write,up,SQ_CLOSURESTREAM_PART));
for(i=0;i<nfunctions;i++){ for(i=0;i<nfunctions;i++){
_CHECK_IO(_funcproto(_functions[i])->save(v,up,write)); _CHECK_IO(_functions[i].toFunctionProto()->save(v,up,write));
} }
_CHECK_IO(SafeWrite(v,write,up,&_stacksize,sizeof(_stacksize))); _CHECK_IO(SafeWrite(v,write,up,&_stacksize,sizeof(_stacksize)));
_CHECK_IO(SafeWrite(v,write,up,&_bgenerator,sizeof(_bgenerator))); _CHECK_IO(SafeWrite(v,write,up,&_bgenerator,sizeof(_bgenerator)));
@ -268,7 +268,7 @@ bool rabbit::FunctionProto::load(rabbit::VirtualMachine *v,rabbit::UserPointer u
_CHECK_IO(CheckTag(v,read,up,SQ_CLOSURESTREAM_PART)); _CHECK_IO(CheckTag(v,read,up,SQ_CLOSURESTREAM_PART));
for(i = 0; i < nfunctions; i++){ for(i = 0; i < nfunctions; i++){
_CHECK_IO(_funcproto(o)->load(v, up, read, o)); _CHECK_IO(o.toFunctionProto()->load(v, up, read, o));
f->_functions[i] = o; f->_functions[i] = o;
} }
_CHECK_IO(SafeRead(v,read,up, &f->_stacksize, sizeof(f->_stacksize))); _CHECK_IO(SafeRead(v,read,up, &f->_stacksize, sizeof(f->_stacksize)));

View File

@ -149,7 +149,6 @@ namespace rabbit {
#define is_delegable(t) (sq_type(t)&SQOBJECT_DELEGABLE) #define is_delegable(t) (sq_type(t)&SQOBJECT_DELEGABLE)
#define raw_type(obj) _RAW_TYPE((obj)._type) #define raw_type(obj) _RAW_TYPE((obj)._type)
#define _funcproto(obj) ((obj)._unVal.pFunctionProto)
#define _class(obj) ((obj)._unVal.pClass) #define _class(obj) ((obj)._unVal.pClass)
#define _instance(obj) ((obj)._unVal.pInstance) #define _instance(obj) ((obj)._unVal.pInstance)
#define _delegable(obj) ((rabbit::Delegable *)(obj)._unVal.pDelegable) #define _delegable(obj) ((rabbit::Delegable *)(obj)._unVal.pDelegable)

View File

@ -149,7 +149,7 @@ rabbit::Result rabbit::sq_compile(rabbit::VirtualMachine* v,SQLEXREADFUNC read,r
rabbit::ObjectPtr o; rabbit::ObjectPtr o;
#ifndef NO_COMPILER #ifndef NO_COMPILER
if(compile(v, read, p, sourcename, o, raiseerror?true:false, _get_shared_state(v)->_debuginfo)) { if(compile(v, read, p, sourcename, o, raiseerror?true:false, _get_shared_state(v)->_debuginfo)) {
v->push(rabbit::Closure::create(_get_shared_state(v), _funcproto(o), v->_roottable.toTable()->getWeakRef(rabbit::OT_TABLE))); v->push(rabbit::Closure::create(_get_shared_state(v), o.toFunctionProto(), v->_roottable.toTable()->getWeakRef(rabbit::OT_TABLE)));
return SQ_OK; return SQ_OK;
} }
return SQ_ERROR; return SQ_ERROR;