blog




  • Essay / SystemC Runtime Instrumentation - 706

    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 bind call) , the compiler silently inserts code to retrieve the VTABLE pointer (VPTR) and look up the address of the requested method in the VTABLE, thereby calling it and causing late binding. All this configuration of VTABLE for each class, the initialization of the VPTR and the insertion of the code for the virtual function call, is done automatically. Figure 5 shows the binary layout of a tlm fw transport if object and how invoking the ab transport virtual method using two different object pointers is resolved from the perspective of the 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 layout of the two compilers is as follows: • Microsoft Visual C++ 2008 (VC) distributes information about each inherited class by placing them next to each other. 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 a single 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 modification of the pointer is known as pointer correction. Finally, since each interface has only one method, the first entry in the current VTABLE (i.e. entry 0) is used to call the correct method. • The GCC 4.1 compiler places information about all classes at the beginning of the object. Depending on the type of pointer used to ...... middle of paper ...... among the following methods: • b transport wrapper: the start address of this method is inserted into the corresponding VTABLE entry of the message intercepted. target grip. It simply redirects the call to transport processing b. • Transport processing b (virtual): This method implements the desired behavior of the wrapper. The default implementation in the base class simply calls the original transport path b, resulting in a pass-through mode. As it is declared virtual, this method is intended to be redefined in the derived class for specialized behavior. • b transport original path: This method allows you to call the original entry of the modified VTABLE in order to preserve the global path of the transaction. The WIL class has four methods: • wil get fw interface: for internal use. This method gets the TLM2 direct interface pointer based on the SystemC hierarchical name of the socket.