[DEV] remote _thread()
This commit is contained in:
parent
e23132b712
commit
985ddbb7f2
@ -149,7 +149,6 @@ namespace rabbit {
|
||||
#define is_delegable(t) (sq_type(t)&SQOBJECT_DELEGABLE)
|
||||
#define raw_type(obj) _RAW_TYPE((obj)._type)
|
||||
|
||||
#define _thread(obj) ((obj)._unVal.pThread)
|
||||
#define _funcproto(obj) ((obj)._unVal.pFunctionProto)
|
||||
#define _class(obj) ((obj)._unVal.pClass)
|
||||
#define _instance(obj) ((obj)._unVal.pInstance)
|
||||
|
@ -172,7 +172,7 @@ rabbit::SharedState::~SharedState()
|
||||
_systemstrings->back().Null();
|
||||
_systemstrings->popBack();
|
||||
}
|
||||
_thread(_root_vm)->finalize();
|
||||
_root_vm.toVirtualMachine()->finalize();
|
||||
_root_vm.Null();
|
||||
_table_default_delegate.Null();
|
||||
_array_default_delegate.Null();
|
||||
|
@ -255,7 +255,7 @@ bool rabbit::VirtualMachine::objCmp(const rabbit::ObjectPtr &o1,const rabbit::Ob
|
||||
}
|
||||
//continues through (no break needed)
|
||||
default:
|
||||
_RET_SUCCEED( o1.getUserPointer() < o2.getUserPointer()?-1:1 );
|
||||
_RET_SUCCEED( o1.toUserPointer() < o2.toUserPointer()?-1:1 );
|
||||
}
|
||||
assert(0);
|
||||
//if(type(res)!=rabbit::OT_INTEGER) { raise_Compareerror(o1,o2); return false; }
|
||||
@ -1795,8 +1795,8 @@ void rabbit::VirtualMachine::dumpstack(int64_t stackbase,bool dumpall)
|
||||
case rabbit::OT_NATIVECLOSURE: printf("NATIVECLOSURE");break;
|
||||
case rabbit::OT_USERDATA: printf("USERDATA %p[%p]",_userdataval(obj),obj.toUserData()->_delegate);break;
|
||||
case rabbit::OT_GENERATOR: printf("GENERATOR %p",obj.toGenerator());break;
|
||||
case rabbit::OT_THREAD: printf("THREAD [%p]",_thread(obj));break;
|
||||
case rabbit::OT_USERPOINTER: printf("USERPOINTER %p",obj.getUserPointer());break;
|
||||
case rabbit::OT_THREAD: printf("THREAD [%p]",obj.toVirtualMachine());break;
|
||||
case rabbit::OT_USERPOINTER: printf("USERPOINTER %p",obj.toUserPointer());break;
|
||||
case rabbit::OT_CLASS: printf("CLASS %p",_class(obj));break;
|
||||
case rabbit::OT_INSTANCE: printf("INSTANCE %p",_instance(obj));break;
|
||||
case rabbit::OT_WEAKREF: printf("WEAKERF %p",_weakref(obj));break;
|
||||
|
@ -135,7 +135,7 @@ void rabbit::sq_setdebughook(rabbit::VirtualMachine* v)
|
||||
void rabbit::sq_close(rabbit::VirtualMachine* v)
|
||||
{
|
||||
rabbit::SharedState *ss = _get_shared_state(v);
|
||||
_thread(ss->_root_vm)->finalize();
|
||||
ss->_root_vm.toVirtualMachine()->finalize();
|
||||
sq_delete(ss, SharedState);
|
||||
}
|
||||
|
||||
@ -229,7 +229,7 @@ rabbit::Bool rabbit::sq_objtobool(const rabbit::Object *o)
|
||||
rabbit::UserPointer rabbit::sq_objtouserpointer(const rabbit::Object *o)
|
||||
{
|
||||
if(sq_isuserpointer(*o)) {
|
||||
return o->getUserPointer();
|
||||
return o->toUserPointer();
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
@ -717,7 +717,7 @@ rabbit::Result rabbit::sq_getthread(rabbit::VirtualMachine* v,int64_t idx,rabbit
|
||||
{
|
||||
rabbit::ObjectPtr *o = NULL;
|
||||
_GETSAFE_OBJ(v, idx, rabbit::OT_THREAD,o);
|
||||
*thread = _thread(*o);
|
||||
*thread = o->toVirtualMachine();
|
||||
return SQ_OK;
|
||||
}
|
||||
|
||||
@ -804,7 +804,7 @@ rabbit::Result rabbit::sq_getuserpointer(rabbit::VirtualMachine* v, int64_t idx,
|
||||
{
|
||||
rabbit::ObjectPtr *o = NULL;
|
||||
_GETSAFE_OBJ(v, idx, rabbit::OT_USERPOINTER,o);
|
||||
(*p) = o->getUserPointer();
|
||||
(*p) = o->toUserPointer();
|
||||
return SQ_OK;
|
||||
}
|
||||
|
||||
|
@ -1060,15 +1060,15 @@ static int64_t thread_call(rabbit::VirtualMachine* v)
|
||||
rabbit::ObjectPtr o = stack_get(v,1);
|
||||
if(sq_type(o) == rabbit::OT_THREAD) {
|
||||
int64_t nparams = sq_gettop(v);
|
||||
_thread(o)->push(_thread(o)->_roottable);
|
||||
o.toVirtualMachine()->push(o.toVirtualMachine()->_roottable);
|
||||
for(int64_t i = 2; i<(nparams+1); i++)
|
||||
sq_move(_thread(o),v,i);
|
||||
if(SQ_SUCCEEDED(sq_call(_thread(o),nparams,SQTrue,SQTrue))) {
|
||||
sq_move(v,_thread(o),-1);
|
||||
sq_pop(_thread(o),1);
|
||||
sq_move(o.toVirtualMachine(),v,i);
|
||||
if(SQ_SUCCEEDED(sq_call(o.toVirtualMachine(),nparams,SQTrue,SQTrue))) {
|
||||
sq_move(v,o.toVirtualMachine(),-1);
|
||||
sq_pop(o.toVirtualMachine(),1);
|
||||
return 1;
|
||||
}
|
||||
v->_lasterror = _thread(o)->_lasterror;
|
||||
v->_lasterror = o.toVirtualMachine()->_lasterror;
|
||||
return SQ_ERROR;
|
||||
}
|
||||
return sq_throwerror(v,"wrong parameter");
|
||||
@ -1078,7 +1078,7 @@ static int64_t thread_wakeup(rabbit::VirtualMachine* v)
|
||||
{
|
||||
rabbit::ObjectPtr o = stack_get(v,1);
|
||||
if(sq_type(o) == rabbit::OT_THREAD) {
|
||||
rabbit::VirtualMachine *thread = _thread(o);
|
||||
rabbit::VirtualMachine *thread = o.toVirtualMachine();
|
||||
int64_t state = sq_getvmstate(thread);
|
||||
if(state != SQ_VMSTATE_SUSPENDED) {
|
||||
switch(state) {
|
||||
@ -1114,7 +1114,7 @@ static int64_t thread_wakeupthrow(rabbit::VirtualMachine* v)
|
||||
{
|
||||
rabbit::ObjectPtr o = stack_get(v,1);
|
||||
if(sq_type(o) == rabbit::OT_THREAD) {
|
||||
rabbit::VirtualMachine *thread = _thread(o);
|
||||
rabbit::VirtualMachine *thread = o.toVirtualMachine();
|
||||
int64_t state = sq_getvmstate(thread);
|
||||
if(state != SQ_VMSTATE_SUSPENDED) {
|
||||
switch(state) {
|
||||
@ -1154,7 +1154,7 @@ static int64_t thread_wakeupthrow(rabbit::VirtualMachine* v)
|
||||
static int64_t thread_getstatus(rabbit::VirtualMachine* v)
|
||||
{
|
||||
rabbit::ObjectPtr &o = stack_get(v,1);
|
||||
switch(sq_getvmstate(_thread(o))) {
|
||||
switch(sq_getvmstate(o.toVirtualMachine())) {
|
||||
case SQ_VMSTATE_IDLE:
|
||||
sq_pushstring(v,"idle",-1);
|
||||
break;
|
||||
@ -1174,7 +1174,7 @@ static int64_t thread_getstackinfos(rabbit::VirtualMachine* v)
|
||||
{
|
||||
rabbit::ObjectPtr o = stack_get(v,1);
|
||||
if(sq_type(o) == rabbit::OT_THREAD) {
|
||||
rabbit::VirtualMachine *thread = _thread(o);
|
||||
rabbit::VirtualMachine *thread = o.toVirtualMachine();
|
||||
int64_t threadtop = sq_gettop(thread);
|
||||
int64_t level;
|
||||
sq_getinteger(v,-1,&level);
|
||||
|
Loading…
x
Reference in New Issue
Block a user