Subject: Re: Modified Proposal for Context Sensitive Function Calls
From: Stickley, John (john_stickley@mentorg.com)
Date: Tue Nov 19 2002 - 18:36:52 PST
Kevin,
Kevin Cameron x3251 wrote:
Your approach solves this problem, however I think a more elegant
way to solve it is, rather than to use dynamic binding as you suggest,
to have a globally scoped "C name" indication as part of the the
export declaration. This would be more consistent with the global
scoping used counterpart extern declarations for the SV-to-C
direction as was outlined by Andrezj today.
That still suffers from the inefficiency that you have one "C" name
for multiple (distinct) instances of the task/function, so you need
an extra level of indirection to get to the actual task or function.
Calculating the indirection may be nontrivial, so it is prefereable
to do it just once (as with the dynamic binding) rather than on
every call.
I'll take efficiency over elegance :-)
The dynamic binding mechanisms are also less dependent on the linker's
capabilities, avoid C name clashes entirely, and also allow checking
that the arguments match up (which C linking doesn't).
I'm OK with the "export ... <module>::<function>" syntax (I used that
in the earlier e-mail proposal).
Kev.
I think either approach can be implemented equally as efficiently.
If I were going to implement the C-to-SV capability I would have my
tool compiler generate a highly efficient, pre-compiled code wrapper
stubs
with the proper C names for each required (exported) function, along
with a
header file containing the function prototypes of the stubs that the
user could
include in his or her code.
Now by merely calling the stub function and passing the context
pointer your code will execute just as efficiently as calling the
dynamically
bound function pointer to the stub function.
-- johnS
__
______ | \
______________________/ \__ / \
\ 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 <mailto:John_Stickley@mentor.com> \
/
Phone: (201)818-2585 \ /
---------
This archive was generated by hypermail 2b28 : Tue Nov 19 2002 - 18:40:38 PST