dotgnu-general
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [DotGNU]method calls and extra indirection


From: Gopal V
Subject: Re: [DotGNU]method calls and extra indirection
Date: Mon, 5 Apr 2004 00:27:00 -0700 (PDT)

> Now lets take the implemetation (eg):
> 
> VMCASE(COP_CALL_NATIVE_VOID):
> {
>  /* Call a native method that has no return value */
>  COPY_STATE_TO_THREAD();
>  FFI_CALL(CVM_ARG_PTR2(void *), CVM_ARG_PTR(void *),
> 0, nativeArgs);
>  RESTORE_STATE_FROM_THREAD();
>  pc = thread->pc;
>  MODIFY_PC_AND_STACK(CVM_LEN_PTR2, 0);
> }
> VMBREAK(COP_CALL_NATIVE_VOID);

Let us take the *real* implemntation in direct
threaded
code..

COP_CALL_NATIVE_VOID_label:
{

        do { thread->pc = pc; thread->frame = frame;
thread->stackTop = stacktop; thread->method = method;
} while (0);
        ffi_call((ffi_cif *)(((void *)((((void
**)(pc))[(2)])))), (void (*)())(((void *)((((void
**)(pc))[(1)])))), (void *)(0), (void
**)(nativeArgs));
        do { stacktop = thread->stackTop; frame =
thread->frame; stackmax = thread->stackLimit;
if(thread->thrownException != 0) { pc = thread->pc;
stacktop[0].ptrValue = thread->thrownException;
thread->thrownException = 0; stacktop += 1; goto
throwException; } } while (0);
        pc = thread->pc;
        do { pc += (((3) * sizeof(void *))); stacktop
+= (0); } while (0);
}
; goto **((void **)pc);


> Now my question is, why/what prevents you from
> declaring locals here (this
> specific example is a bit stupid)? I dont see this
> in any of the CASES.

It's not a switch case !... but just a scope .. which 
is exactly why gcc has a lot of trouble optimising it 
the way it should be done.

Also it's safer to do it in one scope level to prevent
someone from accidentally declaring the same variable
name lower down ... which overrides this ..

Gopal

__________________________________
Do you Yahoo!?
Yahoo! Small Business $15K Web Design Giveaway 
http://promotions.yahoo.com/design_giveaway/


reply via email to

[Prev in Thread] Current Thread [Next in Thread]