EconomicMapImpl.setKey ArrayIndexOutOfBoundsException

Doug Simon doug.simon at oracle.com
Mon Jun 5 19:29:31 UTC 2017


Hi Tim,

Since you are registering plugins at an arbitrary point in time (and not as part of Graal initialization), you need to use org.graalvm.compiler.nodes.graphbuilderconf.InvocationPlugins.LateRegistration like NFI does[1].

-Doug

[1] https://github.com/graalvm/graal/blob/3b1d7f2e9c3bb6a57600dbbcad20e5ecea36a20f/compiler/src/org.graalvm.compiler.truffle.hotspot/src/org/graalvm/compiler/truffle/hotspot/nfi/NativeCallStubGraphBuilder.java#L110

> On 5 Jun 2017, at 17:36, Tim Harris <timothy.l.harris at oracle.com> wrote:
> 
> Hi,
> 
> 
> 
> I am occasionally getting an ArrayIndexOutOfBoundsException during start-up of a multi-threaded program (below).
> 
> 
> 
> I suspect this is a data race with the entries array being expanded in one thread concurrent with the access from the static constructor in another thread.
> 
> 
> 
> If that is correct then does EconomicMapImpl need synchronization here, or should the change be somewhere else?
> 
> 
> 
> --Tim
> 
> 
> 
> 
> 
> 
> 
> 
> 
> Java HotSpot(TM) 64-Bit Server VM (build 25.71-b01-internal-jvmci-0.26, mixed mode)
> 
> 
> 
> Caused by: java.lang.ArrayIndexOutOfBoundsException: 62
> 
>        at org.graalvm.util.impl.EconomicMapImpl.setKey(EconomicMapImpl.java:781)
> 
>        at org.graalvm.util.impl.EconomicMapImpl.put(EconomicMapImpl.java:432)
> 
>        at org.graalvm.compiler.nodes.graphbuilderconf.InvocationPlugins.put(InvocationPlugins.java:634)
> 
>        at org.graalvm.compiler.nodes.graphbuilderconf.InvocationPlugins.register(InvocationPlugins.java:913)
> 
>        at org.graalvm.compiler.nodes.graphbuilderconf.InvocationPlugins$Registration.registerMethodSubstitution(InvocationPlugins.java:378)
> 
>        at org.graalvm.compiler.nodes.graphbuilderconf.InvocationPlugins$Registration.registerMethodSubstitution(InvocationPlugins.java:361)
> 
>        at com.oracle.rts.WorkRequestSubstitutions.<clinit>(WorkRequestSubstitutions.java:148)
> 
> 



More information about the graal-dev mailing list