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 Oct 28, 2023
2 parents 33be2a4 + 1ec0d02 commit 41144fa
Show file tree
Hide file tree
Showing 31 changed files with 431 additions and 432 deletions.
15 changes: 12 additions & 3 deletions make/autoconf/lib-hsdis.m4
Original file line number Diff line number Diff line change
Expand Up @@ -255,16 +255,25 @@ AC_DEFUN([LIB_SETUP_HSDIS_BINUTILS],
disasm_header="\"$BINUTILS_INSTALL_DIR/include/dis-asm.h\""
if test -e $BINUTILS_INSTALL_DIR/lib/libbfd.a && \
test -e $BINUTILS_INSTALL_DIR/lib/libopcodes.a && \
test -e $BINUTILS_INSTALL_DIR/lib/libiberty.a; then
(test -e $BINUTILS_INSTALL_DIR/lib/libiberty.a || test -e $BINUTILS_INSTALL_DIR/lib64/libiberty.a); then
HSDIS_CFLAGS="-DLIBARCH_$OPENJDK_TARGET_CPU_LEGACY_LIB -I$BINUTILS_INSTALL_DIR/include"
HSDIS_LIBS="$BINUTILS_INSTALL_DIR/lib/libbfd.a $BINUTILS_INSTALL_DIR/lib/libopcodes.a $BINUTILS_INSTALL_DIR/lib/libiberty.a"
# libiberty ignores --libdir and may be installed in $BINUTILS_INSTALL_DIR/lib or $BINUTILS_INSTALL_DIR/lib64
# depending on system setup
LIBIBERTY_LIB=""
if test -e $BINUTILS_INSTALL_DIR/lib/libiberty.a; then
LIBIBERTY_LIB="$BINUTILS_INSTALL_DIR/lib/libiberty.a"
else
LIBIBERTY_LIB="$BINUTILS_INSTALL_DIR/lib64/libiberty.a"
fi
HSDIS_LIBS="$BINUTILS_INSTALL_DIR/lib/libbfd.a $BINUTILS_INSTALL_DIR/lib/libopcodes.a $LIBIBERTY_LIB"
# If we have libsframe add it.
if test -e $BINUTILS_INSTALL_DIR/lib/libsframe.a; then
HSDIS_LIBS="$HSDIS_LIBS $BINUTILS_INSTALL_DIR/lib/libsframe.a"
fi
AC_CHECK_LIB(z, deflate, [ HSDIS_LIBS="$HSDIS_LIBS -lz" ], AC_MSG_ERROR([libz not found]))
else
AC_MSG_ERROR(["$BINUTILS_INSTALL_DIR/libs/ must contain libbfd.a, libopcodes.a, libiberty.a"])
AC_MSG_ERROR(["$BINUTILS_INSTALL_DIR/lib[64] must contain libbfd.a, libopcodes.a and libiberty.a"])
fi
fi
Expand Down
14 changes: 12 additions & 2 deletions src/hotspot/cpu/riscv/macroAssembler_riscv.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2408,7 +2408,12 @@ int MacroAssembler::corrected_idivl(Register result, Register rs1, Register rs2,
divuw(result, rs1, rs2);
}
} else {
remw(result, rs1, rs2); // result = rs1 % rs2;
// result = rs1 % rs2;
if (is_signed) {
remw(result, rs1, rs2);
} else {
remuw(result, rs1, rs2);
}
}
return idivl_offset;
}
Expand All @@ -2435,7 +2440,12 @@ int MacroAssembler::corrected_idivq(Register result, Register rs1, Register rs2,
divu(result, rs1, rs2);
}
} else {
rem(result, rs1, rs2); // result = rs1 % rs2;
// result = rs1 % rs2;
if (is_signed) {
rem(result, rs1, rs2);
} else {
remu(result, rs1, rs2);
}
}
return idivq_offset;
}
Expand Down
34 changes: 34 additions & 0 deletions src/hotspot/cpu/riscv/riscv.ad
Original file line number Diff line number Diff line change
Expand Up @@ -2478,6 +2478,14 @@ encode %{
__ corrected_idivl(dst_reg, src1_reg, src2_reg, /* want_remainder */ true, /* is_signed */ true);
%}

enc_class riscv_enc_moduw(iRegI dst, iRegI src1, iRegI src2) %{
C2_MacroAssembler _masm(&cbuf);
Register dst_reg = as_Register($dst$$reg);
Register src1_reg = as_Register($src1$$reg);
Register src2_reg = as_Register($src2$$reg);
__ corrected_idivl(dst_reg, src1_reg, src2_reg, /* want_remainder */ true, /* is_signed */ false);
%}

enc_class riscv_enc_mod(iRegI dst, iRegI src1, iRegI src2) %{
C2_MacroAssembler _masm(&cbuf);
Register dst_reg = as_Register($dst$$reg);
Expand All @@ -2486,6 +2494,14 @@ encode %{
__ corrected_idivq(dst_reg, src1_reg, src2_reg, /* want_remainder */ true, /* is_signed */ true);
%}

enc_class riscv_enc_modu(iRegI dst, iRegI src1, iRegI src2) %{
C2_MacroAssembler _masm(&cbuf);
Register dst_reg = as_Register($dst$$reg);
Register src1_reg = as_Register($src1$$reg);
Register src2_reg = as_Register($src2$$reg);
__ corrected_idivq(dst_reg, src1_reg, src2_reg, /* want_remainder */ true, /* is_signed */ false);
%}

enc_class riscv_enc_tail_call(iRegP jump_target) %{
C2_MacroAssembler _masm(&cbuf);
Register target_reg = as_Register($jump_target$$reg);
Expand Down Expand Up @@ -6752,6 +6768,15 @@ instruct modI(iRegINoSp dst, iRegIorL2I src1, iRegIorL2I src2) %{
ins_pipe(ialu_reg_reg);
%}

instruct UmodI(iRegINoSp dst, iRegIorL2I src1, iRegIorL2I src2) %{
match(Set dst (UModI src1 src2));
ins_cost(IDIVSI_COST);
format %{ "remuw $dst, $src1, $src2\t#@UmodI" %}

ins_encode(riscv_enc_moduw(dst, src1, src2));
ins_pipe(ialu_reg_reg);
%}

// Long Remainder

instruct modL(iRegLNoSp dst, iRegL src1, iRegL src2) %{
Expand All @@ -6763,6 +6788,15 @@ instruct modL(iRegLNoSp dst, iRegL src1, iRegL src2) %{
ins_pipe(ialu_reg_reg);
%}

instruct UmodL(iRegLNoSp dst, iRegL src1, iRegL src2) %{
match(Set dst (UModL src1 src2));
ins_cost(IDIVDI_COST);
format %{ "remu $dst, $src1, $src2\t#@UmodL" %}

ins_encode(riscv_enc_modu(dst, src1, src2));
ins_pipe(ialu_reg_reg);
%}

// Integer Shifts

// Shift Left Register
Expand Down
32 changes: 1 addition & 31 deletions src/java.desktop/macosx/native/libawt_lwawt/awt/InitIDs.m
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2011, 2012, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2011, 2023, 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
Expand Down Expand Up @@ -32,11 +32,6 @@
{
}

JNIEXPORT void JNICALL Java_java_awt_Button_initIDs
(JNIEnv *env, jclass cls)
{
}

JNIEXPORT void JNICALL Java_java_awt_Checkbox_initIDs
(JNIEnv *env, jclass cls)
{
Expand All @@ -52,11 +47,6 @@
{
}

JNIEXPORT void JNICALL Java_java_awt_Color_initIDs
(JNIEnv *env, jclass cls)
{
}

JNIEXPORT void JNICALL Java_java_awt_Component_initIDs
(JNIEnv *env, jclass cls)
{
Expand Down Expand Up @@ -87,11 +77,6 @@
{
}

JNIEXPORT void JNICALL Java_java_awt_FileDialog_initIDs
(JNIEnv *env, jclass cls)
{
}

JNIEXPORT void JNICALL Java_java_awt_Font_initIDs
(JNIEnv *env, jclass cls)
{
Expand All @@ -112,11 +97,6 @@
{
}

JNIEXPORT void JNICALL Java_java_awt_KeyboardFocusManager_initIDs
(JNIEnv *env, jclass cls)
{
}

JNIEXPORT void JNICALL Java_java_awt_Label_initIDs
(JNIEnv *env, jclass cls)
{
Expand All @@ -142,11 +122,6 @@
{
}

JNIEXPORT void JNICALL Java_java_awt_Rectangle_initIDs
(JNIEnv *env, jclass cls)
{
}

JNIEXPORT void JNICALL Java_java_awt_ScrollPane_initIDs
(JNIEnv *env, jclass cls)
{
Expand All @@ -167,11 +142,6 @@
{
}

JNIEXPORT void JNICALL Java_java_awt_TextField_initIDs
(JNIEnv *env, jclass cls)
{
}

JNIEXPORT void JNICALL Java_java_awt_Toolkit_initIDs
(JNIEnv *env, jclass cls)
{
Expand Down
17 changes: 1 addition & 16 deletions src/java.desktop/share/classes/java/awt/Button.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 1995, 2021, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1995, 2023, 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
Expand Down Expand Up @@ -122,21 +122,6 @@ public class Button extends Component implements Accessible {
@Serial
private static final long serialVersionUID = -8774683716313001058L;


static {
/* ensure that the necessary native libraries are loaded */
Toolkit.loadLibraries();
if (!GraphicsEnvironment.isHeadless()) {
initIDs();
}
}

/**
* Initialize JNI field and method IDs for fields that may be
* accessed from C.
*/
private static native void initIDs();

/**
* Constructs a button with an empty string for its label.
*
Expand Down
22 changes: 1 addition & 21 deletions src/java.desktop/share/classes/java/awt/Color.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 1995, 2021, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1995, 2023, 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
Expand Down Expand Up @@ -260,26 +260,6 @@ public class Color implements Paint, java.io.Serializable {
@Serial
private static final long serialVersionUID = 118526816881161077L;

/**
* Initialize JNI field and method IDs
*/
private static native void initIDs();

static {
/** 4112352 - Calling getDefaultToolkit()
** here can cause this class to be accessed before it is fully
** initialized. DON'T DO IT!!!
**
** Toolkit.getDefaultToolkit();
**/

/* ensure that the necessary native libraries are loaded */
Toolkit.loadLibraries();
if (!GraphicsEnvironment.isHeadless()) {
initIDs();
}
}

/**
* Checks the color integer components supplied for validity.
* Throws an {@link IllegalArgumentException} if the value is out of
Expand Down
20 changes: 4 additions & 16 deletions src/java.desktop/share/classes/java/awt/FileDialog.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 1995, 2021, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1995, 2023, 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
Expand Down Expand Up @@ -31,6 +31,7 @@
import java.io.IOException;
import java.io.ObjectInputStream;
import java.io.Serial;
import java.lang.annotation.Native;

import sun.awt.AWTAccessor;

Expand All @@ -55,12 +56,14 @@ public class FileDialog extends Dialog {
* This constant value indicates that the purpose of the file
* dialog window is to locate a file from which to read.
*/
@Native
public static final int LOAD = 0;

/**
* This constant value indicates that the purpose of the file
* dialog window is to locate a file to which to write.
*/
@Native
public static final int SAVE = 1;

/**
Expand Down Expand Up @@ -140,15 +143,6 @@ public class FileDialog extends Dialog {
@Serial
private static final long serialVersionUID = 5035145889651310422L;


static {
/* ensure that the necessary native libraries are loaded */
Toolkit.loadLibraries();
if (!GraphicsEnvironment.isHeadless()) {
initIDs();
}
}

static {
AWTAccessor.setFileDialogAccessor(
new AWTAccessor.FileDialogAccessor() {
Expand All @@ -169,12 +163,6 @@ public boolean isMultipleMode(FileDialog fileDialog) {
});
}

/**
* Initialize JNI field and method IDs for fields that may be
accessed from C.
*/
private static native void initIDs();

/**
* Creates a file dialog for loading a file. The title of the
* file dialog is initially empty. This is a convenience method for
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2000, 2022, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2000, 2023, 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
Expand Down Expand Up @@ -109,11 +109,6 @@ public abstract class KeyboardFocusManager
private static final PlatformLogger focusLog = PlatformLogger.getLogger("java.awt.focus.KeyboardFocusManager");

static {
/* ensure that the necessary native libraries are loaded */
Toolkit.loadLibraries();
if (!GraphicsEnvironment.isHeadless()) {
initIDs();
}
AWTAccessor.setKeyboardFocusManagerAccessor(
new AWTAccessor.KeyboardFocusManagerAccessor() {
public int shouldNativelyFocusHeavyweight(Component heavyweight,
Expand Down Expand Up @@ -157,11 +152,6 @@ public Container getCurrentFocusCycleRoot() {

transient KeyboardFocusManagerPeer peer;

/**
* Initialize JNI field and method IDs
*/
private static native void initIDs();

private static final PlatformLogger log = PlatformLogger.getLogger("java.awt.KeyboardFocusManager");

/**
Expand Down
15 changes: 1 addition & 14 deletions src/java.desktop/share/classes/java/awt/Rectangle.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 1995, 2021, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1995, 2023, 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
Expand Down Expand Up @@ -165,19 +165,6 @@ public class Rectangle extends Rectangle2D
@Serial
private static final long serialVersionUID = -4345857070255674764L;

/**
* Initialize JNI field and method IDs
*/
private static native void initIDs();

static {
/* ensure that the necessary native libraries are loaded */
Toolkit.loadLibraries();
if (!GraphicsEnvironment.isHeadless()) {
initIDs();
}
}

/**
* Constructs a new {@code Rectangle} whose upper-left corner
* is at (0, 0) in the coordinate space, and whose width and
Expand Down
Loading

0 comments on commit 41144fa

Please sign in to comment.