Proposal: Alias more powerful concurrency, and more powerful

DavidL davidl at 126.com
Sat Sep 22 18:09:51 PDT 2007


Daniel Keep Wrote:

> 
> I could be wrong, but I don't think any of this is even *remotely* possible.
> 
> What you're trying to do is access a piece of memory without having
> *any* idea where it is.  Consider your SEH example; there is simply no
> way for FilterFunc to know where func1.flag is.  Where that variable is
> stored depends entirely on what functions got called before it.  Hell,
> what if func1 has recursively called itself several times before calling
> FilterFunc?  What does the alias mean then?
> 
> What's more, look at how the code is structured; you call func1 from
> func, and then call into FilterFunc.  But by the time FilterFunc is
> called, func1's local state is no longer on the stack; it's more than
> likely been replaced by FilterFunc's own local state.
> 
> On a side note, I fail to see what this has to do with concurrency.
> 
> 	-- Daniel
char *p=cast(char*)0;

*p=0;  // this would possibly be generated to two lines of asm
          // the latter one which assign 0 to the target would trigger the
          // the exception. So for this level continue exception, we need
          // to make the temp address for accessing *p be updated not 
          // only p itself.
following illustrate the problem more clearly:
*p=0 could be:
 mov EAX, [p]
 mov byte ptr [EAX],0

So we need to update EAX not *p

workaround could be reexecute the whole statement again.
The infomation could be extracted from the debug build of an app. When an exception occurs. If the handler want to continue the execution , the handler would firstly need to find out the address of the exact begin of the statement address(this case is the address of 
mov EAX,[p];) After running some correctoin func, we go back to 
execute the whole statement again.

A little bit further:
auto myclass= new Class;
some one might argue that if an exception presents in the C-tor of a class, the memory is allocated, if you reexecute the whole statement 
then the block of memory is wasted. But the problem is when a user
want the power of manipulating the thrower code, he *should* be
well informed what kind of exceptions there might be, so he *should*
be on his own for this kind of specific problem.




More information about the Digitalmars-d mailing list