From d6de092ecb8638250141b09ef6f6cf171739f8b6 Mon Sep 17 00:00:00 2001 From: Christian Wimmer Date: Mon, 6 Dec 2021 14:31:01 -0800 Subject: [PATCH 1/4] Use correct version of toJavaName in Debug info generation --- .../oracle/svm/hosted/image/NativeImageDebugInfoProvider.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/substratevm/src/com.oracle.svm.hosted/src/com/oracle/svm/hosted/image/NativeImageDebugInfoProvider.java b/substratevm/src/com.oracle.svm.hosted/src/com/oracle/svm/hosted/image/NativeImageDebugInfoProvider.java index c0a998b4b308..f90b7d5be592 100644 --- a/substratevm/src/com.oracle.svm.hosted/src/com/oracle/svm/hosted/image/NativeImageDebugInfoProvider.java +++ b/substratevm/src/com.oracle.svm.hosted/src/com/oracle/svm/hosted/image/NativeImageDebugInfoProvider.java @@ -660,7 +660,7 @@ public String name() { @Override public String valueType() { - return hostedMethod.getSignature().getReturnType(null).toJavaName(); + return toJavaName((HostedType) hostedMethod.getSignature().getReturnType(null)); } @Override @@ -669,7 +669,7 @@ public List paramTypes() { int parameterCount = signature.getParameterCount(false); List paramTypes = new ArrayList<>(parameterCount); for (int i = 0; i < parameterCount; i++) { - paramTypes.add(signature.getParameterType(i, null).toJavaName()); + paramTypes.add(toJavaName((HostedType) signature.getParameterType(i, null))); } return paramTypes; } From 00964dddcea738b2a54e825bc6830225004c7bdd Mon Sep 17 00:00:00 2001 From: Christian Wimmer Date: Wed, 8 Dec 2021 14:55:55 -0800 Subject: [PATCH 2/4] Fix reachability handler for static methods --- .../src/com/oracle/graal/pointsto/meta/AnalysisUniverse.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/substratevm/src/com.oracle.graal.pointsto/src/com/oracle/graal/pointsto/meta/AnalysisUniverse.java b/substratevm/src/com.oracle.graal.pointsto/src/com/oracle/graal/pointsto/meta/AnalysisUniverse.java index f26cabef0053..552e33c4f6c8 100644 --- a/substratevm/src/com.oracle.graal.pointsto/src/com/oracle/graal/pointsto/meta/AnalysisUniverse.java +++ b/substratevm/src/com.oracle.graal.pointsto/src/com/oracle/graal/pointsto/meta/AnalysisUniverse.java @@ -587,7 +587,7 @@ private void collectMethodImplementations() { public static Set getMethodImplementations(BigBang bb, AnalysisMethod method, boolean includeInlinedMethods) { Set implementations = new LinkedHashSet<>(); if (method.wrapped.canBeStaticallyBound() || method.isConstructor()) { - if (method.isImplementationInvoked()) { + if (includeInlinedMethods ? method.isReachable() : method.isImplementationInvoked()) { implementations.add(method); } } else { From 064a375c87eabd197321ed491de38ce37fac34ea Mon Sep 17 00:00:00 2001 From: Tom Shull Date: Thu, 9 Dec 2021 16:17:16 +0100 Subject: [PATCH 3/4] Lower AArch64ReadNodes to proper AArch64Kinds. --- .../core/aarch64/AArch64ArithmeticLIRGenerator.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/compiler/src/org.graalvm.compiler.core.aarch64/src/org/graalvm/compiler/core/aarch64/AArch64ArithmeticLIRGenerator.java b/compiler/src/org.graalvm.compiler.core.aarch64/src/org/graalvm/compiler/core/aarch64/AArch64ArithmeticLIRGenerator.java index 0e0efb756d5e..a7804c897446 100644 --- a/compiler/src/org.graalvm.compiler.core.aarch64/src/org/graalvm/compiler/core/aarch64/AArch64ArithmeticLIRGenerator.java +++ b/compiler/src/org.graalvm.compiler.core.aarch64/src/org/graalvm/compiler/core/aarch64/AArch64ArithmeticLIRGenerator.java @@ -121,11 +121,11 @@ public Value emitExtendMemory(boolean isSigned, AArch64Kind accessKind, int resu * Issue an extending load of the proper bit size and set the result to the proper kind. */ GraalError.guarantee(accessKind.isInteger(), "can only extend integer kinds"); - Variable result = getLIRGen().newVariable(LIRKind.value(resultBits == 32 ? AArch64Kind.DWORD : AArch64Kind.QWORD)); + AArch64Kind resultKind = resultBits <= 32 ? AArch64Kind.DWORD : AArch64Kind.QWORD; + Variable result = getLIRGen().newVariable(LIRKind.value(resultKind)); - int dstBitSize = resultBits <= 32 ? 32 : 64; AArch64Move.ExtendKind extend = isSigned ? AArch64Move.ExtendKind.SIGN_EXTEND : AArch64Move.ExtendKind.ZERO_EXTEND; - getLIRGen().append(new AArch64Move.LoadOp(accessKind, dstBitSize, extend, result, address, state)); + getLIRGen().append(new AArch64Move.LoadOp(accessKind, resultKind.getSizeInBytes() * Byte.SIZE, extend, result, address, state)); return result; } From c44838e3ce18488a6ca1babd749da527c7e8ee50 Mon Sep 17 00:00:00 2001 From: Christian Wimmer Date: Wed, 8 Dec 2021 14:55:15 -0800 Subject: [PATCH 4/4] Avoid endless loop when parsing reason has cycles --- .../src/com/oracle/graal/pointsto/flow/MethodTypeFlow.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/substratevm/src/com.oracle.graal.pointsto/src/com/oracle/graal/pointsto/flow/MethodTypeFlow.java b/substratevm/src/com.oracle.graal.pointsto/src/com/oracle/graal/pointsto/flow/MethodTypeFlow.java index 20239d4b8c74..242662e47b93 100644 --- a/substratevm/src/com.oracle.graal.pointsto/src/com/oracle/graal/pointsto/flow/MethodTypeFlow.java +++ b/substratevm/src/com.oracle.graal.pointsto/src/com/oracle/graal/pointsto/flow/MethodTypeFlow.java @@ -87,7 +87,10 @@ public StackTraceElement[] getParsingContext() { List parsingContext = new ArrayList<>(); InvokeTypeFlow invokeFlow = parsingReason; - while (invokeFlow != null) { + /* Defend against cycles in the parsing context. GR-35744 should fix this properly. */ + int maxSize = 100; + + while (invokeFlow != null && parsingContext.size() < maxSize) { parsingContext.add(invokeFlow.getSource().getMethod().asStackTraceElement(invokeFlow.getSource().getBCI())); invokeFlow = ((PointsToAnalysisMethod) invokeFlow.getSource().getMethod()).getTypeFlow().parsingReason; }