Replacing Unsafe.allocateInstance

Paul Sandoz paul.sandoz at oracle.com
Tue Aug 4 19:49:25 UTC 2015


On 4 Aug 2015, at 21:14, Henri Tremblay <henri at tremblay.pro> wrote:

> Hi,
> 
> I might have missed something but the purpose of injecting the char[] is to prevent copying it. But frozen arrays seem to require a copy to get the frozen version.
> 
> I would much prefer the JVM to be able to guess that an array will in fact never be modified and so could be used without copying (A copy can be made if needed afterwards). Or maybe just be able to annotate @Constant
> 
> Is there something I'm not understanding?
> 

I was hoping in certain cases that the compiler would be able to work out that the frozen array does not escape and can therefore optimise away the copy. Perhaps i am being naive on this point :-) I don’t know how difficult/fragile that would be in practice to detect.

Paul.


More information about the jdk9-dev mailing list