Search in sources :

Example 31 with UnsignedWord

use of org.graalvm.word.UnsignedWord in project graal by oracle.

the class Target_java_lang_Runtime method visitRuntimeCompiledMethod.

@Override
public <T> boolean visitRuntimeCompiledMethod(T runtimeMethod, RuntimeCompiledMethodAccess<T> access) {
    /* Is a runtime method allocated in some larger block of committed memory? */
    final UnsignedWord size = access.getSize(runtimeMethod);
    nonHeapUsed = nonHeapUsed.add(size);
    nonHeapCommitted = nonHeapUsed.add(size);
    return true;
}
Also used : UnsignedWord(org.graalvm.word.UnsignedWord)

Example 32 with UnsignedWord

use of org.graalvm.word.UnsignedWord in project graal by oracle.

the class Target_java_lang_Runtime method isPinned.

public boolean isPinned(Object instance) {
    final ObjectHeaderImpl ohi = getObjectHeaderImpl();
    final UnsignedWord headerBits = ObjectHeaderImpl.readHeaderBitsFromObject(instance);
    /* The instance is pinned if it is in the image heap. */
    if (ohi.isBootImageHeaderBits(headerBits)) {
        return true;
    }
    final Space pinnedFromSpace = getOldGeneration().getPinnedFromSpace();
    final Space pinnedToSpace = getOldGeneration().getPinnedToSpace();
    if (ohi.isAlignedHeader(headerBits)) {
        final AlignedHeapChunk.AlignedHeader aChunk = AlignedHeapChunk.getEnclosingAlignedHeapChunk(instance);
        final Space space = aChunk.getSpace();
        /* The instance is pinned if it is in the pinned from space. */
        if ((space == pinnedFromSpace) || (space == pinnedToSpace)) {
            return true;
        }
    }
    if (ohi.isUnalignedHeader(headerBits)) {
        final UnalignedHeapChunk.UnalignedHeader uChunk = UnalignedHeapChunk.getEnclosingUnalignedHeapChunk(instance);
        final Space space = uChunk.getSpace();
        /* The instance is pinned if it is in the pinned from space. */
        if ((space == pinnedFromSpace) || (space == pinnedToSpace)) {
            return true;
        }
    }
    /* Look down the list of individually pinned objects. */
    for (PinnedObjectImpl pinnedObject = getPinHead().get(); pinnedObject != null; pinnedObject = pinnedObject.getNext()) {
        if (instance == pinnedObject.getObject()) {
            return true;
        }
    }
    return false;
}
Also used : UnsignedWord(org.graalvm.word.UnsignedWord)

Example 33 with UnsignedWord

use of org.graalvm.word.UnsignedWord in project graal by oracle.

the class Target_java_lang_Runtime method getUsedObjectBytes.

/**
 * Return the size, in bytes, of the actual used memory, not the committed memory.
 */
public UnsignedWord getUsedObjectBytes() {
    final Space youngSpace = getYoungGeneration().getSpace();
    final UnsignedWord youngBytes = youngSpace.getObjectBytes();
    final Space fromSpace = getOldGeneration().getFromSpace();
    final UnsignedWord fromBytes = fromSpace.getObjectBytes();
    final Space pinnedSpace = getOldGeneration().getPinnedFromSpace();
    final UnsignedWord pinnedBytes = pinnedSpace.getObjectBytes();
    final UnsignedWord result = youngBytes.add(fromBytes).add(pinnedBytes);
    return result;
}
Also used : UnsignedWord(org.graalvm.word.UnsignedWord)

Example 34 with UnsignedWord

use of org.graalvm.word.UnsignedWord in project graal by oracle.

the class Target_java_lang_Runtime method visitNativeImageHeapRegion.

/*
     * Implementations of methods declared by MemoryWalker.Visitor.
     */
@Override
public <T> boolean visitNativeImageHeapRegion(T bootImageHeapRegion, NativeImageHeapRegionAccess<T> access) {
    final UnsignedWord size = access.getSize(bootImageHeapRegion);
    heapUsed = heapUsed.add(size);
    heapCommitted = heapCommitted.add(size);
    return true;
}
Also used : UnsignedWord(org.graalvm.word.UnsignedWord)

Example 35 with UnsignedWord

use of org.graalvm.word.UnsignedWord in project graal by oracle.

the class HeapPolicy method setMinimumHeapSize.

/**
 * Set the minimum heap size, returning the previous value.
 */
public static UnsignedWord setMinimumHeapSize(UnsignedWord value) {
    final UnsignedWord result = minimumHeapSize;
    minimumHeapSize = value;
    return result;
}
Also used : UnsignedWord(org.graalvm.word.UnsignedWord)

Aggregations

UnsignedWord (org.graalvm.word.UnsignedWord)137 Pointer (org.graalvm.word.Pointer)43 Log (com.oracle.svm.core.log.Log)30 DynamicHub (com.oracle.svm.core.hub.DynamicHub)11 Fold (org.graalvm.compiler.api.replacements.Fold)11 Uninterruptible (com.oracle.svm.core.annotate.Uninterruptible)9 Snippet (org.graalvm.compiler.api.replacements.Snippet)9 CCharPointer (org.graalvm.nativeimage.c.type.CCharPointer)6 AlignedHeader (com.oracle.svm.core.genscavenge.AlignedHeapChunk.AlignedHeader)4 WordBase (org.graalvm.word.WordBase)4 AlwaysInline (com.oracle.svm.core.annotate.AlwaysInline)3 ValueInfo (com.oracle.svm.core.code.FrameInfoQueryResult.ValueInfo)3 UnalignedHeader (com.oracle.svm.core.genscavenge.UnalignedHeapChunk.UnalignedHeader)3 XOptions (com.oracle.svm.core.option.XOptions)3 CEntryPoint (org.graalvm.nativeimage.c.function.CEntryPoint)3 ObjectLayout (com.oracle.svm.core.config.ObjectLayout)2 DeoptEntryInfopoint (com.oracle.svm.core.deopt.DeoptEntryInfopoint)2 SubstrateForeignCallTarget (com.oracle.svm.core.snippets.SubstrateForeignCallTarget)2 Infopoint (jdk.vm.ci.code.site.Infopoint)2 JavaKind (jdk.vm.ci.meta.JavaKind)2