Re: ECMA Wrong - Class and Object Initialization Rules - Help!
- From: "Matt Grice [MSFT]" <mgrice@xxxxxxxxxxxxx>
- Date: Wed, 20 Apr 2005 11:27:13 -0700
'Initialization' in this context has only to do with the state of the
object, specifically the state of whether constructors have been called.
Your recursive example is verifiable because it will never return without
calling the base class constructor. Of course, it will never return,
period.
The 'uninitialized this on entering a try block' restriction is implemented
in PEVerify and the x64 & Itanium JIT verifiers for Whidbey Beta2. I
believe it is being considered for inclusion in ECMA.
"George" <George@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:D0D8921D-3CA7-45B9-9DC4-9426F19B370F@xxxxxxxxxxxxxxxx
> Hi,
>
> ECMA states in Section 1.8.1.4 (Partition III) on Class and Object
> Initialization Rules:
>
> "An object constructor shall not return unless a constructor for the base
> class or a different construct for the object's class has been called on
> the
> newly constructed object. The verification algorithm shall treat the this
> pointer as uninitialized unless the base class constructor has been
> called."
>
> This means in particular that, if a .ctor didn't invoke a base class .ctor
> but another .ctor of the same class, then the "this" pointer is not
> initialized. For example, class A has 2 .ctors that invoke eachother:
> recursive constructor invocation is allowed at the bytecode level!
>
> BUT, the examples I tried show that the "this" pointer is initialized even
> after invoking another .ctor of the same class - for example I can load
> the
> "this" into a local variable.
>
> SO, it seems to me that the "this" is considered initialized also after
> invoking a ctor of the same class and NOT ONLY a ctor of the base class!
>
> ====================================
>
> There is another issue which is not clear.
>
> Looking in the ROTOR source, I found the following commented idea:
>
> "If there are any locals (or arg slot 0) containing uninit vars, it is
> illegal to be in a try block."
>
> This corresponds to error "VER_E_THIS_UNINIT_EXCEP" "Uninitialized this on
> entering a try block"
>
> Beside the fact that this is not documented in ECMA, I cannot have it
> confirmed by examples.
>
> Is this verification error still checked in the current version of the
> verifier?
>
> Many thanks for any help!
>
> George
.
- Follow-Ups:
- References:
- Prev by Date: Re: Windows Service
- Next by Date: Re: ECMA Wrong - Class and Object Initialization Rules - Help!
- Previous by thread: Re: ECMA Wrong - Class and Object Initialization Rules - Help!
- Next by thread: Re: ECMA Wrong - Class and Object Initialization Rules - Help!
- Index(es):
Relevant Pages
|