Subject: Re: [sv-cc] DPI context - setting/preserving&resetting a scope
From: Andrzej Litwiniuk (Andrzej.Litwiniuk@synopsys.com)
Date: Fri Mar 14 2003 - 12:44:00 PST
Hi Michael,
Thanks for catching my mistake in my cooked-up scenario!
> > Consider the folowing sequence of DPI calls (interleaved context and
> > non-context functions):
> > SV --> context_cfunc1 --> SV --> non_context_cfunc2 --> SV
> >
> > The scope set at the call of context_cfunc1 is preserved and that way
> > still avaialble while non_context_cfunc2 is executed; we don't want
> > to do anything with a scope (overhead!) for non-context calls, do we?
> Calling SV from a non-context function is considered illegal and the result is therefore undefined.
Right! A call 'non_context_cfunc2 --> SV' is of course illegal and therefore
any weird behaviour may happen.
I was very concerned with one part of the specification of svScope svGetScope():
"Returns NULL if invoked from within a non-context function".
I was wondering whether this can be (efficiently) supported and this is how I
came to that cooked-up call chain. For the sake of performance the calls
of "regular" external functions (i.e. non-context) will not be instrumented;
specifically, there will be no additional code for resetting the current context.
Thus a non-context function will simply inherit the most recently set scope.
I have no problem with this. It cannot be claimed, however, that svGetScope()
will return NULL if called from a non-context function, although it can be
claimed that it will return NULL if called from a call chain that does not start with a context function. This is my main point.
Thanks and regards,
Andrzej
This archive was generated by hypermail 2b28 : Fri Mar 14 2003 - 12:44:57 PST