Section 5.6.5 Rules for DPI function call nesting

From: Per Bojsen <per.bojsen_at_.....>
Date: Thu Dec 14 2006 - 06:38:49 PST
Hi,

the last paragraph of Section 5.6.5 states:

   SCE-MI 2 does not support recursion. Recursion occurs for example
   when exported function called from imported function calls the
   same imported function initiating the call. This will result in
   creating an infinite loop.

I disagree with the last sentence.  Recursion does not in general
lead to infinite loops.  It is true that an infinite loop could
occur, but it does not always occur.

Also, just above this paragraph the text states:

   Supporting more that one level of nesting is allowed by
   SystemVerilog DPI but considered undefined in SCE-MI 2 meaning
   it can results in correct behavior, undefined behavior or an error.

So here we state that more than one level of nesting is
considered undefined by SCE-MI 2, yet the paragraph immediately
following talks about something that is at least 2-level
nesting, i.e., imported function calling exported function
calling imported function.  I don't think we can have our
cake and eat it too :-)

   SCE-MI 2 compliant implementations should report an error
   upon encountering recursion.

This is the last sentence of the last paragraph.  I think this
could be difficult to implement.  Not considering the fact
that we defined more than 1 level of nesting to be undefined,
recursion can happen with an arbitrary number of intermediate
levels of nesting.  To check that some function that has just
been entered is a descendent of another instance of itself
in the call chain would be potentially complicated and would
also lead to a performance hit as you can only do this check
dynamically.  Sure, you can do some things statically, but
that will only catch a subset of the cases.

Ok, now I'm curios: Again, not considering that we've declared
2-level nesting undefined, why do we even want to prohibit
recursion in the first place?

Per
Received on Thu Dec 14 06:42:26 2006

This archive was generated by hypermail 2.1.8 : Thu Dec 14 2006 - 06:42:29 PST