From ccbffe7564a94661a4c970ce1241309710a6697e Mon Sep 17 00:00:00 2001 From: Scott Wood Date: Tue, 26 Jun 2007 13:39:28 -0400 Subject: [PATCH] build fixes --- idlcomp/TODO | 5 +---- include/c++/orb.h | 19 +++---------------- include/c++/util/radix.h | 3 +-- kernel/orb/invoke.cc | 4 ++-- lib/c++/orb.cc | 41 ++++++++++++++++++++++++++-------------- 5 files changed, 34 insertions(+), 38 deletions(-) diff --git a/idlcomp/TODO b/idlcomp/TODO index 36123ad..fa745f2 100644 --- a/idlcomp/TODO +++ b/idlcomp/TODO @@ -30,8 +30,7 @@ Methods can be specified as read-only; a read-only version of the interface is then generated, and a secure read-only reference to an object can be generated that can only access read-only methods. This would save effort declaring a separate interface and a separate -class, and would allow the read-write interface to use the read-only -methods without retreiving the read-only object. +class. Implement marshalling/unmarshalling stubs. @@ -51,5 +50,3 @@ Possibly implement out parameters on remote-only async methods that can only be used when invoked as a sync in-process method; the method implementation can check to see how it was invoked, and use the out parameters to avoid having to make a completion callback. - -Vstructs need a length field. diff --git a/include/c++/orb.h b/include/c++/orb.h index 076f1dd..23f0b72 100644 --- a/include/c++/orb.h +++ b/include/c++/orb.h @@ -254,16 +254,12 @@ namespace System { // Length of inheritance chain; 1 for System.VStruct const int chainlen; - - // Size of concrete vstruct - - const int structlen; }; uintptr_t downcast(::System::_i_Object *obj, const unsigned long *new_guid); - typedef u64 GUID[2]; + typedef uint64_t GUID[2]; // FIXME: use above typedef static inline bool guids_equal(const unsigned long *guid1, @@ -343,15 +339,6 @@ namespace System { return false; #endif } - - typedef void (*MethodEntry)(ParamInfoBlock *pib); - - struct Object { - MethodEntry entry; - void *ptr; // pointer to the class interface - }; - - typedef Util::RadixTree ObjTable; } }; } @@ -393,7 +380,7 @@ inline void operator delete[](void *ptr, ::System::RunTime::ORBMM *orbmm, throw T(NULL, NULL, \ new(::System::RunTime::orbmm) \ ::System::Exceptions::NativeCodeExceptionOriginInfo \ - (::System::RunTime::get_pc()), \ + (::System::RunTime::Priv::get_pc()), \ ::System::RunTime::Priv::in_kernel(), ##args); \ } while (0) @@ -401,7 +388,7 @@ inline void operator delete[](void *ptr, ::System::RunTime::ORBMM *orbmm, throw T(new(::System::RunTime::orbmm) typeof(oldex)(oldex), NULL, \ new(::System::RunTime::orbmm) \ ::System::Exceptions::NativeCodeExceptionOriginInfo \ - (::System::RunTime::get_pc()), \ + (::System::RunTime::Priv::get_pc()), \ ::System::RunTime::Priv::in_kernel(), ##args); \ } while (0) #endif diff --git a/include/c++/util/radix.h b/include/c++/util/radix.h index 3dcaaaf..c3ab842 100644 --- a/include/c++/util/radix.h +++ b/include/c++/util/radix.h @@ -11,7 +11,6 @@ #ifndef _UTIL_RADIX_H #define _UTIL_RADIX_H -#include #include #include @@ -65,7 +64,7 @@ namespace Util { return (key >> shift) & (dir_size - 1); } - static uint key_to_offset(Key key) + static unsigned int key_to_offset(Key key) { return key & (node_size - 1); } diff --git a/kernel/orb/invoke.cc b/kernel/orb/invoke.cc index 8d4f3eb..7fffb61 100644 --- a/kernel/orb/invoke.cc +++ b/kernel/orb/invoke.cc @@ -158,7 +158,7 @@ namespace ORB { printf("invoke_method: pib %p\n", user_pib); ParamInfoBlock pib = Arch::copyin(user_pib); - printf("objlist len %lu\n", pib.objlist_len); + printf("objlist len %u\n", pib.objlist_len); if (pib.objlist_len == 0) throw_idl(InvalidArgument, 0, countarray("no objects")); @@ -194,7 +194,7 @@ namespace ORB { u8 *copy = new(orbmm) u8[pib.copy_size]; ParamInfoBlock *dpib = reinterpret_cast (args + piboff); - dpib->objlist = reinterpret_cast(args + datalen); + dpib->objlist = reinterpret_cast(args + datalen); copy_ids_to_kern(dpib, &pib, ids); copy_data(args, args, pib.buffer_size, dpib, &pib, ~0U, Segment::In); diff --git a/lib/c++/orb.cc b/lib/c++/orb.cc index 26f3fc2..852919b 100644 --- a/lib/c++/orb.cc +++ b/lib/c++/orb.cc @@ -1,8 +1,9 @@ #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... @@ -51,6 +52,14 @@ namespace RunTime { 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 +69,48 @@ namespace RunTime { void exception_to_array(::System::VStruct *ex, Array *ar) { - ar->ptr = reinterpret_cast(ex); - ar->count = ex->_infoptr->structlen; + // FIXME +// ar->ptr = reinterpret_cast(ex); +// ar->count = ex->_infoptr->structlen; } - 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(); } } -- 2.39.2