Runtime instrumentation of SystemC

706 Words2 Pages

2.3 Binary Layout and Compiler Dependencies When a call to a virtual function is made through a base class pointer (i.e. a late binding call), the compiler quietly inserts code to fetch the VTABLE pointer (VPTR) and look up the requested method address in the VTABLE, thus calling it and causing late binding to take place. All of this VTABLE setting up for each class, initializing the VPTR and inserting the code for the virtual function call, happens automatically. Figure 5 shows the binary layout of a tlm fw transport if object and how a b transport virtual method invocation using two different object pointers, is resolved from the point of view of Microsoft VC++ and GCC 4.1 compilers. This situation is more complex since two key object- oriented features, such as polymorphic calls and multiple inheritance, are used at the same time. For TLM2 interfaces the arrangement of both compilers is as follows: • Microsoft Visual C++ 2008 (VC) distributes the information on each inherited class by placing them one next to another. If an inherited class has virtual methods, a pointer to its particular VTABLE is included. Since each interface has only one virtual method, there are four VTABLEs with only one entry pointing to the particular implementation of each method. When a call is made through a base class pointer, tlm fw transport if *p fw in Figure 5, the pointer is adjusted to point to its specific VPTR and class data. This pointer modification is known as pointer fix-up. Finally, since each interface has only one method, the first entry of the current VTABLE (i.e. entry 0) is used to call the right method. • The GCC 4.1 compiler places information on all classes at the beginning of the object. Depending on the kind of pointer used to ... ... middle of paper ... ... up of the following methods: • b transport wrapper: The start address of this method is inserted into the corresponding VTABLE entry of the intercepted target socket. It just redirects the call to b transport processing. • b transport processing (virtual): This method implements the desired behaviour of the wrapper. The default implementation in the base class just calls b transport original path resulting in a pass-through mode. As it is declared virtual, this method is intended to be redefined in the derived class for specialized behaviour. • b transport original path: This method is used to call the original entry of the modified VTABLE in order to maintain the overall transaction path. The WIL class has four methods: • wil get fw interface: For internal use. This method gets the TLM2 forward interface pointer given the hierarchical SystemC name of the socket.

More about Runtime instrumentation of SystemC

Open Document