Skip to content

Commit

Permalink
Merge upstream-jdk
Browse files Browse the repository at this point in the history
  • Loading branch information
corretto-github-robot committed Dec 13, 2024
2 parents 7bdae84 + 897a8ab commit 8e8c67b
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 9 deletions.
12 changes: 9 additions & 3 deletions src/hotspot/share/oops/compressedKlass.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -258,9 +258,15 @@ class CompressedKlassPointers : public AllStatic {
is_aligned(addr, klass_alignment_in_bytes());
}

// Check that with the given base, shift and range, aarch64 an encode and decode the klass pointer.
static bool check_klass_decode_mode(address base, int shift, const size_t range) NOT_AARCH64({ return true;});
static bool set_klass_decode_mode() NOT_AARCH64({ return true;}); // can be called after initialization
#if defined(AARCH64) && !defined(ZERO)
// Check that with the given base, shift and range, aarch64 code can encode and decode the klass pointer.
static bool check_klass_decode_mode(address base, int shift, const size_t range);
// Called after initialization.
static bool set_klass_decode_mode();
#else
static bool check_klass_decode_mode(address base, int shift, const size_t range) { return true; }
static bool set_klass_decode_mode() { return true; }
#endif
};

#endif // SHARE_OOPS_COMPRESSEDKLASS_HPP
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@
import java.util.stream.Stream;
import java.util.stream.StreamSupport;

import jdk.internal.classfile.components.ClassPrinter;

/**
* A {@link ClassFileElement} that has complex structure defined in terms of
* other classfile elements, such as a method, field, method body, or entire
Expand Down Expand Up @@ -92,4 +94,14 @@ public void accept(E e) {
return Collections.unmodifiableList(list);
}

/**
* {@return a text representation of the compound element and its contents for debugging purposes}
*
* The format, structure and exact contents of the returned string are not specified and may change at any time in the future.
*/
default String toDebugString() {
StringBuilder text = new StringBuilder();
ClassPrinter.toYaml(this, ClassPrinter.Verbosity.TRACE_ALL, text::append);
return text.toString();
}
}
3 changes: 1 addition & 2 deletions src/java.base/share/classes/java/util/ResourceBundle.java
Original file line number Diff line number Diff line change
Expand Up @@ -3654,8 +3654,7 @@ private static String toPackageName(String bundleName) {

}

private static final boolean TRACE_ON = Boolean.getBoolean(
System.getProperty("resource.bundle.debug", "false"));
private static final boolean TRACE_ON = Boolean.getBoolean("resource.bundle.debug");

private static void trace(String format, Object... params) {
if (TRACE_ON)
Expand Down
7 changes: 3 additions & 4 deletions test/jdk/jdk/classfile/ClassPrinterTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@

/*
* @test
* @bug 8335927
* @bug 8335927 8345773
* @summary Testing ClassFile ClassPrinter.
* @run junit ClassPrinterTest
*/
Expand Down Expand Up @@ -122,8 +122,7 @@ ClassModel getClassModel() {

@Test
void testPrintYamlTraceAll() throws IOException {
var out = new StringBuilder();
ClassPrinter.toYaml(getClassModel(), ClassPrinter.Verbosity.TRACE_ALL, out::append);
var out = getClassModel().toDebugString();
assertOut(out,
"""
- class name: Foo
Expand Down Expand Up @@ -904,7 +903,7 @@ void testWalkMembersOnly() throws IOException {
assertEquals(node.walk().count(), 42);
}

private static void assertOut(StringBuilder out, String expected) {
private static void assertOut(CharSequence out, String expected) {
// System.out.println("-----------------");
// System.out.println(out.toString());
// System.out.println("-----------------");
Expand Down

0 comments on commit 8e8c67b

Please sign in to comment.