-----------------------------------------------------------
New Message on BDOTNET
-----------------------------------------------------------
From: KGK
Message 1 in Discussion
Hello Group! Rotor, Microsoft's Shared Source CLI implementation, is a great way to
understand
how the .NET framework works internally. And with its availability under the shared
source license, its a great way to modify and tinker with it, and see how it behaves.
I have been working with it, and have successfully extended it, by implementing
a new "exponential" operator into the Rotor's runtime. The operator, represented
by the "exp" opcode in IL: 1) is available to all languages targetting the Rotor's
CLI implementation
2) is type-verifiable by the JITter
3) is cross-platform and available across all platforms where Rotor can run
4) is identified by ILDASM/ILASM
5) is verifiable by tools like PEVerify I am yet to build support for the shared
source C# compiler to support it natively
like "extended" Rotor does. But here's the source code of an IL program which runs
perfect under the extended Rotor:
.assembly extern mscorlib
{
.publickeytoken = (B7 7A 5C 56 19 34 E0 89 ) // .z\V.4..
.ver 1:0:3300:0
}
.assembly TestExp
{
// --- The following custom attribute is added automatically, do not uncomment
-------
// .custom instance void
[mscorlib]System.Diagnostics.DebuggableAttribute::.ctor(bool,
//
bool) = ( 01 00 00 01 00 00 )
.hash algorithm 0x00008004
.ver 0:0:0:0
}
.module TestExp.exe
// MVID: {e9b39fad-73fb-2f52-93c5-a2381a07b760}
.imagebase 0x00400000
.subsystem 0x00000003
.file alignment 512
.corflags 0x00000001
// Image base: 0x06eb0000
//
// ============== CLASS STRUCTURE DECLARATION ==================
//
.class public auto ansi beforefieldinit CTestExp
extends [mscorlib]System.Object
{
} // end of class CTestExp
// =============================================================
// =============== GLOBAL FIELDS AND METHODS ===================
// =============================================================
// =============== CLASS MEMBERS DECLARATION ===================
// note that class flags, 'extends' and 'implements' clauses
// are provided here for information only .class public auto ansi
beforefieldinit CTestExp
extends [mscorlib]System.Object
{
.method public hidebysig static void Main() cil managed
{
.entrypoint
// Code size 41 (0x29)
.maxstack 2
.locals init (float64 V_0,
float64 V_1,
float64 V_2)
IL_0000: ldc.r8 2.
IL_0009: stloc.0
IL_000a: ldc.r8 3.
IL_0013: stloc.1
IL_0014: ldloc.0
IL_0015: ldloc.1
IL_0016: exp
IL_0017: stloc.2
IL_0018: ldstr "K={0}"
IL_001d: ldloc.2
IL_001e: box [mscorlib]System.Double
IL_0023: call void [mscorlib]System.Console::WriteLine(string,
object)
IL_0028: ret
} // end of method CTestExp::Main .method public hidebysig specialname
rtspecialname
instance void .ctor() cil managed
{
// Code size 7 (0x7)
.maxstack 1
IL_0000: ldarg.0
IL_0001: call instance void [mscorlib]System.Object::.ctor()
IL_0006: ret
} // end of method CTestExp::.ctor } // end of class CTestExp
In the above example, it accurately displays the result 8, raising 2 to the power 3.
I look forward to share the source code of the extended Rotor with you, and maybe
we can further enhance Rotor and in the process, understand .NET Framework better.
This is probably the first of its kind thing for any UG in India.... :-) Cheers to
that! Cheers :)
Gaurav
-----------------------------------------------------------
To stop getting this e-mail, or change how often it arrives, go to your E-mail
Settings.
http://groups.msn.com/bdotnet/_emailsettings.msnw
Need help? If you've forgotten your password, please go to Passport Member Services.
http://groups.msn.com/_passportredir.msnw?ppmprop=help
For other questions or feedback, go to our Contact Us page.
http://groups.msn.com/contact
If you do not want to receive future e-mail from this MSN group, or if you received
this message by mistake, please click the "Remove" link below. On the pre-addressed
e-mail message that opens, simply click "Send". Your e-mail address will be deleted
from this group's mailing list.
mailto:[EMAIL PROTECTED]