Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

JLS Requirements that are optimizations

42 views
Skip to first unread message

Mark Rada

unread,
Jan 19, 2014, 5:03:16 PM1/19/14
to
The JLS has the following requirement in section 3.10.5 (String literals):

- Strings computed by constant expressions (§15.28) are computed at compile time and then treated as if they were literals.

Are we expected to conform to this requirement when we perform code generation? It is in the language spec, but is something that we would have to take care of during an optimization phase.

Ondřej Lhoták

unread,
Jan 20, 2014, 9:44:46 AM1/20/14
to
You will need to apply this transformation in Assignment 4. You do not
need to worry about it for the earlier assignments.

The reason why it is needed in Assignment 4 is that constant expressions
affect which statements are considered reachable at compile time, and
this in turn affects whether a program is valid (or should trigger a
compile-time error). This particular check is done in Assignment 4.

Ondřej

0 new messages