[Mono-dev] (Delegate) Trampoline executed twice?
mabra at manfbraun.de
mabra at manfbraun.de
Mon Dec 6 12:38:12 EST 2010
Hi !
Sorry for my TOO FAST MAIL ;-)
I have never seen Trampoline and so, not completely
understood the problem .....
If the shown code is generated, I would not know why
and it looks wrong to me.
br++mabra
-----Original Message-----
From: mono-devel-list-bounces at lists.ximian.com
[mailto:mono-devel-list-bounces at lists.ximian.com] On Behalf Of Martin
Däumler
Sent: Monday, December 06, 2010 5:06 PM
To: mono-devel-list at lists.ximian.com
Subject: [Mono-dev] (Delegate) Trampoline executed twice?
Hello,
I currently try to modify Mono (based on 2.6.1) to write C#
applications that meet soft real-time constraints. I want to do
a pre-JIT compilation of nearly all methods and a pre-execution
of most trampoline code.
Look at following snippet that starts a new thread:
ThreadStart ts = new ThreadStart(mToCall);
ts.Invoke();
Thread t = new Thread(ts);
t.Start();
The delegate trampoline of the ThreadStart object "ts" is executed
first through "ts.Invoke()". However, it is executed a second
time through "t.Start()".
Q#1: There are other trampoline types which might be called twice
for the same "object" it handles (in particular trampolines that are
expected to be called only once)? Which situations are relevant?
In order to pre-execute delegate trampolines we modified the code
generator so that it inserts a delegate calling sequence right
after the constructor call. This delegate call returns to the caller
instead to the callee. So, trampoline execution is shifted from
delegate invoke to delegate initialization. We modified the code
for the common case where a "CEE_LDFTN" followed by a "CEE_NEWOBJ"
CIL instruction is found in the assembly.
Q#2: There might be another situation where a call to a
delegate constructor is emitted by Mono's code generator?
If anybody needs more information, don't be afraid to ask.
With kind regard,
Martin Däumler
_______________________________________________
Mono-devel-list mailing list
Mono-devel-list at lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-devel-list
More information about the Mono-devel-list
mailing list