[Mono-bugs] [Bug 442122] New: Better handling of read-only method variables which appear in closures.
bugzilla_noreply at novell.com
bugzilla_noreply at novell.com
Wed Nov 5 20:44:03 EST 2008
https://bugzilla.novell.com/show_bug.cgi?id=442122
Summary: Better handling of read-only method variables which
appear in closures.
Product: Mono: Compilers
Version: 2.0
Platform: Other
OS/Version: Other
Status: NEW
Severity: Enhancement
Priority: P5 - None
Component: C#
AssignedTo: mono-bugs at lists.ximian.com
ReportedBy: lunchtimemama at gmail.com
QAContact: mono-bugs at lists.ximian.com
Found By: ---
Test Case:
void Foo(int i)
{
DoSomethingWithADelagate (() => i != 5);
DoSomethindWithAnInt (i);
}
Observed Behaviour:
The compiler passes the captured value to DoSomethindWithAnInt. This involves
two IL instructions: ldloc (to load the instance of the compiler-generated
class) and ldfld (to load the captured value).
Expected Behaviour:
Because the argument is never assigned to or used as an out or ref parameter,
it is guaranteed not to change. The compiler should load the argument value
directly with a single ldarg instruction. The same could be done with local
variables that are not assigned to within or after their appearance in an
anonymous method.
Side Note: csc does not have this optimization.
--
Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA contact for the bug.
You are the assignee for the bug.
More information about the mono-bugs
mailing list