]> git.buserror.net Git - polintos/scott/priv.git/commitdiff
Some weak symbol usage, and some marshalling stuff.
authorScott Wood <scottwood@freescale.com>
Sun, 28 Oct 2007 20:30:15 +0000 (15:30 -0500)
committerScott Wood <scottwood@freescale.com>
Sun, 28 Oct 2007 20:30:15 +0000 (15:30 -0500)
doc/abi/x86
doc/orb/parameter-info-block
idlcomp/TODO
idlcomp/languages/c++/c++.h
idlcomp/languages/c++/interface-caller.cc
idlcomp/languages/c++/main.cc
idlcomp/languages/c++/marshall.cc
include/c++/orb.h

index 7f3de369192025ad0570c4cac8880f7c94f05e0f..1f9dbef6a1c6ea93e3bd70ce6f65f4e8ee9f2d5c 100644 (file)
@@ -29,23 +29,3 @@ Out-of-Process Method Invocation:
       eax: pointer to exception, or NULL if none
       edx: length of exception segment, if any
       ebx, esi, edi, ebp, esp: may be clobbered
       eax: pointer to exception, or NULL if none
       edx: length of exception segment, if any
       ebx, esi, edi, ebp, esp: may be clobbered
-
-Object registration:
-       eax: number of objects to register with initial refcount 1
-       edx: pointer to list of NewObject structs
-       
-       Call the 32-bit address stored at 0x7fff0008.
-       
-       Upon return:
-       eax: pointer to exception, or NULL if none
-       edx: length of exception segment, if any
-
-GUID SHA-1 hash retrieval:
-       eax: object id
-       edx: 20-byte buffer
-       
-       Call the 32-bit address stored at 0x7fff000c.
-       
-       Upon return:
-       eax: pointer to exception, or NULL if none
-       edx: length of exception segment, if any
index b868a4474a0a7dcc6070fb7d6f9751716d6d3d38..a61c6485114274e93fb7ac2f52970d31118573ef 100644 (file)
@@ -24,9 +24,9 @@ Parameter Info Block (PIB)
       This is like buffer_size, but for Copy segments.
 
    objlist_ptr     pointer Pointer to the object list
       This is like buffer_size, but for Copy segments.
 
    objlist_ptr     pointer Pointer to the object list
-       newobj_ptr      pointer Pointer to the new object list.
+   newobj_ptr      pointer Pointer to the new object list.
    objlist_len     32-bit  Length of the object list, in IDs
    objlist_len     32-bit  Length of the object list, in IDs
-       newobj_len      32-bit  Length of the new object list.
+   newobj_len      32-bit  Length of the new object list.
 
       The object list is a special segment that contains object IDs
       rather than arbitrary data.  Each object ID will be translated
 
       The object list is a special segment that contains object IDs
       rather than arbitrary data.  Each object ID will be translated
@@ -35,12 +35,10 @@ Parameter Info Block (PIB)
       regardless of the pointer size.  The first object in the list
       is the object to receive the message.
 
       regardless of the pointer size.  The first object in the list
       is the object to receive the message.
 
-               Objects which live in this address space have the high bit
-               clear; remote objects have the high bit set.  When sending
-               an object reference that has not been exposed to the kernel
-               before, its interface hash should exist in the newobj list.
-
-               
+      Objects which live in this address space have the high bit
+      clear; remote objects have the high bit set.  When sending
+      an object reference that has not been exposed to the kernel
+      before, its interface hash should exist in the newobj list.
 
    num_segments    32-bit  Number of data segments
 
 
    num_segments    32-bit  Number of data segments
 
index fa745f281c2bda40c5b0f71534de2622b89d13e3..772984b783256f8e31a7777fd26a3fce47e1aee7 100644 (file)
@@ -26,12 +26,6 @@ Properties with automatic getters and setters (or just getters if
 read-only), which can be overridden with custom getters and setters
 in the class.
 
 read-only), which can be overridden with custom getters and setters
 in the class.
 
-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.
-
 Implement marshalling/unmarshalling stubs.
 
 Implement async methods.
 Implement marshalling/unmarshalling stubs.
 
 Implement async methods.
@@ -50,3 +44,6 @@ 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.
 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.
+
+Use linker section garbage collection to discard GUIDs, vtables, etc. for
+interfaces/vstructs that aren't referenced.
index a8fb246821ea3c025d8c43d6bfd5dfc02041a665..ba7e769277b75ae91fe2ae1a4f56ca79df98d4f7 100644 (file)
@@ -54,6 +54,10 @@ class CPPFile : public LangCallback {
        // The implementation is delayed to avoid circular dependency problems.
 
        void output_casts(Interface *sym);
        // The implementation is delayed to avoid circular dependency problems.
 
        void output_casts(Interface *sym);
+       
+       //// Marshalling methods
+       
+       void output_marshall(Struct *sym, int pass);
 
        // Output the downcast and implicit upcast methods for
        // the given interface/superinterface pair.
 
        // Output the downcast and implicit upcast methods for
        // the given interface/superinterface pair.
index 2d8c51d4f91badc4a7e38d73ebf4a7a2923d13aa..0f0d139985d53d771ee143fe43fdc0f4a6a89298 100644 (file)
@@ -260,7 +260,8 @@ void CPPFile::output_internal(Interface *iface)
 
 void CPPFile::output_downcast_proto(Interface *iface, Interface *super)
 {
 
 void CPPFile::output_downcast_proto(Interface *iface, Interface *super)
 {
-       file << '\n' << indent << "static inline " << **iface->name << " downcast(";
+       file << '\n' << indent << "static __attribute__((weak)) inline "
+            << **iface->name << " downcast(";
        cpp_output_type(file, super, false, false);
        file << "oldptr);\n";
 }
        cpp_output_type(file, super, false, false);
        file << "oldptr);\n";
 }
index 8fb4b7259dd1f23351f7be5e1109ab33157167eb..57f94556bb594a17bee0a493c64c88731ab98704 100644 (file)
@@ -385,7 +385,7 @@ void CPPFile::output_guid(const uint64_t *guid64)
        const unsigned char *guid = reinterpret_cast<const unsigned char *>(guid64);
        char guidhex[7];
        
        const unsigned char *guid = reinterpret_cast<const unsigned char *>(guid64);
        char guidhex[7];
        
-       file << indent << "static const __attribute__((unused))\n"
+       file << indent << "__attribute__((weak))\n"
             << indent << "::System::RunTime::GUID _guid = {\n"
             << indent << "\t{ ";
        
             << indent << "::System::RunTime::GUID _guid = {\n"
             << indent << "\t{ ";
        
@@ -459,8 +459,8 @@ void CPPFile::output_vstruct_info(Struct *sym)
 {
        all_ns_in(sym, true, "VINFO_");
 
 {
        all_ns_in(sym, true, "VINFO_");
 
-       file << indent << "static const __attribute__((unused)) "
-                         "unsigned long *const _guids[] = {\n";
+       file << indent << "__attribute__((weak)) "
+                         "unsigned long * _guids[] = {\n";
        
        stack<StructRef> supers;
        sym->chainlen = 0;
        
        stack<StructRef> supers;
        sym->chainlen = 0;
@@ -480,12 +480,10 @@ void CPPFile::output_vstruct_info(Struct *sym)
        }
 
        file << indent << "};\n\n"
        }
 
        file << indent << "};\n\n"
-            << indent << "static const __attribute__((unused)) "
+            << indent << "__attribute__((weak)) "
                          "::System::RunTime::VStructInfo _info = {\n"
             << indent << "\t_guids, " << sym->chainlen << ",\n"
                          "::System::RunTime::VStructInfo _info = {\n"
             << indent << "\t_guids, " << sym->chainlen << ",\n"
-#if 0
-            << indent << "\t_marshall, _unmarshall,\n"
-#endif
+//          << indent << "\t_marshall, _unmarshall,\n"
             << indent << "};\n";
 
        
             << indent << "};\n";
 
        
@@ -521,7 +519,7 @@ void CPPFile::output_vstruct_main(Struct *sym)
 
        if (super)
                file << '\n'
 
        if (super)
                file << '\n'
-                    << indent << "static " << name << " *downcast(::System::VStruct *base)\n"
+                    << indent << "static __attribute__((weak)) " << name << " *downcast(::System::VStruct *base)\n"
                     << indent << "{\n"
                     << indent << "\tif (!base)\n"
                     << indent << "\t\treturn NULL;\n\n"
                     << indent << "{\n"
                     << indent << "\tif (!base)\n"
                     << indent << "\t\treturn NULL;\n\n"
@@ -642,9 +640,13 @@ void CPPFile::output(Struct *sym, int pass, void *arg2)
                                output_nsdecl_begin(sym);
                                output_nsdecl_children(sym);
                                output_guid(sym->def.guid);
                                output_nsdecl_begin(sym);
                                output_nsdecl_children(sym);
                                output_guid(sym->def.guid);
+                               output_marshall(sym, trav_nsdecl);
                                output_nsdecl_end(sym);
                        } else {
                                output_nsdecl_end(sym);
                        } else {
-                               output_nsdecl(sym);
+                               output_nsdecl_begin(sym);
+                               output_nsdecl_children(sym);
+                               output_marshall(sym, trav_nsdecl);
+                               output_nsdecl_end(sym);
                        }
 
                        break;
                        }
 
                        break;
index 8425ddd3aa312b8b97a02cc9b4d199f8a561fb75..6deb115ad7f2842a10c7a6accc6db0356456d7f2 100644 (file)
@@ -25,7 +25,7 @@ void CPPFile::output_ifaceinfo(Interface *iface)
             << indent << "             int nsegs);\n\n";
 #endif
 
             << indent << "             int nsegs);\n\n";
 #endif
 
-       file << indent << "static const __attribute__((unused))\n"
+       file << indent << "__attribute__((weak)) __attribute__((unused))\n"
             << indent << "::System::RunTime::IFaceInfo _info = {\n"
             << indent << "\t&_guid,\n"
             << indent << "};\n";
             << indent << "::System::RunTime::IFaceInfo _info = {\n"
             << indent << "\t&_guid,\n"
             << indent << "};\n";
@@ -33,8 +33,24 @@ void CPPFile::output_ifaceinfo(Interface *iface)
        do_extra_newline = true;
 }
 
        do_extra_newline = true;
 }
 
-void CPPFile::output_marshall(Struct *sym)
+void CPPFile::output_marshall(Struct *sym, int pass)
 {
 {
-       file << indent;
-       
+       switch (pass) {
+               case trav_nsdecl:
+                       extra_newline();
+                       
+                       file << indent << "int _marshall(::System::RunTime::GrowableArray<uint8_t> &buf,\n"
+                            << indent << "              ::System::RunTime::GrowableArray< ::System::RunTime::ID> &objlist,\n"
+                            << indent << "              ::System::RunTime::GrowableArray< ::System::RunTime::NewObject> &newobjlist,\n"
+                            << indent << "              ::System::RunTime::ParamInfoBlock::Segment *segs,\n"
+                            << indent << "              int nsegs);\n";
+
+                       file << indent << "void _unmarshall(::System::RunTime::Array<uint8_t> buf,\n"
+                            << indent << "                 ::System::RunTime::Array< ::System::_i_Object *> objlist,\n"
+                            << indent << "                 ::System::RunTime::ParamInfoBlock::Segment *segs,\n"
+                            << indent << "                 int nsegs);\n";
+
+                       do_extra_newline = true;
+                       break;
+       }
 }
 }
index a20f44d8aebc6be9f994f5c813b20fbe5cdec05e..1f1a3e6f6588586d69caec87fd0976ff6571c783 100644 (file)
@@ -391,6 +391,12 @@ namespace System {
                                       int nsegs);
                        ::System::_i_Object *(*wrapper)(ID id);
                };
                                       int nsegs);
                        ::System::_i_Object *(*wrapper)(ID id);
                };
+               
+               struct NewObject {
+                       uint32_t guid_hash[5]; // SHA-1 hash of Interface GUIDs
+                       uint32_t id;
+                       uint32_t reserved[3]; // must be zero
+               };
 
                struct VStructInfo {
                        // List of GUIDs of the struct and its superstructs,
 
                struct VStructInfo {
                        // List of GUIDs of the struct and its superstructs,
@@ -405,10 +411,11 @@ namespace System {
 
                        int (*marshall)(GrowableArray<uint8_t> &buf,
                                        GrowableArray<ID> &objlist,
 
                        int (*marshall)(GrowableArray<uint8_t> &buf,
                                        GrowableArray<ID> &objlist,
+                                       GrowableArray<NewObject> &newobjlist,
                                        ParamInfoBlock::Segment *segs,
                                        int nsegs);
                        void (*unmarshall)(Array<uint8_t> buf,
                                        ParamInfoBlock::Segment *segs,
                                        int nsegs);
                        void (*unmarshall)(Array<uint8_t> buf,
-                                          Array<ID> objlist,
+                                          Array< ::System::_i_Object *> objlist,
                                           ParamInfoBlock::Segment *segs,
                                           int nsegs);
                };
                                           ParamInfoBlock::Segment *segs,
                                           int nsegs);
                };