|
123 | 123 | import com.oracle.truffle.api.object.DynamicObject;
|
124 | 124 | import com.oracle.truffle.api.object.DynamicObjectLibrary;
|
125 | 125 | import com.oracle.truffle.api.profiles.BranchProfile;
|
| 126 | +import com.oracle.truffle.api.profiles.ConditionProfile; |
126 | 127 |
|
127 | 128 | public abstract class CExtCommonNodes {
|
128 | 129 | private static final int SIGABRT_EXIT_CODE = 134;
|
@@ -612,13 +613,14 @@ public abstract static class GetIntArrayNode extends Node {
|
612 | 613 |
|
613 | 614 | @Specialization(limit = "2")
|
614 | 615 | static int[] doPointer(Object obj, int n, LLVMType sourceElementType,
|
| 616 | + @Cached ConditionProfile isArrayProfile, |
615 | 617 | @Cached GetLLVMType getLLVMType,
|
616 | 618 | @Cached PCallCapiFunction callFromTyped,
|
617 | 619 | @Cached PCallCapiFunction callGetByteArrayTypeId,
|
618 | 620 | @CachedLibrary("obj") InteropLibrary ptrLib,
|
619 | 621 | @CachedLibrary(limit = "1") InteropLibrary elementLib) throws UnsupportedTypeException {
|
620 | 622 | Object arrayPtr = obj;
|
621 |
| - if (!ptrLib.hasArrayElements(obj)) { |
| 623 | + if (!isArrayProfile.profile(ptrLib.hasArrayElements(obj))) { |
622 | 624 | // we first need to attach a type to the pointer object
|
623 | 625 | Object typeId = callGetByteArrayTypeId.call(NativeCAPISymbol.FUN_POLYGLOT_ARRAY_TYPEID, getLLVMType.execute(sourceElementType), n);
|
624 | 626 | arrayPtr = callFromTyped.call(NativeCAPISymbol.FUN_POLYGLOT_FROM_TYPED, obj, typeId);
|
|
0 commit comments