classpath
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Math patch


From: Artur Biesiadowski
Subject: Re: Math patch
Date: Fri, 28 Feb 2003 11:10:19 +0100
User-agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.3a) Gecko/20021212

Chris Gray wrote:

Nonetheless, javac certainly used to do that, and I'm pretty sure it still does. (I could swear that the JLS actually specifies this behaviour, but I'm darned if I can find the words now.)

13.4.8

http://java.sun.com/docs/books/jls/second_edition/html/binaryComp.doc.html#45139

[...]
One reason for requiring inlining of constants is that switch statements require constants on each case, and no two such constant values may be the same. The compiler checks for duplicate constant values in a switch statement at compile time; the class file format does not do symbolic linkage of case values
[...]

Instead of doing checks on both compile and then runtime link time (check would be really trivial), they have decided to go this broken route. Major reason for that is probably speed of interpreter versus boolean debug flag - jit could trivially reject dead branch, with interpreter it is not so obvious.

Artur





reply via email to

[Prev in Thread] Current Thread [Next in Thread]