Re: Modified Proposal for Context Sensitive Function Calls


Subject: Re: Modified Proposal for Context Sensitive Function Calls
From: Bassam Tabbara (bassam@novas.com)
Date: Wed Nov 20 2002 - 10:56:37 PST


John and Kevin,

What I meant to touch on in my earlier email just now requesting clarification from Kevin is that it is not clear to me all the trade-offs are clearly stated in either approach. For example, John's approach needs less of motivation if we stick with SV/Verilog calls C function and to differentiate instances gives user a "workarea" per instance. 

Metrics to evaluate the tradeoff are -not just- "efficiency" (here I think Kev is focusing on face value only...), other things include memory, and I would argue "user visibility", and "understanding", "usability" (e.g. I can use workarea for other things, so we probably need to keep that, might as well use it...). On the down side of John's for example is that we are opening up the PLI/VPI and we had bypassed that part altogether, now it seems a crucial infrastructure here ...

Again, if you guys can endeavor to do a side-by-side comparison/motivation for next time would be great.



-Bassam.

"Stickley, John" wrote:

Kevin,

Kevin Cameron wrote:

>  I'm afraid I have to disagree. Since your scheme has a single C-to-SV
> entry-point per module, and mine can create an entry-point per instance
> there is no way that your scheme will be as fast - it always has to decode
> the instance on each call.
>
> To get the same/better efficiency with your approach you would have to
>
> add the instance name to the export statement.
>
> There is still no way to check that arguments match if you just link by
>
> C name.

I kind of see what you're saying here but it is unclear to me why
any implementor would want to create a distinct fragment of code
for each call instance. The only thing you would gain is to be able to
make the pointer to the internal data structure associated with
that instance an "immediate" argument of some assembly instruction
which would be of little added value.

Am I missing something ?  Even pure C++ with all its efficiency
only has one copy of code in a method that reused with all
caller sites and instantiations of its containing class.

In my view, calling the SV function with a pre-determined context
pointer is equivalent to calling a C++ method with a passed in "this"
pointer which is always what is implicity done in the code that
is compiled for a statement such as,

     myInstance->myClassMethod( args ... );

What's really happening behind the scenes is that the C++
compiler generates code that makes a function call like this:

     _myClassMethod( myInstance, args ... )

-- johnS

> Kev.
> --
> National Semiconductor, Tel: (408) 721 3251
> 2900 Semiconductor Drive, Mail Stop D3-500, Santa Clara, CA 95052-8090
>
>

--

This email may contain material that is confidential, privileged
and/or attorney work product for the sole use of the intended
recipient.  Any review, reliance or distribution by others or
forwarding without express permission is strictly prohibited.
If you are not the intended recipient, please contact the sender
and delete all copies.
                                                           __
                       ______                             |  \
______________________/      \__                         /    \
                                \       H  Dome      ___/     |
John Stickley                 E |       a  __    ___/  /       \____
Principal Engineer            l |       l  | \  /
Verification Solutions Group    |       f  |  \/     ____
Mentor Graphics Corp. - MED   C \         --  /     /
17 E. Cedar Place             a  \     __/   /     /
Ramsey, NJ  07446             p  |    /        ___/
                                 |   /        /
mailto:John_Stickley@mentor.com  \           /
Phone: (201)818-2585              \         /
                                   ---------

-- 
Dr. Bassam Tabbara
Technical Manager, R&D

Novas Software, Inc.
bassam@novas.com
(408) 467-7893
 



This archive was generated by hypermail 2b28 : Wed Nov 20 2002 - 10:57:03 PST