Skip to content

Commit

Permalink
Merge branch 'upstream-master'
Browse files Browse the repository at this point in the history
  • Loading branch information
Datadog Syncup Service committed Jul 31, 2023
2 parents f5f5540 + b60e0ad commit 303b38a
Show file tree
Hide file tree
Showing 10 changed files with 46 additions and 36 deletions.
2 changes: 1 addition & 1 deletion src/hotspot/cpu/aarch64/downcallLinker_aarch64.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ void DowncallStubGenerator::generate() {
assert(_abi._shadow_space_bytes == 0, "not expecting shadow space on AArch64");
allocated_frame_size += arg_shuffle.out_arg_bytes();

bool should_save_return_value = !_needs_return_buffer && _needs_transition;
bool should_save_return_value = !_needs_return_buffer;
RegSpiller out_reg_spiller(_output_registers);
int spill_offset = -1;

Expand Down
2 changes: 1 addition & 1 deletion src/hotspot/cpu/ppc/downcallLinker_ppc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ void DowncallStubGenerator::generate() {
int parameter_save_area_slots = MAX2(_input_registers.length(), 8);
int allocated_frame_size = frame::native_abi_minframe_size + parameter_save_area_slots * BytesPerWord;

bool should_save_return_value = !_needs_return_buffer && _needs_transition;
bool should_save_return_value = !_needs_return_buffer;
RegSpiller out_reg_spiller(_output_registers);
int spill_offset = -1;

Expand Down
2 changes: 1 addition & 1 deletion src/hotspot/cpu/riscv/downcallLinker_riscv.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ void DowncallStubGenerator::generate() {
assert(_abi._shadow_space_bytes == 0, "not expecting shadow space on RISCV64");
allocated_frame_size += arg_shuffle.out_arg_bytes();

bool should_save_return_value = !_needs_return_buffer && _needs_transition;
bool should_save_return_value = !_needs_return_buffer;
RegSpiller out_reg_spiller(_output_registers);
int spill_offset = -1;

Expand Down
2 changes: 1 addition & 1 deletion src/hotspot/cpu/x86/downcallLinker_x86_64.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ void DowncallStubGenerator::generate() {
allocated_frame_size += arg_shuffle.out_arg_bytes();

// when we don't use a return buffer we need to spill the return value around our slow path calls
bool should_save_return_value = !_needs_return_buffer && _needs_transition;
bool should_save_return_value = !_needs_return_buffer;
RegSpiller out_reg_spiller(_output_registers);
int spill_rsp_offset = -1;

Expand Down
3 changes: 0 additions & 3 deletions src/hotspot/share/cds/metaspaceShared.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,6 @@

ReservedSpace MetaspaceShared::_symbol_rs;
VirtualSpace MetaspaceShared::_symbol_vs;
bool MetaspaceShared::_has_error_classes;
bool MetaspaceShared::_archive_loading_failed = false;
bool MetaspaceShared::_remapped_readwrite = false;
void* MetaspaceShared::_shared_metaspace_static_top = nullptr;
Expand Down Expand Up @@ -731,7 +730,6 @@ void MetaspaceShared::preload_classes(TRAPS) {
}

log_info(cds)("Loading classes to share ...");
_has_error_classes = false;
int class_count = ClassListParser::parse_classlist(classlist_path,
ClassListParser::_parse_all, CHECK);
if (ExtraSharedClassListFile) {
Expand Down Expand Up @@ -814,7 +812,6 @@ bool MetaspaceShared::try_link_class(JavaThread* current, InstanceKlass* ik) {
ik->external_name());
CLEAR_PENDING_EXCEPTION;
SystemDictionaryShared::set_class_has_failed_verification(ik);
_has_error_classes = true;
}
ik->compute_has_loops_flag_for_methods();
BytecodeVerificationLocal = saved;
Expand Down
1 change: 0 additions & 1 deletion src/hotspot/share/cds/metaspaceShared.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,6 @@ enum MapArchiveResult {
class MetaspaceShared : AllStatic {
static ReservedSpace _symbol_rs; // used only during -Xshare:dump
static VirtualSpace _symbol_vs; // used only during -Xshare:dump
static bool _has_error_classes;
static bool _archive_loading_failed;
static bool _remapped_readwrite;
static void* _shared_metaspace_static_top;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -468,10 +468,9 @@ private static ZoneInfo getZoneInfo(String zoneId,
}
if (i < savingsInstantTransitions.length) {
// javazic writes the last GMT offset into index 0!
if (i < savingsInstantTransitions.length) {
offsets[0] = standardOffsets[standardOffsets.length - 1] * 1000;
nOffsets = 1;
}
offsets[0] = standardOffsets[standardOffsets.length - 1] * 1000;
nOffsets = 1;

// ZoneInfo has a beginning entry for 1900.
// Only add it if this is not the only one in table
nOffsets = addTrans(transitions, nTrans++,
Expand Down
1 change: 1 addition & 0 deletions test/hotspot/jtreg/ProblemList.txt
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,7 @@ runtime/ErrorHandling/CreateCoredumpOnCrash.java 8267433 macosx-x64
runtime/CompressedOops/CompressedClassPointers.java 8305765 generic-all
runtime/StackGuardPages/TestStackGuardPagesNative.java 8303612 linux-all
runtime/ErrorHandling/TestDwarf.java 8305489 linux-all
runtime/ErrorHandling/MachCodeFramesInErrorFile.java 8313315 linux-ppc64le

applications/jcstress/copy.java 8229852 linux-all
applications/ctw/modules/jdk_crypto_ec.java 8312194 generic-all
Expand Down
58 changes: 35 additions & 23 deletions test/jdk/java/foreign/capturecallstate/TestCaptureCallState.java
Original file line number Diff line number Diff line change
Expand Up @@ -63,12 +63,16 @@ public class TestCaptureCallState extends NativeTestHelper {
}
}

private record SaveValuesCase(String nativeTarget, FunctionDescriptor nativeDesc, String threadLocalName, Consumer<Object> resultCheck) {}
private record SaveValuesCase(String nativeTarget, FunctionDescriptor nativeDesc, boolean trivial, String threadLocalName, Consumer<Object> resultCheck) {}

@Test(dataProvider = "cases")
public void testSavedThreadLocal(SaveValuesCase testCase) throws Throwable {
Linker.Option stl = Linker.Option.captureCallState(testCase.threadLocalName());
MethodHandle handle = downcallHandle(testCase.nativeTarget(), testCase.nativeDesc(), stl);
List<Linker.Option> options = new ArrayList<>();
options.add(Linker.Option.captureCallState(testCase.threadLocalName()));
if (testCase.trivial()) {
options.add(Linker.Option.isTrivial());
}
MethodHandle handle = downcallHandle(testCase.nativeTarget(), testCase.nativeDesc(), options.toArray(Linker.Option[]::new));

StructLayout capturedStateLayout = Linker.Option.captureStateLayout();
VarHandle errnoHandle = capturedStateLayout.varHandle(groupElement(testCase.threadLocalName()));
Expand Down Expand Up @@ -101,36 +105,44 @@ public void testInvalidCaptureSegment(MemorySegment captureSegment,
}
}

interface CaseAdder {
void addCase(String nativeTarget, FunctionDescriptor nativeDesc, String threadLocalName, Consumer<Object> resultCheck);
}

@DataProvider
public static Object[][] cases() {
List<SaveValuesCase> cases = new ArrayList<>();
CaseAdder adder = (nativeTarget, nativeDesc, threadLocalName, resultCheck) -> {
cases.add(new SaveValuesCase(nativeTarget, nativeDesc, false, threadLocalName, resultCheck));
cases.add(new SaveValuesCase(nativeTarget, nativeDesc, true, threadLocalName, resultCheck));
};

cases.add(new SaveValuesCase("set_errno_V", FunctionDescriptor.ofVoid(JAVA_INT), "errno", o -> {}));
cases.add(new SaveValuesCase("set_errno_I", FunctionDescriptor.of(JAVA_INT, JAVA_INT), "errno", o -> assertEquals((int) o, 42)));
cases.add(new SaveValuesCase("set_errno_D", FunctionDescriptor.of(JAVA_DOUBLE, JAVA_INT), "errno", o -> assertEquals((double) o, 42.0)));

cases.add(structCase("SL", Map.of(JAVA_LONG.withName("x"), 42L)));
cases.add(structCase("SLL", Map.of(JAVA_LONG.withName("x"), 42L,
JAVA_LONG.withName("y"), 42L)));
cases.add(structCase("SLLL", Map.of(JAVA_LONG.withName("x"), 42L,
JAVA_LONG.withName("y"), 42L,
JAVA_LONG.withName("z"), 42L)));
cases.add(structCase("SD", Map.of(JAVA_DOUBLE.withName("x"), 42D)));
cases.add(structCase("SDD", Map.of(JAVA_DOUBLE.withName("x"), 42D,
JAVA_DOUBLE.withName("y"), 42D)));
cases.add(structCase("SDDD", Map.of(JAVA_DOUBLE.withName("x"), 42D,
JAVA_DOUBLE.withName("y"), 42D,
JAVA_DOUBLE.withName("z"), 42D)));
adder.addCase("set_errno_V", FunctionDescriptor.ofVoid(JAVA_INT), "errno", o -> {});
adder.addCase("set_errno_I", FunctionDescriptor.of(JAVA_INT, JAVA_INT), "errno", o -> assertEquals((int) o, 42));
adder.addCase("set_errno_D", FunctionDescriptor.of(JAVA_DOUBLE, JAVA_INT), "errno", o -> assertEquals((double) o, 42.0));

structCase(adder, "SL", Map.of(JAVA_LONG.withName("x"), 42L));
structCase(adder, "SLL", Map.of(JAVA_LONG.withName("x"), 42L,
JAVA_LONG.withName("y"), 42L));
structCase(adder, "SLLL", Map.of(JAVA_LONG.withName("x"), 42L,
JAVA_LONG.withName("y"), 42L,
JAVA_LONG.withName("z"), 42L));
structCase(adder, "SD", Map.of(JAVA_DOUBLE.withName("x"), 42D));
structCase(adder, "SDD", Map.of(JAVA_DOUBLE.withName("x"), 42D,
JAVA_DOUBLE.withName("y"), 42D));
structCase(adder, "SDDD", Map.of(JAVA_DOUBLE.withName("x"), 42D,
JAVA_DOUBLE.withName("y"), 42D,
JAVA_DOUBLE.withName("z"), 42D));

if (IS_WINDOWS) {
cases.add(new SaveValuesCase("SetLastError", FunctionDescriptor.ofVoid(JAVA_INT), "GetLastError", o -> {}));
cases.add(new SaveValuesCase("WSASetLastError", FunctionDescriptor.ofVoid(JAVA_INT), "WSAGetLastError", o -> {}));
adder.addCase("SetLastError", FunctionDescriptor.ofVoid(JAVA_INT), "GetLastError", o -> {});
adder.addCase("WSASetLastError", FunctionDescriptor.ofVoid(JAVA_INT), "WSAGetLastError", o -> {});
}

return cases.stream().map(tc -> new Object[] {tc}).toArray(Object[][]::new);
}

static SaveValuesCase structCase(String name, Map<MemoryLayout, Object> fields) {
static void structCase(CaseAdder adder, String name, Map<MemoryLayout, Object> fields) {
StructLayout layout = MemoryLayout.structLayout(fields.keySet().toArray(MemoryLayout[]::new));

Consumer<Object> check = o -> {};
Expand All @@ -141,7 +153,7 @@ static SaveValuesCase structCase(String name, Map<MemoryLayout, Object> fields)
check = check.andThen(o -> assertEquals(fieldHandle.get(o), value));
}

return new SaveValuesCase("set_errno_" + name, FunctionDescriptor.of(layout, JAVA_INT), "errno", check);
adder.addCase("set_errno_" + name, FunctionDescriptor.of(layout, JAVA_INT), "errno", check);
}

@DataProvider
Expand Down
4 changes: 3 additions & 1 deletion test/jdk/java/util/Formatter/Padding.java
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@
* @run junit Padding
*/

import java.util.Locale;

import org.junit.jupiter.params.ParameterizedTest;
import org.junit.jupiter.params.provider.Arguments;
import org.junit.jupiter.params.provider.MethodSource;
Expand Down Expand Up @@ -307,7 +309,7 @@ static Arguments[] padding() {
@ParameterizedTest
@MethodSource
void padding(String expected, String format, Object value) {
assertEquals(expected, String.format(format, value));
assertEquals(expected, String.format(Locale.US, format, value));
}

}

0 comments on commit 303b38a

Please sign in to comment.