Re: JavaMemoryModel: Ordering of volatile and monitor actions

From: Bill Pugh (
Date: Mon Jul 02 2001 - 09:28:13 EDT

A resend of email from Cliff Click that got bounced by the mailing list:

> Comments and questions
> -----------------------
> (1) Is there existing compiler work/convention on reordering with respect to
> potentially unbounded loops?

Yeah, it's generally considered broken to move side effects across unbounded
loops. The general example used is:
   while( complex-condition-which-is-never-true ) { }

HotSpot won't move side effects across loops it can't prove will terminate.

It's usually adequate (for compilers) to say something about 'finite time':
     "It's ok to move around side-effects as long as they would
      happen after a finite amount of time anyways"


Cliff Click                  Compiler Designer and Researcher
cliffc at            Java Software
(408) 863-3266               MS UCUP02-302
JavaMemoryModel mailing list -

This archive was generated by hypermail 2b29 : Thu Oct 13 2005 - 07:00:32 EDT