On Thursday, 25 January 2018 19:48:59 UTC, Carl Mastrangelo wrote:
>
> That's pretty cool. I'm curious: Does -Xcomp work because it can show
> the variable doesn't escape, or because of deadcode elimination? For
> example, when implementing an InputStream, one way to implement read would
> be:
>
> @Override
> public int read() {
> byte[] onebyte = new byte[1];
> int ret = read(onebyte, 0, 1);
> if (ret == -1) {
> return -1;
> }
> return 0xFF & onebyte[0];
> }
>
> How can I tell that the compiler knows onebyte array doesn't escape?
>
The issue in the previous example is not about EA (Escape Analysis). On
Stack Replacement (OSR) of the loop may not have included the context for
the array reference outside the loop. With Xcomp the whole method is
compiled, not just the loop. You have to consider the context of the
compilation unit which can include inlined code.
--
You received this message because you are subscribed to the Google Groups
"mechanical-sympathy" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.