Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix debuginfotest gate #4121

Merged
merged 7 commits into from
Jan 12, 2022
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -79,12 +79,10 @@ jobs:
JDK: "labsjdk-ce-17"
GATE: "build,debuginfotest"
PRIMARY: "substratevm"
GHA_EXPECTED_FAILURE: true # temporarily marked as expected failure due to #4018 / GR-35118
- env:
JDK: "labsjdk-ce-11"
GATE: "build,debuginfotest"
PRIMARY: "substratevm"
GHA_EXPECTED_FAILURE: true # temporarily marked as expected failure due to #4018 / GR-35118
- env:
JDK: "labsjdk-ce-11"
GATE: "hellomodule"
Expand Down
94 changes: 47 additions & 47 deletions substratevm/mx.substratevm/testhello.py
Original file line number Diff line number Diff line change
Expand Up @@ -574,78 +574,78 @@ def test():
checker.check(exec_string, skip_fails=False)

exec_string = execute("info break 6")
rexp = [r"6.1%sy%s%s in hello\.Hello::inlineFrom at hello/Hello\.java:140"%(spaces_pattern, spaces_pattern, address_pattern),
r"6.2%sy%s%s in hello\.Hello::inlineFrom at hello/Hello\.java:177"%(spaces_pattern, spaces_pattern, address_pattern),
r"6.3%sy%s%s in hello\.Hello::inlineFrom at hello/Hello\.java:160"%(spaces_pattern, spaces_pattern, address_pattern),
r"6.4%sy%s%s in hello\.Hello::inlineFrom at hello/Hello\.java:177"%(spaces_pattern, spaces_pattern, address_pattern)]
rexp = [r"6.1%sy%s%s in hello\.Hello::inlineFrom at hello/Hello\.java:141"%(spaces_pattern, spaces_pattern, address_pattern),
r"6.2%sy%s%s in hello\.Hello::inlineFrom at hello/Hello\.java:179"%(spaces_pattern, spaces_pattern, address_pattern),
r"6.3%sy%s%s in hello\.Hello::inlineFrom at hello/Hello\.java:162"%(spaces_pattern, spaces_pattern, address_pattern),
r"6.4%sy%s%s in hello\.Hello::inlineFrom at hello/Hello\.java:179"%(spaces_pattern, spaces_pattern, address_pattern)]
checker = Checker('info break inlineFrom', rexp)
checker.check(exec_string)

execute("delete breakpoints")
exec_string = execute("break Hello.java:155")
rexp = r"Breakpoint %s at %s: file hello/Hello\.java, line 155\."%(digits_pattern, address_pattern)
checker = Checker('break Hello.java:155', rexp)
exec_string = execute("break Hello.java:157")
rexp = r"Breakpoint %s at %s: file hello/Hello\.java, line 157\."%(digits_pattern, address_pattern)
checker = Checker('break Hello.java:157', rexp)
checker.check(exec_string)

execute("continue 5")
exec_string = execute("backtrace 14")
rexp = [r"#0%shello\.Hello::inlineMixTo \(\) at hello/Hello\.java:155"%(spaces_pattern),
r"#1%shello\.Hello::noInlineHere\(int\) \(\) at hello/Hello\.java:147"%(spaces_pattern),
r"#2%s%s in hello\.Hello::inlineMixTo \(\) at hello/Hello\.java:153"%(spaces_pattern, address_pattern),
r"#3%shello\.Hello::noInlineHere\(int\) \(\) at hello/Hello\.java:147"%(spaces_pattern),
r"#4%s%s in hello\.Hello::inlineMixTo \(\) at hello/Hello\.java:153"%(spaces_pattern, address_pattern),
r"#5%shello\.Hello::noInlineHere\(int\) \(\) at hello/Hello\.java:147"%(spaces_pattern),
r"#6%s%s in hello\.Hello::inlineMixTo \(\) at hello/Hello\.java:153"%(spaces_pattern, address_pattern),
r"#7%shello\.Hello::noInlineHere\(int\) \(\) at hello/Hello\.java:147"%(spaces_pattern),
r"#8%s%s in hello\.Hello::inlineMixTo \(\) at hello/Hello\.java:153"%(spaces_pattern, address_pattern),
r"#9%shello\.Hello::noInlineHere\(int\) \(\) at hello/Hello\.java:147"%(spaces_pattern),
r"#10%s%s in hello\.Hello::inlineMixTo \(\) at hello/Hello\.java:153"%(spaces_pattern, address_pattern),
r"#11%shello\.Hello::noInlineHere\(int\) \(\) at hello/Hello\.java:147"%(spaces_pattern),
r"#12%s%s in hello\.Hello::inlineFrom \(\) at hello/Hello\.java:140"%(spaces_pattern, address_pattern),
rexp = [r"#0%shello\.Hello::inlineMixTo \(\) at hello/Hello\.java:157"%(spaces_pattern),
r"#1%shello\.Hello::noInlineHere\(int\) \(\) at hello/Hello\.java:149"%(spaces_pattern),
r"#2%s%s in hello\.Hello::inlineMixTo \(\) at hello/Hello\.java:155"%(spaces_pattern, address_pattern),
r"#3%shello\.Hello::noInlineHere\(int\) \(\) at hello/Hello\.java:149"%(spaces_pattern),
r"#4%s%s in hello\.Hello::inlineMixTo \(\) at hello/Hello\.java:155"%(spaces_pattern, address_pattern),
r"#5%shello\.Hello::noInlineHere\(int\) \(\) at hello/Hello\.java:149"%(spaces_pattern),
r"#6%s%s in hello\.Hello::inlineMixTo \(\) at hello/Hello\.java:155"%(spaces_pattern, address_pattern),
r"#7%shello\.Hello::noInlineHere\(int\) \(\) at hello/Hello\.java:149"%(spaces_pattern),
r"#8%s%s in hello\.Hello::inlineMixTo \(\) at hello/Hello\.java:155"%(spaces_pattern, address_pattern),
r"#9%shello\.Hello::noInlineHere\(int\) \(\) at hello/Hello\.java:149"%(spaces_pattern),
r"#10%s%s in hello\.Hello::inlineMixTo \(\) at hello/Hello\.java:155"%(spaces_pattern, address_pattern),
r"#11%shello\.Hello::noInlineHere\(int\) \(\) at hello/Hello\.java:149"%(spaces_pattern),
r"#12%s%s in hello\.Hello::inlineFrom \(\) at hello/Hello\.java:141"%(spaces_pattern, address_pattern),
r"#13%shello\.Hello::main\(java\.lang\.String\[\] \*\) \(\) at hello/Hello\.java:94"%(spaces_pattern)]
checker = Checker('backtrace in recursive inlineMixTo', rexp)
checker.check(exec_string, skip_fails=False)

execute("delete breakpoints")
exec_string = execute("break Hello.java:168")
rexp = r"Breakpoint %s at %s: Hello\.java:168\. \(2 locations\)"%(digits_pattern, address_pattern)
checker = Checker('break Hello.java:168', rexp)
exec_string = execute("break Hello.java:170")
rexp = r"Breakpoint %s at %s: Hello\.java:170\. \(2 locations\)"%(digits_pattern, address_pattern)
checker = Checker('break Hello.java:170', rexp)
checker.check(exec_string)

execute("continue 5")
execute("continue")
exec_string = execute("backtrace 14")
rexp = [r"#0%shello\.Hello::inlineTo\(int\) \(\) at hello/Hello\.java:168"%(spaces_pattern),
r"#1%s%s in hello\.Hello::inlineHere \(\) at hello/Hello\.java:160"%(spaces_pattern, address_pattern),
r"#2%shello\.Hello::inlineTo\(int\) \(\) at hello/Hello\.java:166"%(spaces_pattern),
r"#3%s%s in hello\.Hello::inlineHere \(\) at hello/Hello\.java:160"%(spaces_pattern, address_pattern),
r"#4%shello\.Hello::inlineTo\(int\) \(\) at hello/Hello\.java:166"%(spaces_pattern),
r"#5%s%s in hello\.Hello::inlineHere \(\) at hello/Hello\.java:160"%(spaces_pattern, address_pattern),
r"#6%shello\.Hello::inlineTo\(int\) \(\) at hello/Hello\.java:166"%(spaces_pattern),
r"#7%s%s in hello\.Hello::inlineHere \(\) at hello/Hello\.java:160"%(spaces_pattern, address_pattern),
r"#8%shello\.Hello::inlineTo\(int\) \(\) at hello/Hello\.java:166"%(spaces_pattern),
r"#9%s%s in hello\.Hello::inlineHere \(\) at hello/Hello\.java:160"%(spaces_pattern, address_pattern),
r"#10%shello\.Hello::inlineTo \(\) at hello/Hello\.java:166"%(spaces_pattern),
r"#11%shello\.Hello::inlineHere \(\) at hello/Hello\.java:160"%(spaces_pattern),
r"#12%shello\.Hello::inlineFrom \(\) at hello/Hello\.java:141"%(spaces_pattern),
rexp = [r"#0%shello\.Hello::inlineTo\(int\) \(\) at hello/Hello\.java:170"%(spaces_pattern),
r"#1%s%s in hello\.Hello::inlineHere \(\) at hello/Hello\.java:162"%(spaces_pattern, address_pattern),
r"#2%shello\.Hello::inlineTo\(int\) \(\) at hello/Hello\.java:168"%(spaces_pattern),
r"#3%s%s in hello\.Hello::inlineHere \(\) at hello/Hello\.java:162"%(spaces_pattern, address_pattern),
r"#4%shello\.Hello::inlineTo\(int\) \(\) at hello/Hello\.java:168"%(spaces_pattern),
r"#5%s%s in hello\.Hello::inlineHere \(\) at hello/Hello\.java:162"%(spaces_pattern, address_pattern),
r"#6%shello\.Hello::inlineTo\(int\) \(\) at hello/Hello\.java:168"%(spaces_pattern),
r"#7%s%s in hello\.Hello::inlineHere \(\) at hello/Hello\.java:162"%(spaces_pattern, address_pattern),
r"#8%shello\.Hello::inlineTo\(int\) \(\) at hello/Hello\.java:168"%(spaces_pattern),
r"#9%s%s in hello\.Hello::inlineHere \(\) at hello/Hello\.java:162"%(spaces_pattern, address_pattern),
r"#10%shello\.Hello::inlineTo \(\) at hello/Hello\.java:168"%(spaces_pattern),
r"#11%shello\.Hello::inlineHere \(\) at hello/Hello\.java:162"%(spaces_pattern),
r"#12%shello\.Hello::inlineFrom \(\) at hello/Hello\.java:143"%(spaces_pattern),
r"#13%shello\.Hello::main\(java\.lang\.String\[\] \*\) \(\) at hello/Hello\.java:94"%(spaces_pattern)]
checker = Checker('backtrace in recursive inlineTo', rexp)
checker.check(exec_string, skip_fails=False)

execute("delete breakpoints")
exec_string = execute("break Hello.java:174")
rexp = r"Breakpoint %s at %s: file hello/Hello\.java, line 174\."%(digits_pattern, address_pattern)
checker = Checker('break Hello.java:174', rexp)
exec_string = execute("break Hello.java:176")
rexp = r"Breakpoint %s at %s: file hello/Hello\.java, line 176\."%(digits_pattern, address_pattern)
checker = Checker('break Hello.java:176', rexp)
checker.check(exec_string)

execute("continue 5")
exec_string = execute("backtrace 8")
rexp = [r"#0%shello\.Hello::inlineTailRecursion\(int\) \(\) at hello/Hello\.java:174"%(spaces_pattern),
r"#1%s%s in hello\.Hello::inlineTailRecursion\(int\) \(\) at hello/Hello\.java:177"%(spaces_pattern, address_pattern),
r"#2%s%s in hello\.Hello::inlineTailRecursion\(int\) \(\) at hello/Hello\.java:177"%(spaces_pattern, address_pattern),
r"#3%s%s in hello\.Hello::inlineTailRecursion\(int\) \(\) at hello/Hello\.java:177"%(spaces_pattern, address_pattern),
r"#4%s%s in hello\.Hello::inlineTailRecursion\(int\) \(\) at hello/Hello\.java:177"%(spaces_pattern, address_pattern),
r"#5%s%s in hello\.Hello::inlineTailRecursion \(\) at hello/Hello\.java:177"%(spaces_pattern, address_pattern),
r"#6%shello\.Hello::inlineFrom \(\) at hello/Hello\.java:142"%(spaces_pattern),
rexp = [r"#0%shello\.Hello::inlineTailRecursion\(int\) \(\) at hello/Hello\.java:176"%(spaces_pattern),
r"#1%s%s in hello\.Hello::inlineTailRecursion\(int\) \(\) at hello/Hello\.java:179"%(spaces_pattern, address_pattern),
r"#2%s%s in hello\.Hello::inlineTailRecursion\(int\) \(\) at hello/Hello\.java:179"%(spaces_pattern, address_pattern),
r"#3%s%s in hello\.Hello::inlineTailRecursion\(int\) \(\) at hello/Hello\.java:179"%(spaces_pattern, address_pattern),
r"#4%s%s in hello\.Hello::inlineTailRecursion\(int\) \(\) at hello/Hello\.java:179"%(spaces_pattern, address_pattern),
r"#5%s%s in hello\.Hello::inlineTailRecursion \(\) at hello/Hello\.java:179"%(spaces_pattern, address_pattern),
r"#6%shello\.Hello::inlineFrom \(\) at hello/Hello\.java:144"%(spaces_pattern),
r"#7%shello\.Hello::main\(java\.lang\.String\[\] \*\) \(\) at hello/Hello\.java:94"%(spaces_pattern)]
checker = Checker('backtrace in recursive inlineTo', rexp)
checker.check(exec_string, skip_fails=False)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -292,14 +292,18 @@ protected MethodEntry processMethod(DebugMethodInfo debugMethodInfo, DebugInfoBa
debugContext.log("typename %s adding %s method %s %s(%s)\n",
typeName, memberModifiers(modifiers), resultTypeName, methodName, formatParams(paramTypes, paramNames));
TypeEntry resultType = debugInfoBase.lookupTypeEntry(resultTypeName);
TypeEntry[] paramTypeArray = new TypeEntry[paramCount];
String[] paramNameArray = new String[paramCount];
int idx = 0;
for (String paramTypeName : paramTypes) {
TypeEntry paramType = debugInfoBase.lookupTypeEntry(TypeEntry.canonicalize(paramTypeName));
paramTypeArray[idx++] = paramType;
TypeEntry[] paramTypeArray = null;
String[] paramNameArray = null;
if (paramCount != 0) {
paramTypeArray = new TypeEntry[paramCount];
paramNameArray = new String[paramCount];
int idx = 0;
for (String paramTypeName : paramTypes) {
TypeEntry paramType = debugInfoBase.lookupTypeEntry(TypeEntry.canonicalize(paramTypeName));
paramTypeArray[idx++] = paramType;
}
paramNameArray = paramNames.toArray(paramNameArray);
}
paramNameArray = paramNames.toArray(paramNameArray);
/*
* n.b. the method file may differ from the owning class file when the method is a
* substitution
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@
import com.oracle.objectfile.debuginfo.DebugInfoProvider.DebugMethodInfo;

public class MethodEntry extends MemberEntry {
final TypeEntry[] paramTypes;
final String[] paramNames;
private final TypeEntry[] paramTypes;
private final String[] paramNames;
static final int DEOPT = 1 << 0;
static final int IN_RANGE = 1 << 1;
static final int INLINED = 1 << 2;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -182,11 +182,14 @@ private String getExtendedMethodName(boolean includeClass, boolean includeParams
builder.append(getMethodName());
if (includeParams) {
builder.append("(");
String prefix = "";
for (TypeEntry t : methodEntry.paramTypes) {
builder.append(prefix);
builder.append(t.getTypeName());
prefix = ", ";
TypeEntry[] paramTypes = methodEntry.getParamTypes();
if (paramTypes != null) {
String prefix = "";
for (TypeEntry t : paramTypes) {
builder.append(prefix);
builder.append(t.getTypeName());
prefix = ", ";
}
}
builder.append(')');
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -737,6 +737,9 @@ private int writeMethodParameterDeclarations(DebugContext context, ClassEntry cl
if (!Modifier.isStatic(method.getModifiers())) {
pos = writeMethodParameterDeclaration(context, "this", classEntry.getTypeName(), true, isSpecification, buffer, pos);
}
if (method.getParamTypes() == null) {
return pos;
}
for (TypeEntry paramType : method.getParamTypes()) {
String paramTypeName = paramType.getTypeName();
String paramName = uniqueDebugString("");
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
/*
* Copyright (c) 2017, 2021, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package com.oracle.svm.jni;

import com.oracle.svm.core.util.VMError;
import com.oracle.svm.jni.hosted.JNIJavaCallWrapperMethod;
import com.oracle.svm.jni.hosted.JNIJavaCallWrapperMethod.CallVariant;

import jdk.vm.ci.meta.ConstantPool;
import jdk.vm.ci.meta.MetaAccessProvider;

/**
* Holder class for generated {@link JNIJavaCallWrapperMethod} code.
*/
public final class JNIJavaCallTrampolines {
public static ConstantPool getConstantPool(MetaAccessProvider metaAccess) {
// Each generated call wrapper needs an actual constant pool, so we provide our
// private constructor's
return metaAccess.lookupJavaType(JNIJavaCallWrappers.class).getDeclaredConstructors()[0].getConstantPool();
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

getConstantPool should not be needed in this class.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done


private JNIJavaCallTrampolines() {
}

public static String getTrampolineName(CallVariant variant, boolean nonVirtual) {
StringBuilder name = new StringBuilder(48);
if (variant == CallVariant.VARARGS) {
name.append("varargs");
} else if (variant == CallVariant.ARRAY) {
name.append("array");
} else if (variant == CallVariant.VA_LIST) {
name.append("valist");
} else {
throw VMError.shouldNotReachHere();
}
if (nonVirtual) {
name.append("Nonvirtual");
}
name.append("JavaCallTrampoline");
return name.toString();
}

public static boolean isNonVirtual(String trampolineName) {
return trampolineName.endsWith("NonvirtualJavaCallTrampoline");
}

public static CallVariant getVariant(String trampolineName) {
if (trampolineName.startsWith("varargs")) {
return CallVariant.VARARGS;
}
if (trampolineName.startsWith("array")) {
return CallVariant.ARRAY;
}
if (trampolineName.startsWith("valist")) {
return CallVariant.VA_LIST;
}
throw VMError.shouldNotReachHere();
}

private native void varargsJavaCallTrampoline();

private native void arrayJavaCallTrampoline();

private native void valistJavaCallTrampoline();

private native void varargsNonvirtualJavaCallTrampoline();

private native void arrayNonvirtualJavaCallTrampoline();

private native void valistNonvirtualJavaCallTrampoline();
}
Loading