< prev index next >

src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot/src/org/graalvm/compiler/hotspot/replacements/NewObjectSnippets.java

Print this page

        

*** 22,34 **** */ package org.graalvm.compiler.hotspot.replacements; import static org.graalvm.compiler.core.common.GraalOptions.GeneratePIC; import static org.graalvm.compiler.core.common.calc.UnsignedMath.belowThan; ! import static org.graalvm.compiler.hotspot.GraalHotSpotVMConfig.INJECTED_VMCONFIG; import static org.graalvm.compiler.hotspot.replacements.HotSpotReplacementsUtil.CLASS_ARRAY_KLASS_LOCATION; import static org.graalvm.compiler.hotspot.replacements.HotSpotReplacementsUtil.HUB_WRITE_LOCATION; import static org.graalvm.compiler.hotspot.replacements.HotSpotReplacementsUtil.MARK_WORD_LOCATION; import static org.graalvm.compiler.hotspot.replacements.HotSpotReplacementsUtil.PROTOTYPE_MARK_WORD_LOCATION; import static org.graalvm.compiler.hotspot.replacements.HotSpotReplacementsUtil.TLAB_END_LOCATION; --- 22,42 ---- */ package org.graalvm.compiler.hotspot.replacements; + import static jdk.vm.ci.meta.DeoptimizationAction.None; + import static jdk.vm.ci.meta.DeoptimizationReason.RuntimeConstraint; import static org.graalvm.compiler.core.common.GraalOptions.GeneratePIC; import static org.graalvm.compiler.core.common.calc.UnsignedMath.belowThan; ! import static org.graalvm.compiler.hotspot.GraalHotSpotVMConfigBase.INJECTED_VMCONFIG; ! import static org.graalvm.compiler.hotspot.HotSpotBackend.NEW_ARRAY; ! import static org.graalvm.compiler.hotspot.HotSpotBackend.NEW_ARRAY_OR_NULL; ! import static org.graalvm.compiler.hotspot.HotSpotBackend.NEW_INSTANCE; ! import static org.graalvm.compiler.hotspot.HotSpotBackend.NEW_INSTANCE_OR_NULL; ! import static org.graalvm.compiler.hotspot.HotSpotBackend.NEW_MULTI_ARRAY; ! import static org.graalvm.compiler.hotspot.HotSpotBackend.NEW_MULTI_ARRAY_OR_NULL; import static org.graalvm.compiler.hotspot.replacements.HotSpotReplacementsUtil.CLASS_ARRAY_KLASS_LOCATION; import static org.graalvm.compiler.hotspot.replacements.HotSpotReplacementsUtil.HUB_WRITE_LOCATION; import static org.graalvm.compiler.hotspot.replacements.HotSpotReplacementsUtil.MARK_WORD_LOCATION; import static org.graalvm.compiler.hotspot.replacements.HotSpotReplacementsUtil.PROTOTYPE_MARK_WORD_LOCATION; import static org.graalvm.compiler.hotspot.replacements.HotSpotReplacementsUtil.TLAB_END_LOCATION;
*** 68,88 **** import static org.graalvm.compiler.replacements.SnippetTemplate.DEFAULT_REPLACER; import static org.graalvm.compiler.replacements.nodes.CStringConstant.cstring; import static org.graalvm.compiler.replacements.nodes.ExplodeLoopNode.explodeLoop; import org.graalvm.compiler.api.replacements.Fold; import org.graalvm.compiler.api.replacements.Snippet; import org.graalvm.compiler.api.replacements.Snippet.ConstantParameter; import org.graalvm.compiler.api.replacements.Snippet.VarargsParameter; import org.graalvm.compiler.core.common.spi.ForeignCallDescriptor; import org.graalvm.compiler.core.common.type.StampFactory; import org.graalvm.compiler.debug.DebugHandlersFactory; import org.graalvm.compiler.debug.GraalError; import org.graalvm.compiler.graph.Node.ConstantNodeParameter; import org.graalvm.compiler.graph.Node.NodeIntrinsic; import org.graalvm.compiler.hotspot.GraalHotSpotVMConfig; - import org.graalvm.compiler.hotspot.HotSpotBackend; import org.graalvm.compiler.hotspot.meta.HotSpotProviders; import org.graalvm.compiler.hotspot.meta.HotSpotRegistersProvider; import org.graalvm.compiler.hotspot.nodes.DimensionsNode; import org.graalvm.compiler.hotspot.nodes.aot.LoadConstantIndirectlyFixedNode; import org.graalvm.compiler.hotspot.nodes.aot.LoadConstantIndirectlyNode; --- 76,96 ---- import static org.graalvm.compiler.replacements.SnippetTemplate.DEFAULT_REPLACER; import static org.graalvm.compiler.replacements.nodes.CStringConstant.cstring; import static org.graalvm.compiler.replacements.nodes.ExplodeLoopNode.explodeLoop; import org.graalvm.compiler.api.replacements.Fold; + import org.graalvm.compiler.api.replacements.Fold.InjectedParameter; import org.graalvm.compiler.api.replacements.Snippet; import org.graalvm.compiler.api.replacements.Snippet.ConstantParameter; import org.graalvm.compiler.api.replacements.Snippet.VarargsParameter; import org.graalvm.compiler.core.common.spi.ForeignCallDescriptor; import org.graalvm.compiler.core.common.type.StampFactory; import org.graalvm.compiler.debug.DebugHandlersFactory; import org.graalvm.compiler.debug.GraalError; import org.graalvm.compiler.graph.Node.ConstantNodeParameter; import org.graalvm.compiler.graph.Node.NodeIntrinsic; import org.graalvm.compiler.hotspot.GraalHotSpotVMConfig; import org.graalvm.compiler.hotspot.meta.HotSpotProviders; import org.graalvm.compiler.hotspot.meta.HotSpotRegistersProvider; import org.graalvm.compiler.hotspot.nodes.DimensionsNode; import org.graalvm.compiler.hotspot.nodes.aot.LoadConstantIndirectlyFixedNode; import org.graalvm.compiler.hotspot.nodes.aot.LoadConstantIndirectlyNode;
*** 124,135 **** import jdk.vm.ci.code.CodeUtil; import jdk.vm.ci.code.MemoryBarriers; import jdk.vm.ci.code.Register; import jdk.vm.ci.code.TargetDescription; import jdk.vm.ci.hotspot.HotSpotResolvedObjectType; - import jdk.vm.ci.meta.DeoptimizationAction; - import jdk.vm.ci.meta.DeoptimizationReason; import jdk.vm.ci.meta.JavaKind; import jdk.vm.ci.meta.ResolvedJavaType; /** * Snippets used for implementing NEW, ANEWARRAY and NEWARRAY. --- 132,141 ----
*** 218,235 **** result = formatObject(hub, size, top, prototypeMarkWord, fillContents, constantSize, counters); } else { if (counters != null && counters.stub != null) { counters.stub.inc(); } ! result = newInstance(HotSpotBackend.NEW_INSTANCE, hub); } profileAllocation("instance", size, typeContext, options); return verifyOop(result); } @NodeIntrinsic(value = ForeignCallNode.class, injectedStampIsNonNull = true) ! public static native Object newInstance(@ConstantNodeParameter ForeignCallDescriptor descriptor, KlassPointer hub); @Snippet public static Object allocateInstancePIC(@ConstantParameter int size, KlassPointer hub, Word prototypeMarkWord, @ConstantParameter boolean fillContents, @ConstantParameter Register threadRegister, @ConstantParameter boolean constantSize, @ConstantParameter String typeContext, @ConstantParameter OptionValues options, @ConstantParameter Counters counters) { --- 224,252 ---- result = formatObject(hub, size, top, prototypeMarkWord, fillContents, constantSize, counters); } else { if (counters != null && counters.stub != null) { counters.stub.inc(); } ! result = newInstanceStub(hub); } profileAllocation("instance", size, typeContext, options); return verifyOop(result); } + public static Object newInstanceStub(KlassPointer hub) { + if (useNullAllocationStubs(INJECTED_VMCONFIG)) { + return nonNullOrDeopt(newInstanceOrNull(NEW_INSTANCE_OR_NULL, hub)); + } else { + return newInstance(NEW_INSTANCE, hub); + } + } + @NodeIntrinsic(value = ForeignCallNode.class, injectedStampIsNonNull = true) ! private static native Object newInstance(@ConstantNodeParameter ForeignCallDescriptor descriptor, KlassPointer hub); ! ! @NodeIntrinsic(value = ForeignCallNode.class, injectedStampIsNonNull = false) ! private static native Object newInstanceOrNull(@ConstantNodeParameter ForeignCallDescriptor descriptor, KlassPointer hub); @Snippet public static Object allocateInstancePIC(@ConstantParameter int size, KlassPointer hub, Word prototypeMarkWord, @ConstantParameter boolean fillContents, @ConstantParameter Register threadRegister, @ConstantParameter boolean constantSize, @ConstantParameter String typeContext, @ConstantParameter OptionValues options, @ConstantParameter Counters counters) {
*** 242,263 **** @Snippet public static Object allocateInstanceDynamic(Class<?> type, Class<?> classClass, @ConstantParameter boolean fillContents, @ConstantParameter Register threadRegister, @ConstantParameter OptionValues options, @ConstantParameter Counters counters) { if (probability(SLOW_PATH_PROBABILITY, type == null)) { ! DeoptimizeNode.deopt(DeoptimizationAction.None, DeoptimizationReason.RuntimeConstraint); } Class<?> nonNullType = PiNode.piCastNonNullClass(type, SnippetAnchorNode.anchor()); if (probability(SLOW_PATH_PROBABILITY, DynamicNewInstanceNode.throwsInstantiationException(type, classClass))) { ! DeoptimizeNode.deopt(DeoptimizationAction.None, DeoptimizationReason.RuntimeConstraint); } ! return PiNode.piCastToSnippetReplaceeStamp(allocateInstanceDynamicHelper(type, fillContents, threadRegister, options, counters, nonNullType)); } ! private static Object allocateInstanceDynamicHelper(Class<?> type, boolean fillContents, Register threadRegister, OptionValues options, Counters counters, Class<?> nonNullType) { KlassPointer hub = ClassGetHubNode.readClass(nonNullType); if (probability(FAST_PATH_PROBABILITY, !hub.isNull())) { KlassPointer nonNullHub = ClassGetHubNode.piCastNonNull(hub, SnippetAnchorNode.anchor()); if (probability(FAST_PATH_PROBABILITY, isInstanceKlassFullyInitialized(nonNullHub))) { --- 259,280 ---- @Snippet public static Object allocateInstanceDynamic(Class<?> type, Class<?> classClass, @ConstantParameter boolean fillContents, @ConstantParameter Register threadRegister, @ConstantParameter OptionValues options, @ConstantParameter Counters counters) { if (probability(SLOW_PATH_PROBABILITY, type == null)) { ! DeoptimizeNode.deopt(None, RuntimeConstraint); } Class<?> nonNullType = PiNode.piCastNonNullClass(type, SnippetAnchorNode.anchor()); if (probability(SLOW_PATH_PROBABILITY, DynamicNewInstanceNode.throwsInstantiationException(type, classClass))) { ! DeoptimizeNode.deopt(None, RuntimeConstraint); } ! return PiNode.piCastToSnippetReplaceeStamp(allocateInstanceDynamicHelper(fillContents, threadRegister, options, counters, nonNullType)); } ! private static Object allocateInstanceDynamicHelper(boolean fillContents, Register threadRegister, OptionValues options, Counters counters, Class<?> nonNullType) { KlassPointer hub = ClassGetHubNode.readClass(nonNullType); if (probability(FAST_PATH_PROBABILITY, !hub.isNull())) { KlassPointer nonNullHub = ClassGetHubNode.piCastNonNull(hub, SnippetAnchorNode.anchor()); if (probability(FAST_PATH_PROBABILITY, isInstanceKlassFullyInitialized(nonNullHub))) {
*** 275,288 **** * binding of parameters is not yet supported by the GraphBuilderPlugin system. */ return allocateInstanceHelper(layoutHelper, nonNullHub, prototypeMarkWord, fillContents, threadRegister, false, "", options, counters); } } else { ! DeoptimizeNode.deopt(DeoptimizationAction.None, DeoptimizationReason.RuntimeConstraint); } } ! return dynamicNewInstanceStub(type); } /** * Maximum array length for which fast path allocation is used. */ --- 292,306 ---- * binding of parameters is not yet supported by the GraphBuilderPlugin system. */ return allocateInstanceHelper(layoutHelper, nonNullHub, prototypeMarkWord, fillContents, threadRegister, false, "", options, counters); } } else { ! DeoptimizeNode.deopt(None, RuntimeConstraint); } } ! DeoptimizeNode.deopt(None, RuntimeConstraint); ! return null; } /** * Maximum array length for which fast path allocation is used. */
*** 305,321 **** KlassPointer picHub = LoadConstantIndirectlyFixedNode.loadKlass(hub); return allocateArrayImpl(picHub, length, prototypeMarkWord, headerSize, log2ElementSize, fillContents, threadRegister, maybeUnroll, typeContext, false, options, counters); } @Snippet ! public static Object allocateArray(KlassPointer hub, int length, Word prototypeMarkWord, @ConstantParameter int headerSize, @ConstantParameter int log2ElementSize, ! @ConstantParameter boolean fillContents, @ConstantParameter Register threadRegister, @ConstantParameter boolean maybeUnroll, @ConstantParameter String typeContext, ! @ConstantParameter OptionValues options, @ConstantParameter Counters counters) { Object result = allocateArrayImpl(hub, length, prototypeMarkWord, headerSize, log2ElementSize, fillContents, threadRegister, maybeUnroll, typeContext, false, options, counters); return piArrayCastToSnippetReplaceeStamp(verifyOop(result), length); } private static Object allocateArrayImpl(KlassPointer hub, int length, Word prototypeMarkWord, int headerSize, int log2ElementSize, boolean fillContents, Register threadRegister, boolean maybeUnroll, String typeContext, boolean skipNegativeCheck, OptionValues options, Counters counters) { Object result; int allocationSize = arrayAllocationSize(length, headerSize, log2ElementSize); Word thread = registerAsWord(threadRegister); --- 323,356 ---- KlassPointer picHub = LoadConstantIndirectlyFixedNode.loadKlass(hub); return allocateArrayImpl(picHub, length, prototypeMarkWord, headerSize, log2ElementSize, fillContents, threadRegister, maybeUnroll, typeContext, false, options, counters); } @Snippet ! public static Object allocateArray(KlassPointer hub, ! int length, ! Word prototypeMarkWord, ! @ConstantParameter int headerSize, ! @ConstantParameter int log2ElementSize, ! @ConstantParameter boolean fillContents, ! @ConstantParameter Register threadRegister, ! @ConstantParameter boolean maybeUnroll, ! @ConstantParameter String typeContext, ! @ConstantParameter OptionValues options, ! @ConstantParameter Counters counters) { Object result = allocateArrayImpl(hub, length, prototypeMarkWord, headerSize, log2ElementSize, fillContents, threadRegister, maybeUnroll, typeContext, false, options, counters); return piArrayCastToSnippetReplaceeStamp(verifyOop(result), length); } + /** + * When allocating on the slow path, determines whether to use a version of the runtime call + * that returns {@code null} on a failed allocation instead of raising an OutOfMemoryError. + */ + @Fold + static boolean useNullAllocationStubs(@InjectedParameter GraalHotSpotVMConfig config) { + return config.areNullAllocationStubsAvailable(); + } + private static Object allocateArrayImpl(KlassPointer hub, int length, Word prototypeMarkWord, int headerSize, int log2ElementSize, boolean fillContents, Register threadRegister, boolean maybeUnroll, String typeContext, boolean skipNegativeCheck, OptionValues options, Counters counters) { Object result; int allocationSize = arrayAllocationSize(length, headerSize, log2ElementSize); Word thread = registerAsWord(threadRegister);
*** 329,359 **** if (counters != null && counters.arrayLoopInit != null) { counters.arrayLoopInit.inc(); } result = formatArray(hub, allocationSize, length, headerSize, top, prototypeMarkWord, fillContents, maybeUnroll, counters); } else { ! result = newArray(HotSpotBackend.NEW_ARRAY, hub, length); } profileAllocation("array", allocationSize, typeContext, options); return result; } ! @NodeIntrinsic(value = ForeignCallNode.class, injectedStampIsNonNull = true) ! public static native Object newArray(@ConstantNodeParameter ForeignCallDescriptor descriptor, KlassPointer hub, int length); ! ! public static final ForeignCallDescriptor DYNAMIC_NEW_ARRAY = new ForeignCallDescriptor("dynamic_new_array", Object.class, Class.class, int.class); ! public static final ForeignCallDescriptor DYNAMIC_NEW_INSTANCE = new ForeignCallDescriptor("dynamic_new_instance", Object.class, Class.class); @NodeIntrinsic(value = ForeignCallNode.class, injectedStampIsNonNull = true) ! public static native Object dynamicNewArrayStub(@ConstantNodeParameter ForeignCallDescriptor descriptor, Class<?> elementType, int length); ! public static Object dynamicNewInstanceStub(Class<?> elementType) { ! return dynamicNewInstanceStubCall(DYNAMIC_NEW_INSTANCE, elementType); } @NodeIntrinsic(value = ForeignCallNode.class, injectedStampIsNonNull = true) ! public static native Object dynamicNewInstanceStubCall(@ConstantNodeParameter ForeignCallDescriptor descriptor, Class<?> elementType); @Snippet public static Object allocateArrayDynamic(Class<?> elementType, Class<?> voidClass, int length, @ConstantParameter boolean fillContents, @ConstantParameter Register threadRegister, @ConstantParameter JavaKind knownElementKind, @ConstantParameter int knownLayoutHelper, Word prototypeMarkWord, @ConstantParameter OptionValues options, @ConstantParameter Counters counters) { --- 364,408 ---- if (counters != null && counters.arrayLoopInit != null) { counters.arrayLoopInit.inc(); } result = formatArray(hub, allocationSize, length, headerSize, top, prototypeMarkWord, fillContents, maybeUnroll, counters); } else { ! result = newArrayStub(hub, length); } profileAllocation("array", allocationSize, typeContext, options); return result; } ! public static Object newArrayStub(KlassPointer hub, int length) { ! if (useNullAllocationStubs(INJECTED_VMCONFIG)) { ! return nonNullOrDeopt(newArrayOrNull(NEW_ARRAY_OR_NULL, hub, length)); ! } else { ! return newArray(NEW_ARRAY, hub, length); ! } ! } @NodeIntrinsic(value = ForeignCallNode.class, injectedStampIsNonNull = true) ! private static native Object newArray(@ConstantNodeParameter ForeignCallDescriptor descriptor, KlassPointer hub, int length); ! @NodeIntrinsic(value = ForeignCallNode.class, injectedStampIsNonNull = false) ! private static native Object newArrayOrNull(@ConstantNodeParameter ForeignCallDescriptor descriptor, KlassPointer hub, int length); ! ! /** ! * Deoptimizes if {@code obj == null} otherwise returns {@code obj}. ! */ ! private static Object nonNullOrDeopt(Object obj) { ! if (obj == null) { ! DeoptimizeNode.deopt(None, RuntimeConstraint); ! } ! return obj; } @NodeIntrinsic(value = ForeignCallNode.class, injectedStampIsNonNull = true) ! public static native Object dynamicNewInstance(@ConstantNodeParameter ForeignCallDescriptor descriptor, Class<?> elementType); ! ! @NodeIntrinsic(value = ForeignCallNode.class, injectedStampIsNonNull = false) ! public static native Object dynamicNewInstanceOrNull(@ConstantNodeParameter ForeignCallDescriptor descriptor, Class<?> elementType); @Snippet public static Object allocateArrayDynamic(Class<?> elementType, Class<?> voidClass, int length, @ConstantParameter boolean fillContents, @ConstantParameter Register threadRegister, @ConstantParameter JavaKind knownElementKind, @ConstantParameter int knownLayoutHelper, Word prototypeMarkWord, @ConstantParameter OptionValues options, @ConstantParameter Counters counters) {
*** 367,387 **** * We only need the dynamic check for void when we have no static information from * knownElementKind. */ staticAssert(knownElementKind != JavaKind.Void, "unsupported knownElementKind"); if (knownElementKind == JavaKind.Illegal && probability(SLOW_PATH_PROBABILITY, elementType == null || DynamicNewArrayNode.throwsIllegalArgumentException(elementType, voidClass))) { ! DeoptimizeNode.deopt(DeoptimizationAction.None, DeoptimizationReason.RuntimeConstraint); } KlassPointer klass = loadKlassFromObject(elementType, arrayKlassOffset(INJECTED_VMCONFIG), CLASS_ARRAY_KLASS_LOCATION); if (klass.isNull()) { ! DeoptimizeNode.deopt(DeoptimizationAction.None, DeoptimizationReason.RuntimeConstraint); } KlassPointer nonNullKlass = ClassGetHubNode.piCastNonNull(klass, SnippetAnchorNode.anchor()); if (length < 0) { ! DeoptimizeNode.deopt(DeoptimizationAction.None, DeoptimizationReason.RuntimeConstraint); } int layoutHelper; if (knownElementKind == JavaKind.Illegal) { layoutHelper = readLayoutHelper(nonNullKlass); } else { --- 416,436 ---- * We only need the dynamic check for void when we have no static information from * knownElementKind. */ staticAssert(knownElementKind != JavaKind.Void, "unsupported knownElementKind"); if (knownElementKind == JavaKind.Illegal && probability(SLOW_PATH_PROBABILITY, elementType == null || DynamicNewArrayNode.throwsIllegalArgumentException(elementType, voidClass))) { ! DeoptimizeNode.deopt(None, RuntimeConstraint); } KlassPointer klass = loadKlassFromObject(elementType, arrayKlassOffset(INJECTED_VMCONFIG), CLASS_ARRAY_KLASS_LOCATION); if (klass.isNull()) { ! DeoptimizeNode.deopt(None, RuntimeConstraint); } KlassPointer nonNullKlass = ClassGetHubNode.piCastNonNull(klass, SnippetAnchorNode.anchor()); if (length < 0) { ! DeoptimizeNode.deopt(None, RuntimeConstraint); } int layoutHelper; if (knownElementKind == JavaKind.Illegal) { layoutHelper = readLayoutHelper(nonNullKlass); } else {
*** 410,437 **** /** * Calls the runtime stub for implementing MULTIANEWARRAY. */ @Snippet ! public static Object newmultiarray(KlassPointer hub, @ConstantParameter int rank, @VarargsParameter int[] dimensions) { Word dims = DimensionsNode.allocaDimsArray(rank); ExplodeLoopNode.explodeLoop(); for (int i = 0; i < rank; i++) { dims.writeInt(i * 4, dimensions[i], LocationIdentity.init()); } ! return newArrayCall(HotSpotBackend.NEW_MULTI_ARRAY, hub, rank, dims); } @Snippet ! public static Object newmultiarrayPIC(KlassPointer hub, @ConstantParameter int rank, @VarargsParameter int[] dimensions) { // Array type would be resolved by dominating resolution. KlassPointer picHub = LoadConstantIndirectlyFixedNode.loadKlass(hub); return newmultiarray(picHub, rank, dimensions); } @NodeIntrinsic(value = ForeignCallNode.class, injectedStampIsNonNull = true) ! public static native Object newArrayCall(@ConstantNodeParameter ForeignCallDescriptor descriptor, KlassPointer hub, int rank, Word dims); /** * Maximum number of long stores to emit when zeroing an object with a constant size. Larger * objects have their bodies initialized in a loop. */ --- 459,497 ---- /** * Calls the runtime stub for implementing MULTIANEWARRAY. */ @Snippet ! private static Object newmultiarray(KlassPointer hub, @ConstantParameter int rank, @VarargsParameter int[] dimensions) { Word dims = DimensionsNode.allocaDimsArray(rank); ExplodeLoopNode.explodeLoop(); for (int i = 0; i < rank; i++) { dims.writeInt(i * 4, dimensions[i], LocationIdentity.init()); } ! return newMultiArrayStub(hub, rank, dims); ! } ! ! private static Object newMultiArrayStub(KlassPointer hub, int rank, Word dims) { ! if (useNullAllocationStubs(INJECTED_VMCONFIG)) { ! return nonNullOrDeopt(newMultiArrayOrNull(NEW_MULTI_ARRAY_OR_NULL, hub, rank, dims)); ! } else { ! return newMultiArray(NEW_MULTI_ARRAY, hub, rank, dims); ! } } @Snippet ! private static Object newmultiarrayPIC(KlassPointer hub, @ConstantParameter int rank, @VarargsParameter int[] dimensions) { // Array type would be resolved by dominating resolution. KlassPointer picHub = LoadConstantIndirectlyFixedNode.loadKlass(hub); return newmultiarray(picHub, rank, dimensions); } @NodeIntrinsic(value = ForeignCallNode.class, injectedStampIsNonNull = true) ! private static native Object newMultiArray(@ConstantNodeParameter ForeignCallDescriptor descriptor, KlassPointer hub, int rank, Word dims); ! ! @NodeIntrinsic(value = ForeignCallNode.class, injectedStampIsNonNull = false) ! private static native Object newMultiArrayOrNull(@ConstantNodeParameter ForeignCallDescriptor descriptor, KlassPointer hub, int rank, Word dims); /** * Maximum number of long stores to emit when zeroing an object with a constant size. Larger * objects have their bodies initialized in a loop. */
*** 507,527 **** private static void fillWithGarbage(int size, Word memory, boolean constantSize, int startOffset, boolean manualUnroll, Counters counters) { fillMemory(0xfefefefefefefefeL, size, memory, constantSize, startOffset, manualUnroll, counters); } /** - * Formats some allocated memory with an object header and zeroes out the rest. Disables asserts - * since they can't be compiled in stubs. - */ - public static Object formatObjectForStub(KlassPointer hub, int size, Word memory, Word compileTimePrototypeMarkWord) { - return formatObject(hub, size, memory, compileTimePrototypeMarkWord, true, false, null); - } - - /** * Formats some allocated memory with an object header and zeroes out the rest. */ ! protected static Object formatObject(KlassPointer hub, int size, Word memory, Word compileTimePrototypeMarkWord, boolean fillContents, boolean constantSize, Counters counters) { Word prototypeMarkWord = useBiasedLocking(INJECTED_VMCONFIG) ? hub.readWord(prototypeMarkWordOffset(INJECTED_VMCONFIG), PROTOTYPE_MARK_WORD_LOCATION) : compileTimePrototypeMarkWord; initializeObjectHeader(memory, prototypeMarkWord, hub); if (fillContents) { zeroMemory(size, memory, constantSize, instanceHeaderSize(INJECTED_VMCONFIG), false, counters); } else if (REPLACEMENTS_ASSERTIONS_ENABLED) { --- 567,579 ---- private static void fillWithGarbage(int size, Word memory, boolean constantSize, int startOffset, boolean manualUnroll, Counters counters) { fillMemory(0xfefefefefefefefeL, size, memory, constantSize, startOffset, manualUnroll, counters); } /** * Formats some allocated memory with an object header and zeroes out the rest. */ ! private static Object formatObject(KlassPointer hub, int size, Word memory, Word compileTimePrototypeMarkWord, boolean fillContents, boolean constantSize, Counters counters) { Word prototypeMarkWord = useBiasedLocking(INJECTED_VMCONFIG) ? hub.readWord(prototypeMarkWordOffset(INJECTED_VMCONFIG), PROTOTYPE_MARK_WORD_LOCATION) : compileTimePrototypeMarkWord; initializeObjectHeader(memory, prototypeMarkWord, hub); if (fillContents) { zeroMemory(size, memory, constantSize, instanceHeaderSize(INJECTED_VMCONFIG), false, counters); } else if (REPLACEMENTS_ASSERTIONS_ENABLED) {
*** 530,540 **** MembarNode.memoryBarrier(MemoryBarriers.STORE_STORE, LocationIdentity.init()); return memory.toObjectNonNull(); } @Snippet ! protected static void verifyHeap(@ConstantParameter Register threadRegister) { Word thread = registerAsWord(threadRegister); Word topValue = readTlabTop(thread); if (!topValue.equal(WordFactory.zero())) { Word topValueContents = topValue.readWord(0, MARK_WORD_LOCATION); if (topValueContents.equal(WordFactory.zero())) { --- 582,592 ---- MembarNode.memoryBarrier(MemoryBarriers.STORE_STORE, LocationIdentity.init()); return memory.toObjectNonNull(); } @Snippet ! private static void verifyHeap(@ConstantParameter Register threadRegister) { Word thread = registerAsWord(threadRegister); Word topValue = readTlabTop(thread); if (!topValue.equal(WordFactory.zero())) { Word topValueContents = topValue.readWord(0, MARK_WORD_LOCATION); if (topValueContents.equal(WordFactory.zero())) {
*** 544,554 **** } /** * Formats some allocated memory with an object header and zeroes out the rest. */ ! public static Object formatArray(KlassPointer hub, int allocationSize, int length, int headerSize, Word memory, Word prototypeMarkWord, boolean fillContents, boolean maybeUnroll, Counters counters) { memory.writeInt(arrayLengthOffset(INJECTED_VMCONFIG), length, LocationIdentity.init()); /* * store hub last as the concurrent garbage collectors assume length is valid if hub field * is not null --- 596,606 ---- } /** * Formats some allocated memory with an object header and zeroes out the rest. */ ! private static Object formatArray(KlassPointer hub, int allocationSize, int length, int headerSize, Word memory, Word prototypeMarkWord, boolean fillContents, boolean maybeUnroll, Counters counters) { memory.writeInt(arrayLengthOffset(INJECTED_VMCONFIG), length, LocationIdentity.init()); /* * store hub last as the concurrent garbage collectors assume length is valid if hub field * is not null
< prev index next >