Summary: | TypeCode redesign | ||
---|---|---|---|
Product: | TAO | Reporter: | Nanbor Wang <bala> |
Component: | ORB | Assignee: | Ossama Othman <ossama.othman> |
Status: | RESOLVED FIXED | ||
Severity: | enhancement | CC: | bala, j.parsons |
Priority: | P2 | ||
Version: | 1.4 | ||
Hardware: | All | ||
OS: | All | ||
Bug Depends on: | 1369 | ||
Bug Blocks: | 550, 1803 |
Description
Nanbor Wang
2003-11-05 10:39:43 CST
Add dependency Accepting this I'll be taking over this work. Mine. Made subject more descriptive of the content. *** Bug 142 has been marked as a duplicate of this bug. *** No need for me to be on the CC list since this enhancement request is already assigned to me. Hopefully the new TypeCode classes will automatically fix bug 550 or render the bug obsolete. The TypeCode rewrite has finally been merged to the HEAD branch. However, the suggested approach above, which is the one used in the new implemenation, requires that the "Template Method" design pattern be used to allow the appropriate TypeCode method implementation to be bound at run-time. Unfortunately, this approach appears to be quite heavy. For example, tao/AnySeqA.o nearly doubled in size: pre-typecode-rewrite-merge ========================== $ size .shobj/AnySeqA.o text data bss dec hex filename 5401 88 144 5633 1601 .shobj/AnySeqA.o HEAD (as of today) ========================== $ size .shobj/AnySeqA.o text data bss dec hex filename 9810 544 164 10518 2916 .shobj/AnySeqA.o AFAICT, the new implementation is fairly lean source code-wise, meaning that it is likely the virtual tables may be the cause of the code bloat. Another cause may be the use of templates in the new implementation. However, quick experiments imply otherwise. It may be possible to subset the virtual tables, so to speak, by using a variation of the "Bridge" design pattern for each method in the CORBA::TypeCode interface. The idea is to only pay for virtual table entries for virtual methods specific to the TypeCode subclass. TAO-specific virtual methods, including the destructor, in the CORBA::TypeCode base class could then be entirely removed. Presumably this approach would reduce the vtable footprint penalty. It turns out the code bloat is infact related to the use of templates. By fully specializing the Alias<> and Sequence<> TypeCode subclasses, and dropping the template source includes (e.g. Alias_TypeCode.cpp) from their corresponding headers, I got a substantial reduction in footprint: pre-typecode-rewrite-merge ========================== $ size .shobj/AnySeqA.o text data bss dec hex filename 5401 88 144 5633 1601 .shobj/AnySeqA.o Current HEAD ============ ossama@void:~/work/head/ACE_wrappers/TAO/tao$ size .shobj/AnySeqA.o text data bss dec hex filename 9810 544 164 10518 2916 .shobj/AnySeqA.o Modified HEAD (code named "Hair Cut" :-)) ============= $ size .shobj/AnySeqA.o text data bss dec hex filename 4570 160 84 4814 12ce .shobj/AnySeqA.o As you can see, the footprint is slightly less than the pre-typecode-rewrite-merge code. TypeCode CDR extraction operations are not reflected in the HEAD branch numbers, so we may still take a hit in that case. I'd prefer not to specialize the templates so I'll see what I can dig up on alternatives to preventing the code bloat. Similar effects can be attained without specialization simply removing the template source includes (e.g. Alias_TypeCode.cpp) in the concrete TypeCode headers. The new TypeCode implementation is available in TAO 1.4.5. |