Bug 91831 - sharing gcc / UNO bridges code ...
Summary: sharing gcc / UNO bridges code ...
Status: NEW
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: sdk (show other bugs)
Version:
(earliest affected)
unspecified
Hardware: All All
: medium normal
Assignee: Not Assigned
URL:
Whiteboard:
Keywords: difficultyInteresting, easyHack, skillCpp, topicCleanup
Depends on:
Blocks: Dev-related
  Show dependency treegraph
 
Reported: 2015-06-03 13:15 UTC by Michael Meeks
Modified: 2021-08-09 20:47 UTC (History)
4 users (show)

See Also:
Crash report or crash signature:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Michael Meeks 2015-06-03 13:15:09 UTC
If you poke into bridges/ you can see that a ton of the gcc bridge code is horribly cut/paste.

We should hack the bridges/Library_cpp_uno.mk to link in a set of gcc_shared/ code - that isolates this into one place. This should then help eg. implement RTTI for Linux so that dynamic_cast<> works properly for bridged objects.

$ cd bridges
$ git grep initializeBlock

for example. At least these two guys should be shared.

sal_Size bridges::cpp_uno::shared::VtableFactory::getBlockSize(
    sal_Int32 slotCount)
{
    return (slotCount + 2) * sizeof (Slot) + slotCount * codeSnippetSize;
}

bridges::cpp_uno::shared::VtableFactory::Slot *
bridges::cpp_uno::shared::VtableFactory::initializeBlock(
    void * block, sal_Int32 slotCount, sal_Int32,
    typelib_InterfaceTypeDescription *)
{
    Slot * slots = mapBlockToVtable(block);
    slots[-2].fn = 0;
    slots[-1].fn = 0;
    return slots + slotCount;
}

I'd start by sharing only these two - and of course carefully checking that they are in fact copy/paste identical across all of the gcc backend/bridges =)

Thanks !
Comment 1 Stephan Bergmann 2015-06-04 07:19:25 UTC
Be /very/ careful here.  There may be some low-hanging fruit that are obvious candidates for consolidation, but there may also be subtle differences that are there for a reason.  Also, changes should ideally only be made if you can actually test the changed code, i.e., have access to each specific OS/hardware combination.
Comment 2 How can I remove my account? 2015-06-04 08:17:33 UTC
I agree strongly with Stephan. This is far from "difficultyBeginner". Do *not* touch code for an architecture you can't test yourself.
Comment 3 Robinson Tryon (qubit) 2015-12-14 07:02:57 UTC Comment hidden (obsolete)
Comment 4 Robinson Tryon (qubit) 2016-02-18 14:51:50 UTC Comment hidden (obsolete)
Comment 5 jani 2016-04-25 06:37:15 UTC
Please remark, the request for a way to test the changes (not with a debugger but automated). Patches need to include that part.