[Mono-dev] Porting mcs to IKVM.Reflection
Kornél Pál
kornelpal at gmail.com
Thu May 6 09:42:50 EDT 2010
Hi Marek,
Thank you for your reply.
I'm trying to keep differences minimal, and I have no intention to drop
System.Reflection support:
#if IKVM_REF_EMIT
using IKVM.Reflection;
using IKVM.Reflection.Emit;
using Type = IKVM.Reflection.Type;
#else
using System.Reflection;
using System.Reflection.Emit;
#endif
My other modifications are around hacks for overcoming limitations of
System.Reflection[.Emit] that make mcs depend on the Mono runtime, so
actually I'm just trying to make the code hack free.
My understanding is that basically we only have two compilers:
- static: mcs.exe, gmcs.exe, smcs.exe, dmcs.exe (for each profile)
- dynamic: Mono.CSharp.dll, that is used by Microsoft.CSharp.dll and
csharp.exe
As I see (based on your explanation) only the dynamic (as in the above
list) compiler is using MakeExpression methods that will have to use
System.Reflection anyway because they generate code that can be executed
without saving an assembly first that requires runtime support. Because
of conditional compilation and minimal code changes, having support for
both SRE implementations - in my opinion - is not (significantly)
increasing code maintenance requirements.
If the above assumptations are correct then all the MakeExpression
methods can safely be #if-ed out when building the static compilers and
thus there are no features that cannot be implemented by using
IKVM.Reflection. Is this correct?
Kornél
Marek Safar wrote:
> Hi Kornél
>> Can you please tell when are MakeExpression methods used and whether
>> are they required for code generation by mcs? The problem is that SLE
>> MakeExpression methods require System.Reflection types. I was unable
>> to find out when are MakeExpression methods used so I cannot come up
>> with a solution.
>>
> MakeExpression is used by dynamic C# compiler for dynamic code
> generation. MakeExpression uses System.Type type-system and always will,
> therefore gmcs must work with System.Type. You can browse
> /mcs/class/Microsoft.CSharp for more details.
>
> Marek
>
More information about the Mono-devel-list
mailing list