hi Jukka, --- Jukka Santala <[EMAIL PROTECTED]> wrote: > On Tue, 28 May 2002, Dalibor Topic wrote: > > Wouldn't it be nicer if the VM did that kind of > > optimization automatically? Imagine the following: > a > > Yes, I had a thought of that, too, especially since > Kaffe already has the > feedback-framework (Which doesn't appear to work > currently;) in place.
The feedback framework sounds nice, although I thought about a simpler implementation based on a classloader that inlines small methods before defining a class. It could be based on a few heuristics, like bytecode size: if there are private methods with bytecode size < 64 inline them. If there are calls to methods from the superclass which are smaller than 64 bytecodes, and do not directly depend on private methods/fields/classes of the superclass, inline them. And so on. The jakarta bcel toolkit looks nice in that respect. Current Kaffe can build and run it. I tested the included pure java verifier, and it seems to work. It's not too fast though ;) Verifying HashMap takes a few seconds on my intel p3 500, linux, jit3. > Altough these kinds of optimizations are, IMHO, ones > which best suit or > are easiest to implement in presetn Kaffe core. > Real, code-transforming > optimizations are quite much harder in the present > direct translation, but > inlining is often easier. It should even be possible > to inline some of the > lighter C library calls, to reduce the overhead for > simple, often-used > calls. Peephole optimization in the class loader would be possible, too. Jopt and jarg use bcel internally, so maybe we could interface the class loader to Jopt or jarg to perform cheap peephole optimization on the fly. > > For even better impact, you could delay inlining > of > > code until the jit tries to compile it. > > That seems like the way to go; altough the present > feedback-feature tries > to compile used classes at start-up anyway. In any > case some sort of > feedback loop seems preferable; see my earlier > comment about knowledge of > program internals and experience. Without knowing > which code-paths are > going to get heavy use, the VM couldn't (shouldn't?) > decide on what paths > to inline without just causing extra memory-use. Yes, feedback definitively beats heuristics, but heuristics should be easier to implement ;) cheers, dalibor topic __________________________________________________ Do You Yahoo!? Yahoo! - Official partner of 2002 FIFA World Cup http://fifaworldcup.yahoo.com _______________________________________________ kaffe mailing list [EMAIL PROTECTED] http://kaffe.org/cgi-bin/mailman/listinfo/kaffe
