Re: method calls and extra indirection
Gopal V <gopalv82-/[email protected]>
| Newsgroups | gmane.comp.gnu.dotgnu.developer |
|---|---|
| Message-ID | <[email protected]> |
> 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/