# HG changeset patch # User Roland Schatz # Date 1397480843 -7200 # Node ID 9f1995f6d9a3935b1306e9564c063c3f5ff4802f # Parent 3028c310ad42402ce87d594ff85e720c7ba9d818 Keep metadata annotation in NewArrayStub, and add exception to stub invariants. diff -r 3028c310ad42 -r 9f1995f6d9a3 graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/HotSpotCompiledRuntimeStub.java --- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/HotSpotCompiledRuntimeStub.java Mon Apr 14 15:07:01 2014 +0200 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/HotSpotCompiledRuntimeStub.java Mon Apr 14 15:07:23 2014 +0200 @@ -27,6 +27,7 @@ import com.oracle.graal.api.code.CompilationResult.DataPatch; import com.oracle.graal.api.code.CompilationResult.Infopoint; import com.oracle.graal.hotspot.data.*; +import com.oracle.graal.hotspot.meta.*; import com.oracle.graal.hotspot.stubs.*; /** @@ -50,6 +51,15 @@ private boolean checkStubInvariants(CompilationResult compResult) { assert compResult.getExceptionHandlers().isEmpty(); for (DataPatch data : compResult.getDataReferences()) { + if (data.data instanceof MetaspaceData) { + MetaspaceData meta = (MetaspaceData) data.data; + if (meta.annotation instanceof HotSpotResolvedObjectType && ((HotSpotResolvedObjectType) meta.annotation).getName().equals("[I")) { + // special handling for NewArrayStub + // embedding the type '[I' is safe, since it is never unloaded + continue; + } + } + assert !(data.data instanceof PatchedData) : this + " cannot have embedded object or metadata constant: " + data.data; } for (Infopoint infopoint : compResult.getInfopoints()) { diff -r 3028c310ad42 -r 9f1995f6d9a3 graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/stubs/NewArrayStub.java --- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/stubs/NewArrayStub.java Mon Apr 14 15:07:01 2014 +0200 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/stubs/NewArrayStub.java Mon Apr 14 15:07:23 2014 +0200 @@ -22,7 +22,6 @@ */ package com.oracle.graal.hotspot.stubs; -import static com.oracle.graal.hotspot.HotSpotGraalRuntime.*; import static com.oracle.graal.hotspot.replacements.HotSpotReplacementsUtil.*; import static com.oracle.graal.hotspot.replacements.NewObjectSnippets.*; import static com.oracle.graal.hotspot.stubs.NewInstanceStub.*; @@ -61,16 +60,10 @@ protected Arguments makeArguments(SnippetInfo stub) { HotSpotResolvedObjectType intArrayType = (HotSpotResolvedObjectType) providers.getMetaAccess().lookupJavaType(int[].class); - // RuntimeStub cannot (currently) support oops or metadata embedded in the code so we - // convert the hub (i.e., Klass*) for int[] to be a naked word. This should be safe since - // the int[] class will never be unloaded. - Constant intArrayHub = intArrayType.klass(); - intArrayHub = Constant.forIntegerKind(runtime().getTarget().wordKind, intArrayHub.asLong()); - Arguments args = new Arguments(stub, GuardsStage.FLOATING_GUARDS, LoweringTool.StandardLoweringStage.HIGH_TIER); args.add("hub", null); args.add("length", null); - args.addConst("intArrayHub", intArrayHub); + args.addConst("intArrayHub", intArrayType.klass()); args.addConst("threadRegister", providers.getRegisters().getThreadRegister()); return args; }