X-Git-Url: http://git.buserror.net/cgi-bin/gitweb.cgi?p=polintos%2Fscott%2Fpriv.git;a=blobdiff_plain;f=lib%2Fc%2B%2B%2Forb.cc;h=a6158bf9ebcf0c23824e28e6adcf34f671b55e10;hp=26f3fc2731b4a74039a3fe84e1726b49b7925136;hb=15d9baeca05f30f8564785c255fed765ede457ff;hpb=d32da4b91b9a403ae9d65c48fbb25c1abbb5083f diff --git a/lib/c++/orb.cc b/lib/c++/orb.cc index 26f3fc2..a6158bf 100644 --- a/lib/c++/orb.cc +++ b/lib/c++/orb.cc @@ -1,12 +1,12 @@ #include +#include namespace System { namespace RunTime { - using ::System::Exceptions::Std; + using namespace ::System::Exceptions::Std; // This function could be made to do a binary search if we can // manage to somehow sort the IFaceTables... - uintptr_t downcast(::System::_i_Object *obj, const unsigned long *new_guid) { @@ -29,15 +29,15 @@ namespace RunTime { // behaves. while (true) { - if (tbl->guid[0] == new_guid_first && - tbl->guid[1] == new_guid[1] && + if (tbl->info->guid[0] == new_guid_first && + tbl->info->guid[1] == new_guid[1] && (sizeof(long) == 8 || - (tbl->guid[2] == new_guid[2] && - tbl->guid[3] == new_guid[3]))) + (tbl->info->guid[2] == new_guid[2] && + tbl->info->guid[3] == new_guid[3]))) break; tbl++; - if (__builtin_expect(!tbl->guid, 0)) + if (__builtin_expect(!tbl->info->guid, 0)) return 0; } @@ -48,9 +48,16 @@ namespace RunTime { return ptr; }; - namespace Priv { + typedef void (*MethodEntry)(ParamInfoBlock *pib); + + struct Object { + MethodEntry entry; + void *ptr; // pointer to the class interface + }; + + typedef ::Util::RadixTree ObjTable; ObjTable objtable; unsigned long get_pc() @@ -60,44 +67,44 @@ namespace RunTime { void exception_to_array(::System::VStruct *ex, Array *ar) { - ar->ptr = reinterpret_cast(ex); - ar->count = ex->_infoptr->structlen; + // FIXME: marshall struct } - void handle_message(ParameterInfoBlock *pib) + void handle_message(ParamInfoBlock *pib) { Message *msg = reinterpret_cast(pib->segments[0].ptr); - switch (seg0->opcode) { + switch (msg->seg0.opcode) { case Segment0::InvokeMethod: { - if (pib->segments[0].len < sizeof(InvokeMessage)) + if (pib->segments[0].len < sizeof(InvokeMethod)) throw_idl(ShortMessage, 0, pib->segments[0].len, - sizeof(InvokeMessage)); + sizeof(InvokeMethod)); - ID obj = pib->objlist[0]; - - +// ID obj = pib->objlist[0]; break; } default: - throw_idl(InvalidOpcode, seg0->opcode); + throw_idl(InvalidOpcode, msg->seg0.opcode); } } } }} -extern "C" handle_message(ParameterInfoaBlock *pib, Array *ex_arr) +extern "C" void abort(); + +extern "C" void handle_message(::System::RunTime::ParamInfoBlock *pib, + ::System::RunTime::Array *ex_arr) { try { - ::System::RunTime::handle_message(pib); + ::System::RunTime::Priv::handle_message(pib); } - catch (::System::Exception *ex) { - exception_to_array(ex, ex_arr); + catch (::System::Exceptions::Exception &ex) { + ::System::RunTime::Priv::exception_to_array(&ex, ex_arr); } catch (...) { - assertl(0, Assert::Always); + abort(); } }