src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.core.common/src/org/graalvm/compiler/core/common/util/Util.java
Index
Unified diffs
Context diffs
Sdiffs
Patch
New
Old
Previous File
Next File
hotspot Cdiff src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.core.common/src/org/graalvm/compiler/core/common/util/Util.java
src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.core.common/src/org/graalvm/compiler/core/common/util/Util.java
Print this page
*** 20,32 ****
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package org.graalvm.compiler.core.common.util;
! import static org.graalvm.compiler.core.common.GraalOptions.HotSpotPrintInlining;
!
! import java.util.Collection;
import java.util.List;
import org.graalvm.compiler.debug.TTY;
import jdk.vm.ci.meta.JavaConstant;
--- 20,32 ----
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package org.graalvm.compiler.core.common.util;
! import java.lang.reflect.AccessibleObject;
! import java.lang.reflect.Executable;
! import java.lang.reflect.Field;
import java.util.List;
import org.graalvm.compiler.debug.TTY;
import jdk.vm.ci.meta.JavaConstant;
*** 72,104 ****
@SuppressWarnings("unchecked")
public static <T> T uncheckedCast(Object object) {
return (T) object;
}
- public interface Stringify {
- String apply(Object o);
- }
-
- public static String join(Collection<?> c, String sep) {
- return join(c, sep, "", "", null);
- }
-
- public static String join(Collection<?> c, String sep, String prefix, String suffix, Stringify stringify) {
- StringBuilder buf = new StringBuilder(prefix);
- boolean first = true;
- for (Object e : c) {
- if (!first) {
- buf.append(sep);
- } else {
- first = false;
- }
- buf.append(stringify != null ? stringify.apply(e) : String.valueOf(e));
- }
- buf.append(suffix);
- return buf.toString();
- }
-
/**
* Sets the element at a given position of a list and ensures that this position exists. If the
* list is current shorter than the position, intermediate positions are filled with a given
* value.
*
--- 72,81 ----
*** 189,199 ****
/**
* Print a HotSpot-style inlining message to the console.
*/
public static void printInlining(final ResolvedJavaMethod method, final int bci, final int inliningDepth, final boolean success, final String msg, final Object... args) {
- if (HotSpotPrintInlining.getValue()) {
StringBuilder sb = new StringBuilder();
// 1234567
sb.append(" "); // print timestamp
// 1234
sb.append(" "); // print compilation number
--- 166,175 ----
*** 205,215 ****
sb.append(" ");
}
sb.append(String.format("@ %d %s %s%s", bci, methodName(method), success ? "" : "not inlining ", String.format(msg, args)));
TTY.println(sb.toString());
}
- }
private static String methodName(ResolvedJavaMethod method) {
return method.format("%H.%n(%p):%r") + " (" + method.getCodeSize() + " bytes)";
}
}
--- 181,212 ----
sb.append(" ");
}
sb.append(String.format("@ %d %s %s%s", bci, methodName(method), success ? "" : "not inlining ", String.format(msg, args)));
TTY.println(sb.toString());
}
private static String methodName(ResolvedJavaMethod method) {
return method.format("%H.%n(%p):%r") + " (" + method.getCodeSize() + " bytes)";
}
+
+ /**
+ * Calls {@link AccessibleObject#setAccessible(boolean)} on {@code field} with the value
+ * {@code flag}.
+ */
+ public static void setAccessible(Field field, boolean flag) {
+ if (!Java8OrEarlier) {
+ ModuleAPI.openForReflectionTo(field.getDeclaringClass(), Util.class);
+ }
+ field.setAccessible(flag);
+ }
+
+ /**
+ * Calls {@link AccessibleObject#setAccessible(boolean)} on {@code executable} with the value
+ * {@code flag}.
+ */
+ public static void setAccessible(Executable executable, boolean flag) {
+ if (!Java8OrEarlier) {
+ ModuleAPI.openForReflectionTo(executable.getDeclaringClass(), Util.class);
+ }
+ executable.setAccessible(flag);
+ }
}
src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.core.common/src/org/graalvm/compiler/core/common/util/Util.java
Index
Unified diffs
Context diffs
Sdiffs
Patch
New
Old
Previous File
Next File