From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=0.6 required=5.0 tests=BAYES_20,INVALID_MSGID autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,b4c0f0f8a3cf7068 X-Google-Attributes: gid103376,public X-Google-Thread: 10a146,7bdd56c6db71678c X-Google-Attributes: gid10a146,public From: Roedy Green Subject: Re: Hotspot. Dynamic compilers "better" than static one? Date: 1998/05/30 Message-ID: <6kpk0h$qmo$1@supernews.com>#1/1 X-Deja-AN: 357992081 References: <6kocc1$d80@drn.newsguy.com> Followup-To: comp.lang.java.programmer X-Complaints-To: newsabuse@supernews.com X-Trace: 896553809 GAXKTYA8I15CACC32C usenet14.supernews.com Organization: Canadian Mind Products Newsgroups: comp.lang.java.programmer,comp.lang.ada Date: 1998-05-30T00:00:00+00:00 List-Id: nabbasi asked, wrote, or quoted: >I just do not see how this example makes dynamic compiler somehow better >than >static compilers. may be someone can comes up with a better example. Here are a couple of examples where information gleaned from dynamic analysis could help substantially in optimisation. (1) Most machine architectures run fastest if there are no jumps, and if any conditional jumps don't jump, just fall through. By dynamic analysis you can determine which branch is the more likely, and put that one inline and branch off to code elsewhere for the less likely one. Over a decade ago I spent months writing screaming fast code for the nucleus of a 32-bit Forth compiler that hand optimised every jump this way. The secondary advantage is that the most commonly used code is more likely to be pre-fetched or in cache. A static optimiser can't do this, since it has no knowledge of which branch is the more likely. (2) If through dynamic analysis, the compiler discovered a loop is chewing up many cycles, it can consider unravelling it, inlining routines in it, or partially unravelling it. It would be counter productive to do this to a non-crucial loop. You would add to the code bulk and thus slow the whole process down with longer load times, wasted cache, and wasted RAM. For the JAVA GLOSSARY and the CMP Utilities: -- Roedy Green Canadian Mind Products Sponsored by: www.athena.com, makers of Integer, a multiuser spreadsheet JavaBean. Opinions expressed are not necessarily those of Athena Design. -30-