This is the mail archive of the java-patches@gcc.gnu.org mailing list for the Java project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [JAVA PATCH] SAVE_EXPR evaluate-once semantics in jcf-write.c


Roger Sayle wrote:

The following patch implements the required evaluate-once semantics
for SAVE_EXPR when generating java bytecodes.  Historically, gcj has
just re-evaluated the saved expression which is less than ideal.

My main concern is that localvar_alloc allocates a new local variable. When does it get freed? There are two concerns: (1) It might get freed too early. (2) It might never get freed (until the end of the method), in which case we may be wasting locals. This is admittedly not a major problem, though it is a bit wasteful.

So this ia a work-around, but the real fix is to stop
generating SAVE_EXPRs while constant-folding.  What we
should do is use a "let expression":

LET tmp := expression IN f(use tmp, use tmp)

This provides an explicit well-defined scope for the temporary.
--
	--Per Bothner
per@bothner.com   http://per.bothner.com/



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]