[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Pnet-developers] A question about verifier code
From: |
Rhys Weatherley |
Subject: |
Re: [Pnet-developers] A question about verifier code |
Date: |
Sun, 25 May 2003 20:56:38 +1000 |
User-agent: |
KMail/1.4.3 |
On Sunday 25 May 2003 06:42 pm, Gopal V wrote:
> Hi,
>
> case IL_OP_LDELEMA:
> {
> /* Load the address of an array element */
> if(STK_BINARY_1 == ILEngineType_O &&
> (STK_BINARY_2 == ILEngineType_I4 || STK_BINARY_2 == ILEngineType_I)
> &&
> (elemType = ArrayElementType(stack[stackSize - 2].typeInfo)) != 0)
> {
> classType = GetTypeToken(method, pc);
> if(classType &&
> (elemType == ILType_Void || ILTypeIdentical(elemType,
> classType)))
> {
> ILCoderArrayAccess(coder, opcode, STK_BINARY_2,
> classType);
>
> So why are we outputting the type of the elemType ?.. Shouldn't we be like
> outputting &elemType ? ... That seems to be what rectangular arrays are
> spitting out ..
The next two lines take care of creating "&elemType" in the stack:
stack[stackSize - 2].engineType = ILEngineType_M;
stack[stackSize - 2].typeInfo = classType;
A type "M" stack item is a managed pointer to "classType". The
ILCoderArrayAccess function is passed the LDELEMA opcode, which tells it to
generate an addressof operation rather than a value fetch.
> Which means that I ran into quite a few problems handling both cases..
> Any quick advice ?.
I'm not really sure that I understand what the problem is. If rank == 1, use
LDELEMA, otherwise use "::Address". The code looks fine to me. Do you have
a specific test case that demonstrates whatever problem it is that you're
seeing?
Cheers,
Rhys.