[Mono-devel-list] Escape Analysis

Willibald Krenn Willibald.Krenn at gmx.at
Tue Jan 25 17:36:50 EST 2005


Hi!

Massimiliano Mantione schrieb:
> A couple of things...
> 
> 1st, I like the idea of Escape Analysis a lot.
> Even without having seen any paper about it, this is an obvious
> optimization... it's true that a generational GC would help as
> well, but this is a more "direct" approach to the problem (in any
> case complementary to a generational GC).
> In any case it's something I'd like to see, if nobody implements
> it eventually (after the more urgent things that I should do) I
> would do it myself.

Yes, it sounds quite promising, but AFAIK it's also quite dependand on 
inlining. (Because lots of functions return newly allocated objects and 
stack allocation of objects can only be made if the lifetime of an 
object remains within a single function, obviously: You can not 'remote' 
or return a stack allocated object.)


> But (2nd) I cannot see how Paolo is blocking you.

Well, actually he's not blocking me, but I had the impression that he 
had significant reworks of the trampolines (et al.) in the pipeline. So 
I figured it would be better to wait (until these changes are made) 
before fussing too much with low-level-mono internals.

Anyways, currently  I'm not that far, as I'm coding the Phase Shift 
Detection (= monitor samples and tell when hot methods have 
significantly changed ) and try to come up with some good balance to 
trigger re-compilation activities.
I'm also investigating what type of sampling profiler I should use:
  - My own one (low-profile; max 100 samples per second or so; basically 
just a thread that sends SIGPROF signals to threads that have profiling 
turned on)
  - Paolo's highly accurate one.
  - or some mixture between the two.

BTW: At the moment I'm testing with some custom C# application server 
(1) but I'm always looking for good suggestions regarding test 
applications.. (GTK# doesn't work here - seems I'm not up to date with 
all the libs. :-( )

> It is probably true that Escape Analysis is expensive, so it
> makes sense only with profile guided optimizations, but this is
> not a good reason not to code it now, knowing that sooner or
> later we *will* have that... and moreover, couldn't it be used
> with AOT anyway?

Interferes a little bit with my plan:
(1.) Get the basic framework ready (profiler, phase change pred., 
picker, static predictor, optimizer)
(2.) Apply _existing_ optimiziations dynamically in some sane manner to 
non-static methods (change VMTs)
(3.) Add new optimization:
candidates: Devirtualization (incl. inlining), Escape Analysis,  profile 
guided code positioning, whatever...
(4.) ask community for comments and inclusion...
(5.) go (3.)

First iteration will end beginning April.. Points 1 and 2 I'd like to 
have in a first working version end of next week. Thereafter I'll 
probably look into the different optimizations and decide which one gets 
to honor of being implemented.

At least that's the plan if I'm not spending too much time writing e-mails,
   Willi


(1) For the interested reader:
Basically my application server is an object persistent framework on top 
of a firebird database that is called via some remoting interface: 
http://www.wpkrenn.net/pmwiki/pmwiki.php/Willi/LiberLinux
It's also my first 'success' story of porting a .NET webservice to 
Linux, as everything was developed on windows using C#/Delphi and now 
also runs on Mono/Kylix.. (Agreed, the client looks _way_ better when 
running on XP..)




More information about the Mono-devel-list mailing list