Java-Gaming.org Java4K winners: [ by our judges | by the community ]         
Featured games (67)
games approved by the League of Dukes
Games in Showcase (∞)
games submitted by our members



News: Read the Java Gaming Resources, or peek at the official Java tutorials
 
    Home     Help   Search   Login   Register   
Pages: [1]
  Print  
  hotspot inlining  (Read 1909 times)
0 Members and 2 Guests are viewing this topic.
Offline snak

JGO n00b
*

Posts: 25


Eu não falo o português


« on: 2002-11-19 07:53:42 »

Does anyone know the rules governing what code hotspot is able to inline?  I have several method calls in tight loop.  The code will start to get pretty nasty looking without them, so I'd rather not do the inlining myself if I can.

Has Sun published any information on what code you can expect will be inlined, or is there any way to determine this with a profiling tool?  I guess I can do it by hand and measure performance, but I'd rather not if there's a way involving less work  Grin
Offline leknor

Full Member
**

Posts: 218


ROCK!!!


« Reply #1 on: 2002-11-19 08:15:37 »

I think the cloests you'll find to a definative answer is from Jeff's book. appendex B.3.1 is about inlining in the -server version of HotSpot. I think the book was written about the time of Java 1.2 and I think I've read the -client HotSpot has since learned how to inline.
Offline pepe

Sr. Member
**

Posts: 402


Nothing unreal exists


« Reply #2 on: 2002-11-19 08:49:48 »

Both standard and server* jvm know how to inline, believe me.
Actually, my tests about inlining show that  if you make a loop that makes some calls, they are inlined, and following some few rules, you can make hotspot's inlining faster than inlining by hand. (yes..  you read it well Shocked )
i did not make tests for the number of functions inlined or the length of the called methods. this could be interesting, but at least, if you have to inline two to ten small methods (20-50 lines) it goes well.


* A regression in 1.4.0 server made the inlining slower than 1.3 client. Did not test under 1.4.1 to see if that was corrected. will do that soon.

Home page: http://frederic.barachant.com
------------------------------------------------------
GoSub: java2D gamechmark http://frederic.barachant.com/GoSub/GoSub.jnlp
Games published by our own members! Go get 'em!
Offline princec
« League of Dukes »

JGO Kernel
*****

Posts: 8088
Medals: 95


Eh? Who? What? ... Me?


« Reply #3 on: 2002-11-19 08:50:04 »

This extra flag controls the maximum size of inlinable methods (I presume the size is in "bytecodes" but I don't know for sure):

-XX:MaxInlineSize=64

Additionally this flag tells the compiler how many times to interpret a method before it compiles it. If I were writing the compiler I'd have it do its inlining recursively before performing a compilation:

-XX:CompileThreshold=500

The default for server is 10000 ISTR, and client is 1500.

Cas Smiley

Offline erikd

JGO Kernel
*****

Posts: 2561
Medals: 7


Maximumisness


« Reply #4 on: 2002-11-22 03:02:43 »

I'd say that you must avoid manual inlining in any way. It makes your code unmaintainable and most probably not any faster.
It *can* even slow down your code a great deal which, as some of you may remember, I found out the hard way  Smiley

Anyway thats my 2 cents.

Erik

Pages: [1]
  Print  
 
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.16 | SMF © 2011, Simple Machines Valid XHTML 1.0! Valid CSS!
Page created in 0.073 seconds with 19 queries.