Skip to content

Commit

Permalink
Fix warning in MemoryDump class.
Browse files Browse the repository at this point in the history
  • Loading branch information
chumer committed Jan 12, 2023
1 parent aebe728 commit 9726433
Showing 1 changed file with 22 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -24,19 +24,8 @@
*/
package org.graalvm.tools.insight.heap.instrument;

import com.oracle.truffle.api.CompilerDirectives;
import com.oracle.truffle.api.CompilerDirectives.CompilationFinal;
import com.oracle.truffle.api.CompilerDirectives.TruffleBoundary;
import com.oracle.truffle.api.dsl.Cached;
import com.oracle.truffle.api.interop.InteropLibrary;
import com.oracle.truffle.api.interop.InvalidArrayIndexException;
import com.oracle.truffle.api.interop.TruffleObject;
import com.oracle.truffle.api.interop.UnknownIdentifierException;
import com.oracle.truffle.api.interop.UnsupportedMessageException;
import com.oracle.truffle.api.interop.UnsupportedTypeException;
import com.oracle.truffle.api.library.ExportLibrary;
import com.oracle.truffle.api.library.ExportMessage;
import com.oracle.truffle.api.profiles.BranchProfile;
import static org.graalvm.tools.insight.heap.instrument.HeapGenerator.asIntOrNull;
import static org.graalvm.tools.insight.heap.instrument.HeapGenerator.asStringOrNull;

import java.util.ArrayList;
import java.util.Arrays;
Expand All @@ -49,8 +38,22 @@

import org.graalvm.collections.EconomicMap;
import org.graalvm.tools.insight.heap.HeapDump;
import static org.graalvm.tools.insight.heap.instrument.HeapGenerator.asIntOrNull;
import static org.graalvm.tools.insight.heap.instrument.HeapGenerator.asStringOrNull;

import com.oracle.truffle.api.CompilerDirectives;
import com.oracle.truffle.api.CompilerDirectives.CompilationFinal;
import com.oracle.truffle.api.CompilerDirectives.TruffleBoundary;
import com.oracle.truffle.api.dsl.Bind;
import com.oracle.truffle.api.dsl.Cached;
import com.oracle.truffle.api.interop.InteropLibrary;
import com.oracle.truffle.api.interop.InvalidArrayIndexException;
import com.oracle.truffle.api.interop.TruffleObject;
import com.oracle.truffle.api.interop.UnknownIdentifierException;
import com.oracle.truffle.api.interop.UnsupportedMessageException;
import com.oracle.truffle.api.interop.UnsupportedTypeException;
import com.oracle.truffle.api.library.ExportLibrary;
import com.oracle.truffle.api.library.ExportMessage;
import com.oracle.truffle.api.nodes.Node;
import com.oracle.truffle.api.profiles.InlinedBranchProfile;

/**
* Dump of heap memory. This object accumulates memory dump events.
Expand Down Expand Up @@ -383,9 +386,11 @@ boolean isArrayElementReadable(long index) {
}

@ExportMessage
Object readArrayElement(long index, @Cached BranchProfile exception) throws InvalidArrayIndexException {
Object readArrayElement(long index,
@Bind("$node") Node node,
@Cached InlinedBranchProfile exception) throws InvalidArrayIndexException {
if (!isArrayElementReadable(index)) {
exception.enter();
exception.enter(node);
throw InvalidArrayIndexException.create(index);
}
return members[(int) index];
Expand Down

0 comments on commit 9726433

Please sign in to comment.