Right, Srihari.  If you go back and read the thread from the top (it's very
long, now, you can be forgiven :) you'll see this has been our driving
assumption -- that the JIT compiler would have to do some static analysis
on the call-tree, to ensure that the struct's members are accessed in a
read-only fashion.

As long as all the code is verifiable (ie: don't use the C# 'unsafe'
keyword) this kind of thing is possible.

I think the conclusion is that this opt would be a very obscure corner-case
scenario, if not for the DirectX APIs cited, and not ordinarily worth
spending valuable JIT cycles on.

Now, the DX team obviously cares about performance -- it'll be very
interesting to see where this goes.  Either a change in API, or a big
enhancement to the JIT... maybe an additional metadata flag (const? ;) on
method params, to give the JIT a hint that the arg is not modified...

-S

On Fri, 21 May 2004 22:52:38 -0400, Srihari Angaluri <[EMAIL PROTECTED]
SOFTTECH.COM> wrote:

>Doesn't it alter the whole semantics of value types if the implementation
>is allowed to do "hidden" optimizations like these? For example, if the
>compiler passes the struct by reference after a threshold size (let's say
>more than 1MB), any modifications I make to the structure inside the method
>will alter the actual parameter passed to the method, right? That clearly
>is inconsitent with the semantics of value types..
>
>Srihari
>
>===================================
>This list is hosted by DevelopMentorŪ  http://www.develop.com
>Some .NET courses you may be interested in:
>
>NEW! Guerrilla ASP.NET, 17 May 2004, in Los Angeles
>http://www.develop.com/courses/gaspdotnetls
>
>View archives and manage your subscription(s) at http://discuss.develop.com
===================================
This list is hosted by DevelopMentorŪ  http://www.develop.com
Some .NET courses you may be interested in:

NEW! Guerrilla ASP.NET, 17 May 2004, in Los Angeles
http://www.develop.com/courses/gaspdotnetls

View archives and manage your subscription(s) at http://discuss.develop.com

Reply via email to