From: <z-...@us...> - 2008-02-21 22:00:50
|
Revision: 8040 http://armagetronad.svn.sourceforge.net/armagetronad/?rev=8040&view=rev Author: z-man Date: 2008-02-21 14:00:56 -0800 (Thu, 21 Feb 2008) Log Message: ----------- Made a boatload of plain IoObject * to IoObjectPointers to avoid the Garbage Collector from Hell. Adapted enum test to namespaces. Fixed double proto errors by not registering namespace protos. Modified Paths: -------------- private/z-man/clio/function.hpp private/z-man/clio/iclassinfo.cpp private/z-man/clio/ifunctioninfo.cpp private/z-man/clio/namespace.cpp private/z-man/clio/tests/enum.test/output.txt private/z-man/clio/tests/enum.test/test.io private/z-man/clio/virtual_helper.cpp private/z-man/clio/virtual_helper.hpp Modified: private/z-man/clio/function.hpp =================================================================== --- private/z-man/clio/function.hpp 2008-02-21 18:53:03 UTC (rev 8039) +++ private/z-man/clio/function.hpp 2008-02-21 22:00:56 UTC (rev 8040) @@ -7,7 +7,7 @@ #include "typelist.hpp" #include "macrorecursion.hpp" -// #include "objectwrapperaware.hpp" +#include "gcpointer.hpp" namespace clio { Modified: private/z-man/clio/iclassinfo.cpp =================================================================== --- private/z-man/clio/iclassinfo.cpp 2008-02-21 18:53:03 UTC (rev 8039) +++ private/z-man/clio/iclassinfo.cpp 2008-02-21 22:00:56 UTC (rev 8040) @@ -590,7 +590,7 @@ // std::cout << "Cloning " << name_ << "\n"; // clone Io part of object - IoObject *clone = IoObject_rawClonePrimitive( self ); + IoObject * clone = IoObject_rawClonePrimitive( self ); // get C++ payload of old object, get class ObjectWrapper & wrapper = GetObjectWrapper( self ); @@ -687,7 +687,10 @@ GetClassRegistratorSet().RegisterAll( state, wrapper, classInfo ); // register object class - IoState_registerProtoWithFunc_( state, self, creator ); + if ( creator ) + { + IoState_registerProtoWithFunc_( state, self, creator ); + } } void IClassInfo::DoPreRegister( IoState * state ) CLIO_NOTHROW @@ -730,8 +733,6 @@ IoObject * prototype = prototypeWrapper->GetSelf(); assert( prototype ); - // ObjectWrapper * wrapper = static_cast< ObjectWrapper * >( prototype_->data.ptr ); - // register base classes for ( Casters::iterator iter = upcasts_.begin(); iter != upcasts_.end(); ++iter ) { Modified: private/z-man/clio/ifunctioninfo.cpp =================================================================== --- private/z-man/clio/ifunctioninfo.cpp 2008-02-21 18:53:03 UTC (rev 8039) +++ private/z-man/clio/ifunctioninfo.cpp 2008-02-21 22:00:56 UTC (rev 8040) @@ -147,7 +147,7 @@ StackResetter topMarker( & topOfStack_ ); // get self - IoObject * self = selfWrapper.GetSelf(); + IoObjectPointer self = selfWrapper.GetSelf(); assert( self ); // get state @@ -165,12 +165,12 @@ argumentsRetained.reserve( argCount ); for( int i = 0; i < argCount; ++i ) { - IoObject * object = IoMessage_locals_valueArgAt_( m, locals, i ); + IoObjectPointer object = IoMessage_locals_valueArgAt_( m, locals, i ); arguments.push_back( object ); argumentsRetained.push_back( object ); } - IoObject * ret = NULL; + IoObjectPointer ret = NULL; IFunctionInfo const * executer = this; // and execute @@ -403,13 +403,13 @@ try { /* - IoObject *call = IoObject_getSlot_(locals, IOSYMBOL("call")); - IoObject *sender = IoCall_sender(call, locals, m); + IoObjectPointercall = IoObject_getSlot_(locals, IOSYMBOL("call")); + IoObjectPointersender = IoCall_sender(call, locals, m); */ - // IoObject *sender = IoObject_getSlot(call, IOSTRING("sender")); + // IoObjectPointersender = IoObject_getSlot(call, IOSTRING("sender")); - IoObject * ret = selfData->function->ExecuteInline_( targetWrapper, locals, m ); + IoObjectPointer ret = selfData->function->ExecuteInline_( targetWrapper, locals, m ); return ret; } catch ( clio::Exception & e ) @@ -430,10 +430,10 @@ assert( locals ); assert( m ); - IoObject *bTarget = IoMessage_locals_valueArgAt_(m, locals, 0); - IoObject *bLocals = locals; - IoObject *bMessage = m; - IoObject *bContext = bTarget; + IoObjectPointer bTarget = IoMessage_locals_valueArgAt_(m, locals, 0); + IoObjectPointer bLocals = locals; + IoObjectPointer bMessage = m; + IoObjectPointer bContext = bTarget; int argCount = IoMessage_argCount(m); if (argCount > 1) @@ -460,7 +460,7 @@ IoCFunction *ClioFunction_rawClone(IoCFunction *proto) { - IoObject *self = IoObject_rawClonePrimitive(proto); + IoObjectPointer self = IoObject_rawClonePrimitive(proto); IoObject_setDataPointer_(self, cpalloc(DATA(proto), sizeof(ClioFunctionData))); IoObject_isActivatable_( self, 1 ); return self; @@ -480,7 +480,7 @@ IoCFunction * ClioFunction_proto(void *state) { - IoObject *self = IoObject_new(state); + IoObjectPointer self = IoObject_new(state); IoObject_tag_( self, ClioFunction_tag(state) ); IoObject_setDataPointer_(self, calloc(1, sizeof(ClioFunctionData))); @@ -501,7 +501,7 @@ {NULL, NULL}, }; - IoObject *self = IoState_protoWithInitFunction_((IoState *)state, ClioFunction_proto); + IoObjectPointer self = IoState_protoWithInitFunction_((IoState *)state, ClioFunction_proto); IoObject_addMethodTable_(self, methodTable); } @@ -546,7 +546,7 @@ IoObject * IoObject_addClioMethod_( IoObject *self, IoSymbol *slotName, IFunctionInfo *fp ) { IoTag *t = IoObject_tag( self ); - IoObject *proto = IoState_protoWithInitFunction_(IOSTATE, IoObject_proto); + IoObjectPointer proto = IoState_protoWithInitFunction_(IOSTATE, IoObject_proto); IoCFunction *f; if (t == IoObject_tag( proto ) ) @@ -673,7 +673,7 @@ void IFunctionInfo::DoRegister( IoState * state, ObjectWrapper * selfWrapper, ExtraInfo const & info ) CLIO_NOTHROW { // fetch Io Object - IoObject * self = selfWrapper->GetSelf(); + IoObjectPointer self = selfWrapper->GetSelf(); // get symbol matching function name IoSymbol * slotName = IOSYMBOL( name_.c_str() ); Modified: private/z-man/clio/namespace.cpp =================================================================== --- private/z-man/clio/namespace.cpp 2008-02-21 18:53:03 UTC (rev 8039) +++ private/z-man/clio/namespace.cpp 2008-02-21 22:00:56 UTC (rev 8040) @@ -24,7 +24,7 @@ return 0; } -typedef static std::map< std::string, NameSpace * > SpaceMap; +typedef std::map< std::string, NameSpace * > SpaceMap; class AutoClearer { Modified: private/z-man/clio/tests/enum.test/output.txt =================================================================== --- private/z-man/clio/tests/enum.test/output.txt 2008-02-21 18:53:03 UTC (rev 8039) +++ private/z-man/clio/tests/enum.test/output.txt 2008-02-21 22:00:56 UTC (rev 8040) @@ -29,7 +29,7 @@ value1 # testing reference instantiation -<<<< r := Ref With(TestEnum) +<<<< r := Clio Ref With(TestEnum) <<<< r = r with( TestEnum value3 ) <<<< r type println Ref With(TestEnum) Modified: private/z-man/clio/tests/enum.test/test.io =================================================================== --- private/z-man/clio/tests/enum.test/test.io 2008-02-21 18:53:03 UTC (rev 8039) +++ private/z-man/clio/tests/enum.test/test.io 2008-02-21 22:00:56 UTC (rev 8040) @@ -19,7 +19,7 @@ EnumTest get println # testing reference instantiation -r := Ref With(TestEnum) +r := Clio Ref With(TestEnum) r = r with( TestEnum value3 ) r type println r println Modified: private/z-man/clio/virtual_helper.cpp =================================================================== --- private/z-man/clio/virtual_helper.cpp 2008-02-21 18:53:03 UTC (rev 8039) +++ private/z-man/clio/virtual_helper.cpp 2008-02-21 22:00:56 UTC (rev 8040) @@ -48,7 +48,7 @@ ObjectWrapper * wrapper = aware->GetObjectWrapper(); if ( !wrapper ) return false; - IoObject * self = wrapper->GetSelf(); + IoObjectPointer self = wrapper->GetSelf(); if ( !self ) return false; @@ -71,7 +71,7 @@ ObjectWrapper * wrapper = aware->GetObjectWrapper(); if ( !wrapper ) return false; - IoObject * self = wrapper->GetSelf(); + IoObjectPointer self = wrapper->GetSelf(); if ( !self ) return false; @@ -128,7 +128,7 @@ // derived from the target object IoObject_rawAppendProto_( locals_, self_ ); - IoObject *self = self_; + IoObjectPointer self = self_; IoObject_setSlot_to_( locals_, IOSYMBOL("self"), self_ ); } Modified: private/z-man/clio/virtual_helper.hpp =================================================================== --- private/z-man/clio/virtual_helper.hpp 2008-02-21 18:53:03 UTC (rev 8039) +++ private/z-man/clio/virtual_helper.hpp 2008-02-21 22:00:56 UTC (rev 8040) @@ -5,6 +5,7 @@ #include <string> #include "dataconversion.hpp" #include "clio_config.hpp" +#include "gcpointer.hpp" class IoState; @@ -78,15 +79,15 @@ void SetMessage(IoMessage * message); private: IoState * state_; // the io state - IoObject * self_; // the object to call the method on + IoObjectPointer self_; // the object to call the method on IoSymbol * slotName_; // the slotname of the method to call - IoObject * method_; // the method itself + IoObjectPointer method_; // the method itself IoMessage * message_; // the message to send - IoObject * locals_; // the locals for the message call - IoObject * context_; // the context of the message call + IoObjectPointer locals_; // the locals for the message call + IoObjectPointer context_; // the context of the message call }; /* the easiest usage is for calling zero-argument functions: This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |