]> git.buserror.net Git - polintos/scott/priv.git/commitdiff
Add IFaceInfo.
authorScott Wood <scott@thor.buserror.net>
Sun, 29 Jul 2007 18:41:23 +0000 (13:41 -0500)
committerScott Wood <scott@thor.buserror.net>
Sun, 29 Jul 2007 19:52:17 +0000 (14:52 -0500)
idlcomp/languages/c++/c++.h
idlcomp/languages/c++/interface-caller.cc
idlcomp/languages/c++/main.cc
idlcomp/languages/c++/marshall.cc
idlcomp/languages/c++/server.cc
idlcomp/vtable-sample.h
include/c++/orb.h
lib/c++/orb.cc

index 51ea7070c737e8888e19461ce80be338e6b83420..214f2cdb1828abec115a2337607b15b628238bbe 100644 (file)
@@ -83,12 +83,13 @@ class CPPFile : public LangCallback {
        void output_one_method_ptr(Method *m, Interface *iface);
        
        static void output_iface_ns(CPPFile *file, NameSpace *sym);
-
+       
        //// Misc members:
 
-       // Output the static const guid[] value.
+       // Output the static const guid[] value, and the IFaceInfo struct.
 
        void output_guid(const uint64_t *guid);
+       void output_ifaceinfo(Interface *iface);
 
        // Output a datum in the given struct, along with any necessary
        // padding.  Return the offset of the next datum.
index 4d17670e0c62ebd7f38eb5350d672f6f2c85a94a..2d8c51d4f91badc4a7e38d73ebf4a7a2923d13aa 100644 (file)
@@ -283,8 +283,8 @@ void CPPFile::output_downcast(Interface *iface, Interface *super)
             << indent << "\treinterpret_cast< ::System::_i_Object *>(oldptr._ptr);\n"
             << indent << "return " << name << "(reinterpret_cast< "
             << iname << " *>\n"
-            << indent << "\t(::System::RunTime::downcast(_llptr, "
-            << name << "_ns::_guid.l)));\n";
+            << indent << "\t(::System::RunTime::downcast(_llptr, &"
+            << name << "_ns::_guid)));\n";
        
        indent.indent_level--;
        
index 813bff394f040f3cd2dcacd5892fb03422d18b1e..7c6ebe8243e27fe00ab3d002b1f7348502402f35 100644 (file)
@@ -385,10 +385,8 @@ void CPPFile::output_guid(const uint64_t *guid64)
        const unsigned char *guid = reinterpret_cast<const unsigned char *>(guid64);
        char guidhex[7];
        
-       file << indent << "static const __attribute__((unused)) union {\n"
-            << indent << "\tunsigned char c[16];\n"
-            << indent << "\tunsigned long l[];\n"
-            << indent << "} _guid = {\n"
+       file << indent << "static const __attribute__((unused))\n"
+            << indent << "::System::RunTime::GUID _guid = {\n"
             << indent << "\t{ ";
        
        for (int i = 0; i < 16; i++) {
@@ -737,8 +735,9 @@ void CPPFile::output_iface_ns(CPPFile *file, NameSpace *sym)
 {
        Interface *i = dynamic_cast<Interface *>(sym);
        assert(i);
-       
+
        file->output_guid(i->def.guid);
+       file->output_ifaceinfo(i);
 }
 
 void CPPFile::output(Interface *sym, int pass, void *arg2)
index 1e0c87a5b60f415e97dfb49569fb70e049b9eb28..2391b37980b9e1476e15b6a94e008d918fff415c 100644 (file)
 
 #include "c++.h"
 
+void CPPFile::output_ifaceinfo(Interface *iface)
+{
+       extra_newline();
+
+       file << indent << "static const __attribute__((unused))\n"
+            << indent << "::System::RunTime::IFaceInfo _info = {\n"
+            << indent << "\t&_guid,\n"
+            << indent << "};\n";
+       
+       do_extra_newline = true;
+}
index f773e6f604d30f98017e5ff8a04ee88b53e15186..190eb4648dddf188f742cc9e73e43b2ed7445b98 100644 (file)
@@ -288,7 +288,7 @@ void cpp_output_iface_table_entry(Interface *super, void *arg)
        ctx.f << ctx.indent << "{\n";
        ctx.indent.indent_level++;
 
-       ctx.f << ctx.indent;
+       ctx.f << ctx.indent << '&';
        cpp_output_name(ctx.f, super);
        
        ctx.f << "_ns::_info,\n"
index a62633cfe6cca7452031422f2d64ca00b09077a1..bffd75fa43c8b4d05c17dac5b564db8124414ce3 100644 (file)
@@ -1,3 +1,5 @@
+// FIXME: This is out-of-date and incomplete.
+
 #include <orb.h>
 
 struct IFaceTable {
index 30c4157728e083e885d37188f1fa56ed88f5425e..72daad843dcedaaed5ab6175e8e174d9c55ad62d 100644 (file)
@@ -327,10 +327,12 @@ namespace System {
                        const int chainlen;
                };
                
-               uintptr_t downcast(::System::_i_Object *obj,
-                                  const unsigned long *new_guid);
+               union GUID {
+                       unsigned char c[16];
+                       unsigned long l[];
+               };
 
-               typedef uint64_t GUID[2];
+               uintptr_t downcast(::System::_i_Object *obj, const GUID *new_guid);
 
                // FIXME: use above typedef
                static inline bool guids_equal(const unsigned long *guid1,
@@ -395,7 +397,7 @@ namespace System {
                };
 
                struct IFaceInfo {
-                       static const uint8_t *guid;
+                       const GUID *guid;
                        int (*marshall)(GrowableArray<uint8_t> &buf,
                                        GrowableArray<ID> &objlist,
                                        ParamInfoBlock::Segment *segs,
index a6158bf9ebcf0c23824e28e6adcf34f671b55e10..a62e91f6b1f43160764e0439311609e175fc6e22 100644 (file)
@@ -7,8 +7,7 @@ namespace RunTime {
 
        // 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)
+       uintptr_t downcast(::System::_i_Object *obj, const GUID *new_guid)
        {
                if (!obj)
                        return 0;
@@ -19,7 +18,7 @@ namespace RunTime {
                        unsupported_long_size();
 
                IFaceTable *tbl = obj->info->concrete_IFaceTable;
-               unsigned long new_guid_first = *new_guid;
+               unsigned long new_guid_first = new_guid->l[0];
                
                // This doesn't use guids_equal(), as that would eliminate the
                // ability to cache the first word of new_guid.  The compiler
@@ -29,15 +28,15 @@ namespace RunTime {
                // behaves.
                
                while (true) {
-                       if (tbl->info->guid[0] == new_guid_first &&
-                           tbl->info->guid[1] == new_guid[1] &&
+                       if (tbl->info->guid->l[0] == new_guid_first &&
+                           tbl->info->guid->l[1] == new_guid->l[1] &&
                            (sizeof(long) == 8 ||
-                            (tbl->info->guid[2] == new_guid[2] &&
-                             tbl->info->guid[3] == new_guid[3])))
+                            (tbl->info->guid->l[2] == new_guid->l[2] &&
+                             tbl->info->guid->l[3] == new_guid->l[3])))
                                break;                          
 
                        tbl++;
-                       if (__builtin_expect(!tbl->info->guid, 0))
+                       if (__builtin_expect(!tbl->info->guid->l[0], 0))
                                return 0;
                }