diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 0e64ad78625..8c058440ad7 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -310,7 +310,7 @@ jobs: uses: ./.github/workflows/build-windows.yml with: platform: windows-x64 - msvc-toolset-version: '14.43' + msvc-toolset-version: '14.44' msvc-toolset-architecture: 'x86.x64' configure-arguments: ${{ github.event.inputs.configure-arguments }} make-arguments: ${{ github.event.inputs.make-arguments }} @@ -322,7 +322,7 @@ jobs: uses: ./.github/workflows/build-windows.yml with: platform: windows-aarch64 - msvc-toolset-version: '14.43' + msvc-toolset-version: '14.44' msvc-toolset-architecture: 'arm64' make-target: 'hotspot' extra-conf-options: '--openjdk-target=aarch64-unknown-cygwin' diff --git a/doc/hotspot-style.html b/doc/hotspot-style.html index d4c06fbd6bd..dafd29d6f54 100644 --- a/doc/hotspot-style.html +++ b/doc/hotspot-style.html @@ -77,6 +77,9 @@

HotSpot Coding Style

  • thread_local
  • nullptr
  • <atomic>
  • +
  • Initializing +variables with static storage duration
  • Uniform Initialization
  • HotSpot Coding Style
  • Inheriting constructors
  • Attributes
  • +
  • noexcept
  • Additional Permitted Features
  • @@ -791,6 +795,33 @@

    <atomic>

    "conservative" memory ordering, which may differ from (may be stronger than) sequentially consistent. There are algorithms in HotSpot that are believed to rely on that ordering.

    +

    Initializing +variables with static storage duration

    +

    Variables with static storage duration and dynamic +initialization C++14 +3.6.2). should be avoided, unless an implementation is permitted to +perform the initialization as a static initialization. The order in +which dynamic initializations occur is incompletely specified. +Initialization order problems can be difficult to deal with and lead to +surprises.

    +

    Variables with static storage duration and non-trivial destructors +should be avoided. HotSpot doesn't generally try to cleanup on exit, and +running destructors at exit can lead to problems.

    +

    Some of the approaches used in HotSpot to avoid dynamic +initialization include:

    +

    Uniform Initialization

    The use of uniform initialization (n2672), @@ -1110,6 +1141,58 @@

    Attributes

    memory_order_consume.
  • [[deprecated]] - Not relevant in HotSpot code.
  • +

    noexcept

    +

    Use of noexcept exception specifications (n3050) are permitted with restrictions +described below.

    + +

    HotSpot is built with exceptions disabled, e.g. compile with +-fno-exceptions (gcc, clang) or no /EH option +(MSVC++). So why do we need to consider noexcept at all? +It's because noexcept exception specifications serve two +distinct purposes.

    +

    The first is to allow the compiler to avoid generating code or data +in support of exceptions being thrown by a function. But this is +unnecessary, because exceptions are disabled.

    +

    The second is to allow the compiler and library code to choose +different algorithms, depending on whether some function may throw +exceptions. This is only relevant to a certain set of functions.

    + +

    HotSpot code can assume no exceptions will ever be thrown, even from +functions not declared noexcept. So HotSpot code doesn't +ever need to check, either with conditional exception specifications or +with noexcept expressions.

    +

    Dynamic exception specifications were deprecated in C++11. C++17 +removed all but throw(), with that remaining a deprecated +equivalent to noexcept.

    Additional Permitted Features

    * @@ -137,7 +144,7 @@ * } * }} * - *

    This interface does not define methods for initially creating, + *

    The {@code CompletionStage} interface does not define methods for initially creating, * forcibly completing normally or exceptionally, probing completion * status or results, or awaiting completion of a stage. * Implementations of CompletionStage may provide means of achieving @@ -145,6 +152,13 @@ * enables interoperability among different implementations of this * interface by providing a common conversion type. * + *

    Memory consistency effects: Actions in a thread prior to the + * submission of a computation producing a {@code CompletionStage} happen-before + * that computation begins. And actions taken by {@code + * CompletionStage x} happen-before actions of any dependent + * stage subsequent to {@code x}'s completion. + * * @param the type of values the stage produces or consumes * * @author Doug Lea @@ -153,8 +167,8 @@ public interface CompletionStage { /** - * Returns a new CompletionStage that, when this stage completes - * normally, is executed with this stage's result as the argument + * Returns a new CompletionStage that, when {@code this} stage completes + * normally, is executed with {@code this} stage's result as the argument * to the supplied function. * *

    This method is analogous to @@ -172,9 +186,9 @@ public interface CompletionStage { public CompletionStage thenApply(Function fn); /** - * Returns a new CompletionStage that, when this stage completes - * normally, is executed using this stage's default asynchronous - * execution facility, with this stage's result as the argument to + * Returns a new CompletionStage that, when {@code this} stage completes + * normally, is executed using {@code this} stage's default asynchronous + * execution facility, with {@code this} stage's result as the argument to * the supplied function. * * See the {@link CompletionStage} documentation for rules @@ -189,8 +203,8 @@ public interface CompletionStage { (Function fn); /** - * Returns a new CompletionStage that, when this stage completes - * normally, is executed using the supplied Executor, with this + * Returns a new CompletionStage that, when {@code this} stage completes + * normally, is executed using the supplied Executor, with {@code this} * stage's result as the argument to the supplied function. * * See the {@link CompletionStage} documentation for rules @@ -207,8 +221,8 @@ public interface CompletionStage { Executor executor); /** - * Returns a new CompletionStage that, when this stage completes - * normally, is executed with this stage's result as the argument + * Returns a new CompletionStage that, when {@code this} stage completes + * normally, is executed with {@code this} stage's result as the argument * to the supplied action. * * See the {@link CompletionStage} documentation for rules @@ -221,9 +235,9 @@ public interface CompletionStage { public CompletionStage thenAccept(Consumer action); /** - * Returns a new CompletionStage that, when this stage completes - * normally, is executed using this stage's default asynchronous - * execution facility, with this stage's result as the argument to + * Returns a new CompletionStage that, when {@code this} stage completes + * normally, is executed using {@code this} stage's default asynchronous + * execution facility, with {@code this} stage's result as the argument to * the supplied action. * * See the {@link CompletionStage} documentation for rules @@ -236,8 +250,8 @@ public interface CompletionStage { public CompletionStage thenAcceptAsync(Consumer action); /** - * Returns a new CompletionStage that, when this stage completes - * normally, is executed using the supplied Executor, with this + * Returns a new CompletionStage that, when {@code this} stage completes + * normally, is executed using the supplied Executor, with {@code this} * stage's result as the argument to the supplied action. * * See the {@link CompletionStage} documentation for rules @@ -251,7 +265,7 @@ public interface CompletionStage { public CompletionStage thenAcceptAsync(Consumer action, Executor executor); /** - * Returns a new CompletionStage that, when this stage completes + * Returns a new CompletionStage that, when {@code this} stage completes * normally, executes the given action. * * See the {@link CompletionStage} documentation for rules @@ -264,8 +278,8 @@ public CompletionStage thenAcceptAsync(Consumer action, public CompletionStage thenRun(Runnable action); /** - * Returns a new CompletionStage that, when this stage completes - * normally, executes the given action using this stage's default + * Returns a new CompletionStage that, when {@code this} stage completes + * normally, executes the given action using {@code this} stage's default * asynchronous execution facility. * * See the {@link CompletionStage} documentation for rules @@ -278,7 +292,7 @@ public CompletionStage thenAcceptAsync(Consumer action, public CompletionStage thenRunAsync(Runnable action); /** - * Returns a new CompletionStage that, when this stage completes + * Returns a new CompletionStage that, when {@code this} stage completes * normally, executes the given action using the supplied Executor. * * See the {@link CompletionStage} documentation for rules @@ -293,7 +307,7 @@ public CompletionStage thenRunAsync(Runnable action, Executor executor); /** - * Returns a new CompletionStage that, when this and the other + * Returns a new CompletionStage that, when {@code this} and the other * given stage both complete normally, is executed with the two * results as arguments to the supplied function. * @@ -312,8 +326,8 @@ public CompletionStage thenRunAsync(Runnable action, BiFunction fn); /** - * Returns a new CompletionStage that, when this and the other - * given stage both complete normally, is executed using this + * Returns a new CompletionStage that, when {@code this} and the other + * given stage both complete normally, is executed using {@code this} * stage's default asynchronous execution facility, with the two * results as arguments to the supplied function. * @@ -332,7 +346,7 @@ public CompletionStage thenRunAsync(Runnable action, BiFunction fn); /** - * Returns a new CompletionStage that, when this and the other + * Returns a new CompletionStage that, when {@code this} and the other * given stage both complete normally, is executed using the * supplied executor, with the two results as arguments to the * supplied function. @@ -354,7 +368,7 @@ public CompletionStage thenRunAsync(Runnable action, Executor executor); /** - * Returns a new CompletionStage that, when this and the other + * Returns a new CompletionStage that, when {@code this} and the other * given stage both complete normally, is executed with the two * results as arguments to the supplied action. * @@ -372,8 +386,8 @@ public CompletionStage thenRunAsync(Runnable action, BiConsumer action); /** - * Returns a new CompletionStage that, when this and the other - * given stage both complete normally, is executed using this + * Returns a new CompletionStage that, when {@code this} and the other + * given stage both complete normally, is executed using {@code this} * stage's default asynchronous execution facility, with the two * results as arguments to the supplied action. * @@ -391,7 +405,7 @@ public CompletionStage thenRunAsync(Runnable action, BiConsumer action); /** - * Returns a new CompletionStage that, when this and the other + * Returns a new CompletionStage that, when {@code this} and the other * given stage both complete normally, is executed using the * supplied executor, with the two results as arguments to the * supplied action. @@ -412,7 +426,7 @@ public CompletionStage thenRunAsync(Runnable action, Executor executor); /** - * Returns a new CompletionStage that, when this and the other + * Returns a new CompletionStage that, when {@code this} and the other * given stage both complete normally, executes the given action. * * See the {@link CompletionStage} documentation for rules @@ -426,9 +440,9 @@ public CompletionStage thenRunAsync(Runnable action, public CompletionStage runAfterBoth(CompletionStage other, Runnable action); /** - * Returns a new CompletionStage that, when this and the other + * Returns a new CompletionStage that, when {@code this} and the other * given stage both complete normally, executes the given action - * using this stage's default asynchronous execution facility. + * using {@code this} stage's default asynchronous execution facility. * * See the {@link CompletionStage} documentation for rules * covering exceptional completion. @@ -442,7 +456,7 @@ public CompletionStage runAfterBothAsync(CompletionStage other, Runnable action); /** - * Returns a new CompletionStage that, when this and the other + * Returns a new CompletionStage that, when {@code this} and the other * given stage both complete normally, executes the given action * using the supplied executor. * @@ -459,7 +473,7 @@ public CompletionStage runAfterBothAsync(CompletionStage other, Runnable action, Executor executor); /** - * Returns a new CompletionStage that, when either this or the + * Returns a new CompletionStage that, when either {@code this} or the * other given stage complete normally, is executed with the * corresponding result as argument to the supplied function. * @@ -477,8 +491,8 @@ public CompletionStage runAfterBothAsync(CompletionStage other, Function fn); /** - * Returns a new CompletionStage that, when either this or the - * other given stage complete normally, is executed using this + * Returns a new CompletionStage that, when either {@code this} or the + * other given stage complete normally, is executed using {@code this} * stage's default asynchronous execution facility, with the * corresponding result as argument to the supplied function. * @@ -496,7 +510,7 @@ public CompletionStage runAfterBothAsync(CompletionStage other, Function fn); /** - * Returns a new CompletionStage that, when either this or the + * Returns a new CompletionStage that, when either {@code this} or the * other given stage complete normally, is executed using the * supplied executor, with the corresponding result as argument to * the supplied function. @@ -517,7 +531,7 @@ public CompletionStage runAfterBothAsync(CompletionStage other, Executor executor); /** - * Returns a new CompletionStage that, when either this or the + * Returns a new CompletionStage that, when either {@code this} or the * other given stage complete normally, is executed with the * corresponding result as argument to the supplied action. * @@ -534,8 +548,8 @@ public CompletionStage runAfterBothAsync(CompletionStage other, Consumer action); /** - * Returns a new CompletionStage that, when either this or the - * other given stage complete normally, is executed using this + * Returns a new CompletionStage that, when either {@code this} or the + * other given stage complete normally, is executed using {@code this} * stage's default asynchronous execution facility, with the * corresponding result as argument to the supplied action. * @@ -552,7 +566,7 @@ public CompletionStage runAfterBothAsync(CompletionStage other, Consumer action); /** - * Returns a new CompletionStage that, when either this or the + * Returns a new CompletionStage that, when either {@code this} or the * other given stage complete normally, is executed using the * supplied executor, with the corresponding result as argument to * the supplied action. @@ -572,7 +586,7 @@ public CompletionStage runAfterBothAsync(CompletionStage other, Executor executor); /** - * Returns a new CompletionStage that, when either this or the + * Returns a new CompletionStage that, when either {@code this} or the * other given stage complete normally, executes the given action. * * See the {@link CompletionStage} documentation for rules @@ -587,9 +601,9 @@ public CompletionStage runAfterEither(CompletionStage other, Runnable action); /** - * Returns a new CompletionStage that, when either this or the + * Returns a new CompletionStage that, when either {@code this} or the * other given stage complete normally, executes the given action - * using this stage's default asynchronous execution facility. + * using {@code this} stage's default asynchronous execution facility. * * See the {@link CompletionStage} documentation for rules * covering exceptional completion. @@ -604,7 +618,7 @@ public CompletionStage runAfterEither(CompletionStage other, Runnable action); /** - * Returns a new CompletionStage that, when either this or the + * Returns a new CompletionStage that, when either {@code this} or the * other given stage complete normally, executes the given action * using the supplied executor. * @@ -626,10 +640,10 @@ public CompletionStage runAfterEither(CompletionStage other, * Returns a new CompletionStage that is completed with the same * value as the CompletionStage returned by the given function. * - *

    When this stage completes normally, the given function is - * invoked with this stage's result as the argument, returning + *

    When {@code this} stage completes normally, the given function is + * invoked with {@code this} stage's result as the argument, returning * another CompletionStage. When that stage completes normally, - * the CompletionStage returned by this method is completed with + * the CompletionStage returned is completed with * the same value. * *

    To ensure progress, the supplied function must arrange @@ -652,13 +666,13 @@ public CompletionStage runAfterEither(CompletionStage other, /** * Returns a new CompletionStage that is completed with the same * value as the CompletionStage returned by the given function, - * executed using this stage's default asynchronous execution + * executed using {@code this} stage's default asynchronous execution * facility. * - *

    When this stage completes normally, the given function is - * invoked with this stage's result as the argument, returning + *

    When {@code this} stage completes normally, the given function is + * invoked with {@code this} stage's result as the argument, returning * another CompletionStage. When that stage completes normally, - * the CompletionStage returned by this method is completed with + * the CompletionStage returned is completed with * the same value. * *

    To ensure progress, the supplied function must arrange @@ -679,10 +693,10 @@ public CompletionStage runAfterEither(CompletionStage other, * value as the CompletionStage returned by the given function, * executed using the supplied Executor. * - *

    When this stage completes normally, the given function is - * invoked with this stage's result as the argument, returning + *

    When {@code this} stage completes normally, the given function is + * invoked with {@code this} stage's result as the argument, returning * another CompletionStage. When that stage completes normally, - * the CompletionStage returned by this method is completed with + * the CompletionStage returned by {@code this} method is completed with * the same value. * *

    To ensure progress, the supplied function must arrange @@ -701,13 +715,13 @@ public CompletionStage runAfterEither(CompletionStage other, Executor executor); /** - * Returns a new CompletionStage that, when this stage completes - * either normally or exceptionally, is executed with this stage's + * Returns a new CompletionStage that, when {@code this} stage completes + * either normally or exceptionally, is executed with {@code this} stage's * result and exception as arguments to the supplied function. * - *

    When this stage is complete, the given function is invoked + *

    When {@code this} stage is complete, the given function is invoked * with the result (or {@code null} if none) and the exception (or - * {@code null} if none) of this stage as arguments, and the + * {@code null} if none) of {@code this} stage as arguments, and the * function's result is used to complete the returned stage. * * @param fn the function to use to compute the value of the @@ -719,14 +733,14 @@ public CompletionStage runAfterEither(CompletionStage other, (BiFunction fn); /** - * Returns a new CompletionStage that, when this stage completes - * either normally or exceptionally, is executed using this stage's - * default asynchronous execution facility, with this stage's + * Returns a new CompletionStage that, when {@code this} stage completes + * either normally or exceptionally, is executed using {@code this} stage's + * default asynchronous execution facility, with {@code this} stage's * result and exception as arguments to the supplied function. * - *

    When this stage is complete, the given function is invoked + *

    When {@code this} stage is complete, the given function is invoked * with the result (or {@code null} if none) and the exception (or - * {@code null} if none) of this stage as arguments, and the + * {@code null} if none) of {@code this} stage as arguments, and the * function's result is used to complete the returned stage. * * @param fn the function to use to compute the value of the @@ -738,14 +752,14 @@ public CompletionStage runAfterEither(CompletionStage other, (BiFunction fn); /** - * Returns a new CompletionStage that, when this stage completes + * Returns a new CompletionStage that, when {@code this} stage completes * either normally or exceptionally, is executed using the - * supplied executor, with this stage's result and exception as + * supplied executor, with {@code this} stage's result and exception as * arguments to the supplied function. * - *

    When this stage is complete, the given function is invoked + *

    When {@code this} stage is complete, the given function is invoked * with the result (or {@code null} if none) and the exception (or - * {@code null} if none) of this stage as arguments, and the + * {@code null} if none) of {@code this} stage as arguments, and the * function's result is used to complete the returned stage. * * @param fn the function to use to compute the value of the @@ -760,22 +774,22 @@ public CompletionStage runAfterEither(CompletionStage other, /** * Returns a new CompletionStage with the same result or exception as - * this stage, that executes the given action when this stage completes. + * {@code this} stage, that executes the given action when {@code this} stage completes. * - *

    When this stage is complete, the given action is invoked + *

    When {@code this} stage is complete, the given action is invoked * with the result (or {@code null} if none) and the exception (or - * {@code null} if none) of this stage as arguments. The returned + * {@code null} if none) of {@code this} stage as arguments. The returned * stage is completed when the action returns. * *

    Unlike method {@link #handle handle}, - * this method is not designed to translate completion outcomes, + * method {@code whenComplete} is not designed to translate completion outcomes, * so the supplied action should not throw an exception. However, - * if it does, the following rules apply: if this stage completed + * if it does, the following rules apply: if {@code this} stage completed * normally but the supplied action throws an exception, then the * returned stage completes exceptionally with the supplied - * action's exception. Or, if this stage completed exceptionally + * action's exception. Or, if {@code this} stage completed exceptionally * and the supplied action throws an exception, then the returned - * stage completes exceptionally with this stage's exception. + * stage completes exceptionally with {@code this} stage's exception. * * @param action the action to perform * @return the new CompletionStage @@ -785,23 +799,23 @@ public CompletionStage runAfterEither(CompletionStage other, /** * Returns a new CompletionStage with the same result or exception as - * this stage, that executes the given action using this stage's - * default asynchronous execution facility when this stage completes. + * {@code this} stage, that executes the given action using {@code this} stage's + * default asynchronous execution facility when {@code this} stage completes. * - *

    When this stage is complete, the given action is invoked with the + *

    When {@code this} stage is complete, the given action is invoked with the * result (or {@code null} if none) and the exception (or {@code null} - * if none) of this stage as arguments. The returned stage is completed + * if none) of {@code this} stage as arguments. The returned stage is completed * when the action returns. * *

    Unlike method {@link #handleAsync(BiFunction) handleAsync}, - * this method is not designed to translate completion outcomes, + * method {@code whenCompleteAsync} is not designed to translate completion outcomes, * so the supplied action should not throw an exception. However, - * if it does, the following rules apply: If this stage completed + * if it does, the following rules apply: If {@code this} stage completed * normally but the supplied action throws an exception, then the * returned stage completes exceptionally with the supplied - * action's exception. Or, if this stage completed exceptionally + * action's exception. Or, if {@code this} stage completed exceptionally * and the supplied action throws an exception, then the returned - * stage completes exceptionally with this stage's exception. + * stage completes exceptionally with {@code this} stage's exception. * * @param action the action to perform * @return the new CompletionStage @@ -811,23 +825,23 @@ public CompletionStage runAfterEither(CompletionStage other, /** * Returns a new CompletionStage with the same result or exception as - * this stage, that executes the given action using the supplied - * Executor when this stage completes. + * {@code this} stage, that executes the given action using the supplied + * Executor when {@code this} stage completes. * - *

    When this stage is complete, the given action is invoked with the + *

    When {@code this} stage is complete, the given action is invoked with the * result (or {@code null} if none) and the exception (or {@code null} - * if none) of this stage as arguments. The returned stage is completed + * if none) of {@code this} stage as arguments. The returned stage is completed * when the action returns. * *

    Unlike method {@link #handleAsync(BiFunction,Executor) handleAsync}, - * this method is not designed to translate completion outcomes, + * method {@code whenCompleteAsync} is not designed to translate completion outcomes, * so the supplied action should not throw an exception. However, - * if it does, the following rules apply: If this stage completed + * if it does, the following rules apply: If {@code this} stage completed * normally but the supplied action throws an exception, then the * returned stage completes exceptionally with the supplied - * action's exception. Or, if this stage completed exceptionally + * action's exception. Or, if {@code this} stage completed exceptionally * and the supplied action throws an exception, then the returned - * stage completes exceptionally with this stage's exception. + * stage completes exceptionally with {@code this} stage's exception. * * @param action the action to perform * @param executor the executor to use for asynchronous execution @@ -838,14 +852,14 @@ public CompletionStage runAfterEither(CompletionStage other, Executor executor); /** - * Returns a new CompletionStage that, when this stage completes - * exceptionally, is executed with this stage's exception as the - * argument to the supplied function. Otherwise, if this stage + * Returns a new CompletionStage that, when {@code this} stage completes + * exceptionally, is executed with {@code this} stage's exception as the + * argument to the supplied function. Otherwise, if {@code this} stage * completes normally, then the returned stage also completes * normally with the same value. * * @param fn the function to use to compute the value of the - * returned CompletionStage if this CompletionStage completed + * returned CompletionStage if {@code this} CompletionStage completed * exceptionally * @return the new CompletionStage */ @@ -853,10 +867,10 @@ public CompletionStage runAfterEither(CompletionStage other, (Function fn); /** - * Returns a new CompletionStage that, when this stage completes - * exceptionally, is executed with this stage's exception as the - * argument to the supplied function, using this stage's default - * asynchronous execution facility. Otherwise, if this stage + * Returns a new CompletionStage that, when {@code this} stage completes + * exceptionally, is executed with {@code this} stage's exception as the + * argument to the supplied function, using {@code this} stage's default + * asynchronous execution facility. Otherwise, if {@code this} stage * completes normally, then the returned stage also completes * normally with the same value. * @@ -865,7 +879,7 @@ public CompletionStage runAfterEither(CompletionStage other, * #thenCompose} for result. * * @param fn the function to use to compute the value of the - * returned CompletionStage if this CompletionStage completed + * returned CompletionStage if {@code this} CompletionStage completed * exceptionally * @return the new CompletionStage * @since 12 @@ -879,10 +893,10 @@ public CompletionStage runAfterEither(CompletionStage other, } /** - * Returns a new CompletionStage that, when this stage completes - * exceptionally, is executed with this stage's exception as the + * Returns a new CompletionStage that, when {@code this} stage completes + * exceptionally, is executed with {@code this} stage's exception as the * argument to the supplied function, using the supplied Executor. - * Otherwise, if this stage completes normally, then the returned + * Otherwise, if {@code this} stage completes normally, then the returned * stage also completes normally with the same value. * * @implSpec The default implementation invokes {@link #handle}, @@ -890,7 +904,7 @@ public CompletionStage runAfterEither(CompletionStage other, * #thenCompose} for result. * * @param fn the function to use to compute the value of the - * returned CompletionStage if this CompletionStage completed + * returned CompletionStage if {@code this} CompletionStage completed * exceptionally * @param executor the executor to use for asynchronous execution * @return the new CompletionStage @@ -905,16 +919,16 @@ public CompletionStage runAfterEither(CompletionStage other, } /** - * Returns a new CompletionStage that, when this stage completes + * Returns a new CompletionStage that, when {@code this} stage completes * exceptionally, is composed using the results of the supplied - * function applied to this stage's exception. + * function applied to {@code this} stage's exception. * * @implSpec The default implementation invokes {@link #handle}, * invoking the given function on exception, then {@link * #thenCompose} for result. * * @param fn the function to use to compute the returned - * CompletionStage if this CompletionStage completed exceptionally + * CompletionStage if {@code this} CompletionStage completed exceptionally * @return the new CompletionStage * @since 12 */ @@ -927,9 +941,9 @@ public CompletionStage runAfterEither(CompletionStage other, } /** - * Returns a new CompletionStage that, when this stage completes + * Returns a new CompletionStage that, when {@code this} stage completes * exceptionally, is composed using the results of the supplied - * function applied to this stage's exception, using this stage's + * function applied to {@code this} stage's exception, using {@code this} stage's * default asynchronous execution facility. * * @implSpec The default implementation invokes {@link #handle}, @@ -937,7 +951,7 @@ public CompletionStage runAfterEither(CompletionStage other, * #thenCompose} for result. * * @param fn the function to use to compute the returned - * CompletionStage if this CompletionStage completed exceptionally + * CompletionStage if {@code this} CompletionStage completed exceptionally * @return the new CompletionStage * @since 12 */ @@ -951,9 +965,9 @@ public CompletionStage runAfterEither(CompletionStage other, } /** - * Returns a new CompletionStage that, when this stage completes + * Returns a new CompletionStage that, when {@code this} stage completes * exceptionally, is composed using the results of the supplied - * function applied to this stage's exception, using the + * function applied to {@code this} stage's exception, using the * supplied Executor. * * @implSpec The default implementation invokes {@link #handle}, @@ -961,7 +975,7 @@ public CompletionStage runAfterEither(CompletionStage other, * #thenCompose} for result. * * @param fn the function to use to compute the returned - * CompletionStage if this CompletionStage completed exceptionally + * CompletionStage if {@code this} CompletionStage completed exceptionally * @param executor the executor to use for asynchronous execution * @return the new CompletionStage * @since 12 @@ -978,9 +992,9 @@ public CompletionStage runAfterEither(CompletionStage other, /** * Returns a {@link CompletableFuture} maintaining the same - * completion properties as this stage. If this stage is already a - * CompletableFuture, this method may return this stage itself. - * Otherwise, invocation of this method may be equivalent in + * completion properties as {@code this} stage. If {@code this} stage is already a + * CompletableFuture, method {@code toCompletableFuture} may return {@code this} stage itself. + * Otherwise, invocation may be equivalent in * effect to {@code thenApply(x -> x)}, but returning an instance * of type {@code CompletableFuture}. * diff --git a/src/java.base/share/classes/java/util/concurrent/ConcurrentHashMap.java b/src/java.base/share/classes/java/util/concurrent/ConcurrentHashMap.java index 8734980cf80..b9df942fbfd 100644 --- a/src/java.base/share/classes/java/util/concurrent/ConcurrentHashMap.java +++ b/src/java.base/share/classes/java/util/concurrent/ConcurrentHashMap.java @@ -147,7 +147,7 @@ *

    Like {@link Hashtable} but unlike {@link HashMap}, this class * does not allow {@code null} to be used as a key or value. * - *

    ConcurrentHashMaps support a set of sequential and parallel bulk + *

    ConcurrentHashMaps support a set of sequential and parallel bulk * operations that, unlike most {@link Stream} methods, are designed * to be safely, and often sensibly, applied even with maps that are * being concurrently updated by other threads; for example, when @@ -3704,7 +3704,7 @@ final int batchFor(long b) { } /** - * Performs the given action for each (key, value). + * Performs the given {@linkplain ##Bulk bulk} action for each (key, value). * * @param parallelismThreshold the (estimated) number of elements * needed for this operation to be executed in parallel @@ -3720,7 +3720,7 @@ public void forEach(long parallelismThreshold, } /** - * Performs the given action for each non-null transformation + * Performs the given {@linkplain ##Bulk bulk} action for each non-null transformation * of each (key, value). * * @param parallelismThreshold the (estimated) number of elements @@ -3743,7 +3743,7 @@ public void forEach(long parallelismThreshold, } /** - * Returns a non-null result from applying the given search + * Returns a non-null result from applying the given {@linkplain ##Bulk bulk} search * function on each (key, value), or null if none. Upon * success, further element processing is suppressed and the * results of any other parallel invocations of the search @@ -3767,7 +3767,7 @@ public U search(long parallelismThreshold, } /** - * Returns the result of accumulating the given transformation + * Returns the result of accumulating the given {@linkplain ##Bulk bulk} transformation * of all (key, value) pairs using the given reducer to * combine values, or null if none. * @@ -3793,7 +3793,7 @@ public U reduce(long parallelismThreshold, } /** - * Returns the result of accumulating the given transformation + * Returns the result of accumulating the given {@linkplain ##Bulk bulk} transformation * of all (key, value) pairs using the given reducer to * combine values, and the given basis as an identity value. * @@ -3819,7 +3819,7 @@ public double reduceToDouble(long parallelismThreshold, } /** - * Returns the result of accumulating the given transformation + * Returns the result of accumulating the given {@linkplain ##Bulk bulk} transformation * of all (key, value) pairs using the given reducer to * combine values, and the given basis as an identity value. * @@ -3845,7 +3845,7 @@ public long reduceToLong(long parallelismThreshold, } /** - * Returns the result of accumulating the given transformation + * Returns the result of accumulating the given {@linkplain ##Bulk bulk} transformation * of all (key, value) pairs using the given reducer to * combine values, and the given basis as an identity value. * @@ -3871,7 +3871,7 @@ public int reduceToInt(long parallelismThreshold, } /** - * Performs the given action for each key. + * Performs the given {@linkplain ##Bulk bulk} action for each key. * * @param parallelismThreshold the (estimated) number of elements * needed for this operation to be executed in parallel @@ -3887,7 +3887,7 @@ public void forEachKey(long parallelismThreshold, } /** - * Performs the given action for each non-null transformation + * Performs the given {@linkplain ##Bulk bulk} action for each non-null transformation * of each key. * * @param parallelismThreshold the (estimated) number of elements @@ -3910,7 +3910,7 @@ public void forEachKey(long parallelismThreshold, } /** - * Returns a non-null result from applying the given search + * Returns a non-null result from applying the given {@linkplain ##Bulk bulk} search * function on each key, or null if none. Upon success, * further element processing is suppressed and the results of * any other parallel invocations of the search function are @@ -3934,7 +3934,7 @@ public U searchKeys(long parallelismThreshold, } /** - * Returns the result of accumulating all keys using the given + * Returns the result of {@linkplain ##Bulk bulk} accumulating all keys using the given * reducer to combine values, or null if none. * * @param parallelismThreshold the (estimated) number of elements @@ -3953,7 +3953,7 @@ public K reduceKeys(long parallelismThreshold, } /** - * Returns the result of accumulating the given transformation + * Returns the result of {@linkplain ##Bulk bulk} accumulating the given transformation * of all keys using the given reducer to combine values, or * null if none. * @@ -3979,7 +3979,7 @@ public U reduceKeys(long parallelismThreshold, } /** - * Returns the result of accumulating the given transformation + * Returns the result of {@linkplain ##Bulk bulk} accumulating the given transformation * of all keys using the given reducer to combine values, and * the given basis as an identity value. * @@ -4005,7 +4005,7 @@ public double reduceKeysToDouble(long parallelismThreshold, } /** - * Returns the result of accumulating the given transformation + * Returns the result of {@linkplain ##Bulk bulk} accumulating the given transformation * of all keys using the given reducer to combine values, and * the given basis as an identity value. * @@ -4031,7 +4031,7 @@ public long reduceKeysToLong(long parallelismThreshold, } /** - * Returns the result of accumulating the given transformation + * Returns the result of {@linkplain ##Bulk bulk} accumulating the given transformation * of all keys using the given reducer to combine values, and * the given basis as an identity value. * @@ -4057,7 +4057,7 @@ public int reduceKeysToInt(long parallelismThreshold, } /** - * Performs the given action for each value. + * Performs the given {@linkplain ##Bulk bulk} action for each value. * * @param parallelismThreshold the (estimated) number of elements * needed for this operation to be executed in parallel @@ -4074,7 +4074,7 @@ public void forEachValue(long parallelismThreshold, } /** - * Performs the given action for each non-null transformation + * Performs the given {@linkplain ##Bulk bulk} action for each non-null transformation * of each value. * * @param parallelismThreshold the (estimated) number of elements @@ -4097,7 +4097,7 @@ public void forEachValue(long parallelismThreshold, } /** - * Returns a non-null result from applying the given search + * Returns a non-null result from {@linkplain ##Bulk bulk} applying the given search * function on each value, or null if none. Upon success, * further element processing is suppressed and the results of * any other parallel invocations of the search function are @@ -4121,7 +4121,7 @@ public U searchValues(long parallelismThreshold, } /** - * Returns the result of accumulating all values using the + * Returns the result of {@linkplain ##Bulk bulk} accumulating all values using the * given reducer to combine values, or null if none. * * @param parallelismThreshold the (estimated) number of elements @@ -4139,7 +4139,7 @@ public V reduceValues(long parallelismThreshold, } /** - * Returns the result of accumulating the given transformation + * Returns the result of {@linkplain ##Bulk bulk} accumulating the given transformation * of all values using the given reducer to combine values, or * null if none. * @@ -4165,7 +4165,7 @@ public U reduceValues(long parallelismThreshold, } /** - * Returns the result of accumulating the given transformation + * Returns the result of {@linkplain ##Bulk bulk} accumulating the given transformation * of all values using the given reducer to combine values, * and the given basis as an identity value. * @@ -4191,7 +4191,7 @@ public double reduceValuesToDouble(long parallelismThreshold, } /** - * Returns the result of accumulating the given transformation + * Returns the result of {@linkplain ##Bulk bulk} accumulating the given transformation * of all values using the given reducer to combine values, * and the given basis as an identity value. * @@ -4217,7 +4217,7 @@ public long reduceValuesToLong(long parallelismThreshold, } /** - * Returns the result of accumulating the given transformation + * Returns the result of {@linkplain ##Bulk bulk} accumulating the given transformation * of all values using the given reducer to combine values, * and the given basis as an identity value. * @@ -4243,7 +4243,7 @@ public int reduceValuesToInt(long parallelismThreshold, } /** - * Performs the given action for each entry. + * Performs the given {@linkplain ##Bulk bulk} action for each entry. * * @param parallelismThreshold the (estimated) number of elements * needed for this operation to be executed in parallel @@ -4258,7 +4258,7 @@ public void forEachEntry(long parallelismThreshold, } /** - * Performs the given action for each non-null transformation + * Performs the given {@linkplain ##Bulk bulk} action for each non-null transformation * of each entry. * * @param parallelismThreshold the (estimated) number of elements @@ -4281,7 +4281,7 @@ public void forEachEntry(long parallelismThreshold, } /** - * Returns a non-null result from applying the given search + * Returns a non-null result from {@linkplain ##Bulk bulk} applying the given search * function on each entry, or null if none. Upon success, * further element processing is suppressed and the results of * any other parallel invocations of the search function are @@ -4305,7 +4305,7 @@ public U searchEntries(long parallelismThreshold, } /** - * Returns the result of accumulating all entries using the + * Returns the result of {@linkplain ##Bulk bulk} accumulating all entries using the * given reducer to combine values, or null if none. * * @param parallelismThreshold the (estimated) number of elements @@ -4323,7 +4323,7 @@ public Map.Entry reduceEntries(long parallelismThreshold, } /** - * Returns the result of accumulating the given transformation + * Returns the result of {@linkplain ##Bulk bulk} accumulating the given transformation * of all entries using the given reducer to combine values, * or null if none. * @@ -4349,7 +4349,7 @@ public U reduceEntries(long parallelismThreshold, } /** - * Returns the result of accumulating the given transformation + * Returns the result of {@linkplain ##Bulk bulk} accumulating the given transformation * of all entries using the given reducer to combine values, * and the given basis as an identity value. * @@ -4375,7 +4375,7 @@ public double reduceEntriesToDouble(long parallelismThreshold, } /** - * Returns the result of accumulating the given transformation + * Returns the result of {@linkplain ##Bulk bulk} accumulating the given transformation * of all entries using the given reducer to combine values, * and the given basis as an identity value. * @@ -4401,7 +4401,7 @@ public long reduceEntriesToLong(long parallelismThreshold, } /** - * Returns the result of accumulating the given transformation + * Returns the result of {@linkplain ##Bulk bulk} accumulating the given transformation * of all entries using the given reducer to combine values, * and the given basis as an identity value. * diff --git a/src/java.base/share/classes/java/util/concurrent/CyclicBarrier.java b/src/java.base/share/classes/java/util/concurrent/CyclicBarrier.java index 87e498d9c24..ca78c254624 100644 --- a/src/java.base/share/classes/java/util/concurrent/CyclicBarrier.java +++ b/src/java.base/share/classes/java/util/concurrent/CyclicBarrier.java @@ -44,7 +44,10 @@ * useful in programs involving a fixed sized party of threads that * must occasionally wait for each other. The barrier is called * cyclic because it can be re-used after the waiting threads - * are released. + * are released. If you need support for variable numbers of parties + * per cycle, alternate actions on exceptions, termination control, + * contention control, or status monitoring, use the more flexible + * {@link Phaser} class. * *

    A {@code CyclicBarrier} supports an optional {@link Runnable} command * that is run once per barrier point, after the last thread in the party diff --git a/src/java.base/share/classes/java/util/concurrent/DelayScheduler.java b/src/java.base/share/classes/java/util/concurrent/DelayScheduler.java index 358d3b69f1e..d1f8283489b 100644 --- a/src/java.base/share/classes/java/util/concurrent/DelayScheduler.java +++ b/src/java.base/share/classes/java/util/concurrent/DelayScheduler.java @@ -85,7 +85,7 @@ final class DelayScheduler extends Thread { * termination checks as well as to suppress reactivation after * terminating. * - * We avoid the need for auxilliary data structures by embedding + * We avoid the need for auxiliary data structures by embedding * pending queue links, heap indices, and pool references inside * ScheduledForkJoinTasks. (We use the same structure for both * Runnable and Callable versions, since including an extra field diff --git a/src/java.base/share/classes/java/util/concurrent/ExecutorService.java b/src/java.base/share/classes/java/util/concurrent/ExecutorService.java index 0d4acf8913e..f899b56b288 100644 --- a/src/java.base/share/classes/java/util/concurrent/ExecutorService.java +++ b/src/java.base/share/classes/java/util/concurrent/ExecutorService.java @@ -56,7 +56,9 @@ * *

    Method {@code submit} extends base method {@link * Executor#execute(Runnable)} by creating and returning a {@link Future} - * that can be used to cancel execution and/or wait for completion. + * that can be used to cancel execution and/or wait for completion; + * also reporting exceptions that would otherwise be uncaught + * using method {@code execute}. * Methods {@code invokeAny} and {@code invokeAll} perform the most * commonly useful forms of bulk execution, executing a collection of * tasks and then waiting for at least one, or all, to diff --git a/src/java.base/share/classes/java/util/concurrent/Executors.java b/src/java.base/share/classes/java/util/concurrent/Executors.java index ba7c2e1efee..ef3d6348010 100644 --- a/src/java.base/share/classes/java/util/concurrent/Executors.java +++ b/src/java.base/share/classes/java/util/concurrent/Executors.java @@ -306,7 +306,7 @@ public static ScheduledExecutorService newSingleThreadScheduledExecutor(ThreadFa } /** - * Creates a thread pool that can schedule commands to run after a + * Creates a fixed-size thread pool that can schedule commands to run after a * given delay, or to execute periodically. * @param corePoolSize the number of threads to keep in the pool, * even if they are idle @@ -318,7 +318,7 @@ public static ScheduledExecutorService newScheduledThreadPool(int corePoolSize) } /** - * Creates a thread pool that can schedule commands to run after a + * Creates a fixed-size thread pool that can schedule commands to run after a * given delay, or to execute periodically. * @param corePoolSize the number of threads to keep in the pool, * even if they are idle diff --git a/src/java.base/share/classes/java/util/concurrent/Flow.java b/src/java.base/share/classes/java/util/concurrent/Flow.java index 1aefaea43b0..16b2ba5e9d8 100644 --- a/src/java.base/share/classes/java/util/concurrent/Flow.java +++ b/src/java.base/share/classes/java/util/concurrent/Flow.java @@ -60,7 +60,8 @@ * TRUE} item to a single subscriber. Because the subscriber receives * only a single item, this class does not use buffering and ordering * control required in most implementations (for example {@link - * SubmissionPublisher}). + * SubmissionPublisher}), and omits some error processing needed to + * fully conform to the Reactive Streams specification. * *

     {@code
      * class OneShotPublisher implements Publisher {
    diff --git a/src/java.base/share/classes/java/util/concurrent/ForkJoinPool.java b/src/java.base/share/classes/java/util/concurrent/ForkJoinPool.java
    index a7821921bc9..482fe3cf801 100644
    --- a/src/java.base/share/classes/java/util/concurrent/ForkJoinPool.java
    +++ b/src/java.base/share/classes/java/util/concurrent/ForkJoinPool.java
    @@ -140,7 +140,7 @@
      * tasks, as well as method {@link #submitWithTimeout} to cancel tasks
      * that take too long. The scheduled functions or actions may create
      * and invoke other {@linkplain ForkJoinTask ForkJoinTasks}. Delayed
    - * actions become enabled and behave as ordinary submitted
    + * actions become enabled for execution and behave as ordinary submitted
      * tasks when their delays elapse.  Scheduling methods return
      * {@linkplain ForkJoinTask ForkJoinTasks} that implement the {@link
      * ScheduledFuture} interface. Resource exhaustion encountered after
    @@ -153,7 +153,7 @@
      * to disable all delayed tasks upon shutdown, and method {@link
      * #shutdownNow} may be used to instead unconditionally initiate pool
      * termination. Monitoring methods such as {@link #getQueuedTaskCount}
    - * do not include scheduled tasks that are not yet enabled to execute,
    + * do not include scheduled tasks that are not yet enabled for execution,
      * which are reported separately by method {@link
      * #getDelayedTaskCount}.
      *
    @@ -3505,7 +3505,7 @@ final  ScheduledForkJoinTask scheduleDelayedTask(ScheduledForkJoinTask
         }
     
         /**
    -     * Submits a one-shot task that becomes enabled after the given
    +     * Submits a one-shot task that becomes enabled for execution after the given
          * delay.  At that point it will execute unless explicitly
          * cancelled, or fail to execute (eventually reporting
          * cancellation) when encountering resource exhaustion, or the
    @@ -3533,7 +3533,7 @@ public ScheduledFuture schedule(Runnable command,
         }
     
         /**
    -     * Submits a value-returning one-shot task that becomes enabled
    +     * Submits a value-returning one-shot task that becomes enabled for execution
          * after the given delay. At that point it will execute unless
          * explicitly cancelled, or fail to execute (eventually reporting
          * cancellation) when encountering resource exhaustion, or the
    @@ -3562,7 +3562,7 @@ public  ScheduledFuture schedule(Callable callable,
         }
     
         /**
    -     * Submits a periodic action that becomes enabled first after the
    +     * Submits a periodic action that becomes enabled for execution first after the
          * given initial delay, and subsequently with the given period;
          * that is, executions will commence after
          * {@code initialDelay}, then {@code initialDelay + period}, then
    @@ -3616,7 +3616,7 @@ public ScheduledFuture scheduleAtFixedRate(Runnable command,
         }
     
         /**
    -     * Submits a periodic action that becomes enabled first after the
    +     * Submits a periodic action that becomes enabled for execution first after the
          * given initial delay, and subsequently with the given delay
          * between the termination of one execution and the commencement of
          * the next.
    diff --git a/src/java.base/share/classes/java/util/concurrent/Future.java b/src/java.base/share/classes/java/util/concurrent/Future.java
    index c6f3036c2d2..2ac837d7270 100644
    --- a/src/java.base/share/classes/java/util/concurrent/Future.java
    +++ b/src/java.base/share/classes/java/util/concurrent/Future.java
    @@ -50,6 +50,26 @@
      * declare types of the form {@code Future} and
      * return {@code null} as a result of the underlying task.
      *
    + * 

    Cancellation of a Future need not abruptly terminate its + * computation. Method {@code cancel} causes {@code isCancelled()} to + * return {@code true} unless already {@code isDone()}; in either case + * {@code isDone()} subsequently reports {@code true}. This suppresses + * execution by an {@link ExecutorService} if not already started. + * There are several options for suppressing unnecessary computation + * or unblocking a running Future that will not generate a + * result. When task bodies are simple and short, no special attention + * is warranted. Computational methods in Future-aware code bodies + * (for example {@link ForkJoinTask}, {@link FutureTask}) may inspect + * their own {@code isDone()} status before or while engaging in + * expensive computations. In blocking I/O or communication contexts, + * the optional {@code mayInterruptIfRunning} argument of {@code + * cancel} may be used to support conventions that tasks should + * unblock and exit when {@link Thread#interrupted}, whether checked + * inside a task body or as a response to an {@link + * InterruptedException}. It is still preferable to additionally + * check {@code isDone()} status when possible to avoid unintended + * effects of other uses of {@link Thread#interrupt}. + * *

    Sample Usage (Note that the following classes are all * made-up.) * diff --git a/src/java.base/share/classes/java/util/concurrent/FutureTask.java b/src/java.base/share/classes/java/util/concurrent/FutureTask.java index b905e71aeef..2ec97629105 100644 --- a/src/java.base/share/classes/java/util/concurrent/FutureTask.java +++ b/src/java.base/share/classes/java/util/concurrent/FutureTask.java @@ -285,7 +285,9 @@ protected void done() { } * this future has already been set or has been cancelled. * *

    This method is invoked internally by the {@link #run} method - * upon successful completion of the computation. + * upon successful completion of the computation. Invocation in + * other contexts has undefined effects. Any override of this + * method in subclasses should include {@code super.set(v)}. * * @param v the value */ diff --git a/src/java.base/share/classes/java/util/concurrent/LinkedBlockingDeque.java b/src/java.base/share/classes/java/util/concurrent/LinkedBlockingDeque.java index 8d0bc7ccdde..1e3ffb81150 100644 --- a/src/java.base/share/classes/java/util/concurrent/LinkedBlockingDeque.java +++ b/src/java.base/share/classes/java/util/concurrent/LinkedBlockingDeque.java @@ -150,7 +150,7 @@ static final class Node { transient Node last; /** Number of items in the deque */ - private transient int count; + private transient volatile int count; /** @serial Maximum number of items in the deque */ private final int capacity; @@ -206,10 +206,13 @@ public LinkedBlockingDeque(Collection c) { /** * Links node as first element, or returns false if full. + * + * @return true if the node was added; false otherwise */ private boolean linkFirst(Node node) { // assert lock.isHeldByCurrentThread(); - if (count >= capacity) + int c; + if ((c = count) >= capacity) return false; Node f = first; node.next = f; @@ -218,17 +221,20 @@ private boolean linkFirst(Node node) { last = node; else f.prev = node; - ++count; + count = c + 1; notEmpty.signal(); return true; } /** * Links node as last element, or returns false if full. + * + * @return true if the node was added; false otherwise */ private boolean linkLast(Node node) { // assert lock.isHeldByCurrentThread(); - if (count >= capacity) + int c; + if ((c = count) >= capacity) return false; Node l = last; node.prev = l; @@ -237,7 +243,7 @@ private boolean linkLast(Node node) { first = node; else l.next = node; - ++count; + count = c + 1; notEmpty.signal(); return true; } @@ -334,6 +340,8 @@ public void addLast(E e) { */ public boolean offerFirst(E e) { if (e == null) throw new NullPointerException(); + if (count >= capacity) + return false; Node node = new Node(e); final ReentrantLock lock = this.lock; lock.lock(); @@ -349,6 +357,8 @@ public boolean offerFirst(E e) { */ public boolean offerLast(E e) { if (e == null) throw new NullPointerException(); + if (count >= capacity) + return false; Node node = new Node(e); final ReentrantLock lock = this.lock; lock.lock(); @@ -367,7 +377,7 @@ public void putFirst(E e) throws InterruptedException { if (e == null) throw new NullPointerException(); Node node = new Node(e); final ReentrantLock lock = this.lock; - lock.lock(); + lock.lockInterruptibly(); try { while (!linkFirst(node)) notFull.await(); @@ -384,7 +394,7 @@ public void putLast(E e) throws InterruptedException { if (e == null) throw new NullPointerException(); Node node = new Node(e); final ReentrantLock lock = this.lock; - lock.lock(); + lock.lockInterruptibly(); try { while (!linkLast(node)) notFull.await(); @@ -458,6 +468,7 @@ public E removeLast() { } public E pollFirst() { + if (count == 0) return null; final ReentrantLock lock = this.lock; lock.lock(); try { @@ -468,6 +479,7 @@ public E pollFirst() { } public E pollLast() { + if (count == 0) return null; final ReentrantLock lock = this.lock; lock.lock(); try { @@ -479,7 +491,7 @@ public E pollLast() { public E takeFirst() throws InterruptedException { final ReentrantLock lock = this.lock; - lock.lock(); + lock.lockInterruptibly(); try { E x; while ( (x = unlinkFirst()) == null) @@ -492,7 +504,7 @@ public E takeFirst() throws InterruptedException { public E takeLast() throws InterruptedException { final ReentrantLock lock = this.lock; - lock.lock(); + lock.lockInterruptibly(); try { E x; while ( (x = unlinkLast()) == null) @@ -558,6 +570,7 @@ public E getLast() { } public E peekFirst() { + if (count == 0) return null; final ReentrantLock lock = this.lock; lock.lock(); try { @@ -568,6 +581,7 @@ public E peekFirst() { } public E peekLast() { + if (count == 0) return null; final ReentrantLock lock = this.lock; lock.lock(); try { @@ -718,13 +732,7 @@ public E peek() { * insert or remove an element. */ public int remainingCapacity() { - final ReentrantLock lock = this.lock; - lock.lock(); - try { - return capacity - count; - } finally { - lock.unlock(); - } + return capacity - count; } /** @@ -806,13 +814,7 @@ public boolean remove(Object o) { * @return the number of elements in this deque */ public int size() { - final ReentrantLock lock = this.lock; - lock.lock(); - try { - return count; - } finally { - lock.unlock(); - } + return count; } /** @@ -858,7 +860,7 @@ public boolean addAll(Collection c) { // Copy c into a private chain of Nodes Node beg = null, end = null; - int n = 0; + long n = 0; for (E e : c) { Objects.requireNonNull(e); n++; @@ -878,14 +880,15 @@ public boolean addAll(Collection c) { final ReentrantLock lock = this.lock; lock.lock(); try { - if (count + n <= capacity) { + long cnt; + if ((cnt = count + n) <= capacity) { beg.prev = last; if (first == null) first = beg; else last.next = beg; last = end; - count += n; + count = (int)cnt; notEmpty.signalAll(); return true; } @@ -894,6 +897,7 @@ public boolean addAll(Collection c) { } // Fall back to historic non-atomic implementation, failing // with IllegalStateException when the capacity is exceeded. + beg = end = null; // help GC return super.addAll(c); } @@ -994,8 +998,8 @@ public void clear() { for (Node f = first; f != null; ) { f.item = null; Node n = f.next; - f.prev = null; - f.next = null; + f.prev = f; + f.next = f; f = n; } first = last = null; diff --git a/src/java.base/share/classes/java/util/concurrent/RunnableFuture.java b/src/java.base/share/classes/java/util/concurrent/RunnableFuture.java index b6b088ae7cd..8585cfe1082 100644 --- a/src/java.base/share/classes/java/util/concurrent/RunnableFuture.java +++ b/src/java.base/share/classes/java/util/concurrent/RunnableFuture.java @@ -47,8 +47,9 @@ */ public interface RunnableFuture extends Runnable, Future { /** - * Sets this Future to the result of its computation - * unless it has been cancelled. + * Sets this Future to the result of its computation unless it has + * been cancelled (or has already been invoked, in which case + * effects are undefined). */ void run(); } diff --git a/src/java.base/share/classes/java/util/concurrent/ScheduledExecutorService.java b/src/java.base/share/classes/java/util/concurrent/ScheduledExecutorService.java index 4d63ffae4bb..034d98687c2 100644 --- a/src/java.base/share/classes/java/util/concurrent/ScheduledExecutorService.java +++ b/src/java.base/share/classes/java/util/concurrent/ScheduledExecutorService.java @@ -40,10 +40,12 @@ * delay, or to execute periodically. * *

    The {@code schedule} methods create tasks with various delays - * and return a task object that can be used to cancel or check - * execution. The {@code scheduleAtFixedRate} and - * {@code scheduleWithFixedDelay} methods create and execute tasks - * that run periodically until cancelled. + * and return {@link ScheduledFuture} objects that can be used to cancel or check + * execution. When delays elapse, tasks are enabled for execution and + * behave in accord with other {@link ExecutorService} tasks, except + * that {@code scheduleAtFixedRate} and {@code scheduleWithFixedDelay} + * methods create and execute tasks that run periodically until + * cancelled. * *

    Commands submitted using the {@link Executor#execute(Runnable)} * and {@link ExecutorService} {@code submit} methods are scheduled @@ -91,7 +93,7 @@ public interface ScheduledExecutorService extends ExecutorService { /** - * Submits a one-shot task that becomes enabled after the given delay. + * Submits a one-shot task that becomes enabled for execution after the given delay. * * @param command the task to execute * @param delay the time from now to delay execution @@ -107,7 +109,7 @@ public ScheduledFuture schedule(Runnable command, long delay, TimeUnit unit); /** - * Submits a value-returning one-shot task that becomes enabled + * Submits a value-returning one-shot task that becomes enabled for execution * after the given delay. * * @param callable the function to execute @@ -123,7 +125,7 @@ public ScheduledFuture schedule(Callable callable, long delay, TimeUnit unit); /** - * Submits a periodic action that becomes enabled first after the + * Submits a periodic action that becomes enabled for execution first after the * given initial delay, and subsequently with the given period; * that is, executions will commence after * {@code initialDelay}, then {@code initialDelay + period}, then @@ -167,7 +169,7 @@ public ScheduledFuture scheduleAtFixedRate(Runnable command, TimeUnit unit); /** - * Submits a periodic action that becomes enabled first after the + * Submits a periodic action that becomes enabled for execution first after the * given initial delay, and subsequently with the given delay * between the termination of one execution and the commencement of * the next. diff --git a/src/java.base/share/classes/java/util/concurrent/ScheduledThreadPoolExecutor.java b/src/java.base/share/classes/java/util/concurrent/ScheduledThreadPoolExecutor.java index 94f40ccf6f5..23398aeae28 100644 --- a/src/java.base/share/classes/java/util/concurrent/ScheduledThreadPoolExecutor.java +++ b/src/java.base/share/classes/java/util/concurrent/ScheduledThreadPoolExecutor.java @@ -57,7 +57,7 @@ * capabilities of {@link ThreadPoolExecutor} (which this class * extends) are required. * - *

    Delayed tasks execute no sooner than they are enabled, but + *

    Delayed tasks execute no sooner than they are enabled for execution, but * without any real-time guarantees about when, after they are * enabled, they will commence. Tasks scheduled for exactly the same * execution time are enabled in first-in-first-out (FIFO) order of @@ -568,7 +568,7 @@ public ScheduledFuture schedule(Callable callable, } /** - * Submits a periodic action that becomes enabled first after the + * Submits a periodic action that becomes enabled for execution first after the * given initial delay, and subsequently with the given period; * that is, executions will commence after * {@code initialDelay}, then {@code initialDelay + period}, then @@ -621,7 +621,7 @@ public ScheduledFuture scheduleAtFixedRate(Runnable command, } /** - * Submits a periodic action that becomes enabled first after the + * Submits a periodic action that becomes enabled for execution first after the * given initial delay, and subsequently with the given delay * between the termination of one execution and the commencement of * the next. diff --git a/src/java.base/share/classes/java/util/concurrent/SubmissionPublisher.java b/src/java.base/share/classes/java/util/concurrent/SubmissionPublisher.java index 3a8f3746637..f793d2bcabd 100644 --- a/src/java.base/share/classes/java/util/concurrent/SubmissionPublisher.java +++ b/src/java.base/share/classes/java/util/concurrent/SubmissionPublisher.java @@ -162,8 +162,8 @@ * (this.subscription = subscription).request(1); * } * public void onNext(S item) { - * subscription.request(1); * submit(function.apply(item)); + * subscription.request(1); * } * public void onError(Throwable ex) { closeExceptionally(ex); } * public void onComplete() { close(); } @@ -602,9 +602,11 @@ public int offer(T item, long timeout, TimeUnit unit, /** * Unless already closed, issues {@link * Flow.Subscriber#onComplete() onComplete} signals to current - * subscribers, and disallows subsequent attempts to publish. - * Upon return, this method does NOT guarantee that all - * subscribers have yet completed. + * subscribers, and disallows subsequent attempts to publish. To + * ensure uniform ordering among subscribers, this method may + * await completion of in-progress offers. Upon return, this + * method does NOT guarantee that all subscribers have + * yet completed. */ public void close() { ReentrantLock lock = this.lock; diff --git a/src/java.base/share/classes/java/util/concurrent/TimeUnit.java b/src/java.base/share/classes/java/util/concurrent/TimeUnit.java index f02aa9f5931..d116fb9b22b 100644 --- a/src/java.base/share/classes/java/util/concurrent/TimeUnit.java +++ b/src/java.base/share/classes/java/util/concurrent/TimeUnit.java @@ -398,6 +398,8 @@ else if (s == MICRO_SCALE) * @param obj the object to wait on * @param timeout the maximum time to wait. If less than * or equal to zero, do not wait at all. + * @throws IllegalMonitorStateException if the current thread is not + * the owner of the object's monitor. * @throws InterruptedException if interrupted while waiting */ public void timedWait(Object obj, long timeout) diff --git a/src/java.base/share/classes/java/util/concurrent/atomic/AtomicIntegerFieldUpdater.java b/src/java.base/share/classes/java/util/concurrent/atomic/AtomicIntegerFieldUpdater.java index e01b3ec7d50..f947eb4f7db 100644 --- a/src/java.base/share/classes/java/util/concurrent/atomic/AtomicIntegerFieldUpdater.java +++ b/src/java.base/share/classes/java/util/concurrent/atomic/AtomicIntegerFieldUpdater.java @@ -46,10 +46,11 @@ /** * A reflection-based utility that enables atomic updates to - * designated {@code volatile int} fields of designated classes. - * This class is designed for use in atomic data structures in which - * several fields of the same node are independently subject to atomic - * updates. + * designated non-static {@code volatile int} fields of designated + * classes, providing a subset of the functionality of class {@link + * VarHandle} that should be used instead. This class is designed for + * use in atomic data structures in which several fields of the same + * node are independently subject to atomic updates. * *

    Note that the guarantees of the {@code compareAndSet} * method in this class are weaker than in other atomic classes. diff --git a/src/java.base/share/classes/java/util/concurrent/atomic/AtomicLongFieldUpdater.java b/src/java.base/share/classes/java/util/concurrent/atomic/AtomicLongFieldUpdater.java index 57722f33371..b31a8edf53a 100644 --- a/src/java.base/share/classes/java/util/concurrent/atomic/AtomicLongFieldUpdater.java +++ b/src/java.base/share/classes/java/util/concurrent/atomic/AtomicLongFieldUpdater.java @@ -46,10 +46,11 @@ /** * A reflection-based utility that enables atomic updates to - * designated {@code volatile long} fields of designated classes. - * This class is designed for use in atomic data structures in which - * several fields of the same node are independently subject to atomic - * updates. + * designated non-static {@code volatile long} fields of designated + * classes, providing a subset of the functionality of class {@link + * VarHandle} that should be used instead. This class is designed for + * use in atomic data structures in which several fields of the same + * node are independently subject to atomic updates. * *

    Note that the guarantees of the {@code compareAndSet} * method in this class are weaker than in other atomic classes. diff --git a/src/java.base/share/classes/java/util/concurrent/atomic/AtomicReferenceFieldUpdater.java b/src/java.base/share/classes/java/util/concurrent/atomic/AtomicReferenceFieldUpdater.java index 1c0c6d0afd0..e3ca4830d5a 100644 --- a/src/java.base/share/classes/java/util/concurrent/atomic/AtomicReferenceFieldUpdater.java +++ b/src/java.base/share/classes/java/util/concurrent/atomic/AtomicReferenceFieldUpdater.java @@ -46,11 +46,12 @@ /** * A reflection-based utility that enables atomic updates to - * designated {@code volatile} reference fields of designated - * classes. This class is designed for use in atomic data structures - * in which several reference fields of the same node are - * independently subject to atomic updates. For example, a tree node - * might be declared as + * designated non-static {@code volatile} reference fields of + * designated classes, providing a subset of the functionality of + * class {@link VarHandle} that should be used instead. This class + * may be used in atomic data structures in which several reference + * fields of the same node are independently subject to atomic + * updates. For example, a tree node might be declared as * *

     {@code
      * class Node {
    @@ -68,6 +69,26 @@
      *   // ... and so on
      * }}
    * + * However, it is preferable to use {@link VarHandle}: + *
     {@code
    + * import java.lang.invoke.VarHandle;
    + * import java.lang.invoke.MethodHandles;
    + * class Node {
    + *  private volatile Node left, right;
    + *  private static final VarHandle LEFT, RIGHT;
    + *  Node getLeft() { return left; }
    + *  boolean compareAndSetLeft(Node expect, Node update) {
    + *    return LEFT.compareAndSet(this, expect, update);
    + *  }
    + *  // ... and so on
    + *  static { try {
    + *    MethodHandles.Lookup l = MethodHandles.lookup();
    + *    LEFT  = l.findVarHandle(Node.class, "left", Node.class);
    + *    RIGHT = l.findVarHandle(Node.class, "right", Node.class);
    + *   } catch (ReflectiveOperationException e) {
    + *     throw new ExceptionInInitializerError(e);
    + * }}}}
    + * *

    Note that the guarantees of the {@code compareAndSet} * method in this class are weaker than in other atomic classes. * Because this class cannot ensure that all uses of the field diff --git a/src/java.base/share/classes/java/util/concurrent/locks/ReentrantReadWriteLock.java b/src/java.base/share/classes/java/util/concurrent/locks/ReentrantReadWriteLock.java index 3e0b293380f..536996fd273 100644 --- a/src/java.base/share/classes/java/util/concurrent/locks/ReentrantReadWriteLock.java +++ b/src/java.base/share/classes/java/util/concurrent/locks/ReentrantReadWriteLock.java @@ -97,6 +97,10 @@ * perform reads under read locks. If a reader tries to acquire the * write lock it will never succeed. * + *

    Note: If you do not rely on reentrancy, you may find that {@link + * StampedLock} offers better performance, as in: {@code ReadWriteLock + * lock = new StampedLock().asReadWriteLock()}. + * *

  • Lock downgrading *

    Reentrancy also allows downgrading from the write lock to a read lock, * by acquiring the write lock, then the read lock and then releasing the @@ -734,11 +738,13 @@ protected ReadLock(ReentrantReadWriteLock lock) { * Acquires the read lock. * *

    Acquires the read lock if the write lock is not held by - * another thread and returns immediately. + * any thread and returns immediately. * - *

    If the write lock is held by another thread then - * the current thread becomes disabled for thread scheduling - * purposes and lies dormant until the read lock has been acquired. + *

    If the write lock is held by any thread or the fairness + * policy prohibits acquisition of the read lock at this time, + * then the current thread becomes disabled for thread + * scheduling purposes and lies dormant until the read lock + * has been acquired. */ public void lock() { sync.acquireShared(1); @@ -749,11 +755,13 @@ public void lock() { * {@linkplain Thread#interrupt interrupted}. * *

    Acquires the read lock if the write lock is not held - * by another thread and returns immediately. + * by any thread and returns immediately. * - *

    If the write lock is held by another thread then the - * current thread becomes disabled for thread scheduling - * purposes and lies dormant until one of two things happens: + *

    If the write lock is held by any thread or the fairness + * policy prohibits acquisition of the read lock at this time, + * then the current thread becomes disabled for thread + * scheduling purposes and lies dormant until one of two + * things happens: * *

      * @@ -794,7 +802,7 @@ public void lockInterruptibly() throws InterruptedException { * another thread at the time of invocation. * *

      Acquires the read lock if the write lock is not held by - * another thread and returns immediately with the value + * any thread and returns immediately with the value * {@code true}. Even when this lock has been set to use a * fair ordering policy, a call to {@code tryLock()} * will immediately acquire the read lock if it is @@ -806,7 +814,7 @@ public void lockInterruptibly() throws InterruptedException { * tryLock(0, TimeUnit.SECONDS)} which is almost equivalent * (it also detects interruption). * - *

      If the write lock is held by another thread then + *

      If the write lock is held by any thread then * this method will return immediately with the value * {@code false}. * diff --git a/src/java.base/share/classes/java/util/concurrent/package-info.java b/src/java.base/share/classes/java/util/concurrent/package-info.java index dd0c8f79bc0..f237017799d 100644 --- a/src/java.base/share/classes/java/util/concurrent/package-info.java +++ b/src/java.base/share/classes/java/util/concurrent/package-info.java @@ -222,7 +222,9 @@ *

    • they are guaranteed to traverse elements as they existed upon * construction exactly once, and may (but are not guaranteed to) * reflect any modifications subsequent to construction. - *
    + *
  • These properties extend to other iteration-based + * operations. In particular, {@link Object#equals} is almost never + * useful unless both collections are known to be quiescent. * *

    Memory Consistency Properties

    * diff --git a/src/java.base/share/classes/jdk/internal/util/StaticProperty.java b/src/java.base/share/classes/jdk/internal/util/StaticProperty.java index abe2dafa3b7..4fb3ae7a184 100644 --- a/src/java.base/share/classes/jdk/internal/util/StaticProperty.java +++ b/src/java.base/share/classes/jdk/internal/util/StaticProperty.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018, 2025, 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 @@ -28,7 +28,7 @@ import java.util.Properties; /** - * System Property access for internal use only. + * System Property access for `java.base` module internal use only. * Read-only access to System property values initialized during Phase 1 * are cached. Setting, clearing, or modifying the value using * {@link System#setProperty} or {@link System#getProperties()} is ignored. @@ -48,8 +48,11 @@ public final class StaticProperty { private static final String JAVA_IO_TMPDIR; private static final String NATIVE_ENCODING; private static final String FILE_ENCODING; - private static final String JAVA_PROPERTIES_DATE; + private static final String STDIN_ENCODING; + private static final String STDERR_ENCODING; + private static final String STDOUT_ENCODING; private static final String SUN_JNU_ENCODING; + private static final String JAVA_PROPERTIES_DATE; private static final String JAVA_LOCALE_USE_OLD_ISO_CODES; private static final String OS_NAME; private static final String OS_ARCH; @@ -86,8 +89,11 @@ private StaticProperty() {} JDK_SERIAL_FILTER_FACTORY = getProperty(props, "jdk.serialFilterFactory", null); NATIVE_ENCODING = getProperty(props, "native.encoding"); FILE_ENCODING = getProperty(props, "file.encoding"); - JAVA_PROPERTIES_DATE = getProperty(props, "java.properties.date", null); + STDIN_ENCODING = getProperty(props, "stdin.encoding"); + STDERR_ENCODING = getProperty(props, "stderr.encoding"); + STDOUT_ENCODING = getProperty(props, "stdout.encoding"); SUN_JNU_ENCODING = getProperty(props, "sun.jnu.encoding"); + JAVA_PROPERTIES_DATE = getProperty(props, "java.properties.date", null); JAVA_LOCALE_USE_OLD_ISO_CODES = getProperty(props, "java.locale.useOldISOCodes", ""); OS_NAME = getProperty(props, "os.name"); OS_ARCH = getProperty(props, "os.arch"); @@ -218,10 +224,24 @@ public static String fileEncoding() { } /** - * {@return the {@code java.properties.date} system property} + * {@return the {@code stdin.encoding} system property} */ - public static String javaPropertiesDate() { - return JAVA_PROPERTIES_DATE; + public static String stdinEncoding() { + return STDIN_ENCODING; + } + + /** + * {@return the {@code stderr.encoding} system property} + */ + public static String stderrEncoding() { + return STDERR_ENCODING; + } + + /** + * {@return the {@code stdout.encoding} system property} + */ + public static String stdoutEncoding() { + return STDOUT_ENCODING; } /** @@ -231,6 +251,13 @@ public static String jnuEncoding() { return SUN_JNU_ENCODING; } + /** + * {@return the {@code java.properties.date} system property} + */ + public static String javaPropertiesDate() { + return JAVA_PROPERTIES_DATE; + } + /** * {@return the {@code java.locale.useOldISOCodes} system property} */ diff --git a/src/java.base/share/classes/module-info.java b/src/java.base/share/classes/module-info.java index 07de3f2c57f..43d148a3428 100644 --- a/src/java.base/share/classes/module-info.java +++ b/src/java.base/share/classes/module-info.java @@ -318,6 +318,7 @@ exports sun.security.internal.spec to jdk.crypto.cryptoki; exports sun.security.jca to + java.security.sasl, java.smartcardio, jdk.crypto.cryptoki, jdk.naming.dns; @@ -402,8 +403,7 @@ uses sun.text.spi.JavaTimeDateTimePatternProvider; uses sun.util.spi.CalendarProvider; uses sun.util.locale.provider.LocaleDataMetaInfo; - uses sun.util.resources.LocaleData.CommonResourceBundleProvider; - uses sun.util.resources.LocaleData.SupplementaryResourceBundleProvider; + uses sun.util.resources.LocaleData.LocaleDataResourceBundleProvider; // Built-in service providers that are located via ServiceLoader diff --git a/src/java.base/share/classes/sun/invoke/empty/Empty.java b/src/java.base/share/classes/sun/invoke/empty/Empty.java deleted file mode 100644 index f75d2b3d016..00000000000 --- a/src/java.base/share/classes/sun/invoke/empty/Empty.java +++ /dev/null @@ -1,40 +0,0 @@ -/* - * Copyright (c) 2009, 2011, 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 sun.invoke.empty; - -/** - * An empty class in an empty package. - * Used as a proxy for unprivileged code, since making access checks - * against it will only succeed against public methods in public types. - *

    - * This class also stands (internally to sun.invoke) for the type of a - * value that cannot be produced, because the expression of this type - * always returns abnormally. (Cf. Nothing in the closures proposal.) - * @author jrose - */ -public class Empty { - private Empty() { throw new InternalError(); } -} diff --git a/src/java.base/share/classes/sun/invoke/util/VerifyType.java b/src/java.base/share/classes/sun/invoke/util/VerifyType.java index 7ede11b150e..5ca46cb0b74 100644 --- a/src/java.base/share/classes/sun/invoke/util/VerifyType.java +++ b/src/java.base/share/classes/sun/invoke/util/VerifyType.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2008, 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2008, 2025, 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 @@ -26,7 +26,6 @@ package sun.invoke.util; import java.lang.invoke.MethodType; -import sun.invoke.empty.Empty; /** * This class centralizes information about the JVM verifier @@ -93,8 +92,6 @@ public static boolean isNullType(Class type) { // Therefore, it can be safely treated as a value of any // other type that admits null, i.e., a reference type. if (type == Void.class) return true; - // Locally known null-only class: - if (type == Empty.class) return true; return false; } diff --git a/src/java.base/share/classes/sun/launcher/resources/launcher_de.properties b/src/java.base/share/classes/sun/launcher/resources/launcher_de.properties index 1f922b4cf73..79b5968b210 100644 --- a/src/java.base/share/classes/sun/launcher/resources/launcher_de.properties +++ b/src/java.base/share/classes/sun/launcher/resources/launcher_de.properties @@ -1,5 +1,5 @@ # -# Copyright (c) 2007, 2024, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2007, 2025, 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 @@ -34,8 +34,8 @@ java.launcher.opt.footer = \ -cp ...|:]\n -disableassertions[:...|:]\n Deaktiviert Assertions mit angegebener Granularität\n -esa | -enablesystemassertions\n Aktiviert System-Assertions\n -dsa | -disablesystemassertions\n Deaktiviert System-Assertions\n -agentlib:[=]\n Lädt die native Agent Library . Beispiel: -agentlib:jdwp\n siehe auch -agentlib:jdwp=help\n -agentpath:[=]\n Lädt die native Agent Library mit dem vollständigen Pfadnamen\n -javaagent:[=]\n Lädt den Java-Programmiersprachen-Agent, siehe java.lang.instrument\n -splash:\n Zeigt den Startbildschirm mit einem angegebenen Bild an\n Skalierte HiDPI-Bilder werden automatisch unterstützt und verwendet,\n falls verfügbar. Der nicht skalierte Bilddateiname (Beispiel: image.ext)\n muss immer als Argument an die Option "-splash" übergeben werden.\n Das am besten geeignete angegebene skalierte Bild wird\n automatisch ausgewählt.\n Weitere Informationen finden Sie in der Dokumentation zur SplashScreen-API\n @argument files\n Eine oder mehrere Argumentdateien mit Optionen\n --disable-@files\n Verhindert die weitere Erweiterung von Argumentdateien\n --enable-preview\n Lässt zu, das Klassen von Vorschaufeatures dieses Release abhängig sind\nUm ein Argument für eine lange Option anzugeben, können Sie --= oder\n-- verwenden.\n # Translators please note do not translate the options themselves -java.launcher.X.usage=\n -Xbatch Deaktiviert die Hintergrundkompilierung\n -Xbootclasspath/a:\n An das Ende des Bootstrap Classpaths anhängen\n -Xcheck:jni Führt zusätzliche Prüfungen für JNI-Funktionen aus\n -Xcomp Erzwingt die Kompilierung von Methoden beim ersten Aufruf\n -Xdebug Führt keine Aktion aus. Ist veraltet und wird in einem zukünftigen Release entfernt.\n -Xdiag Zeigt zusätzliche Diagnosemeldungen an\n -Xint Nur Ausführung im interpretierten Modus\n -Xinternalversion\n Zeigt detailliertere JVM-Versionsinformationen an als die\n Option -version\n -Xlog: Konfiguriert oder aktiviert Logging mit dem einheitlichen Java Virtual\n Machine-(JVM-)Logging-Framework. Verwenden Sie -Xlog:help\n für weitere Einzelheiten.\n -Xloggc: Protokolliert den GC-Status in einer Datei mit Zeitstempeln.\n Diese Option ist veraltet und kann in einem\n zukünftigen Release entfernt werden. Wird durch -Xlog:gc: ersetzt.\n -Xmixed Ausführung im gemischten Modus (Standard)\n -Xmn Legt die anfängliche und maximale Größe (in Byte) des Heaps\n für die Young Generation (Nursery) fest\n -Xms Legt die anfängliche Java-Heap-Größe fest\n -Xmx Legt die maximale Java-Heap-Größe fest\n -Xnoclassgc Deaktiviert die Klassen-Garbage Collection\n -Xrs Reduziert die Verwendung von BS-Signalen durch Java/VM (siehe Dokumentation)\n -Xshare:auto Verwendet freigegebene Klassendaten, wenn möglich (Standard)\n -Xshare:off Versucht nicht, freigegebene Klassendaten zu verwenden\n -Xshare:on Erfordert die Verwendung freigegebener Klassendaten, verläuft sonst nicht erfolgreich.\n Diese Testoption kann zeitweise zu\n Fehlern führen. Sie darf nicht in Produktionsumgebungen verwendet werden.\n -XshowSettings Zeigt alle Einstellungen an und fährt fort\n -XshowSettings:all\n Zeigt alle Einstellungen als Verbose-Ausgabe an und fährt fort\n -XshowSettings:locale\n Zeigt alle gebietsschemabezogenen Einstellungen an und fährt fort\n -XshowSettings:properties\n Zeigt alle Eigenschaftseinstellungen an und fährt fort\n -XshowSettings:vm\n Zeigt alle VM-bezogenen Einstellungen an und fährt fort\n -XshowSettings:security\n Zeigt alle Sicherheitseinstellungen an und fährt fort\n -XshowSettings:security:all\n Zeigt alle Sicherheitseinstellungen an und fährt fort\n -XshowSettings:security:properties\n Zeigt Sicherheitseigenschaften an und fährt fort\n -XshowSettings:security:providers\n Zeigt statische Sicherheitsprovidereinstellungen an und fährt fort\n -XshowSettings:security:tls\n Zeigt TLS-bezogene Sicherheitseinstellungen an und fährt fort\n -XshowSettings:system\n (Nur Linux) Zeigt die Konfiguration des Hostsystems oder Containers an\n und fährt fort\n -Xss Legt die Stackgröße des Java-Threads fest\n Die tatsächliche Größe kann auf ein Vielfaches der\n Systemseitengröße aufgerundet werden, wenn für das Betriebssystem erforderlich.\n -Xverify Legt den Modus der Bytecodeverifizierung fest\n \ - Beachten Sie, dass die Option -Xverify:none veraltet ist und\n in einem zukünftigen Release entfernt werden kann.\n --add-reads =(,)*\n Aktualisiert , damit gelesen wird, ungeachtet\n der Moduldeklaration. \n kann ALL-UNNAMED sein, um alle unbenannten\n Module zu lesen.\n --add-exports /=(,)*\n Aktualisiert , um in zu exportieren,\n ungeachtet der Moduldeklaration.\n kann ALL-UNNAMED sein, um in alle\n unbenannten Module zu exportieren.\n --add-opens /=(,)*\n Aktualisiert , um in\n zu öffnen, ungeachtet der Moduldeklaration.\n --limit-modules [,...]\n Grenzt die Gesamtmenge der beobachtbaren Module ein\n --patch-module =({0})*\n Überschreibt oder erweitert ein Modul mit Klassen und Ressourcen\n in JAR-Dateien oder Verzeichnissen.\n --source \n Legt die Version der Quelle im Quelldateimodus fest.\n --finalization=\n Steuert, ob die JVM Objekte finalisiert.\n Dabei ist entweder "enabled" oder "disabled".\n Die Finalisierung ist standardmäßig aktiviert.\n --sun-misc-unsafe-memory-access=\n Verwendung der nicht unterstützten API sun.misc.Unsafe zulassen oder verweigern\n ist "allow", "warn", "debug" oder "deny".\n Der Standardwert ist "warn".\n\nDiese zusätzlichen Optionen können jederzeit ohne vorherige Ankündigung geändert werden.\n +java.launcher.X.usage=\n -Xbatch Deaktiviert die Hintergrundkompilierung\n -Xbootclasspath/a:\n An das Ende des Bootstrap Classpaths anhängen\n -Xcheck:jni Führt zusätzliche Prüfungen für JNI-Funktionen aus\n -Xcomp Erzwingt die Kompilierung von Methoden beim ersten Aufruf\n -Xdebug Führt keine Aktion aus. Ist veraltet und wird in einem zukünftigen Release entfernt.\n -Xdiag Zeigt zusätzliche Diagnosemeldungen an\n -Xint Nur Ausführung im interpretierten Modus\n -Xinternalversion\n Zeigt detailliertere JVM-Versionsinformationen an als die\n Option -version\n -Xlog: Konfiguriert oder aktiviert Logging mit dem einheitlichen Java Virtual\n Machine-(JVM-)Logging-Framework. Verwenden Sie -Xlog:help\n für weitere Einzelheiten.\n -Xloggc: Protokolliert den GC-Status in einer Datei mit Zeitstempeln.\n Diese Option ist veraltet und kann in einem\n zukünftigen Release entfernt werden. Wird durch -Xlog:gc: ersetzt.\n -Xmixed Ausführung im gemischten Modus (Standard)\n -Xmn Legt die anfängliche und maximale Größe (in Byte) des Heaps\n für die Young Generation (Nursery) fest\n -Xms Legt die minimale und die anfängliche Java-Heap-Größe fest\n -Xmx Legt die maximale Java-Heap-Größe fest\n -Xnoclassgc Deaktiviert die Klassen-Garbage Collection\n -Xrs Reduziert die Verwendung von BS-Signalen durch Java/VM (siehe Dokumentation)\n -Xshare:auto Verwendet freigegebene Klassendaten, wenn möglich (Standard)\n -Xshare:off Versucht nicht, freigegebene Klassendaten zu verwenden\n -Xshare:on Erfordert die Verwendung freigegebener Klassendaten, verläuft sonst nicht erfolgreich.\n Diese Testoption kann zeitweise zu\n Fehlern führen. Sie darf nicht in Produktionsumgebungen verwendet werden.\n -XshowSettings Zeigt alle Einstellungen an und fährt fort\n -XshowSettings:all\n Zeigt alle Einstellungen als Verbose-Ausgabe an und fährt fort\n -XshowSettings:locale\n Zeigt alle gebietsschemabezogenen Einstellungen an und fährt fort\n -XshowSettings:properties\n Zeigt alle Eigenschaftseinstellungen an und fährt fort\n -XshowSettings:vm\n Zeigt alle VM-bezogenen Einstellungen an und fährt fort\n -XshowSettings:security\n Zeigt alle Sicherheitseinstellungen an und fährt fort\n -XshowSettings:security:all\n Zeigt alle Sicherheitseinstellungen an und fährt fort\n -XshowSettings:security:properties\n Zeigt Sicherheitseigenschaften an und fährt fort\n -XshowSettings:security:providers\n Zeigt statische Sicherheitsprovidereinstellungen an und fährt fort\n -XshowSettings:security:tls\n Zeigt TLS-bezogene Sicherheitseinstellungen an und fährt fort\n -XshowSettings:system\n (Nur Linux) Zeigt die Konfiguration des Hostsystems oder Containers an\n und fährt fort\n -Xss Legt die Stackgröße des Java-Threads fest\n Die tatsächliche Größe kann auf ein Vielfaches der\n Systemseitengröße aufgerundet werden, wenn für das Betriebssystem erforderlich.\n -Xverify Legt den Modus der Bytecodeverifizierung fest\n \ + Beachten Sie, dass die Option -Xverify:none veraltet ist und\n in einem zukünftigen Release entfernt werden kann.\n --add-reads =(,)*\n Aktualisiert , damit gelesen wird, ungeachtet\n der Moduldeklaration. \n kann ALL-UNNAMED sein, um alle unbenannten\n Module zu lesen.\n --add-exports /=(,)*\n Aktualisiert , um in zu exportieren,\n ungeachtet der Moduldeklaration.\n kann ALL-UNNAMED sein, um in alle\n unbenannten Module zu exportieren.\n --add-opens /=(,)*\n Aktualisiert , um in\n zu öffnen, ungeachtet der Moduldeklaration.\n --limit-modules [,...]\n Grenzt die Gesamtmenge der beobachtbaren Module ein\n --patch-module =({0})*\n Überschreibt oder erweitert ein Modul mit Klassen und Ressourcen\n in JAR-Dateien oder Verzeichnissen.\n --source \n Legt die Version der Quelle im Quelldateimodus fest.\n --finalization=\n Steuert, ob die JVM Objekte finalisiert.\n Dabei ist entweder "enabled" oder "disabled".\n Die Finalisierung ist standardmäßig aktiviert.\n --sun-misc-unsafe-memory-access=\n Verwendung der nicht unterstützten API sun.misc.Unsafe zulassen oder verweigern\n ist "allow", "warn", "debug" oder "deny".\n Der Standardwert ist "warn".\n\nDiese zusätzlichen Optionen können jederzeit ohne vorherige Ankündigung geändert werden.\n # Translators please note do not translate the options themselves java.launcher.X.macosx.usage=\nDie folgenden Optionen sind für macOS spezifisch:\n -XstartOnFirstThread\n Führt die main()-Methode für den ersten (AppKit-)Thread aus\n -Xdock:name=\n Setzt den im Dock angezeigten Standardanwendungsnamen außer Kraft\n -Xdock:icon=\n Setzt das im Dock angezeigte Standardsymbol außer Kraft\n\n @@ -51,6 +51,7 @@ java.launcher.cls.error4=Fehler: Beim Laden der Klasse {0} ist ein LinkageError java.launcher.cls.error5=Fehler: Hauptklasse {0} kann nicht initialisiert werden\nUrsache: {1}: {2} java.launcher.cls.error6=Fehler: Kein nicht privater Null-Argument-Konstruktor in Klasse {0} gefunden\nEntfernen Sie die Eigenschaft "private" aus dem vorhandenen Konstruktor, oder definieren Sie ihn als:\n public {0}() java.launcher.cls.error7=Fehler: Konstruktor mit nicht statischer innerer Klasse {0} kann nicht aufgerufen werden \nLegen Sie die innere Klasse als statisch fest, oder verschieben Sie sie in eine separate Quelldatei +java.launcher.cls.error8=Fehler: Abstrakte Klasse {0} kann nicht instanziiert werden.\nVerwenden Sie eine konkrete Klasse java.launcher.jar.error1=Fehler: Beim Versuch, Datei {0} zu öffnen, ist ein unerwarteter Fehler aufgetreten java.launcher.jar.error2=Manifest in {0} nicht gefunden java.launcher.jar.error3=kein Hauptmanifestattribut, in {0} diff --git a/src/java.base/share/classes/sun/launcher/resources/launcher_ja.properties b/src/java.base/share/classes/sun/launcher/resources/launcher_ja.properties index c6f1b8b330a..04b68db3a8e 100644 --- a/src/java.base/share/classes/sun/launcher/resources/launcher_ja.properties +++ b/src/java.base/share/classes/sun/launcher/resources/launcher_ja.properties @@ -1,5 +1,5 @@ # -# Copyright (c) 2007, 2024, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2007, 2025, 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 @@ -35,7 +35,7 @@ java.launcher.opt.footer = \ -cp <ディレクトリおよびzip/jarファイ -disableassertions[:...|:]\n 指定した粒度でアサーションを無効にします\n -esa | -enablesystemassertions\n システム・アサーションを有効にします\n -dsa | -disablesystemassertions\n システム・アサーションを無効にします\n -agentlib:[=]\n ネイティブ・エージェント・ライブラリをロードします。例: -agentlib:jdwp\n -agentlib:jdwp=helpも参照してください\n -agentpath:[=]\n フルパス名を使用して、ネイティブ・エージェント・ライブラリをロードします\n -javaagent:[=]\n Javaプログラミング言語エージェントをロードします。java.lang.instrumentを参照してください\n -splash:\n 指定されたイメージを含むスプラッシュ画面を表示します\n HiDPIスケールのイメージが自動的にサポートされて使用されます\n (可能な場合)。スケーリングされないイメージのファイル名(image.extなど)を\n 引数として-splashオプションに必ず渡す必要があります。\n 指定された最も適切なスケーリング済イメージが選択されます\n (自動的)。\n 詳細は、SplashScreen APIのドキュメントを参照してください\n @argumentファイル\n オプションを含む1つ以上の引数ファイル\n --disable-@files\n さらなる引数ファイル拡張を無効にします\n --enable-preview\n クラスをこのリリースのプレビュー機能に依存させることができます\n長いオプションの引数を指定する場合、--=または\n-- を使用できます。\n # Translators please note do not translate the options themselves -java.launcher.X.usage=\n -Xbatch バックグラウンド・コンパイルを無効にします\n -Xbootclasspath/a:\n ブートストラップ・クラス・パスの最後に追加します\n -Xcheck:jni JNI関数に対する追加のチェックを実行します\n -Xcomp 初回呼出し時にメソッドのコンパイルを強制します\n -Xdebug 何も実行されません。将来のリリースで削除されるため、非推奨になりました。\n -Xdiag 追加の診断メッセージを表示します\n -Xint インタプリタ・モードの実行のみ\n -Xinternalversion\n -versionオプションより詳細なJVMバージョン情報を\n 表示します\n -Xlog: Java Virtual Machine (JVM)統合ロギング・フレームワークでの\n ロギングを構成または有効化します。詳細は、-Xlog:helpを\n 使用してください。\n -Xloggc: タイムスタンプが付いたファイルにGCステータスのログを記録します\n このオプションは非推奨であり、将来のリリースで削除される\n 可能性があります。-Xlog:gc:で置換されています。\n -Xmixed 混合モードの実行(デフォルト)\n -Xmn 若い世代(ナーサリ)のヒープの初期サイズおよび最大サイズ\n (バイト単位)を設定します\n -Xms Javaの初期ヒープ・サイズを設定します\n -Xmx Javaの最大ヒープ・サイズを設定します\n -Xnoclassgc クラスのガベージ・コレクションを無効にします\n -Xrs Java/VMによるOSシグナルの使用を削減します(ドキュメントを参照)\n -Xshare:auto 可能であれば共有クラス・データを使用します(デフォルト)\n -Xshare:off 共有クラス・データの使用を試みません\n -Xshare:on 共有クラス・データの使用を必須にし、できなければ失敗します。\n \ +java.launcher.X.usage=\n -Xbatch バックグラウンド・コンパイルを無効にします\n -Xbootclasspath/a:\n ブートストラップ・クラス・パスの最後に追加します\n -Xcheck:jni JNI関数に対する追加のチェックを実行します\n -Xcomp 初回呼出し時にメソッドのコンパイルを強制します\n -Xdebug 何も実行されません。将来のリリースで削除されるため、非推奨になりました。\n -Xdiag 追加の診断メッセージを表示します\n -Xint インタプリタ・モードの実行のみ\n -Xinternalversion\n -versionオプションより詳細なJVMバージョン情報を\n 表示します\n -Xlog: Java Virtual Machine (JVM)統合ロギング・フレームワークでの\n ロギングを構成または有効化します。詳細は、-Xlog:helpを\n 使用してください。\n -Xloggc: タイムスタンプが付いたファイルにGCステータスのログを記録します\n このオプションは非推奨であり、将来のリリースで削除される\n 可能性があります。-Xlog:gc:で置換されています。\n -Xmixed 混合モードの実行(デフォルト)\n -Xmn 若い世代(ナーサリ)のヒープの初期サイズおよび最大サイズ\n (バイト単位)を設定します\n -Xms Javaの最小および初期のヒープ・サイズを設定します\n -Xmx Javaの最大ヒープ・サイズを設定します\n -Xnoclassgc クラスのガベージ・コレクションを無効にします\n -Xrs Java/VMによるOSシグナルの使用を削減します(ドキュメントを参照)\n -Xshare:auto 可能であれば共有クラス・データを使用します(デフォルト)\n -Xshare:off 共有クラス・データの使用を試みません\n -Xshare:on 共有クラス・データの使用を必須にし、できなければ失敗します。\n \ これはテスト・オプションであり、断続的な失敗につながる\n 可能性があります。本番環境では使用しないでください。\n -XshowSettings すべての設定を表示して続行します\n -XshowSettings:all\n すべての設定を詳細に表示して続行します\n -XshowSettings:locale\n すべてのロケール関連の設定を表示して続行します\n -XshowSettings:properties\n すべてのプロパティ設定を表示して続行します\n -XshowSettings:vm\n すべてのVM関連の設定を表示して続行します\n -XshowSettings:security\n すべてのセキュリティ設定を表示して続行します\n -XshowSettings:security:all\n すべてのセキュリティ設定を表示して続行します\n -XshowSettings:security:properties\n セキュリティ・プロパティを表示して続行します\n -XshowSettings:security:providers\n 静的セキュリティ・プロバイダ設定を表示して続行します\n -XshowSettings:security:tls\n TLS関連のセキュリティ設定を表示して続行します\n -XshowSettings:system\n (Linuxのみ)ホスト・システムまたはコンテナを表示します\n 構成して続行します\n -Xss javaスレッドのスタック・サイズを設定します\n 実際のサイズは、次の倍数に切り上げられる場合があります: \n オペレーティング・システムの要件に応じたシステム・ページ・サイズ。\n -Xverify バイトコード・ベリファイアのモードを設定します\n オプション-Xverify:noneは非推奨になり、\n 将来のリリースで削除される可能性があります。\n --add-reads =(,)*\n モジュール宣言に関係なく、を更新してを\n 読み取ります。 \n をALL-UNNAMEDに設定すると、すべての名前のないモジュールを\n 読み取ることができます。\n --add-exports \ /=(,)*\n モジュール宣言に関係なく、を更新してに\n エクスポートします。\n をALL-UNNAMEDに設定すると、すべての名前のないモジュールに\n エクスポートできます。\n --add-opens /=(,)*\n モジュール宣言に関係なく、を更新してを\n に開きます。\n --limit-modules [,...]\n 参照可能なモジュールの領域を制限します\n --patch-module =({0})*\n JARファイルまたはディレクトリのクラスおよびリソースで\n モジュールをオーバーライドまたは拡張します。\n --source \n ソースファイル・モードでソースのバージョンを設定します。\n --finalization=\n JVMがオブジェクトのファイナライズを実行するかどうかを制御します\n は"enabled"または"disabled"のいずれかです。\n ファイナライズはデフォルトで有効になっています。\n --sun-misc-unsafe-memory-access=\n サポートされていないAPI sun.misc.Unsafeの使用を許可または拒否します\n は"allow"、"warn"、"debug"または"deny"のいずれかです。\n デフォルト値は"warn"です。\n\nこの追加オプションは予告なしに変更されることがあります。\n @@ -53,6 +53,7 @@ java.launcher.cls.error4=エラー: メイン・クラス{0}のロード中にLi java.launcher.cls.error5=エラー: メイン・クラス{0}を初期化できません\n原因: {1}: {2} java.launcher.cls.error6=エラー: 非privateのゼロ引数コンストラクタがクラス{0}に見つかりません\n既存のコンストラクタからprivateを削除するか、次のように定義してください:\n public {0}() java.launcher.cls.error7=エラー: staticでない内部クラス{0}コンストラクタを起動できません \n内部クラスをstaticにするか、内部クラスを外部に出してソース・ファイルを区別してください +java.launcher.cls.error8=エラー: 抽象クラス{0}はインスタンス化できません\n具象クラスを使用してください java.launcher.jar.error1=エラー: ファイル{0}を開こうとしているときに、予期しないエラーが発生しました java.launcher.jar.error2={0}にマニフェストが見つかりません java.launcher.jar.error3={0}にメイン・マニフェスト属性がありません diff --git a/src/java.base/share/classes/sun/launcher/resources/launcher_zh_CN.properties b/src/java.base/share/classes/sun/launcher/resources/launcher_zh_CN.properties index 56d774b47db..ec466bf3019 100644 --- a/src/java.base/share/classes/sun/launcher/resources/launcher_zh_CN.properties +++ b/src/java.base/share/classes/sun/launcher/resources/launcher_zh_CN.properties @@ -1,5 +1,5 @@ # -# Copyright (c) 2007, 2024, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2007, 2025, 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 @@ -34,7 +34,7 @@ java.launcher.opt.footer = \ -cp <目录和 zip/jar 文件的类搜索路径> 将产品版本输出到输出流并退出\n -showversion 将产品版本输出到错误流并继续\n --show-version\n 将产品版本输出到输出流并继续\n --show-module-resolution\n 在启动过程中显示模块解析输出\n -? -h -help\n 将此帮助消息输出到错误流\n --help 将此帮助消息输出到输出流\n -X 将额外选项的帮助输出到错误流\n --help-extra 将额外选项的帮助输出到输出流\n -ea[:<程序包名称>...|:<类名>]\n -enableassertions[:<程序包名称>...|:<类名>]\n 按指定的粒度启用断言\n -da[:<程序包名称>...|:<类名>]\n -disableassertions[:<程序包名称>...|:<类名>]\n 按指定的粒度禁用断言\n -esa | -enablesystemassertions\n 启用系统断言\n -dsa | -disablesystemassertions\n 禁用系统断言\n -agentlib:<库名>[=<选项>]\n 加载本机代理库 <库名>, 例如 -agentlib:jdwp\n 另请参阅 -agentlib:jdwp=help\n -agentpath:<路径名>[=<选项>]\n 按完整路径名加载本机代理库\n -javaagent:[=<选项>]\n 加载 Java 编程语言代理, 请参阅 java.lang.instrument\n -splash:<图像路径>\n 使用指定的图像显示启动屏幕\n 自动支持和使用 HiDPI 缩放图像\n (如果可用)。应始终将未缩放的图像文件名 (例如, image.ext)\n 作为参数传递给 -splash 选项。\n 将自动选取提供的最合适的缩放\n 图像。\n 有关详细信息, 请参阅 SplashScreen API 文档\n @argument 文件\n 一个或多个包含选项的参数文件\n --disable-@files\n 阻止进一步扩展参数文件\n --enable-preview\n 允许类依赖于此发行版的预览功能\n要为长选项指定参数, 可以使用 --<名称>=<值> 或\n--<名称> <值>。\n # Translators please note do not translate the options themselves -java.launcher.X.usage=\n -Xbatch 禁用后台编译\n -Xbootclasspath/a:<以 {0} 分隔的目录和 zip/jar 文件>\n 附加在引导类路径末尾\n -Xcheck:jni 对 JNI 函数执行其他检查\n -Xcomp 强制在首次调用时编译方法\n -Xdebug 不执行任何操作;已过时,将在未来发行版中删除。\n -Xdiag 显示附加诊断消息\n -Xint 仅解释模式执行\n -Xinternalversion\n 显示比 -version 选项更详细的\n JVM 版本信息\n -Xlog: 配置或启用采用 Java 虚拟\n 机 (Java Virtual Machine, JVM) 统一记录框架进行事件记录。使用 -Xlog:help\n 可了解详细信息。\n -Xloggc: 将 GC 状态记录在文件中(带时间戳)。\n 此选项已过时,可能会在\n 将来的发行版中删除。它将替换为 -Xlog:gc:。\n -Xmixed 混合模式执行(默认值)\n -Xmn 为年轻代(新生代)设置初始和最大堆大小\n (以字节为单位)\n -Xms 设置初始 Java 堆大小\n -Xmx 设置最大 Java 堆大小\n -Xnoclassgc 禁用类垃圾收集\n -Xrs 减少 Java/VM 对操作系统信号的使用(请参见文档)\n -Xshare:auto 在可能的情况下使用共享类数据(默认值)\n -Xshare:off 不尝试使用共享类数据\n -Xshare:on 要求使用共享类数据,否则将失败。\n 这是一个测试选项,可能导致间歇性\n 故障。不应在生产环境中使用它。\n -XshowSettings 显示所有设置并继续\n -XshowSettings:all\n 详细显示所有设置并继续\n -XshowSettings:locale\n 显示所有与区域设置相关的设置并继续\n -XshowSettings:properties\n 显示所有属性设置并继续\n -XshowSettings:vm\n 显示所有与 vm 相关的设置并继续\n -XshowSettings:security\n 显示所有安全设置并继续\n -XshowSettings:security:all\n 显示所有安全设置并继续\n -XshowSettings:security:properties\n 显示安全属性并继续\n -XshowSettings:security:providers\n 显示静态安全提供方设置并继续\n -XshowSettings:security:tls\n 显示与 TLS \ +java.launcher.X.usage=\n -Xbatch 禁用后台编译\n -Xbootclasspath/a:<以 {0} 分隔的目录和 zip/jar 文件>\n 附加在引导类路径末尾\n -Xcheck:jni 对 JNI 函数执行其他检查\n -Xcomp 强制在首次调用时编译方法\n -Xdebug 不执行任何操作;已过时,将在未来发行版中删除。\n -Xdiag 显示附加诊断消息\n -Xint 仅解释模式执行\n -Xinternalversion\n 显示比 -version 选项更详细的\n JVM 版本信息\n -Xlog: 配置或启用采用 Java 虚拟\n 机 (Java Virtual Machine, JVM) 统一记录框架进行事件记录。使用 -Xlog:help\n 可了解详细信息。\n -Xloggc: 将 GC 状态记录在文件中(带时间戳)。\n 此选项已过时,可能会在\n 将来的发行版中删除。它将替换为 -Xlog:gc:。\n -Xmixed 混合模式执行(默认值)\n -Xmn 为年轻代(新生代)设置初始和最大堆大小\n (以字节为单位)\n -Xms 设置最小和初始 Java 堆大小\n -Xmx 设置最大 Java 堆大小\n -Xnoclassgc 禁用类垃圾收集\n -Xrs 减少 Java/VM 对操作系统信号的使用(请参见文档)\n -Xshare:auto 在可能的情况下使用共享类数据(默认值)\n -Xshare:off 不尝试使用共享类数据\n -Xshare:on 要求使用共享类数据,否则将失败。\n 这是一个测试选项,可能导致间歇性\n 故障。不应在生产环境中使用它。\n -XshowSettings 显示所有设置并继续\n -XshowSettings:all\n 详细显示所有设置并继续\n -XshowSettings:locale\n 显示所有与区域设置相关的设置并继续\n -XshowSettings:properties\n 显示所有属性设置并继续\n -XshowSettings:vm\n 显示所有与 vm 相关的设置并继续\n -XshowSettings:security\n 显示所有安全设置并继续\n -XshowSettings:security:all\n 显示所有安全设置并继续\n -XshowSettings:security:properties\n 显示安全属性并继续\n -XshowSettings:security:providers\n 显示静态安全提供方设置并继续\n -XshowSettings:security:tls\n 显示与 TLS \ 相关的安全设置并继续\n -XshowSettings:system\n (仅 Linux)显示主机系统或容器\n 配置并继续\n -Xss 设置 Java 线程堆栈大小\n 实际大小可以舍入到\n 操作系统要求的系统页面大小的倍数。\n -Xverify 设置字节码验证器的模式\n 请注意,选项 -Xverify:none 已过时,\n 可能会在未来发行版中删除。\n --add-reads =(,)*\n 更新 以读取 ,而无论\n 模块如何声明。 \n 可以是 ALL-UNNAMED,将读取所有未命名\n 模块。\n --add-exports /=(,)*\n 更新 以将 导出到 ,\n 而无论模块如何声明。\n 可以是 ALL-UNNAMED,将导出到所有\n 未命名模块。\n --add-opens /=(,)*\n 更新 以在 中打开\n ,而无论模块如何声明。\n --limit-modules [,...]\n 限制可观察模块的领域\n --patch-module =({0})*\n 使用 JAR 文件或目录中的类和资源\n 覆盖或增强模块。\n --source \n 设置源文件模式中源的版本。\n --finalization=\n 控制 JVM 是否执行对象最终处理,\n 其中 为 "enabled" 或 "disabled" 之一。\n 默认情况下,最终处理处于启用状态。\n --sun-misc-unsafe-memory-access=\n 允许或拒绝使用不受支持的 API sun.misc.Unsafe\n 为 "allow"、"warn"、"debug" 或 "deny" 之一。\n 默认值为 "warn"。\n\n这些额外选项如有更改, 恕不另行通知。\n # Translators please note do not translate the options themselves @@ -51,6 +51,7 @@ java.launcher.cls.error4=错误: 加载主类 {0} 时出现 LinkageError\n\t{1} java.launcher.cls.error5=错误: 无法初始化主类 {0}\n原因: {1}: {2} java.launcher.cls.error6=错误:在类 {0} 中未找到非专用零参数构造器\n请从现有构造器中删除专用,或者定义为:\n public {0}() java.launcher.cls.error7=错误:无法调用非静态内部类 {0} 构造器\n请将内部类设为静态或将内部类移出到单独的源文件 +java.launcher.cls.error8=错误:无法实例化抽象类 {0}\n请使用具体类 java.launcher.jar.error1=错误: 尝试打开文件{0}时出现意外错误 java.launcher.jar.error2=在{0}中找不到清单 java.launcher.jar.error3={0}中没有主清单属性 diff --git a/src/java.base/share/classes/sun/net/www/protocol/http/HttpURLConnection.java b/src/java.base/share/classes/sun/net/www/protocol/http/HttpURLConnection.java index 5d8e6f467aa..b66d9ddb8cb 100644 --- a/src/java.base/share/classes/sun/net/www/protocol/http/HttpURLConnection.java +++ b/src/java.base/share/classes/sun/net/www/protocol/http/HttpURLConnection.java @@ -621,10 +621,10 @@ private void writeRequests() throws IOException { if (port != -1 && port != url.getDefaultPort()) { host += ":" + String.valueOf(port); } - String reqHost = requests.findValue("Host"); - if (reqHost == null || !reqHost.equalsIgnoreCase(host)) { - requests.set("Host", host); - } + // if the "Host" header hasn't been explicitly set, then set its + // value to the one determined through the request URL + requests.setIfNotSet("Host", host); + requests.setIfNotSet("Accept", acceptString); /* diff --git a/src/java.base/share/classes/sun/net/www/protocol/jrt/JavaRuntimeURLConnection.java b/src/java.base/share/classes/sun/net/www/protocol/jrt/JavaRuntimeURLConnection.java index 4e67c962a46..20b735fbdf3 100644 --- a/src/java.base/share/classes/sun/net/www/protocol/jrt/JavaRuntimeURLConnection.java +++ b/src/java.base/share/classes/sun/net/www/protocol/jrt/JavaRuntimeURLConnection.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2025, 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 @@ -28,116 +28,89 @@ import java.io.ByteArrayInputStream; import java.io.IOException; import java.io.InputStream; +import java.io.UncheckedIOException; import java.net.MalformedURLException; import java.net.URL; -import jdk.internal.jimage.ImageLocation; import jdk.internal.jimage.ImageReader; +import jdk.internal.jimage.ImageReader.Node; import jdk.internal.jimage.ImageReaderFactory; -import jdk.internal.loader.Resource; import sun.net.www.ParseUtil; import sun.net.www.URLConnection; /** * URLConnection implementation that can be used to connect to resources - * contained in the runtime image. + * contained in the runtime image. See section "New URI scheme for naming stored + * modules, classes, and resources" in + * JEP 220. */ public class JavaRuntimeURLConnection extends URLConnection { - // ImageReader to access resources in jimage - private static final ImageReader reader = ImageReaderFactory.getImageReader(); + // ImageReader to access resources in jimage. + private static final ImageReader READER = ImageReaderFactory.getImageReader(); - // the module and resource name in the URL + // The module and resource name in the URL (i.e. "jrt:/[$MODULE[/$PATH]]"). + // + // The module name is not percent-decoded, and can be empty. private final String module; - private final String name; + // The resource name permits UTF-8 percent encoding of non-ASCII characters. + private final String path; - // the Resource when connected - private volatile Resource resource; + // The resource node (non-null when connected). + private Node resourceNode; JavaRuntimeURLConnection(URL url) throws IOException { super(url); - String path = url.getPath(); - if (path.isEmpty() || path.charAt(0) != '/') + String urlPath = url.getPath(); + if (urlPath.isEmpty() || urlPath.charAt(0) != '/') { throw new MalformedURLException(url + " missing path or /"); - if (path.length() == 1) { - this.module = null; - this.name = null; + } + int pathSep = urlPath.indexOf('/', 1); + if (pathSep == -1) { + // No trailing resource path. This can never "connect" or return a + // resource (see JEP 220 for details). + this.module = urlPath.substring(1); + this.path = null; } else { - int pos = path.indexOf('/', 1); - if (pos == -1) { - this.module = path.substring(1); - this.name = null; - } else { - this.module = path.substring(1, pos); - this.name = ParseUtil.decode(path.substring(pos+1)); - } + this.module = urlPath.substring(1, pathSep); + this.path = percentDecode(urlPath.substring(pathSep + 1)); } } /** - * Finds a resource in a module, returning {@code null} if the resource - * is not found. + * Finds and caches the resource node associated with this URL and marks the + * connection as "connected". */ - private static Resource findResource(String module, String name) { - if (reader != null) { - URL url = toJrtURL(module, name); - ImageLocation location = reader.findLocation(module, name); - if (location != null) { - return new Resource() { - @Override - public String getName() { - return name; - } - @Override - public URL getURL() { - return url; - } - @Override - public URL getCodeSourceURL() { - return toJrtURL(module); - } - @Override - public InputStream getInputStream() throws IOException { - byte[] resource = reader.getResource(location); - return new ByteArrayInputStream(resource); - } - @Override - public int getContentLength() { - long size = location.getUncompressedSize(); - return (size > Integer.MAX_VALUE) ? -1 : (int) size; - } - }; + private synchronized Node connectResourceNode() throws IOException { + if (resourceNode == null) { + if (module.isEmpty() || path == null) { + throw new IOException("cannot connect to jrt:/" + module); } + Node node = READER.findNode("/modules/" + module + "/" + path); + if (node == null || !node.isResource()) { + throw new IOException(module + "/" + path + " not found"); + } + this.resourceNode = node; + super.connected = true; } - return null; + return resourceNode; } @Override - public synchronized void connect() throws IOException { - if (!connected) { - if (name == null) { - String s = (module == null) ? "" : module; - throw new IOException("cannot connect to jrt:/" + s); - } - resource = findResource(module, name); - if (resource == null) - throw new IOException(module + "/" + name + " not found"); - connected = true; - } + public void connect() throws IOException { + connectResourceNode(); } @Override public InputStream getInputStream() throws IOException { - connect(); - return resource.getInputStream(); + return new ByteArrayInputStream(READER.getResource(connectResourceNode())); } @Override public long getContentLengthLong() { try { - connect(); - return resource.getContentLength(); + return connectResourceNode().size(); } catch (IOException ioe) { return -1L; } @@ -149,27 +122,13 @@ public int getContentLength() { return len > Integer.MAX_VALUE ? -1 : (int)len; } - /** - * Returns a jrt URL for the given module and resource name. - */ - @SuppressWarnings("deprecation") - private static URL toJrtURL(String module, String name) { - try { - return new URL("jrt:/" + module + "/" + name); - } catch (MalformedURLException e) { - throw new InternalError(e); - } - } - - /** - * Returns a jrt URL for the given module. - */ - @SuppressWarnings("deprecation") - private static URL toJrtURL(String module) { + // Perform percent decoding of the resource name/path from the URL. + private static String percentDecode(String path) throws MalformedURLException { + // Any additional special case decoding logic should go here. try { - return new URL("jrt:/" + module); - } catch (MalformedURLException e) { - throw new InternalError(e); + return ParseUtil.decode(path); + } catch (IllegalArgumentException e) { + throw new MalformedURLException(e.getMessage()); } } } diff --git a/src/java.base/share/classes/sun/nio/ch/AsynchronousFileChannelImpl.java b/src/java.base/share/classes/sun/nio/ch/AsynchronousFileChannelImpl.java index 2ca1f8a87b8..28d067ebc74 100644 --- a/src/java.base/share/classes/sun/nio/ch/AsynchronousFileChannelImpl.java +++ b/src/java.base/share/classes/sun/nio/ch/AsynchronousFileChannelImpl.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2008, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2008, 2025, 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 @@ -32,6 +32,8 @@ import java.util.concurrent.locks.*; import java.io.FileDescriptor; import java.io.IOException; +import jdk.internal.access.JavaNioAccess; +import jdk.internal.access.SharedSecrets; /** * Base implementation of AsynchronousFileChannel. @@ -40,6 +42,8 @@ abstract class AsynchronousFileChannelImpl extends AsynchronousFileChannel { + private static final JavaNioAccess NIO_ACCESS = SharedSecrets.getJavaNioAccess(); + // close support protected final ReadWriteLock closeLock = new ReentrantReadWriteLock(); protected volatile boolean closed; @@ -215,6 +219,10 @@ abstract Future implRead(ByteBuffer dst, @Override public final Future read(ByteBuffer dst, long position) { + if (dst.isReadOnly()) + throw new IllegalArgumentException("Read-only buffer"); + if (NIO_ACCESS.isThreadConfined(dst)) + throw new IllegalArgumentException("Buffer is thread confined"); return implRead(dst, position, null, null); } @@ -226,6 +234,10 @@ public final void read(ByteBuffer dst, { if (handler == null) throw new NullPointerException("'handler' is null"); + if (dst.isReadOnly()) + throw new IllegalArgumentException("Read-only buffer"); + if (NIO_ACCESS.isThreadConfined(dst)) + throw new IllegalArgumentException("Buffer is thread confined"); implRead(dst, position, attachment, handler); } @@ -237,6 +249,8 @@ abstract Future implWrite(ByteBuffer src, @Override public final Future write(ByteBuffer src, long position) { + if (NIO_ACCESS.isThreadConfined(src)) + throw new IllegalArgumentException("Buffer is thread confined"); return implWrite(src, position, null, null); } @@ -248,6 +262,8 @@ public final void write(ByteBuffer src, { if (handler == null) throw new NullPointerException("'handler' is null"); + if (NIO_ACCESS.isThreadConfined(src)) + throw new IllegalArgumentException("Buffer is thread confined"); implWrite(src, position, attachment, handler); } } diff --git a/src/java.base/share/classes/sun/nio/ch/AsynchronousSocketChannelImpl.java b/src/java.base/share/classes/sun/nio/ch/AsynchronousSocketChannelImpl.java index c53aca8b1c7..68983304735 100644 --- a/src/java.base/share/classes/sun/nio/ch/AsynchronousSocketChannelImpl.java +++ b/src/java.base/share/classes/sun/nio/ch/AsynchronousSocketChannelImpl.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2008, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2008, 2025, 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 @@ -39,6 +39,8 @@ import java.util.Collections; import java.util.concurrent.*; import java.util.concurrent.locks.*; +import jdk.internal.access.JavaNioAccess; +import jdk.internal.access.SharedSecrets; import sun.net.NetHooks; import sun.net.ext.ExtendedSocketOptions; @@ -50,6 +52,8 @@ abstract class AsynchronousSocketChannelImpl extends AsynchronousSocketChannel implements Cancellable, Groupable { + private static final JavaNioAccess NIO_ACCESS = SharedSecrets.getJavaNioAccess(); + protected final FileDescriptor fd; // protects state, localAddress, and remoteAddress @@ -281,6 +285,8 @@ private Future read(boolean isScatteringRead, public final Future read(ByteBuffer dst) { if (dst.isReadOnly()) throw new IllegalArgumentException("Read-only buffer"); + if (NIO_ACCESS.isThreadConfined(dst)) + throw new IllegalArgumentException("Buffer is thread confined"); return read(false, dst, null, 0L, TimeUnit.MILLISECONDS, null, null); } @@ -295,6 +301,8 @@ public final void read(ByteBuffer dst, throw new NullPointerException("'handler' is null"); if (dst.isReadOnly()) throw new IllegalArgumentException("Read-only buffer"); + if (NIO_ACCESS.isThreadConfined(dst)) + throw new IllegalArgumentException("Buffer is thread confined"); read(false, dst, null, timeout, unit, attachment, handler); } @@ -310,12 +318,14 @@ public final void read(ByteBuffer[] dsts, if (handler == null) throw new NullPointerException("'handler' is null"); Objects.checkFromIndexSize(offset, length, dsts.length); - ByteBuffer[] bufs = Util.subsequence(dsts, offset, length); - for (int i=0; i Future write(boolean isGatheringWrite, @Override public final Future write(ByteBuffer src) { + if (NIO_ACCESS.isThreadConfined(src)) + throw new IllegalArgumentException("Buffer is thread confined"); return write(false, src, null, 0L, TimeUnit.MILLISECONDS, null, null); } @@ -396,6 +408,8 @@ public final void write(ByteBuffer src, { if (handler == null) throw new NullPointerException("'handler' is null"); + if (NIO_ACCESS.isThreadConfined(src)) + throw new IllegalArgumentException("Buffer is thread confined"); write(false, src, null, timeout, unit, attachment, handler); } @@ -412,6 +426,11 @@ public final void write(ByteBuffer[] srcs, throw new NullPointerException("'handler' is null"); Objects.checkFromIndexSize(offset, length, srcs.length); srcs = Util.subsequence(srcs, offset, length); + for (ByteBuffer src : srcs) { + if (NIO_ACCESS.isThreadConfined(src)) { + throw new IllegalArgumentException("Buffer is thread confined"); + } + } write(true, null, srcs, timeout, unit, attachment, handler); } diff --git a/src/java.base/share/classes/sun/nio/ch/DatagramSocketAdaptor.java b/src/java.base/share/classes/sun/nio/ch/DatagramSocketAdaptor.java index 44b05f97472..a9962d19400 100644 --- a/src/java.base/share/classes/sun/nio/ch/DatagramSocketAdaptor.java +++ b/src/java.base/share/classes/sun/nio/ch/DatagramSocketAdaptor.java @@ -50,7 +50,6 @@ import java.nio.channels.MembershipKey; import java.util.Objects; import java.util.Set; -import java.util.concurrent.locks.ReentrantLock; import static java.util.concurrent.TimeUnit.MILLISECONDS; import static jdk.internal.util.Exceptions.formatMsg; @@ -372,44 +371,19 @@ public Set> supportedOptions() { // -- java.net.MulticastSocket -- - // used to coordinate changing TTL with the deprecated send method - private final ReentrantLock sendLock = new ReentrantLock(); - // cached outgoing interface (for use by setInterface/getInterface) private final Object outgoingInterfaceLock = new Object(); private NetworkInterface outgoingNetworkInterface; private InetAddress outgoingInetAddress; - @Override - @SuppressWarnings("removal") - public void setTTL(byte ttl) throws IOException { - setTimeToLive(Byte.toUnsignedInt(ttl)); - } - @Override public void setTimeToLive(int ttl) throws IOException { - sendLock.lock(); - try { - setIntOption(StandardSocketOptions.IP_MULTICAST_TTL, ttl); - } finally { - sendLock.unlock(); - } - } - - @Override - @SuppressWarnings("removal") - public byte getTTL() throws IOException { - return (byte) getTimeToLive(); + setIntOption(StandardSocketOptions.IP_MULTICAST_TTL, ttl); } @Override public int getTimeToLive() throws IOException { - sendLock.lock(); - try { - return getIntOption(StandardSocketOptions.IP_MULTICAST_TTL); - } finally { - sendLock.unlock(); - } + return getIntOption(StandardSocketOptions.IP_MULTICAST_TTL); } @Override @@ -558,23 +532,6 @@ public boolean getLoopbackMode() throws SocketException { return !enabled; } - @Override - @SuppressWarnings("removal") - public void send(DatagramPacket p, byte ttl) throws IOException { - sendLock.lock(); - try { - int oldValue = getTimeToLive(); - try { - setTTL(ttl); - send(p); - } finally { - setTimeToLive(oldValue); - } - } finally { - sendLock.unlock(); - } - } - /** * Returns the outgoing NetworkInterface or null if not set. */ diff --git a/src/java.base/share/classes/sun/nio/ch/IOUtil.java b/src/java.base/share/classes/sun/nio/ch/IOUtil.java index ad1aedc2668..45f8cb2e588 100644 --- a/src/java.base/share/classes/sun/nio/ch/IOUtil.java +++ b/src/java.base/share/classes/sun/nio/ch/IOUtil.java @@ -479,7 +479,7 @@ static long read(FileDescriptor fd, ByteBuffer[] bufs, int offset, int length, static void acquireScope(ByteBuffer bb, boolean async) { if (async && NIO_ACCESS.isThreadConfined(bb)) { - throw new IllegalStateException("Confined session not supported"); + throw new IllegalArgumentException("Buffer is thread confined"); } NIO_ACCESS.acquireSession(bb); } diff --git a/src/java.base/share/classes/sun/nio/ch/Net.java b/src/java.base/share/classes/sun/nio/ch/Net.java index 5cd14a8b301..9ec7975a35c 100644 --- a/src/java.base/share/classes/sun/nio/ch/Net.java +++ b/src/java.base/share/classes/sun/nio/ch/Net.java @@ -94,6 +94,15 @@ static boolean useExclusiveBind() { return EXCLUSIVE_BIND; } + private static final StableValue SHUTDOWN_WRITE_BEFORE_CLOSE = StableValue.of(); + + /** + * Tells whether a TCP connection should be shutdown for writing before closing. + */ + static boolean shouldShutdownWriteBeforeClose() { + return SHUTDOWN_WRITE_BEFORE_CLOSE.orElseSet(Net::shouldShutdownWriteBeforeClose0); + } + /** * Tells whether both IPV6_XXX and IP_XXX socket options should be set on * IPv6 sockets. On some kernels, both IPV6_XXX and IP_XXX socket options @@ -462,6 +471,8 @@ private static boolean isFastTcpLoopbackRequested() { */ private static native int isExclusiveBindAvailable(); + private static native boolean shouldShutdownWriteBeforeClose0(); + private static native boolean shouldSetBothIPv4AndIPv6Options0(); private static native boolean canIPv6SocketJoinIPv4Group0(); diff --git a/src/java.base/share/classes/sun/nio/ch/SimpleAsynchronousFileChannelImpl.java b/src/java.base/share/classes/sun/nio/ch/SimpleAsynchronousFileChannelImpl.java index 440c254601d..13de40e9a24 100644 --- a/src/java.base/share/classes/sun/nio/ch/SimpleAsynchronousFileChannelImpl.java +++ b/src/java.base/share/classes/sun/nio/ch/SimpleAsynchronousFileChannelImpl.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2008, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2008, 2025, 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 @@ -327,6 +327,8 @@ Future implRead(final ByteBuffer dst, return null; } + IOUtil.acquireScope(dst, true); + final PendingFuture result = (handler == null) ? new PendingFuture(this) : null; Runnable task = new Runnable() { @@ -349,6 +351,7 @@ public void run() { } finally { end(); threads.remove(ti); + IOUtil.releaseScope(dst); } if (handler == null) { result.setResult(n, exc); @@ -381,6 +384,8 @@ Future implWrite(final ByteBuffer src, return null; } + IOUtil.acquireScope(src, true); + final PendingFuture result = (handler == null) ? new PendingFuture(this) : null; Runnable task = new Runnable() { @@ -403,6 +408,7 @@ public void run() { } finally { end(); threads.remove(ti); + IOUtil.releaseScope(src); } if (handler == null) { result.setResult(n, exc); diff --git a/src/java.base/share/classes/sun/nio/ch/SocketChannelImpl.java b/src/java.base/share/classes/sun/nio/ch/SocketChannelImpl.java index c1241a51f85..37e6a71d80d 100644 --- a/src/java.base/share/classes/sun/nio/ch/SocketChannelImpl.java +++ b/src/java.base/share/classes/sun/nio/ch/SocketChannelImpl.java @@ -846,7 +846,7 @@ public boolean isConnectionPending() { /** * Marks the beginning of a connect operation that might block. * @param blocking true if configured blocking - * @param isa the remote address + * @param sa the remote socket address * @throws ClosedChannelException if the channel is closed * @throws AlreadyConnectedException if already connected * @throws ConnectionPendingException is a connection is pending @@ -1070,8 +1070,8 @@ public boolean finishConnect() throws IOException { } /** - * Closes the socket if there are no I/O operations in progress and the - * channel is not registered with a Selector. + * Closes the socket if there are no I/O operations in progress (or no I/O + * operations tracked), and the channel is not registered with a Selector. */ private boolean tryClose() throws IOException { assert Thread.holdsLock(stateLock) && state == ST_CLOSING; @@ -1096,11 +1096,21 @@ private void tryFinishClose() { } /** - * Closes this channel when configured in blocking mode. + * Closes this channel when configured in blocking mode. If there are no I/O + * operations in progress (or tracked), then the channel's socket is closed. If + * there are I/O operations in progress then the behavior is platform specific. * - * If there is an I/O operation in progress then the socket is pre-closed - * and the I/O threads signalled, in which case the final close is deferred - * until all I/O operations complete. + * On Unix systems, the channel's socket is pre-closed. This unparks any virtual + * threads that are blocked in I/O operations on this channel. If there are + * platform threads blocked on the channel's socket then the socket is dup'ed + * and the platform threads signalled. The final close is deferred until all I/O + * operations complete. + * + * On Windows, the channel's socket is pre-closed. This unparks any virtual + * threads that are blocked in I/O operations on this channel. If there are no + * virtual threads blocked in I/O operations on this channel then the channel's + * socket is closed. If there are virtual threads in I/O then the final close is + * deferred until all I/O operations on virtual threads complete. * * Note that a channel configured blocking may be registered with a Selector * This arises when a key is canceled and the channel configured to blocking @@ -1112,17 +1122,17 @@ private void implCloseBlockingMode() throws IOException { boolean connected = (state == ST_CONNECTED); state = ST_CLOSING; - if (!tryClose()) { + if (connected && Net.shouldShutdownWriteBeforeClose()) { // shutdown output when linger interval not set to 0 - if (connected) { - try { - var SO_LINGER = StandardSocketOptions.SO_LINGER; - if ((int) Net.getSocketOption(fd, SO_LINGER) != 0) { - Net.shutdown(fd, Net.SHUT_WR); - } - } catch (IOException ignore) { } - } + try { + var SO_LINGER = StandardSocketOptions.SO_LINGER; + if ((int) Net.getSocketOption(fd, SO_LINGER) != 0) { + Net.shutdown(fd, Net.SHUT_WR); + } + } catch (IOException ignore) { } + } + if (!tryClose()) { // prepare file descriptor for closing nd.preClose(fd, readerThread, writerThread); } diff --git a/src/java.base/share/classes/sun/security/ssl/HelloCookieManager.java b/src/java.base/share/classes/sun/security/ssl/HelloCookieManager.java index 5c2a09b7c03..b3155f5170a 100644 --- a/src/java.base/share/classes/sun/security/ssl/HelloCookieManager.java +++ b/src/java.base/share/classes/sun/security/ssl/HelloCookieManager.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018, 2025, 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 @@ -187,7 +187,7 @@ boolean isCookieValid(ServerHandshakeContext context, byte[] secret; d10ManagerLock.lock(); try { - if (((cookieVersion >> 24) & 0xFF) == cookie[0]) { + if ((byte) ((cookieVersion >> 24) & 0xFF) == cookie[0]) { secret = cookieSecret; } else { secret = legacySecret; // including out of window cookies diff --git a/src/java.base/share/classes/sun/security/ssl/TrustStoreManager.java b/src/java.base/share/classes/sun/security/ssl/TrustStoreManager.java index 82dc82362ca..e2c353847c7 100644 --- a/src/java.base/share/classes/sun/security/ssl/TrustStoreManager.java +++ b/src/java.base/share/classes/sun/security/ssl/TrustStoreManager.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018, 2025, 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 @@ -376,9 +376,10 @@ private static KeyStore loadKeyStore( } if (!"NONE".equals(descriptor.storeName)) { - try (FileInputStream fis = - new FileInputStream(descriptor.storeFile)) { - ks.load(fis, password); + try (BufferedInputStream bis = + new BufferedInputStream( + new FileInputStream(descriptor.storeFile))) { + ks.load(bis, password); } catch (FileNotFoundException fnfe) { // No file available, no KeyStore available. if (SSLLogger.isOn && SSLLogger.isOn("trustmanager")) { diff --git a/src/java.base/share/classes/sun/security/tools/keytool/Main.java b/src/java.base/share/classes/sun/security/tools/keytool/Main.java index 89cad63dc65..8c6cd139a0d 100644 --- a/src/java.base/share/classes/sun/security/tools/keytool/Main.java +++ b/src/java.base/share/classes/sun/security/tools/keytool/Main.java @@ -26,6 +26,7 @@ package sun.security.tools.keytool; import java.io.*; +import java.nio.charset.Charset; import java.nio.file.Files; import java.nio.file.Path; import java.security.*; @@ -59,6 +60,8 @@ import javax.security.auth.x500.X500Principal; import java.util.Base64; +import jdk.internal.util.StaticProperty; + import sun.security.pkcs12.PKCS12KeyStore; import sun.security.provider.certpath.CertPathConstraintsParameters; import sun.security.util.*; @@ -1473,7 +1476,7 @@ private void doGenCert(String alias, String sigAlgName, InputStream in, PrintStr info.setVersion(new CertificateVersion(CertificateVersion.V3)); info.setIssuer(issuer); - BufferedReader reader = new BufferedReader(new InputStreamReader(in)); + BufferedReader reader = stdinAwareReader(in); boolean canRead = false; StringBuilder sb = new StringBuilder(); while (true) { @@ -2828,7 +2831,7 @@ private void printCRL(CRL crl, PrintStream out) private void doPrintCertReq(InputStream in, PrintStream out) throws Exception { - BufferedReader reader = new BufferedReader(new InputStreamReader(in)); + BufferedReader reader = stdinAwareReader(in); StringBuilder sb = new StringBuilder(); boolean started = false; while (true) { @@ -3533,8 +3536,7 @@ private String getAlias(String prompt) throws Exception { } else { System.err.print(rb.getString("Enter.alias.name.")); } - return (new BufferedReader(new InputStreamReader( - System.in))).readLine(); + return stdinAwareReader(System.in).readLine(); } /** @@ -3544,8 +3546,14 @@ private String getAlias(String prompt) throws Exception { */ private String inputStringFromStdin(String prompt) throws Exception { System.err.print(prompt); - return (new BufferedReader(new InputStreamReader( - System.in))).readLine(); + return stdinAwareReader(System.in).readLine(); + } + + private static BufferedReader stdinAwareReader(InputStream in) { + InputStreamReader reader = in == System.in + ? new InputStreamReader(in, Charset.forName(StaticProperty.stdinEncoding(), Charset.defaultCharset())) + : new InputStreamReader(in); + return new BufferedReader(reader); } /** @@ -3732,7 +3740,7 @@ private static void printExtensions(String title, CertificateExtensions exts, Pr */ private X500Name getX500Name() throws IOException { BufferedReader in; - in = new BufferedReader(new InputStreamReader(System.in)); + in = stdinAwareReader(System.in); String commonName = "Unknown"; String organizationalUnit = "Unknown"; String organization = "Unknown"; @@ -4238,8 +4246,7 @@ private String getYesNoReply(String prompt) } System.err.print(prompt); System.err.flush(); - reply = (new BufferedReader(new InputStreamReader - (System.in))).readLine(); + reply = stdinAwareReader(System.in).readLine(); if (reply == null || collator.compare(reply, "") == 0 || collator.compare(reply, rb.getString("n")) == 0 || diff --git a/src/java.base/share/classes/sun/security/tools/keytool/resources/keytool_de.properties b/src/java.base/share/classes/sun/security/tools/keytool/resources/keytool_de.properties index 6290bb2a7ac..1c7a9cd17cf 100644 --- a/src/java.base/share/classes/sun/security/tools/keytool/resources/keytool_de.properties +++ b/src/java.base/share/classes/sun/security/tools/keytool/resources/keytool_de.properties @@ -27,7 +27,7 @@ NEWLINE=\n STAR=******************************************* STARNN=*******************************************\n\n # keytool: Help part -.OPTION.=\u0020[OPTION]... +.OPTION.=\ [OPTION]... Options.=Optionen: option.1.set.twice=Die Option %s wurde mehrmals angegeben. Alle Angaben bis auf die letzte werden ignoriert. multiple.commands.1.2=Nur ein Befehl ist zulässig: Sowohl %1$s als auch %2$s wurden angegeben. @@ -170,7 +170,7 @@ Certificate.reply.was.installed.in.keystore=Zertifikatsantwort wurde in Keystore Certificate.reply.was.not.installed.in.keystore=Zertifikatsantwort wurde nicht in Keystore installiert Certificate.was.added.to.keystore=Zertifikat wurde Keystore hinzugefügt Certificate.was.not.added.to.keystore=Zertifikat wurde nicht zu Keystore hinzugefügt -.Storing.ksfname.=[{0} wird gesichert] +.Storing.ksfname.=[{0} wird gespeichert] alias.has.no.public.key.certificate.={0} hat keinen Public Key (Zertifikat) Cannot.derive.signature.algorithm=Signaturalgorithmus kann nicht abgeleitet werden Alias.alias.does.not.exist=Alias <{0}> ist nicht vorhanden @@ -178,9 +178,9 @@ Alias.alias.has.no.certificate=Alias <{0}> hat kein Zertifikat groupname.keysize.coexist=Es können nicht sowohl -groupname als auch -keysize angegeben werden deprecate.keysize.for.ec=Das Angeben von -keysize zum Generieren von EC-Schlüsseln ist veraltet. Verwenden Sie stattdessen "-groupname %s". Key.pair.not.generated.alias.alias.already.exists=Schlüsselpaar wurde nicht generiert. Alias <{0}> ist bereits vorhanden -size.bit.alg=%1$d-Bit %2$s -Generating.full.keyAlgName.key.pair.and.self.signed.certificate.sigAlgName.with.a.validity.of.days.for=Schlüsselpaar {0} und selbstsigniertes Zertifikat ({1}) werden mit einer Gültigkeit von {2} Tagen generiert\n\tfür: {3} -Generating.full.keyAlgName.key.pair.and.a.certificate.sigAlgName.issued.by.signerAlias.with.a.validity.of.days.for=Schlüsselpaar {0} und Zertifikat ({1}) werden generiert, das von <{2}> mit einer Gültigkeit von {3} Tagen ausgestellt wurde\n\tfür: {4} +size.bit.alg=%1$d-Bit-%2$s +Generating.full.keyAlgName.key.pair.and.self.signed.certificate.sigAlgName.with.a.validity.of.days.for=Generieren von {0}-Schlüsselpaar und selbstsigniertem Zertifikat ({1}) mit einer Gültigkeit von {2} Tagen\n\tfür: {3} +Generating.full.keyAlgName.key.pair.and.a.certificate.sigAlgName.issued.by.signerAlias.with.a.validity.of.days.for=Generieren von {0}-Schlüsselpaar und einem von <{2}> ausgestellten Zertifikat ({1}) mit einer Gültigkeit von {3} Tagen\n\tfür: {4} Enter.key.password.for.alias.=Schlüsselkennwort für <{0}> eingeben .RETURN.if.same.as.keystore.password.=\t(RETURN, wenn identisch mit Keystore-Kennwort): \u0020 Key.password.is.too.short.must.be.at.least.6.characters=Schlüsselkennwort ist zu kurz. Es muss mindestens sechs Zeichen lang sein @@ -216,7 +216,7 @@ Do.you.still.want.to.add.it.no.=Möchten Sie es trotzdem hinzufügen? [Nein]: \u Certificate.already.exists.in.system.wide.CA.keystore.under.alias.trustalias.=Zertifikat ist bereits unter Alias <{0}> im systemweiten CA-Keystore vorhanden Do.you.still.want.to.add.it.to.your.own.keystore.no.=Möchten Sie es trotzdem zu Ihrem eigenen Keystore hinzufügen? [Nein]: \u0020 Trust.this.certificate.no.=Diesem Zertifikat vertrauen? [Nein]: \u0020 -New.prompt.=Neues {0}:\u0020 +New.prompt.={0} (neu):\u0020 Passwords.must.differ=Kennwörter müssen sich unterscheiden Re.enter.new.prompt.=Neues {0} erneut eingeben:\u0020 Re.enter.password.=Geben Sie das Kennwort erneut ein:\u0020 @@ -238,7 +238,7 @@ Is.name.correct.=Ist {0} richtig? no=Nein yes=Ja y=J -.defaultValue.=\u0020 [{0}]: \u0020 +.defaultValue.=\ [{0}]: \u0020 Alias.alias.has.no.key=Alias <{0}> verfügt über keinen Schlüssel Alias.alias.references.an.entry.type.that.is.not.a.private.key.entry.The.keyclone.command.only.supports.cloning.of.private.key=Alias <{0}> verweist auf einen Eintragstyp, der kein Private-Key-Eintrag ist. Der Befehl -keyclone unterstützt nur das Klonen von Private-Key-Einträgen @@ -302,8 +302,8 @@ alias.in.keystore=Aussteller <%s> with.weak=%s (schwach) with.disabled=%s (deaktiviert) key.bit=%s-Schlüssel -key.bit.weak=%s Schlüssel (schwach) -key.bit.disabled=%s Schlüssel (deaktiviert) +key.bit.weak=%s-Schlüssel (schwach) +key.bit.disabled=%s-Schlüssel (deaktiviert) .PATTERN.printX509Cert.with.weak=Eigentümer: {0}\nAussteller: {1}\nSeriennummer: {2}\nGültig von: {3} bis: {4}\nZertifikatsfingerprints:\n\t SHA1: {5}\n\t SHA256: {6}\nSignaturalgorithmusname: {7}\nPublic-Key-Algorithmus von Subject: {8}\nVersion: {9} PKCS.10.with.weak=PKCS #10-Zertifikatsanforderung (Version 1.0)\nSubject: %1$s\nFormat: %2$s\nPublic Key: %3$s\nSignaturalgorithmus: %4$s\n verified.by.s.in.s.weak=Von %1$s in %2$s mit %3$s verifiziert @@ -312,7 +312,7 @@ whose.sigalg.usagesignedjar=%1$s verwendet den Signaturalgorithmus %2$s. Das gil Unable.to.parse.denyAfter.string.in.exception.message=denyAfter-Datumszeichenfolge in Ausnahmemeldung kann nicht geparst werden whose.sigalg.weak=%1$s verwendet den Signaturalgorithmus %2$s. Dies gilt als Sicherheitsrisiko. whose.key.disabled=%1$s verwendet %2$s. Dies gilt als Sicherheitsrisiko und ist deaktiviert. -whose.key.weak=%1$s verwendet %2$s. Dies gilt als Sicherheitsrisiko. Wird in einem zukünftigen Update deaktiviert. +whose.key.weak=%1$s verwendet %2$s. Das gilt als Sicherheitsrisiko. Dieser Schlüssel wird in einem zukünftigen Update deaktiviert. jks.storetype.warning=Der %1$s-Keystore verwendet ein proprietäres Format. Es wird empfohlen, auf PKCS12 zu migrieren, das ein Industriestandardformat mit "keytool -importkeystore -srckeystore %2$s -destkeystore %2$s -deststoretype pkcs12" ist. migrate.keystore.warning="%1$s" zu %4$s migriert. Der %2$s-Keystore wurde als "%3$s" gesichert. backup.keystore.warning=Der ursprüngliche Keystore "%1$s" wird als "%3$s" gesichert... diff --git a/src/java.base/share/classes/sun/security/tools/keytool/resources/keytool_ja.properties b/src/java.base/share/classes/sun/security/tools/keytool/resources/keytool_ja.properties index 416cf51007f..63ba4f220dd 100644 --- a/src/java.base/share/classes/sun/security/tools/keytool/resources/keytool_ja.properties +++ b/src/java.base/share/classes/sun/security/tools/keytool/resources/keytool_ja.properties @@ -27,7 +27,7 @@ NEWLINE=\n STAR=******************************************* STARNN=*******************************************\n\n # keytool: Help part -.OPTION.=\u0020[OPTION]... +.OPTION.=\ [OPTION]... Options.=オプション: option.1.set.twice=%sオプションが複数回指定されています。最後のもの以外はすべて無視されます。 multiple.commands.1.2=1つのコマンドのみ許可されます: %1$sと%2$sの両方が指定されました。 @@ -178,9 +178,9 @@ Alias.alias.has.no.certificate=別名<{0}>には証明書がありません groupname.keysize.coexist=-groupnameと-keysizeの両方を指定できません deprecate.keysize.for.ec=-keysizeの指定によるECキーの生成は非推奨です。かわりに"-groupname %s"を使用してください。 Key.pair.not.generated.alias.alias.already.exists=キー・ペアは生成されませんでした。別名<{0}>はすでに存在します -size.bit.alg=%1$dビット%2$s -Generating.full.keyAlgName.key.pair.and.self.signed.certificate.sigAlgName.with.a.validity.of.days.for={0}キー・ペアおよび自己署名証明書({1})を{2}日の有効性で生成しています\n\t対象: {3} -Generating.full.keyAlgName.key.pair.and.a.certificate.sigAlgName.issued.by.signerAlias.with.a.validity.of.days.for={0}キー・ペアと<{2}>によって発行された証明書({1})を{3}日間の有効性で生成しています\n\t対象: {4} +size.bit.alg=%1$d-ビット %2$s +Generating.full.keyAlgName.key.pair.and.self.signed.certificate.sigAlgName.with.a.validity.of.days.for={2}日間有効な{0}のキー・ペアと自己署名型証明書({1})を生成しています\n\tディレクトリ名: {3} +Generating.full.keyAlgName.key.pair.and.a.certificate.sigAlgName.issued.by.signerAlias.with.a.validity.of.days.for={3}日間有効な{0}キー・ペアと<{2}>によって発行される証明書({1})を生成しています\n\tディレクトリ名: {4} Enter.key.password.for.alias.=<{0}>のキー・パスワードを入力してください .RETURN.if.same.as.keystore.password.=\t(キーストアのパスワードと同じ場合はRETURNを押してください): \u0020 Key.password.is.too.short.must.be.at.least.6.characters=キーのパスワードが短すぎます - 6文字以上を指定してください @@ -227,18 +227,18 @@ Enter.new.alias.name.RETURN.to.cancel.import.for.this.entry.=新しい別名を Enter.alias.name.=別名を入力してください: \u0020 .RETURN.if.same.as.for.otherAlias.=\t(<{0}>と同じ場合はRETURNを押してください) enter.dname.components=識別名を入力します。サブコンポーネントを空のままにする場合はドット(.)を1つ入力し、中カッコ内のデフォルト値を使用する場合は[ENTER]を押します。 -What.is.your.first.and.last.name.=姓名は何ですか。 -What.is.the.name.of.your.organizational.unit.=組織単位名は何ですか。 -What.is.the.name.of.your.organization.=組織名は何ですか。 -What.is.the.name.of.your.City.or.Locality.=都市名または地域名は何ですか。 -What.is.the.name.of.your.State.or.Province.=都道府県名または州名は何ですか。 -What.is.the.two.letter.country.code.for.this.unit.=この単位に該当する2文字の国コードは何ですか。 +What.is.your.first.and.last.name.=姓名を入力してください。 +What.is.the.name.of.your.organizational.unit.=組織単位名を入力してください。 +What.is.the.name.of.your.organization.=組織名を入力してください。 +What.is.the.name.of.your.City.or.Locality.=都市名または地域名を入力してください。 +What.is.the.name.of.your.State.or.Province.=都道府県名を入力してください。 +What.is.the.two.letter.country.code.for.this.unit.=この単位に該当する2文字の国コードを入力してください。 no.field.in.dname=少なくとも1つのフィールドを指定する必要があります。再度入力してください。 Is.name.correct.={0}でよろしいですか。 no=いいえ yes=はい y=y -.defaultValue.=\u0020 [{0}]: \u0020 +.defaultValue.=\ [{0}]: \u0020 Alias.alias.has.no.key=別名<{0}>にはキーがありません Alias.alias.references.an.entry.type.that.is.not.a.private.key.entry.The.keyclone.command.only.supports.cloning.of.private.key=別名<{0}>が参照しているエントリ・タイプは秘密キー・エントリではありません。-keycloneコマンドは秘密キー・エントリのクローン作成のみをサポートします @@ -292,7 +292,7 @@ the.certificate=証明書 the.crl=CRL the.tsa.certificate=TSA証明書 the.input=入力 -reply=応答 +reply=返信 one.in.many=%1$s #%2$d / %3$d one.in.many1=%1$s #%2$d one.in.many2=署名者の%1$s #%2$d @@ -302,7 +302,7 @@ alias.in.keystore=発行者<%s> with.weak=%s (弱) with.disabled=%s (無効) key.bit=%sキー -key.bit.weak=%sキー(弱い) +key.bit.weak=%sキー(弱) key.bit.disabled=%sキー(無効) .PATTERN.printX509Cert.with.weak=所有者: {0}\n発行者: {1}\nシリアル番号: {2}\n有効期間の開始日: {3}終了日: {4}\n証明書のフィンガプリント:\n\t SHA1: {5}\n\t SHA256: {6}\n署名アルゴリズム名: {7}\nサブジェクト公開キー・アルゴリズム: {8}\nバージョン: {9} PKCS.10.with.weak=PKCS #10証明書リクエスト(バージョン1.0)\nサブジェクト: %1$s\nフォーマット: %2$s\n公開キー: %3$s\n署名アルゴリズム: %4$s\n @@ -312,7 +312,7 @@ whose.sigalg.usagesignedjar=%1$sは%2$s署名アルゴリズムを使用して Unable.to.parse.denyAfter.string.in.exception.message=例外メッセージのdenyAfter日付文字列を解析できません whose.sigalg.weak=%1$sは%2$s署名アルゴリズムを使用しており、これはセキュリティ・リスクとみなされます。 whose.key.disabled=%1$sは%2$sを使用しており、これはセキュリティ・リスクとみなされ、無効化されています。 -whose.key.weak=%1$sは%2$sを使用しており、これはセキュリティ・リスクとみなされます。今後の更新では無効になります。 +whose.key.weak=%1$sは%2$sを使用しており、これはセキュリティ・リスクとみなされます。これは将来の更新で無効化されます。 jks.storetype.warning=%1$sキーストアは独自の形式を使用しています。"keytool -importkeystore -srckeystore %2$s -destkeystore %2$s -deststoretype pkcs12"を使用する業界標準の形式であるPKCS12に移行することをお薦めします。 migrate.keystore.warning="%1$s"が%4$sに移行されました。%2$sキーストアは"%3$s"としてバックアップされます。 backup.keystore.warning=元のキーストア"%1$s"は"%3$s"としてバックアップされます... diff --git a/src/java.base/share/classes/sun/security/tools/keytool/resources/keytool_zh_CN.properties b/src/java.base/share/classes/sun/security/tools/keytool/resources/keytool_zh_CN.properties index 5aa27eb2ed4..1f96aa12c57 100644 --- a/src/java.base/share/classes/sun/security/tools/keytool/resources/keytool_zh_CN.properties +++ b/src/java.base/share/classes/sun/security/tools/keytool/resources/keytool_zh_CN.properties @@ -27,13 +27,13 @@ NEWLINE=\n STAR=******************************************* STARNN=*******************************************\n\n # keytool: Help part -.OPTION.=\u0020[OPTION]... -Options.=选项: +.OPTION.=\ [OPTION]... +Options.=选项: option.1.set.twice=多次指定了 %s 选项。除最后一个之外, 其余的将全部忽略。 multiple.commands.1.2=只允许一个命令: 同时指定了 %1$s 和 %2$s。 Use.keytool.help.for.all.available.commands=使用 "keytool -?, -h, or --help" 可输出此帮助消息 Key.and.Certificate.Management.Tool=密钥和证书管理工具 -Commands.=命令: +Commands.=命令: Use.keytool.command.name.help.for.usage.of.command.name=使用 "keytool -command_name --help" 可获取 command_name 的用法。\n使用 -conf 选项可指定预配置的选项文件。 # keytool: help: commands Generates.a.certificate.request=生成证书请求 @@ -114,7 +114,7 @@ verbose.output=详细输出 validity.number.of.days=有效天数 Serial.ID.of.cert.to.revoke=要撤销的证书的序列 ID # keytool: Running part -keytool.error.=keytool 错误:\u0020 +keytool.error.=keytool 错误:\u0020 Illegal.option.=非法选项: \u0020 Illegal.value.=非法值:\u0020 Unknown.password.type.=未知口令类型:\u0020 @@ -170,7 +170,7 @@ Certificate.reply.was.installed.in.keystore=证书回复已安装在密钥库中 Certificate.reply.was.not.installed.in.keystore=证书回复未安装在密钥库中 Certificate.was.added.to.keystore=证书已添加到密钥库中 Certificate.was.not.added.to.keystore=证书未添加到密钥库中 -.Storing.ksfname.=[正在存储{0}] +.Storing.ksfname.=[正在存储 {0}] alias.has.no.public.key.certificate.={0}没有公共密钥 (证书) Cannot.derive.signature.algorithm=无法派生签名算法 Alias.alias.does.not.exist=别名 <{0}> 不存在 @@ -179,8 +179,8 @@ groupname.keysize.coexist=无法同时指定 -groupname 和 -keysize deprecate.keysize.for.ec=为生成 EC 密钥指定 -keysize 已过时,请改为使用 "-groupname %s"。 Key.pair.not.generated.alias.alias.already.exists=未生成密钥对, 别名 <{0}> 已经存在 size.bit.alg=%1$d 位 %2$s -Generating.full.keyAlgName.key.pair.and.self.signed.certificate.sigAlgName.with.a.validity.of.days.for=正在为 {3} 生成有效期为 {2} 天的 {0} 密钥对和自签名证书 ({1})\n -Generating.full.keyAlgName.key.pair.and.a.certificate.sigAlgName.issued.by.signerAlias.with.a.validity.of.days.for=生成 {0} 密钥对和 <{2}> 颁发的证书 ({1}),有效期为 {3} 天 \n\t 对于:{4} +Generating.full.keyAlgName.key.pair.and.self.signed.certificate.sigAlgName.with.a.validity.of.days.for=正在为以下对象生成 {0} 密钥对和自签名证书 ({1})(有效期为 {2} 天):\n\t{3} +Generating.full.keyAlgName.key.pair.and.a.certificate.sigAlgName.issued.by.signerAlias.with.a.validity.of.days.for=正在为以下对象生成 {0} 密钥对和由 <{2}> 颁发的证书 ({1})(有效期为 {3} 天):\n\t{4} Enter.key.password.for.alias.=输入 <{0}> 的密钥口令 .RETURN.if.same.as.keystore.password.=\t(如果和密钥库口令相同, 按回车): \u0020 Key.password.is.too.short.must.be.at.least.6.characters=密钥口令太短 - 至少必须为 6 个字符 @@ -216,7 +216,7 @@ Do.you.still.want.to.add.it.no.=是否仍要添加? [否]: \u0020 Certificate.already.exists.in.system.wide.CA.keystore.under.alias.trustalias.=在别名 <{0}> 之下, 证书已经存在于系统范围的 CA 密钥库中 Do.you.still.want.to.add.it.to.your.own.keystore.no.=是否仍要将它添加到自己的密钥库? [否]: \u0020 Trust.this.certificate.no.=是否信任此证书? [否]: \u0020 -New.prompt.=新{0}:\u0020 +New.prompt.=新 {0}:\u0020 Passwords.must.differ=口令不能相同 Re.enter.new.prompt.=重新输入新{0}:\u0020 Re.enter.password.=再次输入口令:\u0020 @@ -238,14 +238,14 @@ Is.name.correct.={0}是否正确? no=否 yes=是 y=y -.defaultValue.=\u0020 [{0}]: \u0020 +.defaultValue.=\ [{0}]: \u0020 Alias.alias.has.no.key=别名 <{0}> 没有密钥 Alias.alias.references.an.entry.type.that.is.not.a.private.key.entry.The.keyclone.command.only.supports.cloning.of.private.key=别名 <{0}> 引用了不属于私有密钥条目的条目类型。-keyclone 命令仅支持对私有密钥条目的克隆 .WARNING.WARNING.WARNING.=***************** WARNING WARNING WARNING ***************** -Signer.d.=签名者 #%d: +Signer.d.=签名者 #%d: Certificate.d.=证书 #%d: -Timestamp.=时间戳: +Timestamp.=时间戳: Certificate.owner.=证书所有者:\u0020 Not.a.signed.jar.file=不是已签名的 jar 文件 No.certificate.from.the.SSL.server=没有来自 SSL 服务器的证书 @@ -256,7 +256,7 @@ No.certificate.from.the.SSL.server=没有来自 SSL 服务器的证书 Certificate.reply.does.not.contain.public.key.for.alias.=证书回复中不包含 <{0}> 的公共密钥 Incomplete.certificate.chain.in.reply=回复中的证书链不完整 Top.level.certificate.in.reply.=回复中的顶级证书:\n -.is.not.trusted.=... 是不可信的。 +.is.not.trusted.=... 是不可信的。\u0020 Install.reply.anyway.no.=是否仍要安装回复? [否]: \u0020 Public.keys.in.reply.and.keystore.don.t.match=回复中的公共密钥与密钥库不匹配 Certificate.reply.and.certificate.in.keystore.are.identical=证书回复与密钥库中的证书是相同的 @@ -269,14 +269,14 @@ Please.provide.keysize.for.secret.key.generation=请提供 -keysize 以生成密 warning.not.verified.make.sure.keystore.is.correct=警告: 未验证。请确保密钥库是正确的。 warning.not.verified.make.sure.keystore.is.correct.or.specify.trustcacerts=警告:未验证。请确保密钥库是正确的,或者指定 -trustcacerts。 -Extensions.=扩展:\u0020 +Extensions.=扩展:\u0020 .Empty.value.=(空值) Extension.Request.=扩展请求: Unknown.keyUsage.type.=未知 keyUsage 类型:\u0020 Unknown.extendedkeyUsage.type.=未知 extendedkeyUsage 类型:\u0020 Unknown.AccessDescription.type.=未知 AccessDescription 类型:\u0020 Unrecognized.GeneralName.type.=无法识别的 GeneralName 类型:\u0020 -This.extension.cannot.be.marked.as.critical.=无法将此扩展标记为“严重”。 +This.extension.cannot.be.marked.as.critical.=无法将此扩展标记为“严重”。\u0020 Odd.number.of.hex.digits.found.=找到奇数个十六进制数字:\u0020 Unknown.extension.type.=未知扩展类型:\u0020 command.{0}.is.ambiguous.=命令{0}不明确: @@ -299,11 +299,11 @@ one.in.many2=签名者 #%2$d 的 %1$s one.in.many3=签名者 #%3$d 的 %1$s #%2$d alias.in.cacerts=cacerts 中的发布者 <%s> alias.in.keystore=发布者 <%s> -with.weak=%s (弱) +with.weak=%s(弱) with.disabled=%s(禁用) key.bit=%s 密钥 key.bit.weak=%s 密钥(弱) -key.bit.disabled=%s 密钥(已禁用) +key.bit.disabled=%s 密钥(禁用) .PATTERN.printX509Cert.with.weak=所有者: {0}\n发布者: {1}\n序列号: {2}\n生效时间: {3}, 失效时间: {4}\n证书指纹:\n\t SHA1: {5}\n\t SHA256: {6}\n签名算法名称: {7}\n主体公共密钥算法: {8}\n版本: {9} PKCS.10.with.weak=PKCS #10 证书请求 (版本 1.0)\n主体: %1$s\n格式: %2$s\n公共密钥: %3$s\n签名算法: %4$s\n verified.by.s.in.s.weak=由 %2$s 中的 %1$s 以 %3$s 验证 @@ -312,7 +312,7 @@ whose.sigalg.usagesignedjar=%1$s 使用的 %2$s 签名算法被视为存在安 Unable.to.parse.denyAfter.string.in.exception.message=无法解析异常错误消息中的 denyAfter 日期字符串 whose.sigalg.weak=%1$s 使用的 %2$s 签名算法存在安全风险。 whose.key.disabled=%1$s 使用的 %2$s 被视为存在安全风险而且被禁用。 -whose.key.weak=%1$s 使用的 %2$s 被视为存在安全风险。在将来的更新中将禁用它。 +whose.key.weak=%1$s 使用的 %2$s 被视为存在安全风险。它将在未来的更新中被禁用。 jks.storetype.warning=%1$s 密钥库使用专用格式。建议使用 "keytool -importkeystore -srckeystore %2$s -destkeystore %2$s -deststoretype pkcs12" 迁移到行业标准格式 PKCS12。 migrate.keystore.warning=已将 "%1$s" 迁移到 %4$s。将 %2$s 密钥库作为 "%3$s" 进行了备份。 backup.keystore.warning=已将原始密钥库 "%1$s" 备份为 "%3$s"... diff --git a/src/java.base/share/classes/sun/security/util/ConsoleCallbackHandler.java b/src/java.base/share/classes/sun/security/util/ConsoleCallbackHandler.java index 83ac503b460..725a78c39c8 100644 --- a/src/java.base/share/classes/sun/security/util/ConsoleCallbackHandler.java +++ b/src/java.base/share/classes/sun/security/util/ConsoleCallbackHandler.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2025, 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 @@ -25,6 +25,8 @@ package sun.security.util; +import jdk.internal.util.StaticProperty; + import javax.security.auth.callback.Callback; import javax.security.auth.callback.CallbackHandler; import javax.security.auth.callback.ConfirmationCallback; @@ -36,6 +38,7 @@ import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; +import java.nio.charset.Charset; /** * A {@code CallbackHandler} that prompts and reads from the command line @@ -130,8 +133,9 @@ public void handle(Callback[] callbacks) /* Reads a line of input */ private String readLine() throws IOException { - String result = new BufferedReader - (new InputStreamReader(System.in)).readLine(); + Charset charset = Charset.forName(StaticProperty.stdinEncoding(), Charset.defaultCharset()); + InputStreamReader reader = new InputStreamReader(System.in, charset); + String result = new BufferedReader(reader).readLine(); if (result == null) { throw new IOException("Cannot read from System.in"); } diff --git a/src/java.base/share/classes/sun/security/util/resources/auth_zh_CN.properties b/src/java.base/share/classes/sun/security/util/resources/auth_zh_CN.properties index 6d677804544..663b3f8993f 100644 --- a/src/java.base/share/classes/sun/security/util/resources/auth_zh_CN.properties +++ b/src/java.base/share/classes/sun/security/util/resources/auth_zh_CN.properties @@ -24,22 +24,22 @@ # # NT principals -invalid.null.input.value=无效的空输入: {0} -NTDomainPrincipal.name=NTDomainPrincipal: {0} -NTNumericCredential.name=NTNumericCredential: {0} +invalid.null.input.value=无效的空输入:{0} +NTDomainPrincipal.name=NTDomainPrincipal:{0} +NTNumericCredential.name=NTNumericCredential:{0} Invalid.NTSid.value=无效的 NTSid 值 -NTSid.name=NTSid: {0} -NTSidDomainPrincipal.name=NTSidDomainPrincipal: {0} -NTSidGroupPrincipal.name=NTSidGroupPrincipal: {0} -NTSidPrimaryGroupPrincipal.name=NTSidPrimaryGroupPrincipal: {0} -NTSidUserPrincipal.name=NTSidUserPrincipal: {0} -NTUserPrincipal.name=NTUserPrincipal: {0} +NTSid.name=NTSid:{0} +NTSidDomainPrincipal.name=NTSidDomainPrincipal:{0} +NTSidGroupPrincipal.name=NTSidGroupPrincipal:{0} +NTSidPrimaryGroupPrincipal.name=NTSidPrimaryGroupPrincipal:{0} +NTSidUserPrincipal.name=NTSidUserPrincipal:{0} +NTUserPrincipal.name=NTUserPrincipal:{0} # UnixPrincipals -UnixNumericGroupPrincipal.Primary.Group.name=UnixNumericGroupPrincipal [主组]: {0} +UnixNumericGroupPrincipal.Primary.Group.name=UnixNumericGroupPrincipal [主组]:{0} UnixNumericGroupPrincipal.Supplementary.Group.name=UnixNumericGroupPrincipal [补充组]: {0} -UnixNumericUserPrincipal.name=UnixNumericUserPrincipal: {0} -UnixPrincipal.name=UnixPrincipal: {0} +UnixNumericUserPrincipal.name=UnixNumericUserPrincipal:{0} +UnixPrincipal.name=UnixPrincipal:{0} # com.sun.security.auth.login.ConfigFile Unable.to.properly.expand.config=无法正确扩展{0} @@ -53,8 +53,8 @@ Configuration.Error.Line.line.expected.expect.=配置错误: \n\t行 {0}: 应为 Configuration.Error.Line.line.system.property.value.expanded.to.empty.value=配置错误: \n\t行 {0}: 系统属性 [{1}] 扩展到空值 # com.sun.security.auth.module.JndiLoginModule -username.=用户名:\u0020 -password.=口令:\u0020 +username.=用户名:\u0020 +password.=密码:\u0020 # com.sun.security.auth.module.KeyStoreLoginModule Please.enter.keystore.information=请输入密钥库信息 @@ -63,5 +63,5 @@ Keystore.password.=密钥库口令:\u0020 Private.key.password.optional.=私有密钥口令 (可选):\u0020 # com.sun.security.auth.module.Krb5LoginModule -Kerberos.username.defUsername.=Kerberos 用户名 [{0}]:\u0020 -Kerberos.password.for.username.={0}的 Kerberos 口令:\u0020 +Kerberos.username.defUsername.=Kerberos 用户名 [{0}]:\u0020 +Kerberos.password.for.username.={0} 的 Kerberos 密码:\u0020 diff --git a/src/java.base/share/classes/sun/security/util/resources/security_ja.properties b/src/java.base/share/classes/sun/security/util/resources/security_ja.properties index b9ec0a82cb9..ff13b37cf3b 100644 --- a/src/java.base/share/classes/sun/security/util/resources/security_ja.properties +++ b/src/java.base/share/classes/sun/security/util/resources/security_ja.properties @@ -66,7 +66,7 @@ Login.Failure.all.modules.ignored=ログイン失敗: すべてのモジュー # sun.security.provider.PolicyParser duplicate.keystore.domain.name=重複するキーストア・ドメイン名: {0} duplicate.keystore.name=重複するキーストア名: {0} -number.=数\u0020 +number.=数値\u0020 expected.expect.read.end.of.file.=[{0}]ではなく[ファイルの終わり]が読み込まれました expected.read.end.of.file.=[;]ではなく[ファイルの終わり]が読み込まれました line.number.msg=行{0}: {1} diff --git a/src/java.base/share/classes/sun/security/util/resources/security_zh_CN.properties b/src/java.base/share/classes/sun/security/util/resources/security_zh_CN.properties index 0653fbdca52..6a4ec11de77 100644 --- a/src/java.base/share/classes/sun/security/util/resources/security_zh_CN.properties +++ b/src/java.base/share/classes/sun/security/util/resources/security_zh_CN.properties @@ -43,17 +43,17 @@ provided.null.OID.map=提供的 OID 映射为空值 NEWLINE=\n invalid.null.action.provided=提供了无效的空操作 invalid.null.Class.provided=提供了无效的空类 -Subject.=主体: \n -.Principal.=\t主用户:\u0020 -.Public.Credential.=\t公共身份证明:\u0020 -.Private.Credential.=\t专用身份证明:\u0020 +Subject.=主体:\n +.Principal.=\t主用户:\u0020 +.Public.Credential.=\t公共身份证明:\u0020 +.Private.Credential.=\t专用身份证明:\u0020 .Private.Credential.inaccessible.=\t无法访问专用身份证明\n Subject.is.read.only=主体为只读 attempting.to.add.an.object.which.is.not.an.instance.of.java.security.Principal.to.a.Subject.s.Principal.Set=正在尝试将一个非 java.security.Principal 实例的对象添加到主体的主用户集中 attempting.to.add.an.object.which.is.not.an.instance.of.class=正在尝试添加一个非{0}实例的对象 # javax.security.auth.login.AppConfigurationEntry -LoginModuleControlFlag.=LoginModuleControlFlag:\u0020 +LoginModuleControlFlag.=LoginModuleControlFlag:\u0020 # javax.security.auth.login.LoginContext Invalid.null.input.name=无效空输入: 名称 @@ -69,8 +69,8 @@ duplicate.keystore.name=密钥库名称重复: {0} number.=编号\u0020 expected.expect.read.end.of.file.=应为 [{0}], 读取的是 [文件结尾] expected.read.end.of.file.=应为 [;], 读取的是 [文件结尾] -line.number.msg=列{0}: {1} +line.number.msg=第 {0} 行:{1} line.number.expected.expect.found.actual.=行号 {0}: 应为 [{1}], 找到 [{2}] # sun.security.pkcs11.SunPKCS11 -PKCS11.Token.providerName.Password.=PKCS11 标记 [{0}] 口令:\u0020 +PKCS11.Token.providerName.Password.=PKCS11 标记 [{0}] 密码:\u0020 diff --git a/src/java.base/share/classes/sun/text/resources/FormatData.java b/src/java.base/share/classes/sun/text/resources/FormatData.java index f90317ee69f..541cb63fff9 100644 --- a/src/java.base/share/classes/sun/text/resources/FormatData.java +++ b/src/java.base/share/classes/sun/text/resources/FormatData.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1996, 2019, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1996, 2025, 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 @@ -23,9 +23,6 @@ * questions. */ -/* - */ - /* * (C) Copyright Taligent, Inc. 1996, 1997 - All Rights Reserved * (C) Copyright IBM Corp. 1996 - 1999 - All Rights Reserved @@ -79,11 +76,11 @@ package sun.text.resources; -import sun.util.resources.ParallelListResourceBundle; +import sun.util.resources.OpenListResourceBundle; -public class FormatData extends ParallelListResourceBundle { +public class FormatData extends OpenListResourceBundle { /** - * Overrides ListResourceBundle + * Overrides OpenListResourceBundle */ @Override protected final Object[][] getContents() { @@ -119,6 +116,109 @@ protected final Object[][] getContents() { "Reiwa", }; + // Moved from JavaTimeSupplementary + final String[] sharedQuarterNames = { + "Q1", + "Q2", + "Q3", + "Q4", + }; + + final String[] sharedQuarterNarrows = { + "1", + "2", + "3", + "4", + }; + + final String[] sharedDatePatterns = { + "GGGG y MMMM d, EEEE", + "GGGG y MMMM d", + "GGGG y MMM d", + "G y-MM-dd", + }; + + final String[] sharedDayAbbrs = { + "Sun", + "Mon", + "Tue", + "Wed", + "Thu", + "Fri", + "Sat", + }; + + final String[] sharedDayNarrows = { + "S", + "M", + "T", + "W", + "T", + "F", + "S", + }; + + final String[] sharedEras = { + "", + "AH", + }; + + final String[] sharedMonthNarrows = { + "1", + "2", + "3", + "4", + "5", + "6", + "7", + "8", + "9", + "10", + "11", + "12", + "", + }; + + final String[] sharedTimePatterns = { + "HH:mm:ss zzzz", + "HH:mm:ss z", + "HH:mm:ss", + "HH:mm", + }; + + final String[] sharedAmPmMarkers = { + "AM", + "PM", + }; + + final String[] sharedJavaTimeDatePatterns = { + "G y MMMM d, EEEE", + "G y MMMM d", + "G y MMM d", + "GGGGG y-MM-dd", + }; + + final String[] sharedShortEras = { + "Before R.O.C.", + "R.O.C.", + }; + + final String[] sharedMonthAbbrs = { + "Jan", + "Feb", + "Mar", + "Apr", + "May", + "Jun", + "Jul", + "Aug", + "Sep", + "Oct", + "Nov", + "Dec", + "", + }; + return new Object[][] { { "MonthNames", new String[] { @@ -138,39 +238,9 @@ protected final Object[][] getContents() { } }, { "MonthAbbreviations", - new String[] { - "Jan", // abb january - "Feb", // abb february - "Mar", // abb march - "Apr", // abb april - "May", // abb may - "Jun", // abb june - "Jul", // abb july - "Aug", // abb august - "Sep", // abb september - "Oct", // abb october - "Nov", // abb november - "Dec", // abb december - "" // abb month 13 if applicable - } - }, + sharedMonthAbbrs }, { "MonthNarrows", - new String[] { - "1", - "2", - "3", - "4", - "5", - "6", - "7", - "8", - "9", - "10", - "11", - "12", - "", - } - }, + sharedMonthNarrows }, { "DayNames", new String[] { "Sunday", // Sunday @@ -183,33 +253,11 @@ protected final Object[][] getContents() { } }, { "DayAbbreviations", - new String[] { - "Sun", // abb Sunday - "Mon", // abb Monday - "Tue", // abb Tuesday - "Wed", // abb Wednesday - "Thu", // abb Thursday - "Fri", // abb Friday - "Sat" // abb Saturday - } - }, + sharedDayAbbrs }, { "DayNarrows", - new String[] { - "S", - "M", - "T", - "W", - "T", - "F", - "S", - } - }, + sharedDayNarrows }, { "AmPmMarkers", - new String[] { - "AM", // am marker - "PM" // pm marker - } - }, + sharedAmPmMarkers }, { "narrow.AmPmMarkers", new String[] { "a", // am marker @@ -227,22 +275,17 @@ protected final Object[][] getContents() { } }, { "buddhist.Eras", - buddhistEras - }, + buddhistEras }, { "buddhist.short.Eras", - buddhistEras - }, + buddhistEras }, { "buddhist.narrow.Eras", - buddhistEras - }, + buddhistEras }, { "japanese.Eras", japaneseEras }, { "japanese.short.Eras", - japaneseEraAbbrs - }, + japaneseEraAbbrs }, { "japanese.narrow.Eras", - japaneseEraAbbrs - }, + japaneseEraAbbrs }, { "japanese.FirstYear", new String[] { // Japanese imperial calendar year name // empty in English @@ -898,6 +941,164 @@ protected final Object[][] getContents() { } }, { "DateTimePatternChars", "GyMdkHmsSEDFwWahKzZ" }, + + // Moved from JavaTimeSupplementary + { "QuarterAbbreviations", + sharedQuarterNames }, + { "QuarterNames", + sharedQuarterNames }, + { "QuarterNarrows", + sharedQuarterNarrows }, + { "field.dayperiod", + "Dayperiod" }, + { "field.era", + "Era" }, + { "field.hour", + "Hour" }, + { "field.minute", + "Minute" }, + { "field.month", + "Month" }, + { "field.second", + "Second" }, + { "field.week", + "Week" }, + { "field.weekday", + "Day of the Week" }, + { "field.year", + "Year" }, + { "field.zone", + "Zone" }, + { "islamic.DatePatterns", + sharedDatePatterns }, + { "islamic.DayAbbreviations", + sharedDayAbbrs }, + { "islamic.DayNames", + sharedDayAbbrs }, + { "islamic.DayNarrows", + sharedDayNarrows }, + { "islamic.Eras", + sharedEras }, + { "islamic.MonthAbbreviations", + new String[] { + "Muh.", + "Saf.", + "Rab. I", + "Rab. II", + "Jum. I", + "Jum. II", + "Raj.", + "Sha.", + "Ram.", + "Shaw.", + "Dhuʻl-Q.", + "Dhuʻl-H.", + "", + } + }, + { "islamic.MonthNames", + new String[] { + "Muharram", + "Safar", + "Rabiʻ I", + "Rabiʻ II", + "Jumada I", + "Jumada II", + "Rajab", + "Shaʻban", + "Ramadan", + "Shawwal", + "Dhuʻl-Qiʻdah", + "Dhuʻl-Hijjah", + "", + } + }, + { "islamic.MonthNarrows", + sharedMonthNarrows }, + { "islamic.QuarterNames", + sharedQuarterNames }, + { "islamic.QuarterNarrows", + sharedQuarterNarrows }, + { "islamic.TimePatterns", + sharedTimePatterns }, + { "islamic.abbreviated.AmPmMarkers", + sharedAmPmMarkers }, + { "islamic.long.Eras", + sharedEras }, + { "islamic.narrow.Eras", + sharedEras }, + { "islamic.short.Eras", + sharedEras }, + { "java.time.buddhist.DatePatterns", + sharedJavaTimeDatePatterns }, + { "java.time.buddhist.long.Eras", + new String[] { + "BC", + "BE", + } + }, + { "java.time.buddhist.short.Eras", + buddhistEras }, + { "java.time.islamic.DatePatterns", + sharedJavaTimeDatePatterns }, + { "java.time.japanese.DatePatterns", + new String[] { + "G y MMMM d (EEEE)", + "G y MMMM d", + "G y MMM d", + "GGGGGy.MM.dd", + } + }, + { "java.time.japanese.long.Eras", + japaneseEras }, + { "java.time.japanese.short.Eras", + japaneseEras }, + { "java.time.long.Eras", + new String[] { + "BCE", + "CE", + } + }, + { "java.time.roc.DatePatterns", + sharedJavaTimeDatePatterns }, + { "java.time.short.Eras", + julianEras }, + { "roc.AmPmMarkers", + sharedAmPmMarkers }, + { "roc.DatePatterns", + sharedDatePatterns }, + { "roc.DayNames", + sharedDayAbbrs }, + { "roc.DayNarrows", + sharedDayNarrows }, + { "roc.Eras", + sharedShortEras }, + { "roc.MonthAbbreviations", + sharedMonthAbbrs }, + { "roc.MonthNames", + sharedMonthAbbrs }, + { "roc.MonthNarrows", + sharedMonthNarrows }, + { "roc.QuarterNames", + sharedQuarterNames }, + { "roc.QuarterNarrows", + sharedQuarterNarrows }, + { "roc.TimePatterns", + sharedTimePatterns }, + { "roc.abbreviated.AmPmMarkers", + sharedAmPmMarkers }, + { "roc.long.Eras", + sharedShortEras }, + { "roc.narrow.AmPmMarkers", + sharedAmPmMarkers }, + { "roc.narrow.Eras", + sharedShortEras }, + { "roc.short.Eras", + sharedShortEras }, + { "timezone.gmtFormat", + "GMT{0}" }, + { "timezone.hourFormat", + "+HH:mm;-HH:mm" }, }; } } diff --git a/src/java.base/share/classes/sun/text/resources/JavaTimeSupplementary.java b/src/java.base/share/classes/sun/text/resources/JavaTimeSupplementary.java deleted file mode 100644 index cbcb724d258..00000000000 --- a/src/java.base/share/classes/sun/text/resources/JavaTimeSupplementary.java +++ /dev/null @@ -1,353 +0,0 @@ -/* - * Copyright (c) 2013, 2019, 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. - */ - -/* - * COPYRIGHT AND PERMISSION NOTICE - * - * Copyright (C) 1991-2016 Unicode, Inc. All rights reserved. - * Distributed under the Terms of Use in - * http://www.unicode.org/copyright.html. - * - * Permission is hereby granted, free of charge, to any person obtaining - * a copy of the Unicode data files and any associated documentation - * (the "Data Files") or Unicode software and any associated documentation - * (the "Software") to deal in the Data Files or Software - * without restriction, including without limitation the rights to use, - * copy, modify, merge, publish, distribute, and/or sell copies of - * the Data Files or Software, and to permit persons to whom the Data Files - * or Software are furnished to do so, provided that - * (a) this copyright and permission notice appear with all copies - * of the Data Files or Software, - * (b) this copyright and permission notice appear in associated - * documentation, and - * (c) there is clear notice in each modified Data File or in the Software - * as well as in the documentation associated with the Data File(s) or - * Software that the data or software has been modified. - * - * THE DATA FILES AND SOFTWARE ARE PROVIDED "AS IS", WITHOUT WARRANTY OF - * ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE - * WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND - * NONINFRINGEMENT OF THIRD PARTY RIGHTS. - * IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS INCLUDED IN THIS - * NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT OR CONSEQUENTIAL - * DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, - * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER - * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR - * PERFORMANCE OF THE DATA FILES OR SOFTWARE. - * - * Except as contained in this notice, the name of a copyright holder - * shall not be used in advertising or otherwise to promote the sale, - * use or other dealings in these Data Files or Software without prior - * written authorization of the copyright holder. - */ - -// Note: this file has been generated by a tool. - -package sun.text.resources; - -import sun.util.resources.OpenListResourceBundle; - -public class JavaTimeSupplementary extends OpenListResourceBundle { - @Override - protected final Object[][] getContents() { - final String[] sharedQuarterNames = { - "Q1", - "Q2", - "Q3", - "Q4", - }; - - final String[] sharedQuarterNarrows = { - "1", - "2", - "3", - "4", - }; - - final String[] sharedDatePatterns = { - "GGGG y MMMM d, EEEE", - "GGGG y MMMM d", - "GGGG y MMM d", - "G y-MM-dd", - }; - - final String[] sharedDayNames = { - "Sun", - "Mon", - "Tue", - "Wed", - "Thu", - "Fri", - "Sat", - }; - - final String[] sharedDayNarrows = { - "S", - "M", - "T", - "W", - "T", - "F", - "S", - }; - - final String[] sharedEras = { - "", - "AH", - }; - - final String[] sharedMonthNarrows = { - "1", - "2", - "3", - "4", - "5", - "6", - "7", - "8", - "9", - "10", - "11", - "12", - "", - }; - - final String[] sharedTimePatterns = { - "HH:mm:ss zzzz", - "HH:mm:ss z", - "HH:mm:ss", - "HH:mm", - }; - - final String[] sharedAmPmMarkers = { - "AM", - "PM", - }; - - final String[] sharedJavaTimeDatePatterns = { - "G y MMMM d, EEEE", - "G y MMMM d", - "G y MMM d", - "GGGGG y-MM-dd", - }; - - final String[] sharedJavaTimeLongEras = { - "", - "Meiji", - "Taisho", - "Showa", - "Heisei", - "Reiwa", - }; - - final String[] sharedShortEras = { - "Before R.O.C.", - "R.O.C.", - }; - - final String[] sharedMonthNames = { - "Jan", - "Feb", - "Mar", - "Apr", - "May", - "Jun", - "Jul", - "Aug", - "Sep", - "Oct", - "Nov", - "Dec", - "", - }; - - return new Object[][] { - { "QuarterAbbreviations", - sharedQuarterNames }, - { "QuarterNames", - sharedQuarterNames }, - { "QuarterNarrows", - sharedQuarterNarrows }, - { "field.dayperiod", - "Dayperiod" }, - { "field.era", - "Era" }, - { "field.hour", - "Hour" }, - { "field.minute", - "Minute" }, - { "field.month", - "Month" }, - { "field.second", - "Second" }, - { "field.week", - "Week" }, - { "field.weekday", - "Day of the Week" }, - { "field.year", - "Year" }, - { "field.zone", - "Zone" }, - { "islamic.DatePatterns", - sharedDatePatterns }, - { "islamic.DayAbbreviations", - sharedDayNames }, - { "islamic.DayNames", - sharedDayNames }, - { "islamic.DayNarrows", - sharedDayNarrows }, - { "islamic.Eras", - sharedEras }, - { "islamic.MonthAbbreviations", - new String[] { - "Muh.", - "Saf.", - "Rab. I", - "Rab. II", - "Jum. I", - "Jum. II", - "Raj.", - "Sha.", - "Ram.", - "Shaw.", - "Dhuʻl-Q.", - "Dhuʻl-H.", - "", - } - }, - { "islamic.MonthNames", - new String[] { - "Muharram", - "Safar", - "Rabiʻ I", - "Rabiʻ II", - "Jumada I", - "Jumada II", - "Rajab", - "Shaʻban", - "Ramadan", - "Shawwal", - "Dhuʻl-Qiʻdah", - "Dhuʻl-Hijjah", - "", - } - }, - { "islamic.MonthNarrows", - sharedMonthNarrows }, - { "islamic.QuarterNames", - sharedQuarterNames }, - { "islamic.QuarterNarrows", - sharedQuarterNarrows }, - { "islamic.TimePatterns", - sharedTimePatterns }, - { "islamic.abbreviated.AmPmMarkers", - sharedAmPmMarkers }, - { "islamic.long.Eras", - sharedEras }, - { "islamic.narrow.Eras", - sharedEras }, - { "islamic.short.Eras", - sharedEras }, - { "java.time.buddhist.DatePatterns", - sharedJavaTimeDatePatterns }, - { "java.time.buddhist.long.Eras", - new String[] { - "BC", - "BE", - } - }, - { "java.time.buddhist.short.Eras", - new String[] { - "BC", - "B.E.", - } - }, - { "java.time.islamic.DatePatterns", - sharedJavaTimeDatePatterns }, - { "java.time.japanese.DatePatterns", - new String[] { - "G y MMMM d (EEEE)", - "G y MMMM d", - "G y MMM d", - "GGGGGy.MM.dd", - } - }, - { "java.time.japanese.long.Eras", - sharedJavaTimeLongEras }, - { "java.time.japanese.short.Eras", - sharedJavaTimeLongEras }, - { "java.time.long.Eras", - new String[] { - "BCE", - "CE", - } - }, - { "java.time.roc.DatePatterns", - sharedJavaTimeDatePatterns }, - { "java.time.short.Eras", - new String[] { - "BC", - "AD", - } - }, - { "roc.AmPmMarkers", - sharedAmPmMarkers }, - { "roc.DatePatterns", - sharedDatePatterns }, - { "roc.DayNames", - sharedDayNames }, - { "roc.DayNarrows", - sharedDayNarrows }, - { "roc.Eras", - sharedShortEras }, - { "roc.MonthAbbreviations", - sharedMonthNames }, - { "roc.MonthNames", - sharedMonthNames }, - { "roc.MonthNarrows", - sharedMonthNarrows }, - { "roc.QuarterNames", - sharedQuarterNames }, - { "roc.QuarterNarrows", - sharedQuarterNarrows }, - { "roc.TimePatterns", - sharedTimePatterns }, - { "roc.abbreviated.AmPmMarkers", - sharedAmPmMarkers }, - { "roc.long.Eras", - sharedShortEras }, - { "roc.narrow.AmPmMarkers", - sharedAmPmMarkers }, - { "roc.narrow.Eras", - sharedShortEras }, - { "roc.short.Eras", - sharedShortEras }, - { "timezone.gmtFormat", - "GMT{0}" }, - { "timezone.hourFormat", - "+HH:mm;-HH:mm" }, - }; - } -} diff --git a/src/java.base/share/classes/sun/util/locale/provider/LocaleResources.java b/src/java.base/share/classes/sun/util/locale/provider/LocaleResources.java index 4ae0275fdda..c539f57141e 100644 --- a/src/java.base/share/classes/sun/util/locale/provider/LocaleResources.java +++ b/src/java.base/share/classes/sun/util/locale/provider/LocaleResources.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2012, 2025, 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 @@ -65,7 +65,6 @@ import jdk.internal.util.StaticProperty; import sun.util.resources.LocaleData; import sun.util.resources.OpenListResourceBundle; -import sun.util.resources.ParallelListResourceBundle; import sun.util.resources.TimeZoneNamesBundle; /** @@ -579,11 +578,7 @@ public String[] getCNPatterns(NumberFormat.Style formatStyle) { * resources required by JSR 310. */ public ResourceBundle getJavaTimeFormatData() { - ResourceBundle rb = localeData.getDateFormatData(locale); - if (rb instanceof ParallelListResourceBundle) { - localeData.setSupplementary((ParallelListResourceBundle) rb); - } - return rb; + return localeData.getDateFormatData(locale); } /** diff --git a/src/java.base/share/classes/sun/util/resources/LocaleData.java b/src/java.base/share/classes/sun/util/resources/LocaleData.java index 7bf14343531..20e8e0f8fe9 100644 --- a/src/java.base/share/classes/sun/util/resources/LocaleData.java +++ b/src/java.base/share/classes/sun/util/resources/LocaleData.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1996, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1996, 2025, 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 @@ -44,7 +44,6 @@ import java.util.List; import java.util.Locale; import java.util.Map; -import java.util.MissingResourceException; import java.util.ResourceBundle; import java.util.Set; import java.util.concurrent.ConcurrentHashMap; @@ -143,30 +142,6 @@ public ResourceBundle getDateFormatData(Locale locale) { return getBundle(type.getTextResourcesPackage() + ".FormatData", locale); } - public void setSupplementary(ParallelListResourceBundle formatData) { - if (!formatData.areParallelContentsComplete()) { - String suppName = type.getTextResourcesPackage() + ".JavaTimeSupplementary"; - setSupplementary(suppName, formatData); - } - } - - private boolean setSupplementary(String suppName, ParallelListResourceBundle formatData) { - ParallelListResourceBundle parent = (ParallelListResourceBundle) formatData.getParent(); - boolean resetKeySet = false; - if (parent != null) { - resetKeySet = setSupplementary(suppName, parent); - } - OpenListResourceBundle supp = getSupplementary(suppName, formatData.getLocale()); - formatData.setParallelContents(supp); - resetKeySet |= supp != null; - // If any parents or this bundle has parallel data, reset keyset to create - // a new keyset with the data. - if (resetKeySet) { - formatData.resetKeySet(); - } - return resetKeySet; - } - /** * Gets a number format data resource bundle, using privileges * to allow accessing a sun.* package. @@ -179,18 +154,7 @@ public static ResourceBundle getBundle(final String baseName, final Locale local return Bundles.of(baseName, locale, LocaleDataStrategy.INSTANCE); } - private static OpenListResourceBundle getSupplementary(final String baseName, final Locale locale) { - OpenListResourceBundle rb = null; - try { - rb = (OpenListResourceBundle) Bundles.of(baseName, locale, - SupplementaryStrategy.INSTANCE); - } catch (MissingResourceException e) { - // return null if no supplementary is available - } - return rb; - } - - private abstract static class LocaleDataResourceBundleProvider + public abstract static class LocaleDataResourceBundleProvider implements ResourceBundleProvider { /** * Changes baseName to its module dependent package name and @@ -212,20 +176,6 @@ protected String toOtherBundleName(String baseName, String bundleName, Locale lo } } - /** - * A ResourceBundleProvider implementation for loading locale data - * resource bundles except for the java.time supplementary data. - */ - public abstract static class CommonResourceBundleProvider extends LocaleDataResourceBundleProvider { - } - - /** - * A ResourceBundleProvider implementation for loading supplementary - * resource bundles for java.time. - */ - public abstract static class SupplementaryResourceBundleProvider extends LocaleDataResourceBundleProvider { - } - // Bundles.Strategy implementations private static class LocaleDataStrategy implements Bundles.Strategy { @@ -254,18 +204,20 @@ public List getCandidateLocales(String baseName, Locale locale) { if (candidates == null) { LocaleProviderAdapter.Type type = baseName.contains(DOTCLDR) ? CLDR : JRE; LocaleProviderAdapter adapter = LocaleProviderAdapter.forType(type); - candidates = adapter instanceof ResourceBundleBasedAdapter ? - ((ResourceBundleBasedAdapter)adapter).getCandidateLocales(baseName, locale) : + candidates = adapter instanceof ResourceBundleBasedAdapter rbba ? + rbba.getCandidateLocales(baseName, locale) : defaultControl.getCandidateLocales(baseName, locale); // Weed out Locales which are known to have no resource bundles int lastDot = baseName.lastIndexOf('.'); String category = (lastDot >= 0) ? baseName.substring(lastDot + 1) : baseName; - Set langtags = ((JRELocaleProviderAdapter)adapter).getLanguageTagSet(category); - if (!langtags.isEmpty()) { - for (Iterator itr = candidates.iterator(); itr.hasNext();) { - if (!adapter.isSupportedProviderLocale(itr.next(), langtags)) { - itr.remove(); + if (adapter instanceof JRELocaleProviderAdapter jlpa) { + var langtags = jlpa.getLanguageTagSet(category); + if (!langtags.isEmpty()) { + for (Iterator itr = candidates.iterator(); itr.hasNext();) { + if (!jlpa.isSupportedProviderLocale(itr.next(), langtags)) { + itr.remove(); + } } } } @@ -302,36 +254,7 @@ public String toBundleName(String baseName, Locale locale) { public Class getResourceBundleProviderType(String baseName, Locale locale) { return inJavaBaseModule(baseName, locale) ? - null : CommonResourceBundleProvider.class; - } - } - - private static class SupplementaryStrategy extends LocaleDataStrategy { - private static final SupplementaryStrategy INSTANCE - = new SupplementaryStrategy(); - // TODO: avoid hard-coded Locales - private static final Set JAVA_BASE_LOCALES - = Set.of(Locale.ROOT, Locale.ENGLISH, Locale.US); - - private SupplementaryStrategy() { - } - - @Override - public List getCandidateLocales(String baseName, Locale locale) { - // Specify only the given locale - return List.of(locale); - } - - @Override - public Class getResourceBundleProviderType(String baseName, - Locale locale) { - return inJavaBaseModule(baseName, locale) ? - null : SupplementaryResourceBundleProvider.class; - } - - @Override - boolean inJavaBaseModule(String baseName, Locale locale) { - return JAVA_BASE_LOCALES.contains(locale); + null : LocaleDataResourceBundleProvider.class; } } } diff --git a/src/java.base/share/classes/sun/util/resources/ParallelListResourceBundle.java b/src/java.base/share/classes/sun/util/resources/ParallelListResourceBundle.java deleted file mode 100644 index 35319575010..00000000000 --- a/src/java.base/share/classes/sun/util/resources/ParallelListResourceBundle.java +++ /dev/null @@ -1,259 +0,0 @@ -/* - * Copyright (c) 2013, 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 sun.util.resources; - -import java.util.AbstractSet; -import java.util.Collections; -import java.util.Enumeration; -import java.util.HashSet; -import java.util.Iterator; -import java.util.NoSuchElementException; -import java.util.ResourceBundle; -import java.util.Set; -import java.util.concurrent.ConcurrentHashMap; -import java.util.concurrent.ConcurrentMap; -import java.util.concurrent.atomic.AtomicMarkableReference; - -/** - * ParallelListResourceBundle is another variant of ListResourceBundle - * supporting "parallel" contents provided by another resource bundle - * (OpenListResourceBundle). Parallel contents, if any, are added into this - * bundle on demand. - * - * @author Masayoshi Okutsu - */ -public abstract class ParallelListResourceBundle extends ResourceBundle { - private volatile ConcurrentMap lookup; - private volatile Set keyset; - private final AtomicMarkableReference parallelContents - = new AtomicMarkableReference<>(null, false); - - /** - * Sole constructor. (For invocation by subclass constructors, typically - * implicit.) - */ - protected ParallelListResourceBundle() { - } - - /** - * Returns an array in which each item is a pair of objects in an - * Object array. The first element of each pair is the key, which - * must be a String, and the second element is the value - * associated with that key. See the class description for - * details. - * - * @return an array of an Object array representing a key-value pair. - */ - protected abstract Object[][] getContents(); - - /** - * Returns the parent of this resource bundle or null if there's no parent. - * - * @return the parent or null if no parent - */ - ResourceBundle getParent() { - return parent; - } - - /** - * Sets the parallel contents to the data given by rb. If rb is null, this - * bundle will be marked as `complete'. - * - * @param rb an OpenResourceBundle for parallel contents, or null indicating - * there are no parallel contents for this bundle - */ - public void setParallelContents(OpenListResourceBundle rb) { - if (rb == null) { - parallelContents.compareAndSet(null, null, false, true); - } else { - parallelContents.compareAndSet(null, rb.getContents(), false, false); - } - } - - /** - * Returns true if any parallel contents have been set or if this bundle is - * marked as complete. - * - * @return true if any parallel contents have been processed - */ - boolean areParallelContentsComplete() { - // Quick check for `complete' - if (parallelContents.isMarked()) { - return true; - } - boolean[] done = new boolean[1]; - Object[][] data = parallelContents.get(done); - return data != null || done[0]; - } - - @Override - protected Object handleGetObject(String key) { - if (key == null) { - throw new NullPointerException(); - } - - loadLookupTablesIfNecessary(); - return lookup.get(key); - } - - @Override - public Enumeration getKeys() { - return Collections.enumeration(keySet()); - } - - @Override - public boolean containsKey(String key) { - return keySet().contains(key); - } - - @Override - protected Set handleKeySet() { - loadLookupTablesIfNecessary(); - return lookup.keySet(); - } - - @Override - @SuppressWarnings("UnusedAssignment") - public Set keySet() { - Set ks; - while ((ks = keyset) == null) { - ks = new KeySet(handleKeySet(), parent); - synchronized (this) { - if (keyset == null) { - keyset = ks; - } - } - } - return ks; - } - - /** - * Discards any cached keyset value. This method is called from - * LocaleData for re-creating a KeySet. - */ - synchronized void resetKeySet() { - keyset = null; - } - - /** - * Loads the lookup table if they haven't been loaded already. - */ - void loadLookupTablesIfNecessary() { - ConcurrentMap map = lookup; - if (map == null) { - map = new ConcurrentHashMap<>(); - for (Object[] item : getContents()) { - map.put((String) item[0], item[1]); - } - } - - // If there's any parallel contents data, merge the data into map. - Object[][] data = parallelContents.getReference(); - if (data != null) { - for (Object[] item : data) { - map.putIfAbsent((String) item[0], item[1]); - } - parallelContents.set(null, true); - } - if (lookup == null) { - synchronized (this) { - if (lookup == null) { - lookup = map; - } - } - } - } - - /** - * This class implements the Set interface for - * ParallelListResourceBundle methods. - */ - private static class KeySet extends AbstractSet { - private final Set set; - private final ResourceBundle parent; - - private KeySet(Set set, ResourceBundle parent) { - this.set = set; - this.parent = parent; - } - - @Override - public boolean contains(Object o) { - if (set.contains(o)) { - return true; - } - return (parent != null) ? parent.containsKey((String) o) : false; - } - - @Override - public Iterator iterator() { - if (parent == null) { - return set.iterator(); - } - return new Iterator<>() { - private Iterator itr = set.iterator(); - private boolean usingParent; - - @Override - public boolean hasNext() { - if (itr.hasNext()) { - return true; - } - if (!usingParent) { - Set nextset = new HashSet<>(parent.keySet()); - nextset.removeAll(set); - itr = nextset.iterator(); - usingParent = true; - } - return itr.hasNext(); - } - - @Override - public String next() { - if (hasNext()) { - return itr.next(); - } - throw new NoSuchElementException(); - } - - @Override - public void remove() { - throw new UnsupportedOperationException(); - } - }; - } - - @Override - public int size() { - if (parent == null) { - return set.size(); - } - Set allset = new HashSet<>(set); - allset.addAll(parent.keySet()); - return allset.size(); - } - } -} diff --git a/src/java.base/share/conf/security/java.security b/src/java.base/share/conf/security/java.security index 61e8aaaf6d1..5d96d74539e 100644 --- a/src/java.base/share/conf/security/java.security +++ b/src/java.base/share/conf/security/java.security @@ -1012,6 +1012,7 @@ jdk.xml.dsig.secureValidationPolicy=\ disallowAlg http://www.w3.org/2000/09/xmldsig#rsa-sha1,\ disallowAlg http://www.w3.org/2007/05/xmldsig-more#sha1-rsa-MGF1,\ disallowAlg http://www.w3.org/2001/04/xmldsig-more#ecdsa-sha1,\ + disallowAlg http://www.w3.org/TR/1999/REC-xpath-19991116,\ maxTransforms 5,\ maxReferences 30,\ disallowReferenceUriSchemes file http https,\ diff --git a/src/java.base/share/man/java.md b/src/java.base/share/man/java.md index fc8cbb23aff..3831fc64f88 100644 --- a/src/java.base/share/man/java.md +++ b/src/java.base/share/man/java.md @@ -1449,9 +1449,10 @@ These `java` options control the runtime behavior of the Java HotSpot VM. `report-on-exit=`*identifier* : Specifies the name of the view to display when the Java Virtual Machine - (JVM) shuts down. This option is not available if the disk option is set - to false. For a list of available views, see `jfr help view`. By default, - no report is generated. + (JVM) shuts down. To specify more than one view, use the report-on-exit + parameter repeatedly. This option is not available if the disk option + is set to false. For a list of available views, see `jfr help view`. + By default, no report is generated. `settings=`*path* : Specifies the path and name of the event settings file (of type JFC). @@ -1514,6 +1515,15 @@ These `java` options control the runtime behavior of the Java HotSpot VM. This option is similar to `-Xss`. +`-XX:+UseCompactObjectHeaders` +: Enables compact object headers. By default, this option is disabled. + Enabling this option reduces memory footprint in the Java heap by + 4 bytes per object (on average) and often improves performance. + + The feature remains disabled by default while it continues to be evaluated. + In a future release it is expected to be enabled by default, and + eventually will be the only mode of operation. + `-XX:-UseCompressedOops` : Disables the use of compressed pointers. By default, this option is enabled, and compressed pointers are used. This will automatically limit @@ -2700,14 +2710,6 @@ Java HotSpot VM. > `-XX:ParallelGCThreads=2` -`-XX:+ParallelRefProcEnabled` -: Enables parallel reference processing. By default, collectors employing multiple - threads perform parallel reference processing if the number of parallel threads - to use is larger than one. - The option is available only when the throughput or G1 garbage collector is used - (`-XX:+UseParallelGC` or `-XX:+UseG1GC`). Other collectors employing multiple - threads always perform reference processing in parallel. - `-XX:+PrintAdaptiveSizePolicy` : Enables printing of information about adaptive-generation sizing. By default, this option is disabled. @@ -2903,6 +2905,14 @@ they're used. : Enables the use of Java Flight Recorder (JFR) during the runtime of the application. Since JDK 8u40 this option has not been required to use JFR. +`-XX:+ParallelRefProcEnabled` +: Enables parallel reference processing. By default, collectors employing multiple + threads perform parallel reference processing if the number of parallel threads + to use is larger than one. + The option is available only when the throughput or G1 garbage collector is used + (`-XX:+UseParallelGC` or `-XX:+UseG1GC`). Other collectors employing multiple + threads always perform reference processing in parallel. + ## Obsolete Java Options These `java` options are still accepted but ignored, and a warning is issued diff --git a/src/java.base/share/native/libjava/Reference.c b/src/java.base/share/native/libjava/Reference.c index ce5b34299ad..7fef23c2ba8 100644 --- a/src/java.base/share/native/libjava/Reference.c +++ b/src/java.base/share/native/libjava/Reference.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2016, 2025, 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 @@ -44,6 +44,12 @@ Java_java_lang_ref_Reference_waitForReferencePendingList(JNIEnv *env, jclass ign JVM_WaitForReferencePendingList(env); } +JNIEXPORT jobject JNICALL +Java_java_lang_ref_Reference_get0(JNIEnv *env, jobject ref) +{ + return JVM_ReferenceGet(env, ref); +} + JNIEXPORT jboolean JNICALL Java_java_lang_ref_Reference_refersTo0(JNIEnv *env, jobject ref, jobject o) { diff --git a/src/java.base/share/native/libjli/args.c b/src/java.base/share/native/libjli/args.c index 547b279b7de..2f8fdf0fc43 100644 --- a/src/java.base/share/native/libjli/args.c +++ b/src/java.base/share/native/libjli/args.c @@ -149,6 +149,19 @@ static void checkArg(const char *arg) { } } +static char *computeToken(JLI_List *parts, const char *anchor, const char *nextc) { + char *token; + if ((*parts)->size == 0) { + token = clone_substring(anchor, nextc - anchor); + } else { + JLI_List_addSubstring(*parts, anchor, nextc - anchor); + token = JLI_List_combine(*parts); + JLI_List_free(*parts); + *parts = JLI_List_new(4); + } + return token; +} + /* [\n\r] +------------+ +------------+ [\n\r] +---------+ IN_COMMENT +<------+ | IN_ESCAPE +---------+ @@ -246,14 +259,7 @@ static char* nextToken(__ctx_args *pctx) { // fall through case '\n': case '\r': - if (pctx->parts->size == 0) { - token = clone_substring(anchor, nextc - anchor); - } else { - JLI_List_addSubstring(pctx->parts, anchor, nextc - anchor); - token = JLI_List_combine(pctx->parts); - JLI_List_free(pctx->parts); - pctx->parts = JLI_List_new(4); - } + token = computeToken(&pctx->parts, anchor, nextc); pctx->cptr = nextc + 1; pctx->state = FIND_NEXT; return token; @@ -262,6 +268,13 @@ static char* nextToken(__ctx_args *pctx) { continue; } pctx->state = IN_COMMENT; + // return non-zero length token, terminated by the number sign + if (nextc - anchor > 0) { + token = computeToken(&pctx->parts, anchor, nextc); + pctx->cptr = nextc + 1; + return token; + } + // anchor after number sign anchor = nextc + 1; break; case '\\': diff --git a/src/java.base/share/native/libnet/net_util.c b/src/java.base/share/native/libnet/net_util.c index 9c0f14b0d90..5b356d04b3c 100644 --- a/src/java.base/share/native/libnet/net_util.c +++ b/src/java.base/share/native/libnet/net_util.c @@ -74,7 +74,7 @@ DEF_JNI_OnLoad(JavaVM *vm, void *reserved) s = (*env)->NewStringUTF(env, "java.net.preferIPv4Stack"); CHECK_NULL_RETURN(s, JNI_VERSION_1_2); preferIPv4Stack = (*env)->CallStaticBooleanMethod(env, iCls, mid, s); - + JNU_CHECK_EXCEPTION_RETURN(env, JNI_VERSION_1_2); /* * Since we have initialized and loaded the socket library we will * check now whether we have IPv6 on this platform and if the @@ -91,14 +91,7 @@ DEF_JNI_OnLoad(JavaVM *vm, void *reserved) } static int enhancedExceptionsInitialized = 0; -static int enhancedExceptionsAllowed = -1; - -#define CHECK_NULL_THROW_ERROR(X) \ - if (X == NULL) { \ - JNU_ThrowByName(env, "java/lang/InternalError", \ - "can't initialize enhanced exceptions"); \ - return -1; \ - } +static int enhancedExceptionsAllowed = 0; int getEnhancedExceptionsAllowed(JNIEnv *env) { jclass cls; @@ -108,9 +101,9 @@ int getEnhancedExceptionsAllowed(JNIEnv *env) { return enhancedExceptionsAllowed; } cls = (*env)->FindClass(env, "jdk/internal/util/Exceptions"); - CHECK_NULL_THROW_ERROR(cls); + CHECK_NULL_RETURN(cls, ENH_INIT_ERROR); fid = (*env)->GetStaticFieldID(env, cls, "enhancedNonSocketExceptionText", "Z"); - CHECK_NULL_THROW_ERROR(fid); + CHECK_NULL_RETURN(fid, ENH_INIT_ERROR); enhancedExceptionsAllowed = (*env)->GetStaticBooleanField(env, cls, fid); enhancedExceptionsInitialized = 1; return enhancedExceptionsAllowed; diff --git a/src/java.base/share/native/libnet/net_util.h b/src/java.base/share/native/libnet/net_util.h index 89537a7f47d..92b812b1868 100644 --- a/src/java.base/share/native/libnet/net_util.h +++ b/src/java.base/share/native/libnet/net_util.h @@ -183,6 +183,11 @@ int lookupCharacteristicsToAddressFamily(int characteristics); int addressesInSystemOrder(int characteristics); +/* return codes */ +#define ENH_INIT_ERROR -1 /* initialization error: check exceptions */ +#define ENH_DISABLED 0 /* enhanced exceptions disabled */ +#define ENH_ENABLED 1 /* enhanced exceptions enabled */ + int getEnhancedExceptionsAllowed(JNIEnv *env); #endif /* NET_UTILS_H */ diff --git a/src/java.base/unix/classes/sun/nio/ch/NativeThread.java b/src/java.base/unix/classes/sun/nio/ch/NativeThread.java index 2ec67cc7d5c..8d0bcea48d9 100644 --- a/src/java.base/unix/classes/sun/nio/ch/NativeThread.java +++ b/src/java.base/unix/classes/sun/nio/ch/NativeThread.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2002, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2002, 2025, 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 @@ -78,6 +78,17 @@ static boolean isVirtualThread(long tid) { return (tid == VIRTUAL_THREAD_ID); } + /** + * Return true if the operating system supports pending signals. If a signal is sent + * to a thread but cannot be delivered immediately then it will be delivered when the + * thread is in the appropriate state. + */ + static boolean supportPendingSignals() { + return supportPendingSignals0(); + } + + private static native boolean supportPendingSignals0(); + // Returns an opaque token representing the native thread underlying the // invoking Java thread. On systems that do not require signalling, this // method always returns 0. diff --git a/src/java.base/unix/classes/sun/nio/ch/UnixDispatcher.java b/src/java.base/unix/classes/sun/nio/ch/UnixDispatcher.java index fcd2d88d7a6..4cdd0c400ec 100644 --- a/src/java.base/unix/classes/sun/nio/ch/UnixDispatcher.java +++ b/src/java.base/unix/classes/sun/nio/ch/UnixDispatcher.java @@ -29,21 +29,31 @@ import java.io.IOException; abstract class UnixDispatcher extends NativeDispatcher { + private static final boolean SUPPORTS_PENDING_SIGNALS = NativeThread.supportPendingSignals(); @Override void close(FileDescriptor fd) throws IOException { close0(fd); } - @Override - void implPreClose(FileDescriptor fd, long reader, long writer) throws IOException { - preClose0(fd); + private void signalThreads(long reader, long writer) { if (NativeThread.isNativeThread(reader)) NativeThread.signal(reader); if (NativeThread.isNativeThread(writer)) NativeThread.signal(writer); } + @Override + void implPreClose(FileDescriptor fd, long reader, long writer) throws IOException { + if (SUPPORTS_PENDING_SIGNALS) { + signalThreads(reader, writer); + } + preClose0(fd); + if (!SUPPORTS_PENDING_SIGNALS) { + signalThreads(reader, writer); + } + } + private static native void close0(FileDescriptor fd) throws IOException; private static native void preClose0(FileDescriptor fd) throws IOException; diff --git a/src/java.base/unix/native/libjava/childproc.c b/src/java.base/unix/native/libjava/childproc.c index 7a21b86565f..0dc0788879e 100644 --- a/src/java.base/unix/native/libjava/childproc.c +++ b/src/java.base/unix/native/libjava/childproc.c @@ -52,6 +52,21 @@ closeSafely(int fd) return (fd == -1) ? 0 : close(fd); } +int +markCloseOnExec(int fd) +{ + const int flags = fcntl(fd, F_GETFD); + if (flags < 0) { + return -1; + } + if ((flags & FD_CLOEXEC) == 0) { + if (fcntl(fd, F_SETFD, flags | FD_CLOEXEC) < 0) { + return -1; + } + } + return 0; +} + static int isAsciiDigit(char c) { @@ -68,21 +83,15 @@ isAsciiDigit(char c) #endif static int -closeDescriptors(void) +markDescriptorsCloseOnExec(void) { DIR *dp; struct dirent *dirp; - int from_fd = FAIL_FILENO + 1; - - /* We're trying to close all file descriptors, but opendir() might - * itself be implemented using a file descriptor, and we certainly - * don't want to close that while it's in use. We assume that if - * opendir() is implemented using a file descriptor, then it uses - * the lowest numbered file descriptor, just like open(). So we - * close a couple explicitly. */ - - close(from_fd); /* for possible use by opendir() */ - close(from_fd + 1); /* another one for good luck */ + /* This function marks all file descriptors beyond stderr as CLOEXEC. + * That includes the file descriptor used for the fail pipe: we want that + * one to stay open up until the execve, but it should be closed with the + * execve. */ + const int fd_from = STDERR_FILENO + 1; #if defined(_AIX) /* AIX does not understand '/proc/self' - it requires the real process ID */ @@ -91,18 +100,22 @@ closeDescriptors(void) #endif if ((dp = opendir(FD_DIR)) == NULL) - return 0; + return -1; while ((dirp = readdir(dp)) != NULL) { int fd; if (isAsciiDigit(dirp->d_name[0]) && - (fd = strtol(dirp->d_name, NULL, 10)) >= from_fd + 2) - close(fd); + (fd = strtol(dirp->d_name, NULL, 10)) >= fd_from) { + if (markCloseOnExec(fd) == -1) { + closedir(dp); + return -1; + } + } } closedir(dp); - return 1; + return 0; } static int @@ -394,11 +407,11 @@ childProcess(void *arg) fail_pipe_fd = FAIL_FILENO; /* close everything */ - if (closeDescriptors() == 0) { /* failed, close the old way */ + if (markDescriptorsCloseOnExec() == -1) { /* failed, close the old way */ int max_fd = (int)sysconf(_SC_OPEN_MAX); int fd; - for (fd = FAIL_FILENO + 1; fd < max_fd; fd++) - if (close(fd) == -1 && errno != EBADF) + for (fd = STDERR_FILENO + 1; fd < max_fd; fd++) + if (markCloseOnExec(fd) == -1 && errno != EBADF) goto WhyCantJohnnyExec; } @@ -413,9 +426,6 @@ childProcess(void *arg) sigprocmask(SIG_SETMASK, &unblock_signals, NULL); } - if (fcntl(FAIL_FILENO, F_SETFD, FD_CLOEXEC) == -1) - goto WhyCantJohnnyExec; - JDK_execvpe(p->mode, p->argv[0], p->argv, p->envv); WhyCantJohnnyExec: diff --git a/src/java.base/unix/native/libnet/net_util_md.c b/src/java.base/unix/native/libnet/net_util_md.c index d50130d188b..9bb6a026961 100644 --- a/src/java.base/unix/native/libnet/net_util_md.c +++ b/src/java.base/unix/native/libnet/net_util_md.c @@ -188,8 +188,11 @@ void NET_ThrowUnknownHostExceptionWithGaiError(JNIEnv *env, if (error_string == NULL) error_string = "unknown error"; int enhancedExceptions = getEnhancedExceptionsAllowed(env); + if (enhancedExceptions == ENH_INIT_ERROR && (*env)->ExceptionCheck(env)) { + return; + } - if (enhancedExceptions) { + if (enhancedExceptions == ENH_ENABLED) { size = strlen(hostname); } else { size = 0; @@ -200,7 +203,7 @@ void NET_ThrowUnknownHostExceptionWithGaiError(JNIEnv *env, if (buf) { jstring s; int n; - if (enhancedExceptions) { + if (enhancedExceptions == ENH_ENABLED) { n = snprintf(buf, size, "%s: %s", hostname, error_string); } else { n = snprintf(buf, size, " %s", error_string); diff --git a/src/java.base/unix/native/libnio/ch/NativeThread.c b/src/java.base/unix/native/libnio/ch/NativeThread.c index f273b951569..d6d31b2b12b 100644 --- a/src/java.base/unix/native/libnio/ch/NativeThread.c +++ b/src/java.base/unix/native/libnio/ch/NativeThread.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2002, 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2002, 2025, 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 @@ -88,3 +88,12 @@ Java_sun_nio_ch_NativeThread_signal0(JNIEnv *env, jclass cl, jlong thread) #endif JNU_ThrowIOExceptionWithLastError(env, "Thread signal failed"); } + +JNIEXPORT jboolean JNICALL +Java_sun_nio_ch_NativeThread_supportPendingSignals0(JNIEnv *env, jclass cl) { +#if defined(_AIX) + return JNI_TRUE; +#else + return JNI_FALSE; +#endif +} diff --git a/src/java.base/unix/native/libnio/ch/Net.c b/src/java.base/unix/native/libnio/ch/Net.c index 98445c93731..28c1814f422 100644 --- a/src/java.base/unix/native/libnio/ch/Net.c +++ b/src/java.base/unix/native/libnio/ch/Net.c @@ -205,6 +205,11 @@ Java_sun_nio_ch_Net_isExclusiveBindAvailable(JNIEnv *env, jclass clazz) { return -1; } +JNIEXPORT jboolean JNICALL +Java_sun_nio_ch_Net_shouldShutdownWriteBeforeClose0(JNIEnv *env, jclass clazz) { + return JNI_FALSE; +} + JNIEXPORT jboolean JNICALL Java_sun_nio_ch_Net_shouldSetBothIPv4AndIPv6Options0(JNIEnv* env, jclass cl) { diff --git a/src/java.base/windows/classes/sun/nio/ch/WindowsAsynchronousFileChannelImpl.java b/src/java.base/windows/classes/sun/nio/ch/WindowsAsynchronousFileChannelImpl.java index e3f65f82f0c..5df8aef7431 100644 --- a/src/java.base/windows/classes/sun/nio/ch/WindowsAsynchronousFileChannelImpl.java +++ b/src/java.base/windows/classes/sun/nio/ch/WindowsAsynchronousFileChannelImpl.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2008, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2008, 2025, 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 @@ -410,8 +410,10 @@ private class ReadTask implements Runnable, Iocp.ResultHandler { this.result = result; } - void releaseBufferIfSubstituted() { - if (buf != dst && RELEASED.compareAndSet(this, false, true)) { + void releaseScopeOrCacheSubstitute() { + if (buf == dst) { + IOUtil.releaseScope(dst); + } else if (RELEASED.compareAndSet(this, false, true)) { Util.releaseTemporaryDirectBuffer(buf); } } @@ -444,12 +446,13 @@ public void run() { long address; // Substitute a native buffer if not direct - if (dst instanceof DirectBuffer) { + if (dst.isDirect()) { buf = dst; - address = ((DirectBuffer)dst).address() + pos; + IOUtil.acquireScope(dst, true); + address = IOUtil.bufferAddress(dst) + pos; } else { buf = Util.getTemporaryDirectBuffer(rem); - address = ((DirectBuffer)buf).address(); + address = IOUtil.bufferAddress(buf) + pos; } boolean pending = false; @@ -479,7 +482,7 @@ public void run() { } finally { if (!pending) // release resources - releaseBufferIfSubstituted(); + releaseScopeOrCacheSubstitute(); end(); } @@ -494,8 +497,8 @@ public void run() { public void completed(int bytesTransferred, boolean canInvokeDirect) { updatePosition(bytesTransferred); - // return direct buffer to cache if substituted - releaseBufferIfSubstituted(); + // release direct buffer scope or return substitute to cache + releaseScopeOrCacheSubstitute(); // release waiters and invoke completion handler result.setResult(bytesTransferred); @@ -512,8 +515,8 @@ public void failed(int error, IOException x) { if (error == ERROR_HANDLE_EOF) { completed(-1, false); } else { - // return direct buffer to cache if substituted - releaseBufferIfSubstituted(); + // release direct buffer scope or return substitute to cache + releaseScopeOrCacheSubstitute(); // release waiters if (isOpen()) { @@ -600,8 +603,10 @@ private class WriteTask implements Runnable, Iocp.ResultHandler { this.result = result; } - void releaseBufferIfSubstituted() { - if (buf != src && RELEASED.compareAndSet(this, false, true)) { + void releaseScopeOrCacheSubstitute() { + if (buf == src) { + IOUtil.releaseScope(src); + } else if (RELEASED.compareAndSet(this, false, true)) { Util.releaseTemporaryDirectBuffer(buf); } } @@ -624,9 +629,10 @@ public void run() { long address; // Substitute a native buffer if not direct - if (src instanceof DirectBuffer) { + if (src.isDirect()) { buf = src; - address = ((DirectBuffer)src).address() + pos; + IOUtil.acquireScope(src, true); + address = IOUtil.bufferAddress(src) + pos; } else { buf = Util.getTemporaryDirectBuffer(rem); buf.put(src); @@ -634,7 +640,7 @@ public void run() { // temporarily restore position as we don't know how many bytes // will be written src.position(pos); - address = ((DirectBuffer)buf).address(); + address = IOUtil.bufferAddress(buf) + pos; } try { @@ -657,7 +663,7 @@ public void run() { result.setFailure(toIOException(x)); // release resources - releaseBufferIfSubstituted(); + releaseScopeOrCacheSubstitute(); if (overlapped != 0L) ioCache.remove(overlapped); @@ -676,8 +682,8 @@ public void run() { public void completed(int bytesTransferred, boolean canInvokeDirect) { updatePosition(bytesTransferred); - // return direct buffer to cache if substituted - releaseBufferIfSubstituted(); + // release direct buffer scope or return substitute to cache + releaseScopeOrCacheSubstitute(); // release waiters and invoke completion handler result.setResult(bytesTransferred); @@ -690,8 +696,8 @@ public void completed(int bytesTransferred, boolean canInvokeDirect) { @Override public void failed(int error, IOException x) { - // return direct buffer to cache if substituted - releaseBufferIfSubstituted(); + // release direct buffer scope or return substitute to cache + releaseScopeOrCacheSubstitute(); // release waiters and invoker completion handler if (isOpen()) { diff --git a/src/java.base/windows/native/libnet/Inet4AddressImpl.c b/src/java.base/windows/native/libnet/Inet4AddressImpl.c index 0ef0cae5be7..93210b0f6a5 100644 --- a/src/java.base/windows/native/libnet/Inet4AddressImpl.c +++ b/src/java.base/windows/native/libnet/Inet4AddressImpl.c @@ -88,9 +88,12 @@ Java_java_net_Inet4AddressImpl_lookupAllHostAddr(JNIEnv *env, jobject this, if (error) { // report error - NET_ThrowByNameWithLastError( - env, "java/net/UnknownHostException", - getEnhancedExceptionsAllowed(env) ? hostname : ""); + int enh = getEnhancedExceptionsAllowed(env); + if (enh == ENH_INIT_ERROR && (*env)->ExceptionCheck(env)) { + goto cleanupAndReturn; + } + const char *hmsg = (enh == ENH_ENABLED) ? hostname : ""; + NET_ThrowByNameWithLastError( env, "java/net/UnknownHostException", hmsg); goto cleanupAndReturn; } else { int i = 0; diff --git a/src/java.base/windows/native/libnet/Inet6AddressImpl.c b/src/java.base/windows/native/libnet/Inet6AddressImpl.c index 0281e2ddecb..6e5306164e1 100644 --- a/src/java.base/windows/native/libnet/Inet6AddressImpl.c +++ b/src/java.base/windows/native/libnet/Inet6AddressImpl.c @@ -83,8 +83,12 @@ Java_java_net_Inet6AddressImpl_lookupAllHostAddr(JNIEnv *env, jobject this, if (error) { // report error - NET_ThrowByNameWithLastError(env, "java/net/UnknownHostException", - getEnhancedExceptionsAllowed(env) ? hostname : ""); + int enh = getEnhancedExceptionsAllowed(env); + if (enh == ENH_INIT_ERROR && (*env)->ExceptionCheck(env)) { + goto cleanupAndReturn; + } + const char *hmsg = (enh == ENH_ENABLED) ? hostname : ""; + NET_ThrowByNameWithLastError(env, "java/net/UnknownHostException", hmsg); goto cleanupAndReturn; } else { int i = 0, inetCount = 0, inet6Count = 0, inetIndex = 0, diff --git a/src/java.base/windows/native/libnio/ch/Net.c b/src/java.base/windows/native/libnio/ch/Net.c index 3ccdbcc4752..105cb9cf743 100644 --- a/src/java.base/windows/native/libnio/ch/Net.c +++ b/src/java.base/windows/native/libnio/ch/Net.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2025, 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 @@ -117,6 +117,11 @@ Java_sun_nio_ch_Net_isExclusiveBindAvailable(JNIEnv *env, jclass clazz) { return 1; } +JNIEXPORT jboolean JNICALL +Java_sun_nio_ch_Net_shouldShutdownWriteBeforeClose0(JNIEnv *env, jclass clazz) { + return JNI_TRUE; +} + JNIEXPORT jboolean JNICALL Java_sun_nio_ch_Net_shouldSetBothIPv4AndIPv6Options0(JNIEnv* env, jclass cl) { diff --git a/src/java.desktop/macosx/native/libawt_lwawt/java2d/metal/EncoderManager.m b/src/java.desktop/macosx/native/libawt_lwawt/java2d/metal/EncoderManager.m index 95374d2c93e..f9cde966061 100644 --- a/src/java.desktop/macosx/native/libawt_lwawt/java2d/metal/EncoderManager.m +++ b/src/java.desktop/macosx/native/libawt_lwawt/java2d/metal/EncoderManager.m @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2019, 2025, 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 @@ -361,9 +361,9 @@ - (void)setContext:(MTLContex * _Nonnull)mtlc { jboolean needEnd = JNI_FALSE; if (_encoder != nil) { if (_destination != dest || renderOptions->isAA != _encoderStates.aa) { - J2dTraceLn2(J2D_TRACE_VERBOSE, - "end common encoder because of dest change: %p -> %p", - _destination, dest); + J2dTraceLn(J2D_TRACE_VERBOSE, + "end common encoder because of dest change: %p -> %p", + _destination, dest); needEnd = JNI_TRUE; } else if ((_useStencil == NO) != ([_mtlc.clip isShape] == NO)) { // 1. When mode changes RECT -> SHAPE we must recreate encoder with @@ -374,9 +374,9 @@ - (void)setContext:(MTLContex * _Nonnull)mtlc { // encoder with disabled stencil test, but [encoder // setDepthStencilState:nil] causes crash, so we have to recreate encoder // in such case - J2dTraceLn2(J2D_TRACE_VERBOSE, - "end common encoder because toggle stencil: %d -> %d", - (int)_useStencil, (int)[_mtlc.clip isShape]); + J2dTraceLn(J2D_TRACE_VERBOSE, + "end common encoder because toggle stencil: %d -> %d", + (int)_useStencil, (int)[_mtlc.clip isShape]); needEnd = JNI_TRUE; } } @@ -426,7 +426,7 @@ - (void)setContext:(MTLContex * _Nonnull)mtlc { rpd.stencilAttachment.storeAction = MTLStoreActionStore; } - // J2dTraceLn1(J2D_TRACE_VERBOSE, "created render encoder to draw on + // J2dTraceLn(J2D_TRACE_VERBOSE, "created render encoder to draw on // tex=%p", dest); _encoder = [[cbw getCommandBuffer] renderCommandEncoderWithDescriptor:rpd]; diff --git a/src/java.desktop/macosx/native/libawt_lwawt/java2d/metal/MTLBlitLoops.m b/src/java.desktop/macosx/native/libawt_lwawt/java2d/metal/MTLBlitLoops.m index 6c91f6a6a13..1a9201f4d6d 100644 --- a/src/java.desktop/macosx/native/libawt_lwawt/java2d/metal/MTLBlitLoops.m +++ b/src/java.desktop/macosx/native/libawt_lwawt/java2d/metal/MTLBlitLoops.m @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2019, 2025, 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 @@ -138,10 +138,10 @@ void drawTex2Tex(MTLContext *mtlc, jdouble dx1, jdouble dy1, jdouble dx2, jdouble dy2) { #ifdef TRACE_drawTex2Tex - J2dRlsTraceLn2(J2D_TRACE_VERBOSE, "drawTex2Tex: src tex=%p, dst tex=%p", src, dst); - J2dRlsTraceLn4(J2D_TRACE_VERBOSE, " sw=%d sh=%d dw=%d dh=%d", src.width, src.height, dst.width, dst.height); - J2dRlsTraceLn4(J2D_TRACE_VERBOSE, " sx1=%d sy1=%d sx2=%d sy2=%d", sx1, sy1, sx2, sy2); - J2dRlsTraceLn4(J2D_TRACE_VERBOSE, " dx1=%f dy1=%f dx2=%f dy2=%f", dx1, dy1, dx2, dy2); + J2dRlsTraceLn(J2D_TRACE_VERBOSE, "drawTex2Tex: src tex=%p, dst tex=%p", src, dst); + J2dRlsTraceLn(J2D_TRACE_VERBOSE, " sw=%d sh=%d dw=%d dh=%d", src.width, src.height, dst.width, dst.height); + J2dRlsTraceLn(J2D_TRACE_VERBOSE, " sx1=%d sy1=%d sx2=%d sy2=%d", sx1, sy1, sx2, sy2); + J2dRlsTraceLn(J2D_TRACE_VERBOSE, " dx1=%f dy1=%f dx2=%f dy2=%f", dx1, dy1, dx2, dy2); #endif //TRACE_drawTex2Tex id encoder = [mtlc.encoderManager getTextureEncoder:dst @@ -174,7 +174,7 @@ static void fillSwizzleUniforms(struct SwizzleUniforms *uniforms, const MTLRaste const int dh = MIN(dy2 - dy1, MTL_GPU_FAMILY_MAC_TXT_SIZE); if (dw < sw || dh < sh) { - J2dTraceLn4(J2D_TRACE_ERROR, "replaceTextureRegion: dest size: (%d, %d) less than source size: (%d, %d)", dw, dh, sw, sh); + J2dTraceLn(J2D_TRACE_ERROR, "replaceTextureRegion: dest size: (%d, %d) less than source size: (%d, %d)", dw, dh, sw, sh); return; } @@ -182,8 +182,8 @@ static void fillSwizzleUniforms(struct SwizzleUniforms *uniforms, const MTLRaste raster += (NSUInteger)srcInfo->bounds.y1 * (NSUInteger)srcInfo->scanStride + (NSUInteger)srcInfo->bounds.x1 * (NSUInteger)srcInfo->pixelStride; @autoreleasepool { - J2dTraceLn4(J2D_TRACE_VERBOSE, "replaceTextureRegion src (dw, dh) : [%d, %d] dest (dx1, dy1) =[%d, %d]", - dw, dh, dx1, dy1); + J2dTraceLn(J2D_TRACE_VERBOSE, "replaceTextureRegion src (dw, dh) : [%d, %d] dest (dx1, dy1) =[%d, %d]", + dw, dh, dx1, dy1); id buff = [[mtlc.device newBufferWithLength:(sw * sh * srcInfo->pixelStride) options:MTLResourceStorageModeManaged] autorelease]; // copy src pixels inside src bounds to buff @@ -327,37 +327,37 @@ jboolean clipDestCoords( dcy2 = maxY; if (dcx1 >= dcx2) { - J2dTraceLn2(J2D_TRACE_ERROR, "\tclipDestCoords: dcx1=%1.2f, dcx2=%1.2f", dcx1, dcx2); + J2dTraceLn(J2D_TRACE_ERROR, "\tclipDestCoords: dcx1=%1.2f, dcx2=%1.2f", dcx1, dcx2); dcx1 = dcx2; } if (dcy1 >= dcy2) { - J2dTraceLn2(J2D_TRACE_ERROR, "\tclipDestCoords: dcy1=%1.2f, dcy2=%1.2f", dcy1, dcy2); + J2dTraceLn(J2D_TRACE_ERROR, "\tclipDestCoords: dcy1=%1.2f, dcy2=%1.2f", dcy1, dcy2); dcy1 = dcy2; } } if (*dx2 <= dcx1 || *dx1 >= dcx2 || *dy2 <= dcy1 || *dy1 >= dcy2) { J2dTraceLn(J2D_TRACE_INFO, "\tclipDestCoords: dest rect doesn't intersect clip area"); - J2dTraceLn4(J2D_TRACE_INFO, "\tdx2=%1.4f <= dcx1=%1.4f || *dx1=%1.4f >= dcx2=%1.4f", *dx2, dcx1, *dx1, dcx2); - J2dTraceLn4(J2D_TRACE_INFO, "\t*dy2=%1.4f <= dcy1=%1.4f || *dy1=%1.4f >= dcy2=%1.4f", *dy2, dcy1, *dy1, dcy2); + J2dTraceLn(J2D_TRACE_INFO, "\tdx2=%1.4f <= dcx1=%1.4f || *dx1=%1.4f >= dcx2=%1.4f", *dx2, dcx1, *dx1, dcx2); + J2dTraceLn(J2D_TRACE_INFO, "\t*dy2=%1.4f <= dcy1=%1.4f || *dy1=%1.4f >= dcy2=%1.4f", *dy2, dcy1, *dy1, dcy2); return JNI_FALSE; } if (*dx1 < dcx1) { - J2dTraceLn3(J2D_TRACE_VERBOSE, "\t\tdx1=%1.2f, will be clipped to %1.2f | sx1+=%d", *dx1, dcx1, (jint)((dcx1 - *dx1) * (sw/dw))); + J2dTraceLn(J2D_TRACE_VERBOSE, "\t\tdx1=%1.2f, will be clipped to %1.2f | sx1+=%d", *dx1, dcx1, (jint)((dcx1 - *dx1) * (sw/dw))); *sx1 += (jint)((dcx1 - *dx1) * (sw/dw)); *dx1 = dcx1; } if (*dx2 > dcx2) { - J2dTraceLn3(J2D_TRACE_VERBOSE, "\t\tdx2=%1.2f, will be clipped to %1.2f | sx2-=%d", *dx2, dcx2, (jint)((*dx2 - dcx2) * (sw/dw))); + J2dTraceLn(J2D_TRACE_VERBOSE, "\t\tdx2=%1.2f, will be clipped to %1.2f | sx2-=%d", *dx2, dcx2, (jint)((*dx2 - dcx2) * (sw/dw))); *sx2 -= (jint)((*dx2 - dcx2) * (sw/dw)); *dx2 = dcx2; } if (*dy1 < dcy1) { - J2dTraceLn3(J2D_TRACE_VERBOSE, "\t\tdy1=%1.2f, will be clipped to %1.2f | sy1+=%d", *dy1, dcy1, (jint)((dcy1 - *dy1) * (sh/dh))); + J2dTraceLn(J2D_TRACE_VERBOSE, "\t\tdy1=%1.2f, will be clipped to %1.2f | sy1+=%d", *dy1, dcy1, (jint)((dcy1 - *dy1) * (sh/dh))); *sy1 += (jint)((dcy1 - *dy1) * (sh/dh)); *dy1 = dcy1; } if (*dy2 > dcy2) { - J2dTraceLn3(J2D_TRACE_VERBOSE, "\t\tdy2=%1.2f, will be clipped to %1.2f | sy2-=%d", *dy2, dcy2, (jint)((*dy2 - dcy2) * (sh/dh))); + J2dTraceLn(J2D_TRACE_VERBOSE, "\t\tdy2=%1.2f, will be clipped to %1.2f | sy2-=%d", *dy2, dcy2, (jint)((*dy2 - dcy2) * (sh/dh))); *sy2 -= (jint)((*dy2 - dcy2) * (sh/dh)); *dy2 = dcy2; } @@ -392,7 +392,7 @@ jboolean clipDestCoords( id srcTex = srcOps->pTexture; id dstTex = dstOps->pTexture; if (srcTex == nil || srcTex == nil) { - J2dTraceLn2(J2D_TRACE_ERROR, "MTLBlitLoops_IsoBlit: surface is null (stex=%p, dtex=%p)", srcTex, dstTex); + J2dTraceLn(J2D_TRACE_ERROR, "MTLBlitLoops_IsoBlit: surface is null (stex=%p, dtex=%p)", srcTex, dstTex); return; } @@ -402,7 +402,7 @@ jboolean clipDestCoords( const jdouble dh = dy2 - dy1; if (sw <= 0 || sh <= 0 || dw <= 0 || dh <= 0) { - J2dTraceLn4(J2D_TRACE_WARNING, "MTLBlitLoops_IsoBlit: invalid dimensions: sw=%d, sh%d, dw=%d, dh=%d", sw, sh, dw, dh); + J2dTraceLn(J2D_TRACE_WARNING, "MTLBlitLoops_IsoBlit: invalid dimensions: sw=%d, sh%d, dw=%d, dh=%d", sw, sh, dw, dh); return; } @@ -431,8 +431,8 @@ jboolean clipDestCoords( if (bounds.x2 <= bounds.x1 || bounds.y2 <= bounds.y1) { J2dTraceLn(J2D_TRACE_VERBOSE, "MTLBlitLoops_IsoBlit: source rectangle doesn't intersect with source surface bounds"); - J2dTraceLn6(J2D_TRACE_VERBOSE, " sx1=%d sy1=%d sx2=%d sy2=%d sw=%d sh=%d", sx1, sy1, sx2, sy2, srcOps->width, srcOps->height); - J2dTraceLn4(J2D_TRACE_VERBOSE, " dx1=%f dy1=%f dx2=%f dy2=%f", dx1, dy1, dx2, dy2); + J2dTraceLn(J2D_TRACE_VERBOSE, " sx1=%d sy1=%d sx2=%d sy2=%d sw=%d sh=%d", sx1, sy1, sx2, sy2, srcOps->width, srcOps->height); + J2dTraceLn(J2D_TRACE_VERBOSE, " dx1=%f dy1=%f dx2=%f dy2=%f", dx1, dy1, dx2, dy2); return; } @@ -521,7 +521,7 @@ jboolean clipDestCoords( return; } if (srctype < 0 || srctype >= sizeof(RasterFormatInfos)/ sizeof(MTLRasterFormatInfo)) { - J2dTraceLn1(J2D_TRACE_ERROR, "MTLBlitLoops_Blit: source pixel format %d isn't supported", srctype); + J2dTraceLn(J2D_TRACE_ERROR, "MTLBlitLoops_Blit: source pixel format %d isn't supported", srctype); return; } const jint sw = sx2 - sx1; @@ -641,14 +641,14 @@ void copyFromMTLBuffer(void *pDst, id srcBuf, NSUInteger offset, NSUI jint srcx, jint srcy, jint dstx, jint dsty, jint width, jint height) { - J2dTraceLn6(J2D_TRACE_VERBOSE, "MTLBlitLoops_SurfaceToSwBlit: sx=%d sy=%d w=%d h=%d dx=%d dy=%d", srcx, srcy, width, height, dstx, dsty); + J2dTraceLn(J2D_TRACE_VERBOSE, "MTLBlitLoops_SurfaceToSwBlit: sx=%d sy=%d w=%d h=%d dx=%d dy=%d", srcx, srcy, width, height, dstx, dsty); BMTLSDOps *srcOps = (BMTLSDOps *)jlong_to_ptr(pSrcOps); SurfaceDataOps *dstOps = (SurfaceDataOps *)jlong_to_ptr(pDstOps); SurfaceDataRasInfo srcInfo, dstInfo; if (dsttype < 0 || dsttype >= sizeof(RasterFormatInfos)/ sizeof(MTLRasterFormatInfo)) { - J2dTraceLn1(J2D_TRACE_ERROR, "MTLBlitLoops_SurfaceToSwBlit: destination pixel format %d isn't supported", dsttype); + J2dTraceLn(J2D_TRACE_ERROR, "MTLBlitLoops_SurfaceToSwBlit: destination pixel format %d isn't supported", dsttype); return; } @@ -736,7 +736,7 @@ void copyFromMTLBuffer(void *pDst, id srcBuf, NSUInteger offset, NSUI // NOTE: using of separate blitCommandBuffer can produce errors (draw into surface (with general cmd-buf) // can be unfinished when reading raster from blit cmd-buf). // Consider to use [mtlc.encoderManager createBlitEncoder] and [mtlc commitCommandBuffer:JNI_TRUE]; - J2dTraceLn1(J2D_TRACE_VERBOSE, "MTLBlitLoops_SurfaceToSwBlit: source texture %p", srcOps->pTexture); + J2dTraceLn(J2D_TRACE_VERBOSE, "MTLBlitLoops_SurfaceToSwBlit: source texture %p", srcOps->pTexture); id cb = [mtlc createCommandBuffer]; id blitEncoder = [cb blitCommandEncoder]; diff --git a/src/java.desktop/macosx/native/libawt_lwawt/java2d/metal/MTLBufImgOps.m b/src/java.desktop/macosx/native/libawt_lwawt/java2d/metal/MTLBufImgOps.m index a36e211f748..d34e8761c37 100644 --- a/src/java.desktop/macosx/native/libawt_lwawt/java2d/metal/MTLBufImgOps.m +++ b/src/java.desktop/macosx/native/libawt_lwawt/java2d/metal/MTLBufImgOps.m @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2019, 2025, 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 @@ -47,7 +47,7 @@ -(jfloat *) getOffsets { - (id)init:(jboolean)isNonPremult factors:(unsigned char *)factors offsets:(unsigned char *)offsets { self = [super init]; if (self) { - J2dTraceLn1(J2D_TRACE_INFO,"Created MTLRescaleOp: isNonPremult=%d", isNonPremult); + J2dTraceLn(J2D_TRACE_INFO, "Created MTLRescaleOp: isNonPremult=%d", isNonPremult); _isNonPremult = isNonPremult; _normScaleFactors[0] = NEXT_FLOAT(factors); @@ -82,7 +82,9 @@ - (id)init:(jboolean)edgeZeroFill kernelWidth:(jint)kernelWidth device:(id)device { self = [super init]; if (self) { - J2dTraceLn2(J2D_TRACE_INFO,"Created MTLConvolveOp: kernelW=%d kernelH=%d", kernelWidth, kernelHeight); + J2dTraceLn(J2D_TRACE_INFO, + "Created MTLConvolveOp: kernelW=%d kernelH=%d", + kernelWidth, kernelHeight); _isEdgeZeroFill = edgeZeroFill; _kernelSize = kernelWidth * kernelHeight; @@ -142,8 +144,9 @@ - (id)init:(jboolean)nonPremult shortData:(jboolean)shortData device:(id)device { self = [super init]; if (self) { - J2dTraceLn4(J2D_TRACE_INFO,"Created MTLLookupOp: short=%d num=%d len=%d off=%d", - shortData, numBands, bandLength, offset); + J2dTraceLn(J2D_TRACE_INFO, + "Created MTLLookupOp: short=%d num=%d len=%d off=%d", + shortData, numBands, bandLength, offset); _isUseSrcAlpha = numBands != 4; _isNonPremult = nonPremult; diff --git a/src/java.desktop/macosx/native/libawt_lwawt/java2d/metal/MTLClip.m b/src/java.desktop/macosx/native/libawt_lwawt/java2d/metal/MTLClip.m index 3919d97c53a..3225fc5562c 100644 --- a/src/java.desktop/macosx/native/libawt_lwawt/java2d/metal/MTLClip.m +++ b/src/java.desktop/macosx/native/libawt_lwawt/java2d/metal/MTLClip.m @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2019, 2025, 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 @@ -128,14 +128,17 @@ - (void)setClipRectX1:(jint)x1 Y1:(jint)y1 X2:(jint)x2 Y2:(jint)y2 { } if (x1 >= x2 || y1 >= y2) { - J2dTraceLn4(J2D_TRACE_ERROR, "MTLClip.setClipRect: invalid rect: x1=%d y1=%d x2=%d y2=%d", x1, y1, x2, y2); + J2dTraceLn(J2D_TRACE_ERROR, + "MTLClip.setClipRect: invalid rect: x1=%d y1=%d x2=%d y2=%d", + x1, y1, x2, y2); _clipType = NO_CLIP; } const jint width = x2 - x1; const jint height = y2 - y1; - J2dTraceLn4(J2D_TRACE_INFO, "MTLClip.setClipRect: x=%d y=%d w=%d h=%d", x1, y1, width, height); + J2dTraceLn(J2D_TRACE_INFO, "MTLClip.setClipRect: x=%d y=%d w=%d h=%d", + x1, y1, width, height); _clipRect.x = (NSUInteger)((x1 >= 0) ? x1 : 0); _clipRect.y = (NSUInteger)((y1 >= 0) ? y1 : 0); diff --git a/src/java.desktop/macosx/native/libawt_lwawt/java2d/metal/MTLContext.m b/src/java.desktop/macosx/native/libawt_lwawt/java2d/metal/MTLContext.m index b88d60957f3..c92f1e21c3a 100644 --- a/src/java.desktop/macosx/native/libawt_lwawt/java2d/metal/MTLContext.m +++ b/src/java.desktop/macosx/native/libawt_lwawt/java2d/metal/MTLContext.m @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2019, 2025, 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 @@ -251,7 +251,10 @@ + (MTLContext*) setSurfacesEnv:(JNIEnv*)env src:(jlong)pSrc dst:(jlong)pDst { return NULL; } - J2dTraceLn6(J2D_TRACE_VERBOSE, "MTLContext_SetSurfaces: bsrc=%p (tex=%p type=%d), bdst=%p (tex=%p type=%d)", srcOps, srcOps->pTexture, srcOps->drawableType, dstOps, dstOps->pTexture, dstOps->drawableType); + J2dTraceLn(J2D_TRACE_VERBOSE, + "MTLContext_SetSurfaces: bsrc=%p (tex=%p type=%d), bdst=%p (tex=%p type=%d)", + srcOps, srcOps->pTexture, srcOps->drawableType, + dstOps, dstOps->pTexture, dstOps->drawableType); if (dstOps->drawableType == MTLSD_TEXTURE) { J2dRlsTraceLn(J2D_TRACE_ERROR, @@ -287,7 +290,7 @@ - (void)resetClip { } - (void)setClipRectX1:(jint)x1 Y1:(jint)y1 X2:(jint)x2 Y2:(jint)y2 { - J2dTraceLn4(J2D_TRACE_INFO, "MTLContext.setClipRect: %d,%d - %d,%d", x1, y1, x2, y2); + J2dTraceLn(J2D_TRACE_INFO, "MTLContext.setClipRect: %d,%d - %d,%d", x1, y1, x2, y2); [_clip setClipRectX1:x1 Y1:y1 X2:x2 Y2:y2]; } @@ -316,7 +319,9 @@ - (void)resetComposite { - (void)setAlphaCompositeRule:(jint)rule extraAlpha:(jfloat)extraAlpha flags:(jint)flags { - J2dTraceLn3(J2D_TRACE_INFO, "MTLContext_SetAlphaComposite: rule=%d, extraAlpha=%1.2f, flags=%d", rule, extraAlpha, flags); + J2dTraceLn(J2D_TRACE_INFO, + "MTLContext_SetAlphaComposite: rule=%d, extraAlpha=%1.2f, flags=%d", + rule, extraAlpha, flags); [_composite setRule:rule extraAlpha:extraAlpha]; } @@ -330,7 +335,7 @@ - (NSString*)getPaintDescription { } - (void)setXorComposite:(jint)xp { - J2dTraceLn1(J2D_TRACE_INFO, "MTLContext.setXorComposite: xorPixel=%08x", xp); + J2dTraceLn(J2D_TRACE_INFO, "MTLContext.setXorComposite: xorPixel=%08x", xp); [_composite setXORComposite:xp]; } @@ -357,7 +362,10 @@ - (void)resetPaint { } - (void)setColorPaint:(int)pixel { - J2dTraceLn5(J2D_TRACE_INFO, "MTLContext.setColorPaint: pixel=%08x [r=%d g=%d b=%d a=%d]", pixel, (pixel >> 16) & (0xFF), (pixel >> 8) & 0xFF, (pixel) & 0xFF, (pixel >> 24) & 0xFF); + J2dTraceLn(J2D_TRACE_INFO, + "MTLContext.setColorPaint: pixel=%08x [r=%d g=%d b=%d a=%d]", + pixel, (pixel >> 16) & (0xFF), (pixel >> 8) & 0xFF, + (pixel) & 0xFF, (pixel >> 24) & 0xFF); self.paint = [[[MTLColorPaint alloc] initWithColor:pixel] autorelease]; } @@ -452,7 +460,7 @@ - (void)setTexturePaint:(jboolean)useMask return; } - J2dTraceLn1(J2D_TRACE_INFO, "MTLContext.setTexturePaint [tex=%p]", srcOps->pTexture); + J2dTraceLn(J2D_TRACE_INFO, "MTLContext.setTexturePaint [tex=%p]", srcOps->pTexture); self.paint = [[[MTLTexturePaint alloc] initWithUseMask:useMask textureID:srcOps->pTexture diff --git a/src/java.desktop/macosx/native/libawt_lwawt/java2d/metal/MTLGlyphCache.m b/src/java.desktop/macosx/native/libawt_lwawt/java2d/metal/MTLGlyphCache.m index 474bdd9af65..1e446967a07 100644 --- a/src/java.desktop/macosx/native/libawt_lwawt/java2d/metal/MTLGlyphCache.m +++ b/src/java.desktop/macosx/native/libawt_lwawt/java2d/metal/MTLGlyphCache.m @@ -1,5 +1,5 @@ /* - * Copyright (c) 2020, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2020, 2025, 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 @@ -269,8 +269,8 @@ { // assert (glyph != NULL && cellInfo != NULL) J2dTraceLn(J2D_TRACE_INFO, "MTLGlyphCache_AddCellInfo"); - J2dTraceLn2(J2D_TRACE_VERBOSE, " glyph 0x%x: adding cell 0x%x to the list", - glyph, cellInfo); + J2dTraceLn(J2D_TRACE_VERBOSE, " glyph 0x%x: adding cell 0x%x to the list", + glyph, cellInfo); cellInfo->glyphInfo = glyph; cellInfo->nextGCI = glyph->cellInfo; @@ -290,9 +290,9 @@ J2dTraceLn(J2D_TRACE_INFO, "MTLGlyphCache_RemoveCellInfo"); do { if (currCellInfo == cellInfo) { - J2dTraceLn2(J2D_TRACE_VERBOSE, - " glyph 0x%x: removing cell 0x%x from glyph's list", - glyph, currCellInfo); + J2dTraceLn(J2D_TRACE_VERBOSE, + " glyph 0x%x: removing cell 0x%x from glyph's list", + glyph, currCellInfo); if (prevInfo == NULL) { // it's the head, chop-chop glyph->cellInfo = currCellInfo->nextGCI; } else { @@ -305,9 +305,9 @@ prevInfo = currCellInfo; currCellInfo = currCellInfo->nextGCI; } while (currCellInfo != NULL); - J2dTraceLn2(J2D_TRACE_WARNING, "MTLGlyphCache_RemoveCellInfo: "\ - "no cell 0x%x in glyph 0x%x's cell list", - cellInfo, glyph); + J2dTraceLn(J2D_TRACE_WARNING, "MTLGlyphCache_RemoveCellInfo: "\ + "no cell 0x%x in glyph 0x%x's cell list", + cellInfo, glyph); } /** @@ -350,15 +350,15 @@ MTLCacheCellInfo *cellInfo = glyph->cellInfo; do { if (cellInfo->cacheInfo == cache) { - J2dTraceLn3(J2D_TRACE_VERBOSE2, - " glyph 0x%x: found cell 0x%x for cache 0x%x", - glyph, cellInfo, cache); + J2dTraceLn(J2D_TRACE_VERBOSE2, + " glyph 0x%x: found cell 0x%x for cache 0x%x", + glyph, cellInfo, cache); return cellInfo; } cellInfo = cellInfo->nextGCI; } while (cellInfo != NULL); } - J2dTraceLn2(J2D_TRACE_VERBOSE2, " glyph 0x%x: no cell for cache 0x%x", - glyph, cache); + J2dTraceLn(J2D_TRACE_VERBOSE2, " glyph 0x%x: no cell for cache 0x%x", + glyph, cache); return NULL; } diff --git a/src/java.desktop/macosx/native/libawt_lwawt/java2d/metal/MTLLayer.m b/src/java.desktop/macosx/native/libawt_lwawt/java2d/metal/MTLLayer.m index 9f3ab974feb..e153ace3bfd 100644 --- a/src/java.desktop/macosx/native/libawt_lwawt/java2d/metal/MTLLayer.m +++ b/src/java.desktop/macosx/native/libawt_lwawt/java2d/metal/MTLLayer.m @@ -132,9 +132,9 @@ - (void) onScreenWakeup { - (void) blitTexture { if (self.ctx == NULL || self.javaLayer == NULL || self.buffer == nil || self.ctx.device == nil) { - J2dTraceLn4(J2D_TRACE_VERBOSE, - "MTLLayer.blitTexture: uninitialized (mtlc=%p, javaLayer=%p, buffer=%p, device=%p)", self.ctx, - self.javaLayer, self.buffer, ctx.device); + J2dTraceLn(J2D_TRACE_VERBOSE, + "MTLLayer.blitTexture: uninitialized (mtlc=%p, javaLayer=%p, buffer=%p, device=%p)", + self.ctx, self.javaLayer, self.buffer, ctx.device); [self stopDisplayLink]; return; } diff --git a/src/java.desktop/macosx/native/libawt_lwawt/java2d/metal/MTLMaskFill.m b/src/java.desktop/macosx/native/libawt_lwawt/java2d/metal/MTLMaskFill.m index 89fad174c1e..7d92ae633fa 100644 --- a/src/java.desktop/macosx/native/libawt_lwawt/java2d/metal/MTLMaskFill.m +++ b/src/java.desktop/macosx/native/libawt_lwawt/java2d/metal/MTLMaskFill.m @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2019, 2025, 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 @@ -47,7 +47,9 @@ jint maskoff, jint maskscan, jint masklen, unsigned char *pMask) { - J2dTraceLn5(J2D_TRACE_INFO, "MTLMaskFill_MaskFill (x=%d y=%d w=%d h=%d pMask=%p)", x, y, w, h, dstOps->pTexture); + J2dTraceLn(J2D_TRACE_INFO, + "MTLMaskFill_MaskFill (x=%d y=%d w=%d h=%d pMask=%p)", + x, y, w, h, dstOps->pTexture); jint tw, th, x0; jint sx1, sy1, sx2, sy2; jint sx, sy, sw, sh; diff --git a/src/java.desktop/macosx/native/libawt_lwawt/java2d/metal/MTLRenderQueue.h b/src/java.desktop/macosx/native/libawt_lwawt/java2d/metal/MTLRenderQueue.h index c81770a2bf3..b6330168759 100644 --- a/src/java.desktop/macosx/native/libawt_lwawt/java2d/metal/MTLRenderQueue.h +++ b/src/java.desktop/macosx/native/libawt_lwawt/java2d/metal/MTLRenderQueue.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019, 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2019, 2025, 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 @@ -81,8 +81,8 @@ enum { */ #define ACT_IF_NULL(ACTION, value) \ if ((value) == NULL) { \ - J2dTraceLn1(J2D_TRACE_ERROR, \ - "%s is null", #value); \ + J2dTraceLn(J2D_TRACE_ERROR, \ + "%s is null", #value); \ ACTION; \ } else do { } while (0) #define RETURN_IF_NULL(value) ACT_IF_NULL(return, value) @@ -90,8 +90,8 @@ enum { #define ACT_IF_TRUE(ACTION, value) \ if ((value)) { \ - J2dTraceLn1(J2D_TRACE_ERROR, \ - "%s is false", #value);\ + J2dTraceLn(J2D_TRACE_ERROR, \ + "%s is false", #value); \ ACTION; \ } else do { } while (0) diff --git a/src/java.desktop/macosx/native/libawt_lwawt/java2d/metal/MTLRenderQueue.m b/src/java.desktop/macosx/native/libawt_lwawt/java2d/metal/MTLRenderQueue.m index 257269e647f..3ffa887388e 100644 --- a/src/java.desktop/macosx/native/libawt_lwawt/java2d/metal/MTLRenderQueue.m +++ b/src/java.desktop/macosx/native/libawt_lwawt/java2d/metal/MTLRenderQueue.m @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019, 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2019, 2025, 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 @@ -65,8 +65,8 @@ void MTLRenderQueue_CheckPreviousOp(jint op) { return; } - J2dTraceLn1(J2D_TRACE_VERBOSE, - "MTLRenderQueue_CheckPreviousOp: new op=%d", op); + J2dTraceLn(J2D_TRACE_VERBOSE, + "MTLRenderQueue_CheckPreviousOp: new op=%d", op); switch (mtlPreviousOp) { case MTL_OP_INIT : @@ -104,8 +104,8 @@ void MTLRenderQueue_CheckPreviousOp(jint op) { { unsigned char *b, *end; - J2dTraceLn1(J2D_TRACE_INFO, - "MTLRenderQueue_flushBuffer: limit=%d", limit); + J2dTraceLn(J2D_TRACE_INFO, + "MTLRenderQueue_flushBuffer: limit=%d", limit); b = (unsigned char *)jlong_to_ptr(buf); if (b == NULL) { @@ -119,9 +119,9 @@ void MTLRenderQueue_CheckPreviousOp(jint op) { while (b < end) { jint opcode = NEXT_INT(b); - J2dTraceLn2(J2D_TRACE_VERBOSE, - "MTLRenderQueue_flushBuffer: opcode=%d, rem=%d", - opcode, (end-b)); + J2dTraceLn(J2D_TRACE_VERBOSE, + "MTLRenderQueue_flushBuffer: opcode=%d, rem=%d", + opcode, (end-b)); switch (opcode) { @@ -868,8 +868,9 @@ void MTLRenderQueue_CheckPreviousOp(jint op) { } default: - J2dRlsTraceLn1(J2D_TRACE_ERROR, - "MTLRenderQueue_flushBuffer: invalid opcode=%d", opcode); + J2dRlsTraceLn(J2D_TRACE_ERROR, + "MTLRenderQueue_flushBuffer: invalid opcode=%d", + opcode); return; } } diff --git a/src/java.desktop/macosx/native/libawt_lwawt/java2d/metal/MTLRenderer.m b/src/java.desktop/macosx/native/libawt_lwawt/java2d/metal/MTLRenderer.m index 84b76f8c8f3..4d8e0c32f36 100644 --- a/src/java.desktop/macosx/native/libawt_lwawt/java2d/metal/MTLRenderer.m +++ b/src/java.desktop/macosx/native/libawt_lwawt/java2d/metal/MTLRenderer.m @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019, 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2019, 2025, 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 @@ -63,7 +63,9 @@ void MTLRenderer_DrawLine(MTLContext *mtlc, BMTLSDOps * dstOps, jint x1, jint y1 return; } - J2dTraceLn5(J2D_TRACE_INFO, "MTLRenderer_DrawLine (x1=%d y1=%d x2=%d y2=%d), dst tex=%p", x1, y1, x2, y2, dstOps->pTexture); + J2dTraceLn(J2D_TRACE_INFO, + "MTLRenderer_DrawLine (x1=%d y1=%d x2=%d y2=%d), dst tex=%p", + x1, y1, x2, y2, dstOps->pTexture); id mtlEncoder = [mtlc.encoderManager getRenderEncoder:dstOps]; if (mtlEncoder == nil) @@ -138,7 +140,7 @@ void MTLRenderer_DrawPixel(MTLContext *mtlc, BMTLSDOps * dstOps, jint x, jint y) } id dest = dstOps->pTexture; - J2dTraceLn3(J2D_TRACE_INFO, "MTLRenderer_DrawPixel (x=%d y=%d), dst tex=%p", x, y, dest); + J2dTraceLn(J2D_TRACE_INFO, "MTLRenderer_DrawPixel (x=%d y=%d), dst tex=%p", x, y, dest); id mtlEncoder = [mtlc.encoderManager getRenderEncoder:dstOps]; if (mtlEncoder == nil) @@ -160,7 +162,9 @@ void MTLRenderer_DrawRect(MTLContext *mtlc, BMTLSDOps * dstOps, jint x, jint y, } id dest = dstOps->pTexture; - J2dTraceLn5(J2D_TRACE_INFO, "MTLRenderer_DrawRect (x=%d y=%d w=%d h=%d), dst tex=%p", x, y, w, h, dest); + J2dTraceLn(J2D_TRACE_INFO, + "MTLRenderer_DrawRect (x=%d y=%d w=%d h=%d), dst tex=%p", + x, y, w, h, dest); // TODO: use DrawParallelogram(x, y, w, h, lw=1, lh=1) id mtlEncoder = [mtlc.encoderManager getRenderEncoder:dstOps]; @@ -209,7 +213,9 @@ void MTLRenderer_DrawPoly(MTLContext *mtlc, BMTLSDOps * dstOps, return; } - J2dTraceLn4(J2D_TRACE_INFO, "MTLRenderer_DrawPoly: %d points, transX=%d, transY=%d, dst tex=%p", nPoints, transX, transY, dstOps->pTexture); + J2dTraceLn(J2D_TRACE_INFO, + "MTLRenderer_DrawPoly: %d points, transX=%d, transY=%d, dst tex=%p", + nPoints, transX, transY, dstOps->pTexture); __block struct { struct Vertex verts[POLYLINE_BUF_SIZE]; @@ -229,20 +235,23 @@ void MTLRenderer_DrawPoly(MTLContext *mtlc, BMTLSDOps * dstOps, __block int chunkSize = isLastChunk ? nPoints : POLYLINE_BUF_SIZE; fillVertex(pointsChunk.verts, prevX + transX + 0.5f, prevY + transY + 0.5f); - J2dTraceLn2(J2D_TRACE_INFO, "MTLRenderer_DrawPoly: Point - (%1.2f, %1.2f)", prevX + transX + 0.5f, prevY + transY + 0.5f); + J2dTraceLn(J2D_TRACE_INFO, "MTLRenderer_DrawPoly: Point - (%1.2f, %1.2f)", + prevX + transX + 0.5f, prevY + transY + 0.5f); for (int i = 1; i < chunkSize; i++) { prevX = *(xPoints++); prevY = *(yPoints++); fillVertex(pointsChunk.verts + i, prevX + transX + 0.5f, prevY + transY + 0.5f); - J2dTraceLn2(J2D_TRACE_INFO, "MTLRenderer_DrawPoly: Point - (%1.2f, %1.2f)", prevX + transX + 0.5f,prevY + transY + 0.5f); + J2dTraceLn(J2D_TRACE_INFO, "MTLRenderer_DrawPoly: Point - (%1.2f, %1.2f)", + prevX + transX + 0.5f,prevY + transY + 0.5f); } bool drawCloseSegment = false; if (isClosed && isLastChunk) { if (chunkSize + 2 <= POLYLINE_BUF_SIZE) { fillVertex(pointsChunk.verts + chunkSize, firstX + transX + 0.5f, firstY + transY + 0.5f); - J2dTraceLn2(J2D_TRACE_INFO, "MTLRenderer_DrawPoly: Point - (%1.2f, %1.2f)",firstX + transX + 0.5f, firstY + transY + 0.5f); + J2dTraceLn(J2D_TRACE_INFO, "MTLRenderer_DrawPoly: Point - (%1.2f, %1.2f)", + firstX + transX + 0.5f, firstY + transY + 0.5f); ++chunkSize; } else @@ -263,8 +272,12 @@ void MTLRenderer_DrawPoly(MTLContext *mtlc, BMTLSDOps * dstOps, {{firstX + transX + 0.5f, firstY + transY + 0.5f}} }; - J2dTraceLn2(J2D_TRACE_INFO, "MTLRenderer_DrawPoly: last segment Point1 - (%1.2f, %1.2f)",prevX + transX + 0.5f, prevY + transY + 0.5f); - J2dTraceLn2(J2D_TRACE_INFO, "MTLRenderer_DrawPoly: last segment Point2 - (%1.2f, %1.2f)",firstX + transX + 0.5f, firstY + transY + 0.5f); + J2dTraceLn(J2D_TRACE_INFO, + "MTLRenderer_DrawPoly: last segment Point1 - (%1.2f, %1.2f)", + prevX + transX + 0.5f, prevY + transY + 0.5f); + J2dTraceLn(J2D_TRACE_INFO, + "MTLRenderer_DrawPoly: last segment Point2 - (%1.2f, %1.2f)", + firstX + transX + 0.5f, firstY + transY + 0.5f); [mtlEncoder setVertexBytes:vertices length:sizeof(vertices) atIndex:MeshVertexBuffer]; [mtlEncoder drawPrimitives:MTLPrimitiveTypeLine vertexStart:0 vertexCount:2]; @@ -324,7 +337,9 @@ void MTLRenderer_DrawPoly(MTLContext *mtlc, BMTLSDOps * dstOps, jint scanlineCount, jint *scanlines) { - J2dTraceLn2(J2D_TRACE_INFO, "MTLRenderer_DrawScanlines (scanlineCount=%d), dst tex=%p", scanlineCount, dstOps->pTexture); + J2dTraceLn(J2D_TRACE_INFO, + "MTLRenderer_DrawScanlines (scanlineCount=%d), dst tex=%p", + scanlineCount, dstOps->pTexture); if (mtlc == NULL || dstOps == NULL || dstOps->pTexture == NULL) { J2dTraceLn(J2D_TRACE_ERROR, "MTLRenderer_DrawScanlines: dest is null"); return; @@ -332,7 +347,7 @@ void MTLRenderer_DrawPoly(MTLContext *mtlc, BMTLSDOps * dstOps, RETURN_IF_NULL(scanlines); int vertexSize = NUM_OF_VERTICES_PER_SCANLINE * scanlineCount * VERTEX_STRUCT_SIZE; - J2dTraceLn1(J2D_TRACE_INFO, "MTLRenderer_DrawScanlines: Total vertex size : %d", vertexSize); + J2dTraceLn(J2D_TRACE_INFO, "MTLRenderer_DrawScanlines: Total vertex size : %d", vertexSize); if (vertexSize == 0) return; id mtlEncoder = [mtlc.encoderManager getRenderEncoder:dstOps]; @@ -399,8 +414,9 @@ void MTLRenderer_DrawPoly(MTLContext *mtlc, BMTLSDOps * dstOps, vertexCount:(remainingScanlineCount / VERTEX_STRUCT_SIZE)]; remainingScanlineCount -= remainingScanlineCount; } - J2dTraceLn1(J2D_TRACE_INFO, - "MTLRenderer_DrawScanlines: Remaining vertex size %d", remainingScanlineCount); + J2dTraceLn(J2D_TRACE_INFO, + "MTLRenderer_DrawScanlines: Remaining vertex size %d", + remainingScanlineCount); } while (remainingScanlineCount != 0); } } @@ -424,7 +440,8 @@ void MTLRenderer_DrawPoly(MTLContext *mtlc, BMTLSDOps * dstOps, id dest = dstOps->pTexture; - J2dTraceLn5(J2D_TRACE_INFO, "MTLRenderer_FillRect (x=%d y=%d w=%d h=%d), dst tex=%p", x, y, w, h, dest); + J2dTraceLn(J2D_TRACE_INFO, + "MTLRenderer_FillRect (x=%d y=%d w=%d h=%d), dst tex=%p", x, y, w, h, dest); // Encode render command. id mtlEncoder = [mtlc.encoderManager getRenderEncoder:dstOps]; @@ -544,14 +561,14 @@ void MTLRenderer_FillSpans(MTLContext *mtlc, BMTLSDOps * dstOps, jint spanCount, } id dest = dstOps->pTexture; - J2dTraceLn7(J2D_TRACE_INFO, - "MTLRenderer_FillParallelogram" - "(x=%6.2f y=%6.2f " - "dx1=%6.2f dy1=%6.2f " - "dx2=%6.2f dy2=%6.2f dst tex=%p)", - fx11, fy11, - dx21, dy21, - dx12, dy12, dest); + J2dTraceLn(J2D_TRACE_INFO, + "MTLRenderer_FillParallelogram" + "(x=%6.2f y=%6.2f " + "dx1=%6.2f dy1=%6.2f " + "dx2=%6.2f dy2=%6.2f dst tex=%p)", + fx11, fy11, + dx21, dy21, + dx12, dy12, dest); struct Vertex verts[QUAD_VERTEX_COUNT] = { { {fx11, fy11}}, @@ -589,14 +606,14 @@ void MTLRenderer_FillSpans(MTLContext *mtlc, BMTLSDOps * dstOps, jint spanCount, jfloat ox11 = fx11 - (ldx21 + ldx12) / 2.0f; jfloat oy11 = fy11 - (ldy21 + ldy12) / 2.0f; - J2dTraceLn8(J2D_TRACE_INFO, - "MTLRenderer_DrawParallelogram" - "(x=%6.2f y=%6.2f " - "dx1=%6.2f dy1=%6.2f lwr1=%6.2f " - "dx2=%6.2f dy2=%6.2f lwr2=%6.2f)", - fx11, fy11, - dx21, dy21, lwr21, - dx12, dy12, lwr12); + J2dTraceLn(J2D_TRACE_INFO, + "MTLRenderer_DrawParallelogram" + "(x=%6.2f y=%6.2f " + "dx1=%6.2f dy1=%6.2f lwr1=%6.2f " + "dx2=%6.2f dy2=%6.2f lwr2=%6.2f)", + fx11, fy11, + dx21, dy21, lwr21, + dx12, dy12, lwr12); // Only need to generate 4 quads if the interior still @@ -790,14 +807,14 @@ void MTLRenderer_FillSpans(MTLContext *mtlc, BMTLSDOps * dstOps, jint spanCount, // parameters for uv texture coordinates of parallelogram corners jfloat ou11, ov11, ou12, ov12, ou21, ov21, ou22, ov22; - J2dTraceLn6(J2D_TRACE_INFO, - "MTLRenderer_FillAAParallelogram " - "(x=%6.2f y=%6.2f " - "dx1=%6.2f dy1=%6.2f " - "dx2=%6.2f dy2=%6.2f)", - fx11, fy11, - dx21, dy21, - dx12, dy12); + J2dTraceLn(J2D_TRACE_INFO, + "MTLRenderer_FillAAParallelogram " + "(x=%6.2f y=%6.2f " + "dx1=%6.2f dy1=%6.2f " + "dx2=%6.2f dy2=%6.2f)", + fx11, fy11, + dx21, dy21, + dx12, dy12); RETURN_IF_NULL(mtlc); RETURN_IF_NULL(dstOps); @@ -907,14 +924,14 @@ void MTLRenderer_FillSpans(MTLContext *mtlc, BMTLSDOps * dstOps, jint spanCount, // parameters for "inner" parallelogram jfloat ifx11, ify11, idx21, idy21, idx12, idy12; - J2dTraceLn8(J2D_TRACE_INFO, - "MTLRenderer_DrawAAParallelogram " - "(x=%6.2f y=%6.2f " - "dx1=%6.2f dy1=%6.2f lwr1=%6.2f " - "dx2=%6.2f dy2=%6.2f lwr2=%6.2f)", - fx11, fy11, - dx21, dy21, lwr21, - dx12, dy12, lwr12); + J2dTraceLn(J2D_TRACE_INFO, + "MTLRenderer_DrawAAParallelogram " + "(x=%6.2f y=%6.2f " + "dx1=%6.2f dy1=%6.2f lwr1=%6.2f " + "dx2=%6.2f dy2=%6.2f lwr2=%6.2f)", + fx11, fy11, + dx21, dy21, lwr21, + dx12, dy12, lwr12); RETURN_IF_NULL(mtlc); RETURN_IF_NULL(dstOps); diff --git a/src/java.desktop/macosx/native/libawt_lwawt/java2d/metal/MTLSurfaceData.m b/src/java.desktop/macosx/native/libawt_lwawt/java2d/metal/MTLSurfaceData.m index f6f6635dacc..fe86b924677 100644 --- a/src/java.desktop/macosx/native/libawt_lwawt/java2d/metal/MTLSurfaceData.m +++ b/src/java.desktop/macosx/native/libawt_lwawt/java2d/metal/MTLSurfaceData.m @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2019, 2025, 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 @@ -42,7 +42,9 @@ static jboolean MTLSurfaceData_initTexture(BMTLSDOps *bmtlsdo, jboolean isOpaque return JNI_FALSE; } if (width <= 0 || height <= 0) { - J2dRlsTraceLn2(J2D_TRACE_ERROR, "MTLSurfaceData_initTexture: texture dimensions is incorrect, w=%d, h=%d", width, height); + J2dRlsTraceLn(J2D_TRACE_ERROR, + "MTLSurfaceData_initTexture: texture dimensions is incorrect, w=%d, h=%d", + width, height); return JNI_FALSE; } @@ -62,8 +64,9 @@ static jboolean MTLSurfaceData_initTexture(BMTLSDOps *bmtlsdo, jboolean isOpaque width = (width <= MTL_GPU_FAMILY_MAC_TXT_SIZE) ? width : 0; height = (height <= MTL_GPU_FAMILY_MAC_TXT_SIZE) ? height : 0; - J2dTraceLn3(J2D_TRACE_VERBOSE, " desired texture dimensions: w=%d h=%d max=%d", - width, height, MTL_GPU_FAMILY_MAC_TXT_SIZE); + J2dTraceLn(J2D_TRACE_VERBOSE, + " desired texture dimensions: w=%d h=%d max=%d", + width, height, MTL_GPU_FAMILY_MAC_TXT_SIZE); // if either dimension is 0, we cannot allocate a texture with the // requested dimensions @@ -93,7 +96,9 @@ static jboolean MTLSurfaceData_initTexture(BMTLSDOps *bmtlsdo, jboolean isOpaque bmtlsdo->height = height; bmtlsdo->drawableType = rtt ? MTLSD_RT_TEXTURE : MTLSD_TEXTURE; - J2dTraceLn6(J2D_TRACE_VERBOSE, "MTLSurfaceData_initTexture: w=%d h=%d bp=%p [tex=%p] opaque=%d rtt=%d", width, height, bmtlsdo, bmtlsdo->pTexture, isOpaque, rtt); + J2dTraceLn(J2D_TRACE_VERBOSE, + "MTLSurfaceData_initTexture: w=%d h=%d bp=%p [tex=%p] opaque=%d rtt=%d", + width, height, bmtlsdo, bmtlsdo->pTexture, isOpaque, rtt); return JNI_TRUE; } } @@ -167,7 +172,8 @@ static jboolean MTLSurfaceData_initTexture(BMTLSDOps *bmtlsdo, jboolean isOpaque void MTLSD_Delete(JNIEnv *env, BMTLSDOps *bmtlsdo) { - J2dTraceLn3(J2D_TRACE_VERBOSE, "MTLSD_Delete: type=%d %p [tex=%p]", bmtlsdo->drawableType, bmtlsdo, bmtlsdo->pTexture); + J2dTraceLn(J2D_TRACE_VERBOSE, "MTLSD_Delete: type=%d %p [tex=%p]", + bmtlsdo->drawableType, bmtlsdo, bmtlsdo->pTexture); if (bmtlsdo->drawableType == MTLSD_WINDOW) { bmtlsdo->drawableType = MTLSD_UNDEFINED; } else if ( @@ -275,7 +281,8 @@ static jboolean MTLSurfaceData_initTexture(BMTLSDOps *bmtlsdo, jboolean isOpaque bmtlsdo->height = surfaceBounds.size.height; JNI_COCOA_EXIT(env); - J2dTraceLn2(J2D_TRACE_VERBOSE, " created window: w=%d h=%d", bmtlsdo->width, bmtlsdo->height); + J2dTraceLn(J2D_TRACE_VERBOSE, " created window: w=%d h=%d", + bmtlsdo->width, bmtlsdo->height); return JNI_TRUE; } @@ -301,10 +308,10 @@ static jboolean MTLSurfaceData_initTexture(BMTLSDOps *bmtlsdo, jboolean isOpaque return; } - J2dTraceLn1(J2D_TRACE_INFO, "MTLSurfaceData_initOps p=%p", bmtlsdo); - J2dTraceLn1(J2D_TRACE_INFO, " pPeerData=%p", jlong_to_ptr(pPeerData)); - J2dTraceLn1(J2D_TRACE_INFO, " layerPtr=%p", jlong_to_ptr(layerPtr)); - J2dTraceLn2(J2D_TRACE_INFO, " xoff=%d, yoff=%d", (int)xoff, (int)yoff); + J2dTraceLn(J2D_TRACE_INFO, "MTLSurfaceData_initOps p=%p", bmtlsdo); + J2dTraceLn(J2D_TRACE_INFO, " pPeerData=%p", jlong_to_ptr(pPeerData)); + J2dTraceLn(J2D_TRACE_INFO, " layerPtr=%p", jlong_to_ptr(layerPtr)); + J2dTraceLn(J2D_TRACE_INFO, " xoff=%d, yoff=%d", (int)xoff, (int)yoff); gc = (*env)->NewGlobalRef(env, gc); if (gc == NULL) { diff --git a/src/java.desktop/macosx/native/libawt_lwawt/java2d/metal/MTLTextRenderer.m b/src/java.desktop/macosx/native/libawt_lwawt/java2d/metal/MTLTextRenderer.m index a52d32a5dea..b57e384b37e 100644 --- a/src/java.desktop/macosx/native/libawt_lwawt/java2d/metal/MTLTextRenderer.m +++ b/src/java.desktop/macosx/native/libawt_lwawt/java2d/metal/MTLTextRenderer.m @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2019, 2025, 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 @@ -263,8 +263,8 @@ jfloat clr[4]; jint col = cPaint.color; - J2dTraceLn2(J2D_TRACE_INFO, "primary color %x, contrast %d", col, contrast); - J2dTraceLn2(J2D_TRACE_INFO, "gamma %f, invgamma %f", gamma, invgamma); + J2dTraceLn(J2D_TRACE_INFO, "primary color %x, contrast %d", col, contrast); + J2dTraceLn(J2D_TRACE_INFO, "gamma %f, invgamma %f", gamma, invgamma); clr[0] = ((col >> 16) & 0xFF)/255.0f; clr[1] = ((col >> 8) & 0xFF)/255.0f; @@ -439,8 +439,8 @@ static void DisableColorGlyphPainting(MTLContext *mtlc) { tx2 = cell->tx2; ty2 = cell->ty2; - J2dTraceLn4(J2D_TRACE_INFO, "tx1 = %f, ty1 = %f, tx2 = %f, ty2 = %f", tx1, ty1, tx2, ty2); - J2dTraceLn2(J2D_TRACE_INFO, "width = %d height = %d", dstOps->width, dstOps->height); + J2dTraceLn(J2D_TRACE_INFO, "tx1 = %f, ty1 = %f, tx2 = %f, ty2 = %f", tx1, ty1, tx2, ty2); + J2dTraceLn(J2D_TRACE_INFO, "width = %d height = %d", dstOps->width, dstOps->height); LCD_ADD_TRIANGLES(tx1, ty1, tx2, ty2, x, y, x+w, y+h); @@ -490,7 +490,9 @@ static void DisableColorGlyphPainting(MTLContext *mtlc) { for (sx = 0; sx < w; sx += tw, x += tw) { sw = ((sx + tw) > w) ? (w - sx) : tw; - J2dTraceLn7(J2D_TRACE_INFO, "sx = %d sy = %d x = %d y = %d sw = %d sh = %d w = %d", sx, sy, x, y, sw, sh, w); + J2dTraceLn(J2D_TRACE_INFO, + "sx = %d sy = %d x = %d y = %d sw = %d sh = %d w = %d", + sx, sy, x, y, sw, sh, w); MTLVertexCache_AddMaskQuad(mtlc, sx, sy, x, y, sw, sh, w, ginfo->image, @@ -514,8 +516,10 @@ static void DisableColorGlyphPainting(MTLContext *mtlc) { jint h = ginfo->height; id blitTexture = nil; - J2dTraceLn2(J2D_TRACE_INFO, "MTLTR_DrawLCDGlyphNoCache x %d, y%d", x, y); - J2dTraceLn3(J2D_TRACE_INFO, "MTLTR_DrawLCDGlyphNoCache rowBytesOffset=%d, rgbOrder=%d, contrast=%d", rowBytesOffset, rgbOrder, contrast); + J2dTraceLn(J2D_TRACE_INFO, "MTLTR_DrawLCDGlyphNoCache x %d, y%d", x, y); + J2dTraceLn(J2D_TRACE_INFO, + "MTLTR_DrawLCDGlyphNoCache rowBytesOffset=%d, rgbOrder=%d, contrast=%d", + rowBytesOffset, rgbOrder, contrast); id encoder = nil; @@ -578,7 +582,9 @@ static void DisableColorGlyphPainting(MTLContext *mtlc) { tx2 = 1.0f; ty2 = 1.0f; - J2dTraceLn2(J2D_TRACE_INFO, "MTLTR_DrawLCDGlyphNoCache : dstOps->width = %d, dstOps->height = %d", dstOps->width, dstOps->height); + J2dTraceLn(J2D_TRACE_INFO, + "MTLTR_DrawLCDGlyphNoCache : dstOps->width = %d, dstOps->height = %d", + dstOps->width, dstOps->height); LCD_ADD_TRIANGLES(tx1, ty1, tx2, ty2, x, y, x+w, y+h); @@ -673,7 +679,7 @@ static void DisableColorGlyphPainting(MTLContext *mtlc) { } glyphMode = MODE_NOT_INITED; - J2dTraceLn1(J2D_TRACE_INFO, "totalGlyphs = %d", totalGlyphs); + J2dTraceLn(J2D_TRACE_INFO, "totalGlyphs = %d", totalGlyphs); jboolean flushBeforeLCD = JNI_FALSE; for (glyphCounter = 0; glyphCounter < totalGlyphs; glyphCounter++) { @@ -711,8 +717,8 @@ static void DisableColorGlyphPainting(MTLContext *mtlc) { continue; } - J2dTraceLn2(J2D_TRACE_INFO, "Glyph width = %d height = %d", ginfo->width, ginfo->height); - J2dTraceLn1(J2D_TRACE_INFO, "rowBytes = %d", ginfo->rowBytes); + J2dTraceLn(J2D_TRACE_INFO, "Glyph width = %d height = %d", ginfo->width, ginfo->height); + J2dTraceLn(J2D_TRACE_INFO, "rowBytes = %d", ginfo->rowBytes); if (ginfo->rowBytes == ginfo->width) { // grayscale or monochrome glyph data if (ginfo->width <= MTLTR_CACHE_CELL_WIDTH && diff --git a/src/java.desktop/macosx/native/libawt_lwawt/java2d/metal/MTLTexurePool.m b/src/java.desktop/macosx/native/libawt_lwawt/java2d/metal/MTLTexurePool.m index 87c489fd11d..b9ec4263024 100644 --- a/src/java.desktop/macosx/native/libawt_lwawt/java2d/metal/MTLTexurePool.m +++ b/src/java.desktop/macosx/native/libawt_lwawt/java2d/metal/MTLTexurePool.m @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2019, 2025, 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 @@ -371,7 +371,8 @@ - (MTLPooledTextureHandle *) getTexture:(int)width height:(int)height format:(MT const int newCellHeight = cellY1 <= _poolCellHeight ? _poolCellHeight : cellY1; const int newCellsCount = newCellWidth*newCellHeight; #ifdef DEBUG - J2dTraceLn2(J2D_TRACE_VERBOSE, "MTLTexturePool: resize: %d -> %d", _poolCellWidth * _poolCellHeight, newCellsCount); + J2dTraceLn(J2D_TRACE_VERBOSE, "MTLTexturePool: resize: %d -> %d", + _poolCellWidth * _poolCellHeight, newCellsCount); #endif void ** newcells = malloc(newCellsCount*sizeof(void*)); const int strideBytes = _poolCellWidth * sizeof(void*); @@ -425,7 +426,9 @@ - (MTLPooledTextureHandle *) getTexture:(int)width height:(int)height format:(MT } minDeltaTpi = [cell createItem:device width:width height:height format:format isMultiSample:isMultiSample]; _memoryTotalAllocated += requestedBytes; - J2dTraceLn5(J2D_TRACE_VERBOSE, "MTLTexturePool: created pool item: tex=%p, w=%d h=%d, pf=%d | total memory = %d Kb", minDeltaTpi.texture, width, height, format, _memoryTotalAllocated/1024); + J2dTraceLn(J2D_TRACE_VERBOSE, "MTLTexturePool: created pool item: "\ + "tex=%p, w=%d h=%d, pf=%d | total memory = %d Kb", + minDeltaTpi.texture, width, height, format, _memoryTotalAllocated/1024); } minDeltaTpi.isBusy = YES; diff --git a/src/java.desktop/macosx/native/libawt_lwawt/java2d/metal/MTLVertexCache.m b/src/java.desktop/macosx/native/libawt_lwawt/java2d/metal/MTLVertexCache.m index 61870120ed3..e94ea306c47 100644 --- a/src/java.desktop/macosx/native/libawt_lwawt/java2d/metal/MTLVertexCache.m +++ b/src/java.desktop/macosx/native/libawt_lwawt/java2d/metal/MTLVertexCache.m @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2019, 2025, 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 @@ -95,8 +95,9 @@ atIndex:MeshVertexBuffer]; [encoder setFragmentTexture:maskCacheTex.texture atIndex: 0]; - J2dTraceLn1(J2D_TRACE_INFO, - "MTLVertexCache_FlushVertexCache : encode %d characters", (vertexCacheIndex / 6)); + J2dTraceLn(J2D_TRACE_INFO, + "MTLVertexCache_FlushVertexCache : encode %d characters", + (vertexCacheIndex / 6)); [encoder drawPrimitives:MTLPrimitiveTypeTriangle vertexStart:0 vertexCount:vertexCacheIndex]; } vertexCacheIndex = 0; @@ -119,8 +120,9 @@ atIndex:MeshVertexBuffer]; id glyphCacheTex = MTLTR_GetGlyphCacheTexture(); [encoder setFragmentTexture:glyphCacheTex atIndex: 0]; - J2dTraceLn1(J2D_TRACE_INFO, - "MTLVertexCache_FlushGlyphVertexCache : encode %d characters", (vertexCacheIndex / 6)); + J2dTraceLn(J2D_TRACE_INFO, + "MTLVertexCache_FlushGlyphVertexCache : encode %d characters", + (vertexCacheIndex / 6)); [encoder drawPrimitives:MTLPrimitiveTypeTriangle vertexStart:0 vertexCount:vertexCacheIndex]; } vertexCacheIndex = 0; @@ -220,8 +222,8 @@ void MTLVertexCache_FreeVertexCache() jfloat tx1, ty1, tx2, ty2; jfloat dx1, dy1, dx2, dy2; - J2dTraceLn1(J2D_TRACE_INFO, "MTLVertexCache_AddMaskQuad: %d", - maskCacheIndex); + J2dTraceLn(J2D_TRACE_INFO, "MTLVertexCache_AddMaskQuad: %d", + maskCacheIndex); // MTLVC_ADD_TRIANGLES at the end of this function // will place VERTS_FOR_A_QUAD vertexes to the vertex cache @@ -229,7 +231,8 @@ void MTLVertexCache_FreeVertexCache() if ((maskCacheIndex >= MTLVC_MASK_CACHE_MAX_INDEX) || ((vertexCacheIndex + VERTS_FOR_A_QUAD) >= MTLVC_MAX_INDEX)) { - J2dTraceLn2(J2D_TRACE_INFO, "maskCacheIndex = %d, vertexCacheIndex = %d", maskCacheIndex, vertexCacheIndex); + J2dTraceLn(J2D_TRACE_INFO, "maskCacheIndex = %d, vertexCacheIndex = %d", + maskCacheIndex, vertexCacheIndex); MTLVertexCache_FlushVertexCache(mtlc); MTLVertexCache_EnableMaskCache(mtlc, dstOps); maskCacheIndex = 0; @@ -240,8 +243,9 @@ void MTLVertexCache_FreeVertexCache() (maskCacheIndex % MTLVC_MASK_CACHE_WIDTH_IN_TILES); jint texy = MTLVC_MASK_CACHE_TILE_HEIGHT * (maskCacheIndex / MTLVC_MASK_CACHE_WIDTH_IN_TILES); - J2dTraceLn5(J2D_TRACE_INFO, "texx = %d texy = %d width = %d height = %d maskscan = %d", texx, texy, width, - height, maskscan); + J2dTraceLn(J2D_TRACE_INFO, + "texx = %d texy = %d width = %d height = %d maskscan = %d", + texx, texy, width, height, maskscan); NSUInteger bytesPerRow = 1 * width; NSUInteger slice = bytesPerRow * srcy + srcx; MTLRegion region = { @@ -271,9 +275,9 @@ void MTLVertexCache_FreeVertexCache() char tile[size]; dst_offset = 0; for (int i = srcy; i < srcy + height; i++) { - J2dTraceLn2(J2D_TRACE_INFO, "srcx = %d srcy = %d", srcx, srcy); + J2dTraceLn(J2D_TRACE_INFO, "srcx = %d srcy = %d", srcx, srcy); src_offset = maskscan * i + srcx; - J2dTraceLn2(J2D_TRACE_INFO, "src_offset = %d dst_offset = %d", src_offset, dst_offset); + J2dTraceLn(J2D_TRACE_INFO, "src_offset = %d dst_offset = %d", src_offset, dst_offset); memcpy(tile + dst_offset, mask + src_offset, width); dst_offset = dst_offset + width; } @@ -301,7 +305,9 @@ void MTLVertexCache_FreeVertexCache() dx2 = dx1 + width; dy2 = dy1 + height; - J2dTraceLn8(J2D_TRACE_INFO, "tx1 = %f ty1 = %f tx2 = %f ty2 = %f dx1 = %f dy1 = %f dx2 = %f dy2 = %f", tx1, ty1, tx2, ty2, dx1, dy1, dx2, dy2); + J2dTraceLn(J2D_TRACE_INFO, + "tx1 = %f ty1 = %f tx2 = %f ty2 = %f dx1 = %f dy1 = %f dx2 = %f dy2 = %f", + tx1, ty1, tx2, ty2, dx1, dy1, dx2, dy2); MTLVC_ADD_TRIANGLES(tx1, ty1, tx2, ty2, dx1, dy1, dx2, dy2); } @@ -317,7 +323,8 @@ void MTLVertexCache_FreeVertexCache() // so need to check space for VERTS_FOR_A_QUAD elements if ((vertexCacheIndex + VERTS_FOR_A_QUAD) >= MTLVC_MAX_INDEX) { - J2dTraceLn2(J2D_TRACE_INFO, "maskCacheIndex = %d, vertexCacheIndex = %d", maskCacheIndex, vertexCacheIndex); + J2dTraceLn(J2D_TRACE_INFO, "maskCacheIndex = %d, vertexCacheIndex = %d", + maskCacheIndex, vertexCacheIndex); MTLVertexCache_FlushGlyphVertexCache(); } diff --git a/src/java.desktop/macosx/native/libawt_lwawt/java2d/opengl/CGLGraphicsConfig.m b/src/java.desktop/macosx/native/libawt_lwawt/java2d/opengl/CGLGraphicsConfig.m index 9ffaba58c02..ff512247e20 100644 --- a/src/java.desktop/macosx/native/libawt_lwawt/java2d/opengl/CGLGraphicsConfig.m +++ b/src/java.desktop/macosx/native/libawt_lwawt/java2d/opengl/CGLGraphicsConfig.m @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011, 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2011, 2025, 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 @@ -220,7 +220,7 @@ [NSOpenGLContext clearCurrentContext]; return; } - J2dRlsTraceLn1(J2D_TRACE_INFO, "CGLGraphicsConfig_getCGLConfigInfo: OpenGL version=%s", versionstr); + J2dRlsTraceLn(J2D_TRACE_INFO, "CGLGraphicsConfig_getCGLConfigInfo: OpenGL version=%s", versionstr); jint caps = CAPS_EMPTY; OGLContext_GetExtensionInfo(env, &caps); @@ -234,9 +234,9 @@ caps |= CAPS_DOUBLEBUFFERED; } - J2dRlsTraceLn1(J2D_TRACE_INFO, - "CGLGraphicsConfig_getCGLConfigInfo: db=%d", - (caps & CAPS_DOUBLEBUFFERED) != 0); + J2dRlsTraceLn(J2D_TRACE_INFO, + "CGLGraphicsConfig_getCGLConfigInfo: db=%d", + (caps & CAPS_DOUBLEBUFFERED) != 0); // remove before shipping (?) #if 1 diff --git a/src/java.desktop/macosx/native/libawt_lwawt/java2d/opengl/CGLSurfaceData.m b/src/java.desktop/macosx/native/libawt_lwawt/java2d/opengl/CGLSurfaceData.m index b90d4ff00ea..e9aac4de7fe 100644 --- a/src/java.desktop/macosx/native/libawt_lwawt/java2d/opengl/CGLSurfaceData.m +++ b/src/java.desktop/macosx/native/libawt_lwawt/java2d/opengl/CGLSurfaceData.m @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011, 2019, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2011, 2025, 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 @@ -199,7 +199,8 @@ extern CGLError CGLTexImageIOSurface2D( CGLSDOps *dstCGLOps = (CGLSDOps *)dstOps->privOps; - J2dTraceLn4(J2D_TRACE_VERBOSE, " src: %d %p dst: %d %p", srcOps->drawableType, srcOps, dstOps->drawableType, dstOps); + J2dTraceLn(J2D_TRACE_VERBOSE, " src: %d %p dst: %d %p", + srcOps->drawableType, srcOps, dstOps->drawableType, dstOps); OGLContext *oglc = dstCGLOps->configInfo->context; if (oglc == NULL) { @@ -292,7 +293,7 @@ extern CGLError CGLTexImageIOSurface2D( oglsdo->height = surfaceBounds.size.height; JNI_COCOA_EXIT(env); - J2dTraceLn2(J2D_TRACE_VERBOSE, " created window: w=%d h=%d", oglsdo->width, oglsdo->height); + J2dTraceLn(J2D_TRACE_VERBOSE, " created window: w=%d h=%d", oglsdo->width, oglsdo->height); return JNI_TRUE; } @@ -338,8 +339,8 @@ extern CGLError CGLTexImageIOSurface2D( jint xoff, jint yoff, jboolean isOpaque) { J2dTraceLn(J2D_TRACE_INFO, "CGLSurfaceData_initOps"); - J2dTraceLn1(J2D_TRACE_INFO, " pPeerData=%p", jlong_to_ptr(pPeerData)); - J2dTraceLn2(J2D_TRACE_INFO, " xoff=%d, yoff=%d", (int)xoff, (int)yoff); + J2dTraceLn(J2D_TRACE_INFO, " pPeerData=%p", jlong_to_ptr(pPeerData)); + J2dTraceLn(J2D_TRACE_INFO, " xoff=%d, yoff=%d", (int)xoff, (int)yoff); gc = (*env)->NewGlobalRef(env, gc); if (gc == NULL) { diff --git a/src/java.desktop/share/classes/com/sun/java/swing/plaf/gtk/GTKFileChooserUI.java b/src/java.desktop/share/classes/com/sun/java/swing/plaf/gtk/GTKFileChooserUI.java index 19d77115025..4f18dc84f4a 100644 --- a/src/java.desktop/share/classes/com/sun/java/swing/plaf/gtk/GTKFileChooserUI.java +++ b/src/java.desktop/share/classes/com/sun/java/swing/plaf/gtk/GTKFileChooserUI.java @@ -1120,6 +1120,9 @@ public Component getListCellRendererComponent(JList list, Object value, int i if (showFileIcons) { setIcon(getFileChooser().getIcon((File)value)); } + + putClientProperty("html.disable", getFileChooser().getClientProperty("html.disable")); + return this; } } @@ -1137,6 +1140,9 @@ public Component getListCellRendererComponent(JList list, Object value, int i } else { setText(getFileChooser().getName((File)value) + "/"); } + + putClientProperty("html.disable", getFileChooser().getClientProperty("html.disable")); + return this; } } diff --git a/src/java.desktop/share/classes/com/sun/media/sound/AbstractMidiDevice.java b/src/java.desktop/share/classes/com/sun/media/sound/AbstractMidiDevice.java index d8a404f500e..0cd5591b7c0 100644 --- a/src/java.desktop/share/classes/com/sun/media/sound/AbstractMidiDevice.java +++ b/src/java.desktop/share/classes/com/sun/media/sound/AbstractMidiDevice.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1999, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1999, 2025, 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 @@ -561,10 +561,7 @@ private void add(Transmitter t) { private void remove(Transmitter t) { synchronized(transmitters) { - int index = transmitters.indexOf(t); - if (index >= 0) { - transmitters.remove(index); - } + transmitters.remove(t); } } diff --git a/src/java.desktop/share/classes/java/awt/HeadlessException.java b/src/java.desktop/share/classes/java/awt/HeadlessException.java index 749f1d15d00..cff97ee8c3c 100644 --- a/src/java.desktop/share/classes/java/awt/HeadlessException.java +++ b/src/java.desktop/share/classes/java/awt/HeadlessException.java @@ -48,7 +48,9 @@ public class HeadlessException extends UnsupportedOperationException { private static final long serialVersionUID = 167183644944358563L; /** - * Constructs new {@code HeadlessException} with empty message. + * Constructs a new {@code HeadlessException} with {@code null} as its detail message. + * The default headless message may replace {@code null} in some cases, as outlined below. + *

    * For such {@code HeadlessException} the default headless error message * may be auto-generated for some platforms. * The text of the default headless message may depend on diff --git a/src/java.desktop/share/classes/javax/sound/midi/Track.java b/src/java.desktop/share/classes/javax/sound/midi/Track.java index 0de4ccfa6e0..71ff8b0730e 100644 --- a/src/java.desktop/share/classes/javax/sound/midi/Track.java +++ b/src/java.desktop/share/classes/javax/sound/midi/Track.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1999, 2017, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1999, 2025, 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 @@ -198,15 +198,8 @@ public boolean remove(MidiEvent event) { // Or: document that the ticks() length will not be reduced // by deleting events (unless the EOT event is removed) synchronized(eventsList) { - if (set.remove(event)) { - int i = eventsList.indexOf(event); - if (i >= 0) { - eventsList.remove(i); - return true; - } - } + return set.remove(event) && eventsList.remove(event); } - return false; } /** diff --git a/src/java.desktop/share/classes/javax/swing/KeyboardManager.java b/src/java.desktop/share/classes/javax/swing/KeyboardManager.java index 5028f19caf2..2ba5749dcdc 100644 --- a/src/java.desktop/share/classes/javax/swing/KeyboardManager.java +++ b/src/java.desktop/share/classes/javax/swing/KeyboardManager.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1998, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1998, 2025, 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 @@ -118,9 +118,6 @@ public void registerKeyStroke(KeyStroke k, JComponent c) { v.addElement(c); keyMap.put(k, v); } - } else { - System.out.println("Unexpected condition in registerKeyStroke"); - Thread.dumpStack(); } componentKeyStrokeMap.put(new ComponentKeyStrokePair(c,k), topContainer); @@ -208,11 +205,6 @@ public void unregisterKeyStroke(KeyStroke ks, JComponent c) { @SuppressWarnings("deprecation") public boolean fireKeyboardAction(KeyEvent e, boolean pressed, Container topAncestor) { - if (e.isConsumed()) { - System.out.println("Acquired pre-used event!"); - Thread.dumpStack(); - } - // There may be two keystrokes associated with a low-level key event; // in this case a keystroke made of an extended key code has a priority. KeyStroke ks; @@ -266,10 +258,6 @@ public boolean fireKeyboardAction(KeyEvent e, boolean pressed, Container topAnce return true; } } - } else { - System.out.println( "Unexpected condition in fireKeyboardAction " + tmp); - // This means that tmp wasn't null, a JComponent, or a Vector. What is it? - Thread.dumpStack(); } } diff --git a/src/java.desktop/share/classes/javax/swing/plaf/basic/BasicPasswordFieldUI.java b/src/java.desktop/share/classes/javax/swing/plaf/basic/BasicPasswordFieldUI.java index 6a78e2d6871..ce3b699b886 100644 --- a/src/java.desktop/share/classes/javax/swing/plaf/basic/BasicPasswordFieldUI.java +++ b/src/java.desktop/share/classes/javax/swing/plaf/basic/BasicPasswordFieldUI.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2006, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2025, 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 @@ -91,23 +91,4 @@ protected void installDefaults() { public View create(Element elem) { return new PasswordView(elem); } - - /** - * Create the action map for Password Field. This map provides - * same actions for double mouse click and - * and for triple mouse click (see bug 4231444). - */ - - ActionMap createActionMap() { - ActionMap map = super.createActionMap(); - if (map.get(DefaultEditorKit.selectWordAction) != null) { - Action a = map.get(DefaultEditorKit.selectLineAction); - if (a != null) { - map.remove(DefaultEditorKit.selectWordAction); - map.put(DefaultEditorKit.selectWordAction, a); - } - } - return map; - } - } diff --git a/src/java.desktop/share/classes/javax/swing/plaf/basic/BasicTextUI.java b/src/java.desktop/share/classes/javax/swing/plaf/basic/BasicTextUI.java index ec0fbaf9928..094f5be68c5 100644 --- a/src/java.desktop/share/classes/javax/swing/plaf/basic/BasicTextUI.java +++ b/src/java.desktop/share/classes/javax/swing/plaf/basic/BasicTextUI.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2025, 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 @@ -647,6 +647,22 @@ ActionMap createActionMap() { TransferHandler.getCopyAction()); map.put(TransferHandler.getPasteAction().getValue(Action.NAME), TransferHandler.getPasteAction()); + + if (getComponent() instanceof JPasswordField) { + // Edit the action map for Password Field. This map provides + // same actions for double mouse click and + // and for triple mouse click (see bugs 4231444, 8354646). + + if (map.get(DefaultEditorKit.selectWordAction) != null) { + map.remove(DefaultEditorKit.selectWordAction); + + Action a = map.get(DefaultEditorKit.selectLineAction); + if (a != null) { + map.put(DefaultEditorKit.selectWordAction, a); + } + } + } + return map; } diff --git a/src/java.desktop/share/classes/javax/swing/plaf/synth/SynthPasswordFieldUI.java b/src/java.desktop/share/classes/javax/swing/plaf/synth/SynthPasswordFieldUI.java index 083a118c209..dbdeac3da1f 100644 --- a/src/java.desktop/share/classes/javax/swing/plaf/synth/SynthPasswordFieldUI.java +++ b/src/java.desktop/share/classes/javax/swing/plaf/synth/SynthPasswordFieldUI.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2002, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2002, 2025, 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 @@ -108,19 +108,4 @@ public void paintBorder(SynthContext context, Graphics g, int x, int y, int w, int h) { context.getPainter().paintPasswordFieldBorder(context, g, x, y, w, h); } - - /** - * {@inheritDoc} - */ - @Override - protected void installKeyboardActions() { - super.installKeyboardActions(); - ActionMap map = SwingUtilities.getUIActionMap(getComponent()); - if (map != null && map.get(DefaultEditorKit.selectWordAction) != null) { - Action a = map.get(DefaultEditorKit.selectLineAction); - if (a != null) { - map.put(DefaultEditorKit.selectWordAction, a); - } - } - } } diff --git a/src/java.desktop/share/classes/sun/awt/AWTAutoShutdown.java b/src/java.desktop/share/classes/sun/awt/AWTAutoShutdown.java index 5a81de507db..d60211ae318 100644 --- a/src/java.desktop/share/classes/sun/awt/AWTAutoShutdown.java +++ b/src/java.desktop/share/classes/sun/awt/AWTAutoShutdown.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2025, 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 @@ -358,8 +358,7 @@ void registerPeer(final Object target, final Object peer) { void unregisterPeer(final Object target, final Object peer) { synchronized (activationLock) { synchronized (mainLock) { - if (peerMap.get(target) == peer) { - peerMap.remove(target); + if (peerMap.remove(target, peer)) { notifyPeerMapUpdated(); } } diff --git a/src/java.desktop/share/native/common/font/AccelGlyphCache.c b/src/java.desktop/share/native/common/font/AccelGlyphCache.c index 67729ad7ec3..37ca924a78e 100644 --- a/src/java.desktop/share/native/common/font/AccelGlyphCache.c +++ b/src/java.desktop/share/native/common/font/AccelGlyphCache.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2025, 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 @@ -319,8 +319,8 @@ AccelGlyphCache_AddCellInfo(GlyphInfo *glyph, CacheCellInfo *cellInfo) { // assert (glyph != NULL && cellInfo != NULL) J2dTraceLn(J2D_TRACE_INFO, "AccelGlyphCache_AddCellInfo"); - J2dTraceLn2(J2D_TRACE_VERBOSE, " glyph 0x%x: adding cell 0x%x to the list", - glyph, cellInfo); + J2dTraceLn(J2D_TRACE_VERBOSE, " glyph 0x%x: adding cell 0x%x to the list", + glyph, cellInfo); cellInfo->glyphInfo = glyph; cellInfo->nextGCI = glyph->cellInfo; @@ -340,8 +340,8 @@ AccelGlyphCache_RemoveCellInfo(GlyphInfo *glyph, CacheCellInfo *cellInfo) J2dTraceLn(J2D_TRACE_INFO, "AccelGlyphCache_RemoveCellInfo"); do { if (currCellInfo == cellInfo) { - J2dTraceLn2(J2D_TRACE_VERBOSE, - " glyph 0x%x: removing cell 0x%x from glyph's list", + J2dTraceLn(J2D_TRACE_VERBOSE, + " glyph 0x%x: removing cell 0x%x from glyph's list", glyph, currCellInfo); if (prevInfo == NULL) { // it's the head, chop-chop glyph->cellInfo = currCellInfo->nextGCI; @@ -355,9 +355,9 @@ AccelGlyphCache_RemoveCellInfo(GlyphInfo *glyph, CacheCellInfo *cellInfo) prevInfo = currCellInfo; currCellInfo = currCellInfo->nextGCI; } while (currCellInfo != NULL); - J2dTraceLn2(J2D_TRACE_WARNING, "AccelGlyphCache_RemoveCellInfo: "\ - "no cell 0x%x in glyph 0x%x's cell list", - cellInfo, glyph); + J2dTraceLn(J2D_TRACE_WARNING, "AccelGlyphCache_RemoveCellInfo: "\ + "no cell 0x%x in glyph 0x%x's cell list", + cellInfo, glyph); } /** @@ -400,16 +400,16 @@ AccelGlyphCache_GetCellInfoForCache(GlyphInfo *glyph, GlyphCacheInfo *cache) CacheCellInfo *cellInfo = glyph->cellInfo; do { if (cellInfo->cacheInfo == cache) { - J2dTraceLn3(J2D_TRACE_VERBOSE2, - " glyph 0x%x: found cell 0x%x for cache 0x%x", - glyph, cellInfo, cache); + J2dTraceLn(J2D_TRACE_VERBOSE2, + " glyph 0x%x: found cell 0x%x for cache 0x%x", + glyph, cellInfo, cache); return cellInfo; } cellInfo = cellInfo->nextGCI; } while (cellInfo != NULL); } - J2dTraceLn2(J2D_TRACE_VERBOSE2, " glyph 0x%x: no cell for cache 0x%x", - glyph, cache); + J2dTraceLn(J2D_TRACE_VERBOSE2, " glyph 0x%x: no cell for cache 0x%x", + glyph, cache); return NULL; } diff --git a/src/java.desktop/share/native/common/java2d/opengl/OGLBlitLoops.c b/src/java.desktop/share/native/common/java2d/opengl/OGLBlitLoops.c index 8e577e11788..d2579f7b653 100644 --- a/src/java.desktop/share/native/common/java2d/opengl/OGLBlitLoops.c +++ b/src/java.desktop/share/native/common/java2d/opengl/OGLBlitLoops.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2019, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2025, 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 @@ -497,11 +497,11 @@ OGLBlitLoops_IsoBlit(JNIEnv *env, sy2 = srcInfo.bounds.y2; } - J2dTraceLn2(J2D_TRACE_VERBOSE, " texture=%d hint=%d", texture, hint); - J2dTraceLn4(J2D_TRACE_VERBOSE, " sx1=%d sy1=%d sx2=%d sy2=%d", - sx1, sy1, sx2, sy2); - J2dTraceLn4(J2D_TRACE_VERBOSE, " dx1=%f dy1=%f dx2=%f dy2=%f", - dx1, dy1, dx2, dy2); + J2dTraceLn(J2D_TRACE_VERBOSE, " texture=%d hint=%d", texture, hint); + J2dTraceLn(J2D_TRACE_VERBOSE, " sx1=%d sy1=%d sx2=%d sy2=%d", + sx1, sy1, sx2, sy2); + J2dTraceLn(J2D_TRACE_VERBOSE, " dx1=%f dy1=%f dx2=%f dy2=%f", + dx1, dy1, dx2, dy2); if (texture) { GLint glhint = (hint == OGLSD_XFORM_BILINEAR) ? GL_LINEAR : @@ -625,12 +625,12 @@ OGLBlitLoops_Blit(JNIEnv *env, sy2 = srcInfo.bounds.y2; } - J2dTraceLn3(J2D_TRACE_VERBOSE, " texture=%d srctype=%d hint=%d", - texture, srctype, hint); - J2dTraceLn4(J2D_TRACE_VERBOSE, " sx1=%d sy1=%d sx2=%d sy2=%d", - sx1, sy1, sx2, sy2); - J2dTraceLn4(J2D_TRACE_VERBOSE, " dx1=%f dy1=%f dx2=%f dy2=%f", - dx1, dy1, dx2, dy2); + J2dTraceLn(J2D_TRACE_VERBOSE, " texture=%d srctype=%d hint=%d", + texture, srctype, hint); + J2dTraceLn(J2D_TRACE_VERBOSE, " sx1=%d sy1=%d sx2=%d sy2=%d", + sx1, sy1, sx2, sy2); + J2dTraceLn(J2D_TRACE_VERBOSE, " dx1=%f dy1=%f dx2=%f dy2=%f", + dx1, dy1, dx2, dy2); // Note: we will calculate x/y positions in the raster manually j2d_glPixelStorei(GL_UNPACK_SKIP_PIXELS, 0); @@ -821,10 +821,10 @@ OGLBlitLoops_SurfaceToSwBlit(JNIEnv *env, OGLContext *oglc, } #endif - J2dTraceLn4(J2D_TRACE_VERBOSE, " sx=%d sy=%d w=%d h=%d", - srcx, srcy, width, height); - J2dTraceLn2(J2D_TRACE_VERBOSE, " dx=%d dy=%d", - dstx, dsty); + J2dTraceLn(J2D_TRACE_VERBOSE, " sx=%d sy=%d w=%d h=%d", + srcx, srcy, width, height); + J2dTraceLn(J2D_TRACE_VERBOSE, " dx=%d dy=%d", + dstx, dsty); // this accounts for lower-left origin of the source region srcx = srcOps->xOffset + srcx; @@ -864,10 +864,10 @@ OGLBlitLoops_CopyArea(JNIEnv *env, RETURN_IF_NULL(dstOps); RESET_PREVIOUS_OP(); - J2dTraceLn4(J2D_TRACE_VERBOSE, " x=%d y=%d w=%d h=%d", - x, y, width, height); - J2dTraceLn2(J2D_TRACE_VERBOSE, " dx=%d dy=%d", - dx, dy); + J2dTraceLn(J2D_TRACE_VERBOSE, " x=%d y=%d w=%d h=%d", + x, y, width, height); + J2dTraceLn(J2D_TRACE_VERBOSE, " dx=%d dy=%d", + dx, dy); srcBounds.x1 = x; srcBounds.y1 = y; diff --git a/src/java.desktop/share/native/common/java2d/opengl/OGLBufImgOps.c b/src/java.desktop/share/native/common/java2d/opengl/OGLBufImgOps.c index b1b216287a5..ee08b4cd600 100644 --- a/src/java.desktop/share/native/common/java2d/opengl/OGLBufImgOps.c +++ b/src/java.desktop/share/native/common/java2d/opengl/OGLBufImgOps.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2007, 2025, 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 @@ -135,9 +135,9 @@ OGLBufImgOps_CreateConvolveProgram(jint flags) char edge[100]; char finalSource[2000]; - J2dTraceLn1(J2D_TRACE_INFO, - "OGLBufImgOps_CreateConvolveProgram: flags=%d", - flags); + J2dTraceLn(J2D_TRACE_INFO, + "OGLBufImgOps_CreateConvolveProgram: flags=%d", + flags); if (IS_SET(CONVOLVE_EDGE_ZERO_FILL)) { // EDGE_ZERO_FILL: fill in zero at the edges @@ -189,9 +189,9 @@ OGLBufImgOps_EnableConvolveOp(OGLContext *oglc, jlong pSrcOps, GLint loc; jint flags = 0; - J2dTraceLn2(J2D_TRACE_INFO, - "OGLBufImgOps_EnableConvolveOp: kernelW=%d kernelH=%d", - kernelWidth, kernelHeight); + J2dTraceLn(J2D_TRACE_INFO, + "OGLBufImgOps_EnableConvolveOp: kernelW=%d kernelH=%d", + kernelWidth, kernelHeight); RETURN_IF_NULL(oglc); RETURN_IF_NULL(srcOps); @@ -350,9 +350,9 @@ OGLBufImgOps_CreateRescaleProgram(jint flags) char *postRescale = ""; char finalSource[2000]; - J2dTraceLn1(J2D_TRACE_INFO, - "OGLBufImgOps_CreateRescaleProgram: flags=%d", - flags); + J2dTraceLn(J2D_TRACE_INFO, + "OGLBufImgOps_CreateRescaleProgram: flags=%d", + flags); if (IS_SET(RESCALE_NON_PREMULT)) { preRescale = "srcColor.rgb /= srcColor.a;"; @@ -572,9 +572,9 @@ OGLBufImgOps_CreateLookupProgram(jint flags) char *postLookup = ""; char finalSource[2000]; - J2dTraceLn1(J2D_TRACE_INFO, - "OGLBufImgOps_CreateLookupProgram: flags=%d", - flags); + J2dTraceLn(J2D_TRACE_INFO, + "OGLBufImgOps_CreateLookupProgram: flags=%d", + flags); if (IS_SET(LOOKUP_USE_SRC_ALPHA)) { // when numComps is 1 or 3, the alpha is not looked up in the table; @@ -632,9 +632,9 @@ OGLBufImgOps_EnableLookupOp(OGLContext *oglc, jlong pSrcOps, int i; jint flags = 0; - J2dTraceLn4(J2D_TRACE_INFO, - "OGLBufImgOps_EnableLookupOp: short=%d num=%d len=%d off=%d", - shortData, numBands, bandLength, offset); + J2dTraceLn(J2D_TRACE_INFO, + "OGLBufImgOps_EnableLookupOp: short=%d num=%d len=%d off=%d", + shortData, numBands, bandLength, offset); for (i = 0; i < 4; i++) { bands[i] = NULL; diff --git a/src/java.desktop/share/native/common/java2d/opengl/OGLContext.c b/src/java.desktop/share/native/common/java2d/opengl/OGLContext.c index 89c3af32b1d..8e1211bda95 100644 --- a/src/java.desktop/share/native/common/java2d/opengl/OGLContext.c +++ b/src/java.desktop/share/native/common/java2d/opengl/OGLContext.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2004, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2004, 2025, 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 @@ -87,11 +87,11 @@ OGLContext_SetViewport(OGLSDOps *srcOps, OGLSDOps *dstOps) jint width = dstOps->width; jint height = dstOps->height; - J2dTraceLn4(J2D_TRACE_INFO, - "OGLContext_SetViewport: w=%d h=%d read=%s draw=%s", - width, height, - OGLC_ACTIVE_BUFFER_NAME(srcOps->activeBuffer), - OGLC_ACTIVE_BUFFER_NAME(dstOps->activeBuffer)); + J2dTraceLn(J2D_TRACE_INFO, + "OGLContext_SetViewport: w=%d h=%d read=%s draw=%s", + width, height, + OGLC_ACTIVE_BUFFER_NAME(srcOps->activeBuffer), + OGLC_ACTIVE_BUFFER_NAME(dstOps->activeBuffer)); // set the viewport and projection matrix j2d_glViewport(dstOps->xOffset, dstOps->yOffset, @@ -162,8 +162,8 @@ OGLContext_SetSurfaces(JNIEnv *env, jlong pSrc, jlong pDst) return NULL; } - J2dTraceLn2(J2D_TRACE_VERBOSE, " srctype=%d dsttype=%d", - srcOps->drawableType, dstOps->drawableType); + J2dTraceLn(J2D_TRACE_VERBOSE, " srctype=%d dsttype=%d", + srcOps->drawableType, dstOps->drawableType); if (dstOps->drawableType == OGLSD_TEXTURE) { J2dRlsTraceLn(J2D_TRACE_ERROR, @@ -230,9 +230,9 @@ OGLContext_SetRectClip(OGLContext *oglc, OGLSDOps *dstOps, jint width = x2 - x1; jint height = y2 - y1; - J2dTraceLn4(J2D_TRACE_INFO, - "OGLContext_SetRectClip: x=%d y=%d w=%d h=%d", - x1, y1, width, height); + J2dTraceLn(J2D_TRACE_INFO, + "OGLContext_SetRectClip: x=%d y=%d w=%d h=%d", + x1, y1, width, height); RETURN_IF_NULL(dstOps); RETURN_IF_NULL(oglc); @@ -335,7 +335,7 @@ OGLContext_EndShapeClip(OGLContext *oglc, OGLSDOps *dstOps) void OGLContext_SetExtraAlpha(jfloat ea) { - J2dTraceLn1(J2D_TRACE_INFO, "OGLContext_SetExtraAlpha: ea=%f", ea); + J2dTraceLn(J2D_TRACE_INFO, "OGLContext_SetExtraAlpha: ea=%f", ea); j2d_glPixelTransferf(GL_ALPHA_SCALE, ea); j2d_glPixelTransferf(GL_RED_SCALE, ea); @@ -377,8 +377,8 @@ void OGLContext_SetAlphaComposite(OGLContext *oglc, jint rule, jfloat extraAlpha, jint flags) { - J2dTraceLn1(J2D_TRACE_INFO, - "OGLContext_SetAlphaComposite: flags=%d", flags); + J2dTraceLn(J2D_TRACE_INFO, + "OGLContext_SetAlphaComposite: flags=%d", flags); RETURN_IF_NULL(oglc); CHECK_PREVIOUS_OP(OGL_STATE_CHANGE); @@ -398,12 +398,12 @@ OGLContext_SetAlphaComposite(OGLContext *oglc, (extraAlpha == 1.0f) && (flags & OGLC_SRC_IS_OPAQUE)) { - J2dTraceLn1(J2D_TRACE_VERBOSE, - " disabling alpha comp: rule=%d ea=1.0 src=opq", rule); + J2dTraceLn(J2D_TRACE_VERBOSE, + " disabling alpha comp: rule=%d ea=1.0 src=opq", rule); j2d_glDisable(GL_BLEND); } else { - J2dTraceLn2(J2D_TRACE_VERBOSE, - " enabling alpha comp: rule=%d ea=%f", rule, extraAlpha); + J2dTraceLn(J2D_TRACE_VERBOSE, + " enabling alpha comp: rule=%d ea=%f", rule, extraAlpha); j2d_glEnable(GL_BLEND); j2d_glBlendFunc(StdBlendRules[rule].src, StdBlendRules[rule].dst); } @@ -421,8 +421,8 @@ OGLContext_SetAlphaComposite(OGLContext *oglc, void OGLContext_SetXorComposite(OGLContext *oglc, jint xorPixel) { - J2dTraceLn1(J2D_TRACE_INFO, - "OGLContext_SetXorComposite: xorPixel=%08x", xorPixel); + J2dTraceLn(J2D_TRACE_INFO, + "OGLContext_SetXorComposite: xorPixel=%08x", xorPixel); RETURN_IF_NULL(oglc); CHECK_PREVIOUS_OP(OGL_STATE_CHANGE); @@ -497,12 +497,12 @@ OGLContext_SetTransform(OGLContext *oglc, oglc->xformMatrix[12] = m02; oglc->xformMatrix[13] = m12; - J2dTraceLn3(J2D_TRACE_VERBOSE, " [%lf %lf %lf]", - oglc->xformMatrix[0], oglc->xformMatrix[4], - oglc->xformMatrix[12]); - J2dTraceLn3(J2D_TRACE_VERBOSE, " [%lf %lf %lf]", - oglc->xformMatrix[1], oglc->xformMatrix[5], - oglc->xformMatrix[13]); + J2dTraceLn(J2D_TRACE_VERBOSE, " [%lf %lf %lf]", + oglc->xformMatrix[0], oglc->xformMatrix[4], + oglc->xformMatrix[12]); + J2dTraceLn(J2D_TRACE_VERBOSE, " [%lf %lf %lf]", + oglc->xformMatrix[1], oglc->xformMatrix[5], + oglc->xformMatrix[13]); j2d_glMatrixMode(GL_MODELVIEW); j2d_glLoadMatrixd(oglc->xformMatrix); @@ -634,9 +634,9 @@ OGLContext_IsExtensionAvailable(const char *extString, char *extName) p += (n + 1); } - J2dRlsTraceLn2(J2D_TRACE_INFO, - "OGLContext_IsExtensionAvailable: %s=%s", - extName, ret ? "true" : "false"); + J2dRlsTraceLn(J2D_TRACE_INFO, + "OGLContext_IsExtensionAvailable: %s=%s", + extName, ret ? "true" : "false"); return ret; } @@ -751,9 +751,9 @@ OGLContext_IsLCDShaderSupportAvailable(JNIEnv *env, // of texture units j2d_glGetIntegerv(GL_MAX_TEXTURE_IMAGE_UNITS_ARB, &maxTexUnits); if (maxTexUnits < 2) { - J2dRlsTraceLn1(J2D_TRACE_INFO, - "OGLContext_IsLCDShaderSupportAvailable: not enough tex units (%d)", - maxTexUnits); + J2dRlsTraceLn(J2D_TRACE_INFO, + "OGLContext_IsLCDShaderSupportAvailable: not enough tex units (%d)", + maxTexUnits); } J2dRlsTraceLn(J2D_TRACE_INFO, @@ -981,9 +981,9 @@ OGLContext_CreateFragmentProgram(const char *fragmentShaderSource) if (infoLogLength > 1) { char infoLog[1024]; j2d_glGetInfoLogARB(fragmentShader, 1024, NULL, infoLog); - J2dRlsTraceLn2(J2D_TRACE_WARNING, - "OGLContext_CreateFragmentProgram: compiler msg (%d):\n%s", - infoLogLength, infoLog); + J2dRlsTraceLn(J2D_TRACE_WARNING, + "OGLContext_CreateFragmentProgram: compiler msg (%d):\n%s", + infoLogLength, infoLog); } if (!success) { @@ -1013,9 +1013,9 @@ OGLContext_CreateFragmentProgram(const char *fragmentShaderSource) if (infoLogLength > 1) { char infoLog[1024]; j2d_glGetInfoLogARB(fragmentProgram, 1024, NULL, infoLog); - J2dRlsTraceLn2(J2D_TRACE_WARNING, - "OGLContext_CreateFragmentProgram: linker msg (%d):\n%s", - infoLogLength, infoLog); + J2dRlsTraceLn(J2D_TRACE_WARNING, + "OGLContext_CreateFragmentProgram: linker msg (%d):\n%s", + infoLogLength, infoLog); } if (!success) { @@ -1063,7 +1063,7 @@ JNIEXPORT jstring JNICALL Java_sun_java2d_opengl_OGLContext_getOGLIdString jio_snprintf(pAdapterId, len, "%s %s (%s)", vendor, renderer, version); - J2dTraceLn1(J2D_TRACE_VERBOSE, " id=%s", pAdapterId); + J2dTraceLn(J2D_TRACE_VERBOSE, " id=%s", pAdapterId); ret = JNU_NewStringPlatform(env, pAdapterId); diff --git a/src/java.desktop/share/native/common/java2d/opengl/OGLFuncs.h b/src/java.desktop/share/native/common/java2d/opengl/OGLFuncs.h index 427c91da2b0..0d24616c2ba 100644 --- a/src/java.desktop/share/native/common/java2d/opengl/OGLFuncs.h +++ b/src/java.desktop/share/native/common/java2d/opengl/OGLFuncs.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2025, 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 @@ -181,7 +181,7 @@ typedef void (GLAPIENTRY *glTextureBarrierNVType) (void); * REMIND: this caused an internal error in the MS compiler!?!? * *#define OGL_CHECK_FUNC_ERR(f) \ - * J2dTrace1(J2D_TRACE_ERROR, "could not load function: %s", #f) + * J2dTrace(J2D_TRACE_ERROR, "could not load function: %s", #f) */ #define OGL_CHECK_FUNC_ERR(f) \ diff --git a/src/java.desktop/share/native/common/java2d/opengl/OGLMaskFill.c b/src/java.desktop/share/native/common/java2d/opengl/OGLMaskFill.c index dcb4cff2323..c8310116dcb 100644 --- a/src/java.desktop/share/native/common/java2d/opengl/OGLMaskFill.c +++ b/src/java.desktop/share/native/common/java2d/opengl/OGLMaskFill.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2006, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2025, 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 @@ -94,9 +94,9 @@ OGLMaskFill_MaskFill(OGLContext *oglc, RETURN_IF_NULL(oglc); CHECK_PREVIOUS_OP(OGL_STATE_MASK_OP); - J2dTraceLn4(J2D_TRACE_VERBOSE, " x=%d y=%d w=%d h=%d", x, y, w, h); - J2dTraceLn2(J2D_TRACE_VERBOSE, " maskoff=%d maskscan=%d", - maskoff, maskscan); + J2dTraceLn(J2D_TRACE_VERBOSE, " x=%d y=%d w=%d h=%d", x, y, w, h); + J2dTraceLn(J2D_TRACE_VERBOSE, " maskoff=%d maskscan=%d", + maskoff, maskscan); { jint tw, th, x0; diff --git a/src/java.desktop/share/native/common/java2d/opengl/OGLPaints.c b/src/java.desktop/share/native/common/java2d/opengl/OGLPaints.c index 89f02cf67fb..4c7b4e04578 100644 --- a/src/java.desktop/share/native/common/java2d/opengl/OGLPaints.c +++ b/src/java.desktop/share/native/common/java2d/opengl/OGLPaints.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2007, 2025, 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 @@ -44,7 +44,7 @@ OGLPaints_ResetPaint(OGLContext *oglc) J2dTraceLn(J2D_TRACE_INFO, "OGLPaints_ResetPaint"); RETURN_IF_NULL(oglc); - J2dTraceLn1(J2D_TRACE_VERBOSE, " state=%d", oglc->paintState); + J2dTraceLn(J2D_TRACE_VERBOSE, " state=%d", oglc->paintState); RESET_PREVIOUS_OP(); if (oglc->useMask) { @@ -102,7 +102,7 @@ OGLPaints_SetColor(OGLContext *oglc, jint pixel) { jubyte r, g, b, a; - J2dTraceLn1(J2D_TRACE_INFO, "OGLPaints_SetColor: pixel=%08x", pixel); + J2dTraceLn(J2D_TRACE_INFO, "OGLPaints_SetColor: pixel=%08x", pixel); RETURN_IF_NULL(oglc); @@ -123,9 +123,9 @@ OGLPaints_SetColor(OGLContext *oglc, jint pixel) b = (jubyte)(pixel >> 0); a = (jubyte)(pixel >> 24); - J2dTraceLn4(J2D_TRACE_VERBOSE, - " updating color: r=%02x g=%02x b=%02x a=%02x", - r, g, b, a); + J2dTraceLn(J2D_TRACE_VERBOSE, + " updating color: r=%02x g=%02x b=%02x a=%02x", + r, g, b, a); } else { pixel ^= oglc->xorPixel; @@ -134,9 +134,9 @@ OGLPaints_SetColor(OGLContext *oglc, jint pixel) b = (jubyte)(pixel >> 0); a = 0xff; - J2dTraceLn4(J2D_TRACE_VERBOSE, - " updating xor color: r=%02x g=%02x b=%02x xorpixel=%08x", - r, g, b, oglc->xorPixel); + J2dTraceLn(J2D_TRACE_VERBOSE, + " updating xor color: r=%02x g=%02x b=%02x xorpixel=%08x", + r, g, b, oglc->xorPixel); } j2d_glColor4ub(r, g, b, a); @@ -704,9 +704,9 @@ OGLPaints_CreateLinearGradProgram(jint flags) char *paintVars; char *distCode; - J2dTraceLn1(J2D_TRACE_INFO, - "OGLPaints_CreateLinearGradProgram", - flags); + J2dTraceLn(J2D_TRACE_INFO, + "OGLPaints_CreateLinearGradProgram", + flags); /* * To simplify the code and to make it easier to upload a number of @@ -808,9 +808,9 @@ OGLPaints_CreateRadialGradProgram(jint flags) char *paintVars; char *distCode; - J2dTraceLn1(J2D_TRACE_INFO, - "OGLPaints_CreateRadialGradProgram", - flags); + J2dTraceLn(J2D_TRACE_INFO, + "OGLPaints_CreateRadialGradProgram", + flags); /* * To simplify the code and to make it easier to upload a number of diff --git a/src/java.desktop/share/native/common/java2d/opengl/OGLRenderQueue.c b/src/java.desktop/share/native/common/java2d/opengl/OGLRenderQueue.c index 6328707a3e2..2bafc33f588 100644 --- a/src/java.desktop/share/native/common/java2d/opengl/OGLRenderQueue.c +++ b/src/java.desktop/share/native/common/java2d/opengl/OGLRenderQueue.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005, 2019, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2005, 2025, 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 @@ -73,8 +73,8 @@ Java_sun_java2d_opengl_OGLRenderQueue_flushBuffer jboolean sync = JNI_FALSE; unsigned char *b, *end; - J2dTraceLn1(J2D_TRACE_INFO, - "OGLRenderQueue_flushBuffer: limit=%d", limit); + J2dTraceLn(J2D_TRACE_INFO, + "OGLRenderQueue_flushBuffer: limit=%d", limit); b = (unsigned char *)jlong_to_ptr(buf); if (b == NULL) { @@ -89,9 +89,9 @@ Java_sun_java2d_opengl_OGLRenderQueue_flushBuffer while (b < end) { jint opcode = NEXT_INT(b); - J2dTraceLn2(J2D_TRACE_VERBOSE, - "OGLRenderQueue_flushBuffer: opcode=%d, rem=%d", - opcode, (end-b)); + J2dTraceLn(J2D_TRACE_VERBOSE, + "OGLRenderQueue_flushBuffer: opcode=%d, rem=%d", + opcode, (end-b)); switch (opcode) { @@ -667,8 +667,9 @@ Java_sun_java2d_opengl_OGLRenderQueue_flushBuffer break; default: - J2dRlsTraceLn1(J2D_TRACE_ERROR, - "OGLRenderQueue_flushBuffer: invalid opcode=%d", opcode); + J2dRlsTraceLn(J2D_TRACE_ERROR, + "OGLRenderQueue_flushBuffer: invalid opcode=%d", + opcode); if (oglc != NULL) { RESET_PREVIOUS_OP(); } @@ -756,8 +757,8 @@ OGLRenderQueue_CheckPreviousOp(jint op) return; } - J2dTraceLn1(J2D_TRACE_VERBOSE, - "OGLRenderQueue_CheckPreviousOp: new op=%d", op); + J2dTraceLn(J2D_TRACE_VERBOSE, + "OGLRenderQueue_CheckPreviousOp: new op=%d", op); switch (previousOp) { case GL_TEXTURE_2D: diff --git a/src/java.desktop/share/native/common/java2d/opengl/OGLRenderQueue.h b/src/java.desktop/share/native/common/java2d/opengl/OGLRenderQueue.h index 88bd4e5448d..2f2692313dc 100644 --- a/src/java.desktop/share/native/common/java2d/opengl/OGLRenderQueue.h +++ b/src/java.desktop/share/native/common/java2d/opengl/OGLRenderQueue.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005, 2008, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2005, 2025, 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 @@ -114,8 +114,8 @@ */ #define ACT_IF_NULL(ACTION, value) \ if ((value) == NULL) { \ - J2dTraceLn1(J2D_TRACE_ERROR, \ - "%s is null", #value); \ + J2dTraceLn(J2D_TRACE_ERROR, \ + "%s is null", #value); \ ACTION; \ } else do { } while (0) #define RETURN_IF_NULL(value) ACT_IF_NULL(return, value) diff --git a/src/java.desktop/share/native/common/java2d/opengl/OGLRenderer.c b/src/java.desktop/share/native/common/java2d/opengl/OGLRenderer.c index fa303643ed7..88f18b6cda2 100644 --- a/src/java.desktop/share/native/common/java2d/opengl/OGLRenderer.c +++ b/src/java.desktop/share/native/common/java2d/opengl/OGLRenderer.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2008, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2025, 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 @@ -341,14 +341,14 @@ OGLRenderer_FillParallelogram(OGLContext *oglc, jfloat dx21, jfloat dy21, jfloat dx12, jfloat dy12) { - J2dTraceLn6(J2D_TRACE_INFO, - "OGLRenderer_FillParallelogram " - "(x=%6.2f y=%6.2f " - "dx1=%6.2f dy1=%6.2f " - "dx2=%6.2f dy2=%6.2f)", - fx11, fy11, - dx21, dy21, - dx12, dy12); + J2dTraceLn(J2D_TRACE_INFO, + "OGLRenderer_FillParallelogram " + "(x=%6.2f y=%6.2f " + "dx1=%6.2f dy1=%6.2f " + "dx2=%6.2f dy2=%6.2f)", + fx11, fy11, + dx21, dy21, + dx12, dy12); RETURN_IF_NULL(oglc); @@ -374,14 +374,14 @@ OGLRenderer_DrawParallelogram(OGLContext *oglc, jfloat ox11 = fx11 - (ldx21 + ldx12) / 2.0f; jfloat oy11 = fy11 - (ldy21 + ldy12) / 2.0f; - J2dTraceLn8(J2D_TRACE_INFO, - "OGLRenderer_DrawParallelogram " - "(x=%6.2f y=%6.2f " - "dx1=%6.2f dy1=%6.2f lwr1=%6.2f " - "dx2=%6.2f dy2=%6.2f lwr2=%6.2f)", - fx11, fy11, - dx21, dy21, lwr21, - dx12, dy12, lwr12); + J2dTraceLn(J2D_TRACE_INFO, + "OGLRenderer_DrawParallelogram " + "(x=%6.2f y=%6.2f " + "dx1=%6.2f dy1=%6.2f lwr1=%6.2f " + "dx2=%6.2f dy2=%6.2f lwr2=%6.2f)", + fx11, fy11, + dx21, dy21, lwr21, + dx12, dy12, lwr12); RETURN_IF_NULL(oglc); @@ -596,14 +596,14 @@ OGLRenderer_FillAAParallelogram(OGLContext *oglc, OGLSDOps *dstOps, // parameters for uv texture coordinates of parallelogram corners jfloat u11, v11, u12, v12, u21, v21, u22, v22; - J2dTraceLn6(J2D_TRACE_INFO, - "OGLRenderer_FillAAParallelogram " - "(x=%6.2f y=%6.2f " - "dx1=%6.2f dy1=%6.2f " - "dx2=%6.2f dy2=%6.2f)", - fx11, fy11, - dx21, dy21, - dx12, dy12); + J2dTraceLn(J2D_TRACE_INFO, + "OGLRenderer_FillAAParallelogram " + "(x=%6.2f y=%6.2f " + "dx1=%6.2f dy1=%6.2f " + "dx2=%6.2f dy2=%6.2f)", + fx11, fy11, + dx21, dy21, + dx12, dy12); RETURN_IF_NULL(oglc); RETURN_IF_NULL(dstOps); @@ -731,14 +731,14 @@ OGLRenderer_DrawAAParallelogram(OGLContext *oglc, OGLSDOps *dstOps, // parameters for "inner" parallelogram jfloat ifx11, ify11, idx21, idy21, idx12, idy12; - J2dTraceLn8(J2D_TRACE_INFO, - "OGLRenderer_DrawAAParallelogram " - "(x=%6.2f y=%6.2f " - "dx1=%6.2f dy1=%6.2f lwr1=%6.2f " - "dx2=%6.2f dy2=%6.2f lwr2=%6.2f)", - fx11, fy11, - dx21, dy21, lwr21, - dx12, dy12, lwr12); + J2dTraceLn(J2D_TRACE_INFO, + "OGLRenderer_DrawAAParallelogram " + "(x=%6.2f y=%6.2f " + "dx1=%6.2f dy1=%6.2f lwr1=%6.2f " + "dx2=%6.2f dy2=%6.2f lwr2=%6.2f)", + fx11, fy11, + dx21, dy21, lwr21, + dx12, dy12, lwr12); RETURN_IF_NULL(oglc); RETURN_IF_NULL(dstOps); diff --git a/src/java.desktop/share/native/common/java2d/opengl/OGLSurfaceData.c b/src/java.desktop/share/native/common/java2d/opengl/OGLSurfaceData.c index f7b0f85fe06..8639c4193cf 100644 --- a/src/java.desktop/share/native/common/java2d/opengl/OGLSurfaceData.c +++ b/src/java.desktop/share/native/common/java2d/opengl/OGLSurfaceData.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2025, 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 @@ -142,9 +142,9 @@ OGLSD_InitTextureObject(OGLSDOps *oglsdo, GLsizei texWidth, texHeight, realWidth, realHeight; GLint texMax; - J2dTraceLn4(J2D_TRACE_INFO, - "OGLSD_InitTextureObject: w=%d h=%d opq=%d nonpow2=%d", - width, height, isOpaque, texNonPow2); + J2dTraceLn(J2D_TRACE_INFO, + "OGLSD_InitTextureObject: w=%d h=%d opq=%d nonpow2=%d", + width, height, isOpaque, texNonPow2); if (oglsdo == NULL) { J2dRlsTraceLn(J2D_TRACE_ERROR, @@ -175,9 +175,9 @@ OGLSD_InitTextureObject(OGLSDOps *oglsdo, texProxyTarget = GL_PROXY_TEXTURE_2D; } - J2dTraceLn3(J2D_TRACE_VERBOSE, - " desired texture dimensions: w=%d h=%d max=%d", - texWidth, texHeight, texMax); + J2dTraceLn(J2D_TRACE_VERBOSE, + " desired texture dimensions: w=%d h=%d max=%d", + texWidth, texHeight, texMax); // if either dimension is 0, we cannot allocate a texture with the // requested dimensions @@ -200,9 +200,8 @@ OGLSD_InitTextureObject(OGLSDOps *oglsdo, // if the requested dimensions and proxy dimensions don't match, // we shouldn't attempt to create the texture if ((realWidth != texWidth) || (realHeight != texHeight)) { - J2dRlsTraceLn2(J2D_TRACE_ERROR, - "OGLSD_InitTextureObject: actual (w=%d h=%d) != requested", - realWidth, realHeight); + J2dRlsTraceLn(J2D_TRACE_ERROR, "OGLSD_InitTextureObject: "\ + "actual (w=%d h=%d) != requested", realWidth, realHeight); return JNI_FALSE; } @@ -227,8 +226,8 @@ OGLSD_InitTextureObject(OGLSDOps *oglsdo, OGLSD_INIT_TEXTURE_FILTER(oglsdo, GL_NEAREST); OGLSD_RESET_TEXTURE_WRAP(texTarget); - J2dTraceLn3(J2D_TRACE_VERBOSE, " created texture: w=%d h=%d id=%d", - width, height, texID); + J2dTraceLn(J2D_TRACE_VERBOSE, " created texture: w=%d h=%d id=%d", + width, height, texID); return JNI_TRUE; } @@ -246,8 +245,8 @@ Java_sun_java2d_opengl_OGLSurfaceData_initTexture { OGLSDOps *oglsdo = (OGLSDOps *)jlong_to_ptr(pData); - J2dTraceLn2(J2D_TRACE_INFO, "OGLSurfaceData_initTexture: w=%d h=%d", - width, height); + J2dTraceLn(J2D_TRACE_INFO, "OGLSurfaceData_initTexture: w=%d h=%d", + width, height); if (oglsdo == NULL) { J2dRlsTraceLn(J2D_TRACE_ERROR, @@ -306,8 +305,8 @@ OGLSD_InitFBObject(GLuint *fbobjectID, GLuint *depthID, jboolean foundDepth = JNI_FALSE; int i; - J2dTraceLn3(J2D_TRACE_INFO, "OGLSD_InitFBObject: w=%d h=%d texid=%d", - textureWidth, textureHeight, textureID); + J2dTraceLn(J2D_TRACE_INFO, "OGLSD_InitFBObject: w=%d h=%d texid=%d", + textureWidth, textureHeight, textureID); // initialize framebuffer object j2d_glGenFramebuffersEXT(1, &fboTmpID); @@ -334,9 +333,9 @@ OGLSD_InitFBObject(GLuint *fbobjectID, GLuint *depthID, // creation of depth buffer could potentially fail, so check for error error = j2d_glGetError(); if (error != GL_NO_ERROR) { - J2dTraceLn2(J2D_TRACE_VERBOSE, - "OGLSD_InitFBObject: could not create depth buffer: depth=%d error=%x", - depthSize, error); + J2dTraceLn(J2D_TRACE_VERBOSE, "OGLSD_InitFBObject: "\ + "could not create depth buffer: depth=%d error=%x", + depthSize, error); j2d_glDeleteRenderbuffersEXT(1, &depthTmpID); continue; } @@ -351,15 +350,15 @@ OGLSD_InitFBObject(GLuint *fbobjectID, GLuint *depthID, if (status == GL_FRAMEBUFFER_COMPLETE_EXT) { // we found a valid format, so break out of the loop - J2dTraceLn1(J2D_TRACE_VERBOSE, - " framebuffer is complete: depth=%d", depthSize); + J2dTraceLn(J2D_TRACE_VERBOSE, + " framebuffer is complete: depth=%d", depthSize); foundDepth = JNI_TRUE; break; } else { // this depth format didn't work, so delete and try another format - J2dTraceLn2(J2D_TRACE_VERBOSE, - " framebuffer is incomplete: depth=%d status=%x", - depthSize, status); + J2dTraceLn(J2D_TRACE_VERBOSE, + " framebuffer is incomplete: depth=%d status=%x", + depthSize, status); j2d_glDeleteRenderbuffersEXT(1, &depthTmpID); } } @@ -398,9 +397,9 @@ Java_sun_java2d_opengl_OGLSurfaceData_initFBObject OGLSDOps *oglsdo = (OGLSDOps *)jlong_to_ptr(pData); GLuint fbobjectID, depthID; - J2dTraceLn2(J2D_TRACE_INFO, - "OGLSurfaceData_initFBObject: w=%d h=%d", - width, height); + J2dTraceLn(J2D_TRACE_INFO, + "OGLSurfaceData_initFBObject: w=%d h=%d", + width, height); if (oglsdo == NULL) { J2dRlsTraceLn(J2D_TRACE_ERROR, @@ -555,8 +554,8 @@ OGLSD_SetNativeDimensions(JNIEnv *env, OGLSDOps *oglsdo, void OGLSD_Delete(JNIEnv *env, OGLSDOps *oglsdo) { - J2dTraceLn1(J2D_TRACE_INFO, "OGLSD_Delete: type=%d", - oglsdo->drawableType); + J2dTraceLn(J2D_TRACE_INFO, "OGLSD_Delete: type=%d", + oglsdo->drawableType); if (oglsdo->drawableType == OGLSD_TEXTURE) { if (oglsdo->textureID != 0) { diff --git a/src/java.desktop/share/native/common/java2d/opengl/OGLTextRenderer.c b/src/java.desktop/share/native/common/java2d/opengl/OGLTextRenderer.c index 19389066f87..118015bf8f6 100644 --- a/src/java.desktop/share/native/common/java2d/opengl/OGLTextRenderer.c +++ b/src/java.desktop/share/native/common/java2d/opengl/OGLTextRenderer.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2025, 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 @@ -347,8 +347,8 @@ OGLTR_UpdateLCDTextContrast(jint contrast) double ig = 1.0 / g; GLint loc; - J2dTraceLn1(J2D_TRACE_INFO, - "OGLTR_UpdateLCDTextContrast: contrast=%d", contrast); + J2dTraceLn(J2D_TRACE_INFO, + "OGLTR_UpdateLCDTextContrast: contrast=%d", contrast); loc = j2d_glGetUniformLocationARB(lcdTextProgram, "gamma"); j2d_glUniform3fARB(loc, g, g, g); @@ -376,8 +376,8 @@ OGLTR_UpdateLCDTextColor(jint contrast) GLfloat clr[4]; GLint loc; - J2dTraceLn1(J2D_TRACE_INFO, - "OGLTR_UpdateLCDTextColor: contrast=%d", contrast); + J2dTraceLn(J2D_TRACE_INFO, + "OGLTR_UpdateLCDTextColor: contrast=%d", contrast); /* * Note: Ideally we would update the "src_adj" uniform parameter only diff --git a/src/java.desktop/share/native/common/java2d/opengl/OGLVertexCache.c b/src/java.desktop/share/native/common/java2d/opengl/OGLVertexCache.c index 21d67705ec5..c63aad9f2d9 100644 --- a/src/java.desktop/share/native/common/java2d/opengl/OGLVertexCache.c +++ b/src/java.desktop/share/native/common/java2d/opengl/OGLVertexCache.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2007, 2025, 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 @@ -220,8 +220,8 @@ OGLVertexCache_AddMaskQuad(OGLContext *oglc, jfloat tx1, ty1, tx2, ty2; jfloat dx1, dy1, dx2, dy2; - J2dTraceLn1(J2D_TRACE_INFO, "OGLVertexCache_AddMaskQuad: %d", - maskCacheIndex); + J2dTraceLn(J2D_TRACE_INFO, "OGLVertexCache_AddMaskQuad: %d", + maskCacheIndex); if (maskCacheIndex >= OGLVC_MASK_CACHE_MAX_INDEX || vertexCacheIndex >= OGLVC_MAX_INDEX) diff --git a/src/java.desktop/share/native/libawt/java2d/Trace.h b/src/java.desktop/share/native/libawt/java2d/Trace.h index b4fe41f77b0..365042a3971 100644 --- a/src/java.desktop/share/native/libawt/java2d/Trace.h +++ b/src/java.desktop/share/native/libawt/java2d/Trace.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2008, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2025, 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 @@ -54,79 +54,13 @@ JNIEXPORT void JNICALL J2dTraceImpl(int level, jboolean cr, const char *string, ...); #ifndef DEBUG -#define J2dTrace(level, string) -#define J2dTrace1(level, string, arg1) -#define J2dTrace2(level, string, arg1, arg2) -#define J2dTrace3(level, string, arg1, arg2, arg3) -#define J2dTrace4(level, string, arg1, arg2, arg3, arg4) -#define J2dTrace5(level, string, arg1, arg2, arg3, arg4, arg5) -#define J2dTrace6(level, string, arg1, arg2, arg3, arg4, arg5, arg6) -#define J2dTrace7(level, string, arg1, arg2, arg3, arg4, arg5, arg6, arg7) -#define J2dTrace8(level, string, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8) -#define J2dTraceLn(level, string) -#define J2dTraceLn1(level, string, arg1) -#define J2dTraceLn2(level, string, arg1, arg2) -#define J2dTraceLn3(level, string, arg1, arg2, arg3) -#define J2dTraceLn4(level, string, arg1, arg2, arg3, arg4) -#define J2dTraceLn5(level, string, arg1, arg2, arg3, arg4, arg5) -#define J2dTraceLn6(level, string, arg1, arg2, arg3, arg4, arg5, arg6) -#define J2dTraceLn7(level, string, arg1, arg2, arg3, arg4, arg5, arg6, arg7) -#define J2dTraceLn8(level, string, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8) +#define J2dTrace(level, ...) +#define J2dTraceLn(level, ...) #else /* DEBUG */ -#define J2dTrace(level, string) { \ - J2dTraceImpl(level, JNI_FALSE, string); \ - } -#define J2dTrace1(level, string, arg1) { \ - J2dTraceImpl(level, JNI_FALSE, string, arg1); \ - } -#define J2dTrace2(level, string, arg1, arg2) { \ - J2dTraceImpl(level, JNI_FALSE, string, arg1, arg2); \ - } -#define J2dTrace3(level, string, arg1, arg2, arg3) { \ - J2dTraceImpl(level, JNI_FALSE, string, arg1, arg2, arg3); \ - } -#define J2dTrace4(level, string, arg1, arg2, arg3, arg4) { \ - J2dTraceImpl(level, JNI_FALSE, string, arg1, arg2, arg3, arg4); \ - } -#define J2dTrace5(level, string, arg1, arg2, arg3, arg4, arg5) { \ - J2dTraceImpl(level, JNI_FALSE, string, arg1, arg2, arg3, arg4, arg5); \ - } -#define J2dTrace6(level, string, arg1, arg2, arg3, arg4, arg5, arg6) { \ - J2dTraceImpl(level, JNI_FALSE, string, arg1, arg2, arg3, arg4, arg5, arg6); \ - } -#define J2dTrace7(level, string, arg1, arg2, arg3, arg4, arg5, arg6, arg7) { \ - J2dTraceImpl(level, JNI_FALSE, string, arg1, arg2, arg3, arg4, arg5, arg6, arg7); \ - } -#define J2dTrace8(level, string, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8) { \ - J2dTraceImpl(level, JNI_FALSE, string, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8); \ - } -#define J2dTraceLn(level, string) { \ - J2dTraceImpl(level, JNI_TRUE, string); \ - } -#define J2dTraceLn1(level, string, arg1) { \ - J2dTraceImpl(level, JNI_TRUE, string, arg1); \ - } -#define J2dTraceLn2(level, string, arg1, arg2) { \ - J2dTraceImpl(level, JNI_TRUE, string, arg1, arg2); \ - } -#define J2dTraceLn3(level, string, arg1, arg2, arg3) { \ - J2dTraceImpl(level, JNI_TRUE, string, arg1, arg2, arg3); \ - } -#define J2dTraceLn4(level, string, arg1, arg2, arg3, arg4) { \ - J2dTraceImpl(level, JNI_TRUE, string, arg1, arg2, arg3, arg4); \ - } -#define J2dTraceLn5(level, string, arg1, arg2, arg3, arg4, arg5) { \ - J2dTraceImpl(level, JNI_TRUE, string, arg1, arg2, arg3, arg4, arg5); \ - } -#define J2dTraceLn6(level, string, arg1, arg2, arg3, arg4, arg5, arg6) { \ - J2dTraceImpl(level, JNI_TRUE, string, arg1, arg2, arg3, arg4, arg5, arg6); \ - } -#define J2dTraceLn7(level, string, arg1, arg2, arg3, arg4, arg5, arg6, arg7) { \ - J2dTraceImpl(level, JNI_TRUE, string, arg1, arg2, arg3, arg4, arg5, arg6, arg7); \ - } -#define J2dTraceLn8(level, string, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8) { \ - J2dTraceImpl(level, JNI_TRUE, string, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8); \ - } +#define J2dTrace(level, ...) \ + J2dTraceImpl(level, JNI_FALSE, __VA_ARGS__) +#define J2dTraceLn(level, ...) \ + J2dTraceImpl(level, JNI_TRUE, __VA_ARGS__) #endif /* DEBUG */ @@ -136,42 +70,10 @@ J2dTraceImpl(int level, jboolean cr, const char *string, ...); * areas. */ -#define J2dRlsTrace(level, string) { \ - J2dTraceImpl(level, JNI_FALSE, string); \ - } -#define J2dRlsTrace1(level, string, arg1) { \ - J2dTraceImpl(level, JNI_FALSE, string, arg1); \ - } -#define J2dRlsTrace2(level, string, arg1, arg2) { \ - J2dTraceImpl(level, JNI_FALSE, string, arg1, arg2); \ - } -#define J2dRlsTrace3(level, string, arg1, arg2, arg3) { \ - J2dTraceImpl(level, JNI_FALSE, string, arg1, arg2, arg3); \ - } -#define J2dRlsTrace4(level, string, arg1, arg2, arg3, arg4) { \ - J2dTraceImpl(level, JNI_FALSE, string, arg1, arg2, arg3, arg4); \ - } -#define J2dRlsTrace5(level, string, arg1, arg2, arg3, arg4, arg5) { \ - J2dTraceImpl(level, JNI_FALSE, string, arg1, arg2, arg3, arg4, arg5); \ - } -#define J2dRlsTraceLn(level, string) { \ - J2dTraceImpl(level, JNI_TRUE, string); \ - } -#define J2dRlsTraceLn1(level, string, arg1) { \ - J2dTraceImpl(level, JNI_TRUE, string, arg1); \ - } -#define J2dRlsTraceLn2(level, string, arg1, arg2) { \ - J2dTraceImpl(level, JNI_TRUE, string, arg1, arg2); \ - } -#define J2dRlsTraceLn3(level, string, arg1, arg2, arg3) { \ - J2dTraceImpl(level, JNI_TRUE, string, arg1, arg2, arg3); \ - } -#define J2dRlsTraceLn4(level, string, arg1, arg2, arg3, arg4) { \ - J2dTraceImpl(level, JNI_TRUE, string, arg1, arg2, arg3, arg4); \ - } -#define J2dRlsTraceLn5(level, string, arg1, arg2, arg3, arg4, arg5) { \ - J2dTraceImpl(level, JNI_TRUE, string, arg1, arg2, arg3, arg4, arg5); \ - } +#define J2dRlsTrace(level, ...) \ + J2dTraceImpl(level, JNI_FALSE, __VA_ARGS__) +#define J2dRlsTraceLn(level, ...) \ + J2dTraceImpl(level, JNI_TRUE, __VA_ARGS__) #ifdef __cplusplus } diff --git a/src/java.desktop/share/native/libawt/java2d/loops/DrawParallelogram.c b/src/java.desktop/share/native/libawt/java2d/loops/DrawParallelogram.c index 6bff9ef8081..6f4caaaa7f2 100644 --- a/src/java.desktop/share/native/libawt/java2d/loops/DrawParallelogram.c +++ b/src/java.desktop/share/native/libawt/java2d/loops/DrawParallelogram.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2008, 2025, 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 @@ -274,10 +274,10 @@ Java_sun_java2d_loops_DrawParallelogram_DrawParallelogram } #ifdef DEBUG if ((numactive & 1) != 0) { - J2dTraceLn1(J2D_TRACE_ERROR, - "DrawParallelogram: " - "ODD NUMBER OF PGRAM EDGES (%d)!!", - numactive); + J2dTraceLn(J2D_TRACE_ERROR, + "DrawParallelogram: " + "ODD NUMBER OF PGRAM EDGES (%d)!!", + numactive); } #endif for (cur = 0; cur < numactive; cur += 2) { diff --git a/src/java.desktop/share/native/libawt/java2d/pipe/BufferedMaskBlit.c b/src/java.desktop/share/native/libawt/java2d/pipe/BufferedMaskBlit.c index b5ba039a237..77b7ec091c0 100644 --- a/src/java.desktop/share/native/libawt/java2d/pipe/BufferedMaskBlit.c +++ b/src/java.desktop/share/native/libawt/java2d/pipe/BufferedMaskBlit.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2007, 2025, 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 @@ -62,9 +62,9 @@ Java_sun_java2d_pipe_BufferedMaskBlit_enqueueTile unsigned char *bbuf; jint *pBuf; - J2dTraceLn1(J2D_TRACE_INFO, - "BufferedMaskBlit_enqueueTile: bpos=%d", - bpos); + J2dTraceLn(J2D_TRACE_INFO, + "BufferedMaskBlit_enqueueTile: bpos=%d", + bpos); if (srcOps == NULL) { J2dRlsTraceLn(J2D_TRACE_ERROR, @@ -139,15 +139,15 @@ Java_sun_java2d_pipe_BufferedMaskBlit_enqueueTile srcScanStride -= width * srcPixelStride; h = height; - J2dTraceLn4(J2D_TRACE_VERBOSE, - " sx=%d sy=%d w=%d h=%d", - srcInfo.bounds.x1, srcInfo.bounds.y1, width, height); - J2dTraceLn2(J2D_TRACE_VERBOSE, - " maskoff=%d maskscan=%d", - maskoff, maskscan); - J2dTraceLn2(J2D_TRACE_VERBOSE, - " pixstride=%d scanstride=%d", - srcPixelStride, srcScanStride); + J2dTraceLn(J2D_TRACE_VERBOSE, + " sx=%d sy=%d w=%d h=%d", + srcInfo.bounds.x1, srcInfo.bounds.y1, width, height); + J2dTraceLn(J2D_TRACE_VERBOSE, + " maskoff=%d maskscan=%d", + maskoff, maskscan); + J2dTraceLn(J2D_TRACE_VERBOSE, + " pixstride=%d scanstride=%d", + srcPixelStride, srcScanStride); // enqueue parameters pBuf[0] = sun_java2d_pipe_BufferedOpCodes_MASK_BLIT; diff --git a/src/java.desktop/share/native/libawt/java2d/pipe/BufferedRenderPipe.c b/src/java.desktop/share/native/libawt/java2d/pipe/BufferedRenderPipe.c index ac55c38f932..a36b2128259 100644 --- a/src/java.desktop/share/native/libawt/java2d/pipe/BufferedRenderPipe.c +++ b/src/java.desktop/share/native/libawt/java2d/pipe/BufferedRenderPipe.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2005, 2025, 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 @@ -59,9 +59,9 @@ Java_sun_java2d_pipe_BufferedRenderPipe_fillSpans jint ipos; jboolean hasException; - J2dTraceLn2(J2D_TRACE_INFO, - "BufferedRenderPipe_fillSpans: bpos=%d limit=%d", - bpos, limit); + J2dTraceLn(J2D_TRACE_INFO, + "BufferedRenderPipe_fillSpans: bpos=%d limit=%d", + bpos, limit); if (JNU_IsNull(env, rq)) { J2dRlsTraceLn(J2D_TRACE_ERROR, diff --git a/src/java.desktop/unix/native/common/java2d/opengl/GLXGraphicsConfig.c b/src/java.desktop/unix/native/common/java2d/opengl/GLXGraphicsConfig.c index b5232b7a912..47c5a6d0d2e 100644 --- a/src/java.desktop/unix/native/common/java2d/opengl/GLXGraphicsConfig.c +++ b/src/java.desktop/unix/native/common/java2d/opengl/GLXGraphicsConfig.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2025, 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 @@ -96,8 +96,8 @@ GLXGC_InitGLX() // we now only verify that the client GLX version is >= 1.3 (if the // server does not support GLX 1.3, then we will find that out later // when we attempt to create a GLXFBConfig) - J2dRlsTraceLn1(J2D_TRACE_INFO, - "GLXGC_InitGLX: client GLX version=%s", version); + J2dRlsTraceLn(J2D_TRACE_INFO, + "GLXGC_InitGLX: client GLX version=%s", version); if (!((version[0] == '1' && version[2] >= '3') || (version[0] > '1'))) { J2dRlsTraceLn(J2D_TRACE_ERROR, "GLXGC_InitGLX: invalid GLX version; 1.3 is required"); @@ -224,8 +224,8 @@ GLXGC_InitFBConfig(JNIEnv *env, jint screennum, VisualID visualid) // be much less than this number) int minDepthPlusStencil = 512; - J2dRlsTraceLn2(J2D_TRACE_INFO, "GLXGC_InitFBConfig: scn=%d vis=0x%x", - screennum, visualid); + J2dRlsTraceLn(J2D_TRACE_INFO, "GLXGC_InitFBConfig: scn=%d vis=0x%x", + screennum, visualid); // find all fbconfigs for this screen with the provided attributes fbconfigs = j2d_glXChooseFBConfig(awt_display, screennum, @@ -275,9 +275,9 @@ GLXGC_InitFBConfig(JNIEnv *env, jint screennum, VisualID visualid) j2d_glXGetFBConfigAttrib(awt_display, fbc, GLX_ALPHA_SIZE, &alpha); - J2dRlsTrace5(J2D_TRACE_VERBOSE, - "[V] id=0x%x db=%d alpha=%d depth=%d stencil=%d valid=", - fbvisualid, db, alpha, depth, stencil); + J2dRlsTrace(J2D_TRACE_VERBOSE, + "[V] id=0x%x db=%d alpha=%d depth=%d stencil=%d valid=", + fbvisualid, db, alpha, depth, stencil); if ((dtype & GLX_WINDOW_BIT) && (dtype & GLX_PBUFFER_BIT) && @@ -337,7 +337,7 @@ GLXGC_FindBestVisual(JNIEnv *env, jint screen) XVisualInfo *xvi; VisualID visualid; - J2dRlsTraceLn1(J2D_TRACE_INFO, "GLXGC_FindBestVisual: scn=%d", screen); + J2dRlsTraceLn(J2D_TRACE_INFO, "GLXGC_FindBestVisual: scn=%d", screen); if (!GLXGC_IsGLXAvailable()) { J2dRlsTraceLn(J2D_TRACE_ERROR, @@ -362,9 +362,9 @@ GLXGC_FindBestVisual(JNIEnv *env, jint screen) visualid = xvi->visualid; XFree(xvi); - J2dRlsTraceLn2(J2D_TRACE_INFO, - "GLXGC_FindBestVisual: chose 0x%x as the best visual for screen %d", - visualid, screen); + J2dRlsTraceLn(J2D_TRACE_INFO, + "GLXGC_FindBestVisual: chose 0x%x as the best visual for screen %d", + visualid, screen); return visualid; } @@ -510,9 +510,9 @@ Java_sun_java2d_opengl_GLXGraphicsConfig_getGLXConfigInfo(JNIEnv *env, // destroy the temporary resources j2d_glXMakeContextCurrent(awt_display, None, None, NULL); - J2dRlsTraceLn1(J2D_TRACE_INFO, - "GLXGraphicsConfig_getGLXConfigInfo: OpenGL version=%s", - (versionstr == NULL) ? "null" : (char *)versionstr); + J2dRlsTraceLn(J2D_TRACE_INFO, + "GLXGraphicsConfig_getGLXConfigInfo: OpenGL version=%s", + (versionstr == NULL) ? "null" : (char *)versionstr); if (!OGLContext_IsVersionSupported(versionstr)) { J2dRlsTraceLn(J2D_TRACE_ERROR, diff --git a/src/java.desktop/unix/native/common/java2d/opengl/GLXSurfaceData.c b/src/java.desktop/unix/native/common/java2d/opengl/GLXSurfaceData.c index c48b38fa1f3..8f264278d9f 100644 --- a/src/java.desktop/unix/native/common/java2d/opengl/GLXSurfaceData.c +++ b/src/java.desktop/unix/native/common/java2d/opengl/GLXSurfaceData.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2019, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2025, 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 @@ -307,8 +307,8 @@ OGLSD_InitOGLWindow(JNIEnv *env, OGLSDOps *oglsdo) glxsdo->drawable = window; glxsdo->xdrawable = window; - J2dTraceLn2(J2D_TRACE_VERBOSE, " created window: w=%d h=%d", - oglsdo->width, oglsdo->height); + J2dTraceLn(J2D_TRACE_VERBOSE, " created window: w=%d h=%d", + oglsdo->width, oglsdo->height); return JNI_TRUE; } diff --git a/src/java.desktop/unix/native/common/java2d/x11/X11SurfaceData.c b/src/java.desktop/unix/native/common/java2d/x11/X11SurfaceData.c index 2349ad3dcfd..b134623a0bd 100644 --- a/src/java.desktop/unix/native/common/java2d/x11/X11SurfaceData.c +++ b/src/java.desktop/unix/native/common/java2d/x11/X11SurfaceData.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 1999, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1999, 2025, 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 @@ -534,9 +534,9 @@ XImage* X11SD_CreateSharedImage(X11SDOps *xsdo, shmget(IPC_PRIVATE, (size_t) height * img->bytes_per_line, IPC_CREAT|mitShmPermissionMask); if (shminfo->shmid < 0) { - J2dRlsTraceLn1(J2D_TRACE_ERROR, - "X11SD_SetupSharedSegment shmget has failed: %s", - strerror(errno)); + J2dRlsTraceLn(J2D_TRACE_ERROR, + "X11SD_SetupSharedSegment shmget has failed: %s", + strerror(errno)); free((void *)shminfo); XDestroyImage(img); return NULL; @@ -545,9 +545,9 @@ XImage* X11SD_CreateSharedImage(X11SDOps *xsdo, shminfo->shmaddr = (char *) shmat(shminfo->shmid, 0, 0); if (shminfo->shmaddr == ((char *) -1)) { shmctl(shminfo->shmid, IPC_RMID, 0); - J2dRlsTraceLn1(J2D_TRACE_ERROR, - "X11SD_SetupSharedSegment shmat has failed: %s", - strerror(errno)); + J2dRlsTraceLn(J2D_TRACE_ERROR, + "X11SD_SetupSharedSegment shmat has failed: %s", + strerror(errno)); free((void *)shminfo); XDestroyImage(img); return NULL; @@ -567,9 +567,9 @@ XImage* X11SD_CreateSharedImage(X11SDOps *xsdo, shmctl(shminfo->shmid, IPC_RMID, 0); if (isXShmAttachFailed() == JNI_TRUE) { - J2dRlsTraceLn1(J2D_TRACE_ERROR, - "X11SD_SetupSharedSegment XShmAttach has failed: %s", - strerror(errno)); + J2dRlsTraceLn(J2D_TRACE_ERROR, + "X11SD_SetupSharedSegment XShmAttach has failed: %s", + strerror(errno)); shmdt(shminfo->shmaddr); free((void *)shminfo); XDestroyImage(img); diff --git a/src/java.desktop/unix/native/libawt_xawt/awt/awt_GraphicsEnv.c b/src/java.desktop/unix/native/libawt_xawt/awt/awt_GraphicsEnv.c index fdb2bbb3ab9..c7fe9c879ff 100644 --- a/src/java.desktop/unix/native/libawt_xawt/awt/awt_GraphicsEnv.c +++ b/src/java.desktop/unix/native/libawt_xawt/awt/awt_GraphicsEnv.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2025, 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 @@ -897,18 +897,18 @@ void TryInitMITShm(JNIEnv *env, jint *shmExt, jint *shmPixmaps) { IPC_CREAT|mitShmPermissionMask); if (shminfo.shmid < 0) { AWT_UNLOCK(); - J2dRlsTraceLn1(J2D_TRACE_ERROR, - "TryInitMITShm: shmget has failed: %s", - strerror(errno)); + J2dRlsTraceLn(J2D_TRACE_ERROR, + "TryInitMITShm: shmget has failed: %s", + strerror(errno)); return; } shminfo.shmaddr = (char *) shmat(shminfo.shmid, 0, 0); if (shminfo.shmaddr == ((char *) -1)) { shmctl(shminfo.shmid, IPC_RMID, 0); AWT_UNLOCK(); - J2dRlsTraceLn1(J2D_TRACE_ERROR, - "TryInitMITShm: shmat has failed: %s", - strerror(errno)); + J2dRlsTraceLn(J2D_TRACE_ERROR, + "TryInitMITShm: shmat has failed: %s", + strerror(errno)); return; } shminfo.readOnly = True; @@ -1525,8 +1525,8 @@ static XRRFreeCrtcInfoType awt_XRRFreeCrtcInfo; do { \ awt_##f = (f##Type)dlsym(pLibRandR, #f); \ if (awt_##f == NULL) { \ - J2dRlsTraceLn1(J2D_TRACE_ERROR, \ - "X11GD_InitXrandrFuncs: Could not load %s", #f); \ + J2dRlsTraceLn(J2D_TRACE_ERROR, \ + "X11GD_InitXrandrFuncs: Could not load %s", #f); \ dlclose(pLibRandR); \ return JNI_FALSE; \ } \ @@ -1564,9 +1564,9 @@ X11GD_InitXrandrFuncs(JNIEnv *env) * a fake one provided by RANDR itself. See Java bug 6636469 for info. */ if (!(rr_maj_ver > 1 || (rr_maj_ver == 1 && rr_min_ver >= 2))) { - J2dRlsTraceLn2(J2D_TRACE_INFO, "X11GD_InitXrandrFuncs: Can't use Xrandr. " - "Xinerama is active and Xrandr version is %d.%d", - rr_maj_ver, rr_min_ver); + J2dRlsTraceLn(J2D_TRACE_INFO, "X11GD_InitXrandrFuncs: Can't use Xrandr. " + "Xinerama is active and Xrandr version is %d.%d", + rr_maj_ver, rr_min_ver); dlclose(pLibRandR); return JNI_FALSE; } diff --git a/src/java.desktop/windows/native/libawt/java2d/d3d/D3DBlitLoops.cpp b/src/java.desktop/windows/native/libawt/java2d/d3d/D3DBlitLoops.cpp index ecf8100e87d..b1c946edcf6 100644 --- a/src/java.desktop/windows/native/libawt/java2d/d3d/D3DBlitLoops.cpp +++ b/src/java.desktop/windows/native/libawt/java2d/d3d/D3DBlitLoops.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2007, 2025, 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 @@ -69,9 +69,9 @@ D3DBL_CopySurfaceToIntArgbImage(IDirect3DSurface9 *pSurface, SurfaceDataRasInfo srcInfo; J2dTraceLn(J2D_TRACE_INFO, "D3DBL_CopySurfaceToIntArgbImage"); - J2dTraceLn4(J2D_TRACE_VERBOSE, - " rect={%-4d, %-4d, %-4d, %-4d}", - r.left, r.top, r.right, r.bottom); + J2dTraceLn(J2D_TRACE_VERBOSE, + " rect={%-4d, %-4d, %-4d, %-4d}", + r.left, r.top, r.right, r.bottom); res = pSurface->LockRect(&lockedRect, &r, D3DLOCK_NOSYSLOCK); RETURN_STATUS_IF_FAILED(res); @@ -121,9 +121,9 @@ D3DBL_CopySurfaceToIntArgbImage(IDirect3DSurface9 *pSurface, &srcInfo, pDstInfo, NULL, NULL); break; default: - J2dRlsTraceLn1(J2D_TRACE_ERROR, - "D3DBL_CopySurfaceToIntArgbImage: unknown format %d", - desc.Format); + J2dRlsTraceLn(J2D_TRACE_ERROR, + "D3DBL_CopySurfaceToIntArgbImage: unknown format %d", + desc.Format); } return pSurface->UnlockRect(); @@ -147,9 +147,9 @@ D3DBL_CopyImageToIntXrgbSurface(SurfaceDataRasInfo *pSrcInfo, DWORD dwLockFlags = D3DLOCK_NOSYSLOCK; J2dTraceLn(J2D_TRACE_INFO, "D3DBL_CopyImageToIntXrgbSurface"); - J2dTraceLn5(J2D_TRACE_VERBOSE, - " srctype=%d rect={%-4d, %-4d, %-4d, %-4d}", - srctype, r.left, r.top, r.right, r.bottom); + J2dTraceLn(J2D_TRACE_VERBOSE, + " srctype=%d rect={%-4d, %-4d, %-4d, %-4d}", + srctype, r.left, r.top, r.right, r.bottom); if (pDesc->Usage == D3DUSAGE_DYNAMIC) { // it is safe to lock with discard because we don't care about the @@ -238,9 +238,9 @@ D3DBL_CopyImageToIntXrgbSurface(SurfaceDataRasInfo *pSrcInfo, // pSrcInfo, &dstInfo, NULL, NULL); break; default: - J2dRlsTraceLn1(J2D_TRACE_ERROR, - "D3DBL_CopyImageToIntXrgbSurface: unknown type %d", - srctype); + J2dRlsTraceLn(J2D_TRACE_ERROR, + "D3DBL_CopyImageToIntXrgbSurface: unknown type %d", + srctype); } return pDstSurface->UnlockRect(); @@ -676,11 +676,11 @@ D3DBlitLoops_IsoBlit(JNIEnv *env, sy2 = srcInfo.bounds.y2; } - J2dTraceLn2(J2D_TRACE_VERBOSE, " texture=%d hint=%d", texture, hint); - J2dTraceLn4(J2D_TRACE_VERBOSE, " sx1=%d sy1=%d sx2=%d sy2=%d", - sx1, sy1, sx2, sy2); - J2dTraceLn4(J2D_TRACE_VERBOSE, " dx1=%f dy1=%f dx2=%f dy2=%f", - dx1, dy1, dx2, dy2); + J2dTraceLn(J2D_TRACE_VERBOSE, " texture=%d hint=%d", texture, hint); + J2dTraceLn(J2D_TRACE_VERBOSE, " sx1=%d sy1=%d sx2=%d sy2=%d", + sx1, sy1, sx2, sy2); + J2dTraceLn(J2D_TRACE_VERBOSE, " dx1=%f dy1=%f dx2=%f dy2=%f", + dx1, dy1, dx2, dy2); D3DTEXTUREFILTERTYPE fhint = (hint == D3DSD_XFORM_BILINEAR) ? D3DTEXF_LINEAR : D3DTEXF_POINT; @@ -697,8 +697,8 @@ D3DBlitLoops_IsoBlit(JNIEnv *env, DWORD abEnabled = 0; pd3dDevice->GetRenderState(D3DRS_ALPHABLENDENABLE, &abEnabled); - J2dTraceLn3(J2D_TRACE_VERBOSE, " xform=%d clip=%d abEnabled=%d", - xform, d3dc->GetClipType(), abEnabled); + J2dTraceLn(J2D_TRACE_VERBOSE, " xform=%d clip=%d abEnabled=%d", + xform, d3dc->GetClipType(), abEnabled); if (!xform && d3dc->GetClipType() != CLIP_SHAPE && !abEnabled) { fhint = d3dc->IsStretchRectFilteringSupported(fhint) ? fhint : D3DTEXF_NONE; @@ -794,12 +794,12 @@ D3DBlitLoops_Blit(JNIEnv *env, sy2 = srcInfo.bounds.y2; } - J2dTraceLn3(J2D_TRACE_VERBOSE, " texture=%d srctype=%d hint=%d", - texture, srctype, hint); - J2dTraceLn4(J2D_TRACE_VERBOSE, " sx1=%d sy1=%d sx2=%d sy2=%d", - sx1, sy1, sx2, sy2); - J2dTraceLn4(J2D_TRACE_VERBOSE, " dx1=%f dy1=%f dx2=%f dy2=%f", - dx1, dy1, dx2, dy2); + J2dTraceLn(J2D_TRACE_VERBOSE, " texture=%d srctype=%d hint=%d", + texture, srctype, hint); + J2dTraceLn(J2D_TRACE_VERBOSE, " sx1=%d sy1=%d sx2=%d sy2=%d", + sx1, sy1, sx2, sy2); + J2dTraceLn(J2D_TRACE_VERBOSE, " dx1=%f dy1=%f dx2=%f dy2=%f", + dx1, dy1, dx2, dy2); if (texture) { // These coordinates will always be integers since we @@ -889,10 +889,10 @@ D3DBlitLoops_SurfaceToSwBlit(JNIEnv *env, D3DContext *d3dc, width = srcInfo.bounds.x2 - srcInfo.bounds.x1; height = srcInfo.bounds.y2 - srcInfo.bounds.y1; - J2dTraceLn4(J2D_TRACE_VERBOSE, " sx=%d sy=%d w=%d h=%d", - srcx, srcy, width, height); - J2dTraceLn2(J2D_TRACE_VERBOSE, " dx=%d dy=%d", - dstx, dsty); + J2dTraceLn(J2D_TRACE_VERBOSE, " sx=%d sy=%d w=%d h=%d", + srcx, srcy, width, height); + J2dTraceLn(J2D_TRACE_VERBOSE, " dx=%d dy=%d", + dstx, dsty); d3dc->UpdateState(STATE_OTHEROP); @@ -961,10 +961,10 @@ D3DBlitLoops_CopyArea(JNIEnv *env, RETURN_STATUS_IF_NULL(dstOps, E_FAIL); RETURN_STATUS_IF_NULL(dstOps->pResource, E_FAIL); - J2dTraceLn4(J2D_TRACE_VERBOSE, " x=%d y=%d w=%d h=%d", - x, y, width, height); - J2dTraceLn2(J2D_TRACE_VERBOSE, " dx=%d dy=%d", - dx, dy); + J2dTraceLn(J2D_TRACE_VERBOSE, " x=%d y=%d w=%d h=%d", + x, y, width, height); + J2dTraceLn(J2D_TRACE_VERBOSE, " dx=%d dy=%d", + dx, dy); IDirect3DDevice9 *pd3dDevice = d3dc->Get3DDevice(); RETURN_STATUS_IF_NULL(pd3dDevice, E_FAIL); diff --git a/src/java.desktop/windows/native/libawt/java2d/d3d/D3DBufImgOps.cpp b/src/java.desktop/windows/native/libawt/java2d/d3d/D3DBufImgOps.cpp index b8b1ec892c1..f1de279014c 100644 --- a/src/java.desktop/windows/native/libawt/java2d/d3d/D3DBufImgOps.cpp +++ b/src/java.desktop/windows/native/libawt/java2d/d3d/D3DBufImgOps.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, 2008, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2007, 2025, 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 @@ -56,9 +56,9 @@ D3DBufImgOps_EnableConvolveOp(D3DContext *d3dc, jlong pSrcOps, jint i, j, kIndex; jint flags = 0; - J2dTraceLn2(J2D_TRACE_INFO, - "D3DBufImgOps_EnableConvolveOp: kernelW=%d kernelH=%d", - kernelWidth, kernelHeight); + J2dTraceLn(J2D_TRACE_INFO, + "D3DBufImgOps_EnableConvolveOp: kernelW=%d kernelH=%d", + kernelWidth, kernelHeight); RETURN_STATUS_IF_NULL(d3dc, E_FAIL); RETURN_STATUS_IF_NULL(srcOps, E_FAIL); @@ -204,9 +204,9 @@ D3DBufImgOps_EnableLookupOp(D3DContext *d3dc, for (i = 0; i < 4; i++) { bands[i] = NULL; } - J2dTraceLn4(J2D_TRACE_INFO, - "D3DBufImgOps_EnableLookupOp: short=%d num=%d len=%d off=%d", - shortData, numBands, bandLength, offset); + J2dTraceLn(J2D_TRACE_INFO, + "D3DBufImgOps_EnableLookupOp: short=%d num=%d len=%d off=%d", + shortData, numBands, bandLength, offset); RETURN_STATUS_IF_NULL(d3dc, E_FAIL); diff --git a/src/java.desktop/windows/native/libawt/java2d/d3d/D3DContext.cpp b/src/java.desktop/windows/native/libawt/java2d/d3d/D3DContext.cpp index da263367ad9..a91cb58f875 100644 --- a/src/java.desktop/windows/native/libawt/java2d/d3d/D3DContext.cpp +++ b/src/java.desktop/windows/native/libawt/java2d/d3d/D3DContext.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, 2019, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2007, 2025, 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 @@ -213,7 +213,7 @@ D3DContext::CreateInstance(IDirect3D9 *pd3d9, UINT adapter, D3DContext **ppCtx) D3DContext::D3DContext(IDirect3D9 *pd3d, UINT adapter) { J2dTraceLn(J2D_TRACE_INFO, "D3DContext::D3DContext"); - J2dTraceLn1(J2D_TRACE_VERBOSE, " pd3d=0x%x", pd3d); + J2dTraceLn(J2D_TRACE_VERBOSE, " pd3d=0x%x", pd3d); pd3dObject = pd3d; pd3dDevice = NULL; adapterOrdinal = adapter; @@ -283,9 +283,9 @@ void D3DContext::ReleaseDefPoolResources() void D3DContext::ReleaseContextResources() { - J2dTraceLn1(J2D_TRACE_INFO, - "D3DContext::ReleaseContextResources: pd3dDevice = 0x%x", - pd3dDevice); + J2dTraceLn(J2D_TRACE_INFO, + "D3DContext::ReleaseContextResources: pd3dDevice = 0x%x", + pd3dDevice); ReleaseDefPoolResources(); @@ -309,9 +309,9 @@ void D3DContext::ReleaseContextResources() } D3DContext::~D3DContext() { - J2dTraceLn2(J2D_TRACE_INFO, - "~D3DContext: pd3dDevice=0x%x, pd3dObject =0x%x", - pd3dDevice, pd3dObject); + J2dTraceLn(J2D_TRACE_INFO, + "~D3DContext: pd3dDevice=0x%x, pd3dObject =0x%x", + pd3dDevice, pd3dObject); ReleaseContextResources(); SAFE_RELEASE(pd3dDevice); } @@ -323,8 +323,8 @@ D3DContext::InitDevice(IDirect3DDevice9 *pd3dDevice) pd3dDevice->GetDeviceCaps(&devCaps); - J2dRlsTraceLn1(J2D_TRACE_INFO, - "D3DContext::InitDevice: device %d", adapterOrdinal); + J2dRlsTraceLn(J2D_TRACE_INFO, + "D3DContext::InitDevice: device %d", adapterOrdinal); // disable some of the unneeded and costly d3d functionality pd3dDevice->SetRenderState(D3DRS_CULLMODE, D3DCULL_NONE); @@ -423,9 +423,9 @@ D3DContext::InitDevice(IDirect3DDevice9 *pd3dDevice) bBeginScenePending = FALSE; - J2dRlsTraceLn1(J2D_TRACE_INFO, - "D3DContext::InitDefice: successfully initialized device %d", - adapterOrdinal); + J2dRlsTraceLn(J2D_TRACE_INFO, + "D3DContext::InitDefice: successfully initialized device %d", + adapterOrdinal); return res; } @@ -440,13 +440,13 @@ D3DContext::CheckAndResetDevice() if (pd3dDevice != NULL) { if (FAILED(res = pd3dDevice->TestCooperativeLevel())) { if (res == D3DERR_DEVICELOST) { - J2dTraceLn1(J2D_TRACE_VERBOSE, " device %d is still lost", - adapterOrdinal); + J2dTraceLn(J2D_TRACE_VERBOSE, " device %d is still lost", + adapterOrdinal); // nothing to be done here, wait for D3DERR_DEVICENOTRESET return res; } else if (res == D3DERR_DEVICENOTRESET) { - J2dTraceLn1(J2D_TRACE_VERBOSE, " device %d needs to be reset", - adapterOrdinal); + J2dTraceLn(J2D_TRACE_VERBOSE, " device %d needs to be reset", + adapterOrdinal); res = ResetContext(); } else { // some unexpected error @@ -454,8 +454,8 @@ D3DContext::CheckAndResetDevice() "unknown error %x from TestCooperativeLevel"); } } else { - J2dTraceLn1(J2D_TRACE_VERBOSE, " device %d is not lost", - adapterOrdinal); + J2dTraceLn(J2D_TRACE_VERBOSE, " device %d is not lost", + adapterOrdinal); } } else { J2dTraceLn(J2D_TRACE_VERBOSE, " null device"); @@ -491,8 +491,8 @@ D3DContext::ResetContext() HRESULT D3DContext::ConfigureContext(D3DPRESENT_PARAMETERS *pNewParams) { - J2dRlsTraceLn1(J2D_TRACE_INFO, "D3DContext::ConfigureContext device %d", - adapterOrdinal); + J2dRlsTraceLn(J2D_TRACE_INFO, "D3DContext::ConfigureContext device %d", + adapterOrdinal); HRESULT res = S_OK; D3DFORMAT stencilFormat; HWND focusHWND = D3DPipelineManager::GetInstance()->GetCurrentFocusWindow(); @@ -516,7 +516,7 @@ D3DContext::ConfigureContext(D3DPRESENT_PARAMETERS *pNewParams) // do not set device window in the windowed mode, we use additional // swap chains for rendering, the default chain is not used. otherwise // our scratch focus window will be made visible - J2dTraceLn1(J2D_TRACE_VERBOSE, " windowed=%d",pNewParams->Windowed); + J2dTraceLn(J2D_TRACE_VERBOSE, " windowed=%d",pNewParams->Windowed); if (pNewParams->Windowed) { pNewParams->hDeviceWindow = (HWND)0; } @@ -571,9 +571,8 @@ D3DContext::ConfigureContext(D3DPRESENT_PARAMETERS *pNewParams) "D3DContext::ConfigureContext: could not reset the device"); return res; } - J2dRlsTraceLn1(J2D_TRACE_INFO, - "D3DContext::ConfigureContext: successfully reset device: %d", - adapterOrdinal); + J2dRlsTraceLn(J2D_TRACE_INFO, "D3DContext::ConfigureContext: " \ + "successfully reset device: %d", adapterOrdinal); } else { D3DCAPS9 d3dCaps; DWORD dwBehaviorFlags; @@ -622,9 +621,8 @@ D3DContext::ConfigureContext(D3DPRESENT_PARAMETERS *pNewParams) "D3DContext::ConfigureContext: error creating d3d device"); return res; } - J2dRlsTraceLn1(J2D_TRACE_INFO, - "D3DContext::ConfigureContext: successfully created device: %d", - adapterOrdinal); + J2dRlsTraceLn(J2D_TRACE_INFO, "D3DContext::ConfigureContext: " \ + "successfully created device: %d", adapterOrdinal); bIsHWRasterizer = (devType == D3DDEVTYPE_HAL); } @@ -646,8 +644,8 @@ D3DContext::ConfigureContext(D3DPRESENT_PARAMETERS *pNewParams) HRESULT D3DContext::InitContext() { - J2dRlsTraceLn1(J2D_TRACE_INFO, "D3DContext::InitContext device %d", - adapterOrdinal); + J2dRlsTraceLn(J2D_TRACE_INFO, "D3DContext::InitContext device %d", + adapterOrdinal); D3DPRESENT_PARAMETERS params; ZeroMemory(¶ms, sizeof(D3DPRESENT_PARAMETERS)); @@ -791,9 +789,9 @@ D3DContext::SetRenderTarget(IDirect3DSurface9 *pSurface) D3DSURFACE_DESC descNew; IDirect3DSurface9 *pCurrentTarget; - J2dTraceLn1(J2D_TRACE_INFO, - "D3DContext::SetRenderTarget: pSurface=0x%x", - pSurface); + J2dTraceLn(J2D_TRACE_INFO, + "D3DContext::SetRenderTarget: pSurface=0x%x", + pSurface); RETURN_STATUS_IF_NULL(pd3dDevice, E_FAIL); RETURN_STATUS_IF_NULL(pSurface, E_FAIL); @@ -829,7 +827,7 @@ D3DContext::SetRenderTarget(IDirect3DSurface9 *pSurface) (float)descNew.Height); pd3dDevice->SetTransform(D3DTS_PROJECTION, &tx); - J2dTraceLn1(J2D_TRACE_VERBOSE, " current render target=0x%x", pSurface); + J2dTraceLn(J2D_TRACE_VERBOSE, " current render target=0x%x", pSurface); return res; } @@ -900,14 +898,14 @@ D3DContext::SetTransform(jdouble m00, jdouble m10, tx._42 = -0.5f; D3DUtils_2DConcatenateM(&tx, &tx1); - J2dTraceLn4(J2D_TRACE_VERBOSE, - " %5f %5f %5f %5f", tx._11, tx._12, tx._13, tx._14); - J2dTraceLn4(J2D_TRACE_VERBOSE, - " %5f %5f %5f %5f", tx._21, tx._22, tx._23, tx._24); - J2dTraceLn4(J2D_TRACE_VERBOSE, - " %5f %5f %5f %5f", tx._31, tx._32, tx._33, tx._34); - J2dTraceLn4(J2D_TRACE_VERBOSE, - " %5f %5f %5f %5f", tx._41, tx._42, tx._43, tx._44); + J2dTraceLn(J2D_TRACE_VERBOSE, + " %5f %5f %5f %5f", tx._11, tx._12, tx._13, tx._14); + J2dTraceLn(J2D_TRACE_VERBOSE, + " %5f %5f %5f %5f", tx._21, tx._22, tx._23, tx._24); + J2dTraceLn(J2D_TRACE_VERBOSE, + " %5f %5f %5f %5f", tx._31, tx._32, tx._33, tx._34); + J2dTraceLn(J2D_TRACE_VERBOSE, + " %5f %5f %5f %5f", tx._41, tx._42, tx._43, tx._44); if (FAILED(res = pd3dDevice->SetTransform(D3DTS_WORLD, &tx))) { DebugPrintD3DError(res, "D3DContext::SetTransform failed"); } @@ -924,9 +922,9 @@ D3DContext::SetRectClip(int x1, int y1, int x2, int y2) IDirect3DSurface9 *pCurrentTarget; J2dTraceLn(J2D_TRACE_INFO, "D3DContext::SetRectClip"); - J2dTraceLn4(J2D_TRACE_VERBOSE, - " x1=%-4d y1=%-4d x2=%-4d y2=%-4d", - x1, y1, x2, y2); + J2dTraceLn(J2D_TRACE_VERBOSE, + " x1=%-4d y1=%-4d x2=%-4d y2=%-4d", + x1, y1, x2, y2); RETURN_STATUS_IF_NULL(pd3dDevice, E_FAIL); @@ -962,9 +960,9 @@ D3DContext::SetRectClip(int x1, int y1, int x2, int y2) res = pd3dDevice->SetRenderState(D3DRS_SCISSORTESTENABLE, TRUE); } else { DebugPrintD3DError(res, "Error setting scissor rect"); - J2dRlsTraceLn4(J2D_TRACE_ERROR, - " x1=%-4d y1=%-4d x2=%-4d y2=%-4d", - x1, y1, x2, y2); + J2dRlsTraceLn(J2D_TRACE_ERROR, + " x1=%-4d y1=%-4d x2=%-4d y2=%-4d", + x1, y1, x2, y2); } return res; @@ -1108,9 +1106,9 @@ D3DContext::UploadTileToTexture(D3DResource *pTextureRes, void *pixels, jint pixelsTouchedL = 0, pixelsTouchedR = 0; J2dTraceLn(J2D_TRACE_INFO, "D3DContext::UploadTileToTexture"); - J2dTraceLn4(J2D_TRACE_VERBOSE, - " rect={%-4d, %-4d, %-4d, %-4d}", - r.left, r.top, r.right, r.bottom); + J2dTraceLn(J2D_TRACE_VERBOSE, + " rect={%-4d, %-4d, %-4d, %-4d}", + r.left, r.top, r.right, r.bottom); if (pDesc->Usage == D3DUSAGE_DYNAMIC) { // it is safe to lock with discard because we don't care about the @@ -1300,9 +1298,9 @@ HRESULT D3DContext::SetAlphaComposite(jint rule, jfloat ea, jint flags) { HRESULT res; - J2dTraceLn3(J2D_TRACE_INFO, - "D3DContext::SetAlphaComposite: rule=%-1d ea=%f flags=%d", - rule, ea, flags); + J2dTraceLn(J2D_TRACE_INFO, + "D3DContext::SetAlphaComposite: rule=%-1d ea=%f flags=%d", + rule, ea, flags); RETURN_STATUS_IF_NULL(pd3dDevice, E_FAIL); @@ -1316,12 +1314,12 @@ D3DContext::SetAlphaComposite(jint rule, jfloat ea, jint flags) (ea == 1.0f) && (flags & D3DC_SRC_IS_OPAQUE)) { - J2dTraceLn1(J2D_TRACE_VERBOSE, - " disabling alpha comp rule=%-1d ea=1.0 src=opq)", rule); + J2dTraceLn(J2D_TRACE_VERBOSE, + " disabling alpha comp rule=%-1d ea=1.0 src=opq)", rule); pd3dDevice->SetRenderState(D3DRS_ALPHABLENDENABLE, FALSE); } else { - J2dTraceLn2(J2D_TRACE_VERBOSE, - " enabling alpha comp (rule=%-1d ea=%f)", rule, ea); + J2dTraceLn(J2D_TRACE_VERBOSE, + " enabling alpha comp (rule=%-1d ea=%f)", rule, ea); pd3dDevice->SetRenderState(D3DRS_ALPHABLENDENABLE, TRUE); pd3dDevice->SetRenderState(D3DRS_SRCBLEND, @@ -1362,7 +1360,7 @@ D3DContext::UpdateTextureTransforms(DWORD dwSamplerToUpdate) // update only given sampler, dwMaxSampler will be set to it as well dwSampler = dwSamplerToUpdate; dwMaxSampler = dwSamplerToUpdate; - J2dTraceLn1(J2D_TRACE_INFO, "D3DContext::UpdateTextureTransforms: "\ + J2dTraceLn(J2D_TRACE_INFO, "D3DContext::UpdateTextureTransforms: "\ "updating sampler %d", dwSampler); } @@ -1376,14 +1374,14 @@ D3DContext::UpdateTextureTransforms(DWORD dwSamplerToUpdate) D3DSURFACE_DESC texDesc; pd3dDevice->GetTransform(D3DTS_WORLD, &tx); - J2dTraceLn4(10, - " %5f %5f %5f %5f", tx._11, tx._12, tx._13, tx._14); - J2dTraceLn4(10, - " %5f %5f %5f %5f", tx._21, tx._22, tx._23, tx._24); - J2dTraceLn4(10, - " %5f %5f %5f %5f", tx._31, tx._32, tx._33, tx._34); - J2dTraceLn4(10, - " %5f %5f %5f %5f", tx._41, tx._42, tx._43, tx._44); + J2dTraceLn(J2D_TRACE_VERBOSE2, + " %5f %5f %5f %5f", tx._11, tx._12, tx._13, tx._14); + J2dTraceLn(J2D_TRACE_VERBOSE2, + " %5f %5f %5f %5f", tx._21, tx._22, tx._23, tx._24); + J2dTraceLn(J2D_TRACE_VERBOSE2, + " %5f %5f %5f %5f", tx._31, tx._32, tx._33, tx._34); + J2dTraceLn(J2D_TRACE_VERBOSE2, + " %5f %5f %5f %5f", tx._41, tx._42, tx._43, tx._44); // this formula works for scales and flips if (tx._11 == 0.0f) { @@ -1403,8 +1401,8 @@ D3DContext::UpdateTextureTransforms(DWORD dwSamplerToUpdate) // transform. mt._31 = (1.0f / (2.0f * texDesc.Width * tx._11)); mt._32 = (1.0f / (2.0f * texDesc.Height * tx._22)); - J2dTraceLn2(J2D_TRACE_VERBOSE, " offsets: tx=%f ty=%f", - mt._31, mt._32); + J2dTraceLn(J2D_TRACE_VERBOSE, " offsets: tx=%f ty=%f", + mt._31, mt._32); pd3dDevice->SetTextureStageState(dwSampler, D3DTSS_TEXTURETRANSFORMFLAGS, @@ -1436,16 +1434,16 @@ D3DContext::SetTexture(IDirect3DTexture9 *pTexture, DWORD dwSampler) J2dTraceLn(J2D_TRACE_INFO, "D3DContext::SetTexture"); if (dwSampler < 0 || dwSampler > MAX_USED_TEXTURE_SAMPLER) { - J2dTraceLn1(J2D_TRACE_ERROR, - "D3DContext::SetTexture: incorrect sampler: %d", dwSampler); + J2dTraceLn(J2D_TRACE_ERROR, + "D3DContext::SetTexture: incorrect sampler: %d", dwSampler); return E_FAIL; } if (lastTexture[dwSampler] != pTexture) { if (FAILED(res = FlushVertexQueue())) { return res; } - J2dTraceLn2(J2D_TRACE_VERBOSE, - " new texture=0x%x on sampler %d", pTexture, dwSampler); + J2dTraceLn(J2D_TRACE_VERBOSE, + " new texture=0x%x on sampler %d", pTexture, dwSampler); res = pd3dDevice->SetTexture(dwSampler, pTexture); if (SUCCEEDED(res)) { lastTexture[dwSampler] = pTexture; @@ -1589,9 +1587,9 @@ IDirect3DPixelShader9 *D3DContext::CreateFragmentProgram(DWORD **shaders, DWORD *sourceCode; IDirect3DPixelShader9 *pProgram; - J2dTraceLn1(J2D_TRACE_INFO, - "D3DContext::CreateFragmentProgram: flags=%d", - flags); + J2dTraceLn(J2D_TRACE_INFO, + "D3DContext::CreateFragmentProgram: flags=%d", + flags); sourceCode = shaders[flags]; if (FAILED(pd3dDevice->CreatePixelShader(sourceCode, &pProgram))) { @@ -1782,7 +1780,7 @@ BOOL D3DContext::IsOpaqueRTTSupported() HRESULT D3DContext::InitContextCaps() { J2dTraceLn(J2D_TRACE_INFO, "D3DContext::InitContextCaps"); - J2dTraceLn1(J2D_TRACE_VERBOSE, " caps for adapter %d :", adapterOrdinal); + J2dTraceLn(J2D_TRACE_VERBOSE, " caps for adapter %d :", adapterOrdinal); if (pd3dDevice == NULL || pd3dObject == NULL) { contextCaps = CAPS_EMPTY; diff --git a/src/java.desktop/windows/native/libawt/java2d/d3d/D3DGlyphCache.cpp b/src/java.desktop/windows/native/libawt/java2d/d3d/D3DGlyphCache.cpp index d7eb4efd37a..a2d09a75bfd 100644 --- a/src/java.desktop/windows/native/libawt/java2d/d3d/D3DGlyphCache.cpp +++ b/src/java.desktop/windows/native/libawt/java2d/d3d/D3DGlyphCache.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2007, 2025, 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 @@ -48,7 +48,7 @@ D3DGlyphCache::CreateInstance(D3DContext *pCtx, GlyphCacheType gcType, D3DGlyphCache::D3DGlyphCache(GlyphCacheType type) { - J2dTraceLn1(J2D_TRACE_INFO, "D3DGlyphCache::D3DGlyphCache gcType=%d", type); + J2dTraceLn(J2D_TRACE_INFO, "D3DGlyphCache::D3DGlyphCache gcType=%d", type); pCtx = NULL; gcType = type; @@ -90,7 +90,7 @@ D3DGlyphCache::Init(D3DContext *pCtx) RETURN_STATUS_IF_NULL(pCtx, E_FAIL); - J2dTraceLn1(J2D_TRACE_INFO, "D3DGlyphCache::Init pCtx=%x", pCtx); + J2dTraceLn(J2D_TRACE_INFO, "D3DGlyphCache::Init pCtx=%x", pCtx); this->pCtx = pCtx; diff --git a/src/java.desktop/windows/native/libawt/java2d/d3d/D3DGraphicsDevice.cpp b/src/java.desktop/windows/native/libawt/java2d/d3d/D3DGraphicsDevice.cpp index cd0295d758d..fa7cbc736ca 100644 --- a/src/java.desktop/windows/native/libawt/java2d/d3d/D3DGraphicsDevice.cpp +++ b/src/java.desktop/windows/native/libawt/java2d/d3d/D3DGraphicsDevice.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, 2011, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2007, 2025, 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 @@ -49,7 +49,7 @@ JNIEXPORT jboolean JNICALL Java_sun_java2d_d3d_D3DGraphicsDevice_initD3D jboolean result = D3DInitializer::GetInstance().EnsureInited() ? JNI_TRUE : JNI_FALSE; - J2dTraceLn1(J2D_TRACE_INFO, "D3DGD_initD3D: result=%x", result); + J2dTraceLn(J2D_TRACE_INFO, "D3DGD_initD3D: result=%x", result); return result; } @@ -94,7 +94,7 @@ JNIEXPORT jstring JNICALL Java_sun_java2d_d3d_D3DGraphicsDevice_getDeviceIdNativ // in the buffer so we have to make sure it is null terminated pAdapterId[len-1] = (WCHAR)0; - J2dTraceLn1(J2D_TRACE_VERBOSE, " id=%S", pAdapterId); + J2dTraceLn(J2D_TRACE_VERBOSE, " id=%S", pAdapterId); jstring ret = JNU_NewStringPlatform(env, pAdapterId); @@ -123,7 +123,7 @@ Java_sun_java2d_d3d_D3DGraphicsDevice_getDeviceCapsNative adapter = pMgr->GetAdapterOrdinalForScreen(gdiScreen); if (FAILED(pMgr->GetD3DContext(adapter, &pCtx))) { - J2dRlsTraceLn1(J2D_TRACE_ERROR, + J2dRlsTraceLn(J2D_TRACE_ERROR, "D3DGD_getDeviceCapsNative: device %d disabled", adapter); return CAPS_EMPTY; } @@ -318,17 +318,17 @@ Java_sun_java2d_d3d_D3DGraphicsDevice_configDisplayModeNative return; } } else { - J2dRlsTraceLn1(J2D_TRACE_ERROR, - "D3DGD_configDisplayModeNative: unsupported depth: %d", - bitDepth); + J2dRlsTraceLn(J2D_TRACE_ERROR, + "D3DGD_configDisplayModeNative: unsupported depth: %d", + bitDepth); return; } - J2dTraceLn4(J2D_TRACE_VERBOSE, " changing to dm: %dx%dx%d@%d", - newParams.BackBufferWidth, newParams.BackBufferHeight, - bitDepth, refreshRate); - J2dTraceLn1(J2D_TRACE_VERBOSE, " selected backbuffer format: %d", - newParams.BackBufferFormat); + J2dTraceLn(J2D_TRACE_VERBOSE, " changing to dm: %dx%dx%d@%d", + newParams.BackBufferWidth, newParams.BackBufferHeight, + bitDepth, refreshRate); + J2dTraceLn(J2D_TRACE_VERBOSE, " selected backbuffer format: %d", + newParams.BackBufferFormat); res = pCtx->ConfigureContext(&newParams); if (SUCCEEDED(res)) { @@ -370,9 +370,9 @@ Java_sun_java2d_d3d_D3DGraphicsDevice_getCurrentDisplayModeNative case D3DFMT_R5G6B5: case D3DFMT_X1R5G5B5: bitDepth = 16; break; } - J2dTraceLn4(J2D_TRACE_VERBOSE, - " current dm: %dx%dx%d@%d", - mode.Width, mode.Height, bitDepth, mode.RefreshRate); + J2dTraceLn(J2D_TRACE_VERBOSE, + " current dm: %dx%dx%d@%d", + mode.Width, mode.Height, bitDepth, mode.RefreshRate); ret = CreateDisplayMode(env, mode.Width, mode.Height, bitDepth, mode.RefreshRate); } @@ -418,8 +418,8 @@ Java_sun_java2d_d3d_D3DGraphicsDevice_enumDisplayModesNative case D3DFMT_R5G6B5: case D3DFMT_X1R5G5B5: bitDepth = 16; break; } - J2dTraceLn4(J2D_TRACE_VERBOSE, " found dm: %dx%dx%d@%d", - mode.Width, mode.Height, bitDepth,mode.RefreshRate); + J2dTraceLn(J2D_TRACE_VERBOSE, " found dm: %dx%dx%d@%d", + mode.Width, mode.Height, bitDepth,mode.RefreshRate); addDisplayMode(env, arrayList, mode.Width, mode.Height, bitDepth, mode.RefreshRate); } @@ -457,7 +457,7 @@ Java_sun_java2d_d3d_D3DGraphicsDevice_getAvailableAcceleratedMemoryNative RETURN_STATUS_IF_NULL(pd3dDevice = pCtx->Get3DDevice(), 0L); UINT mem = pd3dDevice->GetAvailableTextureMem(); - J2dTraceLn1(J2D_TRACE_VERBOSE, " available memory=%d", mem); + J2dTraceLn(J2D_TRACE_VERBOSE, " available memory=%d", mem); return mem; } diff --git a/src/java.desktop/windows/native/libawt/java2d/d3d/D3DMaskCache.cpp b/src/java.desktop/windows/native/libawt/java2d/d3d/D3DMaskCache.cpp index 74ff8e64664..c0d6d914173 100644 --- a/src/java.desktop/windows/native/libawt/java2d/d3d/D3DMaskCache.cpp +++ b/src/java.desktop/windows/native/libawt/java2d/d3d/D3DMaskCache.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, 2008, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2007, 2025, 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 @@ -57,7 +57,7 @@ D3DMaskCache::~D3DMaskCache() HRESULT D3DMaskCache::Init(D3DContext *pCtx) { - J2dTraceLn1(J2D_TRACE_INFO, "D3DMaskCache::Init pCtx=%x", pCtx); + J2dTraceLn(J2D_TRACE_INFO, "D3DMaskCache::Init pCtx=%x", pCtx); this->pCtx = pCtx; this->maskCacheIndex = 0; return S_OK; @@ -103,8 +103,8 @@ HRESULT D3DMaskCache::AddMaskQuad(int srcx, int srcy, float tx1, ty1, tx2, ty2; float dx1, dy1, dx2, dy2; - J2dTraceLn1(J2D_TRACE_INFO, "D3DVertexCacher::AddMaskQuad: %d", - maskCacheIndex); + J2dTraceLn(J2D_TRACE_INFO, "D3DVertexCacher::AddMaskQuad: %d", + maskCacheIndex); if (maskCacheIndex >= D3D_MASK_CACHE_MAX_INDEX || pCtx->pVCacher->GetFreeVertices() < 6) diff --git a/src/java.desktop/windows/native/libawt/java2d/d3d/D3DMaskFill.cpp b/src/java.desktop/windows/native/libawt/java2d/d3d/D3DMaskFill.cpp index 6a380c7df79..59416b32152 100644 --- a/src/java.desktop/windows/native/libawt/java2d/d3d/D3DMaskFill.cpp +++ b/src/java.desktop/windows/native/libawt/java2d/d3d/D3DMaskFill.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, 2008, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2007, 2025, 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 @@ -54,9 +54,9 @@ D3DMaskFill_MaskFill(D3DContext *d3dc, RETURN_STATUS_IF_NULL(d3dc, E_FAIL); - J2dTraceLn4(J2D_TRACE_VERBOSE, " x=%d y=%d w=%d h=%d", x, y, w, h); - J2dTraceLn2(J2D_TRACE_VERBOSE, " maskoff=%d maskscan=%d", - maskoff, maskscan); + J2dTraceLn(J2D_TRACE_VERBOSE, " x=%d y=%d w=%d h=%d", x, y, w, h); + J2dTraceLn(J2D_TRACE_VERBOSE, " maskoff=%d maskscan=%d", + maskoff, maskscan); { D3DMaskCache *maskCache = d3dc->GetMaskCache(); diff --git a/src/java.desktop/windows/native/libawt/java2d/d3d/D3DPaints.cpp b/src/java.desktop/windows/native/libawt/java2d/d3d/D3DPaints.cpp index 8ed5e2388b8..c725da89bc1 100644 --- a/src/java.desktop/windows/native/libawt/java2d/d3d/D3DPaints.cpp +++ b/src/java.desktop/windows/native/libawt/java2d/d3d/D3DPaints.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, 2008, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2007, 2025, 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 @@ -45,7 +45,7 @@ D3DPaints_ResetPaint(D3DContext *d3dc) RETURN_STATUS_IF_NULL(d3dc, E_FAIL); paintState = d3dc->GetPaintState(); - J2dTraceLn1(J2D_TRACE_VERBOSE, " state=%d", paintState); + J2dTraceLn(J2D_TRACE_VERBOSE, " state=%d", paintState); res = d3dc->UpdateState(STATE_OTHEROP); @@ -89,7 +89,7 @@ D3DPaints_SetColor(D3DContext *d3dc, jint pixel) { HRESULT res = S_OK; - J2dTraceLn1(J2D_TRACE_INFO, "D3DPaints_SetColor: pixel=%08x", pixel); + J2dTraceLn(J2D_TRACE_INFO, "D3DPaints_SetColor: pixel=%08x", pixel); RETURN_STATUS_IF_NULL(d3dc, E_FAIL); diff --git a/src/java.desktop/windows/native/libawt/java2d/d3d/D3DPipeline.h b/src/java.desktop/windows/native/libawt/java2d/d3d/D3DPipeline.h index 5d9332e954b..135f09d79b7 100644 --- a/src/java.desktop/windows/native/libawt/java2d/d3d/D3DPipeline.h +++ b/src/java.desktop/windows/native/libawt/java2d/d3d/D3DPipeline.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2007, 2025, 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 @@ -37,7 +37,7 @@ #include "Trace.h" #define DebugPrintD3DError(res, msg) \ - J2dTraceLn1(J2D_TRACE_ERROR, "D3D Error: " msg " res=%d", res) + J2dTraceLn(J2D_TRACE_ERROR, "D3D Error: " msg " res=%d", res) // some helper macros #define SAFE_RELEASE(RES) \ @@ -60,7 +60,7 @@ do { \ #define SAFE_PRINTLN(RES) \ do { \ if ((RES)!= NULL) { \ - J2dTraceLn1(J2D_TRACE_VERBOSE, " " #RES "=0x%x", (RES)); \ + J2dTraceLn(J2D_TRACE_VERBOSE, " " #RES "=0x%x", (RES)); \ } else { \ J2dTraceLn(J2D_TRACE_VERBOSE, " " #RES "=NULL"); \ } \ @@ -76,8 +76,8 @@ do { \ */ #define ACT_IF_NULL(ACTION, value) \ if ((value) == NULL) { \ - J2dTraceLn3(J2D_TRACE_ERROR, \ - "%s is null in %s:%d", #value, __FILE__, __LINE__); \ + J2dTraceLn(J2D_TRACE_ERROR, \ + "%s is null in %s:%d", #value, __FILE__, __LINE__); \ ACTION; \ } else do { } while (0) #define RETURN_IF_NULL(value) ACT_IF_NULL(return, value) diff --git a/src/java.desktop/windows/native/libawt/java2d/d3d/D3DPipelineManager.cpp b/src/java.desktop/windows/native/libawt/java2d/d3d/D3DPipelineManager.cpp index 27bf3e39d08..3048f12914d 100644 --- a/src/java.desktop/windows/native/libawt/java2d/d3d/D3DPipelineManager.cpp +++ b/src/java.desktop/windows/native/libawt/java2d/d3d/D3DPipelineManager.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2007, 2025, 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 @@ -59,9 +59,9 @@ D3DPipelineManager * D3DPipelineManager::CreateInstance(void) // this should never happen so to be on the safe side do not // use this unexpected pointer, do not try to release it, just null // it out and fail safely - J2dRlsTraceLn1(J2D_TRACE_ERROR, - "D3DPPLM::CreateInstance: unexpected instance: 0x%x,"\ - " abort.", pMgr); + J2dRlsTraceLn(J2D_TRACE_ERROR, + "D3DPPLM::CreateInstance: unexpected instance: 0x%x,"\ + " abort.", pMgr); pMgr = NULL; } return pMgr; @@ -201,7 +201,7 @@ HRESULT D3DPipelineManager::HandleAdaptersChange(HMONITOR *pHMONITORs, UINT monN J2dTraceLn(J2D_TRACE_INFO, "D3DPPLM::HandleAdaptersChange"); if (monNum != pMgr->adapterCount) { - J2dTraceLn2(J2D_TRACE_VERBOSE, + J2dTraceLn(J2D_TRACE_VERBOSE, " number of adapters changed (old=%d, new=%d)", pMgr->adapterCount, monNum); bResetD3D = TRUE; @@ -209,23 +209,23 @@ HRESULT D3DPipelineManager::HandleAdaptersChange(HMONITOR *pHMONITORs, UINT monN for (UINT i = 0; i < pMgr->adapterCount; i++) { HMONITOR hMon = pMgr->pd3d9->GetAdapterMonitor(i); if (hMon == (HMONITOR)0x0) { - J2dTraceLn1(J2D_TRACE_VERBOSE, " adapter %d: removed", i); + J2dTraceLn(J2D_TRACE_VERBOSE, " adapter %d: removed", i); bResetD3D = TRUE; break; } bFound = FALSE; for (UINT mon = 0; mon < monNum; mon++) { if (pHMONITORs[mon] == hMon) { - J2dTraceLn3(J2D_TRACE_VERBOSE, - " adapter %d: found hmnd[%d]=0x%x", i, mon, hMon); + J2dTraceLn(J2D_TRACE_VERBOSE, + " adapter %d: found hmnd[%d]=0x%x", i, mon, hMon); bFound = TRUE; break; } } if (!bFound) { - J2dTraceLn2(J2D_TRACE_VERBOSE, - " adapter %d: could not find hmnd=0x%x "\ - "in the list of new hmnds", i, hMon); + J2dTraceLn(J2D_TRACE_VERBOSE, + " adapter %d: could not find hmnd=0x%x "\ + "in the list of new hmnds", i, hMon); bResetD3D = TRUE; break; } @@ -276,8 +276,8 @@ HRESULT D3DPipelineManager::HandleLostDevices() if (pAdapters != NULL) { for (UINT i = 0; i < adapterCount; i++) { if (pAdapters[i].pd3dContext != NULL) { - J2dTraceLn1(J2D_TRACE_VERBOSE, - " HandleLostDevices: checking adapter %d", i); + J2dTraceLn(J2D_TRACE_VERBOSE, + " HandleLostDevices: checking adapter %d", i); D3DContext *d3dc = pAdapters[i].pd3dContext; if (FAILED(d3dc->CheckAndResetDevice())) { bAllClear = FALSE; @@ -374,9 +374,9 @@ D3DPipelineManager::GDICheckForBadHardware() int args2 = swscanf(deviceId, L"%X", &dwDId); if (args1 == 1 && args2 == 1) { - J2dTraceLn2(J2D_TRACE_VERBOSE, - " device: vendorID=0x%04x, deviceId=0x%04x", - dwVId, dwDId); + J2dTraceLn(J2D_TRACE_VERBOSE, + " device: vendorID=0x%04x, deviceId=0x%04x", + dwVId, dwDId); // since we don't have a driver version here we will // just ask to ignore the version for now; bad hw // entries with specific drivers information will be @@ -450,16 +450,16 @@ BOOL D3DPPLM_OsVersionMatches(USHORT osInfo) { J2dRlsTrace(J2D_TRACE_INFO, "Pro\n"); } } else { - J2dRlsTrace2(J2D_TRACE_INFO, + J2dRlsTrace(J2D_TRACE_INFO, "OS_UNKNOWN: dwMajorVersion=%d dwMinorVersion=%d\n", - osvi.dwMajorVersion, osvi.dwMinorVersion); + osvi.dwMajorVersion, osvi.dwMinorVersion); currentOS = OS_UNKNOWN; } } else { if (bVersOk) { - J2dRlsTrace2(J2D_TRACE_INFO, - "OS_UNKNOWN: dwPlatformId=%d dwMajorVersion=%d\n", - osvi.dwPlatformId, osvi.dwMajorVersion); + J2dRlsTrace(J2D_TRACE_INFO, + "OS_UNKNOWN: dwPlatformId=%d dwMajorVersion=%d\n", + osvi.dwPlatformId, osvi.dwMajorVersion); } else { J2dRlsTrace(J2D_TRACE_INFO,"OS_UNKNOWN: GetVersionEx failed\n"); } @@ -492,21 +492,21 @@ D3DPipelineManager::CheckForBadHardware(DWORD vId, DWORD dId, LONGLONG version) if (D3DPPLM_OsVersionMatches(osInfo) && (goodVersion == NO_VERSION || version < goodVersion)) { - J2dRlsTraceLn2(J2D_TRACE_ERROR, - "D3DPPLM::CheckForBadHardware: found matching "\ - "hardware: VendorId=0x%04x DeviceId=0x%04x", - vendorId, deviceId); + J2dRlsTraceLn(J2D_TRACE_ERROR, + "D3DPPLM::CheckForBadHardware: found matching "\ + "hardware: VendorId=0x%04x DeviceId=0x%04x", + vendorId, deviceId); if (goodVersion != NO_VERSION) { // this was a match by the driver version LARGE_INTEGER li; li.QuadPart = goodVersion; J2dRlsTraceLn(J2D_TRACE_ERROR, " bad driver found, device disabled"); - J2dRlsTraceLn4(J2D_TRACE_ERROR, - " update your driver to at "\ - "least version %d.%d.%d.%d", - HIWORD(li.HighPart), LOWORD(li.HighPart), - HIWORD(li.LowPart), LOWORD(li.LowPart)); + J2dRlsTraceLn(J2D_TRACE_ERROR, + " update your driver to at "\ + "least version %d.%d.%d.%d", + HIWORD(li.HighPart), LOWORD(li.HighPart), + HIWORD(li.LowPart), LOWORD(li.LowPart)); } else { // this was a match by the device (no good driver for this // device) @@ -542,39 +542,39 @@ HRESULT D3DPipelineManager::CheckAdaptersInfo() continue; } - J2dRlsTraceLn1(J2D_TRACE_INFO, "Adapter Ordinal : %d", Adapter); - J2dRlsTraceLn1(J2D_TRACE_INFO, "Adapter Handle : 0x%x", - pd3d9->GetAdapterMonitor(Adapter)); - J2dRlsTraceLn1(J2D_TRACE_INFO, "Description : %s", - aid.Description); - J2dRlsTraceLn2(J2D_TRACE_INFO, "GDI Name, Driver : %s, %s", - aid.DeviceName, aid.Driver); - J2dRlsTraceLn1(J2D_TRACE_INFO, "Vendor Id : 0x%04x", - aid.VendorId); - J2dRlsTraceLn1(J2D_TRACE_INFO, "Device Id : 0x%04x", - aid.DeviceId); - J2dRlsTraceLn1(J2D_TRACE_INFO, "SubSys Id : 0x%x", - aid.SubSysId); - J2dRlsTraceLn4(J2D_TRACE_INFO, "Driver Version : %d.%d.%d.%d", - HIWORD(aid.DriverVersion.HighPart), - LOWORD(aid.DriverVersion.HighPart), - HIWORD(aid.DriverVersion.LowPart), - LOWORD(aid.DriverVersion.LowPart)); - J2dRlsTrace3(J2D_TRACE_INFO, - "[I] GUID : {%08X-%04X-%04X-", - aid.DeviceIdentifier.Data1, - aid.DeviceIdentifier.Data2, - aid.DeviceIdentifier.Data3); - J2dRlsTrace4(J2D_TRACE_INFO, "%02X%02X-%02X%02X", - aid.DeviceIdentifier.Data4[0], - aid.DeviceIdentifier.Data4[1], - aid.DeviceIdentifier.Data4[2], - aid.DeviceIdentifier.Data4[3]); - J2dRlsTrace4(J2D_TRACE_INFO, "%02X%02X%02X%02X}\n", - aid.DeviceIdentifier.Data4[4], - aid.DeviceIdentifier.Data4[5], - aid.DeviceIdentifier.Data4[6], - aid.DeviceIdentifier.Data4[7]); + J2dRlsTraceLn(J2D_TRACE_INFO, "Adapter Ordinal : %d", Adapter); + J2dRlsTraceLn(J2D_TRACE_INFO, "Adapter Handle : 0x%x", + pd3d9->GetAdapterMonitor(Adapter)); + J2dRlsTraceLn(J2D_TRACE_INFO, "Description : %s", + aid.Description); + J2dRlsTraceLn(J2D_TRACE_INFO, "GDI Name, Driver : %s, %s", + aid.DeviceName, aid.Driver); + J2dRlsTraceLn(J2D_TRACE_INFO, "Vendor Id : 0x%04x", + aid.VendorId); + J2dRlsTraceLn(J2D_TRACE_INFO, "Device Id : 0x%04x", + aid.DeviceId); + J2dRlsTraceLn(J2D_TRACE_INFO, "SubSys Id : 0x%x", + aid.SubSysId); + J2dRlsTraceLn(J2D_TRACE_INFO, "Driver Version : %d.%d.%d.%d", + HIWORD(aid.DriverVersion.HighPart), + LOWORD(aid.DriverVersion.HighPart), + HIWORD(aid.DriverVersion.LowPart), + LOWORD(aid.DriverVersion.LowPart)); + J2dRlsTrace(J2D_TRACE_INFO, + "[I] GUID : {%08X-%04X-%04X-", + aid.DeviceIdentifier.Data1, + aid.DeviceIdentifier.Data2, + aid.DeviceIdentifier.Data3); + J2dRlsTrace(J2D_TRACE_INFO, "%02X%02X-%02X%02X", + aid.DeviceIdentifier.Data4[0], + aid.DeviceIdentifier.Data4[1], + aid.DeviceIdentifier.Data4[2], + aid.DeviceIdentifier.Data4[3]); + J2dRlsTrace(J2D_TRACE_INFO, "%02X%02X%02X%02X}\n", + aid.DeviceIdentifier.Data4[4], + aid.DeviceIdentifier.Data4[5], + aid.DeviceIdentifier.Data4[6], + aid.DeviceIdentifier.Data4[7]); if (FAILED(CheckForBadHardware(aid.VendorId, aid.DeviceId, aid.DriverVersion.QuadPart)) || @@ -612,9 +612,9 @@ D3DDEVTYPE D3DPipelineManager::SelectDeviceType() J2dRlsTrace(J2D_TRACE_WARNING, "nullref rasterizer selected"); dtype = D3DDEVTYPE_NULLREF; } else { - J2dRlsTrace1(J2D_TRACE_WARNING, - "unknown rasterizer: %s, only (ref|hal|nul) "\ - "supported, hal selected instead", pRas); + J2dRlsTrace(J2D_TRACE_WARNING, + "unknown rasterizer: %s, only (ref|hal|nul) "\ + "supported, hal selected instead", pRas); } J2dRlsTrace(J2D_TRACE_WARNING, "\n"); } @@ -624,10 +624,10 @@ D3DDEVTYPE D3DPipelineManager::SelectDeviceType() #define CHECK_CAP(FLAG, CAP) \ do { \ if (!((FLAG)&CAP)) { \ - J2dRlsTraceLn2(J2D_TRACE_ERROR, \ - "D3DPPLM::CheckDeviceCaps: adapter %d: Failed "\ - "(cap %s not supported)", \ - adapter, #CAP); \ + J2dRlsTraceLn(J2D_TRACE_ERROR, \ + "D3DPPLM::CheckDeviceCaps: adapter %d: Failed "\ + "(cap %s not supported)", \ + adapter, #CAP); \ return E_FAIL; \ } \ } while (0) @@ -684,14 +684,14 @@ HRESULT D3DPipelineManager::CheckDeviceCaps(UINT adapter) CHECK_CAP(d3dCaps.TextureOpCaps, D3DTEXOPCAPS_MODULATE); if (d3dCaps.PixelShaderVersion < D3DPS_VERSION(2,0) && !IsD3DForced()) { - J2dRlsTraceLn1(J2D_TRACE_ERROR, - "D3DPPLM::CheckDeviceCaps: adapter %d: Failed "\ - "(pixel shaders 2.0 required)", adapter); + J2dRlsTraceLn(J2D_TRACE_ERROR, + "D3DPPLM::CheckDeviceCaps: adapter %d: Failed "\ + "(pixel shaders 2.0 required)", adapter); return E_FAIL; } - J2dRlsTraceLn1(J2D_TRACE_INFO, - "D3DPPLM::CheckDeviceCaps: adapter %d: Passed", adapter); + J2dRlsTraceLn(J2D_TRACE_INFO, + "D3DPPLM::CheckDeviceCaps: adapter %d: Passed", adapter); return S_OK; } @@ -706,9 +706,9 @@ HRESULT D3DPipelineManager::D3DEnabledOnAdapter(UINT adapter) res = pd3d9->CheckDeviceType(adapter, devType, dm.Format, dm.Format, TRUE); if (FAILED(res)) { - J2dRlsTraceLn1(J2D_TRACE_ERROR, - "D3DPPLM::D3DEnabledOnAdapter: no " \ - "suitable d3d device on adapter %d", adapter); + J2dRlsTraceLn(J2D_TRACE_ERROR, + "D3DPPLM::D3DEnabledOnAdapter: no " \ + "suitable d3d device on adapter %d", adapter); } return res; @@ -759,9 +759,9 @@ HWND D3DPipelineManager::CreateDefaultFocusWindow() { UINT adapterOrdinal = D3DADAPTER_DEFAULT; - J2dTraceLn1(J2D_TRACE_INFO, - "D3DPPLM::CreateDefaultFocusWindow: adapter=%d", - adapterOrdinal); + J2dTraceLn(J2D_TRACE_INFO, + "D3DPPLM::CreateDefaultFocusWindow: adapter=%d", + adapterOrdinal); if (defaultFocusWindow != 0) { J2dRlsTraceLn(J2D_TRACE_WARNING, @@ -787,9 +787,10 @@ HWND D3DPipelineManager::CreateDefaultFocusWindow() mi.cbSize = sizeof(MONITORINFO); HMONITOR hMon = pd3d9->GetAdapterMonitor(adapterOrdinal); if (hMon == 0 || !GetMonitorInfo(hMon, (LPMONITORINFO)&mi)) { - J2dRlsTraceLn1(J2D_TRACE_ERROR, - "D3DPPLM::CreateDefaultFocusWindow: "\ - "error getting monitor info for adapter=%d", adapterOrdinal); + J2dRlsTraceLn(J2D_TRACE_ERROR, + "D3DPPLM::CreateDefaultFocusWindow: "\ + "error getting monitor info for adapter=%d", + adapterOrdinal); return 0; } @@ -800,9 +801,9 @@ HWND D3DPipelineManager::CreateDefaultFocusWindow() J2dRlsTraceLn(J2D_TRACE_ERROR, "D3DPPLM::CreateDefaultFocusWindow: CreateWindow failed"); } else { - J2dTraceLn2(J2D_TRACE_INFO, - " Created default focus window %x for adapter %d", - hWnd, adapterOrdinal); + J2dTraceLn(J2D_TRACE_INFO, + " Created default focus window %x for adapter %d", + hWnd, adapterOrdinal); defaultFocusWindow = hWnd; } return hWnd; @@ -812,20 +813,20 @@ HWND D3DPipelineManager::GetCurrentFocusWindow() { J2dTraceLn(J2D_TRACE_INFO, "D3DPPLM::GetCurrentFocusWindow"); if (currentFSFocusAdapter < 0) { - J2dTraceLn1(J2D_TRACE_VERBOSE, - " no fs windows, using default focus window=0x%x", - defaultFocusWindow); + J2dTraceLn(J2D_TRACE_VERBOSE, + " no fs windows, using default focus window=0x%x", + defaultFocusWindow); return defaultFocusWindow; } - J2dTraceLn1(J2D_TRACE_VERBOSE, " using fs window=0x%x", - pAdapters[currentFSFocusAdapter].fsFocusWindow); + J2dTraceLn(J2D_TRACE_VERBOSE, " using fs window=0x%x", + pAdapters[currentFSFocusAdapter].fsFocusWindow); return pAdapters[currentFSFocusAdapter].fsFocusWindow; } HWND D3DPipelineManager::SetFSFocusWindow(UINT adapterOrdinal, HWND hWnd) { - J2dTraceLn2(J2D_TRACE_INFO,"D3DPPLM::SetFSFocusWindow hwnd=0x%x adapter=%d", - hWnd, adapterOrdinal); + J2dTraceLn(J2D_TRACE_INFO,"D3DPPLM::SetFSFocusWindow hwnd=0x%x adapter=%d", + hWnd, adapterOrdinal); HWND prev = pAdapters[adapterOrdinal].fsFocusWindow; pAdapters[adapterOrdinal].fsFocusWindow = hWnd; @@ -846,8 +847,8 @@ HWND D3DPipelineManager::SetFSFocusWindow(UINT adapterOrdinal, HWND hWnd) currentFSFocusAdapter = -1; for (i = 0; i < adapterCount; i++) { if (pAdapters[i].fsFocusWindow != 0) { - J2dTraceLn1(J2D_TRACE_VERBOSE, - " adapter %d is still in fs mode", i); + J2dTraceLn(J2D_TRACE_VERBOSE, + " adapter %d is still in fs mode", i); currentFSFocusAdapter = i; break; } @@ -868,9 +869,9 @@ HWND D3DPipelineManager::SetFSFocusWindow(UINT adapterOrdinal, HWND hWnd) } } } else { - J2dTraceLn1(J2D_TRACE_WARNING, - "D3DPM::SetFSFocusWindow: setting the fs "\ - "window again for adapter %d", adapterOrdinal); + J2dTraceLn(J2D_TRACE_WARNING, + "D3DPM::SetFSFocusWindow: setting the fs "\ + "window again for adapter %d", adapterOrdinal); } } } @@ -887,9 +888,9 @@ HRESULT D3DPipelineManager::GetD3DContext(UINT adapterOrdinal, pAdapters == NULL || pAdapters[adapterOrdinal].state == CONTEXT_INIT_FAILED) { - J2dRlsTraceLn1(J2D_TRACE_ERROR, - "D3DPPLM::GetD3DContext: invalid parameters or "\ - "failed init for adapter %d", adapterOrdinal); + J2dRlsTraceLn(J2D_TRACE_ERROR, + "D3DPPLM::GetD3DContext: invalid parameters or "\ + "failed init for adapter %d", adapterOrdinal); *ppd3dContext = NULL; return E_FAIL; } @@ -898,23 +899,24 @@ HRESULT D3DPipelineManager::GetD3DContext(UINT adapterOrdinal, D3DContext *pCtx = NULL; if (pAdapters[adapterOrdinal].pd3dContext != NULL) { - J2dTraceLn1(J2D_TRACE_ERROR, " non-null context in "\ - "uninitialized adapter %d", adapterOrdinal); + J2dTraceLn(J2D_TRACE_ERROR, " non-null context in "\ + "uninitialized adapter %d", adapterOrdinal); res = E_FAIL; } else { - J2dTraceLn1(J2D_TRACE_VERBOSE, - " initializing context for adapter %d",adapterOrdinal); + J2dTraceLn(J2D_TRACE_VERBOSE, + " initializing context for adapter %d",adapterOrdinal); if (SUCCEEDED(res = D3DEnabledOnAdapter(adapterOrdinal))) { res = D3DContext::CreateInstance(pd3d9, adapterOrdinal, &pCtx); if (FAILED(res)) { - J2dRlsTraceLn1(J2D_TRACE_ERROR, - "D3DPPLM::GetD3DContext: failed to create context "\ - "for adapter=%d", adapterOrdinal); + J2dRlsTraceLn(J2D_TRACE_ERROR, "D3DPPLM::GetD3DContext: "\ + "failed to create context "\ + "for adapter=%d", adapterOrdinal); } } else { - J2dRlsTraceLn1(J2D_TRACE_ERROR, - "D3DPPLM::GetContext: no d3d on adapter %d",adapterOrdinal); + J2dRlsTraceLn(J2D_TRACE_ERROR, + "D3DPPLM::GetContext: no d3d on adapter %d", + adapterOrdinal); } } pAdapters[adapterOrdinal].state = @@ -967,8 +969,8 @@ void D3DInitializer::InitImpl() void D3DInitializer::CleanImpl(bool reInit) { - J2dRlsTraceLn1(J2D_TRACE_INFO, "D3DInitializer::CleanImpl (%s)", - reInit ? "RELAUNCH" : "normal"); + J2dRlsTraceLn(J2D_TRACE_INFO, "D3DInitializer::CleanImpl (%s)", + reInit ? "RELAUNCH" : "normal"); D3DPipelineManager::DeleteInstance(); if (bComInitialized) { CoUninitialize(); @@ -978,7 +980,7 @@ void D3DInitializer::CleanImpl(bool reInit) void D3DInitializer::D3DAdapterInitializer::InitImpl() { - J2dRlsTraceLn1(J2D_TRACE_INFO, "D3DAdapterInitializer::InitImpl(%d) started", adapter); + J2dRlsTraceLn(J2D_TRACE_INFO, "D3DAdapterInitializer::InitImpl(%d) started", adapter); D3DPipelineManager *pMgr = D3DPipelineManager::GetInstance(); if (pMgr == NULL) { @@ -988,7 +990,7 @@ void D3DInitializer::D3DAdapterInitializer::InitImpl() D3DContext *pd3dContext; pMgr->GetD3DContext(adapter, &pd3dContext); - J2dRlsTraceLn1(J2D_TRACE_INFO, "D3DAdapterInitializer::InitImpl(%d) finished", adapter); + J2dRlsTraceLn(J2D_TRACE_INFO, "D3DAdapterInitializer::InitImpl(%d) finished", adapter); } void D3DInitializer::D3DAdapterInitializer::CleanImpl(bool reInit) diff --git a/src/java.desktop/windows/native/libawt/java2d/d3d/D3DRenderQueue.cpp b/src/java.desktop/windows/native/libawt/java2d/d3d/D3DRenderQueue.cpp index 5508409b530..2f69fd4269b 100644 --- a/src/java.desktop/windows/native/libawt/java2d/d3d/D3DRenderQueue.cpp +++ b/src/java.desktop/windows/native/libawt/java2d/d3d/D3DRenderQueue.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, 2019, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2007, 2025, 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 @@ -67,8 +67,8 @@ D3DRQ_SwapBuffers(D3DPipelineManager *pMgr, D3DSDOps *d3dsdo, RECT srcRect, dstRect, *pSrcRect, *pDstRect; J2dTraceLn(J2D_TRACE_INFO, "D3DRQ_SwapBuffers"); - J2dTraceLn4(J2D_TRACE_VERBOSE, " x1=%d y1=%d x2=%d y2=%d", - x1, y1, x2, y2); + J2dTraceLn(J2D_TRACE_VERBOSE, " x1=%d y1=%d x2=%d y2=%d", + x1, y1, x2, y2); RETURN_STATUS_IF_NULL(d3dsdo, E_FAIL); RETURN_STATUS_IF_NULL(d3dsdo->pResource, E_FAIL); @@ -106,10 +106,10 @@ D3DRQ_SwapBuffers(D3DPipelineManager *pMgr, D3DSDOps *d3dsdo, int ww = r.right - r.left; int wh = r.bottom - r.top; if (ww != params.BackBufferWidth || wh != params.BackBufferHeight) { - J2dTraceLn4(J2D_TRACE_WARNING, - "D3DRQ_SwapBuffers: surface/window dimensions mismatch: "\ - "win: w=%d h=%d, bb: w=%d h=%d", - ww, wh, params.BackBufferWidth, params.BackBufferHeight); + J2dTraceLn(J2D_TRACE_WARNING, + "D3DRQ_SwapBuffers: surface/window dimensions mismatch: "\ + "win: w=%d h=%d, bb: w=%d h=%d", + ww, wh, params.BackBufferWidth, params.BackBufferHeight); return S_OK; } @@ -200,7 +200,7 @@ void D3DRQ_FlushBuffer(void *pParam) b = pFlush->buffer; limit = pFlush->limit; - J2dTraceLn1(J2D_TRACE_INFO, "D3DRQ_flushBuffer: limit=%d", limit); + J2dTraceLn(J2D_TRACE_INFO, "D3DRQ_flushBuffer: limit=%d", limit); end = b + limit; @@ -219,7 +219,7 @@ void D3DRQ_FlushBuffer(void *pParam) while (b < end) { jint opcode = NEXT_INT(b); - J2dTraceLn1(J2D_TRACE_VERBOSE, "D3DRQ_flushBuffer: opcode=%d", opcode); + J2dTraceLn(J2D_TRACE_VERBOSE, "D3DRQ_flushBuffer: opcode=%d", opcode); switch (opcode) { @@ -839,8 +839,8 @@ void D3DRQ_FlushBuffer(void *pParam) break; default: - J2dRlsTraceLn1(J2D_TRACE_ERROR, - "D3DRQ_flushBuffer: invalid opcode=%d", opcode); + J2dRlsTraceLn(J2D_TRACE_ERROR, + "D3DRQ_flushBuffer: invalid opcode=%d", opcode); return; } // we may mark the surface lost repeatedly but that won't do much harm diff --git a/src/java.desktop/windows/native/libawt/java2d/d3d/D3DRenderer.cpp b/src/java.desktop/windows/native/libawt/java2d/d3d/D3DRenderer.cpp index 384559d90fd..32126ddc2f5 100644 --- a/src/java.desktop/windows/native/libawt/java2d/d3d/D3DRenderer.cpp +++ b/src/java.desktop/windows/native/libawt/java2d/d3d/D3DRenderer.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, 2008, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2007, 2025, 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 @@ -35,9 +35,9 @@ HRESULT D3DRenderer_DrawLine(D3DContext *d3dc, jint x1, jint y1, jint x2, jint y2) { - J2dTraceLn4(J2D_TRACE_INFO, - "D3DRenderer_doDrawLineD3D x1=%-4d y1=%-4d x2=%-4d y2=%-4d", - x1, y1, x2, y2); + J2dTraceLn(J2D_TRACE_INFO, + "D3DRenderer_doDrawLineD3D x1=%-4d y1=%-4d x2=%-4d y2=%-4d", + x1, y1, x2, y2); d3dc->BeginScene(STATE_RENDEROP); return d3dc->pVCacher->DrawLine(x1, y1, x2, y2); } @@ -46,9 +46,9 @@ HRESULT D3DRenderer_DrawRect(D3DContext *d3dc, jint x, jint y, jint w, jint h) { - J2dTraceLn4(J2D_TRACE_INFO, - "D3DRenderer_DrawRect x=%-4d y=%-4d w=%-4d h=%-4d", - x, y, w, h); + J2dTraceLn(J2D_TRACE_INFO, + "D3DRenderer_DrawRect x=%-4d y=%-4d w=%-4d h=%-4d", + x, y, w, h); d3dc->BeginScene(STATE_RENDEROP); return d3dc->pVCacher->DrawRect(x, y, x + w, y + h); @@ -58,9 +58,9 @@ HRESULT D3DRenderer_FillRect(D3DContext *d3dc, jint x, jint y, jint w, jint h) { - J2dTraceLn4(J2D_TRACE_INFO, + J2dTraceLn(J2D_TRACE_INFO, "D3DRenderer_FillRect x=%-4d y=%-4d w=%-4d h=%-4d", - x, y, w, h); + x, y, w, h); d3dc->BeginScene(STATE_RENDEROP); return d3dc->pVCacher->FillRect(x, y, x + w, y + h); @@ -120,14 +120,14 @@ D3DRenderer_FillParallelogram(D3DContext *d3dc, jfloat dx21, jfloat dy21, jfloat dx12, jfloat dy12) { - J2dTraceLn6(J2D_TRACE_INFO, - "D3DRenderer_FillParallelogram " - "x=%6.2f y=%6.2f " - "dx1=%6.2f dy1=%6.2f " - "dx2=%6.2f dy2=%6.2f ", - fx11, fy11, - dx21, dy21, - dx12, dy12); + J2dTraceLn(J2D_TRACE_INFO, + "D3DRenderer_FillParallelogram " + "x=%6.2f y=%6.2f " + "dx1=%6.2f dy1=%6.2f " + "dx2=%6.2f dy2=%6.2f ", + fx11, fy11, + dx21, dy21, + dx12, dy12); d3dc->BeginScene(STATE_RENDEROP); return d3dc->pVCacher->FillParallelogram(fx11, fy11, @@ -144,14 +144,14 @@ D3DRenderer_DrawParallelogram(D3DContext *d3dc, { HRESULT res; - J2dTraceLn8(J2D_TRACE_INFO, - "D3DRenderer_DrawParallelogram " - "x=%6.2f y=%6.2f " - "dx1=%6.2f dy1=%6.2f lwr1=%6.2f " - "dx2=%6.2f dy2=%6.2f lwr2=%6.2f ", - fx11, fy11, - dx21, dy21, lwr21, - dx12, dy12, lwr12); + J2dTraceLn(J2D_TRACE_INFO, + "D3DRenderer_DrawParallelogram " + "x=%6.2f y=%6.2f " + "dx1=%6.2f dy1=%6.2f lwr1=%6.2f " + "dx2=%6.2f dy2=%6.2f lwr2=%6.2f ", + fx11, fy11, + dx21, dy21, lwr21, + dx12, dy12, lwr12); // dx,dy for line width in the "21" and "12" directions. jfloat ldx21 = dx21 * lwr21; @@ -251,14 +251,14 @@ D3DRenderer_FillAAParallelogram(D3DContext *d3dc, IDirect3DDevice9 *pd3dDevice; HRESULT res; - J2dTraceLn6(J2D_TRACE_INFO, - "D3DRenderer_FillAAParallelogram " - "x=%6.2f y=%6.2f " - "dx1=%6.2f dy1=%6.2f " - "dx2=%6.2f dy2=%6.2f ", - fx11, fy11, - dx21, dy21, - dx12, dy12); + J2dTraceLn(J2D_TRACE_INFO, + "D3DRenderer_FillAAParallelogram " + "x=%6.2f y=%6.2f " + "dx1=%6.2f dy1=%6.2f " + "dx2=%6.2f dy2=%6.2f ", + fx11, fy11, + dx21, dy21, + dx12, dy12); res = d3dc->BeginScene(STATE_AAPGRAMOP); RETURN_STATUS_IF_FAILED(res); @@ -290,14 +290,14 @@ D3DRenderer_DrawAAParallelogram(D3DContext *d3dc, jfloat ifx11, ify11, idx21, idy21, idx12, idy12; HRESULT res; - J2dTraceLn8(J2D_TRACE_INFO, - "D3DRenderer_DrawAAParallelogram " - "x=%6.2f y=%6.2f " - "dx1=%6.2f dy1=%6.2f lwr1=%6.2f " - "dx2=%6.2f dy2=%6.2f lwr2=%6.2f ", - fx11, fy11, - dx21, dy21, lwr21, - dx12, dy12, lwr12); + J2dTraceLn(J2D_TRACE_INFO, + "D3DRenderer_DrawAAParallelogram " + "x=%6.2f y=%6.2f " + "dx1=%6.2f dy1=%6.2f lwr1=%6.2f " + "dx2=%6.2f dy2=%6.2f lwr2=%6.2f ", + fx11, fy11, + dx21, dy21, lwr21, + dx12, dy12, lwr12); res = d3dc->BeginScene(STATE_AAPGRAMOP); RETURN_STATUS_IF_FAILED(res); diff --git a/src/java.desktop/windows/native/libawt/java2d/d3d/D3DResourceManager.cpp b/src/java.desktop/windows/native/libawt/java2d/d3d/D3DResourceManager.cpp index 2841cf82fd6..4d2826507d3 100644 --- a/src/java.desktop/windows/native/libawt/java2d/d3d/D3DResourceManager.cpp +++ b/src/java.desktop/windows/native/libawt/java2d/d3d/D3DResourceManager.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, 2008, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2007, 2025, 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 @@ -61,7 +61,7 @@ D3DResource::Init(IDirect3DResource9 *pRes, IDirect3DSwapChain9 *pSC) ((IDirect3DCubeTexture9*)pResource)->GetLevelDesc(0, &desc); break; default: - J2dTraceLn1(J2D_TRACE_VERBOSE, " resource type=%d", type); + J2dTraceLn(J2D_TRACE_VERBOSE, " resource type=%d", type); } } else if (pSwapChain != NULL) { pSwapChain->GetBackBuffer(0, D3DBACKBUFFER_TYPE_MONO, &pSurface); @@ -90,9 +90,9 @@ D3DResource::SetSDOps(D3DSDOps *pOps) if (pOps != NULL && this->pOps != NULL) { // something's wrong, we're overwriting // a non-null field (setting it to null is allowed) - J2dTraceLn2(J2D_TRACE_WARNING, - "D3DResource::SetSDOps: overwriting "\ - "this->pOps=0x%x with pOps=0x%x", this->pOps, pOps); + J2dTraceLn(J2D_TRACE_WARNING, + "D3DResource::SetSDOps: overwriting "\ + "this->pOps=0x%x with pOps=0x%x", this->pOps, pOps); } this->pOps = pOps; } @@ -157,7 +157,7 @@ D3DResourceManager::D3DResourceManager() HRESULT D3DResourceManager::Init(D3DContext *pCtx) { - J2dTraceLn1(J2D_TRACE_INFO, "D3DRM::Init pCtx=%x", pCtx); + J2dTraceLn(J2D_TRACE_INFO, "D3DRM::Init pCtx=%x", pCtx); if (this->pCtx != pCtx || (this->pCtx != NULL && this->pCtx->Get3DDevice() != pCtx->Get3DDevice())) @@ -211,7 +211,7 @@ D3DResourceManager::ReleaseResource(IManagedResource* pResource) J2dTraceLn(J2D_TRACE_INFO, "D3DRM::ReleaseResource"); if (pResource != NULL) { - J2dTraceLn1(J2D_TRACE_VERBOSE, " releasing pResource=%x", pResource); + J2dTraceLn(J2D_TRACE_VERBOSE, " releasing pResource=%x", pResource); if (pResource->pPrev != NULL) { pResource->pPrev->pNext = pResource->pNext; } else { @@ -237,7 +237,7 @@ D3DResourceManager::AddResource(IManagedResource* pResource) J2dTraceLn(J2D_TRACE_INFO, "D3DRM::AddResource"); if (pResource != NULL) { - J2dTraceLn1(J2D_TRACE_VERBOSE, " pResource=%x", pResource); + J2dTraceLn(J2D_TRACE_VERBOSE, " pResource=%x", pResource); pResource->pPrev = NULL; pResource->pNext = pHead; if (pHead != NULL) { @@ -261,8 +261,8 @@ D3DResourceManager::CreateTexture(UINT width, UINT height, IDirect3DDevice9 *pd3dDevice; J2dTraceLn(J2D_TRACE_INFO, "D3DRM::CreateTexture"); - J2dTraceLn4(J2D_TRACE_VERBOSE, " w=%d h=%d isRTT=%d isOpaque=%d", - width, height, isRTT, isOpaque); + J2dTraceLn(J2D_TRACE_VERBOSE, " w=%d h=%d isRTT=%d isOpaque=%d", + width, height, isRTT, isOpaque); if (ppTextureResource == NULL || pCtx == NULL || (pd3dDevice = pCtx->Get3DDevice()) == NULL) @@ -317,7 +317,7 @@ D3DResourceManager::CreateTexture(UINT width, UINT height, res = pd3dDevice->CreateTexture(width, height, 1/*levels*/, dwUsage, format, pool, &pTexture, 0); if (SUCCEEDED(res)) { - J2dTraceLn1(J2D_TRACE_VERBOSE, " created texture: 0x%x", pTexture); + J2dTraceLn(J2D_TRACE_VERBOSE, " created texture: 0x%x", pTexture); *ppTextureResource = new D3DResource((IDirect3DResource9*)pTexture); res = AddResource(*ppTextureResource); } else { @@ -342,8 +342,8 @@ HRESULT D3DResourceManager::CreateRTSurface(UINT width, UINT height, IDirect3DDevice9 *pd3dDevice; J2dTraceLn(J2D_TRACE_INFO, "D3DRM::CreateRTSurface"); - J2dTraceLn3(J2D_TRACE_VERBOSE, " w=%d h=%d isOpaque=%d", - width, height, isOpaque); + J2dTraceLn(J2D_TRACE_VERBOSE, " w=%d h=%d isOpaque=%d", + width, height, isOpaque); if (pCtx == NULL || ppSurfaceResource == NULL || (pd3dDevice = pCtx->Get3DDevice()) == NULL) @@ -363,7 +363,7 @@ HRESULT D3DResourceManager::CreateRTSurface(UINT width, UINT height, isLockable, &pSurface, NULL); if (SUCCEEDED(res)) { - J2dTraceLn1(J2D_TRACE_VERBOSE, " created RT Surface: 0x%x ", pSurface); + J2dTraceLn(J2D_TRACE_VERBOSE, " created RT Surface: 0x%x ", pSurface); if (pFormat != NULL) { *pFormat = format; } @@ -385,7 +385,7 @@ HRESULT D3DResourceManager::CreateOSPSurface(UINT width, UINT height, IDirect3DDevice9 *pd3dDevice; J2dTraceLn(J2D_TRACE_INFO, "D3DRM::CreateOSPSurface"); - J2dTraceLn2(J2D_TRACE_VERBOSE, " w=%d h=%d", width, height); + J2dTraceLn(J2D_TRACE_VERBOSE, " w=%d h=%d", width, height); if (pCtx == NULL || ppSurfaceResource == NULL || (pd3dDevice = pCtx->Get3DDevice()) == NULL) @@ -413,7 +413,7 @@ HRESULT D3DResourceManager::CreateOSPSurface(UINT width, UINT height, format, pool, &pSurface, NULL); if (SUCCEEDED(res)) { - J2dTraceLn1(J2D_TRACE_VERBOSE, " created OSP Surface: 0x%x ",pSurface); + J2dTraceLn(J2D_TRACE_VERBOSE, " created OSP Surface: 0x%x ",pSurface); *ppSurfaceResource = new D3DResource((IDirect3DResource9*)pSurface); res = AddResource(*ppSurfaceResource); } else { @@ -436,8 +436,8 @@ D3DResourceManager::CreateSwapChain(HWND hWnd, UINT numBuffers, D3DPRESENT_PARAMETERS newParams, *curParams; J2dTraceLn(J2D_TRACE_INFO, "D3DRM::CreateSwapChain"); - J2dTraceLn4(J2D_TRACE_VERBOSE, " w=%d h=%d hwnd=%x numBuffers=%d", - width, height, hWnd, numBuffers); + J2dTraceLn(J2D_TRACE_VERBOSE, " w=%d h=%d hwnd=%x numBuffers=%d", + width, height, hWnd, numBuffers); if (pCtx == NULL || ppSwapChainResource == NULL || (pd3dDevice = pCtx->Get3DDevice()) == NULL) @@ -481,7 +481,7 @@ D3DResourceManager::CreateSwapChain(HWND hWnd, UINT numBuffers, } if (SUCCEEDED(res)) { - J2dTraceLn1(J2D_TRACE_VERBOSE," created swap chain: 0x%x ",pSwapChain); + J2dTraceLn(J2D_TRACE_VERBOSE," created swap chain: 0x%x ",pSwapChain); *ppSwapChainResource = new D3DResource(pSwapChain); res = AddResource(*ppSwapChainResource); } else { diff --git a/src/java.desktop/windows/native/libawt/java2d/d3d/D3DShaderGen.c b/src/java.desktop/windows/native/libawt/java2d/d3d/D3DShaderGen.c index 51c9b37801e..14de44a85f2 100644 --- a/src/java.desktop/windows/native/libawt/java2d/d3d/D3DShaderGen.c +++ b/src/java.desktop/windows/native/libawt/java2d/d3d/D3DShaderGen.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, 2008, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2007, 2025, 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 @@ -55,10 +55,8 @@ static char *strHeaderFile = "D3DShaders.h"; (((flags) & (flagbit)) != 0) // REMIND -//#define J2dTraceLn(a, b) fprintf(stderr, "%s\n", b); -//#define J2dTraceLn1(a, b, c) fprintf(stderr, b, c); -#define J2dTraceLn(a, b) -#define J2dTraceLn1(a, b, c) +//#define J2dTraceLn(level, ...) (fprintf(stderr, __VA_ARGS__), fprintf(stderr, "\n")); +#define J2dTraceLn(level, ...) /************************* General shader support ***************************/ @@ -212,9 +210,9 @@ D3DShaderGen_GenerateConvolveShader(int flags) char *edge; char finalSource[2000]; - J2dTraceLn1(J2D_TRACE_INFO, - "D3DShaderGen_GenerateConvolveShader: flags=%d", - flags); + J2dTraceLn(J2D_TRACE_INFO, + "D3DShaderGen_GenerateConvolveShader: flags=%d", + flags); if (IS_SET(CONVOLVE_EDGE_ZERO_FILL)) { // EDGE_ZERO_FILL: fill in zero at the edges @@ -273,9 +271,9 @@ D3DShaderGen_GenerateRescaleShader(int flags) char *postRescale = ""; char finalSource[2000]; - J2dTraceLn1(J2D_TRACE_INFO, - "D3DShaderGen_GenerateRescaleShader: flags=%d", - flags); + J2dTraceLn(J2D_TRACE_INFO, + "D3DShaderGen_GenerateRescaleShader: flags=%d", + flags); if (IS_SET(RESCALE_NON_PREMULT)) { preRescale = "srcColor.rgb /= srcColor.a;"; @@ -338,9 +336,9 @@ D3DShaderGen_GenerateLookupShader(int flags) char *postLookup = ""; char finalSource[2000]; - J2dTraceLn1(J2D_TRACE_INFO, - "D3DShaderGen_GenerateLookupShader: flags=%d", - flags); + J2dTraceLn(J2D_TRACE_INFO, + "D3DShaderGen_GenerateLookupShader: flags=%d", + flags); if (IS_SET(LOOKUP_USE_SRC_ALPHA)) { // when numComps is 1 or 3, the alpha is not looked up in the table; @@ -427,9 +425,9 @@ D3DShaderGen_GenerateBasicGradShader(int flags) char *maskCode = ""; char finalSource[3000]; - J2dTraceLn1(J2D_TRACE_INFO, - "D3DShaderGen_GenerateBasicGradShader", - flags); + J2dTraceLn(J2D_TRACE_INFO, + "D3DShaderGen_GenerateBasicGradShader", + flags); if (IS_SET(BASIC_GRAD_IS_CYCLIC)) { cycleCode = @@ -689,9 +687,9 @@ D3DShaderGen_GenerateLinearGradShader(int flags) char *paintVars; char *distCode; - J2dTraceLn1(J2D_TRACE_INFO, - "D3DShaderGen_GenerateLinearGradShader", - flags); + J2dTraceLn(J2D_TRACE_INFO, + "D3DShaderGen_GenerateLinearGradShader", + flags); /* * To simplify the code and to make it easier to upload a number of @@ -720,9 +718,9 @@ D3DShaderGen_GenerateRadialGradShader(int flags) char *paintVars; char *distCode; - J2dTraceLn1(J2D_TRACE_INFO, - "D3DShaderGen_GenerateRadialGradShader", - flags); + J2dTraceLn(J2D_TRACE_INFO, + "D3DShaderGen_GenerateRadialGradShader", + flags); /* * To simplify the code and to make it easier to upload a number of diff --git a/src/java.desktop/windows/native/libawt/java2d/d3d/D3DSurfaceData.cpp b/src/java.desktop/windows/native/libawt/java2d/d3d/D3DSurfaceData.cpp index 38d9e1ecc58..9527760033c 100644 --- a/src/java.desktop/windows/native/libawt/java2d/d3d/D3DSurfaceData.cpp +++ b/src/java.desktop/windows/native/libawt/java2d/d3d/D3DSurfaceData.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2007, 2025, 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 @@ -248,8 +248,8 @@ JNICALL Java_sun_java2d_d3d_D3DSurfaceData_initTexture isRTT, isOpaque, &format, 0/*usage*/, &d3dsdo->pResource); if (SUCCEEDED(res)) { - J2dTraceLn1(J2D_TRACE_VERBOSE, - " created texture pResource=%x", d3dsdo->pResource); + J2dTraceLn(J2D_TRACE_VERBOSE, + " created texture pResource=%x", d3dsdo->pResource); d3dsdo->pResource->SetSDOps(d3dsdo); } else { D3DRQ_MarkLostIfNeeded(res, d3dsdo); @@ -293,8 +293,8 @@ Java_sun_java2d_d3d_D3DSurfaceData_initRTSurface isOpaque, FALSE /*lockable*/, &format, &d3dsdo->pResource); if (SUCCEEDED(res)) { - J2dTraceLn1(J2D_TRACE_VERBOSE, " created RT surface pResource=0x%x", - d3dsdo->pResource); + J2dTraceLn(J2D_TRACE_VERBOSE, " created RT surface pResource=0x%x", + d3dsdo->pResource); d3dsdo->pResource->SetSDOps(d3dsdo); } else { D3DRQ_MarkLostIfNeeded(res, d3dsdo); @@ -390,8 +390,8 @@ JNICALL Java_sun_java2d_d3d_D3DSurfaceData_initFlipBackbuffer d3dsdo->swapEffect, presentationInterval, &d3dsdo->pResource); if (SUCCEEDED(res)) { - J2dTraceLn1(J2D_TRACE_VERBOSE, " created swap chain pResource=0x%x", - d3dsdo->pResource); + J2dTraceLn(J2D_TRACE_VERBOSE, " created swap chain pResource=0x%x", + d3dsdo->pResource); d3dsdo->pResource->SetSDOps(d3dsdo); } else { D3DRQ_MarkLostIfNeeded(res, d3dsdo); @@ -531,7 +531,7 @@ JNIEXPORT jlong JNICALL { D3DSDOps *d3dsdo; - J2dTraceLn(J2D_TRACE_INFO, "D3DSurfaceData_getNativeResourceNative") + J2dTraceLn(J2D_TRACE_INFO, "D3DSurfaceData_getNativeResourceNative"); RETURN_STATUS_IF_NULL(d3dsdo = (D3DSDOps *)jlong_to_ptr(pData), 0L); diff --git a/src/java.desktop/windows/native/libawt/java2d/d3d/D3DTextRenderer.cpp b/src/java.desktop/windows/native/libawt/java2d/d3d/D3DTextRenderer.cpp index c86e2f14a40..c8ed19914fb 100644 --- a/src/java.desktop/windows/native/libawt/java2d/d3d/D3DTextRenderer.cpp +++ b/src/java.desktop/windows/native/libawt/java2d/d3d/D3DTextRenderer.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2007, 2025, 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 @@ -133,8 +133,8 @@ D3DTR_UpdateLCDTextColor(D3DContext *d3dc, jint contrast) jfloat gamma = ((jfloat)contrast) / 100.0f; jfloat clr[4]; - J2dTraceLn1(J2D_TRACE_INFO, - "D3DTR_UpdateLCDTextColor: contrast=%d", contrast); + J2dTraceLn(J2D_TRACE_INFO, + "D3DTR_UpdateLCDTextColor: contrast=%d", contrast); /* * Note: Ideally we would update the "srcAdj" uniform parameter only diff --git a/src/java.desktop/windows/native/libawt/java2d/d3d/D3DVertexCacher.cpp b/src/java.desktop/windows/native/libawt/java2d/d3d/D3DVertexCacher.cpp index 4f108001b87..300ffd73bed 100644 --- a/src/java.desktop/windows/native/libawt/java2d/d3d/D3DVertexCacher.cpp +++ b/src/java.desktop/windows/native/libawt/java2d/d3d/D3DVertexCacher.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2007, 2025, 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 @@ -733,11 +733,11 @@ HRESULT D3DVertexCacher::Render(int actionType) res = lpD3DVertexBuffer->Unlock(); UINT currentVertex = firstPendingVertex; UINT batchSize; - J2dTraceLn2(J2D_TRACE_VERBOSE, - "D3DVC::Render Starting flushing of %d vertices "\ - "in %d batches", - pendingVertices, - (currentBatch - firstPendingBatch + 1)); + J2dTraceLn(J2D_TRACE_VERBOSE, + "D3DVC::Render Starting flushing of %d vertices "\ + "in %d batches", + pendingVertices, + (currentBatch - firstPendingBatch + 1)); for (UINT b = firstPendingBatch; b <= currentBatch; b++) { @@ -785,20 +785,20 @@ HRESULT D3DVertexCacher::EnsureCapacity(D3DPRIMITIVETYPE newPType, UINT vNum) // if we can't fit new vertices in the vertex buffer, // render whatever we have in the buffer and start // from the beginning of the vertex buffer - J2dTraceLn2(J2D_TRACE_VERBOSE, - "D3DVC::EnsureCapacity exceeded capacity. "\ - "current v: %d, requested vertices: %d\n", - firstUnusedVertex, vNum); + J2dTraceLn(J2D_TRACE_VERBOSE, + "D3DVC::EnsureCapacity exceeded capacity. "\ + "current v: %d, requested vertices: %d\n", + firstUnusedVertex, vNum); if (FAILED(res = Render(RESET_ACTION))) { return res; } } - J2dTraceLn5(J2D_TRACE_VERBOSE, - "D3DVC::EnsureCapacity current batch: %d "\ - " batch.type=%d newType=%d vNum=%d firstUnusedV=%d", - currentBatch, batches[currentBatch].pType, newPType, vNum, - firstUnusedVertex); + J2dTraceLn(J2D_TRACE_VERBOSE, + "D3DVC::EnsureCapacity current batch: %d "\ + " batch.type=%d newType=%d vNum=%d firstUnusedV=%d", + currentBatch, batches[currentBatch].pType, newPType, vNum, + firstUnusedVertex); // there should not be multiple linestrips in a batch, // or they will be counted as a single line strip if (batches[currentBatch].pType != newPType || diff --git a/src/java.desktop/windows/native/libawt/java2d/opengl/WGLGraphicsConfig.c b/src/java.desktop/windows/native/libawt/java2d/opengl/WGLGraphicsConfig.c index 0b495738a5a..7f69093388b 100644 --- a/src/java.desktop/windows/native/libawt/java2d/opengl/WGLGraphicsConfig.c +++ b/src/java.desktop/windows/native/libawt/java2d/opengl/WGLGraphicsConfig.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2004, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2004, 2025, 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 @@ -245,9 +245,9 @@ WGLGC_GetPixelFormatForDC(HDC hdc) db = attrVals[2]; alpha = attrVals[3]; - J2dRlsTrace5(J2D_TRACE_VERBOSE, - "[V] pixfmt=%d db=%d alpha=%d depth=%d stencil=%d valid=", - pixfmt, db, alpha, depth, stencil); + J2dRlsTrace(J2D_TRACE_VERBOSE, "[V] "\ + "pixfmt=%d db=%d alpha=%d depth=%d stencil=%d valid=", + pixfmt, db, alpha, depth, stencil); if ((depth + stencil) < minDepthPlusStencil) { J2dRlsTrace(J2D_TRACE_VERBOSE, "true\n"); @@ -264,9 +264,8 @@ WGLGC_GetPixelFormatForDC(HDC hdc) return 0; } - J2dRlsTraceLn1(J2D_TRACE_INFO, - "WGLGC_GetPixelFormatForDC: chose %d as the best pixel format", - chosenPixFmt); + J2dRlsTraceLn(J2D_TRACE_INFO, "WGLGC_GetPixelFormatForDC: "\ + "chose %d as the best pixel format", chosenPixFmt); return chosenPixFmt; } @@ -595,9 +594,9 @@ Java_sun_java2d_opengl_WGLGraphicsConfig_getWGLConfigInfo(JNIEnv *env, extstr = j2d_wglGetExtensionsStringARB(hdc); OGLContext_GetExtensionInfo(env, &caps); - J2dRlsTraceLn1(J2D_TRACE_INFO, - "WGLGraphicsConfig_getWGLConfigInfo: OpenGL version=%s", - (versionstr == NULL) ? "null" : (char *)versionstr); + J2dRlsTraceLn(J2D_TRACE_INFO, + "WGLGraphicsConfig_getWGLConfigInfo: OpenGL version=%s", + (versionstr == NULL) ? "null" : (char *)versionstr); if (!OGLContext_IsVersionSupported(versionstr)) { J2dRlsTraceLn(J2D_TRACE_ERROR, diff --git a/src/java.desktop/windows/native/libawt/java2d/opengl/WGLSurfaceData.c b/src/java.desktop/windows/native/libawt/java2d/opengl/WGLSurfaceData.c index 76bbb89c526..c83e42a4d40 100644 --- a/src/java.desktop/windows/native/libawt/java2d/opengl/WGLSurfaceData.c +++ b/src/java.desktop/windows/native/libawt/java2d/opengl/WGLSurfaceData.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2004, 2019, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2004, 2025, 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 @@ -212,9 +212,9 @@ OGLSD_MakeOGLContextCurrent(JNIEnv *env, OGLSDOps *srcOps, OGLSDOps *dstOps) J2dTraceLn(J2D_TRACE_INFO, "OGLSD_MakeOGLContextCurrent"); - J2dTraceLn4(J2D_TRACE_VERBOSE, " src: %d %p dst: %d %p", - srcOps->drawableType, srcOps, - dstOps->drawableType, dstOps); + J2dTraceLn(J2D_TRACE_VERBOSE, " src: %d %p dst: %d %p", + srcOps->drawableType, srcOps, + dstOps->drawableType, dstOps); oglc = dstWGLOps->configInfo->context; if (oglc == NULL) { @@ -354,8 +354,8 @@ OGLSD_InitOGLWindow(JNIEnv *env, OGLSDOps *oglsdo) oglsdo->height = wbounds.bottom - wbounds.top; wglsdo->pbufferDC = 0; - J2dTraceLn2(J2D_TRACE_VERBOSE, " created window: w=%d h=%d", - oglsdo->width, oglsdo->height); + J2dTraceLn(J2D_TRACE_VERBOSE, " created window: w=%d h=%d", + oglsdo->width, oglsdo->height); return JNI_TRUE; } diff --git a/src/java.desktop/windows/native/libawt/java2d/windows/GDIRenderer.cpp b/src/java.desktop/windows/native/libawt/java2d/windows/GDIRenderer.cpp index bea2b07e08f..18dfe01ff33 100644 --- a/src/java.desktop/windows/native/libawt/java2d/windows/GDIRenderer.cpp +++ b/src/java.desktop/windows/native/libawt/java2d/windows/GDIRenderer.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1999, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1999, 2025, 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 @@ -132,9 +132,9 @@ Java_sun_java2d_windows_GDIRenderer_doDrawLine jint x1, jint y1, jint x2, jint y2) { J2dTraceLn(J2D_TRACE_INFO, "GDIRenderer_doDrawLine"); - J2dTraceLn5(J2D_TRACE_VERBOSE, - " color=0x%x x1=%-4d y1=%-4d x2=%-4d y2=%-4d", - color, x1, y1, x2, y2); + J2dTraceLn(J2D_TRACE_VERBOSE, + " color=0x%x x1=%-4d y1=%-4d x2=%-4d y2=%-4d", + color, x1, y1, x2, y2); GDIWinSDOps *wsdo = GDIWindowSurfaceData_GetOps(env, sData); if (wsdo == NULL) { return; @@ -179,9 +179,9 @@ Java_sun_java2d_windows_GDIRenderer_doDrawRect jint x, jint y, jint w, jint h) { J2dTraceLn(J2D_TRACE_INFO, "GDIRenderer_doDrawRect"); - J2dTraceLn5(J2D_TRACE_VERBOSE, - " color=0x%x x=%-4d y=%-4d w=%-4d h=%-4d", - color, x, y, w, h); + J2dTraceLn(J2D_TRACE_VERBOSE, + " color=0x%x x=%-4d y=%-4d w=%-4d h=%-4d", + color, x, y, w, h); if (w < 0 || h < 0) { return; } @@ -224,11 +224,11 @@ Java_sun_java2d_windows_GDIRenderer_doDrawRoundRect jint x, jint y, jint w, jint h, jint arcW, jint arcH) { J2dTraceLn(J2D_TRACE_INFO, "GDIRenderer_doDrawRoundRect"); - J2dTraceLn5(J2D_TRACE_VERBOSE, - " color=0x%x x=%-4d y=%-4d w=%-4d h=%-4d", - color, x, y, w, h); - J2dTraceLn2(J2D_TRACE_VERBOSE, " arcW=%-4d arcH=%-4d", - arcW, arcH); + J2dTraceLn(J2D_TRACE_VERBOSE, + " color=0x%x x=%-4d y=%-4d w=%-4d h=%-4d", + color, x, y, w, h); + J2dTraceLn(J2D_TRACE_VERBOSE, " arcW=%-4d arcH=%-4d", + arcW, arcH); if (w < 2 || h < 2 || arcW <= 0 || arcH <= 0) { // Fix for 4524760 - drawRoundRect0 test case fails on Windows 98 // Thin round rects degenerate into regular rectangles @@ -268,9 +268,9 @@ Java_sun_java2d_windows_GDIRenderer_doDrawOval jint x, jint y, jint w, jint h) { J2dTraceLn(J2D_TRACE_INFO, "GDIRenderer_doDrawOval"); - J2dTraceLn5(J2D_TRACE_VERBOSE, - " color=0x%x x=%-4d y=%-4d w=%-4d h=%-4d", - color, x, y, w, h); + J2dTraceLn(J2D_TRACE_VERBOSE, + " color=0x%x x=%-4d y=%-4d w=%-4d h=%-4d", + color, x, y, w, h); if (w < 2 || h < 2) { // Thin enough ovals have no room for curvature. Defer to // the DrawRect method which handles degenerate sizes better. @@ -307,12 +307,12 @@ Java_sun_java2d_windows_GDIRenderer_doDrawArc jint angleStart, jint angleExtent) { J2dTraceLn(J2D_TRACE_INFO, "GDIRenderer_doDrawArc"); - J2dTraceLn5(J2D_TRACE_VERBOSE, - " color=0x%x x=%-4d y=%-4d w=%-4d h=%-4d", - color, x, y, w, h); - J2dTraceLn2(J2D_TRACE_VERBOSE, - " angleStart=%-4d angleExtent=%-4d", - angleStart, angleExtent); + J2dTraceLn(J2D_TRACE_VERBOSE, + " color=0x%x x=%-4d y=%-4d w=%-4d h=%-4d", + color, x, y, w, h); + J2dTraceLn(J2D_TRACE_VERBOSE, + " angleStart=%-4d angleExtent=%-4d", + angleStart, angleExtent); if (w < 0 || h < 0 || angleExtent == 0) { return; } @@ -364,10 +364,10 @@ Java_sun_java2d_windows_GDIRenderer_doDrawPoly jint npoints, jboolean isclosed) { J2dTraceLn(J2D_TRACE_INFO, "GDIRenderer_doDrawPoly"); - J2dTraceLn5(J2D_TRACE_VERBOSE, - " color=0x%x transx=%-4d transy=%-4d "\ - "npoints=%-4d isclosed=%-4d", - color, transx, transy, npoints, isclosed); + J2dTraceLn(J2D_TRACE_VERBOSE, + " color=0x%x transx=%-4d transy=%-4d "\ + "npoints=%-4d isclosed=%-4d", + color, transx, transy, npoints, isclosed); if (JNU_IsNull(env, xpointsarray) || JNU_IsNull(env, ypointsarray)) { JNU_ThrowNullPointerException(env, "coordinate array"); return; @@ -434,9 +434,9 @@ Java_sun_java2d_windows_GDIRenderer_doFillRect jint x, jint y, jint w, jint h) { J2dTraceLn(J2D_TRACE_INFO, "GDIRenderer_doFillRect"); - J2dTraceLn5(J2D_TRACE_VERBOSE, - " color=0x%x x=%-4d y=%-4d w=%-4d h=%-4d", - color, x, y, w, h); + J2dTraceLn(J2D_TRACE_VERBOSE, + " color=0x%x x=%-4d y=%-4d w=%-4d h=%-4d", + color, x, y, w, h); if (w <= 0 || h <= 0) { return; } @@ -467,11 +467,11 @@ Java_sun_java2d_windows_GDIRenderer_doFillRoundRect jint x, jint y, jint w, jint h, jint arcW, jint arcH) { J2dTraceLn(J2D_TRACE_INFO, "GDIRenderer_doFillRoundRect"); - J2dTraceLn5(J2D_TRACE_VERBOSE, - " color=0x%x x=%-4d y=%-4d w=%-4d h=%-4d", - color, x, y, w, h); - J2dTraceLn2(J2D_TRACE_VERBOSE, " arcW=%-4d arcH=%-4d", - arcW, arcH); + J2dTraceLn(J2D_TRACE_VERBOSE, + " color=0x%x x=%-4d y=%-4d w=%-4d h=%-4d", + color, x, y, w, h); + J2dTraceLn(J2D_TRACE_VERBOSE, " arcW=%-4d arcH=%-4d", + arcW, arcH); if (w < 2 || h < 2 || arcW <= 0 || arcH <= 0) { // Fix related to 4524760 - drawRoundRect0 fails on Windows 98 // Thin round rects have no room for curvature. Also, if @@ -510,9 +510,9 @@ Java_sun_java2d_windows_GDIRenderer_doFillOval jint x, jint y, jint w, jint h) { J2dTraceLn(J2D_TRACE_INFO, "GDIRenderer_doFillOval"); - J2dTraceLn5(J2D_TRACE_VERBOSE, - " color=0x%x x=%-4d y=%-4d w=%-4d h=%-4d", - color, x, y, w, h); + J2dTraceLn(J2D_TRACE_VERBOSE, + " color=0x%x x=%-4d y=%-4d w=%-4d h=%-4d", + color, x, y, w, h); if (w < 3 || h < 3) { // Fix for 4411814 - small ovals do not draw anything // (related to 4205762 on Solaris platform) @@ -578,12 +578,12 @@ Java_sun_java2d_windows_GDIRenderer_doFillArc jint angleStart, jint angleExtent) { J2dTraceLn(J2D_TRACE_INFO, "GDIRenderer_doFillArc"); - J2dTraceLn5(J2D_TRACE_VERBOSE, - " color=0x%x x=%-4d y=%-4d w=%-4d h=%-4d", - color, x, y, w, h); - J2dTraceLn2(J2D_TRACE_VERBOSE, - " angleStart=%-4d angleExtent=%-4d", - angleStart, angleExtent); + J2dTraceLn(J2D_TRACE_VERBOSE, + " color=0x%x x=%-4d y=%-4d w=%-4d h=%-4d", + color, x, y, w, h); + J2dTraceLn(J2D_TRACE_VERBOSE, + " angleStart=%-4d angleExtent=%-4d", + angleStart, angleExtent); if (w <= 0 || h <= 0 || angleExtent == 0) { return; } @@ -639,9 +639,9 @@ Java_sun_java2d_windows_GDIRenderer_doFillPoly jint npoints) { J2dTraceLn(J2D_TRACE_INFO, "GDIRenderer_doFillPoly"); - J2dTraceLn4(J2D_TRACE_VERBOSE, - " color=0x%x transx=%-4d transy=%-4d npoints=%-4d", - color, transx, transy, npoints); + J2dTraceLn(J2D_TRACE_VERBOSE, + " color=0x%x transx=%-4d transy=%-4d npoints=%-4d", + color, transx, transy, npoints); if (JNU_IsNull(env, xpointsarray) || JNU_IsNull(env, ypointsarray)) { JNU_ThrowNullPointerException(env, "coordinate array"); return; @@ -710,9 +710,9 @@ Java_sun_java2d_windows_GDIRenderer_doShape jobject p2df, jboolean isfill) { J2dTraceLn(J2D_TRACE_INFO, "GDIRenderer_doShape"); - J2dTraceLn4(J2D_TRACE_VERBOSE, - " color=0x%x transx=%-4d transy=%-4d isfill=%-4d", - color, transX, transY, isfill); + J2dTraceLn(J2D_TRACE_VERBOSE, + " color=0x%x transx=%-4d transy=%-4d isfill=%-4d", + color, transX, transY, isfill); GDIWinSDOps *wsdo = GDIWindowSurfaceData_GetOps(env, sData); if (wsdo == NULL) { return; @@ -892,9 +892,9 @@ Java_sun_java2d_windows_GDIRenderer_devCopyArea { GDIWinSDOps *wsdo = GDIWindowSurfaceData_GetOps(env, wsd); J2dTraceLn(J2D_TRACE_INFO, "GDIWindowSurfaceData_devCopyArea"); - J2dTraceLn4(J2D_TRACE_VERBOSE, " srcx=%-4d srcy=%-4d dx=%-4d dy=%-4d", - srcx, srcy, dx, dy); - J2dTraceLn2(J2D_TRACE_VERBOSE, " w=%-4d h=%-4d", width, height); + J2dTraceLn(J2D_TRACE_VERBOSE, " srcx=%-4d srcy=%-4d dx=%-4d dy=%-4d", + srcx, srcy, dx, dy); + J2dTraceLn(J2D_TRACE_VERBOSE, " w=%-4d h=%-4d", width, height); if (wsdo == NULL) { return; } diff --git a/src/java.desktop/windows/native/libawt/java2d/windows/GDIWindowSurfaceData.cpp b/src/java.desktop/windows/native/libawt/java2d/windows/GDIWindowSurfaceData.cpp index 406a82a022f..004637737d3 100644 --- a/src/java.desktop/windows/native/libawt/java2d/windows/GDIWindowSurfaceData.cpp +++ b/src/java.desktop/windows/native/libawt/java2d/windows/GDIWindowSurfaceData.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1999, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1999, 2025, 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 @@ -76,9 +76,9 @@ void SetupThreadGraphicsInfo(JNIEnv *env, GDIWinSDOps *wsdo) { info = new ThreadGraphicsInfo; ZeroMemory(info, sizeof(ThreadGraphicsInfo)); TlsSetValue(threadInfoIndex, (LPVOID)info); - J2dTraceLn2(J2D_TRACE_VERBOSE, - " current batch limit for thread 0x%x is %d", - GetCurrentThreadId(), ::GdiGetBatchLimit()); + J2dTraceLn(J2D_TRACE_VERBOSE, + " current batch limit for thread 0x%x is %d", + GetCurrentThreadId(), ::GdiGetBatchLimit()); J2dTraceLn(J2D_TRACE_VERBOSE, " setting to the limit to 1"); // Fix for bug 4374079 ::GdiSetBatchLimit(1); @@ -403,8 +403,8 @@ Java_sun_java2d_windows_GDIWindowSurfaceData_initOps(JNIEnv *env, jobject wsd, // GDIWindowSurfaceData_GetWindow will throw NullPointerException // if wsdo->window is NULL wsdo->window = GDIWindowSurfaceData_GetWindow(env, wsdo); - J2dTraceLn2(J2D_TRACE_VERBOSE, " wsdo=0x%x wsdo->window=0x%x", - wsdo, wsdo->window); + J2dTraceLn(J2D_TRACE_VERBOSE, " wsdo=0x%x wsdo->window=0x%x", + wsdo, wsdo->window); { Devices::InstanceAccess devices; @@ -414,15 +414,15 @@ Java_sun_java2d_windows_GDIWindowSurfaceData_initOps(JNIEnv *env, jobject wsd, !SurfaceDepthsCompatible(depth, wsdo->device->GetBitDepth())) { if (wsdo->device != NULL) { - J2dTraceLn2(J2D_TRACE_WARNING, - "GDIWindowSurfaceData_initOps: Surface depth mismatch: "\ - "wsdo->depth=%d device depth=%d. Surface invalidated.", - wsdo->depth, wsdo->device->GetBitDepth()); + J2dTraceLn(J2D_TRACE_WARNING, + "GDIWindowSurfaceData_initOps: Surface depth mismatch: "\ + "wsdo->depth=%d device depth=%d. Surface invalidated.", + wsdo->depth, wsdo->device->GetBitDepth()); } else { - J2dTraceLn1(J2D_TRACE_WARNING, - "GDIWindowSurfaceData_initOps: Incorrect "\ - "screen number (screen=%d). Surface invalidated.", - screen); + J2dTraceLn(J2D_TRACE_WARNING, + "GDIWindowSurfaceData_initOps: Incorrect "\ + "screen number (screen=%d). Surface invalidated.", + screen); } wsdo->invalid = JNI_TRUE; @@ -461,9 +461,9 @@ GDIWindowSurfaceData_GetComp(JNIEnv *env, GDIWinSDOps *wsdo) jobject localObj = env->NewLocalRef(wsdo->peer); if (localObj == NULL || (pData = JNI_GET_PDATA(localObj)) == NULL) { - J2dTraceLn1(J2D_TRACE_WARNING, - "GDIWindowSurfaceData_GetComp: Null pData? pData=0x%x", - pData); + J2dTraceLn(J2D_TRACE_WARNING, + "GDIWindowSurfaceData_GetComp: Null pData? pData=0x%x", + pData); if (beingShutdown == JNI_TRUE) { wsdo->invalid = JNI_TRUE; return (AwtComponent *) NULL; @@ -1057,8 +1057,8 @@ static void GDIWinSD_ReleaseDC(JNIEnv *env, GDIWinSDOps *wsdo, HDC hDC) static void GDIWinSD_InvalidateSD(JNIEnv *env, GDIWinSDOps *wsdo) { J2dTraceLn(J2D_TRACE_INFO, "GDIWinSD_InvalidateSD"); - J2dTraceLn2(J2D_TRACE_VERBOSE, " wsdo=0x%x wsdo->window=0x%x", - wsdo, wsdo->window); + J2dTraceLn(J2D_TRACE_VERBOSE, " wsdo=0x%x wsdo->window=0x%x", + wsdo, wsdo->window); wsdo->invalid = JNI_TRUE; } diff --git a/src/java.desktop/windows/native/libawt/java2d/windows/WindowsFlags.cpp b/src/java.desktop/windows/native/libawt/java2d/windows/WindowsFlags.cpp index 9ed0f38bd10..189525c39a1 100644 --- a/src/java.desktop/windows/native/libawt/java2d/windows/WindowsFlags.cpp +++ b/src/java.desktop/windows/native/libawt/java2d/windows/WindowsFlags.cpp @@ -93,12 +93,12 @@ void GetFlagValues(JNIEnv *env, jclass wFlagsClass) JNU_CHECK_EXCEPTION(env); J2dTraceLn(J2D_TRACE_INFO, "WindowsFlags (native):"); - J2dTraceLn1(J2D_TRACE_INFO, " d3dEnabled = %s", - (useD3D ? "true" : "false")); - J2dTraceLn1(J2D_TRACE_INFO, " d3dSet = %s", - (forceD3DUsage ? "true" : "false")); - J2dTraceLn1(J2D_TRACE_INFO, " setHighDPIAware = %s", - (setHighDPIAware ? "true" : "false")); + J2dTraceLn(J2D_TRACE_INFO, " d3dEnabled = %s", + (useD3D ? "true" : "false")); + J2dTraceLn(J2D_TRACE_INFO, " d3dSet = %s", + (forceD3DUsage ? "true" : "false")); + J2dTraceLn(J2D_TRACE_INFO, " setHighDPIAware = %s", + (setHighDPIAware ? "true" : "false")); } void SetD3DEnabledFlag(JNIEnv *env, BOOL d3dEnabled, BOOL d3dSet) diff --git a/src/java.desktop/windows/native/libawt/windows/Devices.cpp b/src/java.desktop/windows/native/libawt/windows/Devices.cpp index e275cb77a57..8096b1084a2 100644 --- a/src/java.desktop/windows/native/libawt/windows/Devices.cpp +++ b/src/java.desktop/windows/native/libawt/windows/Devices.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2025, 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 @@ -99,13 +99,17 @@ static BOOL IsValidMonitor(HMONITOR hMon) memset((void*)(&mieInfo), 0, sizeof(MONITORINFOEX)); mieInfo.cbSize = sizeof(MONITORINFOEX); if (!::GetMonitorInfo(hMon, (LPMONITORINFOEX)(&mieInfo))) { - J2dTraceLn1(J2D_TRACE_INFO, "Devices::IsValidMonitor: GetMonitorInfo failed for monitor with handle %p", hMon); + J2dTraceLn(J2D_TRACE_INFO, + "Devices::IsValidMonitor: GetMonitorInfo failed for monitor with handle %p", + hMon); return FALSE; } HDC hDC = CreateDC(mieInfo.szDevice, NULL, NULL, NULL); if (NULL == hDC) { - J2dTraceLn2(J2D_TRACE_INFO, "Devices::IsValidMonitor: CreateDC failed for monitor with handle %p, device: %S", hMon, mieInfo.szDevice); + J2dTraceLn(J2D_TRACE_INFO, + "Devices::IsValidMonitor: CreateDC failed for monitor with handle %p, device: %S", + hMon, mieInfo.szDevice); return FALSE; } @@ -183,7 +187,7 @@ CriticalSection Devices::arrayLock; */ Devices::Devices(int numDevices) { - J2dTraceLn1(J2D_TRACE_INFO, "Devices::Devices numDevices=%d", numDevices); + J2dTraceLn(J2D_TRACE_INFO, "Devices::Devices numDevices=%d", numDevices); this->numDevices = numDevices; this->refCount = 0; devices = (AwtWin32GraphicsDevice**)SAFE_SIZE_ARRAY_ALLOC(safe_Malloc, @@ -224,7 +228,7 @@ BOOL Devices::UpdateInstance(JNIEnv *env) AwtWin32GraphicsDevice** rawDevices = newDevices->GetRawArray(); int i; for (i = 0; i < numScreens; ++i) { - J2dTraceLn2(J2D_TRACE_VERBOSE, " hmon[%d]=0x%x", i, monHds[i]); + J2dTraceLn(J2D_TRACE_VERBOSE, " hmon[%d]=0x%x", i, monHds[i]); rawDevices[i] = new AwtWin32GraphicsDevice(i, monHds[i], newDevices); } for (i = 0; i < numScreens; ++i) { @@ -247,8 +251,8 @@ BOOL Devices::UpdateInstance(JNIEnv *env) J2dTraceLn(J2D_TRACE_VERBOSE, " Invalidating removed devices"); for (int i = newNumScreens; i < oldNumScreens; i++) { // removed device, needs to be invalidated - J2dTraceLn1(J2D_TRACE_WARNING, - "Devices::UpdateInstance: device removed: %d", i); + J2dTraceLn(J2D_TRACE_WARNING, + "Devices::UpdateInstance: device removed: %d", i); oldDevices->GetDevice(i)->Invalidate(env); } // Now that we have a new array in place, remove this (possibly the @@ -277,7 +281,7 @@ void Devices::AddReference() J2dTraceLn(J2D_TRACE_INFO, "Devices::AddReference"); CriticalSection::Lock l(arrayLock); refCount++; - J2dTraceLn1(J2D_TRACE_VERBOSE, " refCount=%d", refCount); + J2dTraceLn(J2D_TRACE_VERBOSE, " refCount=%d", refCount); } /** @@ -319,9 +323,9 @@ Devices* Devices::GetInstance() AwtWin32GraphicsDevice *Devices::GetDeviceReference(int index, BOOL adjust) { - J2dTraceLn2(J2D_TRACE_INFO, - "Devices::GetDeviceReference index=%d adjust?=%d", - index, adjust); + J2dTraceLn(J2D_TRACE_INFO, + "Devices::GetDeviceReference index=%d adjust?=%d", + index, adjust); AwtWin32GraphicsDevice * ret = GetDevice(index, adjust); if (ret != NULL) { @@ -339,19 +343,19 @@ AwtWin32GraphicsDevice *Devices::GetDeviceReference(int index, */ AwtWin32GraphicsDevice *Devices::GetDevice(int index, BOOL adjust) { - J2dTraceLn2(J2D_TRACE_INFO, - "Devices::GetDevice index=%d adjust?=%d", - index, adjust); + J2dTraceLn(J2D_TRACE_INFO, + "Devices::GetDevice index=%d adjust?=%d", + index, adjust); if (index < 0 || index >= numDevices) { if (!adjust) { - J2dTraceLn1(J2D_TRACE_WARNING, - "Devices::GetDevice: "\ - "incorrect index %d, returning NULL.", index); + J2dTraceLn(J2D_TRACE_WARNING, + "Devices::GetDevice: "\ + "incorrect index %d, returning NULL.", index); return NULL; } - J2dTraceLn1(J2D_TRACE_WARNING, - "Devices::GetDevice: "\ - "adjusted index %d to 0.", index); + J2dTraceLn(J2D_TRACE_WARNING, + "Devices::GetDevice: "\ + "adjusted index %d to 0.", index); index = 0; } return devices[index]; @@ -385,7 +389,7 @@ int Devices::Release() int refs = --refCount; - J2dTraceLn1(J2D_TRACE_VERBOSE, " refCount=%d", refs); + J2dTraceLn(J2D_TRACE_VERBOSE, " refCount=%d", refs); if (refs == 0) { J2dTraceLn(J2D_TRACE_VERBOSE, " disposing the array"); @@ -407,9 +411,9 @@ int Devices::Release() // (note: can not reference refCount here!) return refs; } else if (refs < 0) { - J2dTraceLn1(J2D_TRACE_ERROR, - "Devices::Release: Negative ref count! refCount=%d", - refs); + J2dTraceLn(J2D_TRACE_ERROR, + "Devices::Release: Negative ref count! refCount=%d", + refs); } return refs; diff --git a/src/java.desktop/windows/native/libawt/windows/awt_Toolkit.h b/src/java.desktop/windows/native/libawt/windows/awt_Toolkit.h index d2adeca6776..de4d84157c9 100644 --- a/src/java.desktop/windows/native/libawt/windows/awt_Toolkit.h +++ b/src/java.desktop/windows/native/libawt/windows/awt_Toolkit.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 1996, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1996, 2025, 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 @@ -122,23 +122,23 @@ class CriticalSection { // lock/unlock actions #define CRITICAL_SECTION_ENTER(cs) { \ - J2dTraceLn4(J2D_TRACE_VERBOSE2, \ - "CS.Wait: tid, cs, file, line = 0x%x, 0x%x, %s, %d", \ - GetCurrentThreadId(), &(cs), __FILE__, __LINE__); \ + J2dTraceLn(J2D_TRACE_VERBOSE2, \ + "CS.Wait: tid, cs, file, line = 0x%x, 0x%x, %s, %d", \ + GetCurrentThreadId(), &(cs), __FILE__, __LINE__); \ (cs).Enter(); \ - J2dTraceLn4(J2D_TRACE_VERBOSE2, \ - "CS.Enter: tid, cs, file, line = 0x%x, 0x%x, %s, %d", \ - GetCurrentThreadId(), &(cs), __FILE__, __LINE__); \ + J2dTraceLn(J2D_TRACE_VERBOSE2, \ + "CS.Enter: tid, cs, file, line = 0x%x, 0x%x, %s, %d", \ + GetCurrentThreadId(), &(cs), __FILE__, __LINE__); \ } #define CRITICAL_SECTION_LEAVE(cs) { \ - J2dTraceLn4(J2D_TRACE_VERBOSE2, \ - "CS.Leave: tid, cs, file, line = 0x%x, 0x%x, %s, %d", \ - GetCurrentThreadId(), &(cs), __FILE__, __LINE__); \ + J2dTraceLn(J2D_TRACE_VERBOSE2, \ + "CS.Leave: tid, cs, file, line = 0x%x, 0x%x, %s, %d", \ + GetCurrentThreadId(), &(cs), __FILE__, __LINE__); \ (cs).Leave(); \ - J2dTraceLn4(J2D_TRACE_VERBOSE2, \ - "CS.Left: tid, cs, file, line = 0x%x, 0x%x, %s, %d", \ - GetCurrentThreadId(), &(cs), __FILE__, __LINE__); \ + J2dTraceLn(J2D_TRACE_VERBOSE2, \ + "CS.Left: tid, cs, file, line = 0x%x, 0x%x, %s, %d", \ + GetCurrentThreadId(), &(cs), __FILE__, __LINE__); \ } // Redefine WinAPI values related to touch input, if OS < Windows 7. diff --git a/src/java.desktop/windows/native/libawt/windows/awt_Win32GraphicsDevice.cpp b/src/java.desktop/windows/native/libawt/windows/awt_Win32GraphicsDevice.cpp index 8a84a28685f..785f1301516 100644 --- a/src/java.desktop/windows/native/libawt/windows/awt_Win32GraphicsDevice.cpp +++ b/src/java.desktop/windows/native/libawt/windows/awt_Win32GraphicsDevice.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1999, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1999, 2025, 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 @@ -843,8 +843,8 @@ int AwtWin32GraphicsDevice::GetGrayness(int deviceIndex) } HDC AwtWin32GraphicsDevice::GetDCFromScreen(int screen) { - J2dTraceLn1(J2D_TRACE_INFO, - "AwtWin32GraphicsDevice::GetDCFromScreen screen=%d", screen); + J2dTraceLn(J2D_TRACE_INFO, + "AwtWin32GraphicsDevice::GetDCFromScreen screen=%d", screen); Devices::InstanceAccess devices; AwtWin32GraphicsDevice *dev = devices->GetDevice(screen); return MakeDCFromMonitor(dev->GetMonitor()); @@ -854,9 +854,9 @@ HDC AwtWin32GraphicsDevice::GetDCFromScreen(int screen) { * If equal, return TRUE */ BOOL AwtWin32GraphicsDevice::AreSameMonitors(HMONITOR mon1, HMONITOR mon2) { - J2dTraceLn2(J2D_TRACE_INFO, - "AwtWin32GraphicsDevice::AreSameMonitors mhnd1=%x mhnd2=%x", - mon1, mon2); + J2dTraceLn(J2D_TRACE_INFO, + "AwtWin32GraphicsDevice::AreSameMonitors mhnd1=%x mhnd2=%x", + mon1, mon2); DASSERT(mon1 != NULL); DASSERT(mon2 != NULL); @@ -885,8 +885,8 @@ BOOL AwtWin32GraphicsDevice::AreSameMonitors(HMONITOR mon1, HMONITOR mon2) { } int AwtWin32GraphicsDevice::GetScreenFromHMONITOR(HMONITOR mon) { - J2dTraceLn1(J2D_TRACE_INFO, - "AwtWin32GraphicsDevice::GetScreenFromHMONITOR mhnd=%x", mon); + J2dTraceLn(J2D_TRACE_INFO, + "AwtWin32GraphicsDevice::GetScreenFromHMONITOR mhnd=%x", mon); DASSERT(mon != NULL); JNIEnv *env = (JNIEnv*) JNU_GetEnv(jvm, JNI_VERSION_1_2); @@ -898,14 +898,14 @@ int AwtWin32GraphicsDevice::GetScreenFromHMONITOR(HMONITOR mon) { for (int i = 0; i < devices->GetNumDevices(); i++) { HMONITOR mhnd = devices->GetDevice(i)->GetMonitor(); if (AreSameMonitors(mon, mhnd)) { - J2dTraceLn1(J2D_TRACE_VERBOSE, " Found device: %d", i); + J2dTraceLn(J2D_TRACE_VERBOSE, " Found device: %d", i); return i; } } - J2dTraceLn1(J2D_TRACE_WARNING, - "AwtWin32GraphicsDevice::GetScreenFromHMONITOR(): "\ - "couldn't find screen for HMONITOR %x, returning default", mon); + J2dTraceLn(J2D_TRACE_WARNING, + "AwtWin32GraphicsDevice::GetScreenFromHMONITOR(): "\ + "couldn't find screen for HMONITOR %x, returning default", mon); return AwtWin32GraphicsDevice::GetDefaultDeviceIndex(); } @@ -1119,9 +1119,9 @@ Java_sun_awt_Win32GraphicsDevice_enterFullScreenExclusive( if (!::SetWindowPos(hWnd, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOMOVE|SWP_NOOWNERZORDER|SWP_NOSIZE)) { - J2dTraceLn1(J2D_TRACE_ERROR, - "Error %d setting topmost attribute to fs window", - ::GetLastError()); + J2dTraceLn(J2D_TRACE_ERROR, + "Error %d setting topmost attribute to fs window", + ::GetLastError()); } CATCH_BAD_ALLOC; @@ -1154,9 +1154,9 @@ Java_sun_awt_Win32GraphicsDevice_exitFullScreenExclusive( if (!::SetWindowPos(hWnd, HWND_NOTOPMOST, 0, 0, 0, 0, SWP_NOMOVE|SWP_NOOWNERZORDER|SWP_NOSIZE)) { - J2dTraceLn1(J2D_TRACE_ERROR, - "Error %d unsetting topmost attribute to fs window", - ::GetLastError()); + J2dTraceLn(J2D_TRACE_ERROR, + "Error %d unsetting topmost attribute to fs window", + ::GetLastError()); } // We should restore alwaysOnTop state as it's anyway dropped here diff --git a/src/java.desktop/windows/native/libawt/windows/awt_Win32GraphicsEnv.cpp b/src/java.desktop/windows/native/libawt/windows/awt_Win32GraphicsEnv.cpp index 9991427c75e..50591434d4c 100644 --- a/src/java.desktop/windows/native/libawt/windows/awt_Win32GraphicsEnv.cpp +++ b/src/java.desktop/windows/native/libawt/windows/awt_Win32GraphicsEnv.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1999, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1999, 2025, 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 @@ -109,11 +109,11 @@ BOOL DWMIsCompositionEnabled() { HRESULT res = DwmAPI::DwmIsCompositionEnabled(&bEnabled); if (SUCCEEDED(res)) { bRes = bEnabled; - J2dTraceLn1(J2D_TRACE_VERBOSE, " composition enabled: %d",bRes); + J2dTraceLn(J2D_TRACE_VERBOSE, " composition enabled: %d",bRes); } else { - J2dTraceLn1(J2D_TRACE_ERROR, - "IsDWMCompositionEnabled: error %x when detecting"\ - "if composition is enabled", res); + J2dTraceLn(J2D_TRACE_ERROR, + "IsDWMCompositionEnabled: error %x when detecting"\ + "if composition is enabled", res); } } catch (const DllUtil::Exception &) { J2dTraceLn(J2D_TRACE_ERROR, diff --git a/src/java.instrument/share/classes/java/lang/instrument/IllegalClassFormatException.java b/src/java.instrument/share/classes/java/lang/instrument/IllegalClassFormatException.java index 7e14665b198..59bde2f6c1f 100644 --- a/src/java.instrument/share/classes/java/lang/instrument/IllegalClassFormatException.java +++ b/src/java.instrument/share/classes/java/lang/instrument/IllegalClassFormatException.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2008, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2025, 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 @@ -25,6 +25,8 @@ package java.lang.instrument; +import java.io.Serial; + /* * Copyright 2003 Wily Technology, Inc. */ @@ -40,6 +42,8 @@ * @since 1.5 */ public class IllegalClassFormatException extends Exception { + + @Serial private static final long serialVersionUID = -3841736710924794009L; /** diff --git a/src/java.instrument/share/classes/java/lang/instrument/UnmodifiableClassException.java b/src/java.instrument/share/classes/java/lang/instrument/UnmodifiableClassException.java index d6aac1d5b4b..40bae4b5c91 100644 --- a/src/java.instrument/share/classes/java/lang/instrument/UnmodifiableClassException.java +++ b/src/java.instrument/share/classes/java/lang/instrument/UnmodifiableClassException.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2004, 2008, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2004, 2025, 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 @@ -25,6 +25,8 @@ package java.lang.instrument; +import java.io.Serial; + /** * Thrown by an implementation of * {@link java.lang.instrument.Instrumentation#redefineClasses Instrumentation.redefineClasses} @@ -34,6 +36,8 @@ * @since 1.5 */ public class UnmodifiableClassException extends Exception { + + @Serial private static final long serialVersionUID = 1716652643585309178L; /** diff --git a/src/java.instrument/share/classes/java/lang/instrument/UnmodifiableModuleException.java b/src/java.instrument/share/classes/java/lang/instrument/UnmodifiableModuleException.java index 462ee8b71ff..f97294a01c1 100644 --- a/src/java.instrument/share/classes/java/lang/instrument/UnmodifiableModuleException.java +++ b/src/java.instrument/share/classes/java/lang/instrument/UnmodifiableModuleException.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2017, 2025, 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 @@ -25,14 +25,17 @@ package java.lang.instrument; +import java.io.Serial; + /** * Thrown to indicate that a module cannot be modified. * * @see Instrumentation#redefineModule * @since 9 */ - public class UnmodifiableModuleException extends RuntimeException { + + @Serial private static final long serialVersionUID = 6912511912351080644L; /** diff --git a/src/java.management/share/classes/javax/management/ImmutableDescriptor.java b/src/java.management/share/classes/javax/management/ImmutableDescriptor.java index c9044b68ed2..731dd619d26 100644 --- a/src/java.management/share/classes/javax/management/ImmutableDescriptor.java +++ b/src/java.management/share/classes/javax/management/ImmutableDescriptor.java @@ -138,6 +138,7 @@ private Object readResolve() throws InvalidObjectException { if (names == null || values == null || names.length != values.length) bad = true; if (!bad) { + hashCode = -1; // Force recalculation if (names.length == 0 && getClass() == ImmutableDescriptor.class) return EMPTY_DESCRIPTOR; final Comparator compare = String.CASE_INSENSITIVE_ORDER; @@ -343,30 +344,6 @@ public final String[] getFieldNames() { return names.clone(); } - /** - * Compares this descriptor to the given object. The objects are equal if - * the given object is also a Descriptor, and if the two Descriptors have - * the same field names (possibly differing in case) and the same - * associated values. The respective values for a field in the two - * Descriptors are equal if the following conditions hold: - * - *

    - * - * @param o the object to compare with. - * - * @return {@code true} if the objects are the same; {@code false} - * otherwise. - * - */ - // Note: this Javadoc is copied from javax.management.Descriptor - // due to 6369229. @Override public boolean equals(Object o) { if (o == this) @@ -394,28 +371,6 @@ public boolean equals(Object o) { return Arrays.deepEquals(values, ovalues); } - /** - *

    Returns the hash code value for this descriptor. The hash - * code is computed as the sum of the hash codes for each field in - * the descriptor. The hash code of a field with name {@code n} - * and value {@code v} is {@code n.toLowerCase().hashCode() ^ h}. - * Here {@code h} is the hash code of {@code v}, computed as - * follows:

    - * - *
      - *
    • If {@code v} is null then {@code h} is 0.
    • - *
    • If {@code v} is a primitive array then {@code h} is computed using - * the appropriate overloading of {@code java.util.Arrays.hashCode}.
    • - *
    • If {@code v} is an object array then {@code h} is computed using - * {@link Arrays#deepHashCode(Object[])}.
    • - *
    • Otherwise {@code h} is {@code v.hashCode()}.
    • - *
    - * - * @return A hash code value for this object. - * - */ - // Note: this Javadoc is copied from javax.management.Descriptor - // due to 6369229. @Override public int hashCode() { if (hashCode == -1) { @@ -487,12 +442,14 @@ public Descriptor clone() { */ public final void setFields(String[] fieldNames, Object[] fieldValues) throws RuntimeOperationsException { + if (fieldNames == null || fieldValues == null) illegal("Null argument"); if (fieldNames.length != fieldValues.length) illegal("Different array sizes"); for (int i = 0; i < fieldNames.length; i++) checkIllegalFieldName(fieldNames[i]); + hashCode = -1; // Force recalculation for (int i = 0; i < fieldNames.length; i++) setField(fieldNames[i], fieldValues[i]); } @@ -508,10 +465,12 @@ public final void setFields(String[] fieldNames, Object[] fieldValues) */ public final void setField(String fieldName, Object fieldValue) throws RuntimeOperationsException { + checkIllegalFieldName(fieldName); int i = fieldIndex(fieldName); if (i < 0) unsupported(); + hashCode = -1; // Force recalculation Object value = values[i]; if ((value == null) ? (fieldValue != null) : @@ -531,6 +490,7 @@ public final void setField(String fieldName, Object fieldValue) * be an {@link UnsupportedOperationException}. */ public final void removeField(String fieldName) { + hashCode = -1; // Force recalculation if (fieldName != null && fieldIndex(fieldName) >= 0) unsupported(); } diff --git a/src/java.management/share/classes/javax/management/modelmbean/DescriptorSupport.java b/src/java.management/share/classes/javax/management/modelmbean/DescriptorSupport.java index d003cd9d9d6..71f8f61bedb 100644 --- a/src/java.management/share/classes/javax/management/modelmbean/DescriptorSupport.java +++ b/src/java.management/share/classes/javax/management/modelmbean/DescriptorSupport.java @@ -696,31 +696,6 @@ public synchronized void removeField(String fieldName) { descriptorMap.remove(fieldName); } - /** - * Compares this descriptor to the given object. The objects are equal if - * the given object is also a Descriptor, and if the two Descriptors have - * the same field names (possibly differing in case) and the same - * associated values. The respective values for a field in the two - * Descriptors are equal if the following conditions hold: - * - *
      - *
    • If one value is null then the other must be too.
    • - *
    • If one value is a primitive array then the other must be a primitive - * array of the same type with the same elements.
    • - *
    • If one value is an object array then the other must be too and - * {@link java.util.Arrays#deepEquals(Object[],Object[]) Arrays.deepEquals} - * must return true.
    • - *
    • Otherwise {@link Object#equals(Object)} must return true.
    • - *
    - * - * @param o the object to compare with. - * - * @return {@code true} if the objects are the same; {@code false} - * otherwise. - * - */ - // Note: this Javadoc is copied from javax.management.Descriptor - // due to 6369229. @Override public synchronized boolean equals(Object o) { if (o == this) @@ -732,28 +707,6 @@ public synchronized boolean equals(Object o) { return new ImmutableDescriptor(descriptorMap).equals(o); } - /** - *

    Returns the hash code value for this descriptor. The hash - * code is computed as the sum of the hash codes for each field in - * the descriptor. The hash code of a field with name {@code n} - * and value {@code v} is {@code n.toLowerCase().hashCode() ^ h}. - * Here {@code h} is the hash code of {@code v}, computed as - * follows:

    - * - *
      - *
    • If {@code v} is null then {@code h} is 0.
    • - *
    • If {@code v} is a primitive array then {@code h} is computed using - * the appropriate overloading of {@code java.util.Arrays.hashCode}.
    • - *
    • If {@code v} is an object array then {@code h} is computed using - * {@link java.util.Arrays#deepHashCode(Object[]) Arrays.deepHashCode}.
    • - *
    • Otherwise {@code h} is {@code v.hashCode()}.
    • - *
    - * - * @return A hash code value for this object. - * - */ - // Note: this Javadoc is copied from javax.management.Descriptor - // due to 6369229. @Override public synchronized int hashCode() { final int size = descriptorMap.size(); diff --git a/src/java.management/share/classes/javax/management/monitor/CounterMonitorMBean.java b/src/java.management/share/classes/javax/management/monitor/CounterMonitorMBean.java index 6e6b3ee99e0..dbf8dd73ea7 100644 --- a/src/java.management/share/classes/javax/management/monitor/CounterMonitorMBean.java +++ b/src/java.management/share/classes/javax/management/monitor/CounterMonitorMBean.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1999, 2007, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1999, 2025, 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 @@ -97,7 +97,7 @@ public interface CounterMonitorMBean extends MonitorMBean { * * @param object the MBean for which the derived gauge timestamp is to be returned * @return The derived gauge timestamp for the specified MBean if this MBean - * is in the set of observed MBeans, or null otherwise. + * is in the set of observed MBeans, or 0 otherwise. * */ public long getDerivedGaugeTimeStamp(ObjectName object); diff --git a/src/java.management/share/classes/javax/management/remote/JMXConnectorServer.java b/src/java.management/share/classes/javax/management/remote/JMXConnectorServer.java index a643a27e3dc..05fd8df8f55 100644 --- a/src/java.management/share/classes/javax/management/remote/JMXConnectorServer.java +++ b/src/java.management/share/classes/javax/management/remote/JMXConnectorServer.java @@ -133,8 +133,7 @@ public String[] getConnectionIds() { * one new connection to this connector server.

    * *

    A given connector need not support the generation of client - * stubs. However, the connectors specified by the JMX Remote API do - * (JMXMP Connector and RMI Connector).

    + * stubs. The RMI Connector does so.

    * *

    The default implementation of this method uses {@link * #getAddress} and {@link JMXConnectorFactory} to generate the diff --git a/src/java.management/share/classes/javax/management/remote/JMXConnectorServerMBean.java b/src/java.management/share/classes/javax/management/remote/JMXConnectorServerMBean.java index fdc7fa5b3a1..4d8602bb81b 100644 --- a/src/java.management/share/classes/javax/management/remote/JMXConnectorServerMBean.java +++ b/src/java.management/share/classes/javax/management/remote/JMXConnectorServerMBean.java @@ -186,8 +186,7 @@ public interface JMXConnectorServerMBean { * one new connection to this connector server.

    * *

    A given connector need not support the generation of client - * stubs. However, the connectors specified by the JMX Remote API do - * (JMXMP Connector and RMI Connector).

    + * stubs. The RMI Connector does so.

    * * @param env client connection parameters of the same sort that * can be provided to {@link JMXConnector#connect(Map) diff --git a/src/java.management/share/classes/javax/management/remote/JMXServiceURL.java b/src/java.management/share/classes/javax/management/remote/JMXServiceURL.java index b6c2860b9cd..da47f7a1eda 100644 --- a/src/java.management/share/classes/javax/management/remote/JMXServiceURL.java +++ b/src/java.management/share/classes/javax/management/remote/JMXServiceURL.java @@ -238,8 +238,8 @@ public JMXServiceURL(String serviceURL) throws MalformedURLException { * {@link #JMXServiceURL(String, String, int, String) * JMXServiceURL(protocol, host, port, null)}.

    * - * @param protocol the protocol part of the URL. If null, defaults - * to jmxmp. + * @param protocol the protocol part of the URL. Must be specified, + * there is no default. * * @param host the host part of the URL. If host is null and if * local host name can be resolved to an IP, then host defaults @@ -255,7 +255,7 @@ public JMXServiceURL(String serviceURL) throws MalformedURLException { * @exception MalformedURLException if one of the parts is * syntactically incorrect, or if host is null and it * is not possible to find the local host name, or if - * port is negative. + * port is negative, or if protocol is null. */ public JMXServiceURL(String protocol, String host, int port) throws MalformedURLException { @@ -265,8 +265,8 @@ public JMXServiceURL(String protocol, String host, int port) /** *

    Constructs a JMXServiceURL with the given parts. * - * @param protocol the protocol part of the URL. If null, defaults - * to jmxmp. + * @param protocol the protocol part of the URL. Must be specified, + * there is no default. * * @param host the host part of the URL. If host is null and if * local host name can be resolved to an IP, then host defaults @@ -285,14 +285,14 @@ public JMXServiceURL(String protocol, String host, int port) * @exception MalformedURLException if one of the parts is * syntactically incorrect, or if host is null and it * is not possible to find the local host name, or if - * port is negative. + * port is negative, or if protocol is null. */ public JMXServiceURL(String protocol, String host, int port, String urlPath) throws MalformedURLException { - if (protocol == null) - protocol = "jmxmp"; - + if (protocol == null) { + throw new MalformedURLException("Misssing protocol name"); + } if (host == null) { InetAddress local; try { diff --git a/src/java.management/share/classes/javax/management/remote/package-info.java b/src/java.management/share/classes/javax/management/remote/package-info.java index d198030c302..046cc8cd570 100644 --- a/src/java.management/share/classes/javax/management/remote/package-info.java +++ b/src/java.management/share/classes/javax/management/remote/package-info.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2002, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2002, 2025, 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 @@ -27,12 +27,9 @@ *

    Interfaces for remote access to * JMX MBean servers. * This package defines the essential interfaces for making a JMX - * MBean server manageable remotely. The specification of this - * functionality is completed by Part III of the - * - * JMX Specification, version 1.4

    + * MBean server manageable remotely.

    * - *

    The JMX specification defines the notion of connectors. + *

    JMX defines the notion of connectors. * A connector is attached to a JMX API MBean server and makes it * accessible to remote Java clients. The client end of a * connector exports essentially the same interface as the MBean @@ -41,32 +38,17 @@ * interface.

    * *

    A connector makes an MBean server remotely accessible through - * a given protocol. The JMX Remote API allows the use of different - * type of connectors: + * a given protocol. * - *

      + *
        *
      • The JMX Remote API defines a standard connector, * the RMI Connector, which provides remote access to an - * MBeanServer through RMI. + * MBeanServer through RMI. * - *
      • The JMX Remote API also defines an optional connector called - * JMXMP Connector implementing the JMX Message Protocol - * (JMXMP). As it is optional, it is not part of this bundle (see - * note below). - * - *
      • User-defined connector protocols are also possible using the + *
      • Other connector protocols are also possible using the * {@link javax.management.remote.JMXConnectorFactory - * JMXConnectorFactory} and, optionally, the Generic Connector - * (not part of this bundle, see note below). - *
      - * - *

      Note: the optional packages implementing - * the optional part of the JMX Remote API - * are not included in the Java SE Platform - * but are available from the JMX Remote API - * - * Reference Implementation.

      - * + * JMXConnectorFactory}. + *
    * *

    Connector addresses

    * diff --git a/src/java.net.http/share/classes/jdk/internal/net/http/RequestPublishers.java b/src/java.net.http/share/classes/jdk/internal/net/http/RequestPublishers.java index 305957ae804..dd5443c5035 100644 --- a/src/java.net.http/share/classes/jdk/internal/net/http/RequestPublishers.java +++ b/src/java.net.http/share/classes/jdk/internal/net/http/RequestPublishers.java @@ -25,7 +25,6 @@ package jdk.internal.net.http; -import java.io.FileInputStream; import java.io.FileNotFoundException; import java.io.IOException; import java.io.InputStream; @@ -35,6 +34,7 @@ import java.nio.ByteBuffer; import java.nio.charset.Charset; import java.nio.file.Files; +import java.nio.file.NoSuchFileException; import java.nio.file.Path; import java.util.ArrayList; import java.util.Collections; @@ -48,7 +48,6 @@ import java.util.concurrent.Flow.Publisher; import java.util.concurrent.atomic.AtomicReference; import java.util.concurrent.locks.ReentrantLock; -import java.util.function.Function; import java.util.function.Supplier; import jdk.internal.net.http.common.Demand; @@ -228,30 +227,16 @@ public static class FilePublisher implements BodyPublisher { private final Path path; private final long length; - private final Function inputStreamSupplier; /** * Factory for creating FilePublisher. */ public static FilePublisher create(Path path) throws FileNotFoundException { - boolean defaultFS = true; - try { - path.toFile().getPath(); - } catch (UnsupportedOperationException uoe) { - // path not associated with the default file system provider - defaultFS = false; - } - - // existence check must be after FS checks if (Files.notExists(path)) throw new FileNotFoundException(path + " not found"); - boolean finalDefaultFS = defaultFS; - Function inputStreamSupplier = (p) -> - createInputStream(p, finalDefaultFS); - long length; try { length = Files.size(path); @@ -259,26 +244,12 @@ public static FilePublisher create(Path path) length = -1; } - return new FilePublisher(path, length, inputStreamSupplier); + return new FilePublisher(path, length); } - private static InputStream createInputStream(Path path, - boolean defaultFS) { - try { - return defaultFS - ? new FileInputStream(path.toFile()) - : Files.newInputStream(path); - } catch (IOException io) { - throw new UncheckedIOException(io); - } - } - - private FilePublisher(Path name, - long length, - Function inputStreamSupplier) { + private FilePublisher(Path name, long length) { path = name; this.length = length; - this.inputStreamSupplier = inputStreamSupplier; } @Override @@ -286,7 +257,14 @@ public void subscribe(Flow.Subscriber subscriber) { InputStream is = null; Throwable t = null; try { - is = inputStreamSupplier.apply(path); + // Throw `FileNotFoundException` to match the specification of `BodyPublishers::ofFile + if (!Files.isRegularFile(path)) { + throw new FileNotFoundException(path + " (Not a regular file)"); + } + is = Files.newInputStream(path); + } catch (NoSuchFileException nsfe) { + // Throw `FileNotFoundException` to match the specification of `BodyPublishers::ofFile` + t = new FileNotFoundException(path + " (No such file or directory)"); } catch (UncheckedIOException | UndeclaredThrowableException ue) { t = ue.getCause(); } catch (Throwable th) { diff --git a/src/java.net.http/share/classes/module-info.java b/src/java.net.http/share/classes/module-info.java index 7d7c3fb351a..14cbb85291d 100644 --- a/src/java.net.http/share/classes/module-info.java +++ b/src/java.net.http/share/classes/module-info.java @@ -156,7 +156,8 @@ *
  • *
  • {@systemProperty jdk.httpclient.auth.retrylimit} (default: 3)
    * The number of attempts the Basic authentication filter will attempt to retry a failed - * authentication. + * authentication. The number of authentication attempts is always one greater than the + * retry limit, as the initial request does not count toward the retries. *

  • *
  • {@systemProperty jdk.httpclient.sendBufferSize} (default: operating system * default)
    The HTTP client {@linkplain java.nio.channels.SocketChannel socket} diff --git a/src/java.scripting/share/classes/com/sun/tools/script/shell/Main.java b/src/java.scripting/share/classes/com/sun/tools/script/shell/Main.java index f1ac21bbfbb..96fd6d010ac 100644 --- a/src/java.scripting/share/classes/com/sun/tools/script/shell/Main.java +++ b/src/java.scripting/share/classes/com/sun/tools/script/shell/Main.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2005, 2025, 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 @@ -27,6 +27,7 @@ import java.io.*; import java.net.*; +import java.nio.charset.Charset; import java.text.*; import java.util.*; import javax.script.*; @@ -255,8 +256,8 @@ private static void listScriptEngines() { private static void processSource(ScriptEngine se, String filename, String encoding) { if (filename.equals("-")) { - BufferedReader in = new BufferedReader - (new InputStreamReader(getIn())); + Charset charset = Charset.forName(System.getProperty("stdin.encoding"), Charset.defaultCharset()); + BufferedReader in = new BufferedReader(new InputStreamReader(System.in, charset)); boolean hitEOF = false; String prompt = getPrompt(se); se.put(ScriptEngine.FILENAME, ""); @@ -402,11 +403,6 @@ private static String getMessage(String key, Object[] params) { return MessageFormat.format(msgRes.getString(key), params); } - // input stream from where we will read - private static InputStream getIn() { - return System.in; - } - // stream to print error messages private static PrintStream getError() { return System.err; diff --git a/src/java.scripting/share/classes/javax/script/SimpleScriptContext.java b/src/java.scripting/share/classes/javax/script/SimpleScriptContext.java index 5fcb0209107..89f5978601f 100644 --- a/src/java.scripting/share/classes/javax/script/SimpleScriptContext.java +++ b/src/java.scripting/share/classes/javax/script/SimpleScriptContext.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005, 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2005, 2025, 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 @@ -25,6 +25,7 @@ package javax.script; +import java.nio.charset.Charset; import java.util.*; import java.io.*; @@ -86,13 +87,18 @@ public class SimpleScriptContext implements ScriptContext { * Create a {@code SimpleScriptContext}. */ public SimpleScriptContext() { - this(new InputStreamReader(System.in), + this(stdinReader(), new PrintWriter(System.out , true), new PrintWriter(System.err, true)); engineScope = new SimpleBindings(); globalScope = null; } + private static InputStreamReader stdinReader() { + Charset charset = Charset.forName(System.getProperty("stdin.encoding"), Charset.defaultCharset()); + return new InputStreamReader(System.in, charset); + } + /** * Package-private constructor to avoid needless creation of reader and writers. * It is the caller's responsibility to initialize the engine scope. diff --git a/src/java.security.jgss/share/classes/sun/security/jgss/wrapper/SunNativeProvider.java b/src/java.security.jgss/share/classes/sun/security/jgss/wrapper/SunNativeProvider.java index 2da15b8b6a6..ad24432f188 100644 --- a/src/java.security.jgss/share/classes/sun/security/jgss/wrapper/SunNativeProvider.java +++ b/src/java.security.jgss/share/classes/sun/security/jgss/wrapper/SunNativeProvider.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2005, 2025, 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 @@ -29,7 +29,6 @@ import java.security.Provider; import jdk.internal.util.OperatingSystem; -import jdk.internal.util.StaticProperty; import org.ietf.jgss.Oid; import static sun.security.util.SecurityConstants.PROVIDER_VER; @@ -95,7 +94,7 @@ private static Oid[] getMechOIDs() { }; case WINDOWS -> new String[]{ // Full path needed, DLL is in jre/bin - StaticProperty.javaHome() + "\\bin\\sspi_bridge.dll", + System.getProperty("java.home") + "\\bin\\sspi_bridge.dll", }; case AIX -> new String[]{ "/opt/freeware/lib64/libgssapi_krb5.so", diff --git a/src/java.security.jgss/windows/classes/sun/security/krb5/internal/tools/Ktab.java b/src/java.security.jgss/windows/classes/sun/security/krb5/internal/tools/Ktab.java index 21002f3369a..ffe2e3196c1 100644 --- a/src/java.security.jgss/windows/classes/sun/security/krb5/internal/tools/Ktab.java +++ b/src/java.security.jgss/windows/classes/sun/security/krb5/internal/tools/Ktab.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2025, 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 @@ -35,6 +35,8 @@ import java.io.IOException; import java.io.BufferedReader; import java.io.InputStreamReader; +import java.io.Reader; +import java.nio.charset.Charset; import java.text.DateFormat; import java.util.Arrays; import java.util.Date; @@ -304,8 +306,7 @@ void addEntry() { } if (password == null) { try { - BufferedReader cis = - new BufferedReader(new InputStreamReader(System.in)); + BufferedReader cis = stdinReader(); System.out.print("Password for " + pname.toString() + ":"); System.out.flush(); password = cis.readLine().toCharArray(); @@ -403,6 +404,12 @@ void listKt() { } } + private static BufferedReader stdinReader() { + Charset charset = Charset.forName(System.getProperty("stdin.encoding"), Charset.defaultCharset()); + Reader reader = new InputStreamReader(System.in, charset); + return new BufferedReader(reader); + } + /** * Deletes an entry from the key table. */ @@ -412,8 +419,7 @@ void deleteEntry() { pname = new PrincipalName(principal); if (!fopt) { String answer; - BufferedReader cis = - new BufferedReader(new InputStreamReader(System.in)); + BufferedReader cis = stdinReader(); System.out.print("Are you sure you want to delete "+ "service key(s) for " + pname.toString() + " (" + (etype==-1?"all etypes":("etype="+etype)) + ", " + diff --git a/src/java.security.sasl/share/classes/com/sun/security/sasl/CramMD5Server.java b/src/java.security.sasl/share/classes/com/sun/security/sasl/CramMD5Server.java index 42a0409920c..b3dda2c869c 100644 --- a/src/java.security.sasl/share/classes/com/sun/security/sasl/CramMD5Server.java +++ b/src/java.security.sasl/share/classes/com/sun/security/sasl/CramMD5Server.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2025, 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 @@ -25,11 +25,13 @@ package com.sun.security.sasl; +import sun.security.jca.JCAUtil; + import java.io.IOException; import java.security.NoSuchAlgorithmException; +import java.security.SecureRandom; import java.util.logging.Level; import java.util.Map; -import java.util.Random; import javax.security.sasl.*; import javax.security.auth.callback.*; @@ -52,6 +54,10 @@ * @author Rosanna Lee */ final class CramMD5Server extends CramMD5Base implements SaslServer { + + /* SecureRandom instance to generate random digits used in challenge */ + private static final SecureRandom SECURE_RANDOM = JCAUtil.getDefSecureRandom(); + private String fqdn; private byte[] challengeData = null; private String authzid; @@ -113,8 +119,7 @@ public byte[] evaluateResponse(byte[] responseData) } // Generate challenge {random, timestamp, fqdn} - Random random = new Random(); - long rand = random.nextLong(); + long rand = SECURE_RANDOM.nextLong(); long timestamp = System.currentTimeMillis(); StringBuilder sb = new StringBuilder(); diff --git a/src/java.security.sasl/share/classes/com/sun/security/sasl/digest/DigestMD5Base.java b/src/java.security.sasl/share/classes/com/sun/security/sasl/digest/DigestMD5Base.java index 535c11b4f0c..567c7171116 100644 --- a/src/java.security.sasl/share/classes/com/sun/security/sasl/digest/DigestMD5Base.java +++ b/src/java.security.sasl/share/classes/com/sun/security/sasl/digest/DigestMD5Base.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2025, 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 @@ -33,10 +33,10 @@ import java.util.Arrays; import java.util.List; import java.util.logging.Level; -import java.util.Random; import java.security.MessageDigest; import java.security.NoSuchAlgorithmException; import java.security.InvalidKeyException; +import java.security.SecureRandom; import java.security.spec.KeySpec; import java.security.spec.InvalidKeySpecException; import java.security.InvalidAlgorithmParameterException; @@ -59,6 +59,7 @@ import javax.security.sasl.*; import com.sun.security.sasl.util.AbstractSaslImpl; +import sun.security.jca.JCAUtil; /** * Utility class for DIGEST-MD5 mechanism. Provides utility methods @@ -132,6 +133,9 @@ abstract class DigestMD5Base extends AbstractSaslImpl { protected static final byte[] EMPTY_BYTE_ARRAY = new byte[0]; + /* SecureRandom instance to generate nonce */ + private static final SecureRandom SECURE_RANDOM = JCAUtil.getDefSecureRandom(); + /* ------------------- Variable Fields ----------------------- */ /* Used to track progress of authentication; step numbers from RFC 2831 */ @@ -269,7 +273,6 @@ public Object getNegotiatedProperty(String propName) { * is slightly faster and a more compact representation of the same info. * @return A non-null byte array containing the nonce value for the * digest challenge or response. - * Could use SecureRandom to be more secure but it is very slow. */ /** This array maps the characters to their 6 bit values */ @@ -293,10 +296,8 @@ public Object getNegotiatedProperty(String propName) { protected static final byte[] generateNonce() { - // SecureRandom random = new SecureRandom(); - Random random = new Random(); byte[] randomData = new byte[RAW_NONCE_SIZE]; - random.nextBytes(randomData); + SECURE_RANDOM.nextBytes(randomData); byte[] nonce = new byte[ENCODED_NONCE_SIZE]; diff --git a/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/impl/msg/XMLSchemaMessages_de.properties b/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/impl/msg/XMLSchemaMessages_de.properties index 1144488773e..87ac233b6c7 100644 --- a/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/impl/msg/XMLSchemaMessages_de.properties +++ b/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/impl/msg/XMLSchemaMessages_de.properties @@ -56,6 +56,7 @@ cvc-complex-type.2.4.b = cvc-complex-type.2.4.b: Content des Elements ''{0}'' ist nicht vollständig. ''{1}'' wird erwartet. cvc-complex-type.2.4.c = cvc-complex-type.2.4.c: Übereinstimmungsplatzhalter ist streng, aber es kann keine Deklaration für Element ''{0}'' gefunden werden. cvc-complex-type.2.4.d = cvc-complex-type.2.4.d: Ungültiger Content wurde beginnend mit Element ''{0}'' gefunden. An dieser Stelle wird kein untergeordnetes Element erwartet. + cvc-complex-type.2.4.d.1 = cvc-complex-type.2.4.d: Ungültiger Content wurde beginnend mit Element ''{0}'' gefunden. An dieser Stelle wird kein untergeordnetes Element ''{1}'' erwartet. cvc-complex-type.2.4.e = cvc-complex-type.2.4.e: "{0}" darf maximal "{2}"-mal in der aktuellen Abfolge auftreten. Dieser Grenzwert wurde überschritten. An dieser Stelle wird eines von "{1}" erwartet. cvc-complex-type.2.4.f = cvc-complex-type.2.4.e: "{0}" darf maximal "{1}"-mal in der aktuellen Abfolge auftreten. Dieser Grenzwert wurde überschritten. An dieser Stelle wird kein untergeordnetes Element erwartet. cvc-complex-type.2.4.g = cvc-complex-type.2.4.g: Ungültigen Inhalt gefunden, der mit Element "{0}" beginnt. "{1}" soll erwartungsgemäß mindestens "{2}"-mal in der aktuellen Abfolge auftreten. Eine weitere Instanz ist erforderlich, um diesen Constraint zu erfüllen. diff --git a/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/impl/msg/XMLSchemaMessages_ja.properties b/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/impl/msg/XMLSchemaMessages_ja.properties index 05e945bed9b..ad82476b1e8 100644 --- a/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/impl/msg/XMLSchemaMessages_ja.properties +++ b/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/impl/msg/XMLSchemaMessages_ja.properties @@ -56,6 +56,7 @@ cvc-complex-type.2.4.b = cvc-complex-type.2.4.b: 要素''{0}''のコンテンツは不完全です。''{1}''のいずれかが必要です。 cvc-complex-type.2.4.c = cvc-complex-type.2.4.c: ワイルドカードの一致は厳密ですが、要素''{0}''で宣言が見つかりません。 cvc-complex-type.2.4.d = cvc-complex-type.2.4.d: 要素''{0}''で始まる無効なコンテンツが見つかりました。ここでは子要素を使用できません。 + cvc-complex-type.2.4.d.1 = cvc-complex-type.2.4.d: 要素''{0}''で始まる無効なコンテンツが見つかりました。ここでは子要素''{1}''を使用できません。 cvc-complex-type.2.4.e = cvc-complex-type.2.4.e: ''{0}''は現在のシーケンスで最大''{2}''回発生することがあります。この制限を超えました。ここでは''{1}''のいずれかが必要です。 cvc-complex-type.2.4.f = cvc-complex-type.2.4.f: ''{0}''は現在のシーケンスで最大''{1}''回発生することがあります。この制限を超えました。ここでは子要素は使用できません。 cvc-complex-type.2.4.g = cvc-complex-type.2.4.g: 要素''{0}''で始まる無効なコンテンツが見つかりました。''{1}''は現在のシーケンスで少なくとも''{2}''回発生する必要があります。この制約を満たすインスタンスがもう1つ必要です。 diff --git a/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/impl/msg/XMLSchemaMessages_zh_CN.properties b/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/impl/msg/XMLSchemaMessages_zh_CN.properties index f366acbb174..238cb63c869 100644 --- a/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/impl/msg/XMLSchemaMessages_zh_CN.properties +++ b/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/impl/msg/XMLSchemaMessages_zh_CN.properties @@ -56,6 +56,7 @@ cvc-complex-type.2.4.b = cvc-complex-type.2.4.b: 元素 ''{0}'' 的内容不完整。应为 ''{1}'' 之一。 cvc-complex-type.2.4.c = cvc-complex-type.2.4.c: 通配符的匹配很全面, 但无法找到元素 ''{0}'' 的声明。 cvc-complex-type.2.4.d = cvc-complex-type.2.4.d: 发现了以元素 ''{0}'' 开头的无效内容。此处不应含有子元素。 + cvc-complex-type.2.4.d.1 = cvc-complex-type.2.4.d: 发现了以元素 ''{0}'' 开头的无效内容。此处不应含有子元素 ''{1}''。 cvc-complex-type.2.4.e = cvc-complex-type.2.4.e: ''{0}'' 在当前序列中最多可以出现 ''{2}'' 次。已超过此限制。此处预期为 ''{1}'' 之一。 cvc-complex-type.2.4.f = cvc-complex-type.2.4.f: ''{0}'' 在当前序列中最多可以出现 ''{1}'' 次。已超过此限制。此处预期没有子元素。 cvc-complex-type.2.4.g = cvc-complex-type.2.4.g: 发现了以元素 ''{0}'' 开头的无效内容。''{1}'' 预期在当前序列中最少出现 ''{2}'' 次。另外一个实例必须满足此约束条件。 diff --git a/src/java.xml/share/classes/com/sun/org/apache/xpath/internal/res/XPATHErrorResources_de.java b/src/java.xml/share/classes/com/sun/org/apache/xpath/internal/res/XPATHErrorResources_de.java index 272dca058d3..eacc96e70fb 100644 --- a/src/java.xml/share/classes/com/sun/org/apache/xpath/internal/res/XPATHErrorResources_de.java +++ b/src/java.xml/share/classes/com/sun/org/apache/xpath/internal/res/XPATHErrorResources_de.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2019, 2025, Oracle and/or its affiliates. All rights reserved. */ /* * Licensed to the Apache Software Foundation (ASF) under one or more @@ -31,7 +31,7 @@ * Also you need to update the count of messages(MAX_CODE)or * the count of warnings(MAX_WARNING) [ Information purpose only] * @xsl.usage advanced - * @LastModified: Nov 2024 + * @LastModified: Apr 2025 */ public class XPATHErrorResources_de extends ListResourceBundle { @@ -305,7 +305,6 @@ public class XPATHErrorResources_de extends ListResourceBundle public static final String ER_XPATH_ERROR = "ER_XPATH_ERROR"; //BEGIN: Keys needed for exception messages of JAXP 1.3 XPath API implementation - public static final String ER_EXTENSION_FUNCTION_CANNOT_BE_INVOKED = "ER_EXTENSION_FUNCTION_CANNOT_BE_INVOKED"; public static final String ER_RESOLVE_VARIABLE_RETURNS_NULL = "ER_RESOLVE_VARIABLE_RETURNS_NULL"; public static final String ER_NO_XPATH_VARIABLE_RESOLVER = "ER_NO_XPATH_VARIABLE_RESOLVER"; public static final String ER_NO_XPATH_FUNCTION_PROVIDER = "ER_NO_XPATH_FUNCTION_PROVIDER"; @@ -766,11 +765,6 @@ public class XPATHErrorResources_de extends ListResourceBundle //BEGIN: Definitions of error keys used in exception messages of JAXP 1.3 XPath API implementation - /** Field ER_EXTENSION_FUNCTION_CANNOT_BE_INVOKED */ - - { ER_EXTENSION_FUNCTION_CANNOT_BE_INVOKED, - "Erweiterungsfunktion \"{0}\" kann nicht aufgerufen werden, wenn das Feature \"XMLConstants.FEATURE_SECURE_PROCESSING\" auf \"true\" gesetzt ist."}, - /** Field ER_RESOLVE_VARIABLE_RETURNS_NULL */ { ER_RESOLVE_VARIABLE_RETURNS_NULL, diff --git a/src/java.xml/share/classes/com/sun/org/apache/xpath/internal/res/XPATHErrorResources_ja.java b/src/java.xml/share/classes/com/sun/org/apache/xpath/internal/res/XPATHErrorResources_ja.java index 1b707cd7820..8d8d5828da1 100644 --- a/src/java.xml/share/classes/com/sun/org/apache/xpath/internal/res/XPATHErrorResources_ja.java +++ b/src/java.xml/share/classes/com/sun/org/apache/xpath/internal/res/XPATHErrorResources_ja.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2019, 2025, Oracle and/or its affiliates. All rights reserved. */ /* * Licensed to the Apache Software Foundation (ASF) under one or more @@ -31,7 +31,7 @@ * Also you need to update the count of messages(MAX_CODE)or * the count of warnings(MAX_WARNING) [ Information purpose only] * @xsl.usage advanced - * @LastModified: Nov 2024 + * @LastModified: Apr 2025 */ public class XPATHErrorResources_ja extends ListResourceBundle { @@ -305,7 +305,6 @@ public class XPATHErrorResources_ja extends ListResourceBundle public static final String ER_XPATH_ERROR = "ER_XPATH_ERROR"; //BEGIN: Keys needed for exception messages of JAXP 1.3 XPath API implementation - public static final String ER_EXTENSION_FUNCTION_CANNOT_BE_INVOKED = "ER_EXTENSION_FUNCTION_CANNOT_BE_INVOKED"; public static final String ER_RESOLVE_VARIABLE_RETURNS_NULL = "ER_RESOLVE_VARIABLE_RETURNS_NULL"; public static final String ER_NO_XPATH_VARIABLE_RESOLVER = "ER_NO_XPATH_VARIABLE_RESOLVER"; public static final String ER_NO_XPATH_FUNCTION_PROVIDER = "ER_NO_XPATH_FUNCTION_PROVIDER"; @@ -766,11 +765,6 @@ public class XPATHErrorResources_ja extends ListResourceBundle //BEGIN: Definitions of error keys used in exception messages of JAXP 1.3 XPath API implementation - /** Field ER_EXTENSION_FUNCTION_CANNOT_BE_INVOKED */ - - { ER_EXTENSION_FUNCTION_CANNOT_BE_INVOKED, - "\u62E1\u5F35\u95A2\u6570: XMLConstants.FEATURE_SECURE_PROCESSING\u6A5F\u80FD\u304Ctrue\u306B\u8A2D\u5B9A\u3055\u308C\u308B\u3068''{0}''\u3092\u8D77\u52D5\u3067\u304D\u307E\u305B\u3093\u3002"}, - /** Field ER_RESOLVE_VARIABLE_RETURNS_NULL */ { ER_RESOLVE_VARIABLE_RETURNS_NULL, diff --git a/src/java.xml/share/classes/com/sun/org/apache/xpath/internal/res/XPATHErrorResources_zh_CN.java b/src/java.xml/share/classes/com/sun/org/apache/xpath/internal/res/XPATHErrorResources_zh_CN.java index dd9e507a8f0..3e1969357fb 100644 --- a/src/java.xml/share/classes/com/sun/org/apache/xpath/internal/res/XPATHErrorResources_zh_CN.java +++ b/src/java.xml/share/classes/com/sun/org/apache/xpath/internal/res/XPATHErrorResources_zh_CN.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2019, 2025, Oracle and/or its affiliates. All rights reserved. */ /* * Licensed to the Apache Software Foundation (ASF) under one or more @@ -31,7 +31,7 @@ * Also you need to update the count of messages(MAX_CODE)or * the count of warnings(MAX_WARNING) [ Information purpose only] * @xsl.usage advanced - * @LastModified: Nov 2024 + * @LastModified: Apr 2025 */ public class XPATHErrorResources_zh_CN extends ListResourceBundle { @@ -305,7 +305,6 @@ public class XPATHErrorResources_zh_CN extends ListResourceBundle public static final String ER_XPATH_ERROR = "ER_XPATH_ERROR"; //BEGIN: Keys needed for exception messages of JAXP 1.3 XPath API implementation - public static final String ER_EXTENSION_FUNCTION_CANNOT_BE_INVOKED = "ER_EXTENSION_FUNCTION_CANNOT_BE_INVOKED"; public static final String ER_RESOLVE_VARIABLE_RETURNS_NULL = "ER_RESOLVE_VARIABLE_RETURNS_NULL"; public static final String ER_NO_XPATH_VARIABLE_RESOLVER = "ER_NO_XPATH_VARIABLE_RESOLVER"; public static final String ER_NO_XPATH_FUNCTION_PROVIDER = "ER_NO_XPATH_FUNCTION_PROVIDER"; @@ -766,11 +765,6 @@ public class XPATHErrorResources_zh_CN extends ListResourceBundle //BEGIN: Definitions of error keys used in exception messages of JAXP 1.3 XPath API implementation - /** Field ER_EXTENSION_FUNCTION_CANNOT_BE_INVOKED */ - - { ER_EXTENSION_FUNCTION_CANNOT_BE_INVOKED, - "\u5F53 XMLConstants.FEATURE_SECURE_PROCESSING \u529F\u80FD\u8BBE\u7F6E\u4E3A\u201C\u771F\u201D\u65F6, \u4E0D\u80FD\u8C03\u7528\u6269\u5C55\u51FD\u6570 ''{0}''\u3002"}, - /** Field ER_RESOLVE_VARIABLE_RETURNS_NULL */ { ER_RESOLVE_VARIABLE_RETURNS_NULL, diff --git a/src/jdk.compiler/share/classes/com/sun/tools/javac/code/Lint.java b/src/jdk.compiler/share/classes/com/sun/tools/javac/code/Lint.java index ede2511f35c..2ed365bcbfa 100644 --- a/src/jdk.compiler/share/classes/com/sun/tools/javac/code/Lint.java +++ b/src/jdk.compiler/share/classes/com/sun/tools/javac/code/Lint.java @@ -183,9 +183,9 @@ private void initializeRootIfNeeded() { // Look for specific overrides for (LintCategory lc : LintCategory.values()) { - if (options.isExplicitlyEnabled(Option.XLINT, lc)) { + if (options.isLintExplicitlyEnabled(lc)) { values.add(lc); - } else if (options.isExplicitlyDisabled(Option.XLINT, lc)) { + } else if (options.isLintExplicitlyDisabled(lc)) { values.remove(lc); } } diff --git a/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Modules.java b/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Modules.java index a159793fe32..47066b24de9 100644 --- a/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Modules.java +++ b/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Modules.java @@ -205,7 +205,7 @@ protected Modules(Context context) { allowAccessIntoSystem = options.isUnset(Option.RELEASE); - lintOptions = !options.isExplicitlyDisabled(Option.XLINT, LintCategory.OPTIONS); + lintOptions = !options.isLintDisabled(LintCategory.OPTIONS); multiModuleMode = fileManager.hasLocation(StandardLocation.MODULE_SOURCE_PATH); ClassWriter classWriter = ClassWriter.instance(context); diff --git a/src/jdk.compiler/share/classes/com/sun/tools/javac/main/Arguments.java b/src/jdk.compiler/share/classes/com/sun/tools/javac/main/Arguments.java index 9e3a978c3bc..7aa1cc473b5 100644 --- a/src/jdk.compiler/share/classes/com/sun/tools/javac/main/Arguments.java +++ b/src/jdk.compiler/share/classes/com/sun/tools/javac/main/Arguments.java @@ -503,7 +503,7 @@ public boolean validate() { } } else { // single-module or legacy mode - boolean lintPaths = !options.isExplicitlyDisabled(Option.XLINT, LintCategory.PATH); + boolean lintPaths = !options.isLintDisabled(LintCategory.PATH); if (lintPaths) { Path outDirParent = outDir.getParent(); if (outDirParent != null && Files.exists(outDirParent.resolve("module-info.class"))) { @@ -576,7 +576,7 @@ public boolean validate() { reportDiag(Errors.SourcepathModulesourcepathConflict); } - boolean lintOptions = !options.isExplicitlyDisabled(Option.XLINT, LintCategory.OPTIONS); + boolean lintOptions = !options.isLintDisabled(LintCategory.OPTIONS); if (lintOptions && source.compareTo(Source.DEFAULT) < 0 && !options.isSet(Option.RELEASE)) { if (fm instanceof BaseFileManager baseFileManager) { if (source.compareTo(Source.JDK8) <= 0) { diff --git a/src/jdk.compiler/share/classes/com/sun/tools/javac/resources/compiler_de.properties b/src/jdk.compiler/share/classes/com/sun/tools/javac/resources/compiler_de.properties index 8761d334157..538b5a6c03b 100644 --- a/src/jdk.compiler/share/classes/com/sun/tools/javac/resources/compiler_de.properties +++ b/src/jdk.compiler/share/classes/com/sun/tools/javac/resources/compiler_de.properties @@ -1,5 +1,5 @@ # -# Copyright (c) 1999, 2024, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 1999, 2025, 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 @@ -251,7 +251,7 @@ compiler.misc.no.suitable.functional.intf.inst=Funktionsschnittstellendeskriptor compiler.misc.bad.intersection.target.for.functional.expr=Ungültiges Schnittmengentypziel für Lambda oder Methodenreferenz\n{0} # 0: symbol or type -compiler.misc.not.an.intf.component=Komponententyp {0} ist keine Schnittstelle +compiler.misc.not.an.intf.component=Komponententyp {0} ist keine Schnittstelle oder kein java.lang.Object # 0: kind name, 1: message segment compiler.err.invalid.mref=Ungültige {0}-Referenz\n{1} @@ -389,9 +389,9 @@ compiler.err.duplicate.class=Doppelte Klasse: {0} # 0: string compiler.err.bad.file.name=Ungültiger Dateiname: {0} -compiler.err.implicit.class.should.not.have.package.declaration=Implizit deklarierte Klasse darf keine Packagedeklaration aufweisen +compiler.err.implicit.class.should.not.have.package.declaration=Kompakte Quelldatei darf keine Packagedeklaration aufweisen -compiler.err.implicit.class.does.not.have.main.method=Implizit deklarierte Klasse weist keine Hauptmethode im Format "void main()" oder "void main(String[] args)" auf +compiler.err.implicit.class.does.not.have.main.method=Kompakte Quelldatei weist keine Hauptmethode im Format "void main()" oder "void main(String[] args)" auf # 0: name, 1: name compiler.err.same.binary.name=Klassen {0} und {1} haben denselben binären Namen @@ -501,6 +501,8 @@ compiler.err.illegal.combination.of.modifiers=Unzulässige Kombination aus Modif compiler.err.illegal.enum.static.ref=Unzulässige Referenz zu statischem Feld aus Initializer +compiler.err.illegal.char.literal.multiple.surrogates=Zeichenliteral enthält mehrere UTF-16-Codeeinheiten + compiler.err.illegal.esc.char=Unzulässiges Escapezeichen compiler.err.illegal.forward.ref=Unzulässige Vorwärtsreferenz @@ -511,8 +513,10 @@ compiler.err.not.in.profile={0} ist in Profil "{1}" nicht verfügbar # 0: symbol compiler.warn.forward.ref=Referenz zu Variable "{0}", bevor sie initialisiert wurde +# lint: this-escape compiler.warn.possible.this.escape=Mögliches "this"-Escape vor vollständiger Initialisierung der Unterklasse +# lint: this-escape compiler.warn.possible.this.escape.location=Vorheriges mögliches "This"-Escape erfolgt hier per Aufruf compiler.err.illegal.self.ref=Selbstreferenz in Initializer @@ -527,8 +531,10 @@ compiler.err.illegal.line.end.in.char.lit=Unzulässiges Zeilenende in Zeichenlit compiler.err.illegal.text.block.open=Unzulässige Sequenz für Öffnungstrennzeichen von Textblock. Zeilenabschlusszeichen fehlt +# lint: text-blocks compiler.warn.inconsistent.white.space.indentation=Inkonsistenter Leerzeicheneinzug +# lint: text-blocks compiler.warn.trailing.white.space.will.be.removed=Nachgestelltes Leerzeichen wird entfernt compiler.err.illegal.nonascii.digit=Unzulässige Nicht-ASCII-Ziffer @@ -1112,6 +1118,7 @@ compiler.err.cant.read.file=Lesen nicht möglich: {0} compiler.err.plugin.not.found=Plug-in nicht gefunden: {0} # 0: path +# lint: path compiler.warn.locn.unknown.file.on.module.path=Unbekannte Datei in Modulpfad: {0} @@ -1131,6 +1138,7 @@ compiler.err.locn.cant.get.module.name.for.jar=Modulname für {0} kann nicht bes compiler.err.multi-module.outdir.cannot.be.exploded.module=Im Modus für mehrere Module kann das Ausgabeverzeichnis kein entpacktes Modul sein: {0} # 0: path +# lint: path compiler.warn.outdir.is.in.exploded.module=Das Ausgabeverzeichnis befindet sich in einem entpackten Modul: {0} # 0: file object @@ -1182,6 +1190,7 @@ compiler.misc.x.print.rounds=Runde {0}:\n\tEingabedateien: {1}\n\tAnnotationen: compiler.warn.file.from.future=Änderungsdatum liegt in der Zukunft für Datei {0} # 0: path +# lint: output-file-clash compiler.warn.output.file.clash=Ausgabedatei mehrmals geschrieben: {0} ##### @@ -1335,51 +1344,67 @@ compiler.warn.warning=Warnung:\u0020 compiler.warn.lintOption=[{0}]\u0020 # 0: symbol +# lint: serial compiler.warn.constant.SVUID=serialVersionUID muss Konstante in Klasse {0} sein +# lint: dangling-doc-comments compiler.warn.dangling.doc.comment=Dokumentationskommentar ist an keine Deklaration angehängt # 0: path +# lint: path compiler.warn.dir.path.element.not.found=Ungültiges Pfadelement "{0}": Verzeichnis nicht vorhanden # 0: file name +# lint: path compiler.warn.dir.path.element.not.directory=Ungültiges Pfadelement "{0}": kein Verzeichnis # 0: symbol, 1: symbol, 2: symbol +# lint: missing-explicit-ctor compiler.warn.missing-explicit-ctor=Klasse {0} in exportiertem Package {1} deklariert keine expliziten Konstruktoren und stellt daher einen Standardkonstruktor für Clients des Moduls {2} bereit +# lint: strictfp compiler.warn.strictfp=Ab Release 17 werden alle Gleitkommaausdrücke streng ausgewertet. Daher ist "strictfp" nicht erforderlich +# lint: finally compiler.warn.finally.cannot.complete=Finally-Klausel kann nicht normal abgeschlossen werden # 0: name +# lint: module compiler.warn.poor.choice.for.module.name=Modulnamenskomponente {0} darf keine Ziffern am Ende enthalten # 0: string +# lint: incubating compiler.warn.incubating.modules=Inkubatormodul(e) verwendet: {0} # 0: symbol, 1: symbol +# lint: deprecation compiler.warn.has.been.deprecated={0} in {1} ist veraltet # 0: symbol, 1: symbol +# lint: removal compiler.warn.has.been.deprecated.for.removal={0} in {1} ist veraltet und wurde zum Entfernen markiert # 0: symbol +# lint: preview compiler.warn.is.preview={0} ist eine Vorschau-API, die in einem zukünftigen Release entfernt werden kann. # 0: symbol compiler.err.is.preview={0} ist eine Vorschau-API, die standardmäßig deaktiviert ist.\n(Verwenden Sie --enable-preview, um Vorschau-APIs zu aktivieren) # 0: symbol +# lint: preview compiler.warn.is.preview.reflective={0} ist eine reflektive Vorschau-API, die in einem zukünftigen Release entfernt werden kann. # 0: symbol, 1: symbol +# lint: restricted compiler.warn.restricted.method={0}.{1} ist eine eingeschränkte Methode.\n(Eingeschränkte Methoden sind nicht sicher und können bei falscher Verwendung die JRE zum Absturz bringen oder den Arbeitsspeicher beschädigen) # 0: symbol +# lint: deprecation compiler.warn.has.been.deprecated.module=Modul {0} ist veraltet # 0: symbol +# lint: removal compiler.warn.has.been.deprecated.for.removal.module=Modul {0} ist veraltet und wurde zum Entfernen markiert # 0: symbol @@ -1388,10 +1413,13 @@ compiler.warn.sun.proprietary={0} ist eine interne proprietäre API, die in eine compiler.warn.illegal.char.for.encoding=Nicht zuordenbares Zeichen für Codierung {0} # 0: symbol +# lint: serial compiler.warn.improper.SVUID=serialVersionUID muss als "static final" in Klasse {0} deklariert sein +# lint: serial compiler.warn.improper.SPF=serialPersistentFields muss als "private static final" deklariert sein, um in Kraft zu treten +# lint: serial compiler.warn.SPF.null.init=serialPersistentFields tritt bei Initialisierung als Null nicht in Kraft.\nFühren Sie die Initialisierung zu einem leeren Array aus, um keine Felder anzugeben @@ -1405,82 +1433,111 @@ compiler.warn.unreachable.catch=Nicht erreichbare Catch-Klausel\nAusgelöster Ty compiler.warn.unreachable.catch.1=Nicht erreichbare Catch-Klausel\nAusgelöste Typen {0} wurden bereits abgefangen # 0: symbol +# lint: serial compiler.warn.long.SVUID=serialVersionUID muss den Typ "long" in Klasse {0} aufweisen +# lint: serial compiler.warn.OSF.array.SPF=serialPersistentFields muss den Typ "java.io.ObjectStreamField[]" aufweisen, um in Kraft zu treten # 0: symbol +# lint: serial compiler.warn.missing.SVUID=Serialisierbare Klasse {0} enthält keine Definition von serialVersionUID # 0: name +# lint: serial compiler.warn.serializable.missing.access.no.arg.ctor=Zugriff auf einen no-arg-Konstruktor in der ersten nicht serialisierbaren Superklasse {0} nicht möglich # 0: name +# lint: serial compiler.warn.serial.method.not.private=Serialisierungsbezogene Methode {0} nicht als privat deklariert # 0: name +# lint: serial compiler.warn.serial.concrete.instance.method=Serialisierungsbezogene Methode {0} muss eine konkrete Instanzmethode sein, um in Kraft zu treten. Sie darf nicht abstrakt oder statisch sein # 0: name +# lint: serial compiler.warn.serial.method.static=Serialisierungsbezogene Methode {0} ist als statisch deklariert. Sie muss stattdessen eine Instanzmethode sein, um in Kraft zu treten. # 0: name +# lint: serial compiler.warn.serial.method.no.args=Serialisierungsbezogene Methode {0} darf keine Parameter aufweisen, um in Kraft zu treten # 0: name, 1: number +# lint: serial compiler.warn.serial.method.one.arg=Serialisierungsbezogene Methode {0} muss genau einen Parameter aufweisen, um in Kraft zu treten. Sie darf nicht {1} Parameter enthalten # 0: name, 1: type, 2: type +# lint: serial compiler.warn.serial.method.parameter.type=Der einzige Parameter der serialisierungsbezogenen Methode {0} muss den Typ {1} haben, um in Kraft zu treten. Er darf nicht den Typ {2} aufweisen # 0: name, 1: type, 2: type +# lint: serial compiler.warn.serial.method.unexpected.return.type=Serialisierungsbezogene Methode {0} wurde mit dem Rückgabetyp {1} und nicht dem erwarteten Typ {2} deklariert.\nMit dieser Deklaration ist die Methode ungültig für die Serialisierung # 0: name, 1: type +# lint: serial compiler.warn.serial.method.unexpected.exception=Serialisierungsbezogene Methode {0} wurde zum Auslösen eines unerwarteten Typs {1} deklariert +# lint: serial compiler.warn.ineffectual.serial.field.interface=serialPersistentFields ist in einer Schnittstelle nicht effektiv # 0: string +# lint: serial compiler.warn.ineffectual.serial.field.enum=Serialisierungsbezogenes Feld {0} ist in einer Enum-Klasse nicht effektiv # 0: string +# lint: serial compiler.warn.ineffectual.serial.method.enum=Serialisierungsbezogene Methode {0} ist in einer Enum-Klasse nicht effektiv # 0: string +# lint: serial compiler.warn.ineffectual.extern.method.enum=Externalisierungsbezogene Methode {0} ist in einer Enum-Klasse nicht effektiv +# lint: serial compiler.warn.ineffectual.serial.field.record=serialPersistentFields ist in einer Datensatzklasse nicht effektiv # 0: string +# lint: serial compiler.warn.ineffectual.serial.method.record=Serialisierungsbezogene Methode {0} ist in einer Datensatzklasse nicht effektiv # 0: string +# lint: serial compiler.warn.ineffectual.externalizable.method.record=Externalisierungsbezogene Methode {0} ist in einer Datensatzklasse nicht effektiv # 0: name +# lint: serial compiler.warn.ineffectual.serial.method.externalizable=Serialisierungsbezogene Methode {0} ist in einer externalisierbaren Klasse nicht effektiv +# lint: serial compiler.warn.ineffectual.serial.field.externalizable=serialPersistentFields ist in einer externalisierbaren Klasse nicht effektiv +# lint: serial compiler.warn.externalizable.missing.public.no.arg.ctor=Eine externalisierbare Klasse erfordert einen öffentlichen no-arg-Konstruktor +# lint: serial compiler.warn.non.serializable.instance.field=Nicht transientes Instanzfeld einer serialisierbaren Klasse mit einem nicht serialisierbaren Typ deklariert # 0: type +# lint: serial compiler.warn.non.serializable.instance.field.array=Nicht transientes Instanzfeld einer serialisierbaren Klasse wurde mit einem Array mit einem nicht serialisierbaren Basiskomponententyp {0} deklariert +# lint: serial compiler.warn.non.private.method.weaker.access=Serialisierungsbezogene Methode, die in einer Schnittstelle als nicht privat deklariert ist, verhindert,\ndass Klassen, die die Schnittstelle implementieren, die Methode als privat deklarieren +# lint: serial compiler.warn.default.ineffective=Serialisierungsbezogene Standardmethode aus einer Schnittstelle wird nicht von der Serialisierung für eine implementierende Klasse ausgeführt # 0: symbol, 1: symbol, 2: symbol, 3: symbol +# lint: overloads compiler.warn.potentially.ambiguous.overload={0} in {1} ist möglicherweise mehrdeutig mit {2} in {3} # 0: message segment +# lint: overrides compiler.warn.override.varargs.missing={0}. Außer Kraft gesetzte Methode umfasst kein "..." # 0: message segment +# lint: overrides compiler.warn.override.varargs.extra={0}. In außer Kraft setzender Methode fehlt "..." # 0: message segment @@ -1490,11 +1547,14 @@ compiler.warn.override.bridge={0}. Außer Kraft setzende Methode ist eine Bridge compiler.warn.pkg-info.already.seen=Die Datei package-info.java wurde bereits für Package {0} gefunden # 0: path +# lint: path compiler.warn.path.element.not.found=Ungültiges Pfadelement "{0}": Datei oder Verzeichnis nicht vorhanden +# lint: fallthrough compiler.warn.possible.fall-through.into.case=Möglicher Fallthrough in Case # 0: type +# lint: cast compiler.warn.redundant.cast=Redundantes Casting in {0} # 0: number @@ -1507,15 +1567,19 @@ compiler.warn.big.major.version={0}: Hauptversion {1} ist neuer als {2}, die hö compiler.warn.invalid.utf8.in.classfile={0}: Klassendatei enthält ungültige UTF-8-Codierung: {1} # 0: kind name, 1: symbol +# lint: static compiler.warn.static.not.qualified.by.type=Statische {0} muss mit Typname {1} anstelle eines Ausdrucks qualifiziert werden # 0: kind name +# lint: static compiler.warn.static.not.qualified.by.type2={0} (statisch) darf nicht als Member einer anonymen Klasse verwendet werden # 0: string, 1: fragment +# lint: options compiler.warn.source.no.bootclasspath=Bootstrap Classpath ist nicht zusammen mit -source {0} festgelegt\n{1} # 0: string, 1: fragment +# lint: options compiler.warn.source.no.system.modules.path=Systemmodulpfad ist nicht zusammen mit -source {0} festgelegt\n{1} # 0: string @@ -1531,9 +1595,11 @@ compiler.misc.source.no.bootclasspath.with.target=Wenn Sie den Bootstrap Classpa compiler.misc.source.no.system.modules.path.with.target=Wenn Sie den Speicherort der Systemmodule nicht festlegen, kann dies zu Klassendateien führen, die auf JDK {0} nicht ausgeführt werden können\n--release {0} wird anstelle von -source {0} -target {1} empfohlen, weil dadurch der Speicherort der Systemmodule automatisch festgelegt wird # 0: string +# lint: options compiler.warn.option.obsolete.source=Quellwert {0} ist veraltet und wird in einem zukünftigen Release entfernt # 0: target +# lint: options compiler.warn.option.obsolete.target=Zielwert {0} ist veraltet und wird in einem zukünftigen Release entfernt # 0: string, 1: string @@ -1542,13 +1608,17 @@ compiler.err.option.removed.source=Quelloption {0} wird nicht mehr unterstützt. # 0: target, 1: target compiler.err.option.removed.target=Zieloption {0} wird nicht mehr unterstützt. Verwenden Sie {1} oder höher. +# lint: options compiler.warn.option.obsolete.suppression=Verwenden Sie -Xlint:-options, um Warnungen zu veralteten Optionen zu unterdrücken. # 0: name, 1: number, 2: number, 3: number, 4: number +# lint: classfile compiler.warn.future.attr={0}-Attribut, das in Klassendateien der Version {1}.{2} eingeführt wurde, wird in Klassendateien der Version {3}.{4} ignoriert +# lint: requires-automatic compiler.warn.requires.automatic=Erfordert Direktive für ein automatisches Modul +# lint: requires-transitive-automatic compiler.warn.requires.transitive.automatic=Erfordert transitive-Direktive für ein automatisches Modul # Warnings related to annotation processing @@ -1556,40 +1626,50 @@ compiler.warn.requires.transitive.automatic=Erfordert transitive-Direktive für compiler.warn.proc.package.does.not.exist=Package {0} ist nicht vorhanden # 0: string +# lint: processing compiler.warn.proc.file.reopening=Versuch, mehrmals eine Datei für "{0}" zu erstellen # 0: string +# lint: processing compiler.warn.proc.type.already.exists=Es ist bereits eine Datei für Typ "{0}" im Quellpfad oder Classpath vorhanden # 0: string +# lint: processing compiler.warn.proc.type.recreate=Versuch, mehrmals eine Datei für Typ "{0}" zu erstellen # 0: string +# lint: processing compiler.warn.proc.illegal.file.name=Datei kann nicht für unzulässigen Namen "{0}" erstellt werden. # 0: string, 1: string +# lint: processing compiler.warn.proc.suspicious.class.name=Datei für einen Typ, dessen Name mit {1} endet, wird erstellt: "{0}" # 0: string compiler.warn.proc.file.create.last.round=Datei für Typ "{0}", die in der letzten Runde erstellt wurde, wird keiner Annotationsverarbeitung unterzogen. # 0: string, 1: string +# lint: processing compiler.warn.proc.malformed.supported.string=Nicht wohlgeformte Zeichenfolge "{0}" für eine unterstützte Annotationsschnittstelle von Prozessor "{1}" zurückgegeben # 0: set of string +# lint: processing compiler.warn.proc.annotations.without.processors=Diese Annotationen wurden von keinem Prozessor beansprucht: {0} # 0: source version, 1: string, 2: string compiler.warn.proc.processor.incompatible.source.version=Unterstützte Quellversion "{0}" von Annotationsprozessor "{1}" kleiner als -source "{2}" # 0: string, 1: string +# lint: processing compiler.warn.proc.duplicate.option.name=Doppelte unterstützte Option "{0}" von Annotationsprozessor "{1}" zurückgegeben # 0: string, 1: string +# lint: processing compiler.warn.proc.duplicate.supported.annotation=Doppelte unterstützte Annotationsschnittstelle "{0}" von Annotationsprozessor "{1}" zurückgegeben # 0: string +# lint: processing compiler.warn.proc.redundant.types.with.wildcard=Annotationsprozessor "{0}" unterstützt redundant sowohl "*" als auch andere Annotationsschnittstellen compiler.warn.proc.proc-only.requested.no.procs=Annotationsverarbeitung ohne Kompilierung angefordert, aber keine Prozessoren gefunden. @@ -1608,42 +1688,56 @@ compiler.warn.proc.unclosed.type.files=Nicht geschlossene Dateien für die Typen # 0: string compiler.warn.proc.unmatched.processor.options=Die folgenden Optionen wurden von keinem Prozessor erkannt: "{0}" +# lint: try compiler.warn.try.explicit.close.call=Expliziter Aufruf von close() für eine automatisch schließbare Ressource # 0: symbol +# lint: try compiler.warn.try.resource.not.referenced=Automatisch schließbare Ressource {0} wird nie im Body der entsprechenden try-Anweisung referenziert # 0: type +# lint: try compiler.warn.try.resource.throws.interrupted.exc=Automatisch schließbare Ressource {0} umfasst die Mitgliedsmethode close(), die InterruptedException auslösen könnte +# lint: unchecked compiler.warn.unchecked.assign=Nicht geprüfte Zuweisung: {0} zu {1} # 0: symbol, 1: type +# lint: unchecked compiler.warn.unchecked.assign.to.var=Nicht geprüfte Zuweisung zu Variable {0} als Mitglied des Raw-Typs {1} # 0: symbol, 1: type +# lint: unchecked compiler.warn.unchecked.call.mbr.of.raw.type=Nicht geprüfter Aufruf von {0} als Mitglied des Raw-Typs {1} +# lint: unchecked compiler.warn.unchecked.cast.to.type=Nicht geprüftes Casting zu Typ {0} # 0: kind name, 1: name, 2: object, 3: object, 4: kind name, 5: symbol +# lint: unchecked compiler.warn.unchecked.meth.invocation.applied=Nicht geprüfter Methodenaufruf: {0} {1} in {4} {5} wird auf die angegebenen Typen angewendet\nErforderlich: {2}\nErmittelt: {3} # 0: type +# lint: unchecked compiler.warn.unchecked.generic.array.creation=Nicht geprüfte Erstellung eines generischen Arrays für varargs-Parameter des Typs {0} # 0: type +# lint: unchecked compiler.warn.unchecked.varargs.non.reifiable.type=Möglich Heap-Beschädigung aus parametrisiertem vararg-Typ {0} # 0: symbol +# lint: varargs compiler.warn.varargs.unsafe.use.varargs.param=Varargs-Methode könnte Heap-Beschädigung aus nicht reifizierbarem varargs-Parameter {0} verursachen +# lint: dep-ann compiler.warn.missing.deprecated.annotation=Veraltetes Element ist nicht mit @Deprecated-Annotation versehen # 0: kind name +# lint: deprecation compiler.warn.deprecated.annotation.has.no.effect=@Deprecated-Annotation hat keine Auswirkung auf diese {0}-Deklaration # 0: string +# lint: path compiler.warn.invalid.path=Ungültiger Dateiname: {0} compiler.warn.doclint.not.available=Kein Serviceprovider für doclint verfügbar @@ -1653,22 +1747,28 @@ compiler.err.invalid.path=Ungültiger Dateiname: {0} # 0: path +# lint: path compiler.warn.invalid.archive.file=Unerwartete Datei in Pfad: {0} # 0: path +# lint: path compiler.warn.unexpected.archive.file=Unerwartete Erweiterung für Archivdatei: {0} # 0: path compiler.err.no.zipfs.for.archive=Kein Dateisystemprovider zur Verarbeitung dieser Datei verfügbar: {0} +# lint: divzero compiler.warn.div.zero=Division durch Null +# lint: empty compiler.warn.empty.if=Leere Anweisung nach "if" # 0: type, 1: name +# lint: classfile compiler.warn.annotation.method.not.found=Annotationsmethode "{1}()" kann nicht in Typ "{0}" gefunden werden # 0: type, 1: name, 2: message segment +# lint: classfile compiler.warn.annotation.method.not.found.reason=Annotationsmethode "{1}()" kann nicht in Typ "{0}" gefunden werden: {2} # 0: list of annotation, 1: symbol, 2: name, 3: message segment @@ -1681,6 +1781,7 @@ compiler.warn.unknown.enum.constant=Unbekannte Enum-Konstante {1}.{2} compiler.warn.unknown.enum.constant.reason=Unbekannte Enum-Konstante {1}.{2}\nGrund: {3} # 0: type, 1: type +# lint: rawtypes compiler.warn.raw.class.use=Raw-Typ gefunden: {0}\nTypargumente für generische Klasse {1} fehlen compiler.warn.diamond.redundant.args=Redundante Typargumente in neuem Ausdruck (verwenden Sie stattdessen den Rautenoperator). @@ -1692,12 +1793,15 @@ compiler.warn.potential.lambda.found=Die Erstellung dieser anonymen inneren Klas compiler.warn.method.redundant.typeargs=Redundante Typargumente in Methodenaufruf. # 0: symbol, 1: message segment +# lint: varargs compiler.warn.varargs.redundant.trustme.anno=Redundante {0}-Annotation. {1} # 0: symbol +# lint: serial compiler.warn.access.to.member.from.serializable.element=Zugriff auf Mitglied {0} aus serialisierbarem Element kann öffentlich für nicht vertrauenswürdigen Code zugänglich sein # 0: symbol +# lint: serial compiler.warn.access.to.member.from.serializable.lambda=Zugriff auf Mitglied {0} aus serialisierbarem Lambda kann öffentlich für nicht vertrauenswürdigen Code zugänglich sein ##### @@ -1810,9 +1914,11 @@ compiler.misc.bad.enclosing.class=Ungültige einschließende Klasse für {0}: {1 compiler.misc.bad.enclosing.method=Ungültiges einschließendes Methodenattribut für Klasse {0} # 0: file name +# lint: classfile compiler.warn.runtime.visible.invisible.param.annotations.mismatch=Die Längen der Parameter im RuntimeVisibleParameterAnnotations-Attribut und RuntimeInvisibleParameterAnnotations-Attribut in {0} stimmen nicht überein. Beide Attribute werden ignoriert # 0: file name +# lint: classfile compiler.warn.runtime.invisible.parameter.annotations=Die Attribute RuntimeVisibleParameterAnnotations und RuntimeInvisibleParameterAnnotations in {0} können nicht den Parametern der Methode zugeordnet werden compiler.misc.bad.const.pool.tag=Ungültiges Konstantenpooltag: {0} @@ -1904,6 +2010,7 @@ compiler.err.prob.found.req=Inkompatible Typen: {0} compiler.misc.prob.found.req=Inkompatible Typen: {0} # 0: message segment, 1: type, 2: type +# lint: unchecked compiler.warn.prob.found.req={0}\nErforderlich: {2}\nErmittelt: {1} # 0: type, 1: type @@ -1913,6 +2020,7 @@ compiler.misc.inconvertible.types={0} kann nicht in {1} konvertiert werden compiler.misc.possible.loss.of.precision=Möglicher Verlust bei Konvertierung von {0} in {1} # 0: type, 1: type +# lint: lossy-conversions compiler.warn.possible.loss.of.precision=Möglicher Verlust eines impliziten Cast von {0} bis {1} in zusammengesetzter Zuweisung compiler.misc.unchecked.assign=Nicht geprüfte Konvertierung @@ -2035,6 +2143,7 @@ compiler.misc.varargs.argument.mismatch=Keine übereinstimmenden varargs; {0} ##### # 0: symbol or type, 1: file name +# lint: auxiliaryclass compiler.warn.auxiliary.class.accessed.from.outside.of.its.source.file=Auf Auxiliary-Klasse {0} in {1} darf nicht von außerhalb der eigenen Quelldatei zugegriffen werden ## The first argument ({0}) is a "kindname". @@ -2174,12 +2283,15 @@ compiler.err.override.weaker.access={0}\nVersuch, niedrigere Zugriffsberechtigun compiler.err.override.incompatible.ret={0}\nRückgabetyp {1} ist nicht mit {2} kompatibel # 0: message segment, 1: type, 2: type +# lint: unchecked compiler.warn.override.unchecked.ret={0}\nRückgabetyp erfordert eine nicht geprüfte Konvertierung von {1} in {2} # 0: message segment, 1: type +# lint: unchecked compiler.warn.override.unchecked.thrown={0}\nAußer Kraft gesetzte Methode löst nicht {1} aus # 0: symbol +# lint: overrides compiler.warn.override.equals.but.not.hashcode=Klasse {0} setzt Gleichwertige außer Kraft. hashCode-Methode wird aber weder von der Klasse noch einer Superklasse außer Kraft gesetzt ## The following are all possible strings for the first argument ({0}) of the @@ -2245,12 +2357,15 @@ compiler.err.preview.feature.disabled.plural={0} sind ein Vorschaufeature, das s compiler.err.preview.feature.disabled.classfile=Klassendatei für {0} verwendet Vorschaufeatures von Java SE {1}.\n(Verwenden Sie --enable-preview, um das Laden von Klassendateien mit Vorschaufeatures zu ermöglichen) # 0: message segment (feature) +# lint: preview compiler.warn.preview.feature.use={0} ist ein Vorschaufeature, das in einem zukünftigen Release entfernt werden kann. # 0: message segment (feature) +# lint: preview compiler.warn.preview.feature.use.plural={0} sind ein Vorschaufeature, das in einem zukünftigen Release entfernt werden kann. # 0: file object (classfile), 1: string (expected version) +# lint: preview compiler.warn.preview.feature.use.classfile=Klassendatei für {0} verwendet Vorschaufeatures von Java SE {1}. compiler.misc.feature.modules=Module @@ -2515,6 +2630,7 @@ compiler.err.expected.module="module" erwartet compiler.err.module.not.found=Modul nicht gefunden: {0} # 0: symbol +# lint: module compiler.warn.module.not.found=Modul nicht gefunden: {0} # 0: name @@ -2584,6 +2700,7 @@ compiler.err.service.implementation.no.args.constructor.not.public=Der "no argum compiler.err.package.empty.or.not.found=Package ist leer oder nicht vorhanden: {0} # 0: symbol +# lint: opens compiler.warn.package.empty.or.not.found=Package ist leer oder nicht vorhanden: {0} compiler.err.no.output.dir=Kein Klassenausgabeverzeichnis angegeben @@ -2644,6 +2761,7 @@ compiler.warn.bad.name.for.option=Ungültiger Name im Wert für {0}-Option: "{1} compiler.err.bad.name.for.option=Ungültiger Name im Wert für {0}-Option: "{1}" # 0: option name, 1: symbol +# lint: options compiler.warn.module.for.option.not.found=Modulname in {0}-Option nicht gefunden: {1} compiler.err.addmods.all.module.path.invalid=--add-modules ALL-MODULE-PATH kann nur beim Kompilieren des unbenannten Moduls oder beim Kompilieren im Kontext eines automatischen Moduls verwendet werden @@ -2654,6 +2772,7 @@ compiler.err.add.exports.with.release=Export eines Packages aus Systemmodul {0} # 0: symbol compiler.err.add.reads.with.release=Hinzufügen von Lese-Edges für Systemmodul {0} ist mit --release nicht zulässig +# lint: options compiler.warn.addopens.ignored=--add-opens hat zur Kompilierungszeit keine Auswirkungen compiler.misc.locn.module_source_path=Modulquellpfad @@ -2675,12 +2794,16 @@ compiler.err.invalid.module.specifier=Modulbezeichner nicht zulässig: {0} compiler.warn.service.provided.but.not.exported.or.used=Serviceschnittstelle angegeben, aber nicht exportiert oder verwendet # 0: kind name, 1: symbol, 2: symbol +# lint: exports compiler.warn.leaks.not.accessible={0} {1} in Modul {2} ist nicht zugänglich für Clients, die dieses Modul benötigen # 0: kind name, 1: symbol, 2: symbol +# lint: exports compiler.warn.leaks.not.accessible.unexported={0} {1} in Modul {2} wird nicht exportiert # 0: kind name, 1: symbol, 2: symbol +# lint: exports compiler.warn.leaks.not.accessible.not.required.transitive={0} {1} in Modul {2} wird nicht indirekt mit "requires transitive" exportiert # 0: kind name, 1: symbol, 2: symbol +# lint: exports compiler.warn.leaks.not.accessible.unexported.qualified={0} {1} in Modul {2} ist möglichweise nicht für alle Clients, die dieses Modul benötigen, sichtbar ### @@ -2712,7 +2835,10 @@ compiler.misc.is.a.type.variable=Darf keine Typvariablen enthalten: {0} compiler.misc.is.duplicated=Darf keine Duplikate enthalten: {0} # 0: type -compiler.misc.doesnt.extend.sealed=Unterklasse {0} muss verschlüsselte Klasse erweitern +compiler.misc.doesnt.extend.sealed=Klasse {0} muss verschlüsselte Klasse erweitern + +# 0: kind name, 1: type +compiler.misc.doesnt.implement.sealed={0} {1} muss verschlüsselte Klasse erweitern compiler.misc.must.not.be.same.class=Unzulässige Selbstreferenz in PERMITS-Klausel @@ -2912,9 +3038,14 @@ compiler.err.deconstruction.pattern.var.not.allowed=Dekonstruktionsmuster könne compiler.err.incorrect.number.of.nested.patterns=Falsche Anzahl verschachtelter Muster\nErforderlich: {0}\nGefunden: {1} # 0: kind name, 1: symbol +# lint: preview compiler.warn.declared.using.preview={0} {1} ist mit einem Vorschaufeature deklariert, das in einem zukünftigen Release entfernt werden kann. +# lint: identity compiler.warn.attempt.to.synchronize.on.instance.of.value.based.class=Versuch der Synchronisierung für eine Instanz einer wertbasierten Klasse +# lint: identity +compiler.warn.attempt.to.use.value.based.where.identity.expected=Verwendung einer wertbasierten Klasse mit einem Vorgang, der eine zuverlässige Identität erwartet + # 0: type compiler.err.enclosing.class.type.non.denotable=Einschließender Klassentyp: {0}\nist nicht deklarierbar. Führen Sie das Casting in einen deklarierbaren Typ aus diff --git a/src/jdk.compiler/share/classes/com/sun/tools/javac/resources/compiler_ja.properties b/src/jdk.compiler/share/classes/com/sun/tools/javac/resources/compiler_ja.properties index 9ab2862407f..aa501fd6c11 100644 --- a/src/jdk.compiler/share/classes/com/sun/tools/javac/resources/compiler_ja.properties +++ b/src/jdk.compiler/share/classes/com/sun/tools/javac/resources/compiler_ja.properties @@ -1,5 +1,5 @@ # -# Copyright (c) 1999, 2024, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 1999, 2025, 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 @@ -251,7 +251,7 @@ compiler.misc.no.suitable.functional.intf.inst={0}の機能インタフェース compiler.misc.bad.intersection.target.for.functional.expr=ラムダまたはメソッド参照の交差タイプ・ターゲットが不正です\n{0} # 0: symbol or type -compiler.misc.not.an.intf.component=コンポーネント・タイプ{0}はインタフェースではありません +compiler.misc.not.an.intf.component=コンポーネント・タイプ{0}はインタフェースまたはjava.lang.Objectではありません # 0: kind name, 1: message segment compiler.err.invalid.mref={0}参照が無効です\n{1} @@ -389,9 +389,9 @@ compiler.err.duplicate.class=クラス{0}が重複しています # 0: string compiler.err.bad.file.name=不正なファイル名: {0} -compiler.err.implicit.class.should.not.have.package.declaration=暗黙的に宣言されたクラスにパッケージ宣言を含めることはできません +compiler.err.implicit.class.should.not.have.package.declaration=コンパクト・ソース・ファイルにパッケージ宣言を含めることはできません -compiler.err.implicit.class.does.not.have.main.method=暗黙的に宣言されたクラスにvoid main()またはvoid main(String[] args)という形式のmainメソッドがありません +compiler.err.implicit.class.does.not.have.main.method=コンパクト・ソース・ファイルにvoid main()またはvoid main(String[] args)という形式のmainメソッドがありません # 0: name, 1: name compiler.err.same.binary.name=クラス: {0}と{1}のバイナリ名が同じです @@ -501,6 +501,8 @@ compiler.err.illegal.combination.of.modifiers=修飾子{0}と{1}の組合せは compiler.err.illegal.enum.static.ref=初期化子からstaticフィールドへの参照が不正です +compiler.err.illegal.char.literal.multiple.surrogates=文字リテラルに複数のUTF-16コード・ユニットが含まれています + compiler.err.illegal.esc.char=エスケープ文字が不正です compiler.err.illegal.forward.ref=前方参照が不正です @@ -511,8 +513,10 @@ compiler.err.not.in.profile={0}はプロファイル''{1}''で使用できませ # 0: symbol compiler.warn.forward.ref=初期化される前の変数''{0}''を参照しようとしました +# lint: this-escape compiler.warn.possible.this.escape=サブクラスが初期化される前の''this''エスケープの可能性があります +# lint: this-escape compiler.warn.possible.this.escape.location=事前の''this''エスケープはこの呼び出しで出現する可能性があります compiler.err.illegal.self.ref=初期化子内の自己参照 @@ -527,8 +531,10 @@ compiler.err.illegal.line.end.in.char.lit=文字リテラルの行末が不正 compiler.err.illegal.text.block.open=テキスト・ブロックの開始区切り文字のシーケンスが無効です。行の終了文字がありません +# lint: text-blocks compiler.warn.inconsistent.white.space.indentation=空白のインデントに一貫性がありません +# lint: text-blocks compiler.warn.trailing.white.space.will.be.removed=末尾の空白は除去されます compiler.err.illegal.nonascii.digit=不正な非ASCII数字です @@ -1112,6 +1118,7 @@ compiler.err.cant.read.file={0}を読み込めません compiler.err.plugin.not.found=プラグインが見つかりません: {0} # 0: path +# lint: path compiler.warn.locn.unknown.file.on.module.path=モジュール・パスのファイルが不明です: {0} @@ -1131,6 +1138,7 @@ compiler.err.locn.cant.get.module.name.for.jar={0}のモジュール名を判別 compiler.err.multi-module.outdir.cannot.be.exploded.module=複数モジュール・モードで、出力ディレクトリは展開したモジュールにすることはできません: {0} # 0: path +# lint: path compiler.warn.outdir.is.in.exploded.module=出力ディレクトリは展開したモジュール内です: {0} # 0: file object @@ -1182,6 +1190,7 @@ compiler.misc.x.print.rounds=往復{0}:\n\t入力ファイル: {1}\n\t注釈: {2 compiler.warn.file.from.future=ファイル{0}の変更日が将来の日付です # 0: path +# lint: output-file-clash compiler.warn.output.file.clash=出力ファイルへの書込みが複数回ありました: {0} ##### @@ -1335,51 +1344,67 @@ compiler.warn.warning=警告:\u0020 compiler.warn.lintOption=[{0}]\u0020 # 0: symbol +# lint: serial compiler.warn.constant.SVUID=serialVersionUIDはクラス{0}の定数である必要があります +# lint: dangling-doc-comments compiler.warn.dangling.doc.comment=どの宣言にもドキュメンテーション・コメントが添付されていません # 0: path +# lint: path compiler.warn.dir.path.element.not.found=不正なパス要素"{0}": そのディレクトリは存在しません # 0: file name +# lint: path compiler.warn.dir.path.element.not.directory=不正なパス要素"{0}": ディレクトリは存在しません # 0: symbol, 1: symbol, 2: symbol +# lint: missing-explicit-ctor compiler.warn.missing-explicit-ctor=エクスポートされたパッケージ{1}のクラス{0}は明示的なコンストラクタを宣言しないため、デフォルト・コンストラクタをモジュール{2}のクライアントに公開します +# lint: strictfp compiler.warn.strictfp=リリース17以降、すべての浮動小数点式は厳密に評価され、''strictfp''は必要ありません +# lint: finally compiler.warn.finally.cannot.complete=finally節が正常に完了できません # 0: name +# lint: module compiler.warn.poor.choice.for.module.name=モジュール名コンポーネント{0}の末尾は数字にしないでください # 0: string +# lint: incubating compiler.warn.incubating.modules=実験的なモジュールを使用しています: {0} # 0: symbol, 1: symbol +# lint: deprecation compiler.warn.has.been.deprecated={1}の{0}は推奨されません # 0: symbol, 1: symbol +# lint: removal compiler.warn.has.been.deprecated.for.removal={1}の{0}は推奨されておらず、削除用にマークされています # 0: symbol +# lint: preview compiler.warn.is.preview={0}はプレビューAPIであり、今後のリリースで削除される可能性があります。 # 0: symbol compiler.err.is.preview={0}はプレビューAPIであり、デフォルトで無効になっています。\n(プレビューAPIを有効にするには--enable-previewを使用します) # 0: symbol +# lint: preview compiler.warn.is.preview.reflective={0}はリフレクティブ・プレビューAPIであり、今後のリリースで削除される可能性があります。 # 0: symbol, 1: symbol +# lint: restricted compiler.warn.restricted.method={0}.{1}は制限されたメソッドです。\n(制限されたメソッドは安全ではありません。不適切に使用した場合、Javaランタイムがクラッシュまたはメモリーが破損する場合があります) # 0: symbol +# lint: deprecation compiler.warn.has.been.deprecated.module=モジュール{0}は推奨されません # 0: symbol +# lint: removal compiler.warn.has.been.deprecated.for.removal.module=モジュール{0}は推奨されておらず、削除用にマークされています # 0: symbol @@ -1388,10 +1413,13 @@ compiler.warn.sun.proprietary={0}は内部所有のAPIであり、今後のリ compiler.warn.illegal.char.for.encoding=この文字は、エンコーディング{0}にマップできません # 0: symbol +# lint: serial compiler.warn.improper.SVUID=serialVersionUIDは、クラス{0}にstatic finalを宣言する必要があります +# lint: serial compiler.warn.improper.SPF=serialPersistentFieldsを有効にするには、private static finalとして宣言する必要があります +# lint: serial compiler.warn.SPF.null.init=nullに初期化するとserialPersistentFieldsは無効になります。\nフィールドがないことを示すには、空の配列に初期化します @@ -1405,82 +1433,111 @@ compiler.warn.unreachable.catch=catch句に移すことができません\nス compiler.warn.unreachable.catch.1=catch句に移すことができません\nスローされたタイプ{0}はすでに捕捉されています # 0: symbol +# lint: serial compiler.warn.long.SVUID=serialVersionUIDは、クラス{0}のlong型である必要があります +# lint: serial compiler.warn.OSF.array.SPF=serialPersistentFieldsを有効にするには、タイプをjava.io.ObjectStreamField[]にする必要があります # 0: symbol +# lint: serial compiler.warn.missing.SVUID=直列化可能なクラス{0}には、serialVersionUIDが定義されていません # 0: name +# lint: serial compiler.warn.serializable.missing.access.no.arg.ctor=シリアライズ不可のスーパークラス{0}で引数なしのコンストラクタにアクセスできません # 0: name +# lint: serial compiler.warn.serial.method.not.private=シリアライズ関連メソッド{0}はprivateとして宣言されていません # 0: name +# lint: serial compiler.warn.serial.concrete.instance.method=シリアライズ関連メソッド{0}を有効にするには、concreteインスタンス・メソッドである必要があります。abstractでもstaticでもありません # 0: name +# lint: serial compiler.warn.serial.method.static=シリアライズ関連メソッド{0}がstaticとして宣言されています。有効にするには、かわりにインスタンス・メソッドにする必要があります # 0: name +# lint: serial compiler.warn.serial.method.no.args=有効にするには、シリアライズ関連メソッド{0}にパラメータを指定しないでください # 0: name, 1: number +# lint: serial compiler.warn.serial.method.one.arg=有効にするには、シリアライズ関連メソッド{0}に、{1}のパラメータではなく、パラメータを1つのみ指定する必要があります # 0: name, 1: type, 2: type +# lint: serial compiler.warn.serial.method.parameter.type=有効にするには、シリアライズ関連メソッド{0}の1つのパラメータに、型{2}ではなく、型{1}を指定する必要があります # 0: name, 1: type, 2: type +# lint: serial compiler.warn.serial.method.unexpected.return.type=シリアライズ関連メソッド{0}は、必要な型{2}ではなく、{1}の戻り型で宣言されています。\n宣言されているように、メソッドはシリアライズが無効になります # 0: name, 1: type +# lint: serial compiler.warn.serial.method.unexpected.exception=シリアライズ関連メソッド{0}は予期しない型{1}をスローするように宣言されています +# lint: serial compiler.warn.ineffectual.serial.field.interface=serialPersistentFieldsはインタフェースで有効ではありません # 0: string +# lint: serial compiler.warn.ineffectual.serial.field.enum=シリアライズ関連フィールド{0}は列挙クラスで有効ではありません # 0: string +# lint: serial compiler.warn.ineffectual.serial.method.enum=シリアライズ関連メソッド{0}は列挙クラスで有効ではありません # 0: string +# lint: serial compiler.warn.ineffectual.extern.method.enum=外部化関連メソッド{0}は列挙クラスで有効ではありません +# lint: serial compiler.warn.ineffectual.serial.field.record=serialPersistentFieldsはレコード・クラスで有効ではありません # 0: string +# lint: serial compiler.warn.ineffectual.serial.method.record=シリアライズ関連メソッド{0}はレコード・ラスで有効ではありません # 0: string +# lint: serial compiler.warn.ineffectual.externalizable.method.record=外部化関連メソッド{0}はレコード・クラスで有効ではありません # 0: name +# lint: serial compiler.warn.ineffectual.serial.method.externalizable=シリアライズ関連メソッド{0}は外部化可能なクラスで有効ではありません +# lint: serial compiler.warn.ineffectual.serial.field.externalizable=serialPersistentFieldsは外部化可能なクラスで有効ではありません +# lint: serial compiler.warn.externalizable.missing.public.no.arg.ctor=外部化可能なクラスには引数なしでパブリックのコンストラクタが必要です +# lint: serial compiler.warn.non.serializable.instance.field=直列化可能なクラスの常駐インスタンス・フィールドは直列不可タイプで宣言されています # 0: type +# lint: serial compiler.warn.non.serializable.instance.field.array=直列化可能なクラスの常駐インスタンス・フィールドは、直列不可のベース・コンポーネント・タイプ{0}を持つ配列で宣言されています +# lint: serial compiler.warn.non.private.method.weaker.access=インタフェースでprivateとして宣言されたシリアライズ関連メソッドによって、\nそのインタフェースを実装するクラスがメソッドをprivateとして宣言できなくなります +# lint: serial compiler.warn.default.ineffective=インタフェースのシリアライズ関連のデフォルト・メソッドは、クラスを実装するためのシリアライズで実行されません # 0: symbol, 1: symbol, 2: symbol, 3: symbol +# lint: overloads compiler.warn.potentially.ambiguous.overload={1}内の{0}は{3}内の{2}と矛盾する可能性があります # 0: message segment +# lint: overrides compiler.warn.override.varargs.missing={0}。オーバーライドされたメソッドには''...''がありません # 0: message segment +# lint: overrides compiler.warn.override.varargs.extra={0}。オーバーライドしているメソッドには''...''がありません # 0: message segment @@ -1490,11 +1547,14 @@ compiler.warn.override.bridge={0}。オーバーライドされたメソッド compiler.warn.pkg-info.already.seen=package-info.javaファイルがすでにパッケージ{0}用に表示されています # 0: path +# lint: path compiler.warn.path.element.not.found=不正なパス要素"{0}": そのファイルまたはディレクトリはありません +# lint: fallthrough compiler.warn.possible.fall-through.into.case=caseにfall-throughする可能性があります # 0: type +# lint: cast compiler.warn.redundant.cast={0}への冗長なキャストです # 0: number @@ -1507,15 +1567,19 @@ compiler.warn.big.major.version={0}: メジャー・バージョン{1}は、こ compiler.warn.invalid.utf8.in.classfile={0}: クラス・ファイルに無効なUTF-8が含まれています: {1} # 0: kind name, 1: symbol +# lint: static compiler.warn.static.not.qualified.by.type=static {0}は式ではなく型名{1}で修飾する必要があります # 0: kind name +# lint: static compiler.warn.static.not.qualified.by.type2=static {0}を匿名クラスのメンバーとして使用しないでください # 0: string, 1: fragment +# lint: options compiler.warn.source.no.bootclasspath=ブートストラップ・クラス・パスが-source {0}と一緒に設定されていません\n{1} # 0: string, 1: fragment +# lint: options compiler.warn.source.no.system.modules.path=システム・モジュールの場所が-source {0}と一緒に設定されていません\n{1} # 0: string @@ -1531,9 +1595,11 @@ compiler.misc.source.no.bootclasspath.with.target=ブートストラップ・ク compiler.misc.source.no.system.modules.path.with.target=システム・モジュールの場所を設定しないと、クラス・ファイルがJDK {0}で実行できない場合があります\nシステム・モジュールの場所を自動的に設定するため、-source {0} -target {1}のかわりに--release {0}をお薦めします # 0: string +# lint: options compiler.warn.option.obsolete.source=ソース値{0}は廃止されていて、今後のリリースで削除される予定です # 0: target +# lint: options compiler.warn.option.obsolete.target=ターゲット値{0}は廃止されていて、今後のリリースで削除される予定です # 0: string, 1: string @@ -1542,13 +1608,17 @@ compiler.err.option.removed.source=ソース・オプション{0}は現在サポ # 0: target, 1: target compiler.err.option.removed.target=ターゲット・オプション{0}は現在サポートされていません。{1}以降を使用してください。 +# lint: options compiler.warn.option.obsolete.suppression=廃止されたオプションについての警告を表示しないようにするには、-Xlint:オプションを使用します。 # 0: name, 1: number, 2: number, 3: number, 4: number +# lint: classfile compiler.warn.future.attr=バージョン{1}.{2}のクラス・ファイルで導入された{0}属性は、バージョン{3}.{4}のクラス・ファイルでは無視されます +# lint: requires-automatic compiler.warn.requires.automatic=自動モジュールにはディレクティブが必要です +# lint: requires-transitive-automatic compiler.warn.requires.transitive.automatic=自動モジュールには推移的ディレクティブが必要です # Warnings related to annotation processing @@ -1556,40 +1626,50 @@ compiler.warn.requires.transitive.automatic=自動モジュールには推移的 compiler.warn.proc.package.does.not.exist=パッケージ{0}は存在しません # 0: string +# lint: processing compiler.warn.proc.file.reopening=''{0}''用のファイルを複数回作成しようとしています # 0: string +# lint: processing compiler.warn.proc.type.already.exists=タイプ''{0}''のファイルはすでにソース・パスまたはクラスパスに存在します # 0: string +# lint: processing compiler.warn.proc.type.recreate=タイプ''{0}''のファイルを複数回作成しようとしています # 0: string +# lint: processing compiler.warn.proc.illegal.file.name=無効な名前''{0}''のファイルは作成できません。 # 0: string, 1: string +# lint: processing compiler.warn.proc.suspicious.class.name=名前が{1}で終わる型のファイルを作成しています: ''{0}'' # 0: string compiler.warn.proc.file.create.last.round=最後に作成されたタイプ''{0}''のファイルは注釈処理に渡されません。 # 0: string, 1: string +# lint: processing compiler.warn.proc.malformed.supported.string=プロセッサ''{1}''が返したサポートされる注釈インタフェースの文字列''{0}''が不正です # 0: set of string +# lint: processing compiler.warn.proc.annotations.without.processors=これらの注釈を要求するプロセッサはありませんでした: {0} # 0: source version, 1: string, 2: string compiler.warn.proc.processor.incompatible.source.version=注釈プロセッサ''{1}''から-source ''{2}''より小さいソース・バージョン''{0}''がサポートされています # 0: string, 1: string +# lint: processing compiler.warn.proc.duplicate.option.name=重複するサポート対象オプション''{0}''が注釈プロセッサ''{1}''によって返されました # 0: string, 1: string +# lint: processing compiler.warn.proc.duplicate.supported.annotation=重複するサポート対象注釈インタフェース''{0}''が注釈プロセッサ''{1}''によって返されました # 0: string +# lint: processing compiler.warn.proc.redundant.types.with.wildcard=注釈プロセッサ''{0}''は''*''と他の注釈インタフェースを重複してサポートします compiler.warn.proc.proc-only.requested.no.procs=コンパイルなしの注釈処理がリクエストされましたが、プロセッサが見つかりませんでした。 @@ -1608,42 +1688,56 @@ compiler.warn.proc.unclosed.type.files=タイプ''{0}''のファイルが閉じ # 0: string compiler.warn.proc.unmatched.processor.options=次のオプションはどのプロセッサでも認識されませんでした: ''{0}'' +# lint: try compiler.warn.try.explicit.close.call=自動クローズ可能なリソースにおけるclose()の明示的呼出し # 0: symbol +# lint: try compiler.warn.try.resource.not.referenced=自動クローズ可能なリソース{0}は対応するtry文の本体では参照されません # 0: type +# lint: try compiler.warn.try.resource.throws.interrupted.exc=自動クローズ可能なリソース{0}に、InterruptedExceptionをスローする可能性があるメンバー・メソッドclose()があります +# lint: unchecked compiler.warn.unchecked.assign={0}から{1}への無検査代入です # 0: symbol, 1: type +# lint: unchecked compiler.warn.unchecked.assign.to.var=raw型{1}のメンバーとして変数{0}への無検査代入です # 0: symbol, 1: type +# lint: unchecked compiler.warn.unchecked.call.mbr.of.raw.type=raw型{1}のメンバーとしての{0}への無検査呼出しです +# lint: unchecked compiler.warn.unchecked.cast.to.type=型{0}への無検査キャストです # 0: kind name, 1: name, 2: object, 3: object, 4: kind name, 5: symbol +# lint: unchecked compiler.warn.unchecked.meth.invocation.applied=無検査メソッド呼出し: {4} {5}の{0} {1}は指定された型に適用されます\n期待値: {2}\n検出値: {3} # 0: type +# lint: unchecked compiler.warn.unchecked.generic.array.creation=型{0}の可変引数パラメータに対する総称型配列の無検査作成です # 0: type +# lint: unchecked compiler.warn.unchecked.varargs.non.reifiable.type=パラメータ化された可変引数型{0}からのヒープ汚染の可能性があります # 0: symbol +# lint: varargs compiler.warn.varargs.unsafe.use.varargs.param=可変引数メソッドは、型情報保持可能でない可変引数パラメータ{0}からのヒープ汚染の原因となる可能性があります +# lint: dep-ann compiler.warn.missing.deprecated.annotation=推奨されない項目は@Deprecatedで注釈が付けられていません # 0: kind name +# lint: deprecation compiler.warn.deprecated.annotation.has.no.effect=@Deprecated注釈は、この{0}宣言には影響しません # 0: string +# lint: path compiler.warn.invalid.path=ファイル名が無効です: {0} compiler.warn.doclint.not.available=使用可能なdoclintのサービス・プロバイダはありません @@ -1653,22 +1747,28 @@ compiler.err.invalid.path=ファイル名が無効です: {0} # 0: path +# lint: path compiler.warn.invalid.archive.file=パス上の予期しないファイル: {0} # 0: path +# lint: path compiler.warn.unexpected.archive.file=アーカイブ・ファイルの予期しない拡張子: {0} # 0: path compiler.err.no.zipfs.for.archive=このファイルの処理に使用できるファイル・システム・プロバイダがありません: {0} +# lint: divzero compiler.warn.div.zero=ゼロで除算 +# lint: empty compiler.warn.empty.if=if以降が空の文です # 0: type, 1: name +# lint: classfile compiler.warn.annotation.method.not.found=タイプ''{0}''内に注釈メソッド''{1}()''が見つかりません # 0: type, 1: name, 2: message segment +# lint: classfile compiler.warn.annotation.method.not.found.reason=タイプ''{0}''内に注釈メソッド''{1}()''が見つかりません: {2} # 0: list of annotation, 1: symbol, 2: name, 3: message segment @@ -1681,6 +1781,7 @@ compiler.warn.unknown.enum.constant=不明な列挙型定数です{1}.{2} compiler.warn.unknown.enum.constant.reason=不明な列挙型定数です{1}.{2}\n理由: {3} # 0: type, 1: type +# lint: rawtypes compiler.warn.raw.class.use=raw型が見つかりました: {0}\n汎用クラス{1}の型引数がありません compiler.warn.diamond.redundant.args=新しい式の型引数が重複しています(かわりにダイヤモンド演算子を使用します)。 @@ -1692,12 +1793,15 @@ compiler.warn.potential.lambda.found=この匿名内部クラスをラムダ式 compiler.warn.method.redundant.typeargs=メソッド呼出しの型引数が重複しています。 # 0: symbol, 1: message segment +# lint: varargs compiler.warn.varargs.redundant.trustme.anno={0}注釈が冗長です。{1} # 0: symbol +# lint: serial compiler.warn.access.to.member.from.serializable.element=直列化可能要素からメンバー{0}へのアクセスは、信頼できないコードからパブリックにアクセス可能である可能性があります # 0: symbol +# lint: serial compiler.warn.access.to.member.from.serializable.lambda=直列化可能ラムダからメンバー{0}へのアクセスは、信頼できないコードからパブリックにアクセス可能である可能性があります ##### @@ -1810,9 +1914,11 @@ compiler.misc.bad.enclosing.class={0}の内部クラスが不正です: {1} compiler.misc.bad.enclosing.method=クラス{0}の囲んでいるメソッド属性が不正です # 0: file name +# lint: classfile compiler.warn.runtime.visible.invisible.param.annotations.mismatch={0}内のRuntimeVisibleParameterAnnotations属性およびRuntimeInvisibleParameterAnnotations属性内のパラメータの長さが一致しません。両方の属性を無視します # 0: file name +# lint: classfile compiler.warn.runtime.invisible.parameter.annotations={0}内のRuntimeVisibleParameterAnnotationsおよびRuntimeInvisibleParameterAnnotations属性をメソッドのパラメータにマップできません compiler.misc.bad.const.pool.tag=定数プール・タグ{0}が不正です @@ -1904,6 +2010,7 @@ compiler.err.prob.found.req=不適合な型: {0} compiler.misc.prob.found.req=不適合な型: {0} # 0: message segment, 1: type, 2: type +# lint: unchecked compiler.warn.prob.found.req={0}\n期待値: {2}\n検出値: {1} # 0: type, 1: type @@ -1913,6 +2020,7 @@ compiler.misc.inconvertible.types={0}を{1}に変換できません: compiler.misc.possible.loss.of.precision=精度が失われる可能性がある{0}から{1}への変換 # 0: type, 1: type +# lint: lossy-conversions compiler.warn.possible.loss.of.precision=複合代入における{0}から{1}への暗黙的キャストは、精度が失われる可能性があります compiler.misc.unchecked.assign=無検査変換 @@ -2035,6 +2143,7 @@ compiler.misc.varargs.argument.mismatch=可変引数の不一致: {0} ##### # 0: symbol or type, 1: file name +# lint: auxiliaryclass compiler.warn.auxiliary.class.accessed.from.outside.of.its.source.file={1}の補助クラス{0}にソース・ファイル外からアクセスできません ## The first argument ({0}) is a "kindname". @@ -2174,12 +2283,15 @@ compiler.err.override.weaker.access={0}\n({1})より弱いアクセス権限を compiler.err.override.incompatible.ret={0}\n戻り値の型{1}は{2}と互換性がありません # 0: message segment, 1: type, 2: type +# lint: unchecked compiler.warn.override.unchecked.ret={0}\n戻り値の型は{1}から{2}への無検査変換が必要です # 0: message segment, 1: type +# lint: unchecked compiler.warn.override.unchecked.thrown={0}\nオーバーライドされたメソッドは{1}をスローしません # 0: symbol +# lint: overrides compiler.warn.override.equals.but.not.hashcode=クラス{0}はequalsをオーバーライドしますが、このクラスも、また、いかなるスーパークラスも、hashCodeメソッドをオーバーライドしません ## The following are all possible strings for the first argument ({0}) of the @@ -2245,12 +2357,15 @@ compiler.err.preview.feature.disabled.plural={0}はプレビュー機能であ compiler.err.preview.feature.disabled.classfile={0}のクラス・ファイルはJava SE {1}のプレビュー機能を使用します。\n(プレビュー機能を含むクラス・ファイルをロードできるようにするには、--enable-previewを使用します) # 0: message segment (feature) +# lint: preview compiler.warn.preview.feature.use={0}はプレビュー機能であり、今後のリリースで削除される可能性があります。 # 0: message segment (feature) +# lint: preview compiler.warn.preview.feature.use.plural={0}はプレビュー機能であり、今後のリリースで削除される可能性があります。 # 0: file object (classfile), 1: string (expected version) +# lint: preview compiler.warn.preview.feature.use.classfile={0}のクラス・ファイルはJava SE {1}のプレビュー機能を使用します。 compiler.misc.feature.modules=モジュール @@ -2515,6 +2630,7 @@ compiler.err.expected.module=''モジュール''が必要です compiler.err.module.not.found=モジュールが見つかりません: {0} # 0: symbol +# lint: module compiler.warn.module.not.found=モジュールが見つかりません: {0} # 0: name @@ -2584,6 +2700,7 @@ compiler.err.service.implementation.no.args.constructor.not.public=サービス compiler.err.package.empty.or.not.found=パッケージは空であるか、または存在しません {0} # 0: symbol +# lint: opens compiler.warn.package.empty.or.not.found=パッケージは空であるか、または存在しません {0} compiler.err.no.output.dir=クラス出力ディレクトリが指定されていません @@ -2644,6 +2761,7 @@ compiler.warn.bad.name.for.option={0}オプションの値に含まれる名前 compiler.err.bad.name.for.option={0}オプションの値に含まれる名前が不正です: ''{1}'' # 0: option name, 1: symbol +# lint: options compiler.warn.module.for.option.not.found={0}オプション内にモジュール名が見つかりません: {1} compiler.err.addmods.all.module.path.invalid=--add-modules ALL-MODULE-PATHは、名前のないモジュールのコンパイル時または自動モジュールのコンテキストでのコンパイル時のみ使用できます @@ -2654,6 +2772,7 @@ compiler.err.add.exports.with.release=システム・モジュール{0}からの # 0: symbol compiler.err.add.reads.with.release=システム・モジュール{0}の読取りエッジの追加は--releaseを指定して実行できません +# lint: options compiler.warn.addopens.ignored=--add-opensは、コンパイル時には無効です compiler.misc.locn.module_source_path=モジュール・ソース・パス @@ -2675,12 +2794,16 @@ compiler.err.invalid.module.specifier=モジュール指定子は許可されま compiler.warn.service.provided.but.not.exported.or.used=サービス・インタフェースが指定されましたが、エクスポートまたは使用されていません # 0: kind name, 1: symbol, 2: symbol +# lint: exports compiler.warn.leaks.not.accessible=モジュール{2}の{0} {1}は、このモジュールを必要とするクライアントからアクセスできません # 0: kind name, 1: symbol, 2: symbol +# lint: exports compiler.warn.leaks.not.accessible.unexported=モジュール{2}の{0} {1}はエクスポートされません # 0: kind name, 1: symbol, 2: symbol +# lint: exports compiler.warn.leaks.not.accessible.not.required.transitive=モジュール{2}の{0} {1}は、''requires transitive''を使用して間接的にエクスポートされません # 0: kind name, 1: symbol, 2: symbol +# lint: exports compiler.warn.leaks.not.accessible.unexported.qualified=モジュール{2}の{0} {1}は、このモジュールを必要とするすべてのクライアントに表示されない可能性があります ### @@ -2712,7 +2835,10 @@ compiler.misc.is.a.type.variable=型変数を含めることはできません: compiler.misc.is.duplicated=重複を含めることはできません: {0} # 0: type -compiler.misc.doesnt.extend.sealed=サブクラス{0}はシール・クラスを拡張する必要があります +compiler.misc.doesnt.extend.sealed=クラス{0}はシール・クラスを拡張する必要があります + +# 0: kind name, 1: type +compiler.misc.doesnt.implement.sealed={0} {1}はシール・インタフェースを拡張する必要があります compiler.misc.must.not.be.same.class=permits句の自己参照が不正です @@ -2912,9 +3038,14 @@ compiler.err.deconstruction.pattern.var.not.allowed=デコンストラクショ compiler.err.incorrect.number.of.nested.patterns=ネスト・パターンの数が正しくありません\n期待値: {0}\n検出値: {1} # 0: kind name, 1: symbol +# lint: preview compiler.warn.declared.using.preview={0} {1}はプレビュー機能を使用して宣言されており、今後のリリースで削除される可能性があります。 +# lint: identity compiler.warn.attempt.to.synchronize.on.instance.of.value.based.class=値ベース・クラスのインスタンスで同期しようとしました +# lint: identity +compiler.warn.attempt.to.use.value.based.where.identity.expected=信頼できるアイデンティティを必要とする操作での値ベース・クラスの使用 + # 0: type compiler.err.enclosing.class.type.non.denotable=包含するクラス型: {0}\nは非型指定です。型指定型にキャストしてみてください diff --git a/src/jdk.compiler/share/classes/com/sun/tools/javac/resources/compiler_zh_CN.properties b/src/jdk.compiler/share/classes/com/sun/tools/javac/resources/compiler_zh_CN.properties index 52a6ec23e51..d25110f6532 100644 --- a/src/jdk.compiler/share/classes/com/sun/tools/javac/resources/compiler_zh_CN.properties +++ b/src/jdk.compiler/share/classes/com/sun/tools/javac/resources/compiler_zh_CN.properties @@ -1,5 +1,5 @@ # -# Copyright (c) 1999, 2024, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 1999, 2025, 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 @@ -251,7 +251,7 @@ compiler.misc.no.suitable.functional.intf.inst=无法推断{0}的函数接口描 compiler.misc.bad.intersection.target.for.functional.expr=lambda 或方法引用的交叉类型目标错误\n{0} # 0: symbol or type -compiler.misc.not.an.intf.component=组件类型{0}不是接口 +compiler.misc.not.an.intf.component=组件类型 {0} 不是接口或 java.lang.Object # 0: kind name, 1: message segment compiler.err.invalid.mref={0}引用无效\n{1} @@ -389,9 +389,9 @@ compiler.err.duplicate.class=类重复: {0} # 0: string compiler.err.bad.file.name=文件名错误:{0} -compiler.err.implicit.class.should.not.have.package.declaration=隐式声明的类不应有程序包声明 +compiler.err.implicit.class.should.not.have.package.declaration=压缩源文件不应有程序包声明 -compiler.err.implicit.class.does.not.have.main.method=隐式声明的类没有 void main() 或 void main(String[] args) 形式的 main 方法 +compiler.err.implicit.class.does.not.have.main.method=压缩源文件没有 void main() 或 void main(String[] args) 形式的 main 方法 # 0: name, 1: name compiler.err.same.binary.name=类:{0} 和 {1} 具有相同的二进制名称 @@ -501,6 +501,8 @@ compiler.err.illegal.combination.of.modifiers=非法的修饰符组合: {0}和{1 compiler.err.illegal.enum.static.ref=初始化程序中对静态字段的引用不合法 +compiler.err.illegal.char.literal.multiple.surrogates=字符文字包含多个 UTF-16 代码单元 + compiler.err.illegal.esc.char=非法逃逸 符 compiler.err.illegal.forward.ref=非法前向引用 @@ -511,8 +513,10 @@ compiler.err.not.in.profile={0}在配置文件 ''{1}'' 中不可用 # 0: symbol compiler.warn.forward.ref=先引用变量 ''{0}'', 然后再对其初始化 +# lint: this-escape compiler.warn.possible.this.escape=可能在完全初始化子类之前逃逸了 ''this'' +# lint: this-escape compiler.warn.possible.this.escape.location=此处以前可能通过调用逃逸 了 ''this'' compiler.err.illegal.self.ref=初始化程序中存在自引用 @@ -527,8 +531,10 @@ compiler.err.illegal.line.end.in.char.lit=字符文字的行结尾不合法 compiler.err.illegal.text.block.open=文本块起始分隔符序列非法,缺少行终止符 +# lint: text-blocks compiler.warn.inconsistent.white.space.indentation=空格缩进不一致 +# lint: text-blocks compiler.warn.trailing.white.space.will.be.removed=将删除尾随空格 compiler.err.illegal.nonascii.digit=非法的非 ASCII 数字 @@ -1112,6 +1118,7 @@ compiler.err.cant.read.file=无法读取: {0} compiler.err.plugin.not.found=找不到插件: {0} # 0: path +# lint: path compiler.warn.locn.unknown.file.on.module.path=模块路径中的未知文件: {0} @@ -1131,6 +1138,7 @@ compiler.err.locn.cant.get.module.name.for.jar=无法确定 {0} 的模块名称 compiler.err.multi-module.outdir.cannot.be.exploded.module=在多模块模式下, 输出目录不能是展开的模块: {0} # 0: path +# lint: path compiler.warn.outdir.is.in.exploded.module=输出目录位于展开的模块中: {0} # 0: file object @@ -1182,6 +1190,7 @@ compiler.misc.x.print.rounds=循环 {0}:\n\t输入文件: {1}\n\t批注: {2}\n\t compiler.warn.file.from.future=文件 {0} 的修改日期是未来的日期 # 0: path +# lint: output-file-clash compiler.warn.output.file.clash=多次写入输出文件:{0} ##### @@ -1335,51 +1344,67 @@ compiler.warn.warning=警告:\u0020 compiler.warn.lintOption=[{0}]\u0020 # 0: symbol +# lint: serial compiler.warn.constant.SVUID=serialVersionUID 在类{0}中必须是常量 +# lint: dangling-doc-comments compiler.warn.dangling.doc.comment=文档注释未附加到任何声明 # 0: path +# lint: path compiler.warn.dir.path.element.not.found=错误的路径元素 "{0}": 没有这种目录 # 0: file name +# lint: path compiler.warn.dir.path.element.not.directory=错误的路径元素 "{0}": 不是目录 # 0: symbol, 1: symbol, 2: symbol +# lint: missing-explicit-ctor compiler.warn.missing-explicit-ctor=导出的程序包 {1} 中的类 {0} 未声明显式构造器,因此将向模块 {2} 的客户机公开默认构造器 +# lint: strictfp compiler.warn.strictfp=从发行版 17 开始,所有浮点表达式都经过严格计算,不需要 ''strictfp'' +# lint: finally compiler.warn.finally.cannot.complete=finally 子句无法正常完成 # 0: name +# lint: module compiler.warn.poor.choice.for.module.name=模块名称组成部分 {0} 应避免以数字结尾 # 0: string +# lint: incubating compiler.warn.incubating.modules=使用 incubating 模块: {0} # 0: symbol, 1: symbol +# lint: deprecation compiler.warn.has.been.deprecated={1}中的{0}已过时 # 0: symbol, 1: symbol +# lint: removal compiler.warn.has.been.deprecated.for.removal={1} 中的 {0} 已过时, 且标记为待删除 # 0: symbol +# lint: preview compiler.warn.is.preview={0} 是预览 API,可能会在未来发行版中删除。 # 0: symbol compiler.err.is.preview={0} 是预览 API,默认情况下处于禁用状态。\n(请使用 --enable-preview 以启用预览 API) # 0: symbol +# lint: preview compiler.warn.is.preview.reflective={0} 是反射预览 API,可能会在未来发行版中删除。 # 0: symbol, 1: symbol +# lint: restricted compiler.warn.restricted.method={0}.{1} 是受限制的方法。\n(受限制的方法不安全,如果使用不当,可能会导致 Java 运行时崩溃或内存损坏) # 0: symbol +# lint: deprecation compiler.warn.has.been.deprecated.module=模块 {0} 已过时 # 0: symbol +# lint: removal compiler.warn.has.been.deprecated.for.removal.module=模块 {0} 已过时, 且标记为待删除 # 0: symbol @@ -1388,10 +1413,13 @@ compiler.warn.sun.proprietary={0}是内部专用 API, 可能会在未来发行 compiler.warn.illegal.char.for.encoding=编码{0}的不可映射字符 # 0: symbol +# lint: serial compiler.warn.improper.SVUID=必须在类{0}中将 serialVersionUID 声明为 static final +# lint: serial compiler.warn.improper.SPF=serialPersistentFields 必须声明为 private static final 才能生效 +# lint: serial compiler.warn.SPF.null.init=serialPersistentFields 如果初始化为空值,则无效。\n请初始化为空数组以指示没有字段 @@ -1405,82 +1433,111 @@ compiler.warn.unreachable.catch=catch 子句无法访问\n已捕获到抛出的 compiler.warn.unreachable.catch.1=catch 子句无法访问\n已捕获到抛出的类型{0} # 0: symbol +# lint: serial compiler.warn.long.SVUID=serialVersionUID 在类{0}中必须是 long 类型 +# lint: serial compiler.warn.OSF.array.SPF=serialPersistentFields 的类型必须为 java.io.ObjectStreamField[] 才能生效 # 0: symbol +# lint: serial compiler.warn.missing.SVUID=可序列化类{0}没有 serialVersionUID 的定义 # 0: name +# lint: serial compiler.warn.serializable.missing.access.no.arg.ctor=无法访问第一个不可序列化超类 {0} 中的无参数构造器 # 0: name +# lint: serial compiler.warn.serial.method.not.private=与序列化相关的方法 {0} 未声明为 private # 0: name +# lint: serial compiler.warn.serial.concrete.instance.method=与序列化相关的方法 {0} 必须是具体的实例方法才能生效,既不能是抽象方法也不能是静态方法 # 0: name +# lint: serial compiler.warn.serial.method.static=与序列化相关的方法 {0} 声明为 static;必须改为实例方法才能有效 # 0: name +# lint: serial compiler.warn.serial.method.no.args=与序列化相关的方法 {0} 必须没有参数才能生效 # 0: name, 1: number +# lint: serial compiler.warn.serial.method.one.arg=与序列化相关的方法 {0} 必须只有一个参数(而非 {1} 个参数)才能生效 # 0: name, 1: type, 2: type +# lint: serial compiler.warn.serial.method.parameter.type=与序列化相关的方法 {0} 的唯一参数的类型必须为 {1}(而非 {2})才能生效 # 0: name, 1: type, 2: type +# lint: serial compiler.warn.serial.method.unexpected.return.type=与序列化相关的方法 {0} 是用返回类型 {1}(而不是预期类型 {2})声明的。\n如声明的那样,该方法对序列化无效 # 0: name, 1: type +# lint: serial compiler.warn.serial.method.unexpected.exception=与序列化相关的方法 {0} 声明为抛出意外类型 {1} +# lint: serial compiler.warn.ineffectual.serial.field.interface=serialPersistentFields 在接口中无效 # 0: string +# lint: serial compiler.warn.ineffectual.serial.field.enum=与序列化相关的字段 {0} 在枚举类中无效 # 0: string +# lint: serial compiler.warn.ineffectual.serial.method.enum=与序列化相关的方法 {0} 在枚举类中无效 # 0: string +# lint: serial compiler.warn.ineffectual.extern.method.enum=与外部化相关的方法 {0} 在枚举类中无效 +# lint: serial compiler.warn.ineffectual.serial.field.record=serialPersistentFields 在记录类中无效 # 0: string +# lint: serial compiler.warn.ineffectual.serial.method.record=与序列化相关的方法 {0} 在记录类中无效 # 0: string +# lint: serial compiler.warn.ineffectual.externalizable.method.record=与外部化相关的方法 {0} 在记录类中无效 # 0: name +# lint: serial compiler.warn.ineffectual.serial.method.externalizable=与序列化相关的方法 {0} 在可外部化的类中无效 +# lint: serial compiler.warn.ineffectual.serial.field.externalizable=serialPersistentFields 在可外部化的类中无效 +# lint: serial compiler.warn.externalizable.missing.public.no.arg.ctor=可外部化的类需要一个公共的无参数构造器 +# lint: serial compiler.warn.non.serializable.instance.field=可序列化类的非瞬时实例字段是用不可序列化的类型声明的 # 0: type +# lint: serial compiler.warn.non.serializable.instance.field.array=可序列化类的非瞬时实例字段是用具有不可序列化基本组件类型 {0} 的数组声明的 +# lint: serial compiler.warn.non.private.method.weaker.access=在接口中声明为 non-private 的序列化相关方法将阻止\n实现接口的类将方法声明为 private +# lint: serial compiler.warn.default.ineffective=实现类的序列化不会运行接口中与序列化相关的默认方法 # 0: symbol, 1: symbol, 2: symbol, 3: symbol +# lint: overloads compiler.warn.potentially.ambiguous.overload={1} 中的 {0} 可能与 {3} 中的 {2} 混淆 # 0: message segment +# lint: overrides compiler.warn.override.varargs.missing={0}; 被覆盖的方法没有 ''...'' # 0: message segment +# lint: overrides compiler.warn.override.varargs.extra={0}; 覆盖的方法缺少 ''...'' # 0: message segment @@ -1490,11 +1547,14 @@ compiler.warn.override.bridge={0}; 被覆盖的方法为 bridge 方法 compiler.warn.pkg-info.already.seen=已找到程序包{0}的 package-info.java 文件 # 0: path +# lint: path compiler.warn.path.element.not.found=错误的路径元素 "{0}": 没有这种文件或目录 +# lint: fallthrough compiler.warn.possible.fall-through.into.case=可能无法实现 case # 0: type +# lint: cast compiler.warn.redundant.cast=出现冗余的到{0}的转换 # 0: number @@ -1507,15 +1567,19 @@ compiler.warn.big.major.version={0}: 主版本 {1} 比 {2} 新, 此编译器支 compiler.warn.invalid.utf8.in.classfile={0}:类文件包含无效 UTF-8:{1} # 0: kind name, 1: symbol +# lint: static compiler.warn.static.not.qualified.by.type=static {0}应由类型名称{1}而不是表达式限定 # 0: kind name +# lint: static compiler.warn.static.not.qualified.by.type2=static {0} 不应用作匿名类的成员 # 0: string, 1: fragment +# lint: options compiler.warn.source.no.bootclasspath=未与 -source {0} 一起设置引导类路径\n{1} # 0: string, 1: fragment +# lint: options compiler.warn.source.no.system.modules.path=未与 -source {0} 一起设置系统模块的位置\n{1} # 0: string @@ -1531,9 +1595,11 @@ compiler.misc.source.no.bootclasspath.with.target=不设置引导类路径可能 compiler.misc.source.no.system.modules.path.with.target=不设置系统模块的位置可能会导致类文件无法在 JDK {0} 上运行\n建议使用 --release {0} 而不是 -source {0} -target {1},因为它会自动设置系统模块的位置 # 0: string +# lint: options compiler.warn.option.obsolete.source=源值 {0} 已过时,将在未来发行版中删除 # 0: target +# lint: options compiler.warn.option.obsolete.target=目标值 {0} 已过时,将在未来发行版中删除 # 0: string, 1: string @@ -1542,13 +1608,17 @@ compiler.err.option.removed.source=不再支持源选项 {0}。请使用 {1} 或 # 0: target, 1: target compiler.err.option.removed.target=不再支持目标选项 {0}。请使用 {1} 或更高版本。 +# lint: options compiler.warn.option.obsolete.suppression=要隐藏有关已过时选项的警告, 请使用 -Xlint:-options。 # 0: name, 1: number, 2: number, 3: number, 4: number +# lint: classfile compiler.warn.future.attr={1}.{2} 版类文件中引入的 {0} 属性在 {3}.{4} 版类文件中被忽略 +# lint: requires-automatic compiler.warn.requires.automatic=需要自动模块的指令 +# lint: requires-transitive-automatic compiler.warn.requires.transitive.automatic=需要自动模块的过渡指令 # Warnings related to annotation processing @@ -1556,40 +1626,50 @@ compiler.warn.requires.transitive.automatic=需要自动模块的过渡指令 compiler.warn.proc.package.does.not.exist=程序包{0}不存在 # 0: string +# lint: processing compiler.warn.proc.file.reopening=尝试多次为 ''{0}'' 创建文件 # 0: string +# lint: processing compiler.warn.proc.type.already.exists=类型 ''{0}'' 的文件已经存在于源路径或类路径中 # 0: string +# lint: processing compiler.warn.proc.type.recreate=尝试多次创建类型 ''{0}'' 的文件 # 0: string +# lint: processing compiler.warn.proc.illegal.file.name=无法创建带有非法名称 ''{0}'' 的文件。 # 0: string, 1: string +# lint: processing compiler.warn.proc.suspicious.class.name=正在为名称以{1}结尾的类型创建文件: ''{0}'' # 0: string compiler.warn.proc.file.create.last.round=将不对在最后一个循环中创建的类型为 ''{0}'' 的文件进行批注处理。 # 0: string, 1: string +# lint: processing compiler.warn.proc.malformed.supported.string=处理程序 ''{1}'' 为支持的批注接口返回格式错误的字符串 ''{0}'' # 0: set of string +# lint: processing compiler.warn.proc.annotations.without.processors=没有处理程序要使用以下任何批注: {0} # 0: source version, 1: string, 2: string compiler.warn.proc.processor.incompatible.source.version=来自批注处理程序 ''{1}'' 的受支持 source 版本 ''{0}'' 低于 -source ''{2}'' # 0: string, 1: string +# lint: processing compiler.warn.proc.duplicate.option.name=批注处理程序 ''{1}'' 返回重复的支持的选项 ''{0}'' # 0: string, 1: string +# lint: processing compiler.warn.proc.duplicate.supported.annotation=批注处理程序 ''{1}'' 返回重复的受支持批注接口 ''{0}'' # 0: string +# lint: processing compiler.warn.proc.redundant.types.with.wildcard=批注处理程序 ''{0}'' 重复支持 ''*'' 和其他批注接口 compiler.warn.proc.proc-only.requested.no.procs=在未请求编译的情况下进行批注处理, 但找不到处理程序。 @@ -1608,42 +1688,56 @@ compiler.warn.proc.unclosed.type.files=类型 ''{0}'' 的文件未关闭; 将不 # 0: string compiler.warn.proc.unmatched.processor.options=以下选项未被任何处理程序识别: ''{0}'' +# lint: try compiler.warn.try.explicit.close.call=在可自动结束的资源上显式调用 close() # 0: symbol +# lint: try compiler.warn.try.resource.not.referenced=不能在相应的 try 语句的正文中引用可自动结束的资源{0} # 0: type +# lint: try compiler.warn.try.resource.throws.interrupted.exc=可自动关闭的资源{0}包含的成员方法 close() 可能抛出 InterruptedException +# lint: unchecked compiler.warn.unchecked.assign=未经检查的分配: 将{0}分配给{1} # 0: symbol, 1: type +# lint: unchecked compiler.warn.unchecked.assign.to.var=对作为原始类型{1}的成员的变量{0}的分配未经过检查 # 0: symbol, 1: type +# lint: unchecked compiler.warn.unchecked.call.mbr.of.raw.type=对作为原始类型{1}的成员的{0}的调用未经过检查 +# lint: unchecked compiler.warn.unchecked.cast.to.type=向类型{0}的转换未经过检查 # 0: kind name, 1: name, 2: object, 3: object, 4: kind name, 5: symbol +# lint: unchecked compiler.warn.unchecked.meth.invocation.applied=方法调用未经过检查: 将{4} {5}中的{0} {1}应用到给定的类型\n需要: {2}\n找到: {3} # 0: type +# lint: unchecked compiler.warn.unchecked.generic.array.creation=对于类型为{0}的 varargs 参数, 泛型数组创建未经过检查 # 0: type +# lint: unchecked compiler.warn.unchecked.varargs.non.reifiable.type=参数化 vararg 类型{0}的堆可能已受污染 # 0: symbol +# lint: varargs compiler.warn.varargs.unsafe.use.varargs.param=Varargs 方法可能导致来自不可具体化 varargs 参数 {0} 的堆污染 +# lint: dep-ann compiler.warn.missing.deprecated.annotation=未使用 @Deprecated 对已过时的项目进行批注 # 0: kind name +# lint: deprecation compiler.warn.deprecated.annotation.has.no.effect=@Deprecated 批注对此 {0} 声明没有任何效果 # 0: string +# lint: path compiler.warn.invalid.path=无效文件名: {0} compiler.warn.doclint.not.available=没有 doclint 服务提供方可用 @@ -1653,22 +1747,28 @@ compiler.err.invalid.path=无效文件名: {0} # 0: path +# lint: path compiler.warn.invalid.archive.file=以下路径中存在意外的文件: {0} # 0: path +# lint: path compiler.warn.unexpected.archive.file=以下档案文件存在意外的扩展名: {0} # 0: path compiler.err.no.zipfs.for.archive=没有任何文件系统提供方可处理此文件: {0} +# lint: divzero compiler.warn.div.zero=除数为零 +# lint: empty compiler.warn.empty.if=if 之后没有语句 # 0: type, 1: name +# lint: classfile compiler.warn.annotation.method.not.found=无法找到类型 ''{0}'' 的批注方法 ''{1}()'' # 0: type, 1: name, 2: message segment +# lint: classfile compiler.warn.annotation.method.not.found.reason=无法找到类型 ''{0}'' 的批注方法 ''{1}()'': {2} # 0: list of annotation, 1: symbol, 2: name, 3: message segment @@ -1681,6 +1781,7 @@ compiler.warn.unknown.enum.constant=未知的枚举常量 {1}.{2} compiler.warn.unknown.enum.constant.reason=未知的枚举常量 {1}.{2}\n原因: {3} # 0: type, 1: type +# lint: rawtypes compiler.warn.raw.class.use=找到原始类型: {0}\n缺少泛型类{1}的类型参数 compiler.warn.diamond.redundant.args=新表达式中存在冗余类型参数 (改用 diamond 运算符)。 @@ -1692,12 +1793,15 @@ compiler.warn.potential.lambda.found=可将此匿名内部类创建转换为 lam compiler.warn.method.redundant.typeargs=方法调用中存在冗余类型参数。 # 0: symbol, 1: message segment +# lint: varargs compiler.warn.varargs.redundant.trustme.anno=冗余的 {0} 批注。{1} # 0: symbol +# lint: serial compiler.warn.access.to.member.from.serializable.element=可串行化元素对成员 {0} 的访问可以由不受信任的代码公开执行 # 0: symbol +# lint: serial compiler.warn.access.to.member.from.serializable.lambda=可串行化 lambda 对成员 {0} 的访问可以由不受信任的代码公开执行 ##### @@ -1810,9 +1914,11 @@ compiler.misc.bad.enclosing.class={0}的封闭类错误: {1} compiler.misc.bad.enclosing.method=类 {0} 的封闭方法属性错误 # 0: file name +# lint: classfile compiler.warn.runtime.visible.invisible.param.annotations.mismatch={0} 中 RuntimeVisibleParameterAnnotations 属性和 RuntimeInvisibleParameterAnnotations 属性中的参数长度不匹配,将忽略这两个属性 # 0: file name +# lint: classfile compiler.warn.runtime.invisible.parameter.annotations={0} 中的 RuntimeVisibleParameterAnnotations 属性和 RuntimeInvisibleParameterAnnotations 属性无法映射到方法的参数 compiler.misc.bad.const.pool.tag=错误的常量池标记: {0} @@ -1904,6 +2010,7 @@ compiler.err.prob.found.req=不兼容的类型: {0} compiler.misc.prob.found.req=不兼容的类型: {0} # 0: message segment, 1: type, 2: type +# lint: unchecked compiler.warn.prob.found.req={0}\n需要: {2}\n找到: {1} # 0: type, 1: type @@ -1913,6 +2020,7 @@ compiler.misc.inconvertible.types={0}无法转换为{1} compiler.misc.possible.loss.of.precision=从{0}转换到{1}可能会有损失 # 0: type, 1: type +# lint: lossy-conversions compiler.warn.possible.loss.of.precision=在复合赋值中从 {0} 隐式转换为 {1} 可能会有损失 compiler.misc.unchecked.assign=未经检查的转换 @@ -2035,6 +2143,7 @@ compiler.misc.varargs.argument.mismatch=varargs 不匹配; {0} ##### # 0: symbol or type, 1: file name +# lint: auxiliaryclass compiler.warn.auxiliary.class.accessed.from.outside.of.its.source.file={1} 中的辅助类{0}不应从其自身的源文件以外访问 ## The first argument ({0}) is a "kindname". @@ -2174,12 +2283,15 @@ compiler.err.override.weaker.access={0}\n正在尝试分配更低的访问权限 compiler.err.override.incompatible.ret={0}\n返回类型{1}与{2}不兼容 # 0: message segment, 1: type, 2: type +# lint: unchecked compiler.warn.override.unchecked.ret={0}\n返回类型需要从{1}到{2}的未经检查的转换 # 0: message segment, 1: type +# lint: unchecked compiler.warn.override.unchecked.thrown={0}\n被覆盖的方法未抛出{1} # 0: symbol +# lint: overrides compiler.warn.override.equals.but.not.hashcode=类{0}覆盖了 equals, 但该类或任何超类都未覆盖 hashCode 方法 ## The following are all possible strings for the first argument ({0}) of the @@ -2245,12 +2357,15 @@ compiler.err.preview.feature.disabled.plural={0} 是预览功能,默认情况 compiler.err.preview.feature.disabled.classfile={0} 的类文件使用 Java SE {1} 的预览功能。\n(请使用 --enable-preview 以允许加载包含预览功能的类文件) # 0: message segment (feature) +# lint: preview compiler.warn.preview.feature.use={0} 是预览功能,可能会在未来发行版中删除。 # 0: message segment (feature) +# lint: preview compiler.warn.preview.feature.use.plural={0} 是预览功能,可能会在未来发行版中删除。 # 0: file object (classfile), 1: string (expected version) +# lint: preview compiler.warn.preview.feature.use.classfile={0} 的类文件使用 Java SE {1} 的预览功能。 compiler.misc.feature.modules=模块 @@ -2515,6 +2630,7 @@ compiler.err.expected.module=预期 ''module'' compiler.err.module.not.found=找不到模块: {0} # 0: symbol +# lint: module compiler.warn.module.not.found=找不到模块: {0} # 0: name @@ -2584,6 +2700,7 @@ compiler.err.service.implementation.no.args.constructor.not.public=服务实现 compiler.err.package.empty.or.not.found=程序包为空或不存在: {0} # 0: symbol +# lint: opens compiler.warn.package.empty.or.not.found=程序包为空或不存在: {0} compiler.err.no.output.dir=未指定类输出目录 @@ -2644,6 +2761,7 @@ compiler.warn.bad.name.for.option={0} 选项的值中有错误的名称: ''{1}'' compiler.err.bad.name.for.option={0} 选项的值中有错误的名称: ''{1}'' # 0: option name, 1: symbol +# lint: options compiler.warn.module.for.option.not.found=找不到 {0} 选项中的模块名称: {1} compiler.err.addmods.all.module.path.invalid=--add-modules ALL-MODULE-PATH 只能在编译未命名模块或在自动模块的上下文中编译时使用 @@ -2654,6 +2772,7 @@ compiler.err.add.exports.with.release=不允许在使用 --release 时从系统 # 0: symbol compiler.err.add.reads.with.release=不允许在使用 --release 时为系统模块 {0} 添加读取维边: +# lint: options compiler.warn.addopens.ignored=--add-opens 在编译时没有任何效果 compiler.misc.locn.module_source_path=模块源路径 @@ -2675,12 +2794,16 @@ compiler.err.invalid.module.specifier=不允许模块说明符: {0} compiler.warn.service.provided.but.not.exported.or.used=已提供服务接口, 但未导出或使用服务接口 # 0: kind name, 1: symbol, 2: symbol +# lint: exports compiler.warn.leaks.not.accessible=模块 {2} 中的 {0} {1} 对需要该模块的客户机不可访问 # 0: kind name, 1: symbol, 2: symbol +# lint: exports compiler.warn.leaks.not.accessible.unexported=未导出模块 {2} 中的 {0} {1} # 0: kind name, 1: symbol, 2: symbol +# lint: exports compiler.warn.leaks.not.accessible.not.required.transitive=未使用 ''requires transitive'' 间接导出模块 {2} 中的 {0} {1} # 0: kind name, 1: symbol, 2: symbol +# lint: exports compiler.warn.leaks.not.accessible.unexported.qualified=模块 {2} 中的 {0} {1} 可能对需要该模块的所有客户机都不可见 ### @@ -2712,7 +2835,10 @@ compiler.misc.is.a.type.variable=不得包含类型变量:{0} compiler.misc.is.duplicated=不得包含重复项:{0} # 0: type -compiler.misc.doesnt.extend.sealed=子类 {0} 必须扩展密封类 +compiler.misc.doesnt.extend.sealed=类 {0} 必须扩展密封类 + +# 0: kind name, 1: type +compiler.misc.doesnt.implement.sealed={0} {1} 必须扩展密封接口 compiler.misc.must.not.be.same.class=permits 子句中存在非法自引用 @@ -2912,9 +3038,14 @@ compiler.err.deconstruction.pattern.var.not.allowed=解构模式只能应用于 compiler.err.incorrect.number.of.nested.patterns=嵌套模式数不正确\n需要:{0}\n已找到:{1} # 0: kind name, 1: symbol +# lint: preview compiler.warn.declared.using.preview={0} {1} 是使用预览功能声明的,可能会在未来发行版中删除。 +# lint: identity compiler.warn.attempt.to.synchronize.on.instance.of.value.based.class=尝试在基于值的类的实例上同步 +# lint: identity +compiler.warn.attempt.to.use.value.based.where.identity.expected=使用基于值的类,其操作需要可靠的身份 + # 0: type compiler.err.enclosing.class.type.non.denotable=封闭类类型:{0}\n是不可指示的类型,尝试转换为可指示的类型 diff --git a/src/jdk.compiler/share/classes/com/sun/tools/javac/resources/javac_de.properties b/src/jdk.compiler/share/classes/com/sun/tools/javac/resources/javac_de.properties index 447695c9cf8..18a43abe14a 100644 --- a/src/jdk.compiler/share/classes/com/sun/tools/javac/resources/javac_de.properties +++ b/src/jdk.compiler/share/classes/com/sun/tools/javac/resources/javac_de.properties @@ -1,5 +1,5 @@ # -# Copyright (c) 1999, 2024, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 1999, 2025, 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 @@ -32,7 +32,7 @@ javac.description=Java-Klasse und Schnittstellendefinitionen lesen und in Byteco javac.opt.g=Generiert alle Debugginginformationen javac.opt.g.none=Generiert keine Debugginginformationen javac.opt.g.lines.vars.source=Generiert nur einige Debugginginformationen -javac.opt.nowarn=Generiert keine Warnungen +javac.opt.nowarn=Nur obligatorische Warnungen generieren javac.opt.verbose=Gibt Nachrichten zu den Compilervorgängen aus javac.opt.deprecation=Gibt Quellspeicherorte aus, wo veraltete APIs verwendet werden javac.opt.classpath=Gibt an, wo sich die Benutzerklassendateien und Annotationsprozessoren befinden @@ -97,12 +97,12 @@ javac.opt.arg.pathname= javac.opt.arg.file= javac.opt.Xbootclasspath.p=Dem Bootstrap Classpath voranstellen javac.opt.Xbootclasspath.a=An Bootstrap Classpath anhängen -javac.opt.Xlint=Aktiviert die empfohlenen Warnungen -javac.opt.Xlint.all=Alle Warnungen aktivieren -javac.opt.Xlint.none=Alle Warnungen deaktivieren +javac.opt.Xlint=Empfohlene Warnungskategorien aktivieren +javac.opt.Xlint.all=Alle Warnungskategorien aktivieren +javac.opt.Xlint.none=Alle Warnungskategorien deaktivieren #L10N: do not localize: -Xlint javac.opt.arg.Xlint=(,)* -javac.opt.Xlint.custom=Warnungen, die aktiviert oder deaktiviert werden sollen, durch Komma getrennt.\nStellen Sie einem Schlüssel "-" voran, um die angegebene Warnung zu deaktivieren.\nVerwenden Sie "--help-lint", um die unterstützten Schlüssel anzuzeigen. +javac.opt.Xlint.custom=Durch Komma getrennte Warnungskategorien, die aktiviert oder deaktiviert werden sollen.\nStellen Sie einem Schlüssel "-" voran, um die angegebene Warnung zu deaktivieren.\nVerwenden Sie "--help-lint", um die unterstützten Schlüssel anzuzeigen. javac.opt.Xlint.desc.auxiliaryclass=Warnt vor Auxiliary-Klassen, die in einer Quelldatei verborgen sind und aus anderen Dateien heraus verwendet werden. javac.opt.Xlint.desc.cast=Warnt vor unnötigen Umwandlungen mit Cast. @@ -159,7 +159,7 @@ javac.opt.Xlint.desc.serial=Warnt vor serialisierbaren Klassen, die kein serialV javac.opt.Xlint.desc.static=Warnt vor Zugriff auf ein statisches Mitglied mit einer Instanz. -javac.opt.Xlint.desc.strictfp=Warnt vor unnötiger Verwendung des strictfp-Modifizierers. +javac.opt.Xlint.desc.strictfp=Warnt vor unnötiger Verwendung des strictfp-Modifikators. javac.opt.Xlint.desc.text-blocks=Warnt vor inkonsistenten Leerzeichen in Textblockeinzug. @@ -175,7 +175,13 @@ javac.opt.Xlint.desc.preview=Warnt vor Verwendung von Vorschausprachfeatures. javac.opt.Xlint.desc.restricted=Warnt vor der Verwendung eingeschränkter Methoden. -javac.opt.Xlint.desc.synchronization=Warnt vor Synchronisierungsversuchen mit Instanzen wertbasierter Klassen. +javac.opt.Xlint.desc.synchronization=\ + Warnt vor Synchronisierungsversuchen mit Instanzen wertbasierter Klassen.\n\ +\ Dieser Schlüssel ist ein veralteter Alias für die Kategorie ''identity'', die dieselben Verwendungen und\n\ +\ Effekte hat. Benutzern wird empfohlen, die Kategorie ''identity'' für alle zukünftigen\n\ +\ und vorhandenen Verwendungen von ''synchronization'' zu verwenden. + +javac.opt.Xlint.desc.identity=Warnt vor Verwendungen wertbasierter Klassen, wenn eine Identitätsklasse erwartet wird. javac.opt.Xdoclint=Empfohlene Prüfungen für Probleme in javadoc-Kommentaren aktivieren # L10N: do not localize: all none diff --git a/src/jdk.compiler/share/classes/com/sun/tools/javac/resources/javac_ja.properties b/src/jdk.compiler/share/classes/com/sun/tools/javac/resources/javac_ja.properties index c215ad5eeba..66e2e3dce39 100644 --- a/src/jdk.compiler/share/classes/com/sun/tools/javac/resources/javac_ja.properties +++ b/src/jdk.compiler/share/classes/com/sun/tools/javac/resources/javac_ja.properties @@ -1,5 +1,5 @@ # -# Copyright (c) 1999, 2024, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 1999, 2025, 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 @@ -32,7 +32,7 @@ javac.description=Javaクラスおよびインタフェースの定義を読み javac.opt.g=すべてのデバッグ情報を生成する javac.opt.g.none=デバッグ情報を生成しない javac.opt.g.lines.vars.source=いくつかのデバッグ情報のみを生成する -javac.opt.nowarn=警告を発生させない +javac.opt.nowarn=必須の警告のみを生成します javac.opt.verbose=コンパイラの動作についてメッセージを出力する javac.opt.deprecation=推奨されないAPIが使用されているソースの位置を出力する javac.opt.classpath=ユーザー・クラス・ファイルおよび注釈プロセッサを検索する位置を指定する @@ -97,12 +97,12 @@ javac.opt.arg.pathname= javac.opt.arg.file= javac.opt.Xbootclasspath.p=ブートストラップ・クラス・パスの先頭に付加する javac.opt.Xbootclasspath.a=ブートストラップ・クラス・パスに追加する -javac.opt.Xlint=推奨の警告を有効にする -javac.opt.Xlint.all=すべての警告を有効にします -javac.opt.Xlint.none=すべての警告を無効にします +javac.opt.Xlint=推奨の警告カテゴリを有効にします +javac.opt.Xlint.all=すべての警告カテゴリを有効にします +javac.opt.Xlint.none=すべての警告カテゴリを無効にします #L10N: do not localize: -Xlint javac.opt.arg.Xlint=(,)* -javac.opt.Xlint.custom=有効または無効にする警告(カンマ区切り)。\n指定した警告を無効にするには、キーの前に''-''を指定します。\nサポートされているキーを表示するには--help-lintを使用します。 +javac.opt.Xlint.custom=有効または無効にする警告カテゴリ(カンマ区切り)。\n指定した警告を無効にするには、キーの前に''-''を指定します。\nサポートされているキーを表示するには--help-lintを使用します。 javac.opt.Xlint.desc.auxiliaryclass=ソース・ファイルで非表示になっているが他のファイルから使用されている補助クラスについて警告します。 javac.opt.Xlint.desc.cast=不要なキャストの使用について警告します。 @@ -175,7 +175,9 @@ javac.opt.Xlint.desc.preview=プレビュー言語機能の使用について警 javac.opt.Xlint.desc.restricted=制限されたメソッドの使用について警告します。 -javac.opt.Xlint.desc.synchronization=値ベース・クラスのインスタンスでの同期の試行について警告します。 +javac.opt.Xlint.desc.synchronization=値ベース・クラスのインスタンスでの同期の試行について警告します。\n このキーは、''identity''の非推奨のエイリアスであり、同じ使用方法と効果を\n 持ちます。ユーザーには、今後および既存の''synchronization''の使用に対して''identity''カテゴリを\n 使用することをお薦めします。 + +javac.opt.Xlint.desc.identity=アイデンティティ・クラスが必要な場所での値ベース・クラスの使用について警告します。 javac.opt.Xdoclint=javadocコメントの問題に関する推奨チェックを有効にします # L10N: do not localize: all none diff --git a/src/jdk.compiler/share/classes/com/sun/tools/javac/resources/javac_zh_CN.properties b/src/jdk.compiler/share/classes/com/sun/tools/javac/resources/javac_zh_CN.properties index 1593280fd4d..efc6e73494e 100644 --- a/src/jdk.compiler/share/classes/com/sun/tools/javac/resources/javac_zh_CN.properties +++ b/src/jdk.compiler/share/classes/com/sun/tools/javac/resources/javac_zh_CN.properties @@ -1,5 +1,5 @@ # -# Copyright (c) 1999, 2024, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 1999, 2025, 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 @@ -32,7 +32,7 @@ javac.description=读取 Java 类和接口定义,并将其编译为字节码 javac.opt.g=生成所有调试信息 javac.opt.g.none=不生成任何调试信息 javac.opt.g.lines.vars.source=只生成某些调试信息 -javac.opt.nowarn=不生成任何警告 +javac.opt.nowarn=仅生成必需警告 javac.opt.verbose=输出有关编译器正在执行的操作的消息 javac.opt.deprecation=输出使用已过时的 API 的源位置 javac.opt.classpath=指定查找用户类文件和批注处理程序的位置 @@ -97,12 +97,12 @@ javac.opt.arg.pathname= javac.opt.arg.file= javac.opt.Xbootclasspath.p=置于引导类路径之前 javac.opt.Xbootclasspath.a=置于引导类路径之后 -javac.opt.Xlint=启用建议的警告 -javac.opt.Xlint.all=启用所有警告 -javac.opt.Xlint.none=禁用所有警告 +javac.opt.Xlint=启用建议的警告类别 +javac.opt.Xlint.all=启用所有警告类别 +javac.opt.Xlint.none=禁用所有警告类别 #L10N: do not localize: -Xlint javac.opt.arg.Xlint=(,)* -javac.opt.Xlint.custom=要启用或禁用的警告(以逗号分隔)。\n在关键字前面加上 ''-'' 可禁用指定的警告。\n使用 --help-lint 可查看受支持的关键字。 +javac.opt.Xlint.custom=要启用或禁用的警告类别(以逗号分隔)。\n在关键字前面加上 ''-'' 可禁用指定的警告。\n使用 --help-lint 可查看受支持的关键字。 javac.opt.Xlint.desc.auxiliaryclass=有关辅助类在源文件中隐藏, 但在其他文件中使用的警告。 javac.opt.Xlint.desc.cast=有关使用了不必要转换的警告。 @@ -175,7 +175,9 @@ javac.opt.Xlint.desc.preview=有关使用预览语言功能的警告。 javac.opt.Xlint.desc.restricted=有关使用受限制方法的警告。 -javac.opt.Xlint.desc.synchronization=有关尝试在基于值的类的实例上同步的警告。 +javac.opt.Xlint.desc.synchronization=有关尝试在基于值的类的实例上同步的警告。\n 此密钥是 ''identity'' 的已过时别名,具有相同的用法和\n 效果。建议用户在 ''synchronization'' 的所有未来和现有\n 用法中使用 ''identity'' 类别。 + +javac.opt.Xlint.desc.identity=有关在需要身份类的情况下使用基于值的类的警告。 javac.opt.Xdoclint=为 javadoc 注释中的问题启用建议的检查 # L10N: do not localize: all none diff --git a/src/jdk.compiler/share/classes/com/sun/tools/javac/resources/launcher_de.properties b/src/jdk.compiler/share/classes/com/sun/tools/javac/resources/launcher_de.properties index 0c67a60aa0a..7f12decb225 100644 --- a/src/jdk.compiler/share/classes/com/sun/tools/javac/resources/launcher_de.properties +++ b/src/jdk.compiler/share/classes/com/sun/tools/javac/resources/launcher_de.properties @@ -1,5 +1,5 @@ # -# Copyright (c) 2018, 2024, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2018, 2025, 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 @@ -100,7 +100,10 @@ launcher.err.main.not.void=Methode "main" ist nicht mit Rückgabetyp "void" dekl launcher.err.cant.find.class=Klasse nicht gefunden: {0} # 0: string -launcher.err.cant.find.main.method=Methode "main(String[])" nicht gefunden in Klasse: {0} +launcher.err.cant.find.main.method=Konnte keine main(String[])- oder main()-Methode in der Klasse: {0} finden. + +# 0: string +launcher.err.cant.instantiate=Abstrakte Klasse: {0} kann nicht instanziiert werden # 0: string launcher.err.cant.access.main.method=kein Zugriff auf Methode "main" in Klasse: {0} diff --git a/src/jdk.compiler/share/classes/com/sun/tools/javac/resources/launcher_ja.properties b/src/jdk.compiler/share/classes/com/sun/tools/javac/resources/launcher_ja.properties index ef4d0f1f9e0..be1feb4a8a9 100644 --- a/src/jdk.compiler/share/classes/com/sun/tools/javac/resources/launcher_ja.properties +++ b/src/jdk.compiler/share/classes/com/sun/tools/javac/resources/launcher_ja.properties @@ -1,5 +1,5 @@ # -# Copyright (c) 2018, 2024, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2018, 2025, 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 @@ -100,7 +100,10 @@ launcher.err.main.not.void=''main'メソッドが戻り型''void''で宣言さ launcher.err.cant.find.class=クラスが見つかりません: {0} # 0: string -launcher.err.cant.find.main.method=クラスにmain(String[])メソッドが見つかりません: {0} +launcher.err.cant.find.main.method=クラスにmain(String[])またはmain()メソッドが見つかりません: {0} + +# 0: string +launcher.err.cant.instantiate=抽象クラス: {0}はインスタンス化できません # 0: string launcher.err.cant.access.main.method=クラスのメイン・メソッドにアクセスできません: {0} diff --git a/src/jdk.compiler/share/classes/com/sun/tools/javac/resources/launcher_zh_CN.properties b/src/jdk.compiler/share/classes/com/sun/tools/javac/resources/launcher_zh_CN.properties index a442cfe1e68..5367036d82f 100644 --- a/src/jdk.compiler/share/classes/com/sun/tools/javac/resources/launcher_zh_CN.properties +++ b/src/jdk.compiler/share/classes/com/sun/tools/javac/resources/launcher_zh_CN.properties @@ -1,5 +1,5 @@ # -# Copyright (c) 2018, 2024, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2018, 2025, 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 @@ -100,7 +100,10 @@ launcher.err.main.not.void=未使用返回类型 ''void'' 声明 ''main'' 方法 launcher.err.cant.find.class=找不到类:{0} # 0: string -launcher.err.cant.find.main.method=在类 {0} 中找不到 main(String[]) 方法 +launcher.err.cant.find.main.method=在类 {0} 中找不到 main(String[]) 或 main() 方法 + +# 0: string +launcher.err.cant.instantiate=无法实例化抽象类 {0} # 0: string launcher.err.cant.access.main.method=无法访问类 {0} 中的 main 方法 diff --git a/src/jdk.compiler/share/classes/com/sun/tools/javac/util/Options.java b/src/jdk.compiler/share/classes/com/sun/tools/javac/util/Options.java index 63f5b0ca75a..32a31028b68 100644 --- a/src/jdk.compiler/share/classes/com/sun/tools/javac/util/Options.java +++ b/src/jdk.compiler/share/classes/com/sun/tools/javac/util/Options.java @@ -172,55 +172,67 @@ public boolean isUnset(Option option, String value) { } /** - * Check whether the given lint category is explicitly enabled or disabled. + * Determine if a specific {@link LintCategory} is enabled via a custom + * option flag of the form {@code -Xlint}, {@code -Xlint:all}, or {@code -Xlint:key}. * *

    - * If the category is neither enabled nor disabled, return the given default value. + * Note: It's possible the category was also disabled; this method does not check that. * - * @param option the plain (non-custom) option * @param lc the {@link LintCategory} in question - * @param defaultValue presumed default value - * @return true if {@code lc} would be included + * @return true if {@code lc} has been enabled */ - public boolean isSet(Option option, LintCategory lc, boolean defaultValue) { - Option customOption = option.getCustom(); - if (lc.optionList.stream().anyMatch(alias -> isSet(customOption, alias))) { - return true; - } - if (lc.optionList.stream().anyMatch(alias -> isSet(customOption, "-" + alias))) { - return false; - } - if (isSet(option) || isSet(customOption, Option.LINT_CUSTOM_ALL)) { - return true; - } - if (isSet(customOption, Option.LINT_CUSTOM_NONE)) { - return false; - } - return defaultValue; + public boolean isLintEnabled(LintCategory lc) { + return isLintExplicitlyEnabled(lc) || + isSet(Option.XLINT_CUSTOM) || + isSet(Option.XLINT_CUSTOM, Option.LINT_CUSTOM_ALL); } /** - * Determine if a specific {@link LintCategory} was explicitly enabled via a custom option flag - * of the form {@code -Flag:all} or {@code -Flag:key}. + * Determine if a specific {@link LintCategory} is disabled via a custom + * option flag of the form {@code -Xlint:none} or {@code -Xlint:-key}. + * + *

    + * Note: It's possible the category was also enabled; this method does not check that. + * + * @param lc the {@link LintCategory} in question + * @return true if {@code lc} has been disabled + */ + public boolean isLintDisabled(LintCategory lc) { + return isLintExplicitlyDisabled(lc) || isSet(Option.XLINT_CUSTOM, Option.LINT_CUSTOM_NONE); + } + + /** + * Determine if a specific {@link LintCategory} is explicitly enabled via a custom + * option flag of the form {@code -Xlint:key}. + * + *

    + * Note: This does not check for option flags of the form {@code -Xlint} or {@code -Xlint:all}. + * + *

    + * Note: It's possible the category was also disabled; this method does not check that. * - * @param option the option * @param lc the {@link LintCategory} in question * @return true if {@code lc} has been explicitly enabled */ - public boolean isExplicitlyEnabled(Option option, LintCategory lc) { - return isSet(option, lc, false); + public boolean isLintExplicitlyEnabled(LintCategory lc) { + return lc.optionList.stream().anyMatch(alias -> isSet(Option.XLINT_CUSTOM, alias)); } /** - * Determine if a specific {@link LintCategory} was explicitly disabled via a custom option flag - * of the form {@code -Flag:none} or {@code -Flag:-key}. + * Determine if a specific {@link LintCategory} is explicitly disabled via a custom + * option flag of the form {@code -Xlint:-key}. + * + *

    + * Note: This does not check for an option flag of the form {@code -Xlint:none}. + * + *

    + * Note: It's possible the category was also enabled; this method does not check that. * - * @param option the option * @param lc the {@link LintCategory} in question * @return true if {@code lc} has been explicitly disabled */ - public boolean isExplicitlyDisabled(Option option, LintCategory lc) { - return !isSet(option, lc, true); + public boolean isLintExplicitlyDisabled(LintCategory lc) { + return lc.optionList.stream().anyMatch(alias -> isSet(Option.XLINT_CUSTOM, "-" + alias)); } public void put(String name, String value) { diff --git a/src/jdk.compiler/share/classes/sun/tools/serialver/resources/serialver_de.properties b/src/jdk.compiler/share/classes/sun/tools/serialver/resources/serialver_de.properties index 11c8b51dc53..f9eea0b9030 100644 --- a/src/jdk.compiler/share/classes/sun/tools/serialver/resources/serialver_de.properties +++ b/src/jdk.compiler/share/classes/sun/tools/serialver/resources/serialver_de.properties @@ -1,5 +1,5 @@ # -# Copyright (c) 2010, 2019, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2010, 2024, 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 diff --git a/src/jdk.compiler/share/classes/sun/tools/serialver/resources/serialver_ja.properties b/src/jdk.compiler/share/classes/sun/tools/serialver/resources/serialver_ja.properties index a92c8324681..765d60199cb 100644 --- a/src/jdk.compiler/share/classes/sun/tools/serialver/resources/serialver_ja.properties +++ b/src/jdk.compiler/share/classes/sun/tools/serialver/resources/serialver_ja.properties @@ -1,5 +1,5 @@ # -# Copyright (c) 2010, 2019, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2010, 2024, 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 diff --git a/src/jdk.compiler/share/classes/sun/tools/serialver/resources/serialver_zh_CN.properties b/src/jdk.compiler/share/classes/sun/tools/serialver/resources/serialver_zh_CN.properties index 994efca2408..246381ed212 100644 --- a/src/jdk.compiler/share/classes/sun/tools/serialver/resources/serialver_zh_CN.properties +++ b/src/jdk.compiler/share/classes/sun/tools/serialver/resources/serialver_zh_CN.properties @@ -1,5 +1,5 @@ # -# Copyright (c) 2010, 2019, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2010, 2024, 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 diff --git a/src/jdk.compiler/share/data/symbols/java.base-P.sym.txt b/src/jdk.compiler/share/data/symbols/java.base-P.sym.txt index 95544fc3cac..36f9e40e526 100644 --- a/src/jdk.compiler/share/data/symbols/java.base-P.sym.txt +++ b/src/jdk.compiler/share/data/symbols/java.base-P.sym.txt @@ -51,6 +51,10 @@ class name java/io/ProxyingConsole -method name readln descriptor (Ljava/lang/String;)Ljava/lang/String; -method name readln descriptor ()Ljava/lang/String; +class name java/io/Reader +method name readAllLines descriptor ()Ljava/util/List; thrownTypes java/io/IOException flags 1 signature ()Ljava/util/List; +method name readAllAsString descriptor ()Ljava/lang/String; thrownTypes java/io/IOException flags 1 + class name java/io/SerializablePermission header extends java/security/BasicPermission flags 31 deprecated true runtimeAnnotations @Ljava/lang/Deprecated;(forRemoval=Ztrue,since="25") @@ -118,6 +122,7 @@ method name descriptor (J)V flags 1 deprecated true runtimeAnnotations @L method name descriptor (Ljava/lang/String;)V thrownTypes java/lang/NumberFormatException flags 1 deprecated true runtimeAnnotations @Ljava/lang/Deprecated;(since="9") class name java/lang/Math +-method name cbrt descriptor (D)D -method name max descriptor (JJ)J -method name min descriptor (JJ)J method name max descriptor (JJ)J flags 9 runtimeAnnotations @Ljdk/internal/vm/annotation/IntrinsicCandidate; @@ -129,6 +134,7 @@ method name powExact descriptor (II)I flags 9 method name unsignedPowExact descriptor (II)I flags 9 method name powExact descriptor (JI)J flags 9 method name unsignedPowExact descriptor (JI)J flags 9 +method name cbrt descriptor (D)D flags 9 runtimeAnnotations @Ljdk/internal/vm/annotation/IntrinsicCandidate; class name java/lang/Package header extends java/lang/NamedPackage implements java/lang/reflect/AnnotatedElement flags 31 @@ -145,6 +151,20 @@ innerclass innerClass java/lang/Runtime$Version outerClass java/lang/Runtime inn class name java/lang/RuntimePermission header extends java/security/BasicPermission flags 31 deprecated true runtimeAnnotations @Ljava/lang/Deprecated;(forRemoval=Ztrue,since="25") +class name java/lang/ScopedValue +header extends java/lang/Object nestMembers java/lang/ScopedValue$CallableOp,java/lang/ScopedValue$Carrier flags 31 signature Ljava/lang/Object; +innerclass innerClass java/lang/ScopedValue$Carrier outerClass java/lang/ScopedValue innerClassName Carrier flags 19 +innerclass innerClass java/lang/ScopedValue$CallableOp outerClass java/lang/ScopedValue innerClassName CallableOp flags 609 + +class name java/lang/ScopedValue$CallableOp +header extends java/lang/Object nestHost java/lang/ScopedValue flags 601 signature Ljava/lang/Object; runtimeAnnotations @Ljava/lang/FunctionalInterface; +innerclass innerClass java/lang/ScopedValue$CallableOp outerClass java/lang/ScopedValue innerClassName CallableOp flags 609 + +class name java/lang/ScopedValue$Carrier +header extends java/lang/Object nestHost java/lang/ScopedValue flags 31 +innerclass innerClass java/lang/ScopedValue$Carrier outerClass java/lang/ScopedValue innerClassName Carrier flags 19 +innerclass innerClass java/lang/ScopedValue$CallableOp outerClass java/lang/ScopedValue innerClassName CallableOp flags 609 + class name java/lang/Short -method name descriptor (S)V -method name descriptor (Ljava/lang/String;)V @@ -426,6 +446,12 @@ header extends java/lang/Object flags 31 class name java/nio/file/LinkPermission header extends java/security/BasicPermission flags 31 deprecated true runtimeAnnotations @Ljava/lang/Deprecated;(forRemoval=Ztrue,since="25") +class name java/security/AsymmetricKey +header extends java/lang/Object implements java/security/Key,java/security/DEREncodable flags 601 + +class name java/security/DEREncodable +header extends java/lang/Object sealed true permittedSubclasses java/security/AsymmetricKey,java/security/KeyPair,java/security/spec/PKCS8EncodedKeySpec,java/security/spec/X509EncodedKeySpec,javax/crypto/EncryptedPrivateKeyInfo,java/security/cert/X509Certificate,java/security/cert/X509CRL,java/security/PEMRecord flags 601 classAnnotations @Ljdk/internal/javac/PreviewFeature;(feature=eLjdk/internal/javac/PreviewFeature$Feature;PEM_API;) + class name java/security/DrbgParameters header extends java/lang/Object nestMembers java/security/DrbgParameters$Reseed,java/security/DrbgParameters$NextBytes,java/security/DrbgParameters$Instantiation,java/security/DrbgParameters$Capability flags 31 innerclass innerClass java/security/DrbgParameters$Instantiation outerClass java/security/DrbgParameters innerClassName Instantiation flags 19 @@ -433,12 +459,63 @@ innerclass innerClass java/security/DrbgParameters$Capability outerClass java/se innerclass innerClass java/security/DrbgParameters$NextBytes outerClass java/security/DrbgParameters innerClassName NextBytes flags 19 innerclass innerClass java/security/DrbgParameters$Reseed outerClass java/security/DrbgParameters innerClassName Reseed flags 19 +class name java/security/KeyPair +header extends java/lang/Object implements java/io/Serializable,java/security/DEREncodable flags 31 + +class name java/security/PEMDecoder +header extends java/lang/Object flags 31 classAnnotations @Ljdk/internal/javac/PreviewFeature;(feature=eLjdk/internal/javac/PreviewFeature$Feature;PEM_API;) +innerclass innerClass java/util/Base64$Decoder outerClass java/util/Base64 innerClassName Decoder flags 9 +method name of descriptor ()Ljava/security/PEMDecoder; flags 9 +method name decode descriptor (Ljava/lang/String;)Ljava/security/DEREncodable; flags 1 +method name decode descriptor (Ljava/io/InputStream;)Ljava/security/DEREncodable; thrownTypes java/io/IOException flags 1 +method name decode descriptor (Ljava/lang/String;Ljava/lang/Class;)Ljava/security/DEREncodable; flags 1 signature (Ljava/lang/String;Ljava/lang/Class;)TS; +method name decode descriptor (Ljava/io/InputStream;Ljava/lang/Class;)Ljava/security/DEREncodable; thrownTypes java/io/IOException flags 1 signature (Ljava/io/InputStream;Ljava/lang/Class;)TS; +method name withFactory descriptor (Ljava/security/Provider;)Ljava/security/PEMDecoder; flags 1 +method name withDecryption descriptor ([C)Ljava/security/PEMDecoder; flags 1 + +class name java/security/PEMEncoder +header extends java/lang/Object flags 31 classAnnotations @Ljdk/internal/javac/PreviewFeature;(feature=eLjdk/internal/javac/PreviewFeature$Feature;PEM_API;) +innerclass innerClass java/lang/invoke/MethodHandles$Lookup outerClass java/lang/invoke/MethodHandles innerClassName Lookup flags 19 +method name of descriptor ()Ljava/security/PEMEncoder; flags 9 +method name encodeToString descriptor (Ljava/security/DEREncodable;)Ljava/lang/String; flags 1 +method name encode descriptor (Ljava/security/DEREncodable;)[B flags 1 +method name withEncryption descriptor ([C)Ljava/security/PEMEncoder; flags 1 + +class name java/security/PEMRecord +header extends java/lang/Record implements java/security/DEREncodable record true flags 31 classAnnotations @Ljdk/internal/javac/PreviewFeature;(feature=eLjdk/internal/javac/PreviewFeature$Feature;PEM_API;) +recordcomponent name type descriptor Ljava/lang/String; +recordcomponent name pem descriptor Ljava/lang/String; +recordcomponent name leadingData descriptor [B +innerclass innerClass java/util/Base64$Decoder outerClass java/util/Base64 innerClassName Decoder flags 9 +innerclass innerClass java/lang/invoke/MethodHandles$Lookup outerClass java/lang/invoke/MethodHandles innerClassName Lookup flags 19 +method name descriptor (Ljava/lang/String;Ljava/lang/String;[B)V flags 1 methodParameters 0:type,0:pem,0:leadingData +method name descriptor (Ljava/lang/String;Ljava/lang/String;)V flags 1 +method name getEncoded descriptor ()[B flags 1 +method name toString descriptor ()Ljava/lang/String; flags 1 +method name hashCode descriptor ()I flags 11 +method name equals descriptor (Ljava/lang/Object;)Z flags 11 +method name type descriptor ()Ljava/lang/String; flags 1 +method name pem descriptor ()Ljava/lang/String; flags 1 +method name leadingData descriptor ()[B flags 1 + class name java/security/SecurityPermission header extends java/security/BasicPermission flags 31 deprecated true runtimeAnnotations @Ljava/lang/Deprecated;(forRemoval=Ztrue,since="25") class name java/security/UnresolvedPermission header extends java/security/Permission implements java/io/Serializable flags 31 deprecated true runtimeAnnotations @Ljava/lang/Deprecated;(forRemoval=Ztrue,since="25") +class name java/security/cert/X509CRL +header extends java/security/cert/CRL implements java/security/cert/X509Extension,java/security/DEREncodable flags 421 + +class name java/security/cert/X509Certificate +header extends java/security/cert/Certificate implements java/security/cert/X509Extension,java/security/DEREncodable flags 421 + +class name java/security/spec/PKCS8EncodedKeySpec +header extends java/security/spec/EncodedKeySpec implements java/security/DEREncodable flags 21 + +class name java/security/spec/X509EncodedKeySpec +header extends java/security/spec/EncodedKeySpec implements java/security/DEREncodable flags 21 + class name java/time/ZoneOffset header extends java/time/ZoneId implements java/time/temporal/TemporalAccessor,java/time/temporal/TemporalAdjuster,java/lang/Comparable,java/io/Serializable flags 31 signature Ljava/time/ZoneId;Ljava/time/temporal/TemporalAccessor;Ljava/time/temporal/TemporalAdjuster;Ljava/lang/Comparable;Ljava/io/Serializable; runtimeAnnotations @Ljdk/internal/ValueBased; @@ -641,6 +718,14 @@ class name java/util/zip/Inflater header extends java/lang/Object implements java/lang/AutoCloseable flags 21 method name close descriptor ()V flags 1 +class name javax/crypto/EncryptedPrivateKeyInfo +header extends java/lang/Object implements java/security/DEREncodable flags 21 +method name encryptKey descriptor (Ljava/security/PrivateKey;[CLjava/lang/String;Ljava/security/spec/AlgorithmParameterSpec;Ljava/security/Provider;)Ljavax/crypto/EncryptedPrivateKeyInfo; flags 9 classAnnotations @Ljdk/internal/javac/PreviewFeature;(feature=eLjdk/internal/javac/PreviewFeature$Feature;PEM_API;) +method name encryptKey descriptor (Ljava/security/PrivateKey;[C)Ljavax/crypto/EncryptedPrivateKeyInfo; flags 9 classAnnotations @Ljdk/internal/javac/PreviewFeature;(feature=eLjdk/internal/javac/PreviewFeature$Feature;PEM_API;) +method name encryptKey descriptor (Ljava/security/PrivateKey;Ljava/security/Key;Ljava/lang/String;Ljava/security/spec/AlgorithmParameterSpec;Ljava/security/Provider;Ljava/security/SecureRandom;)Ljavax/crypto/EncryptedPrivateKeyInfo; flags 9 classAnnotations @Ljdk/internal/javac/PreviewFeature;(feature=eLjdk/internal/javac/PreviewFeature$Feature;PEM_API;) +method name getKey descriptor ([C)Ljava/security/PrivateKey; thrownTypes java/security/GeneralSecurityException flags 1 classAnnotations @Ljdk/internal/javac/PreviewFeature;(feature=eLjdk/internal/javac/PreviewFeature$Feature;PEM_API;) +method name getKey descriptor (Ljava/security/Key;Ljava/security/Provider;)Ljava/security/PrivateKey; thrownTypes java/security/GeneralSecurityException flags 1 classAnnotations @Ljdk/internal/javac/PreviewFeature;(feature=eLjdk/internal/javac/PreviewFeature$Feature;PEM_API;) + class name javax/crypto/KDF header extends java/lang/Object flags 31 innerclass innerClass java/security/Provider$Service outerClass java/security/Provider innerClassName Service flags 9 @@ -678,6 +763,10 @@ innerclass innerClass javax/crypto/spec/HKDFParameterSpec$ExtractThenExpand oute innerclass innerClass javax/crypto/spec/HKDFParameterSpec$Extract outerClass javax/crypto/spec/HKDFParameterSpec innerClassName Extract flags 19 innerclass innerClass javax/crypto/spec/HKDFParameterSpec$Expand outerClass javax/crypto/spec/HKDFParameterSpec innerClassName Expand flags 19 +class name javax/net/ssl/ExtendedSSLSession +method name exportKeyingMaterialKey descriptor (Ljava/lang/String;Ljava/lang/String;[BI)Ljavax/crypto/SecretKey; thrownTypes javax/net/ssl/SSLKeyException flags 1 +method name exportKeyingMaterialData descriptor (Ljava/lang/String;[BI)[B thrownTypes javax/net/ssl/SSLKeyException flags 1 + class name javax/net/ssl/SSLPermission header extends java/security/BasicPermission flags 31 deprecated true runtimeAnnotations @Ljava/lang/Deprecated;(forRemoval=Ztrue,since="25") diff --git a/src/jdk.compiler/share/data/symbols/java.desktop-P.sym.txt b/src/jdk.compiler/share/data/symbols/java.desktop-P.sym.txt index 23b567b6c05..4a3684710e7 100644 --- a/src/jdk.compiler/share/data/symbols/java.desktop-P.sym.txt +++ b/src/jdk.compiler/share/data/symbols/java.desktop-P.sym.txt @@ -26,10 +26,22 @@ # ### THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT. ### # ########################################################## # +module name java.desktop +header exports java/applet,java/awt,java/awt/color,java/awt/desktop,java/awt/dnd,java/awt/event,java/awt/font,java/awt/geom,java/awt/im,java/awt/im/spi,java/awt/image,java/awt/image/renderable,java/awt/print,java/beans,java/beans/beancontext,javax/accessibility,javax/imageio,javax/imageio/event,javax/imageio/metadata,javax/imageio/plugins/bmp,javax/imageio/plugins/jpeg,javax/imageio/plugins/tiff,javax/imageio/spi,javax/imageio/stream,javax/print,javax/print/attribute,javax/print/attribute/standard,javax/print/event,javax/sound,javax/sound/midi,javax/sound/midi/spi,javax/sound/sampled,javax/sound/sampled/spi,javax/swing,javax/swing/border,javax/swing/colorchooser,javax/swing/event,javax/swing/filechooser,javax/swing/plaf,javax/swing/plaf/basic,javax/swing/plaf/metal,javax/swing/plaf/multi,javax/swing/plaf/nimbus,javax/swing/plaf/synth,javax/swing/table,javax/swing/text,javax/swing/text/html,javax/swing/text/html/parser,javax/swing/text/rtf,javax/swing/tree,javax/swing/undo extraModulePackages sun/print requires name\u0020;java.base\u0020;flags\u0020;8000,name\u0020;java.prefs\u0020;flags\u0020;0,name\u0020;java.datatransfer\u0020;flags\u0020;20,name\u0020;java.xml\u0020;flags\u0020;20 uses java/awt/im/spi/InputMethodDescriptor,javax/accessibility/AccessibilityProvider,javax/imageio/spi/ImageInputStreamSpi,javax/imageio/spi/ImageOutputStreamSpi,javax/imageio/spi/ImageReaderSpi,javax/imageio/spi/ImageTranscoderSpi,javax/imageio/spi/ImageWriterSpi,javax/print/PrintServiceLookup,javax/print/StreamPrintServiceFactory,javax/sound/midi/spi/MidiDeviceProvider,javax/sound/midi/spi/MidiFileReader,javax/sound/midi/spi/MidiFileWriter,javax/sound/midi/spi/SoundbankReader,javax/sound/sampled/spi/AudioFileReader,javax/sound/sampled/spi/AudioFileWriter,javax/sound/sampled/spi/FormatConversionProvider,javax/sound/sampled/spi/MixerProvider,sun/swing/InteropProvider provides interface\u0020;sun/datatransfer/DesktopDatatransferService\u0020;impls\u0020;sun/awt/datatransfer/DesktopDatatransferServiceImpl,interface\u0020;java/net/ContentHandlerFactory\u0020;impls\u0020;sun/awt/www/content/MultimediaContentHandlers,interface\u0020;javax/print/PrintServiceLookup\u0020;impls\u0020;sun/print/PrintServiceLookupProvider,interface\u0020;javax/print/StreamPrintServiceFactory\u0020;impls\u0020;sun/print/PSStreamPrinterFactory,interface\u0020;javax/sound/midi/spi/MidiDeviceProvider\u0020;impls\u0020;com/sun/media/sound/MidiInDeviceProvider\u005C;u002C;com/sun/media/sound/MidiOutDeviceProvider\u005C;u002C;com/sun/media/sound/RealTimeSequencerProvider\u005C;u002C;com/sun/media/sound/SoftProvider,interface\u0020;javax/sound/midi/spi/MidiFileReader\u0020;impls\u0020;com/sun/media/sound/StandardMidiFileReader,interface\u0020;javax/sound/midi/spi/MidiFileWriter\u0020;impls\u0020;com/sun/media/sound/StandardMidiFileWriter,interface\u0020;javax/sound/midi/spi/SoundbankReader\u0020;impls\u0020;com/sun/media/sound/AudioFileSoundbankReader\u005C;u002C;com/sun/media/sound/DLSSoundbankReader\u005C;u002C;com/sun/media/sound/JARSoundbankReader\u005C;u002C;com/sun/media/sound/SF2SoundbankReader,interface\u0020;javax/sound/sampled/spi/AudioFileReader\u0020;impls\u0020;com/sun/media/sound/AiffFileReader\u005C;u002C;com/sun/media/sound/AuFileReader\u005C;u002C;com/sun/media/sound/SoftMidiAudioFileReader\u005C;u002C;com/sun/media/sound/WaveFileReader\u005C;u002C;com/sun/media/sound/WaveFloatFileReader\u005C;u002C;com/sun/media/sound/WaveExtensibleFileReader,interface\u0020;javax/sound/sampled/spi/AudioFileWriter\u0020;impls\u0020;com/sun/media/sound/AiffFileWriter\u005C;u002C;com/sun/media/sound/AuFileWriter\u005C;u002C;com/sun/media/sound/WaveFileWriter\u005C;u002C;com/sun/media/sound/WaveFloatFileWriter,interface\u0020;javax/sound/sampled/spi/FormatConversionProvider\u0020;impls\u0020;com/sun/media/sound/AlawCodec\u005C;u002C;com/sun/media/sound/AudioFloatFormatConverter\u005C;u002C;com/sun/media/sound/PCMtoPCMCodec\u005C;u002C;com/sun/media/sound/UlawCodec,interface\u0020;javax/sound/sampled/spi/MixerProvider\u0020;impls\u0020;com/sun/media/sound/DirectAudioDeviceProvider\u005C;u002C;com/sun/media/sound/PortMixerProvider target macos-aarch64 flags 8000 + class name java/awt/Color -method name createContext descriptor (Ljava/awt/image/ColorModel;Ljava/awt/Rectangle;Ljava/awt/geom/Rectangle2D;Ljava/awt/geom/AffineTransform;Ljava/awt/RenderingHints;)Ljava/awt/PaintContext; method name createContext descriptor (Ljava/awt/image/ColorModel;Ljava/awt/Rectangle;Ljava/awt/geom/Rectangle2D;Ljava/awt/geom/AffineTransform;Ljava/awt/RenderingHints;)Ljava/awt/PaintContext; flags 1 +class name javax/sound/SoundClip +header extends java/lang/Object flags 31 +method name createSoundClip descriptor (Ljava/io/File;)Ljavax/sound/SoundClip; thrownTypes java/io/IOException flags 9 +method name canPlay descriptor ()Z flags 1 +method name isPlaying descriptor ()Z flags 1 +method name play descriptor ()V flags 1 +method name loop descriptor ()V flags 1 +method name stop descriptor ()V flags 1 + class name javax/swing/plaf/basic/BasicScrollBarUI$ScrollListener header extends java/lang/Object implements java/awt/event/ActionListener nestHost javax/swing/plaf/basic/BasicScrollBarUI flags 21 innerclass innerClass javax/swing/plaf/basic/BasicScrollBarUI$ScrollListener outerClass javax/swing/plaf/basic/BasicScrollBarUI innerClassName ScrollListener flags 4 diff --git a/src/jdk.compiler/share/data/symbols/jdk.incubator.vector-P.sym.txt b/src/jdk.compiler/share/data/symbols/jdk.incubator.vector-P.sym.txt index cae81b02a3d..7f6a2e0bcfa 100644 --- a/src/jdk.compiler/share/data/symbols/jdk.incubator.vector-P.sym.txt +++ b/src/jdk.compiler/share/data/symbols/jdk.incubator.vector-P.sym.txt @@ -90,6 +90,7 @@ innerclass innerClass java/lang/invoke/MethodHandles$Lookup outerClass java/lang class name jdk/incubator/vector/VectorShape -method name forBitSize descriptor (I)Ljdk/incubator/vector/VectorShape; method name forBitSize descriptor (I)Ljdk/incubator/vector/VectorShape; flags 9 runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name largestShapeFor descriptor (Ljava/lang/Class;)Ljdk/incubator/vector/VectorShape; flags 9 signature (Ljava/lang/Class<*>;)Ljdk/incubator/vector/VectorShape; class name jdk/incubator/vector/VectorShuffle header extends jdk/internal/vm/vector/VectorSupport$VectorShuffle flags 421 signature Ljdk/internal/vm/vector/VectorSupport$VectorShuffle; diff --git a/src/jdk.compiler/share/data/symbols/jdk.jfr-P.sym.txt b/src/jdk.compiler/share/data/symbols/jdk.jfr-P.sym.txt index 8f7fe9f5699..4325289f570 100644 --- a/src/jdk.compiler/share/data/symbols/jdk.jfr-P.sym.txt +++ b/src/jdk.compiler/share/data/symbols/jdk.jfr-P.sym.txt @@ -26,6 +26,14 @@ # ### THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT. ### # ########################################################## # +class name jdk/jfr/Contextual +header extends java/lang/Object implements java/lang/annotation/Annotation flags 2601 runtimeAnnotations @Ljdk/jfr/MetadataDefinition;@Ljdk/jfr/Label;(value="Context")@Ljava/lang/annotation/Retention;(value=eLjava/lang/annotation/RetentionPolicy;RUNTIME;)@Ljava/lang/annotation/Target;(value={eLjava/lang/annotation/ElementType;FIELD;}) + class name jdk/jfr/FlightRecorderPermission header extends java/security/BasicPermission flags 31 deprecated true runtimeAnnotations @Ljava/lang/Deprecated;(forRemoval=Ztrue,since="25") +class name jdk/jfr/Throttle +header extends java/lang/Object implements java/lang/annotation/Annotation flags 2601 runtimeAnnotations @Ljdk/jfr/MetadataDefinition;@Ljava/lang/annotation/Target;(value={eLjava/lang/annotation/ElementType;TYPE;})@Ljava/lang/annotation/Inherited;@Ljava/lang/annotation/Retention;(value=eLjava/lang/annotation/RetentionPolicy;RUNTIME;) +field name NAME descriptor Ljava/lang/String; constantValue throttle flags 19 +method name value descriptor ()Ljava/lang/String; annotationDefaultValue "off" flags 401 + diff --git a/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/gc/shared/GCCause.java b/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/gc/shared/GCCause.java index 20fbb2128f0..918d34940f4 100644 --- a/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/gc/shared/GCCause.java +++ b/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/gc/shared/GCCause.java @@ -39,7 +39,6 @@ public enum GCCause { _wb_breakpoint ("WhiteBox Initiated Run to Breakpoint"), _no_gc ("No GC"), - _no_cause_specified ("Unknown GCCause"), _allocation_failure ("Allocation Failure"), _codecache_GC_threshold ("CodeCache GC Threshold"), @@ -54,8 +53,9 @@ public enum GCCause { _dcmd_gc_run ("Diagnostic Command"), - _shenandoah_allocation_failure_evac ("Allocation Failure During Evacuation"), _shenandoah_stop_vm ("Stopping VM"), + _shenandoah_allocation_failure_evac ("Allocation Failure During Evacuation"), + _shenandoah_humongous_allocation_failure("Humongous Allocation Failure"), _shenandoah_concurrent_gc ("Concurrent GC"), _shenandoah_upgrade_to_full_gc ("Upgrade To Full GC"), diff --git a/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/oops/ConstantPool.java b/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/oops/ConstantPool.java index c1df1df9429..563d9d3ac4a 100644 --- a/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/oops/ConstantPool.java +++ b/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/oops/ConstantPool.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2025, 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 @@ -100,9 +100,9 @@ private static synchronized void initialize(TypeDataBase db) throws WrongTypeExc headerSize = type.getSize(); elementSize = 0; // fetch constants: - INDY_BSM_OFFSET = db.lookupIntConstant("ConstantPool::_indy_bsm_offset").intValue(); - INDY_ARGC_OFFSET = db.lookupIntConstant("ConstantPool::_indy_argc_offset").intValue(); - INDY_ARGV_OFFSET = db.lookupIntConstant("ConstantPool::_indy_argv_offset").intValue(); + INDY_BSM_OFFSET = db.lookupIntConstant("BSMAttributeEntry::_bsmi_offset").intValue(); + INDY_ARGC_OFFSET = db.lookupIntConstant("BSMAttributeEntry::_argc_offset").intValue(); + INDY_ARGV_OFFSET = db.lookupIntConstant("BSMAttributeEntry::_argv_offset").intValue(); } public ConstantPool(Address addr) { diff --git a/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/runtime/Threads.java b/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/runtime/Threads.java index dfc49d1a81f..6acacc28722 100644 --- a/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/runtime/Threads.java +++ b/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/runtime/Threads.java @@ -158,6 +158,7 @@ private static synchronized void initialize(TypeDataBase db) { virtualConstructor.addMapping("JvmtiAgentThread", JavaThread.class); virtualConstructor.addMapping("NotificationThread", JavaThread.class); virtualConstructor.addMapping("AttachListenerThread", JavaThread.class); + virtualConstructor.addMapping("JfrRecorderThread", JavaThread.class); // These are all the hidden JavaThread subclasses that don't execute java code. virtualConstructor.addMapping("StringDedupThread", HiddenJavaThread.class); @@ -195,7 +196,8 @@ public JavaThread createJavaThreadWrapper(Address threadAddr) { } catch (Exception e) { throw new RuntimeException("Unable to deduce type of thread from address " + threadAddr + " (expected type JavaThread, CompilerThread, MonitorDeflationThread, AttachListenerThread," + - " DeoptimizeObjectsALotThread, StringDedupThread, NotificationThread, ServiceThread or JvmtiAgentThread)", e); + " DeoptimizeObjectsALotThread, StringDedupThread, NotificationThread, ServiceThread," + + " JfrRecorderThread, or JvmtiAgentThread)", e); } } @@ -222,29 +224,18 @@ private JavaThread owningThreadFromMonitor(Address o) { public JavaThread owningThreadFromMonitor(ObjectMonitor monitor) { if (monitor.isOwnedAnonymous()) { - if (VM.getVM().getCommandLineFlag("LockingMode").getInt() == LockingMode.getLightweight()) { - OopHandle object = monitor.object(); - for (int i = 0; i < getNumberOfThreads(); i++) { - JavaThread thread = getJavaThreadAt(i); - if (thread.isLockOwned(object)) { - return thread; - } - } - // We should have found the owner, however, as the VM could be in any state, including the middle - // of performing GC, it is not always possible to do so. Just return null if we can't locate it. - System.out.println("Warning: We failed to find a thread that owns an anonymous lock. This is likely"); - System.out.println("due to the JVM currently running a GC. Locking information may not be accurate."); - return null; - } else { - assert(VM.getVM().getCommandLineFlag("LockingMode").getInt() == LockingMode.getLegacy()); - Address o = (Address)monitor.stackLocker(); - for (int i = 0; i < getNumberOfThreads(); i++) { - JavaThread thread = getJavaThreadAt(i); - if (thread.isLockOwned(o)) - return thread; - } - return null; + OopHandle object = monitor.object(); + for (int i = 0; i < getNumberOfThreads(); i++) { + JavaThread thread = getJavaThreadAt(i); + if (thread.isLockOwned(object)) { + return thread; + } } + // We should have found the owner, however, as the VM could be in any state, including the middle + // of performing GC, it is not always possible to do so. Just return null if we can't locate it. + System.out.println("Warning: We failed to find a thread that owns an anonymous lock. This is likely"); + System.out.println("due to the JVM currently running a GC. Locking information may not be accurate."); + return null; } else { return owningThreadFromMonitor(monitor.owner()); } diff --git a/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/VectorMathLibrary.java b/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/VectorMathLibrary.java index 4729235e2d9..ecd03ab9124 100644 --- a/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/VectorMathLibrary.java +++ b/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/VectorMathLibrary.java @@ -24,7 +24,6 @@ */ package jdk.incubator.vector; -import jdk.internal.util.StaticProperty; import jdk.internal.vm.annotation.DontInline; import jdk.internal.vm.annotation.ForceInline; import jdk.internal.vm.annotation.Stable; @@ -70,7 +69,7 @@ static Library getInstance() { } static String getDefaultName() { - return switch (StaticProperty.osArch()) { + return switch (System.getProperty("os.arch")) { case "amd64", "x86_64" -> SVML; case "aarch64", "riscv64" -> SLEEF; default -> JAVA; diff --git a/src/jdk.internal.vm.ci/share/classes/jdk/vm/ci/aarch64/AArch64.java b/src/jdk.internal.vm.ci/share/classes/jdk/vm/ci/aarch64/AArch64.java index 66aed480bbb..391ac224609 100644 --- a/src/jdk.internal.vm.ci/share/classes/jdk/vm/ci/aarch64/AArch64.java +++ b/src/jdk.internal.vm.ci/share/classes/jdk/vm/ci/aarch64/AArch64.java @@ -179,6 +179,7 @@ public enum CPUFeature implements CPUFeatureName { SHA3, SHA512, SVE, + SB, PACA, SVEBITPERM, SVE2, diff --git a/src/jdk.internal.vm.ci/share/classes/jdk/vm/ci/hotspot/CompilerToVM.java b/src/jdk.internal.vm.ci/share/classes/jdk/vm/ci/hotspot/CompilerToVM.java index 0cb56354498..b25f7a09256 100644 --- a/src/jdk.internal.vm.ci/share/classes/jdk/vm/ci/hotspot/CompilerToVM.java +++ b/src/jdk.internal.vm.ci/share/classes/jdk/vm/ci/hotspot/CompilerToVM.java @@ -654,6 +654,8 @@ native int installCode0(long compiledCodeBuffer, long failedSpeculationsAddress, byte[] speculations); + native String getInvalidationReasonDescription(int invalidationReason); + /** * Gets flags specifying optional parts of code info. Only if a flag is set, will the * corresponding code info being included in the {@linkplain HotSpotCompiledCodeStream @@ -842,7 +844,7 @@ void reprofile(HotSpotResolvedJavaMethodImpl method) { * {@code nmethod} associated with {@code nmethodMirror} is also made non-entrant and if * {@code deoptimize == true} any current activations of the {@code nmethod} are deoptimized. */ - native void invalidateHotSpotNmethod(HotSpotNmethod nmethodMirror, boolean deoptimize); + native void invalidateHotSpotNmethod(HotSpotNmethod nmethodMirror, boolean deoptimize, int invalidationReason); /** * Collects the current values of all JVMCI benchmark counters, summed up over all threads. diff --git a/src/jdk.internal.vm.ci/share/classes/jdk/vm/ci/hotspot/HotSpotCodeCacheProvider.java b/src/jdk.internal.vm.ci/share/classes/jdk/vm/ci/hotspot/HotSpotCodeCacheProvider.java index a0130d1bda9..9545c9aa9ec 100644 --- a/src/jdk.internal.vm.ci/share/classes/jdk/vm/ci/hotspot/HotSpotCodeCacheProvider.java +++ b/src/jdk.internal.vm.ci/share/classes/jdk/vm/ci/hotspot/HotSpotCodeCacheProvider.java @@ -154,16 +154,20 @@ public InstalledCode installCode(ResolvedJavaMethod method, CompiledCode compile return logOrDump(resultInstalledCode, compiledCode); } - @Override - public void invalidateInstalledCode(InstalledCode installedCode) { + public void invalidateInstalledCode(InstalledCode installedCode, int invalidationReason) { if (installedCode instanceof HotSpotNmethod) { HotSpotNmethod nmethod = (HotSpotNmethod) installedCode; - nmethod.invalidate(true); + nmethod.invalidate(true, invalidationReason); } else { throw new IllegalArgumentException("Cannot invalidate a " + Objects.requireNonNull(installedCode).getClass().getName()); } } + @Override + public void invalidateInstalledCode(InstalledCode installedCode) { + invalidateInstalledCode(installedCode, jvmciInvalidationReason()); + } + @Override public TargetDescription getTarget() { return target; @@ -201,4 +205,8 @@ public int interpreterFrameSize(BytecodeFrame pos) { public void resetCompilationStatistics() { runtime.getCompilerToVM().resetCompilationStatistics(); } + + private static int jvmciInvalidationReason() { + return HotSpotJVMCIRuntime.runtime().config.getConstant("nmethod::InvalidationReason::JVMCI_INVALIDATE", Integer.class); + } } diff --git a/src/jdk.internal.vm.ci/share/classes/jdk/vm/ci/hotspot/HotSpotNmethod.java b/src/jdk.internal.vm.ci/share/classes/jdk/vm/ci/hotspot/HotSpotNmethod.java index 9ed03f9749e..5c7089da6cb 100644 --- a/src/jdk.internal.vm.ci/share/classes/jdk/vm/ci/hotspot/HotSpotNmethod.java +++ b/src/jdk.internal.vm.ci/share/classes/jdk/vm/ci/hotspot/HotSpotNmethod.java @@ -27,6 +27,7 @@ import jdk.vm.ci.code.InstalledCode; import jdk.vm.ci.code.InvalidInstalledCodeException; +import jdk.vm.ci.common.JVMCIError; import jdk.vm.ci.meta.JavaKind; import jdk.vm.ci.meta.JavaType; import jdk.vm.ci.meta.ResolvedJavaMethod; @@ -76,12 +77,19 @@ boolean inOopsTable() { */ private final long compileIdSnapshot; + /** + * Identify the reason that caused this nmethod to be invalidated. + * A value of -1 means that the nmethod was not invalidated. + */ + private int invalidationReason; + HotSpotNmethod(HotSpotResolvedJavaMethodImpl method, String name, boolean isDefault, long compileId) { super(name); this.method = method; this.isDefault = isDefault; boolean inOopsTable = !IS_IN_NATIVE_IMAGE && !isDefault; this.compileIdSnapshot = inOopsTable ? 0L : compileId; + this.invalidationReason = -1; assert inOopsTable || compileId != 0L : this; } @@ -122,9 +130,19 @@ public ResolvedJavaMethod getMethod() { return method; } + /** + * Invalidate this nmethod using the reason specified in {@code invalidationReason} and + * optionally deoptimize the method if {@code deoptimize} is set. + * @param deoptimize whether or not to deoptimize the method. + * @param invalidationReason invalidation reason code. + */ + public void invalidate(boolean deoptimize, int invalidationReason) { + compilerToVM().invalidateHotSpotNmethod(this, deoptimize, invalidationReason); + } + @Override public void invalidate(boolean deoptimize) { - compilerToVM().invalidateHotSpotNmethod(this, deoptimize); + invalidate(deoptimize, jvmciInvalidationReason()); } @Override @@ -188,4 +206,22 @@ public Object executeVarargs(Object... args) throws InvalidInstalledCodeExceptio public long getStart() { return isValid() ? super.getStart() : 0; } + + /** + * @return an integer representing the reason why this nmethod was invalidated. + */ + public int getInvalidationReason() { + return invalidationReason; + } + + /** + * @return a String describing the reason why this nmethod was invalidated. + */ + public String getInvalidationReasonDescription() { + return compilerToVM().getInvalidationReasonDescription(this.getInvalidationReason()); + } + + private static int jvmciInvalidationReason() { + return HotSpotJVMCIRuntime.runtime().config.getConstant("nmethod::InvalidationReason::JVMCI_INVALIDATE", Integer.class); + } } diff --git a/src/jdk.jartool/share/classes/sun/security/tools/jarsigner/resources/jarsigner_de.properties b/src/jdk.jartool/share/classes/sun/security/tools/jarsigner/resources/jarsigner_de.properties index fe4ff9b50c4..c5d9f41ee85 100644 --- a/src/jdk.jartool/share/classes/sun/security/tools/jarsigner/resources/jarsigner_de.properties +++ b/src/jdk.jartool/share/classes/sun/security/tools/jarsigner/resources/jarsigner_de.properties @@ -25,7 +25,7 @@ # shared (from jarsigner) SPACE=\u0020 -6SPACE=\u0020 \u0020 +6SPACE=\ \u0020 COMMA=,\u0020 provclass.not.a.provider=%s kein Provider provider.name.not.found=Provider namens "%s" nicht gefunden @@ -37,8 +37,8 @@ Illegal.option.=Unzulässige Option:\u0020 If.protected.is.specified.then.storepass.and.keypass.must.not.be.specified=Wenn -protected angegeben ist, dürfen -storepass und -keypass nicht angegeben werden If.keystore.is.not.password.protected.then.storepass.and.keypass.must.not.be.specified=Wenn der Keystore nicht kennwortgeschützt ist, dürfen -storepass und -keypass nicht angegeben werden Usage.jarsigner.options.jar.file.alias=Verwendung: jarsigner [options] jar-file alias -.jarsigner.verify.options.jar.file.alias.=\u0020 jarsigner -verify [options] jar-file [alias...] -.jarsigner.version=\u0020 jarsigner -version +.jarsigner.verify.options.jar.file.alias.=\ jarsigner -verify [options] jar-file [alias...] +.jarsigner.version=\ jarsigner -version .keystore.url.keystore.location=[-keystore ] Keystore-Speicherort .storepass.password.password.for.keystore.integrity=[-storepass ] Kennwort für Keystore-Integrität .storetype.type.keystore.type=[-storetype ] Keystore-Typ @@ -51,7 +51,7 @@ Usage.jarsigner.options.jar.file.alias=Verwendung: jarsigner [options] jar-file .verify.verify.a.signed.JAR.file=[-verify] Verifiziert eine signierte JAR-Datei .version.print.the.program.version=[-version] Gibt die Programmversion aus .verbose.suboptions.verbose.output.when.signing.verifying.=[-verbose[:suboptions]] Verbose-Ausgabe beim Signieren/Verifizieren. -.suboptions.can.be.all.grouped.or.summary=\u0020 Als Unteroptionen sind "all", "grouped" und "summary" möglich +.suboptions.can.be.all.grouped.or.summary=\ Als Unteroptionen sind "all", "grouped" und "summary" möglich .certs.display.certificates.when.verbose.and.verifying=[-certs] Zeigt Zertifikate bei Verbose und Verifizierung an .certs.revocation.check=[-revCheck] Aktiviert die Zertifikatswiderrufprüfung .tsa.url.location.of.the.Timestamping.Authority=[-tsa ] Ort der Zeitstempelautorität @@ -63,9 +63,9 @@ Usage.jarsigner.options.jar.file.alias=Verwendung: jarsigner [options] jar-file .protected.keystore.has.protected.authentication.path=[-protected] Keystore hat geschützten Authentifizierungspfad .providerName.name.provider.name=[-providerName ] Providername .add.provider.option=[-addprovider Fügt einen Sicherheitsprovider nach Name hinzu (z.B. SunPKCS11) -.providerArg.option.1=\u0020 [-providerArg ]] ... Konfiguriert Argument für -addprovider +.providerArg.option.1=\ [-providerArg ]] ... Konfiguriert Argument für -addprovider .providerClass.option=[-providerClass Fügt einen Sicherheitsprovider nach vollqualifiziertem Klassennamen hinzu -.providerArg.option.2=\u0020 [-providerArg ]] ... Konfiguriert Argument für -providerClass +.providerArg.option.2=\ [-providerArg ]] ... Konfiguriert Argument für -providerClass .providerPath.option=[-providerPath ] Provider-Classpath .strict.treat.warnings.as.errors=[-strict] Behandelt Warnungen als Fehler .conf.url.specify.a.pre.configured.options.file=[-conf ] Vorkonfigurierte Optionsdatei angeben @@ -83,11 +83,11 @@ k=k X=X q=? .and.d.more.=(und %d mehr) -.s.signature.was.verified.=\u0020 s = Signatur wurde verifiziert\u0020 -.m.entry.is.listed.in.manifest=\u0020 m = Eintrag ist in Manifest aufgeführt -.k.at.least.one.certificate.was.found.in.keystore=\u0020 k = Mindestens ein Zertifikat im Keystore gefunden -.X.not.signed.by.specified.alias.es.=\u0020 X = Nicht von den angegebenen Aliasnamen signiert -.q.unsigned.entry=\u0020 ? = Nicht signierter Eintrag +.s.signature.was.verified.=\ s = Signatur wurde verifiziert\u0020 +.m.entry.is.listed.in.manifest=\ m = Eintrag ist in Manifest aufgeführt +.k.at.least.one.certificate.was.found.in.keystore=\ k = Mindestens ein Zertifikat im Keystore gefunden +.X.not.signed.by.specified.alias.es.=\ X = Nicht von den angegebenen Aliasnamen signiert +.q.unsigned.entry=\ ? = Nicht signierter Eintrag no.manifest.=Kein Manifest. .Signature.related.entries.=(Signaturbezogene Einträge) .Unsigned.entries.=(Nicht signierte Einträge) @@ -96,14 +96,15 @@ jar.is.unsigned=JAR-Datei ist nicht signiert. jar.treated.unsigned=Warnung: Signatur kann entweder nicht geparst oder nicht verifiziert werden. Die JAR-Datei wird als nicht signiert behandelt. Weitere Informationen erhalten Sie, indem Sie "jarsigner" mit aktiviertem Debugging erneut ausführen (-J-Djava.security.debug=jar). jar.treated.unsigned.see.weak=Die JAR-Datei wird als nicht signiert behandelt, da sie mit einem schwachen Algorithmus signiert wurde, der jetzt deaktiviert ist.\n\nFühren Sie "jarsigner" mit der Option "-verbose" erneut aus, um weitere Einzelheiten zu erhalten. jar.treated.unsigned.see.weak.verbose=Warnung: Die JAR-Datei wird als nicht signiert behandelt, da sie mit einem schwachen Algorithmus signiert wurde, der mittlerweile von der folgenden Sicherheitseigenschaft deaktiviert wurde: -jar.signed.=JAR-Datei signiert. +multiple.manifest.warning.=Doppelte Manifesteinträge in der JAR-Datei erkannt. JarSigner hat nur einen Eintrag bearbeitet. Die anderen wurden verworfen. +jar.signed.=JAR signiert. jar.signed.with.signer.errors.=JAR-Datei signiert, mit Signaturgeberfehlern. -jar.verified.=JAR-Datei verifiziert. +jar.verified.=JAR verifiziert. jar.verified.with.signer.errors.=JAR-Datei verifiziert, mit Signaturgeberfehlern. history.with.ts=- Von "%1$s" signiert\n Digestalgorithmus: %2$s\n Signaturalgorithmus: %3$s, %4$s\n Zeitstempel von "%6$s" am %5$tc\n Digestalgorithmus für Zeitstempel: %7$s\n Signaturalgorithmus für Zeitstempel: %8$s, %9$s history.without.ts=- Von "%1$s" signiert\n Digestalgorithmus: %2$s\n Signaturalgorithmus: %3$s, %4$s -history.nonexistent.entries=\u0020 Warnung: Nicht vorhandene signierte Einträge:\u0020 +history.nonexistent.entries=\ Warnung: Nicht vorhandene signierte Einträge:\u0020 history.unparsable=- Signaturbezogene Datei %s kann nicht geparst werden history.nosf=- Signaturbezogene Datei META-INF/%s.SF fehlt history.nobk=- Blockdatei für signaturbezogene Datei META-INF/%s.SF fehlt @@ -113,8 +114,8 @@ with.algparams.weak=%1$s mit %2$s (schwach) with.disabled=%s (deaktiviert) with.algparams.disabled=%1$s mit %2$s (deaktiviert) key.bit=%s-Schlüssel -key.bit.weak=%s Schlüssel (schwach) -key.bit.disabled=%s Schlüssel (deaktiviert) +key.bit.weak=%s-Schlüssel (schwach) +key.bit.disabled=%s-Schlüssel (deaktiviert) nonexistent.entries.found=Diese JAR-Datei enthält signierte Einträge für Dateien, die nicht vorhanden sind. Weitere Details finden Sie in der Verbose-Ausgabe (-verbose). external.file.attributes.detected=POSIX-Dateiberechtigung und/oder Symlink-Attribute erkannt. Diese Attribute werden bei der Signatur ignoriert und sind nicht durch die Signatur geschützt. @@ -122,9 +123,9 @@ jarsigner.=jarsigner:\u0020 signature.filename.must.consist.of.the.following.characters.A.Z.0.9.or.=Signaturdateiname muss aus den folgenden Zeichen bestehen: A-Z, 0-9, _ oder - unable.to.open.jar.file.=JAR-Datei kann nicht geöffnet werden:\u0020 unable.to.create.=Erstellen nicht möglich:\u0020 -.adding.=\u0020 Wird hinzugefügt:\u0020 -.updating.=\u0020Wird aktualisiert:\u0020 -.signing.=\u0020 Wird signiert:\u0020 +.adding.=\ Wird hinzugefügt:\u0020 +.updating.=\ Wird aktualisiert:\u0020 +.signing.=\ Wird signiert:\u0020 attempt.to.rename.signedJarFile.to.jarFile.failed=Der Versuch, {0} in {1} umzubenennen, war nicht erfolgreich attempt.to.rename.jarFile.to.origJar.failed=Der Versuch, {0} in {1} umzubenennen, war nicht erfolgreich unable.to.sign.jar.=JAR-Datei kann nicht signiert werden:\u0020 @@ -149,7 +150,7 @@ certificate.will.expire.on=Zertifikat läuft am {0} ab .Invalid.certificate.chain.=[Ungültige Zertifikatskette:\u0020 .Invalid.TSA.certificate.chain.=[Ungültige TSA-Zertifikatskette:\u0020 requesting.a.signature.timestamp=Signaturzeitstempel wird angefordert -TSA.location.=TSA-Ort:\u0020 +TSA.location.=TSA-Speicherort:\u0020 TSA.certificate.=TSA-Zertifikat:\u0020 no.response.from.the.Timestamping.Authority.=Keine Antwort von der Zeitstempelautorität. Bei Verbindungen hinter einer Firewall muss möglicherweise ein HTTP- oder HTTPS-Proxy angegeben werden. Geben Sie die folgenden Optionen für "jarsigner" an: or=oder @@ -159,9 +160,9 @@ Warning.=Warnung:\u0020 Error.=Fehler:\u0020 ...Signer=>>> Signaturgeber ...TSA=>>> TSA -trusted.certificate=vertrauenswürdiges Zertifikat +trusted.certificate=Vertrauenswürdiges Zertifikat This.jar.contains.unsigned.entries.which.have.not.been.integrity.checked.=Diese JAR-Datei enthält nicht signierte Einträge, deren Integrität nicht geprüft wurde.\u0020 -This.jar.contains.entries.whose.signer.certificate.has.expired.=Diese JAR-Datei enthält Einträge, deren Signaturgeberzertifikat abgelaufen ist. +This.jar.contains.entries.whose.signer.certificate.has.expired.=Diese JAR-Datei enthält Einträge, deren Signaturgeberzertifikat abgelaufen ist.\u0020 This.jar.contains.entries.whose.signer.certificate.will.expire.within.six.months.=Diese JAR-Datei enthält Einträge, deren Signaturgeberzertifikat innerhalb der nächsten sechs Monate abläuft.\u0020 This.jar.contains.entries.whose.signer.certificate.is.not.yet.valid.=Diese JAR-Datei enthält Einträge, deren Signaturgeberzertifikat noch nicht gültig ist.\u0020 This.jar.contains.entries.whose.signer.certificate.is.self.signed.=Diese JAR-Datei enthält Einträge, deren Signaturgeberzertifikat selbstsigniert ist. @@ -188,9 +189,9 @@ The.1.algorithm.specified.for.the.2.option.is.considered.a.security.risk.and.is. The.timestamp.digest.algorithm.1.is.considered.a.security.risk..This.algorithm.will.be.disabled.in.a.future.update.=Der %1$s-Digestalgorithmus des Zeitstempels gilt als Sicherheitsrisiko. Dieser Algorithmus wird in einem zukünftigen Update deaktiviert. The.digest.algorithm.1.is.considered.a.security.risk..This.algorithm.will.be.disabled.in.a.future.update.=Der %1$s-Digestalgorithmus gilt als Sicherheitsrisiko. Dieser Algorithmus wird in einem zukünftigen Update deaktiviert. The.signature.algorithm.1.is.considered.a.security.risk..This.algorithm.will.be.disabled.in.a.future.update.=Der %1$s-Signaturalgorithmus gilt als Sicherheitsrisiko. Dieser Algorithmus wird in einem zukünftigen Update deaktiviert. -size.bit.alg=%1$d-Bit %2$s -The.full.keyAlgName.signing.key.is.considered.a.security.risk..It.will.be.disabled.in.a.future.update.=Der %s Signaturschlüssel wird als Sicherheitsrisiko betrachtet. Wird in einem zukünftigen Update deaktiviert. -The.full.keyAlgName.signing.key.is.considered.a.security.risk.and.is.disabled.=Der %s Signaturschlüssel wird als Sicherheitsrisiko betrachtet und ist deaktiviert. +size.bit.alg=%1$d-Bit-%2$s +The.full.keyAlgName.signing.key.is.considered.a.security.risk..It.will.be.disabled.in.a.future.update.=Der %1$s-Signaturschlüssel gilt als Sicherheitsrisiko. Er wird in einem zukünftigen Update deaktiviert. +The.full.keyAlgName.signing.key.is.considered.a.security.risk.and.is.disabled.=Der %s-Signaturschlüssel gilt als Sicherheitsrisiko und ist deaktiviert. This.jar.contains.entries.whose.certificate.chain.is.invalid.reason.1=Diese JAR-Datei enthält Einträge, deren Zertifikatskette ungültig ist. Grund: %s This.jar.contains.entries.whose.tsa.certificate.chain.is.invalid.reason.1=Diese JAR-Datei enthält Einträge, deren TSA-Zertifikatskette ungültig ist. Grund: %s no.timestamp.signing=Weder -tsa noch -tsacert wurde angegeben, und diese JAR-Datei hat keinen Zeitstempel. Ohne Zeitstempel können Benutzer diese JAR-Datei nach dem Ablaufdatum des Signaturgeberzertifikats (%1$tY-%1$tm-%1$td) möglicherweise nicht mehr validieren. @@ -205,3 +206,17 @@ Cannot.find.environment.variable.=Umgebungsvariable kann nicht gefunden werden:\ Cannot.find.file.=Datei kann nicht gefunden werden:\u0020 event.ocsp.check=Verbindung zu OCSP-Server bei %s wird hergestellt... event.crl.check=CRL wird von %s heruntergeladen... +manifest.missing.when.reading.jarfile=Manifest fehlt beim Lesen über JarFile +manifest.missing.when.reading.jarinputstream=Manifest fehlt beim Lesen über JarInputStream +manifest.attribute.1.present.when.reading.jarfile.but.missing.via.jarinputstream=Manifesthauptattribut %s ist beim Lesen über JarFile vorhanden, aber fehlt beim Lesen über JarInputStream +manifest.attribute.1.present.when.reading.jarinputstream.but.missing.via.jarfile=Manifesthauptattribut %s ist beim Lesen über JarInputStream vorhanden, aber fehlt beim Lesen über JarFile +manifest.attribute.1.differs.jarfile.value.2.jarinputstream.value.3=Manifesthauptattribut %1$s unterschiedlich: JarFile-Wert = %2$s, JarInputStream-Wert = %3$s +entry.1.present.when.reading.jarinputstream.but.missing.via.jarfile=Eintrag %s ist beim Lesen über JarInputStream vorhanden, aber fehlt beim Lesen über JarFile +entry.1.present.when.reading.jarfile.but.missing.via.jarinputstream=Eintrag %s ist beim Lesen über JarFile vorhanden, aber fehlt beim Lesen über JarInputStream +entry.1.present.in.jarfile.but.unreadable=Eintrag %s ist in JarFile vorhanden, aber nicht lesbar +codesigners.different.for.entry.1.when.reading.jarfile.and.jarinputstream=Codesignaturgeber für Eintrag %s beim Lesen über JarFile anders als bei JarInputStream +entry.1.is.signed.in.jarfile.but.is.not.signed.in.jarinputstream=Eintrag %s ist in JarFile, aber nicht in JarInputStream signiert +entry.1.is.signed.in.jarinputstream.but.is.not.signed.in.jarfile=Eintrag %s ist in JarInputStream, aber nicht in JarFile signiert +jar.contains.internal.inconsistencies.result.in.different.contents.via.jarfile.and.jarinputstream=Diese JAR-Datei enthält interne Inkonsistenzen, die zu anderem Inhalt beim Lesen über JarFile als beim Lesen über JarInputStream führen können: +signature.verification.failed.on.entry.1.when.reading.via.jarinputstream=Signaturverifizierung war für Eintrag %s beim Lesen über JarInputStream nicht erfolgreich +signature.verification.failed.on.entry.1.when.reading.via.jarfile=Signaturverifizierung war für Eintrag %s beim Lesen über JarFile nicht erfolgreich diff --git a/src/jdk.jartool/share/classes/sun/security/tools/jarsigner/resources/jarsigner_ja.properties b/src/jdk.jartool/share/classes/sun/security/tools/jarsigner/resources/jarsigner_ja.properties index e13d8b5a471..97ab6a918cb 100644 --- a/src/jdk.jartool/share/classes/sun/security/tools/jarsigner/resources/jarsigner_ja.properties +++ b/src/jdk.jartool/share/classes/sun/security/tools/jarsigner/resources/jarsigner_ja.properties @@ -25,7 +25,7 @@ # shared (from jarsigner) SPACE=\u0020 -6SPACE=\u0020 \u0020 +6SPACE=\ \u0020 COMMA=,\u0020 provclass.not.a.provider=%sはプロバイダではありません provider.name.not.found=プロバイダ名"%s"が見つかりません @@ -37,8 +37,8 @@ Illegal.option.=不正なオプション:\u0020 If.protected.is.specified.then.storepass.and.keypass.must.not.be.specified=-protectedを指定する場合は、-storepassおよび-keypassを指定しないでください If.keystore.is.not.password.protected.then.storepass.and.keypass.must.not.be.specified=キーストアがパスワードで保護されていない場合、-storepassおよび-keypassを指定しないでください Usage.jarsigner.options.jar.file.alias=使用方法: jarsigner [options] jar-file alias -.jarsigner.verify.options.jar.file.alias.=\u0020 jarsigner -verify [options] jar-file [alias...] -.jarsigner.version=\u0020 jarsigner -version +.jarsigner.verify.options.jar.file.alias.=\ jarsigner -verify [options] jar-file [alias...] +.jarsigner.version=\ jarsigner -version .keystore.url.keystore.location=[-keystore ] キーストアの位置 .storepass.password.password.for.keystore.integrity=[-storepass ] キーストア整合性のためのパスワード .storetype.type.keystore.type=[-storetype ] キーストアの型 @@ -47,25 +47,25 @@ Usage.jarsigner.options.jar.file.alias=使用方法: jarsigner [options] jar-fil .sigfile.file.name.of.SF.DSA.file=[-sigfile ] .SF/.DSAファイルの名前 .signedjar.file.name.of.signed.JAR.file=[-signedjar ] 署名付きJARファイルの名前 .digestalg.algorithm.name.of.digest.algorithm=[-digestalg ] ダイジェスト・アルゴリズムの名前 -.sigalg.algorithm.name.of.signature.algorithm=[-sigalg ] シグネチャ・アルゴリズムの名前 +.sigalg.algorithm.name.of.signature.algorithm=[-sigalg ] 署名アルゴリズムの名前 .verify.verify.a.signed.JAR.file=[-verify] 署名付きJARファイルの検証 .version.print.the.program.version=[-version] プログラム・バージョンを出力します .verbose.suboptions.verbose.output.when.signing.verifying.=[-verbose[:suboptions]] 署名/検証時の詳細出力。 -.suboptions.can.be.all.grouped.or.summary=\u0020 サブオプションとして、all、groupedまたはsummaryを使用できます +.suboptions.can.be.all.grouped.or.summary=\ サブオプションとして、all、groupedまたはsummaryを使用できます .certs.display.certificates.when.verbose.and.verifying=[-certs] 詳細出力および検証時に証明書を表示 .certs.revocation.check=[-revCheck] 証明書失効チェックの有効化 .tsa.url.location.of.the.Timestamping.Authority=[-tsa ] タイムスタンプ局の場所 .tsacert.alias.public.key.certificate.for.Timestamping.Authority=[-tsacert ] タイムスタンプ局の公開キー証明書 .tsapolicyid.tsapolicyid.for.Timestamping.Authority=[-tsapolicyid ] タイムスタンプ局のTSAPolicyID .tsadigestalg.algorithm.of.digest.data.in.timestamping.request=[-tsadigestalg ] タイムスタンプ・リクエストのダイジェスト・データのアルゴリズム -.internalsf.include.the.SF.file.inside.the.signature.block=[-internalsf] シグネチャ・ブロックに.SFファイルを含める +.internalsf.include.the.SF.file.inside.the.signature.block=[-internalsf] 署名ブロックに.SFファイルを含める .sectionsonly.don.t.compute.hash.of.entire.manifest=[-sectionsonly] マニフェスト全体のハッシュは計算しない .protected.keystore.has.protected.authentication.path=[-protected] キーストアには保護された認証パスがある .providerName.name.provider.name=[-providerName ] プロバイダ名 .add.provider.option=[-addprovider 名前でセキュリティ・プロバイダを追加する(SunPKCS11など) -.providerArg.option.1=\u0020 [-providerArg ]] ... -addproviderの引数を構成する +.providerArg.option.1=\ [-providerArg ]] ... -addproviderの引数を構成する .providerClass.option=[-providerClass 完全修飾クラス名でセキュリティ・プロバイダを追加する -.providerArg.option.2=\u0020 [-providerArg ]] ... -providerClassの引数を構成する +.providerArg.option.2=\ [-providerArg ]] ... -providerClassの引数を構成する .providerPath.option=[-providerPath ] プロバイダ・クラスパス .strict.treat.warnings.as.errors=[-strict] 警告をエラーとして処理 .conf.url.specify.a.pre.configured.options.file=[-conf ] 事前構成済のオプション・ファイルを指定する @@ -83,19 +83,20 @@ k=k X=X q=? .and.d.more.=(他にも%d個) -.s.signature.was.verified.=\u0020 s=シグネチャが検証されました\u0020 -.m.entry.is.listed.in.manifest=\u0020 m=エントリがマニフェスト内にリストされます -.k.at.least.one.certificate.was.found.in.keystore=\u0020 k=1つ以上の証明書がキーストアで検出されました -.X.not.signed.by.specified.alias.es.=\u0020 X =指定した別名で署名されていません -.q.unsigned.entry=\u0020 ? = 署名なしのエントリ +.s.signature.was.verified.=\ s=署名が検証されました\u0020 +.m.entry.is.listed.in.manifest=\ m=エントリがマニフェスト内にリストされます +.k.at.least.one.certificate.was.found.in.keystore=\ k=1つ以上の証明書がキーストアで検出されました +.X.not.signed.by.specified.alias.es.=\ X =指定した別名で署名されていません +.q.unsigned.entry=\ ? = 署名なしのエントリ no.manifest.=マニフェストは存在しません。 -.Signature.related.entries.=(シグネチャ関連エントリ) +.Signature.related.entries.=(署名関連エントリ) .Unsigned.entries.=(署名なしのエントリ) .Directory.entries.=(ディレクトリ・エントリ) jar.is.unsigned=jarは署名されていません。 jar.treated.unsigned=警告: 署名が構文解析できないか検証できないため、このjarは署名なしとして扱われます。詳細は、デバッグを有効にして(-J-Djava.security.debug=jar) jarsignerを再実行してください。 jar.treated.unsigned.see.weak=このjarは、現在無効になっている弱いアルゴリズムで署名されているため、署名なしとして扱われます。\n\n詳細は、-verboseオプションを使用してjarsignerを再実行してください。 jar.treated.unsigned.see.weak.verbose=警告: このjarは、セキュリティ・プロパティによって現在無効になっている弱いアルゴリズムで署名されているため、署名なしとして扱われます: +multiple.manifest.warning.=jarファイルで重複したマニフェスト・エントリが検出されました。JarSignerは1つでのみ動作し、その他は破棄されました。 jar.signed.=jarは署名されました。 jar.signed.with.signer.errors.=jarは署名されました - 署名者エラーがあります。 jar.verified.=jarが検証されました。 @@ -103,7 +104,7 @@ jar.verified.with.signer.errors.=jarは検証されました - 署名者エラ history.with.ts=- 署名者: "%1$s"\n ダイジェスト・アルゴリズム: %2$s\n 署名アルゴリズム: %3$s、%4$s\n タイムスタンプ付加者: "%6$s" 日時: %5$tc\n タイムスタンプのダイジェスト・アルゴリズム: %7$s\n タイムスタンプの署名アルゴリズム: %8$s、%9$s history.without.ts=- 署名者: "%1$s"\n ダイジェスト・アルゴリズム: %2$s\n 署名アルゴリズム: %3$s、%4$s -history.nonexistent.entries=\u0020 警告: 存在しない署名済エントリ:\u0020 +history.nonexistent.entries=\ 警告: 存在しない署名済エントリ:\u0020 history.unparsable=- 署名関連ファイル%sを解析できません history.nosf=- 署名関連ファイルMETA-INF/%s.SFがありません history.nobk=- 署名関連ファイルMETA-INF/%s.SFのブロック・ファイルがありません @@ -113,18 +114,18 @@ with.algparams.weak=%2$sを使用した%1$s (弱) with.disabled=%s (無効) with.algparams.disabled=%2$sを使用した%1$s (無効) key.bit=%sキー -key.bit.weak=%sキー(弱い) +key.bit.weak=%sキー(弱) key.bit.disabled=%sキー(無効) nonexistent.entries.found=このjarには、存在しないファイルの署名済エントリが含まれます。詳細は、-verbose出力を参照してください。 external.file.attributes.detected=POSIXファイル権限またはsymlink(あるいはその両方)の属性が検出されました。署名中はこれらの属性は無視され、署名によって保護されません。 jarsigner.=jarsigner:\u0020 -signature.filename.must.consist.of.the.following.characters.A.Z.0.9.or.=シグネチャのファイル名に使用できる文字は、A-Z、0-9、_、- のみです。 +signature.filename.must.consist.of.the.following.characters.A.Z.0.9.or.=署名のファイル名に使用できる文字は、A-Z、0-9、_、- のみです unable.to.open.jar.file.=次のjarファイルを開くことができません:\u0020 unable.to.create.=作成できません:\u0020 -.adding.=\u0020 追加中:\u0020 -.updating.=\u0020更新中:\u0020 -.signing.=\u0020 署名中:\u0020 +.adding.=\ 追加中:\u0020 +.updating.=\ 更新中:\u0020 +.signing.=\ 署名中:\u0020 attempt.to.rename.signedJarFile.to.jarFile.failed={0}の名前を{1}に変更しようとしましたが失敗しました attempt.to.rename.jarFile.to.origJar.failed={0}の名前を{1}に変更しようとしましたが失敗しました unable.to.sign.jar.=jarに署名できません:\u0020 @@ -148,7 +149,7 @@ certificate.is.not.valid.until=証明書は{0}まで有効ではありません certificate.will.expire.on=証明書は{0}に失効します .Invalid.certificate.chain.=[無効な証明書チェーン:\u0020 .Invalid.TSA.certificate.chain.=[無効なTSA証明書チェーン:\u0020 -requesting.a.signature.timestamp=シグネチャ・タイムスタンプのリクエスト +requesting.a.signature.timestamp=署名タイムスタンプのリクエスト TSA.location.=TSAの場所:\u0020 TSA.certificate.=TSA証明書:\u0020 no.response.from.the.Timestamping.Authority.=タイムスタンプ局からのレスポンスがありません。ファイアウォールを介して接続するときは、必要に応じてHTTPまたはHTTPSプロキシを指定してください。jarsignerに次のオプションを指定してください: @@ -164,7 +165,7 @@ This.jar.contains.unsigned.entries.which.have.not.been.integrity.checked.=この This.jar.contains.entries.whose.signer.certificate.has.expired.=このjarには、署名者の証明書が期限切れのエントリが含まれています。\u0020 This.jar.contains.entries.whose.signer.certificate.will.expire.within.six.months.=このjarには、署名者の証明書が6か月以内に期限切れとなるエントリが含まれています。\u0020 This.jar.contains.entries.whose.signer.certificate.is.not.yet.valid.=このjarには、署名者の証明書がまだ有効になっていないエントリが含まれています。\u0020 -This.jar.contains.entries.whose.signer.certificate.is.self.signed.=このjarには、署名者の証明書が自己署名されているエントリが含まれています。\u0020 +This.jar.contains.entries.whose.signer.certificate.is.self.signed.=このjarには、署名者の証明書が自己署名されているエントリが含まれています。 Re.run.with.the.verbose.and.certs.options.for.more.details.=詳細は、-verboseおよび-certsオプションを使用して再実行してください。 The.signer.certificate.has.expired.=署名者の証明書は期限切れです。 The.timestamp.expired.1.but.usable.2=タイムスタンプは%1$tY-%1$tm-%1$tdに期限切れになります。ただし、JARは署名者の証明書が%2$tY-%2$tm-%2$tdに期限切れになるまで有効です。 @@ -188,9 +189,9 @@ The.1.algorithm.specified.for.the.2.option.is.considered.a.security.risk.and.is. The.timestamp.digest.algorithm.1.is.considered.a.security.risk..This.algorithm.will.be.disabled.in.a.future.update.=%1$sタイムスタンプ・ダイジェスト・アルゴリズムは、セキュリティ・リスクとみなされます。このアルゴリズムは将来の更新で無効化されます。 The.digest.algorithm.1.is.considered.a.security.risk..This.algorithm.will.be.disabled.in.a.future.update.=%1$sダイジェスト・アルゴリズムは、セキュリティ・リスクとみなされます。このアルゴリズムは将来の更新で無効化されます。 The.signature.algorithm.1.is.considered.a.security.risk..This.algorithm.will.be.disabled.in.a.future.update.=%1$s署名アルゴリズムは、セキュリティ・リスクとみなされます。このアルゴリズムは将来の更新で無効化されます。 -size.bit.alg=%1$dビット%2$s -The.full.keyAlgName.signing.key.is.considered.a.security.risk..It.will.be.disabled.in.a.future.update.=%s署名キーはセキュリティ・リスクとみなされます。今後の更新では無効になります。 -The.full.keyAlgName.signing.key.is.considered.a.security.risk.and.is.disabled.=%s署名キーはセキュリティ・リスクとみなされ、無効になっています。 +size.bit.alg=%1$d-ビット %2$s +The.full.keyAlgName.signing.key.is.considered.a.security.risk..It.will.be.disabled.in.a.future.update.=%s署名キーはセキュリティ・リスクとみなされます。これは将来の更新で無効化されます。 +The.full.keyAlgName.signing.key.is.considered.a.security.risk.and.is.disabled.=%s署名キーはセキュリティ・リスクとみなされ、無効化されています。 This.jar.contains.entries.whose.certificate.chain.is.invalid.reason.1=このjarには、証明書チェーンが無効なエントリが含まれています。理由: %s This.jar.contains.entries.whose.tsa.certificate.chain.is.invalid.reason.1=このjarには、TSA証明書チェーンが無効なエントリが含まれています。理由: %s no.timestamp.signing=-tsaまたは-tsacertが指定されていないため、このjarにはタイムスタンプが付加されていません。タイムスタンプがないと、署名者証明書の有効期限(%1$tY-%1$tm-%1$td)後に、ユーザーはこのjarを検証できない可能性があります。 @@ -205,3 +206,17 @@ Cannot.find.environment.variable.=環境変数が見つかりません:\u0020 Cannot.find.file.=ファイルが見つかりません:\u0020 event.ocsp.check=%sのOCSPサーバーに接続しています... event.crl.check=%sからCRLをダウンロードしています... +manifest.missing.when.reading.jarfile=JarFileを介して読み取るときにマニフェストがありません +manifest.missing.when.reading.jarinputstream=JarInputStreamを介して読み取るときにマニフェストがありません +manifest.attribute.1.present.when.reading.jarfile.but.missing.via.jarinputstream=マニフェストのメイン属性%sは、JarFileを介して読み取るときは存在しますが、JarInputStreamを介して読み取るときにはありません +manifest.attribute.1.present.when.reading.jarinputstream.but.missing.via.jarfile=マニフェストのメイン属性%sは、JarInputStreamを介して読み取るときは存在しますが、JarFileを介して読み取るときにはありません +manifest.attribute.1.differs.jarfile.value.2.jarinputstream.value.3=マニフェストのメイン属性%1$sが異なります: JarFileの値 = %2$s、JarInputStreamの値 = %3$s +entry.1.present.when.reading.jarinputstream.but.missing.via.jarfile=エントリ%sは、JarInputStreamを介して読み取るときは存在しますが、JarFileを介して読み取るときにはありません +entry.1.present.when.reading.jarfile.but.missing.via.jarinputstream=エントリ%sは、JarFileを介して読み取るときは存在しますが、JarInputStreamを介して読み取るときにはありません +entry.1.present.in.jarfile.but.unreadable=エントリ%sはJarFileに存在しますが読み取れません +codesigners.different.for.entry.1.when.reading.jarfile.and.jarinputstream=JarFileとJarInputStreamから読み取る場合のエントリ%sのコード署名者が異なります +entry.1.is.signed.in.jarfile.but.is.not.signed.in.jarinputstream=エントリ%sは、JarFileでは署名されていますが、JarInputStreamでは署名されていません +entry.1.is.signed.in.jarinputstream.but.is.not.signed.in.jarfile=エントリ%sは、JarInputStreamでは署名されていますが、JarFileでは署名されていません +jar.contains.internal.inconsistencies.result.in.different.contents.via.jarfile.and.jarinputstream=このJARファイルには内部的な不整合があるため、JarFileとJarInputStreamから読み取る場合にコンテンツが異なる可能性があります: +signature.verification.failed.on.entry.1.when.reading.via.jarinputstream=JarInputStreamを介して読み取るときに署名検証がエントリ%sで失敗しました +signature.verification.failed.on.entry.1.when.reading.via.jarfile=JarFileを介して読み取るときに署名検証がエントリ%sで失敗しました diff --git a/src/jdk.jartool/share/classes/sun/security/tools/jarsigner/resources/jarsigner_zh_CN.properties b/src/jdk.jartool/share/classes/sun/security/tools/jarsigner/resources/jarsigner_zh_CN.properties index 2558239039f..378cc3ba9fc 100644 --- a/src/jdk.jartool/share/classes/sun/security/tools/jarsigner/resources/jarsigner_zh_CN.properties +++ b/src/jdk.jartool/share/classes/sun/security/tools/jarsigner/resources/jarsigner_zh_CN.properties @@ -25,7 +25,7 @@ # shared (from jarsigner) SPACE=\u0020 -6SPACE=\u0020 \u0020 +6SPACE=\ \u0020 COMMA=,\u0020 provclass.not.a.provider=%s不是提供方 provider.name.not.found=未找到名为 "%s" 的提供方 @@ -37,8 +37,8 @@ Illegal.option.=非法选项:\u0020 If.protected.is.specified.then.storepass.and.keypass.must.not.be.specified=如果指定了 -protected, 则不能指定 -storepass 和 -keypass If.keystore.is.not.password.protected.then.storepass.and.keypass.must.not.be.specified=如果密钥库未受口令保护, 则不能指定 -storepass 和 -keypass Usage.jarsigner.options.jar.file.alias=用法: jarsigner [选项] jar-file 别名 -.jarsigner.verify.options.jar.file.alias.=\u0020 jarsigner -verify [选项] jar-file [别名...] -.jarsigner.version=\u0020 jarsigner -version +.jarsigner.verify.options.jar.file.alias.=\ jarsigner -verify [选项] jar-file [别名...] +.jarsigner.version=\ jarsigner -version .keystore.url.keystore.location=[-keystore ] 密钥库位置 .storepass.password.password.for.keystore.integrity=[-storepass <口令>] 用于密钥库完整性的口令 .storetype.type.keystore.type=[-storetype <类型>] 密钥库类型 @@ -51,7 +51,7 @@ Usage.jarsigner.options.jar.file.alias=用法: jarsigner [选项] jar-file 别 .verify.verify.a.signed.JAR.file=[-verify] 验证已签名的 JAR 文件 .version.print.the.program.version=[-version] 输出程序版本 .verbose.suboptions.verbose.output.when.signing.verifying.=[-verbose[:suboptions]] 签名/验证时输出详细信息。 -.suboptions.can.be.all.grouped.or.summary=\u0020 子选项可以是 all, grouped 或 summary +.suboptions.can.be.all.grouped.or.summary=\ 子选项可以是 all, grouped 或 summary .certs.display.certificates.when.verbose.and.verifying=[-certs] 输出详细信息和验证时显示证书 .certs.revocation.check=[-revCheck] 启用证书撤消检查 .tsa.url.location.of.the.Timestamping.Authority=[-tsa ] 时间戳颁发机构的位置 @@ -63,9 +63,9 @@ Usage.jarsigner.options.jar.file.alias=用法: jarsigner [选项] jar-file 别 .protected.keystore.has.protected.authentication.path=[-protected] 密钥库具有受保护验证路径 .providerName.name.provider.name=[-providerName <名称>] 提供方名称 .add.provider.option=[-addprovider <名称> 按名称 (例如 SunPKCS11) 添加安全提供方 -.providerArg.option.1=\u0020 [-providerArg <参数>]] ... 配置 -addprovider 的参数 +.providerArg.option.1=\ [-providerArg <参数>]] ... 配置 -addprovider 的参数 .providerClass.option=[-providerClass <类> 按全限定类名添加安全提供方 -.providerArg.option.2=\u0020 [-providerArg <参数>]] ... 配置 -providerClass 的参数 +.providerArg.option.2=\ [-providerArg <参数>]] ... 配置 -providerClass 的参数 .providerPath.option=[-providerPath ] 提供方类路径 .strict.treat.warnings.as.errors=[-strict] 将警告视为错误 .conf.url.specify.a.pre.configured.options.file=[-conf ] 指定预配置的选项文件 @@ -83,11 +83,11 @@ k=k X=X q=? .and.d.more.=(%d 及以上) -.s.signature.was.verified.=\u0020 s = 已验证签名\u0020 -.m.entry.is.listed.in.manifest=\u0020 m = 在清单中列出条目 -.k.at.least.one.certificate.was.found.in.keystore=\u0020 k = 在密钥库中至少找到了一个证书 -.X.not.signed.by.specified.alias.es.=\u0020 X = 未由指定别名签名 -.q.unsigned.entry=\u0020 ? = 未签名条目 +.s.signature.was.verified.=\ s = 已验证签名\u0020 +.m.entry.is.listed.in.manifest=\ m = 在清单中列出条目 +.k.at.least.one.certificate.was.found.in.keystore=\ k = 在密钥库中至少找到了一个证书 +.X.not.signed.by.specified.alias.es.=\ X = 未由指定别名签名 +.q.unsigned.entry=\ ? = 未签名条目 no.manifest.=没有清单。 .Signature.related.entries.=(与签名相关的条目) .Unsigned.entries.=(未签名条目) @@ -96,6 +96,7 @@ jar.is.unsigned=jar 未签名。 jar.treated.unsigned=警告: 签名无法解析或验证, 该 jar 将被视为未签名。有关详细信息, 请在启用调试的情况下重新运行 jarsigner (-J-Djava.security.debug=jar)。 jar.treated.unsigned.see.weak=由于该 jar 是使用目前已禁用的弱算法签名的, 因此该 jar 将被视为未签名。\n\n有关详细信息, 请使用 -verbose 选项重新运行 jarsigner。 jar.treated.unsigned.see.weak.verbose=警告: 该 jar 将被视为未签名, 因为它是由目前安全属性禁用的弱算法签名的: +multiple.manifest.warning.=在 jar 文件中检测到重复的清单条目。JarSigner 仅对其中一个条目进行了操作,其他条目都已放弃。 jar.signed.=jar 已签名。 jar.signed.with.signer.errors.=jar 已签名, 但出现签名者错误。 jar.verified.=jar 已验证。 @@ -103,28 +104,28 @@ jar.verified.with.signer.errors.=jar 已验证, 但出现签名者错误。 history.with.ts=- 由 "%1$s" 签名\n 摘要算法: %2$s\n 签名算法: %3$s, %4$s\n 由 "%6$s" 于 %5$tc 加时间戳\n 时间戳摘要算法: %7$s\n 时间戳签名算法: %8$s, %9$s history.without.ts=- 由 "%1$s" 签名\n 摘要算法: %2$s\n 签名算法: %3$s, %4$s -history.nonexistent.entries=警告:不存在的签名条目:\u0020 +history.nonexistent.entries=\ 警告:不存在的签名条目:\u0020 history.unparsable=- 无法解析的与签名相关的文件 %s history.nosf=- 缺少与签名相关的文件 META-INF/%s.SF history.nobk=- 与签名相关的文件 META-INF/%s.SF 缺少块文件 -with.weak=%s (弱) +with.weak=%s(弱) with.algparams.weak=%1$s 使用 %2$s(弱) with.disabled=%s(禁用) with.algparams.disabled=%1$s 使用 %2$s(禁用) key.bit=%s 密钥 key.bit.weak=%s 密钥(弱) -key.bit.disabled=%s 密钥(已禁用) +key.bit.disabled=%s 密钥(禁用) nonexistent.entries.found=此 jar 的文件包含不存在的签名条目。有关更多详细信息,请参见 -verbose 输出。 external.file.attributes.detected=检测到 POSIX 文件权限和/或 symlink 属性。这些属性在进行签名时会被忽略,不受该签名的保护。 -jarsigner.=jarsigner:\u0020 +jarsigner.=jarsigner:\u0020 signature.filename.must.consist.of.the.following.characters.A.Z.0.9.or.=签名文件名必须包含以下字符: A-Z, 0-9, _ 或 - unable.to.open.jar.file.=无法打开 jar 文件:\u0020 unable.to.create.=无法创建:\u0020 -.adding.=\u0020 正在添加:\u0020 -.updating.=\u0020正在更新:\u0020 -.signing.=\u0020 正在签名:\u0020 +.adding.=\ 正在添加:\u0020 +.updating.=\ 正在更新:\u0020 +.signing.=\ 正在签名:\u0020 attempt.to.rename.signedJarFile.to.jarFile.failed=尝试将{0}重命名为{1}时失败 attempt.to.rename.jarFile.to.origJar.failed=尝试将{0}重命名为{1}时失败 unable.to.sign.jar.=无法对 jar 进行签名:\u0020 @@ -151,12 +152,12 @@ certificate.will.expire.on=证书将在{0}到期 requesting.a.signature.timestamp=正在请求签名时间戳 TSA.location.=TSA 位置:\u0020 TSA.certificate.=TSA 证书:\u0020 -no.response.from.the.Timestamping.Authority.=时间戳颁发机构没有响应。如果要从防火墙后面连接, 则可能需要指定 HTTP 或 HTTPS 代理。请为 jarsigner 提供以下选项:\u0020 +no.response.from.the.Timestamping.Authority.=时间戳颁发机构没有响应。如果要从防火墙后面连接, 则可能需要指定 HTTP 或 HTTPS 代理。请为 jarsigner 提供以下选项: or=或 Certificate.not.found.for.alias.alias.must.reference.a.valid.KeyStore.entry.containing.an.X.509.public.key.certificate.for.the=找不到{0}的证书。{1}必须引用包含时间戳颁发机构的 X.509 公共密钥证书的有效密钥库条目。 entry.was.signed.on=条目的签名日期为 {0} -Warning.=警告:\u0020 -Error.=错误:\u0020 +Warning.=警告:\u0020 +Error.=错误:\u0020 ...Signer=>>> 签名者 ...TSA=>>> TSA trusted.certificate=可信证书 @@ -189,8 +190,8 @@ The.timestamp.digest.algorithm.1.is.considered.a.security.risk..This.algorithm.w The.digest.algorithm.1.is.considered.a.security.risk..This.algorithm.will.be.disabled.in.a.future.update.=%1$s 摘要算法被视为存在安全风险。此算法将在未来的更新中被禁用。 The.signature.algorithm.1.is.considered.a.security.risk..This.algorithm.will.be.disabled.in.a.future.update.=%1$s 签名算法被视为存在安全风险。此算法将在未来的更新中被禁用。 size.bit.alg=%1$d 位 %2$s -The.full.keyAlgName.signing.key.is.considered.a.security.risk..It.will.be.disabled.in.a.future.update.=%s 签名密钥被视为安全风险。在将来的更新中将禁用它。 -The.full.keyAlgName.signing.key.is.considered.a.security.risk.and.is.disabled.=%s 签名密钥被视为安全风险并被禁用。 +The.full.keyAlgName.signing.key.is.considered.a.security.risk..It.will.be.disabled.in.a.future.update.=%s 签名密钥被视为存在安全风险。它将在未来的更新中被禁用。 +The.full.keyAlgName.signing.key.is.considered.a.security.risk.and.is.disabled.=%s 签名密钥被视为存在安全风险而且被禁用。 This.jar.contains.entries.whose.certificate.chain.is.invalid.reason.1=此 jar 包含其证书链无效的条目。原因: %s This.jar.contains.entries.whose.tsa.certificate.chain.is.invalid.reason.1=此 jar 包含其 TSA 证书链无效的条目。原因: %s no.timestamp.signing=未提供 -tsa 或 -tsacert, 此 jar 没有时间戳。如果没有时间戳, 则在签名者证书的到期日期 (%1$tY-%1$tm-%1$td) 之后, 用户可能无法验证此 jar。 @@ -205,3 +206,17 @@ Cannot.find.environment.variable.=找不到环境变量:\u0020 Cannot.find.file.=找不到文件:\u0020 event.ocsp.check=正在联系位于 %s 的 OCSP 服务器... event.crl.check=正在从 %s 下载 CRL... +manifest.missing.when.reading.jarfile=通过 JarFile 读取时缺少清单 +manifest.missing.when.reading.jarinputstream=通过 JarInputStream 读取时缺少清单 +manifest.attribute.1.present.when.reading.jarfile.but.missing.via.jarinputstream=通过 JarFile 读取时,清单主属性 %s 存在,但通过 JarInputStream 读取时缺失 +manifest.attribute.1.present.when.reading.jarinputstream.but.missing.via.jarfile=通过 JarInputStream 读取时,清单主属性 %s 存在,但通过 JarFile 读取时缺失 +manifest.attribute.1.differs.jarfile.value.2.jarinputstream.value.3=清单主属性 %1$s 不同:JarFile 值 = %2$s,JarInputStream 值 = %3$s +entry.1.present.when.reading.jarinputstream.but.missing.via.jarfile=通过 JarInputStream 读取时,条目 %s 存在,但通过 JarFile 读取时缺失 +entry.1.present.when.reading.jarfile.but.missing.via.jarinputstream=通过 JarFile 读取时,条目 %s 存在,但通过 JarInputStream 读取时缺失 +entry.1.present.in.jarfile.but.unreadable=条目 %s 存在于 JarFile 中,但无法读取 +codesigners.different.for.entry.1.when.reading.jarfile.and.jarinputstream=从 JarFile 和 JarInputStream 读取时,条目 %s 的代码签名者不同 +entry.1.is.signed.in.jarfile.but.is.not.signed.in.jarinputstream=条目 %s 已在 JarFile 中签名,但未在 JarInputStream 中签名 +entry.1.is.signed.in.jarinputstream.but.is.not.signed.in.jarfile=条目 %s 已在 JarInputStream 中签名,但未在 JarFile 中签名 +jar.contains.internal.inconsistencies.result.in.different.contents.via.jarfile.and.jarinputstream=此 JAR 文件包含内部不一致,通过 JarFile 和 JarInputStream 读取时可能会导致内容不同: +signature.verification.failed.on.entry.1.when.reading.via.jarinputstream=通过 JarInputStream 读取时,条目 %s 的签名验证失败 +signature.verification.failed.on.entry.1.when.reading.via.jarfile=通过 JarFile 读取时,条目 %s 的签名验证失败 diff --git a/src/jdk.jartool/share/classes/sun/tools/jar/resources/jar_de.properties b/src/jdk.jartool/share/classes/sun/tools/jar/resources/jar_de.properties index e81bda89ef3..2a5786e10b4 100644 --- a/src/jdk.jartool/share/classes/sun/tools/jar/resources/jar_de.properties +++ b/src/jdk.jartool/share/classes/sun/tools/jar/resources/jar_de.properties @@ -1,5 +1,5 @@ # -# Copyright (c) 1999, 2024, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 1999, 2025, 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 @@ -58,6 +58,7 @@ error.missing.provider=Serviceprovider nicht gefunden: {0} error.release.value.notnumber=Release {0} nicht gültig error.release.value.toosmall=Release {0} nicht gültig, muss >= 9 sein error.release.unexpected.versioned.entry=Unerwarteter versionierte Eintrag {0} für Release {1} +error.release.value.toohigh.versioned.entry={0} hat Klassendateiversion {1}, aber Klassendateiversion {2} oder niedriger ist für Release {3} der Java-Plattform erforderlich error.date.notvalid=Datum {0} ist keine gültige erweiterte Datums-/Uhrzeitangabe mit Zeitunterschied und optionaler Zeitzone nach ISO-8601 error.date.out.of.range=Datum {0} liegt nicht im gültigen Bereich 1980-01-01T00:00:02Z bis 2099-12-31T23:59:59Z error.validator.jarfile.exception={0} kann nicht validiert werden: {1} @@ -82,6 +83,12 @@ error.validator.info.manclass.notequal={0}: module-info.class in einem versionie warn.validator.identical.entry=Warnung: Eintrag {0} enthält eine Klasse, die mit\neinem bereits in der JAR-Datei enthaltenen Eintrag identisch ist warn.validator.resources.with.same.name=Warnung: Eintrag {0}, mehrere Ressourcen mit demselben Namen warn.validator.concealed.public.class=Warnung: Eintrag {0} ist eine öffentliche Klasse\nin einem verdeckten Package. Wenn Sie diese JAR-Datei in den Classpath einfügen, kommt es\nzu nicht kompatiblen öffentlichen Schnittstellen +warn.validator.duplicate.cen.entry=Warnung: {0} zentrale Verzeichniseinträge für {1} gefunden +warn.validator.duplicate.loc.entry=Warnung: {0} lokale Dateiheader für {1} gefunden +warn.validator.invalid.entry.name=Warnung: Eintragsname {0} ist ungültig +warn.validator.cen.only.entry=Warnung: Kein Äquivalent für zentralen Verzeichniseintrag {0} in den lokalen Dateiheadern gefunden +warn.validator.loc.only.entry=Warnung: Kein äquivalenter Eintrag für den lokalen Dateiheader {0} im zentralen Verzeichnis gefunden +warn.validator.order.mismatch=Warnung: Zentrale Verzeichniseinträge und lokale Dateiheadereinträge sind nicht in derselben Reihenfolge warn.release.unexpected.versioned.entry=Unerwarteter versionierter Eintrag {0} warn.index.is.ignored=Der JAR-Index (META-INF/INDEX.LIST) wird seit JDK 18 zur Laufzeit ignoriert warn.flag.is.deprecated=Warnung: Die Option {0} ist veraltet und wird möglicherweise ignoriert oder in einem zukünftigen Release entfernt\n @@ -115,7 +122,9 @@ main.help.opt.main.list=\ -t, --list Das Inhaltsverzeichnis fü main.help.opt.main.update=\ -u, --update Ein vorhandenes JAR-Archiv aktualisieren main.help.opt.main.extract=\ -x, --extract Extrahiert benannte (oder alle) Dateien aus dem Archiv.\n Wenn eine Datei mit demselben Namen mehrmals im\n Archiv enthalten ist, wird jede Kopie extrahiert. Dabei überschreiben (ersetzen) neuere Kopien\n ältere Kopien, es sei denn, "-k" ist angegeben. main.help.opt.main.describe-module=\ -d, --describe-module Gibt den Moduldeskriptor oder automatischen Modulnamen aus -main.help.opt.main.validate=\ --validate Validiert den Inhalt des JAR-Archivs. Diese Option\n validiert, dass die von einem Multi-Release-JAR-Archiv\n exportierte API über die verschiedenen Releaseversionen\n hinweg konsistent ist. +main.help.opt.main.validate=\ --validate Validiert den Inhalt des JAR-Archivs. Diese Option:\n - Validiert, dass die von einem Multi-Release-JAR-Archiv\n exportierte API über die verschiedenen Releaseversionen\n hinweg konsistent ist.\n - Gibt eine Warnung aus, wenn ungültige oder doppelte Dateinamen vorhanden sind + + main.help.opt.any=\ In jedem Modus gültige Vorgangsmodifikatoren:\n\n -C DIR Zum angegebenen Verzeichnis wechseln und die folgende\n Datei aufnehmen. Bei Verwendung im Extraktionsmodus wird\n die JAR-Datei in das angegebene Verzeichnis extrahiert main.help.opt.any.file=\ -f, --file=FILE Der Name der Archivdatei. Wenn Sie dies auslassen, wird entweder stdin oder\n stdout verwendet, je nach Vorgang\n --release VERSION Speichert alle der folgenden Dateien in einem versionierten Verzeichnis\n der JAR-Datei (d.h. META-INF/versions/VERSION/) main.help.opt.any.verbose=\ -v, --verbose Verbose-Ausgabe bei Standardausgabe generieren @@ -139,5 +148,4 @@ main.help.opt.other.help=\ -?, -h, --help[:compat] Gibt diese Meldung oder o main.help.opt.other.help-extra=\ --help-extra Hilfe zu zusätzlichen Optionen main.help.opt.other.version=\ --version Programmversion ausgeben main.help.postopt=\ Ein Archiv ist ein modulares JAR-Archiv, wenn der Moduldeskriptor "module-info.class"\n in der Root der angegebenen Verzeichnisse oder in der Root des JAR-Archivs selbst\n vorhanden ist. Die folgenden Vorgänge sind nur gültig, wenn Sie ein modulares JAR-Archiv\n erstellen oder ein vorhandenes nicht modulares JAR-Archiv aktualisieren: "--module-version",\n "--hash-modules" und "--modulepath".\n\n Obligatorische oder optionale Argumente zu langen Optionen sind auch für die jeweils\n zugehörigen kurzen Optionen obligatorisch oder optional. -main.help.opt.extract=\ Vorgangsmodifikatoren, die nur im Extraktionsmodus gültig sind:\n main.help.opt.extract.dir=\ --dir Verzeichnis, in das die JAR-Datei extrahiert wird diff --git a/src/jdk.jartool/share/classes/sun/tools/jar/resources/jar_ja.properties b/src/jdk.jartool/share/classes/sun/tools/jar/resources/jar_ja.properties index 5be71c2e424..c7d7c14613a 100644 --- a/src/jdk.jartool/share/classes/sun/tools/jar/resources/jar_ja.properties +++ b/src/jdk.jartool/share/classes/sun/tools/jar/resources/jar_ja.properties @@ -1,5 +1,5 @@ # -# Copyright (c) 1999, 2024, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 1999, 2025, 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 @@ -58,6 +58,7 @@ error.missing.provider=サービス・プロバイダが見つかりません: { error.release.value.notnumber=リリース{0}は有効ではありません error.release.value.toosmall=リリース{0}は有効ではありません。9以上である必要があります error.release.unexpected.versioned.entry=リリース{1}で予期しないバージョニング済エントリ{0} +error.release.value.toohigh.versioned.entry={0}にはクラス・ファイル・バージョン{1}がありますが、Javaプラットフォームのリリース{3}をターゲットとするにはクラス・ファイル・バージョン{2}以下が必要です error.date.notvalid=日付{0}が、オプションのタイムゾーンを指定した、有効なISO-8601の拡張オフセットの日時ではありません error.date.out.of.range=日付{0}が有効な範囲1980-01-01T00:00:02Z to 2099-12-31T23:59:59Zにありません error.validator.jarfile.exception={0}を検証できません: {1} @@ -82,6 +83,12 @@ error.validator.info.manclass.notequal={0}: バージョニングされたディ warn.validator.identical.entry=警告 : エントリ{0}には、jarにすでに存在する\nエントリと同じクラスが含まれます warn.validator.resources.with.same.name=警告 : エントリ{0}、同じ名前を持つ複数のリソース warn.validator.concealed.public.class=警告 : エントリ{0}は、隠しパッケージ内のpublicクラスです。\nクラスパスにこのjarを配置すると、互換性のない\npublicインタフェースが生成されます +warn.validator.duplicate.cen.entry=警告: {1}に対して{0}の中央ディレクトリ・エントリがありました +warn.validator.duplicate.loc.entry=警告: {1}に対して{0}のローカル・ファイル・ヘッダーがありました +warn.validator.invalid.entry.name=警告: エントリ名{0}が無効です +warn.validator.cen.only.entry=警告: 中央ディレクトリ・エントリ{0}と同等のものがローカル・ファイル・ヘッダーに見つかりませんでした +warn.validator.loc.only.entry=警告: ローカル・ファイル・ヘッダー{0}と同等のエントリが中央ディレクトリに見つかりませんでした +warn.validator.order.mismatch=警告: 中央ディレクトリとローカル・ファイル・ヘッダーのエントリが同じ順序ではありません warn.release.unexpected.versioned.entry=予期しないバージョニング済エントリ{0} warn.index.is.ignored=JDK 18以降、JAR索引(META-INF/INDEX.LIST)は実行時に無視されます warn.flag.is.deprecated=警告: {0}オプションは非推奨であり、今後のリリースで無視または削除される可能性があります\n @@ -115,7 +122,9 @@ main.help.opt.main.list=\ -t、--list アーカイブの内容 main.help.opt.main.update=\ -u、--update 既存のjarアーカイブを更新します main.help.opt.main.extract=\ -x、--extract 指定の(またはすべての)ファイルをアーカイブから抽出します。\n 同じ名前のファイルがアーカイブに複数回出現する場合、\n 各コピーが抽出され、後のコピーにより、前のコピーが\n 上書き(置換)されます(-kが指定されている場合以外)。 main.help.opt.main.describe-module=\ -d, --describe-module モジュール・ディスクリプタまたは自動モジュール名を出力します -main.help.opt.main.validate=\ --validate jarアーカイブの内容を検証します。このオプションは\n 複数リリースのjarアーカイブでエクスポートされたAPIが\n すべての異なるリリース・バージョンで一貫していることを\n 検証します。 +main.help.opt.main.validate=\ --validate jarアーカイブの内容を検証します。このオプションは\n - 複数リリースのjarアーカイブでエクスポートされたAPIが\n すべての異なるリリース・バージョンで一貫していることを\n 検証します。\n - 無効または重複するファイル名がある場合は警告を発行します + + main.help.opt.any=\ どのモードでも有効な操作修飾子:\n\n -C DIR 指定のディレクトリに変更し、次のファイルを\n 取り込みます。抽出モードで使用されている場合、jarを\n 指定のディレクトリに抽出します main.help.opt.any.file=\ -f、--file=FILE アーカイブ・ファイル名。省略した場合、stdinまたは\n stdoutのいずれかが操作に基づいて使用されます\n --release VERSION 次のすべてのファイルをjarのバージョニングされたディレクトリ\n (つまり、META-INF/versions/VERSION/)に配置します main.help.opt.any.verbose=\ -v、--verbose 標準出力に詳細な出力を生成します @@ -139,5 +148,4 @@ main.help.opt.other.help=\ -?、-h、--help[:compat] これ(オプショ main.help.opt.other.help-extra=\ --help-extra 追加オプションのヘルプを提供します main.help.opt.other.version=\ --version プログラム・バージョンを出力します main.help.postopt=\ モジュール・ディスクリプタ'module-info.class'が指定のディレクトリのルートまたは\n jarアーカイブ自体のルートにある場合、アーカイブはモジュラjarです。\n 次の操作は、モジュラjarの作成時または既存の非モジュラjarの更新時に\n のみ有効です: '--module-version'、\n '--hash-modules'および'--module-path'。\n\n ロング・オプションへの必須またはオプションの引数は、対応するショート・オプション\n に対しても必須またはオプションになります。 -main.help.opt.extract=\ 抽出モードでのみ有効な操作修飾子:\n main.help.opt.extract.dir=\ --dir jarが抽出されるディレクトリ diff --git a/src/jdk.jartool/share/classes/sun/tools/jar/resources/jar_zh_CN.properties b/src/jdk.jartool/share/classes/sun/tools/jar/resources/jar_zh_CN.properties index 1f652d87029..1979f3e2386 100644 --- a/src/jdk.jartool/share/classes/sun/tools/jar/resources/jar_zh_CN.properties +++ b/src/jdk.jartool/share/classes/sun/tools/jar/resources/jar_zh_CN.properties @@ -1,5 +1,5 @@ # -# Copyright (c) 1999, 2024, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 1999, 2025, 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 @@ -58,6 +58,7 @@ error.missing.provider=未找到服务提供方: {0} error.release.value.notnumber=发行版 {0} 无效 error.release.value.toosmall=发行版 {0} 无效, 必须 >= 9 error.release.unexpected.versioned.entry=发行版 {1} 存在意外的版本化条目 {0} +error.release.value.toohigh.versioned.entry={0} 具有类文件版本 {1},但是 Java 平台的目标发行版 {3} 需要类文件版本 {2} 或更低版本 error.date.notvalid=日期 {0} 不是具有可选时区的有效 ISO-8601 扩展偏移日期时间 error.date.out.of.range=日期 {0} 不在 1980-01-01T00:00:02Z 到 2099-12-31T23:59:59Z 这一有效范围内 error.validator.jarfile.exception=无法验证 {0}: {1} @@ -82,6 +83,12 @@ error.validator.info.manclass.notequal={0}: 版本化目录中的 module-info.cl warn.validator.identical.entry=警告: 条目 {0} 包含与 jar 中的\n现有条目相同的类 warn.validator.resources.with.same.name=警告: 条目 {0}, 多个资源具有相同名称 warn.validator.concealed.public.class=警告: 条目 {0} 是已隐藏程序包中的\n公共类, 将此 jar 放置在类路径中\n将导致公共接口不兼容 +warn.validator.duplicate.cen.entry=警告:为 {1} 找到 {0} 个中央目录条目 +warn.validator.duplicate.loc.entry=警告:为 {1} 找到 {0} 个本地文件标头 +warn.validator.invalid.entry.name=警告:条目名称 {0} 无效 +warn.validator.cen.only.entry=警告:在本地文件标头中找不到中央目录条目 {0} 的等效条目 +warn.validator.loc.only.entry=警告:在中央目录中找不到本地文件标头 {0} 的等效条目 +warn.validator.order.mismatch=警告:中央目录和本地文件标头条目的顺序不同 warn.release.unexpected.versioned.entry=意外的版本化条目 {0} warn.index.is.ignored=自 JDK 18 起,在运行时忽略 JAR 索引 (META-INF/INDEX.LIST) warn.flag.is.deprecated=警告:{0} 选项已过时,可能会在未来发行版中忽略或删除。\n @@ -115,7 +122,9 @@ main.help.opt.main.list=\ -t, --list 列出档案的目录 main.help.opt.main.update=\ -u, --update 更新现有 jar 档案 main.help.opt.main.extract=\ -x, --extract 从档案中提取指定的(或所有)文件。\n 如果某个同名的文件在档案中出现多次,\n 则将提取每个副本,除非指定 -k,否则\n 后面的副本将覆盖(替换)前面的副本。 main.help.opt.main.describe-module=\ -d, --describe-module 输出模块描述符或自动模块名称 -main.help.opt.main.validate=\ --validate 验证 jar 档案的内容。此选项\n 将验证由多发行版 jar 档案导出\n 的 API 在所有不同的发行版本中\n 是否一致。 +main.help.opt.main.validate=\ --validate 验证 jar 档案的内容。此选项:\n - 验证由多发行版 jar 档案导出\n 的 API 在所有不同的发行版本中\n 是否一致。\n - 如果文件名无效或重复,则发出警告 + + main.help.opt.any=\ 在任意模式下有效的操作修饰符:\n\n -C DIR 更改为指定目录并包含\n 以下文件。在提取模式下使用时,\n 将 jar 提取到指定目录 main.help.opt.any.file=\ -f, --file=FILE 档案文件名。省略时, 基于操作\n 使用 stdin 或 stdout\n --release VERSION 将下面的所有文件都放在\n jar 的版本化目录中 (即 META-INF/versions/VERSION/) main.help.opt.any.verbose=\ -v, --verbose 在标准输出中生成详细输出 @@ -139,5 +148,4 @@ main.help.opt.other.help=\ -?, -h, --help[:compat] 提供此帮助,也可 main.help.opt.other.help-extra=\ --help-extra 提供额外选项的帮助 main.help.opt.other.version=\ --version 输出程序版本 main.help.postopt=\ 如果模块描述符 'module-info.class' 位于指定目录的\n 根目录中, 或者位于 jar 档案本身的根目录中, 则\n 该档案是一个模块化 jar。以下操作只在创建模块化 jar,\n 或更新现有的非模块化 jar 时有效: '--module-version',\n '--hash-modules' 和 '--module-path'。\n\n 如果为长选项提供了必需参数或可选参数, 则它们对于\n 任何对应的短选项也是必需或可选的。 -main.help.opt.extract=\ 仅在提取模式下有效的操作修饰符:\n main.help.opt.extract.dir=\ --dir jar 将提取到其中的目录 diff --git a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/Table.java b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/Table.java index 6ba40145e8f..572d489057e 100644 --- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/Table.java +++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/Table.java @@ -385,12 +385,12 @@ private Content toContent() { table.add(getTableBody()); main.add(table); } else { - var tablist = HtmlTree.DIV(HtmlStyles.tableTabs) - .put(HtmlAttr.ROLE, "tablist") - .put(HtmlAttr.ARIA_ORIENTATION, "horizontal"); + var tablist = HtmlTree.DIV(HtmlStyles.tableTabs); HtmlId defaultTabId = HtmlIds.forTab(id, 0); if (renderTabs) { + tablist.put(HtmlAttr.ROLE, "tablist") + .put(HtmlAttr.ARIA_ORIENTATION, "horizontal"); tablist.add(createTab(defaultTabId, HtmlStyles.activeTableTab, true, defaultTab)); for (var tab : tabs) { if (occurringTabs.contains(tab)) { diff --git a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/resources/standard.properties b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/resources/standard.properties index 76b223bf130..9b111cb5edf 100644 --- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/resources/standard.properties +++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/resources/standard.properties @@ -599,7 +599,7 @@ doclet.usage.excludedocfilessubdir.description=\ doclet.usage.group.parameters=\ ,... doclet.usage.group.description=\ - Group specified elements together in overview page.\n\ + Group specified packages or modules together in overview page.\n\ ':' can also be used anywhere in the argument as a separator. doclet.usage.legal-notices.parameters=\ diff --git a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/resources/standard_de.properties b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/resources/standard_de.properties index b4d3f94bad5..a725d415406 100644 --- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/resources/standard_de.properties +++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/resources/standard_de.properties @@ -1,5 +1,5 @@ # -# Copyright (c) 2010, 2024, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2010, 2025, 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 @@ -97,6 +97,9 @@ doclet.Record_component_in=Komponente von {0} erfassen doclet.Static_method_in=Statische Methode in {0} doclet.Search_tag_in=Tag suchen in {0} doclet.Method_in=Methode in {0} +doclet.System_property_in=Systemeigenschaft in {0} +doclet.External_specification_in=Externe Spezifikation in {0} +doclet.Section_in=Abschnitt in {0} doclet.module=Modul doclet.package=Package doclet.MalformedURL=Nicht wohlgeformte URL: {0} @@ -116,14 +119,14 @@ doclet.tag.invalid_input=Ungültige Eingabe: "{0}" doclet.tag.invalid=ungültiges @{0} doclet.Deprecated_API=Veraltete API doclet.Deprecated_API_Checkbox_Label=Veraltete API anzeigen in: -doclet.Deprecated_API_Checkbox_All_Releases=Alle +doclet.Deprecated_API_Checkbox_All_Releases=Alle umschalten doclet.Deprecated_API_Checkbox_Other_Releases=Sonstige doclet.Deprecated_Elements=Veraltete {0} doclet.Deprecated_Elements_Release_Column_Header=Veraltet in doclet.Deprecated_In_Release=Veraltet in {0} doclet.New_API=Neue API doclet.New_API_Checkbox_Label=Hinzugefügte API anzeigen in: -doclet.New_API_Checkbox_All_Releases=Alle +doclet.New_API_Checkbox_All_Releases=Alle umschalten doclet.New_Elements=Neue {0} doclet.New_Elements_Release_Column_Header=Hinzugefügt in doclet.New_Label=Neu @@ -133,6 +136,8 @@ doclet.Preview_API_Checkbox_Toggle_All=Alle umschalten doclet.Preview_JEP_URL=https://openjdk.org/jeps/{0} doclet.Preview_Label=Vorschau doclet.Preview_Mark=PREVIEW +doclet.Preview_Notes=Hinweise zur Vorschau-API +doclet.Preview_Notes_Elements=Elemente mit Vorschauhinweisen doclet.Restricted_Methods=Eingeschränkte Methoden doclet.Restricted_Mark=RESTRICTED doclet.searchTag=Suchtag @@ -174,13 +179,11 @@ doclet.Enclosing_Interface=Umschließende Schnittstelle: doclet.Inheritance_Tree=Vererbungsbaum doclet.DefinedIn=Definiert in doclet.ReferencedIn=Referenziert in -doclet.Section=Abschnitt -doclet.External_Specification=Externe Spezifikation doclet.External_Specifications=Externe Spezifikationen doclet.External_Specifications.All_Specifications=Alle Spezifikationen doclet.External_Specifications.no-host=Lokal doclet.Specification=Spezifikation -doclet.System_Property=Systemeigenschaft +doclet.Summary_Page=Zusammenfassung (Seite) doclet.systemProperties=Systemeigenschaften doclet.systemPropertiesSummary=Systemeigenschaften - Übersicht doclet.Window_Source_title=Quellcode @@ -195,8 +198,9 @@ doclet.search.show_more=Zusätzliche Ressourcen doclet.search.help_page_link=Hilfeseite # 0: a link to the help page with text above doclet.search.help_page_info= Die {0} enthält eine Einführung in den Umfang und die Syntax der JavaDoc-Suche. -doclet.search.keyboard_info= Sie können die - oder -Taste zusammen mit den Pfeiltasten nach links und rechts verwenden, um zwischen Ergebnisregisterkarten auf dieser Seite zu wechseln. -doclet.search.browser_info= Mit der URL-Vorlage unten können Sie diese Seite als Suchmaschine in Browsern konfigurieren, die dieses Feature unterstützen. Das Feature wurde erfolgreich mit Google Chrome und Mozilla Firefox getestet. Beachten Sie, dass andere Browser dieses Feature möglicherweise nicht unterstützen oder ein anderes URL-Format erfordern. +# 0: [V] 1: [^] 2: [<]/[>] (down, up, left and right arrow keys) +doclet.search.keyboard_info= Sie können mit den Tasten {0}/{1} zwischen Suchergebnissen und mit den Tasten {2} zwischen Ergebnisregisterkarten wechseln. +doclet.search.browser_info= Die unten stehende URL-Vorlage kann nützlich sein, um diese Seite als Suchmaschine oder Bookmarklet in Browsern zu konfigurieren, die dieses Feature unterstützen. doclet.search.redirect=Zum ersten Ergebnis umleiten # 0: a date @@ -286,7 +290,18 @@ doclet.help.search.refer=Eine vollständige Beschreibung der Suchfeatures finden doclet.help.search.spec.url=https://docs.oracle.com/en/java/javase/{0}/docs/specs/javadoc/javadoc-search-spec.html # The title for the Javadoc Search Specification doclet.help.search.spec.title=Javadoc-Suchspezifikation - +doclet.help.keyboard_navigation.title=Tastaturnavigation +doclet.help.keyboard_navigation.intro=Dokumentationsseiten enthalten Tastenkombinationen für den einfachen Zugriff auf häufige Navigationsaufgaben. +# Arguments in the messages below are elements representing various keyboard keys +doclet.help.keyboard_navigation.index=Verwenden Sie {0}, um auf einer beliebigen Seite auf das Sucheingabefeld zuzugreifen. +doclet.help.keyboard_navigation.filter=Verwenden Sie {0}, um in der Randleiste von Klassenseiten auf das Filtereingabefeld zuzugreifen. +doclet.help.keyboard_navigation.escape=Verwenden Sie {0}, um die Eingabe zu löschen und den Tastaturfokus von einem Eingabefeld zu entfernen. +doclet.help.keyboard_navigation.search=Verwenden Sie {0}/{1}/{2}, um Listenelemente auszuwählen, nachdem Sie einen Suchbegriff in ein Such- oder Filtereingabefeld eingegeben haben. +doclet.help.keyboard_navigation.tabs=Verwenden Sie {0}/{1}, um in Zusammenfassungstabellen mit Registerkarten zwischen Registerkarten zu wechseln. +doclet.help.releases.head=Releasedetails +doclet.help.releases.body.specify.top-level=Die Details für die einzelnen Module, Packages, Klassen oder Schnittstellen enthalten normalerweise das Release, in dem die Deklaration eingeführt wurde. +doclet.help.releases.body.specify.member=Wenn ein Member nach der anfänglichen Einführung der umschließenden Klasse oder Schnittstelle hinzugefügt wird, enthalten die Details des Members das Release, in dem es eingeführt wurde. +doclet.help.releases.body.refer=Auf einigen Übersichtsseiten ("Neue API", "Veraltet") können Sie den Inhalt der Seite nach dem Release filtern, in dem die Deklaration eingeführt oder eingestellt wurde. doclet.ClassUse_Packages.that.use.0=Packages, die {0} verwenden doclet.ClassUse_Uses.of.0.in.1=Verwendungen von {0} in {1} doclet.ClassUse_Classes.in.0.used.by.1=Von {1} verwendete Klassen in {0} @@ -501,6 +516,8 @@ doclet.usage.override-methods.description=Außer Kraft gesetzte Methoden im Absc doclet.usage.allow-script-in-comments.description=JavaScript in Dokumentationskommentaren und Optionen\nzulassen, die HTML-Code enthalten +doclet.usage.syntax-highlight.description=Syntaxhervorhebung für Codefragmente in {@snippet}-Tags\nund

    -Elementen aktivieren.
    +
     doclet.usage.xdocrootparent.parameters=< URL>
     doclet.usage.xdocrootparent.description=Ersetzt alle Vorkommen von @docRoot gefolgt von /.. in doc-Kommentaren durch\n
     
    diff --git a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/resources/standard_ja.properties b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/resources/standard_ja.properties
    index 31e745301b6..749ef5856b8 100644
    --- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/resources/standard_ja.properties
    +++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/resources/standard_ja.properties
    @@ -1,5 +1,5 @@
     #
    -# Copyright (c) 2010, 2024, Oracle and/or its affiliates. All rights reserved.
    +# Copyright (c) 2010, 2025, 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
    @@ -97,6 +97,9 @@ doclet.Record_component_in={0}のレコード・コンポーネント
     doclet.Static_method_in={0}のstaticメソッド
     doclet.Search_tag_in={0}の検索タグ
     doclet.Method_in={0}のメソッド
    +doclet.System_property_in={0}のシステム・プロパティ
    +doclet.External_specification_in={0}の外部仕様
    +doclet.Section_in={0}のセクション
     doclet.module=モジュール
     doclet.package=パッケージ
     doclet.MalformedURL=不正なURL: {0}
    @@ -116,14 +119,14 @@ doclet.tag.invalid_input=入力が無効です: ''{0}''
     doclet.tag.invalid=@{0}が無効です
     doclet.Deprecated_API=推奨されていないAPI
     doclet.Deprecated_API_Checkbox_Label=次で非推奨のAPIを表示:
    -doclet.Deprecated_API_Checkbox_All_Releases=すべて
    +doclet.Deprecated_API_Checkbox_All_Releases=すべて設定
     doclet.Deprecated_API_Checkbox_Other_Releases=その他
     doclet.Deprecated_Elements=推奨されていない{0}
     doclet.Deprecated_Elements_Release_Column_Header=次で非推奨
     doclet.Deprecated_In_Release={0}で非推奨
     doclet.New_API=新規API
     doclet.New_API_Checkbox_Label=次で追加されたAPIを表示:
    -doclet.New_API_Checkbox_All_Releases=すべて
    +doclet.New_API_Checkbox_All_Releases=すべて設定
     doclet.New_Elements=新規{0}
     doclet.New_Elements_Release_Column_Header=次で追加
     doclet.New_Label=新規
    @@ -133,6 +136,8 @@ doclet.Preview_API_Checkbox_Toggle_All=すべて設定
     doclet.Preview_JEP_URL=https://openjdk.org/jeps/{0}
     doclet.Preview_Label=プレビュー
     doclet.Preview_Mark=PREVIEW
    +doclet.Preview_Notes=プレビューAPIのノート
    +doclet.Preview_Notes_Elements=プレビュー・ノートを含む要素
     doclet.Restricted_Methods=制限されたメソッド
     doclet.Restricted_Mark=RESTRICTED
     doclet.searchTag=検索タグ
    @@ -174,13 +179,11 @@ doclet.Enclosing_Interface=含まれているインタフェース:
     doclet.Inheritance_Tree=継承ツリー
     doclet.DefinedIn=定義先
     doclet.ReferencedIn=参照
    -doclet.Section=セクション
    -doclet.External_Specification=外部仕様
     doclet.External_Specifications=外部仕様
     doclet.External_Specifications.All_Specifications=すべての仕様
     doclet.External_Specifications.no-host=ローカル
     doclet.Specification=仕様
    -doclet.System_Property=システム・プロパティ
    +doclet.Summary_Page=サマリー・ページ
     doclet.systemProperties=システム・プロパティ
     doclet.systemPropertiesSummary=システム・プロパティ・サマリー
     doclet.Window_Source_title=ソース・コード
    @@ -195,8 +198,9 @@ doclet.search.show_more=その他のリソース
     doclet.search.help_page_link=ヘルプ・ページ
     # 0: a link to the help page with text above
     doclet.search.help_page_info= {0}では、JavaDoc検索の範囲および構文の概要について説明します。
    -doclet.search.keyboard_info= またはキーを左右の矢印キーと組み合せて使用すると、このページの結果タブを切り替えることができます。
    -doclet.search.browser_info= 次のURLテンプレートは、この機能をサポートするブラウザでこのページを検索エンジンとして構成するために使用できます。Google ChromeおよびMozilla Firefoxで動作することがテストされています。他のブラウザでは、この機能がサポートされていないか、別のURL形式が必要になる場合があります。
    +# 0: [V] 1: [^] 2: [<]/[>] (down, up, left and right arrow keys)
    +doclet.search.keyboard_info= {0}/{1}キーを使用して検索結果間を移動し、{2}キーを使用して結果タブ間を切り替えます。
    +doclet.search.browser_info= 下のURLテンプレートは、この機能をサポートするブラウザで検索エンジンまたはブックマークとして、このページを構成するのに役立つ可能性があります。
     doclet.search.redirect=最初の結果にリダイレクト
     
     # 0: a date
    @@ -286,7 +290,18 @@ doclet.help.search.refer=検索機能の詳細な説明は、{0}を参照して
     doclet.help.search.spec.url=https://docs.oracle.com/en/java/javase/{0}/docs/specs/javadoc/javadoc-search-spec.html
     # The title for the Javadoc Search Specification
     doclet.help.search.spec.title=Javadoc検索仕様
    -
    +doclet.help.keyboard_navigation.title=キーボード・ナビゲーション
    +doclet.help.keyboard_navigation.intro=ドキュメント・ページは、一般的なナビゲーション・タスクへのアクセスを容易にするキーボード・ショートカットを提供します。
    +# Arguments in the messages below are  elements representing various keyboard keys
    +doclet.help.keyboard_navigation.index=任意のページの検索入力フィールドにアクセスするには{0}と入力します。
    +doclet.help.keyboard_navigation.filter=クラス・ページのサイドバーのフィルタ入力フィールドにアクセスするには{0}と入力します。
    +doclet.help.keyboard_navigation.escape=任意の入力フィールドの入力をクリアし、キーボード・フォーカスを解放するには{0}と入力します。
    +doclet.help.keyboard_navigation.search=検索またはフィルタ入力フィールドに検索語を入力した後でリスト項目を選択するには{0}/{1}/{2}と入力します。
    +doclet.help.keyboard_navigation.tabs=タブ付きサマリー表のタブ間を切り替えるには{0}/{1}と入力します。
    +doclet.help.releases.head=リリース詳細
    +doclet.help.releases.body.specify.top-level=各モジュール、パッケージ、クラスまたはインタフェースの詳細には、通常、宣言が導入されたリリースが含まれます。
    +doclet.help.releases.body.specify.member=含まれているクラスまたはインタフェースの初期導入後にメンバーが追加された場合、メンバーの詳細にはそれが導入されたリリースが含まれます。
    +doclet.help.releases.body.refer=一部のサマリー・ページ(新規API、非推奨)では、宣言が導入または非推奨化されたリリースに従ってページのコンテンツをフィルタできます。
     doclet.ClassUse_Packages.that.use.0={0}を使用しているパッケージ
     doclet.ClassUse_Uses.of.0.in.1={1}での{0}の使用
     doclet.ClassUse_Classes.in.0.used.by.1={1}により使用される{0}のクラス
    @@ -501,6 +516,8 @@ doclet.usage.override-methods.description=オーバーライドされたメソ
     
     doclet.usage.allow-script-in-comments.description=ドキュメント・コメント、および値がhtml-codeであるオプションで\nJavaScriptを許可します
     
    +doclet.usage.syntax-highlight.description={@snippet}タグおよび
    要素のコード・フラグメントの\n構文ハイライト表示を有効にします。
    +
     doclet.usage.xdocrootparent.parameters=
     doclet.usage.xdocrootparent.description=docコメント内の/..が後に続く@docRootのすべてをで置換します
     
    diff --git a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/resources/standard_zh_CN.properties b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/resources/standard_zh_CN.properties
    index 36e27355b63..4bb154065b6 100644
    --- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/resources/standard_zh_CN.properties
    +++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/resources/standard_zh_CN.properties
    @@ -1,5 +1,5 @@
     #
    -# Copyright (c) 2010, 2024, Oracle and/or its affiliates. All rights reserved.
    +# Copyright (c) 2010, 2025, 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
    @@ -97,6 +97,9 @@ doclet.Record_component_in={0} 的记录组件
     doclet.Static_method_in={0}中的静态方法
     doclet.Search_tag_in={0}中的搜索标记
     doclet.Method_in={0}中的方法
    +doclet.System_property_in={0} 中的系统属性
    +doclet.External_specification_in={0} 中的外部规范
    +doclet.Section_in={0} 中的节
     doclet.module=模块
     doclet.package=程序包
     doclet.MalformedURL=格式错误的 URL: {0}
    @@ -116,14 +119,14 @@ doclet.tag.invalid_input=无效输入:''{0}''
     doclet.tag.invalid=@{0} 无效
     doclet.Deprecated_API=已过时的 API
     doclet.Deprecated_API_Checkbox_Label=显示在以下发行版中已过时的 API:
    -doclet.Deprecated_API_Checkbox_All_Releases=全部
    +doclet.Deprecated_API_Checkbox_All_Releases=全部切换
     doclet.Deprecated_API_Checkbox_Other_Releases=其他
     doclet.Deprecated_Elements=已过时的 {0}
     doclet.Deprecated_Elements_Release_Column_Header=在以下发行版中已过时
     doclet.Deprecated_In_Release=在 {0} 中已过时
     doclet.New_API=新建 API
     doclet.New_API_Checkbox_Label=显示在以下发行版中添加的 API:
    -doclet.New_API_Checkbox_All_Releases=全部
    +doclet.New_API_Checkbox_All_Releases=全部切换
     doclet.New_Elements=新建 {0}
     doclet.New_Elements_Release_Column_Header=在以下发行版中已添加
     doclet.New_Label=新建
    @@ -133,6 +136,8 @@ doclet.Preview_API_Checkbox_Toggle_All=全部切换
     doclet.Preview_JEP_URL=https://openjdk.org/jeps/{0}
     doclet.Preview_Label=预览
     doclet.Preview_Mark=PREVIEW
    +doclet.Preview_Notes=预览 API 注释
    +doclet.Preview_Notes_Elements=包含预览注释的元素
     doclet.Restricted_Methods=受限制的方法
     doclet.Restricted_Mark=RESTRICTED
     doclet.searchTag=搜索标记
    @@ -174,13 +179,11 @@ doclet.Enclosing_Interface=封闭接口:
     doclet.Inheritance_Tree=继承树
     doclet.DefinedIn=定义位置
     doclet.ReferencedIn=参考位置
    -doclet.Section=节
    -doclet.External_Specification=外部规范
     doclet.External_Specifications=外部规范
     doclet.External_Specifications.All_Specifications=所有规范
     doclet.External_Specifications.no-host=本地
     doclet.Specification=规范
    -doclet.System_Property=系统属性
    +doclet.Summary_Page=概要页
     doclet.systemProperties=系统属性
     doclet.systemPropertiesSummary=系统属性概要
     doclet.Window_Source_title=源代码
    @@ -195,8 +198,9 @@ doclet.search.show_more=其他资源
     doclet.search.help_page_link=帮助页
     # 0: a link to the help page with text above
     doclet.search.help_page_info= {0} 介绍了 JavaDoc 搜索的范围和语法。
    -doclet.search.keyboard_info= 您可以使用  键与左箭头和右箭头键组合在此页面中的结果选项卡之间切换。
    -doclet.search.browser_info= 下面的 URL 模板可用于在支持此功能的浏览器中将此页面配置为搜索引擎。已经对其进行了测试以在 Google Chrome 和 Mozilla Firefox 中使用。请注意,其他浏览器可能不支持此功能或需要不同的 URL 格式。
    +# 0: [V] 1: [^] 2: [<]/[>] (down, up, left and right arrow keys)
    +doclet.search.keyboard_info= 使用 {0}/{1} 键在搜索结果之间移动,使用 {2} 键在结果选项卡之间切换。
    +doclet.search.browser_info= 下面的 URL 模板可能有助于在支持此功能的浏览器中将此页面配置为搜索引擎或 bookmarklet。
     doclet.search.redirect=重定向到第一个结果
     
     # 0: a date
    @@ -286,7 +290,18 @@ doclet.help.search.refer=有关搜索功能的完整说明,请参阅 {0}。
     doclet.help.search.spec.url=https://docs.oracle.com/en/java/javase/{0}/docs/specs/javadoc/javadoc-search-spec.html
     # The title for the Javadoc Search Specification
     doclet.help.search.spec.title=Javadoc 搜索规范
    -
    +doclet.help.keyboard_navigation.title=键盘导航
    +doclet.help.keyboard_navigation.intro=文档页面提供键盘快捷键,以方便访问常见的导航任务。
    +# Arguments in the messages below are  elements representing various keyboard keys
    +doclet.help.keyboard_navigation.index=键入 {0} 以访问任何页面中的搜索输入字段。
    +doclet.help.keyboard_navigation.filter=键入 {0} 以访问类页面子工具栏中的筛选器输入字段。
    +doclet.help.keyboard_navigation.escape=键入 {0} 以清除任何输入字段中的输入并释放键盘焦点。
    +doclet.help.keyboard_navigation.search=在搜索或筛选器输入字段中输入搜索词后,键入 {0}/{1}/{2} 以选择列表项。
    +doclet.help.keyboard_navigation.tabs=键入 {0}/{1} 以在选项卡式概要表中的选项卡之间切换。
    +doclet.help.releases.head=发行版详细信息
    +doclet.help.releases.body.specify.top-level=每个模块、程序包、类或接口的详细信息通常包括引入声明的发行版。
    +doclet.help.releases.body.specify.member=当在最初引入封闭类或接口后添加成员时,成员的详细信息包括引入它的发行版。
    +doclet.help.releases.body.refer=某些概要页(新建 API、已过时)允许您根据声明被引入或已过时的发行版筛选页面的内容。
     doclet.ClassUse_Packages.that.use.0=使用{0}的程序包
     doclet.ClassUse_Uses.of.0.in.1={1}中{0}的使用
     doclet.ClassUse_Classes.in.0.used.by.1={1}使用的{0}中的类
    @@ -501,6 +516,8 @@ doclet.usage.override-methods.description=在详细信息部分或概要部分
     
     doclet.usage.allow-script-in-comments.description=允许在文档注释和选项中使用 JavaScript\n其值为 html-code
     
    +doclet.usage.syntax-highlight.description=为 {@snippet} 标记和 
     元素中的代码片段\n启用语法突出显示。
    +
     doclet.usage.xdocrootparent.parameters=
     doclet.usage.xdocrootparent.description=将文档注释中出现的所有后跟 /.. 的 @docRoot 替换为\n
     
    diff --git a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/resources/stylesheet.css b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/resources/stylesheet.css
    index 2c10cb3bc6f..f7994c7f7ed 100644
    --- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/resources/stylesheet.css
    +++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/resources/stylesheet.css
    @@ -29,8 +29,8 @@
         --block-line-height: 1.5;
         --code-line-height: 1.6;
         /* Text colors for body and block elements */
    -    --body-text-color: #282828;
    -    --block-text-color: #282828;
    +    --body-text-color: #181818;
    +    --block-text-color: #181818;
         /* Background colors for various elements */
         --body-background-color: #ffffff;
         --section-background-color: var(--body-background-color);
    @@ -656,14 +656,14 @@ ul.preview-feature-list input {
     .class-use-page .caption span,
     .package-use-page .caption span,
     .constants-summary-page .caption span,
    -.inherited-list.expanded h3 {
    +.inherited-list h3 {
         background-color: var(--subnav-background-color);
         color: var(--block-text-color);
     }
     .caption a:link,
     .caption a:visited,
    -.inherited-list.expanded h3 a:link,
    -.inherited-list.expanded h3 a:visited {
    +.inherited-list h3 a:link,
    +.inherited-list h3 a:visited {
         color:var(--subnav-link-color);
     }
     div.table-tabs {
    diff --git a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/resources/doclets_de.properties b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/resources/doclets_de.properties
    index 7ab2d3fc1dc..0ee34071c93 100644
    --- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/resources/doclets_de.properties
    +++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/resources/doclets_de.properties
    @@ -1,5 +1,5 @@
     #
    -# Copyright (c) 2010, 2024, Oracle and/or its affiliates. All rights reserved.
    +# Copyright (c) 2010, 2025, 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
    @@ -218,14 +218,15 @@ doclet.Annotation_Type_Optional_Members=Optionale Elemente
     doclet.Annotation_Type_Required_Members=Erforderliche Elemente
     doclet.Enum_Constants=Enum-Konstanten
     doclet.Nested_Classes=Verschachtelte Klassen
    -doclet.Modifier=Modifizierer
    +doclet.Modifier=Modifikator
     doclet.Type=Typ
    -doclet.Modifier_and_Type=Modifizierer und Typ
    +doclet.Modifier_and_Type=Modifikator und Typ
     doclet.Implementation=Implementierung(en):
     doclet.search=Suchen
    -doclet.search_placeholder=Suchen
    +doclet.search_placeholder=In Dokumentation suchen ("/" eingeben)
     doclet.search_in_documentation=In Dokumentation suchen
     doclet.search_reset=Zurücksetzen
    +doclet.Member=Mitglied
     doclet.Field=Feld
     doclet.Property=Eigenschaft
     doclet.Constructor=Konstruktor
    @@ -241,7 +242,7 @@ doclet.Value=Wert
     doclet.table_of_contents=Inhaltsverzeichnis
     doclet.hide_sidebar=Randleiste ausblenden
     doclet.show_sidebar=Randleiste einblenden
    -doclet.filter_label=Filter
    +doclet.filter_label=Inhalt filtern ("." eingeben)
     doclet.filter_table_of_contents=Inhaltsverzeichnis filtern
     doclet.filter_reset=Zurücksetzen
     doclet.linkMismatch_PackagedLinkedtoModule=Der Code, der dokumentiert wird, verwendet Packages im unbenannten Modul, aber die in {0} definierten Packages befinden sich in benannten Modulen.
    @@ -313,12 +314,16 @@ doclet.search.many_results={0} Ergebnisse gefunden
     doclet.search.loading=Suchindex wird geladen...
     doclet.search.searching=Suche wird ausgeführt...
     doclet.search.redirecting=Zum ersten Ergebnis wird umgeleitet...
    +# {0} is a select input containing all_modules message below and module names
    +doclet.search.in=in {0}
    +doclet.search.all_modules=allen Modulen
     doclet.search.modules=Module
     doclet.search.packages=Packages
     doclet.search.classes_and_interfaces=Klassen und Schnittstellen
     doclet.search.types=Typen
     doclet.search.members=Mitglieder
     doclet.search.search_tags=Tags suchen
    +doclet.search.linkSearchPageLabel=Gehe zur Suchseite
     
     doclet.snippet.contents.none=@snippet gibt keinen Inhalt an
     
    @@ -353,3 +358,6 @@ doclet.cannot_use_snippet_path=Option --snippet-path kann mit dem gegebenen Date
     
     # 0: path; 1: exception
     doclet.error_setting_snippet_path=Fehler beim Festlegen von Snippet-Pfad {0}: {1}
    +
    +# 0: location
    +doclet.error.snippet.ambiguous.link=Snippet-Linktags: {0} und {1} überschneiden sich in {2}
    diff --git a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/resources/doclets_ja.properties b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/resources/doclets_ja.properties
    index 28126387ead..2b10f4e6e9a 100644
    --- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/resources/doclets_ja.properties
    +++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/resources/doclets_ja.properties
    @@ -1,5 +1,5 @@
     #
    -# Copyright (c) 2010, 2024, Oracle and/or its affiliates. All rights reserved.
    +# Copyright (c) 2010, 2025, 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
    @@ -223,9 +223,10 @@ doclet.Type=タイプ
     doclet.Modifier_and_Type=修飾子とタイプ
     doclet.Implementation=実装:
     doclet.search=検索
    -doclet.search_placeholder=検索
    +doclet.search_placeholder=ドキュメントの検索(/と入力)
     doclet.search_in_documentation=ドキュメントで検索
     doclet.search_reset=リセット
    +doclet.Member=メンバー
     doclet.Field=フィールド
     doclet.Property=プロパティ
     doclet.Constructor=コンストラクタ
    @@ -241,7 +242,7 @@ doclet.Value=値
     doclet.table_of_contents=目次
     doclet.hide_sidebar=サイドバーの非表示
     doclet.show_sidebar=サイドバーの表示
    -doclet.filter_label=フィルタ
    +doclet.filter_label=コンテンツのフィルタ(.と入力)
     doclet.filter_table_of_contents=目次のフィルタ
     doclet.filter_reset=リセット
     doclet.linkMismatch_PackagedLinkedtoModule=ドキュメント化しようとしているコードでは名前のないモジュールのパッケージが使用されていますが、{0}で定義されているパッケージは名前のあるモジュールのものです。
    @@ -313,12 +314,16 @@ doclet.search.many_results={0}の結果が見つかりました
     doclet.search.loading=検索索引をロード中...
     doclet.search.searching=検索中...
     doclet.search.redirecting=最初の結果にリダイレクト中...
    +# {0} is a select input containing all_modules message below and module names
    +doclet.search.in={0}内
    +doclet.search.all_modules=すべてのモジュール
     doclet.search.modules=モジュール
     doclet.search.packages=パッケージ
     doclet.search.classes_and_interfaces=クラスとインタフェース
     doclet.search.types=タイプ
     doclet.search.members=メンバー
     doclet.search.search_tags=タグの検索
    +doclet.search.linkSearchPageLabel=検索ページに移動します
     
     doclet.snippet.contents.none=@snippetにコンテンツが指定されていません
     
    @@ -353,3 +358,6 @@ doclet.cannot_use_snippet_path=指定されたファイル・マネージャで'
     
     # 0: path; 1: exception
     doclet.error_setting_snippet_path=スニペットのパス{0}の設定中にエラーが発生しました: {1}
    +
    +# 0: location
    +doclet.error.snippet.ambiguous.link=スニペット・リンク・タグ: {2}の{0}と{1}の重複
    diff --git a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/resources/doclets_zh_CN.properties b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/resources/doclets_zh_CN.properties
    index e2722f1deab..f2c8762b283 100644
    --- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/resources/doclets_zh_CN.properties
    +++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/resources/doclets_zh_CN.properties
    @@ -1,5 +1,5 @@
     #
    -# Copyright (c) 2010, 2024, Oracle and/or its affiliates. All rights reserved.
    +# Copyright (c) 2010, 2025, 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
    @@ -223,9 +223,10 @@ doclet.Type=类型
     doclet.Modifier_and_Type=修饰符和类型
     doclet.Implementation=实现:
     doclet.search=搜索
    -doclet.search_placeholder=搜索
    +doclet.search_placeholder=搜索文档(键入 /)
     doclet.search_in_documentation=在文档中搜索
     doclet.search_reset=重置
    +doclet.Member=成员
     doclet.Field=字段
     doclet.Property=属性
     doclet.Constructor=构造器
    @@ -241,7 +242,7 @@ doclet.Value=值
     doclet.table_of_contents=目录
     doclet.hide_sidebar=隐藏子工具栏
     doclet.show_sidebar=显示子工具栏
    -doclet.filter_label=筛选器
    +doclet.filter_label=筛选内容(键入 .)
     doclet.filter_table_of_contents=筛选目录
     doclet.filter_reset=重置
     doclet.linkMismatch_PackagedLinkedtoModule=进行文档化的代码使用了未命名模块中的程序包,但在 {0} 中定义的程序包在命名模块中。
    @@ -313,12 +314,16 @@ doclet.search.many_results=找到 {0} 个结果
     doclet.search.loading=正在加载搜索索引...
     doclet.search.searching=正在搜索...
     doclet.search.redirecting=正在重定向到第一个结果...
    +# {0} is a select input containing all_modules message below and module names
    +doclet.search.in=在 {0} 中
    +doclet.search.all_modules=全部模块
     doclet.search.modules=模块
     doclet.search.packages=程序包
     doclet.search.classes_and_interfaces=类和接口
     doclet.search.types=类型
     doclet.search.members=成员
     doclet.search.search_tags=搜索标记
    +doclet.search.linkSearchPageLabel=转至搜索页
     
     doclet.snippet.contents.none=@snippet 未指定内容
     
    @@ -353,3 +358,6 @@ doclet.cannot_use_snippet_path=不能将 ''--snippet-path'' 选项与给定的
     
     # 0: path; 1: exception
     doclet.error_setting_snippet_path=设置片段路径 {0} 时出错:{1}
    +
    +# 0: location
    +doclet.error.snippet.ambiguous.link=片段链接标记:{0} 和 {1} 在 {2} 中重叠
    diff --git a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/tool/resources/javadoc_de.properties b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/tool/resources/javadoc_de.properties
    index 4d0e7bae176..7829d2d7e27 100644
    --- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/tool/resources/javadoc_de.properties
    +++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/tool/resources/javadoc_de.properties
    @@ -1,5 +1,5 @@
     #
    -# Copyright (c) 1997, 2024, Oracle and/or its affiliates. All rights reserved.
    +# Copyright (c) 1997, 2025, 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
    @@ -32,6 +32,8 @@ main.warning={0} Warnung
     
     main.usage=Verwendung:\n    javadoc [options] [packagenames] [sourcefiles] [@files]\nmit folgenden Optionen:
     
    +main.usage.short=Verwendung:\n    javadoc [options] [packagenames] [sourcefiles] [@files]
    +
     main.did-you-mean=Meinten Sie: {0}
     
     main.did-you-mean-one-of=Meinten Sie eine der folgenden Optionen: {0}
    diff --git a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/tool/resources/javadoc_ja.properties b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/tool/resources/javadoc_ja.properties
    index 42765ab4ded..da267939d3e 100644
    --- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/tool/resources/javadoc_ja.properties
    +++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/tool/resources/javadoc_ja.properties
    @@ -1,5 +1,5 @@
     #
    -# Copyright (c) 1997, 2024, Oracle and/or its affiliates. All rights reserved.
    +# Copyright (c) 1997, 2025, 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
    @@ -32,6 +32,8 @@ main.warning=警告{0}個
     
     main.usage=使用方法:\n    javadoc [options] [packagenames] [sourcefiles] [@files]\nオプションは次のとおりです:
     
    +main.usage.short=使用方法:\n    javadoc [options] [packagenames] [sourcefiles] [@files]
    +
     main.did-you-mean=もしかして: {0}
     
     main.did-you-mean-one-of=もしかして次のいずれかですか: {0}
    diff --git a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/tool/resources/javadoc_zh_CN.properties b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/tool/resources/javadoc_zh_CN.properties
    index 27053b44753..0305eaf7743 100644
    --- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/tool/resources/javadoc_zh_CN.properties
    +++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/tool/resources/javadoc_zh_CN.properties
    @@ -1,5 +1,5 @@
     #
    -# Copyright (c) 1997, 2024, Oracle and/or its affiliates. All rights reserved.
    +# Copyright (c) 1997, 2025, 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
    @@ -32,6 +32,8 @@ main.warning={0} 个警告
     
     main.usage=用法:\n    javadoc [options] [packagenames] [sourcefiles] [@files]\n其中, 选项包括:
     
    +main.usage.short=用法:\n    javadoc [options] [packagenames] [sourcefiles] [@files]
    +
     main.did-you-mean=您要查找的是:{0}
     
     main.did-you-mean-one-of=您要查找的是以下项之一:{0}
    diff --git a/src/jdk.javadoc/share/man/javadoc.md b/src/jdk.javadoc/share/man/javadoc.md
    index 2ba64dfb2e5..920b16f55b4 100644
    --- a/src/jdk.javadoc/share/man/javadoc.md
    +++ b/src/jdk.javadoc/share/man/javadoc.md
    @@ -510,8 +510,9 @@ The following options are provided by the standard doclet.
     `-footer` *html-code*
     :   This option is no longer supported and reports a warning.
     
    -`-group` *name* *p1*`,`*p2...*
    -:   Group the specified packages together in the Overview page.
    +`-group` *name* *g1*`,`*g2...*
    +:   Group the specified packages, or modules when documenting modular code,
    +    together in the Overview page.
         For historical reasons, `:` can be used as a separator anywhere in the
         argument instead of `,`.
     
    diff --git a/src/jdk.jconsole/share/classes/sun/tools/jconsole/resources/messages_de.properties b/src/jdk.jconsole/share/classes/sun/tools/jconsole/resources/messages_de.properties
    index 947fb1c8d66..e6859fd8d74 100644
    --- a/src/jdk.jconsole/share/classes/sun/tools/jconsole/resources/messages_de.properties
    +++ b/src/jdk.jconsole/share/classes/sun/tools/jconsole/resources/messages_de.properties
    @@ -1,5 +1,5 @@
     #
    -# Copyright (c) 2012, 2024, Oracle and/or its affiliates. All rights reserved.
    +# Copyright (c) 2012, 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
    diff --git a/src/jdk.jdi/share/classes/com/sun/tools/example/debug/tty/TTY.java b/src/jdk.jdi/share/classes/com/sun/tools/example/debug/tty/TTY.java
    index acdd6c45f6e..94d06363dd1 100644
    --- a/src/jdk.jdi/share/classes/com/sun/tools/example/debug/tty/TTY.java
    +++ b/src/jdk.jdi/share/classes/com/sun/tools/example/debug/tty/TTY.java
    @@ -1,5 +1,5 @@
     /*
    - * Copyright (c) 1998, 2024, Oracle and/or its affiliates. All rights reserved.
    + * Copyright (c) 1998, 2025, 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
    @@ -39,6 +39,7 @@
     import com.sun.jdi.request.*;
     import com.sun.jdi.connect.*;
     
    +import java.nio.charset.Charset;
     import java.util.*;
     import java.util.concurrent.CopyOnWriteArrayList;
     import java.io.*;
    @@ -796,8 +797,8 @@ public TTY() throws Exception {
                 this.handler = new EventHandler(this, true, trackVthreads);
             }
             try {
    -            BufferedReader in =
    -                    new BufferedReader(new InputStreamReader(System.in));
    +            Charset charset = Charset.forName(System.getProperty("stdin.encoding"), Charset.defaultCharset());
    +            BufferedReader in = new BufferedReader(new InputStreamReader(System.in, charset));
     
                 Thread.currentThread().setPriority(Thread.NORM_PRIORITY);
     
    diff --git a/src/jdk.jdi/share/classes/com/sun/tools/example/debug/tty/TTYResources_de.java b/src/jdk.jdi/share/classes/com/sun/tools/example/debug/tty/TTYResources_de.java
    index f3aadd3677c..04ec27a624d 100644
    --- a/src/jdk.jdi/share/classes/com/sun/tools/example/debug/tty/TTYResources_de.java
    +++ b/src/jdk.jdi/share/classes/com/sun/tools/example/debug/tty/TTYResources_de.java
    @@ -1,5 +1,5 @@
     /*
    - * Copyright (c) 2001, 2024, Oracle and/or its affiliates. All rights reserved.
    + * Copyright (c) 2001, 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
    diff --git a/src/jdk.jfr/share/classes/jdk/jfr/DataAmount.java b/src/jdk.jfr/share/classes/jdk/jfr/DataAmount.java
    index c2442ad2c92..106110f0208 100644
    --- a/src/jdk.jfr/share/classes/jdk/jfr/DataAmount.java
    +++ b/src/jdk.jfr/share/classes/jdk/jfr/DataAmount.java
    @@ -1,5 +1,5 @@
     /*
    - * Copyright (c) 2016, 2023, Oracle and/or its affiliates. All rights reserved.
    + * Copyright (c) 2016, 2025, 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
    @@ -59,7 +59,7 @@
         /**
          * Returns the unit for the data amount, by default bytes.
          *
    -     * @return the data amount unit, default {@code BYTES}, not {@code null}
    +     * @return the data amount unit, default {@code BYTES}
          */
         String value() default BYTES;
     }
    diff --git a/src/jdk.jfr/share/classes/jdk/jfr/Description.java b/src/jdk.jfr/share/classes/jdk/jfr/Description.java
    index f907c25d4d0..d34312fc918 100644
    --- a/src/jdk.jfr/share/classes/jdk/jfr/Description.java
    +++ b/src/jdk.jfr/share/classes/jdk/jfr/Description.java
    @@ -1,5 +1,5 @@
     /*
    - * Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved.
    + * Copyright (c) 2016, 2025, 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
    @@ -46,7 +46,7 @@
         /**
          * Returns a sentence or two that describes the annotated element.
          *
    -     * @return a description, not {@code null}
    +     * @return a description
          */
         String value();
     }
    diff --git a/src/jdk.jfr/share/classes/jdk/jfr/Label.java b/src/jdk.jfr/share/classes/jdk/jfr/Label.java
    index 6a4928e0a04..6f5d85380df 100644
    --- a/src/jdk.jfr/share/classes/jdk/jfr/Label.java
    +++ b/src/jdk.jfr/share/classes/jdk/jfr/Label.java
    @@ -1,5 +1,5 @@
     /*
    - * Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved.
    + * Copyright (c) 2016, 2025, 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
    @@ -49,7 +49,7 @@
         /**
          * Returns a human-readable name for the annotated element.
          *
    -     * @return a human-readable name, not {@code null}
    +     * @return a human-readable name
          */
         String value();
     }
    diff --git a/src/jdk.jfr/share/classes/jdk/jfr/Period.java b/src/jdk.jfr/share/classes/jdk/jfr/Period.java
    index 90c4a9699d8..97d4676e6a5 100644
    --- a/src/jdk.jfr/share/classes/jdk/jfr/Period.java
    +++ b/src/jdk.jfr/share/classes/jdk/jfr/Period.java
    @@ -1,5 +1,5 @@
     /*
    - * Copyright (c) 2016, 2023, Oracle and/or its affiliates. All rights reserved.
    + * Copyright (c) 2016, 2025, 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
    @@ -71,7 +71,7 @@
          * least once for every recording file. The number of events that are emitted
          * depends on how many times the file rotations occur when data is recorded.
          *
    -     * @return the default setting value, not {@code null}
    +     * @return the default setting value, default {@code "everyChunk"}
          */
         String value() default "everyChunk";
     }
    diff --git a/src/jdk.jfr/share/classes/jdk/jfr/Threshold.java b/src/jdk.jfr/share/classes/jdk/jfr/Threshold.java
    index 94030fba7b2..92c40823bbb 100644
    --- a/src/jdk.jfr/share/classes/jdk/jfr/Threshold.java
    +++ b/src/jdk.jfr/share/classes/jdk/jfr/Threshold.java
    @@ -1,5 +1,5 @@
     /*
    - * Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved.
    + * Copyright (c) 2016, 2025, 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
    @@ -63,7 +63,7 @@
          * 

    * Example values are {@code "0 ns"}, {@code "10 ms"}, and {@code "1 s"}. * - * @return the threshold, default {@code "0 ns"}, not {@code null} + * @return the threshold, default {@code "0 ns"} */ String value() default "0 ns"; } diff --git a/src/jdk.jfr/share/classes/jdk/jfr/Throttle.java b/src/jdk.jfr/share/classes/jdk/jfr/Throttle.java index 7b9771eba2b..7278a93a698 100644 --- a/src/jdk.jfr/share/classes/jdk/jfr/Throttle.java +++ b/src/jdk.jfr/share/classes/jdk/jfr/Throttle.java @@ -74,7 +74,7 @@ *

    * Specifying {@code "off"} (case-sensitive) results in all events being emitted. * - * @return the throttle value, default {@code "off"} not {@code null} + * @return the throttle value, default {@code "off"} */ String value() default "off"; } diff --git a/src/jdk.jfr/share/classes/jdk/jfr/Timespan.java b/src/jdk.jfr/share/classes/jdk/jfr/Timespan.java index bc5ac72d045..f82ae42b762 100644 --- a/src/jdk.jfr/share/classes/jdk/jfr/Timespan.java +++ b/src/jdk.jfr/share/classes/jdk/jfr/Timespan.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2016, 2025, 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 @@ -71,7 +71,7 @@ *

    * By default, the unit is nanoseconds. * - * @return the time span unit, default {@link #NANOSECONDS}, not {@code null} + * @return the time span unit, default {@code NANOSECONDS} */ String value() default NANOSECONDS; } diff --git a/src/jdk.jfr/share/classes/jdk/jfr/Timestamp.java b/src/jdk.jfr/share/classes/jdk/jfr/Timestamp.java index d13f5151ea1..11b4ed9c966 100644 --- a/src/jdk.jfr/share/classes/jdk/jfr/Timestamp.java +++ b/src/jdk.jfr/share/classes/jdk/jfr/Timestamp.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2016, 2025, 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 @@ -57,7 +57,7 @@ /** * Unit for the time stamp. * - * @return time stamp unit, not {@code null} + * @return time stamp unit, default {@code MILLISECONDS_SINCE_EPOCH} */ String value() default Timestamp.MILLISECONDS_SINCE_EPOCH; } diff --git a/src/jdk.jfr/share/classes/jdk/jfr/internal/JDKEvents.java b/src/jdk.jfr/share/classes/jdk/jfr/internal/JDKEvents.java index a28f1fdd41f..503a7955e00 100644 --- a/src/jdk.jfr/share/classes/jdk/jfr/internal/JDKEvents.java +++ b/src/jdk.jfr/share/classes/jdk/jfr/internal/JDKEvents.java @@ -45,6 +45,7 @@ import jdk.jfr.events.MethodTimingEvent; import jdk.jfr.events.MethodTraceEvent; import jdk.jfr.internal.periodic.PeriodicEvents; +import jdk.jfr.internal.settings.MethodSetting; import jdk.jfr.internal.tracing.PlatformTracer; import jdk.jfr.tracing.MethodTracer; @@ -235,7 +236,7 @@ private static void emitInitialSecurityProperties() { } private static void emitMethodTiming() { - if (MethodTimingEvent.enabled()) { + if (MethodSetting.isInitialized() && MethodTimingEvent.enabled()) { PlatformTracer.emitTiming(); } } diff --git a/src/jdk.jfr/share/classes/jdk/jfr/internal/consumer/ChunkParser.java b/src/jdk.jfr/share/classes/jdk/jfr/internal/consumer/ChunkParser.java index 67143ee1265..62618c13c5a 100644 --- a/src/jdk.jfr/share/classes/jdk/jfr/internal/consumer/ChunkParser.java +++ b/src/jdk.jfr/share/classes/jdk/jfr/internal/consumer/ChunkParser.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2016, 2025, 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 @@ -421,14 +421,29 @@ private String textify(Object o) { return o.getClass().getName(); } if (o.getClass().isArray()) { - Object[] array = (Object[]) o; - if (array.length > 0) { - return textify(array[0]) + "[]"; // can it be recursive? - } + return textifyArray((Object[])o); } return String.valueOf(o); } + private String textifyArray(Object[] array) { + int length = array.length; + if (length > 0) { + Object element = array[0]; + if (element != null) { + if (element instanceof String s) { + // Probably an enumeration type, e.g. ThreadState. Remove array indirection + return textify(s); + } + if (element.getClass().isArray()) { + Object[] subArray = (Object[]) element; + return element.getClass().getComponentType().getName() + "[" + subArray.length + "]" + "[" + length + "]"; + } + } + } + return array.getClass().getComponentType().getName() + "[" + length + "]"; + } + private String getName(long id) { Type type = typeMap.get(id); return type == null ? ("unknown(" + id + ")") : type.getName(); diff --git a/src/jdk.jfr/share/classes/jdk/jfr/internal/consumer/ConstantMap.java b/src/jdk.jfr/share/classes/jdk/jfr/internal/consumer/ConstantMap.java index 3b6859304b8..daf6ad7278c 100644 --- a/src/jdk.jfr/share/classes/jdk/jfr/internal/consumer/ConstantMap.java +++ b/src/jdk.jfr/share/classes/jdk/jfr/internal/consumer/ConstantMap.java @@ -77,7 +77,7 @@ Object get(long id) { if (id != 0) { String msg = "Missing object ID " + id + " in pool " + getName() + ". All IDs should reference an object"; Logger.log(LogTag.JFR_SYSTEM_PARSER, LogLevel.INFO, msg); - assert false : msg; + // assert false : msg; } return null; } diff --git a/src/jdk.jfr/share/classes/jdk/jfr/internal/dcmd/DCmdStart.java b/src/jdk.jfr/share/classes/jdk/jfr/internal/dcmd/DCmdStart.java index 9cc3bdaf101..ed93710e59a 100644 --- a/src/jdk.jfr/share/classes/jdk/jfr/internal/dcmd/DCmdStart.java +++ b/src/jdk.jfr/share/classes/jdk/jfr/internal/dcmd/DCmdStart.java @@ -502,9 +502,11 @@ private static String reportOnExit() { """ report-on-exit Specifies the name of the view to display when the Java Virtual - Machine (JVM) shuts down. This option is not available if the - disk option is set to false. For a list of available views, - see 'jfr help view'. By default, no report is generated. + Machine (JVM) shuts down. To specify more than one view, use + the `report-on-exit` parameter repeatedly, for each view. This + option is not available if the disk option is set to false. + For a list of available views, see `jfr help view`. By default, + no report is generated. """; } diff --git a/src/jdk.jfr/share/classes/jdk/jfr/internal/jfc/model/XmlElement.java b/src/jdk.jfr/share/classes/jdk/jfr/internal/jfc/model/XmlElement.java index d05516ed229..e2d40a635aa 100644 --- a/src/jdk.jfr/share/classes/jdk/jfr/internal/jfc/model/XmlElement.java +++ b/src/jdk.jfr/share/classes/jdk/jfr/internal/jfc/model/XmlElement.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2021, 2025, 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 @@ -107,6 +107,13 @@ final String getContent() { return content; } + final String getContentOrEmptyQuote() { + if (content == null || content.isEmpty()) { + return "\"\""; + } + return content; + } + final void addListener(XmlElement listener) { listeners.add(listener); listener.addProducer(this); diff --git a/src/jdk.jfr/share/classes/jdk/jfr/internal/jfc/model/XmlText.java b/src/jdk.jfr/share/classes/jdk/jfr/internal/jfc/model/XmlText.java index 4d90dd3c51c..9eedf59d4bc 100644 --- a/src/jdk.jfr/share/classes/jdk/jfr/internal/jfc/model/XmlText.java +++ b/src/jdk.jfr/share/classes/jdk/jfr/internal/jfc/model/XmlText.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2021, 2025, 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 @@ -24,6 +24,8 @@ */ package jdk.jfr.internal.jfc.model; +import jdk.jfr.internal.tracing.Filter; + // Corresponds to final class XmlText extends XmlInput { @@ -35,7 +37,7 @@ public String getOptionSyntax() { sb.append(getContentType().orElse("text")); sb.append(">"); sb.append(" ("); - String content = getContent(); + String content = getContentOrEmptyQuote(); if (isTimespan()) { // "20 ms" becomes "20ms" content = content.replaceAll("\\s", ""); @@ -57,7 +59,7 @@ public void configure(String value) { @Override public void configure(UserInterface ui) throws AbortException { ui.println(); - ui.println(getLabel() + ": " + getContent() + " (default)"); + ui.println(getLabel() + ": " + getContentOrEmptyQuote() + " (default)"); while (!readInput(ui)) { ; } @@ -71,9 +73,21 @@ protected Result evaluate() { private boolean readInput(UserInterface ui) throws AbortException { String line = ui.readLine(); if (line.isBlank()) { - ui.println("Using default: " + getContent()); + ui.println("Using default: " + getContentOrEmptyQuote()); return true; } + if (isMethodFilter()) { + if (!Filter.isValid(line)) { + ui.println(""" + Not a valid method filter. A filter can be an annotation \ + (@jakarta.ws.rs.GET), a full qualified class name (com.example.Foo), \ + a fully qualified method reference (java.lang.HashMap::resize) or a \ + class initializer (::). Use for constructors. \ + Separate multiple filters with semicolon.\ + """); + return false; + } + } if (isTimespan()) { try { line = Utilities.parseTimespan(line); @@ -90,4 +104,8 @@ private boolean readInput(UserInterface ui) throws AbortException { private boolean isTimespan() { return getContentType().orElse("text").equals("timespan"); } + + private boolean isMethodFilter() { + return getContentType().orElse("text").equals("method-filter"); + } } diff --git a/src/jdk.jfr/share/classes/jdk/jfr/internal/query/view.ini b/src/jdk.jfr/share/classes/jdk/jfr/internal/query/view.ini index 018f41bbf22..fd9636f17ab 100644 --- a/src/jdk.jfr/share/classes/jdk/jfr/internal/query/view.ini +++ b/src/jdk.jfr/share/classes/jdk/jfr/internal/query/view.ini @@ -471,8 +471,8 @@ table = "COLUMN 'Alloc. Time', 'Application Method', 'Object Age', 'Heap Usage' [application.method-timing] label = "Method Timing" -table = "COLUMN 'Timed Method', 'Invocations', 'Min. Tim', 'Max. Time', 'Average Time' - FORMAT none, none, ms-precision:6 +table = "COLUMN 'Timed Method', 'Invocations', 'Min. Time', 'Max. Time', 'Average Time' + FORMAT none, none, ms-precision:6, ms-precision:6, ms-precision:6 SELECT LAST_BATCH(method) AS M, LAST_BATCH(invocations), LAST_BATCH(minimum), LAST_BATCH(maximum), LAST_BATCH(average) FROM jdk.MethodTiming GROUP BY method ORDER BY average" diff --git a/src/jdk.jfr/share/classes/jdk/jfr/internal/settings/MethodSetting.java b/src/jdk.jfr/share/classes/jdk/jfr/internal/settings/MethodSetting.java index f4f3d93c01c..0f2751b6ac7 100644 --- a/src/jdk.jfr/share/classes/jdk/jfr/internal/settings/MethodSetting.java +++ b/src/jdk.jfr/share/classes/jdk/jfr/internal/settings/MethodSetting.java @@ -33,6 +33,7 @@ import jdk.jfr.internal.PlatformEventType; import jdk.jfr.internal.Type; import jdk.jfr.internal.tracing.Modification; +import jdk.jfr.internal.tracing.Filter; import jdk.jfr.internal.tracing.PlatformTracer; @MetadataDefinition @@ -41,18 +42,34 @@ @Name(Type.SETTINGS_PREFIX + "Filter") public final class MethodSetting extends FilterSetting { private final Modification modification; + private volatile static boolean initialized; public MethodSetting(PlatformEventType eventType, Modification modification, String defaultValue) { super(eventType, defaultValue); this.modification = modification; } + @Override public boolean isValid(String text) { - return PlatformTracer.isValidFilter(text); + return Filter.isValid(text); } @Override protected void apply(PlatformEventType eventType, List filters) { + ensureInitialized(); PlatformTracer.setFilters(modification, filters); } + + // Expected to be called when holding external lock, so no extra + // synchronization is required here. + private static void ensureInitialized() { + if (!initialized) { + PlatformTracer.initialize(); + initialized = true; + } + } + + public static boolean isInitialized() { + return initialized; + } } diff --git a/src/jdk.jfr/share/classes/jdk/jfr/internal/tracing/ExcludeList.java b/src/jdk.jfr/share/classes/jdk/jfr/internal/tracing/ExcludeList.java index 8aa889dd68d..58408da811e 100644 --- a/src/jdk.jfr/share/classes/jdk/jfr/internal/tracing/ExcludeList.java +++ b/src/jdk.jfr/share/classes/jdk/jfr/internal/tracing/ExcludeList.java @@ -24,38 +24,46 @@ */ package jdk.jfr.internal.tracing; +import java.util.Set; + // // The JVM will skip all classes in the jdk.jfr module, so it's not added here. public final class ExcludeList { private static final String[] EXCLUDED_CLASSES = { // Used by MethodTiming event to accumulate invocations. "java/util/concurrent/atomic/AtomicLong", - // Used by EventWriter + // Used by EventWriter, directly or indirectly. "sun/misc/Unsafe", - "jdk/internal/misc/Unsafe;", + "jdk/internal/misc/Unsafe", + "java/lang/StringLatin1", + "java/lang/StringUTF16", }; private static final String[] EXCLUDED_PREFIX = { // Used by MethodTiming event to store invocations, including inner classes. "java/util/concurrent/ConcurrentHashMap", // Can't trigger of these classes during PlatformTracer::onMethodTrace(...) - "jdk/internal/", // jdk/internal/classfile, jdk/internal/loader and jdk/internal/foreign + // Also to avoid recursion with EventWriter::putString + "jdk/internal/", // jdk/internal/classfile, // jdk/internal/vm, jdk/internal/util, jdk/internal/loader and jdk/internal/foreign "java/lang/classfile/" }; - private static final String[] EXCLUDED_METHODS = { + private static final Set EXCLUDED_METHODS = Set.of( // Long used by MethodTiming event when looking up entry for timing entry "java.lang.Long::", "java.lang.Long::valueOf", - "java.lang.Number::" - }; + "java.lang.Number::", + // Used by EventWriter::putString, directly or indirectly. + "java.lang.String::charAt", + "java.lang.String::length", + "java.lang.String::coder", // Used by charAt(int) + "java.lang.String::checkIndex", // Used by charAt(int) + "java.lang.String::isLatin1", // Used by charAt() + "java.lang.String::equals", // Used by StringPool + "java.lang.String::hashCode" // Used by StringPool + ); public static boolean containsMethod(String methodName) { - for (String method : EXCLUDED_METHODS) { - if (method.equals(methodName)) { - return true; - } - } - return false; + return EXCLUDED_METHODS.contains(methodName); } public static boolean containsClass(String className) { diff --git a/src/jdk.jfr/share/classes/jdk/jfr/internal/tracing/Filter.java b/src/jdk.jfr/share/classes/jdk/jfr/internal/tracing/Filter.java index 782cc3e56d1..177b6d03166 100644 --- a/src/jdk.jfr/share/classes/jdk/jfr/internal/tracing/Filter.java +++ b/src/jdk.jfr/share/classes/jdk/jfr/internal/tracing/Filter.java @@ -30,7 +30,11 @@ * Class that represents the filter a user can specify for the MethodTrace and * MethodTiming event. */ -record Filter(String className, String methodName, String annotationName, Modification modification) { +public record Filter(String className, String methodName, String annotationName, Modification modification) { + + public static boolean isValid(String filter) { + return of(filter, Modification.NONE) != null; + } static Filter of(String filter, Modification modification) { if (filter.startsWith("@")) { diff --git a/src/jdk.jfr/share/classes/jdk/jfr/internal/tracing/PlatformTracer.java b/src/jdk.jfr/share/classes/jdk/jfr/internal/tracing/PlatformTracer.java index abc3b0f8cd0..2d40e496dc1 100644 --- a/src/jdk.jfr/share/classes/jdk/jfr/internal/tracing/PlatformTracer.java +++ b/src/jdk.jfr/share/classes/jdk/jfr/internal/tracing/PlatformTracer.java @@ -53,8 +53,6 @@ public final class PlatformTracer { private static List timingFilters = List.of(); private static TimedMethod OBJECT; - private static boolean initialized; - public static byte[] onMethodTrace(Module module, ClassLoader classLoader, String className, byte[] oldBytecode, long[] ids, String[] names, String[] signatures, int[] modifications) { @@ -158,12 +156,7 @@ public static void addTiming(long id, long duration) { } } - public static boolean isValidFilter(String text) { - return Filter.of(text, null) != null; - } - public static void setFilters(Modification modification, List filters) { - ensureInitialized(); publishClasses(applyFilter(modification, filters)); } @@ -256,14 +249,6 @@ private static void reset() { timedClasses.clear(); } - // Expected to be called when holding external lock, so no extra - // synchronization is required here. - private static void ensureInitialized() { - if (!initialized) { - initialize(); - initialized = true; - } - } // This method has three purposes: // @@ -278,7 +263,7 @@ private static void ensureInitialized() { // This method takes 1-10 milliseconds to run and is only executed once, // provided a user has specified a non-empty filter for the MethodTrace or // MethodTiming event. - private static void initialize() { + public static void initialize() { try { Logger.log(LogTag.JFR_METHODTRACE, LogLevel.DEBUG, "Method tracer initialization started."); Thread current = Thread.currentThread(); diff --git a/src/jdk.jfr/share/conf/jfr/default.jfc b/src/jdk.jfr/share/conf/jfr/default.jfc index 565dfbdee05..20051864895 100644 --- a/src/jdk.jfr/share/conf/jfr/default.jfc +++ b/src/jdk.jfr/share/conf/jfr/default.jfc @@ -1189,9 +1189,11 @@ 20 ms - + - + false diff --git a/src/jdk.jfr/share/conf/jfr/profile.jfc b/src/jdk.jfr/share/conf/jfr/profile.jfc index 2c0812e75fe..5ffdc8d9e4d 100644 --- a/src/jdk.jfr/share/conf/jfr/profile.jfc +++ b/src/jdk.jfr/share/conf/jfr/profile.jfc @@ -1188,9 +1188,11 @@ 10 ms - + - + false diff --git a/src/jdk.jlink/share/classes/jdk/tools/jimage/resources/jimage_de.properties b/src/jdk.jlink/share/classes/jdk/tools/jimage/resources/jimage_de.properties new file mode 100644 index 00000000000..fd30f5385e8 --- /dev/null +++ b/src/jdk.jlink/share/classes/jdk/tools/jimage/resources/jimage_de.properties @@ -0,0 +1,68 @@ +# +# Copyright (c) 2015, 2018, 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. +# + +main.usage.summary=Verwendung: {0} jimage...\nMit -h oder --help können Sie eine Liste der möglichen Optionen aufrufen. + +main.usage=Verwendung: {0} jimage...\n\n extract - Extrahiert alle jimage-Einträge und platziert sie in einem mit der Option\n --dir= (Standardwert = ".") angegebenen Verzeichnis.\n\n info - Gibt detaillierte Informationen aus, die im jimage-Header enthalten sind.\n\n list - Gibt die Namen aller Einträge im jimage aus. Bei Verwendung mit\n --verbose gibt der Befehl "list" auch die Eintragsgröße und Offset-Attribute aus.\n\n verify - Meldet alle .class-Einträge, die nicht als Klassen verifiziert werden.\n\nMögliche Optionen: + +main.usage.extract=\ extract - Extrahiert alle jimage-Einträge und platziert sie in einem mit der Option\n --dir= (Standardwert = ".") angegebenen Verzeichnis. + +main.usage.info=\ info - Gibt detaillierte Informationen aus, die im jimage-Header enthalten sind. + +main.usage.list=\ list - Gibt die Namen aller Einträge im jimage aus. Bei Verwendung mit\n --verbose gibt der Befehl "list" auch die Eintragsgröße und Offset-Attribute aus. + +main.usage.verify=\ verify - Meldet alle .class-Einträge, die nicht als Klassen verifiziert werden. + +error.prefix=Fehler: +warn.prefix=Warnung: + +main.opt.dir=\ --dir Zielverzeichnis für extract-Direktive + +main.opt.include=\ --include Musterliste für das Filtern von Einträgen. + +main.opt.full-version=\ --full-version Gibt vollständige Versionsinformationen aus + +main.opt.help=\ -?, -h, --help Gibt diese Hilfemeldung aus + +main.opt.verbose=\ --verbose Gibt beim Auflisten die Eintragsgröße\n und Offset-Attribute aus + +main.opt.version=\ --version Gibt Versionsinformationen aus + +main.command.files=\ @ Liest Optionen aus der Datei + +main.opt.footer=\nBei Optionen, die eine erfordern, ist der Wert eine durch Komma getrennte\nListe von Elementen, die jeweils eines der folgenden Formate verwenden:\n \n glob:\n regex: + + + +err.not.a.task=Aufgabe muss einen der folgenden Werte aufweisen: : {0} +err.missing.arg=kein Wert angegeben für {0} +err.ambiguous.arg=Wert für Option {0} beginnt mit "--", aber muss das Format {0}= verwenden +err.not.a.dir=Kein Verzeichnis: {0} +err.not.a.jimage=Keine jimage-Datei: {0} +err.invalid.jimage={0} kann nicht geöffnet werden: {1} +err.no.jimage=Kein jimage angegeben +err.option.unsupported={0} nicht unterstützt: {1} +err.unknown.option=unbekannte Option: {0} +err.cannot.create.dir=Verzeichnis {0} kann nicht erstellt werden diff --git a/src/jdk.jlink/share/classes/jdk/tools/jimage/resources/jimage_ja.properties b/src/jdk.jlink/share/classes/jdk/tools/jimage/resources/jimage_ja.properties new file mode 100644 index 00000000000..66471e23b38 --- /dev/null +++ b/src/jdk.jlink/share/classes/jdk/tools/jimage/resources/jimage_ja.properties @@ -0,0 +1,68 @@ +# +# Copyright (c) 2015, 2018, 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. +# + +main.usage.summary=使用方法: {0} jimage...\n使用可能なオプションのリストについては、-hまたは--helpを使用します。 + +main.usage=使用方法: {0} jimage...\n\n extract - すべてのjimageエントリを抽出し、--dir= (default=''.'')\n オプションで指定されたディレクトリに配置します。\n\n info - jimageヘッダーに含まれる詳細情報を出力します。\n\n list - jimage内のすべてのエントリの名前を出力します。--verboseと共に\n 使用すると、listはエントリ・サイズとオフセット属性も出力します。\n\n verify - クラスとして検証しない任意の.classエントリを報告します。\n\n使用可能なオプションには次のものがあります: + +main.usage.extract=\ extract - すべてのjimageエントリを抽出し、--dir= (default='.')\n オプションで指定されたディレクトリに配置します。 + +main.usage.info=\ info - jimageヘッダーに含まれる詳細情報を出力します。 + +main.usage.list=\ list - jimage内のすべてのエントリの名前を出力します。--verboseと共に\n 使用すると、listはエントリ・サイズとオフセット属性も出力します。 + +main.usage.verify=\ verify - クラスとして検証しない任意の.classエントリに関するエラーを報告します。 + +error.prefix=エラー: +warn.prefix=警告: + +main.opt.dir=\ --dir 抽出ディレクティブのターゲット・ディレクトリ + +main.opt.include=\ --include フィルタリング・エントリのパターン・リスト。 + +main.opt.full-version=\ --full-version 完全なバージョン情報を出力します + +main.opt.help=\ -?, -h, --help このヘルプ・メッセージを出力します + +main.opt.verbose=\ --verbose エントリ・サイズとオフセット属性の出力の\n リスティング + +main.opt.version=\ --version バージョン情報を出力します + +main.command.files=\ @ ファイルからオプションを読み取ります + +main.opt.footer=\nを必要とするオプションの場合、値は、次の形式のいずれかを使用する、\n要素のカンマ区切りリストになります:\n \n glob:\n regex: + + + +err.not.a.task=タスクはのいずれかである必要があります: {0} +err.missing.arg={0}に値が指定されていません +err.ambiguous.arg=オプション{0}の値が"--"で始まっています。{0}=形式を使用する必要があります +err.not.a.dir=ディレクトリではありません: {0} +err.not.a.jimage=jimageファイルではありません: {0} +err.invalid.jimage={0}を開けません: {1} +err.no.jimage=jimageが提供されていません +err.option.unsupported={0}はサポートされていません: {1} +err.unknown.option=不明なオプション: {0} +err.cannot.create.dir=ディレクトリ{0}を作成できません diff --git a/src/jdk.jlink/share/classes/jdk/tools/jimage/resources/jimage_zh_CN.properties b/src/jdk.jlink/share/classes/jdk/tools/jimage/resources/jimage_zh_CN.properties new file mode 100644 index 00000000000..8355ed5595e --- /dev/null +++ b/src/jdk.jlink/share/classes/jdk/tools/jimage/resources/jimage_zh_CN.properties @@ -0,0 +1,68 @@ +# +# Copyright (c) 2015, 2018, 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. +# + +main.usage.summary=用法:{0} jimage...\n使用 -h 或 --help 列出可能的选项。 + +main.usage=用法:{0} jimage...\n\n extract - 提取所有 jimage 条目,并将其放置在\n 由 --dir= (default=''.'') 选项指定的目录中。\n\n info - 输出 jimage 标头中包含的详细信息。\n\n list - 输出 jimage 中所有条目的名称。与\n --verbose 一起使用时,list 还将输出条目大小和偏移量属性。\n\n verify - 报告任何未验证为类的 .class 条目。\n\n可能的选项包括: + +main.usage.extract=\ extract - 提取所有 jimage 条目,并将其放置在\n 由 --dir= (default='.') 选项指定的目录中。 + +main.usage.info=\ info - 输出 jimage 标头中包含的详细信息。 + +main.usage.list=\ list - 输出 jimage 中所有条目的名称。与 \n --verbose 一起使用时,list 还将输出条目大小和偏移量属性。 + +main.usage.verify=\ verify - 报告任何未验证为类的 .class 条目的错误。 + +error.prefix=错误: +warn.prefix=警告: + +main.opt.dir=\ --dir 提取指令的目标目录 + +main.opt.include=\ --include 用于筛选条目的模式列表。 + +main.opt.full-version=\ --full-version 输出完整版本信息 + +main.opt.help=\ -?, -h, --help 输出此帮助消息 + +main.opt.verbose=\ --verbose 列表输出条目大小和偏移量\n 属性 + +main.opt.version=\ --version 输出版本信息 + +main.command.files=\ @<文件名> 从文件中读取选项 + +main.opt.footer=\n对于需要 的选项,值将为逗号分隔的元素列表,\n每个元素使用以下格式之一:\n \n glob:\n regex: + + + +err.not.a.task=任务必须是 之一:{0} +err.missing.arg=没有为{0}指定值 +err.ambiguous.arg=选项 {0} 的值以 "--" 开头,应使用 {0}= 格式 +err.not.a.dir=不是目录:{0} +err.not.a.jimage=不是 jimage 文件:{0} +err.invalid.jimage=无法打开 {0}: {1} +err.no.jimage=未提供 jimage +err.option.unsupported=不支持{0}: {1} +err.unknown.option=未知选项: {0} +err.cannot.create.dir=无法创建目录 {0} diff --git a/src/jdk.jlink/share/classes/jdk/tools/jlink/resources/jlink_de.properties b/src/jdk.jlink/share/classes/jdk/tools/jlink/resources/jlink_de.properties index 6df60ada590..9b776745c66 100644 --- a/src/jdk.jlink/share/classes/jdk/tools/jlink/resources/jlink_de.properties +++ b/src/jdk.jlink/share/classes/jdk/tools/jlink/resources/jlink_de.properties @@ -1,5 +1,5 @@ # -# Copyright (c) 2015, 2024, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2015, 2025, 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 @@ -61,7 +61,7 @@ main.msg.bug=Eine Ausnahme ist in jlink aufgetreten. Melden Sie in der Java-Bugd main.extended.help=Liste der verfügbaren Plug-ins: -main.extended.help.footer=Bei Optionen, die eine erfordern, ist der Wert eine kommagetrennte\nListe von Elementen, die jeweils eines der folgenden Formate verwenden:\n \n glob:\n regex:\n @, wobei der Dateiname der Name einer Datei mit zu verwendenden Mustern ist,\n ein Muster pro Zeile\n\n +main.extended.help.footer=Bei Optionen, die eine erfordern, ist der Wert eine kommagetrennte\nListe von Elementen, die jeweils eines der folgenden Formate verwenden:\n \n glob:\n regex:\n @, wobei der Dateiname der Name einer Datei mit zu verwendenden Mustern ist,\n ein Muster pro Zeile\n\n main.runtime.image.linking.cap.enabled=aktiviert main.runtime.image.linking.cap.disabled=deaktiviert main.runtime.image.linking.cap.sect.header=Funktionen: @@ -75,7 +75,7 @@ err.runtime.link.jdk.jlink.prohibited=Dieses JDK enthält keine verpackten Modul err.runtime.link.packaged.mods=Dieses JDK enthält keine verpackten Module. "--keep-packaged-modules" wird nicht unterstützt err.runtime.link.modified.file={0} wurde geändert err.runtime.link.patched.module=jlink unterstützt keine Verknüpfung vom Laufzeitimage unter einer gepatchten Laufzeit mit --patch-module -err.no.module.path=--module-path Option muss mit --add-modules ALL-MODULE-PATH angegeben werden +err.no.module.path=Option --module-path muss mit --add-modules ALL-MODULE-PATH angegeben werden err.empty.module.path=Kein Modul im Modulpfad "{0}" mit --add-modules ALL-MODULE-PATH gefunden err.limit.modules=--limit-modules nicht mit --add-modules ALL-MODULE-PATH zulässig err.jlink.version.mismatch=jlink-Version {0}.{1} stimmt nicht mit Ziel-java.base-Version {2}.{3} überein @@ -95,6 +95,7 @@ err.dir.exists={0} ist bereits vorhanden err.badpattern=ungültiges Muster {0} err.unknown.option=unbekannte Option: {0} err.missing.arg=kein Wert angegeben für {0} +err.ambiguous.arg=Wert für Option {0} beginnt mit "--", aber muss das Format {0}= verwenden err.internal.error=interner Fehler: {0} {1} {2} err.invalid.arg.for.option={0} akzeptiert nicht das Argument "{1}" err.option.after.class=Option muss angegeben werden vor den Klassen: {0} diff --git a/src/jdk.jlink/share/classes/jdk/tools/jlink/resources/jlink_ja.properties b/src/jdk.jlink/share/classes/jdk/tools/jlink/resources/jlink_ja.properties index ef82d3bb461..c925f250c41 100644 --- a/src/jdk.jlink/share/classes/jdk/tools/jlink/resources/jlink_ja.properties +++ b/src/jdk.jlink/share/classes/jdk/tools/jlink/resources/jlink_ja.properties @@ -1,5 +1,5 @@ # -# Copyright (c) 2015, 2024, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2015, 2025, 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 @@ -95,6 +95,7 @@ err.dir.exists={0}はすでに存在します err.badpattern=不正パターン{0} err.unknown.option=不明なオプション: {0} err.missing.arg={0}に値が指定されていません +err.ambiguous.arg=オプション{0}の値が"--"で始まっています。{0}=形式を使用する必要があります err.internal.error=内部エラー: {0} {1} {2} err.invalid.arg.for.option={0}は"{1}"引数を受け入れません err.option.after.class=オプションはクラスの前に指定する必要があります: {0} diff --git a/src/jdk.jlink/share/classes/jdk/tools/jlink/resources/jlink_zh_CN.properties b/src/jdk.jlink/share/classes/jdk/tools/jlink/resources/jlink_zh_CN.properties index 12989131e65..b7526c9f57a 100644 --- a/src/jdk.jlink/share/classes/jdk/tools/jlink/resources/jlink_zh_CN.properties +++ b/src/jdk.jlink/share/classes/jdk/tools/jlink/resources/jlink_zh_CN.properties @@ -1,5 +1,5 @@ # -# Copyright (c) 2015, 2024, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2015, 2025, 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 @@ -95,6 +95,7 @@ err.dir.exists={0} 已存在 err.badpattern=错误的模式 {0} err.unknown.option=未知选项: {0} err.missing.arg=没有为{0}指定值 +err.ambiguous.arg=选项 {0} 的值以 "--" 开头,应使用 {0}= 格式 err.internal.error=内部错误: {0} {1} {2} err.invalid.arg.for.option={0} 不接受 "{1}" 参数 err.option.after.class=必须在类之前指定选项: {0} diff --git a/src/jdk.jlink/share/classes/jdk/tools/jmod/resources/jmod_de.properties b/src/jdk.jlink/share/classes/jdk/tools/jmod/resources/jmod_de.properties index a5896e94abb..126e04d0b58 100644 --- a/src/jdk.jlink/share/classes/jdk/tools/jmod/resources/jmod_de.properties +++ b/src/jdk.jlink/share/classes/jdk/tools/jmod/resources/jmod_de.properties @@ -47,7 +47,7 @@ main.opt.cmds=Speicherort der nativen Befehle main.opt.config=Speicherort der vom Benutzer editierbaren Konfigurationsdateien main.opt.extractDir=Zielverzeichnis für Extraktion main.opt.dry-run=Testlauf des Hashmodus -main.opt.exclude=Schließt Dateien aus, die der angegebenen kommagetrennten Musterliste entsprechen. Jedes Element verwendet eines der folgenden Formate: , glob: oder regex: +main.opt.exclude=Schließt Dateien aus, die der angegebenen kommagetrennten Musterliste entsprechen. Jedes Element verwendet eines der folgenden Formate: , glob: oder regex: main.opt.header-files=Speicherort der Headerdateien main.opt.legal-notices=Speicherort der rechtlichen Hinweise main.opt.module-version= Modulversion diff --git a/src/jdk.jlink/share/man/jmod.md b/src/jdk.jlink/share/man/jmod.md index 6fd2aa54cf9..4e20e2458b7 100644 --- a/src/jdk.jlink/share/man/jmod.md +++ b/src/jdk.jlink/share/man/jmod.md @@ -1,5 +1,5 @@ --- -# Copyright (c) 2017, 2024, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2017, 2025, 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 @@ -179,7 +179,11 @@ e.g. "2022-02-12T12:30:00-05:00". `--hash-modules`. `--target-platform` *platform* -: Specifies the target platform. +: Specifies the target platform of a JMOD file intended for a specific + operating system and architecture. The value should follow + the format `-`, where `` is the operating system + and `` is the hardware architecture. Example values include + `linux-amd64`, `windows-amd64`, and `macos-aarch64`. `--version` : Prints version information of the `jmod` tool. @@ -190,7 +194,7 @@ e.g. "2022-02-12T12:30:00-05:00". An options file is a text file that contains the options and values that you would ordinarily enter in a command prompt. Options may appear on one line or on several lines. You may not specify environment variables for - path names. You may comment out lines by prefixinga hash symbol (`#`) to + path names. You may comment out lines by prefixing a hash symbol (`#`) to the beginning of the line. The following is an example of an options file for the `jmod` command: @@ -201,8 +205,7 @@ e.g. "2022-02-12T12:30:00-05:00". --cmds commands --config configfiles --header-files src/h --libs lib --main-class com.greetings.Main --man-pages man --module-version 1.0 - --os-arch "x86_x64" --os-name "macOS" - --os-version "10.10.5" greetingsmod + --target-platform "macos-aarch64" greetingsmod ``` ## Extra Options for jmod @@ -217,23 +220,32 @@ extra options that can be used with the command. : Hint for a tool to issue a warning if the module is resolved. One of deprecated, deprecated-for-removal, or incubating. -## jmod Create Example +## jmod Create Examples -The following is an example of creating a JMOD file: +Create a JMOD file containing only compiled classes: ``` -jmod create --class-path mods/com.greetings --cmds commands - --config configfiles --header-files src/h --libs lib - --main-class com.greetings.Main --man-pages man --module-version 1.0 - --os-arch "x86_x64" --os-name "macOS" - --os-version "10.10.5" greetingsmod +jmod create --class-path build/foo/classes jmods/foo1.jmod ``` + Create a JMOD file specifying the date for the entries as `2022 March 15 00:00:00`: ``` jmod create --class-path build/foo/classes --date 2022-03-15T00:00:00Z - jmods/foo1.jmod + jmods/foo2.jmod +``` + +Create a JMOD file bundling compiled classes, native commands, configuration files, +header files, native libraries, man pages, and metadata including the +main class, module version, and target platform details: + ``` +jmod create --class-path mods/com.greetings --cmds commands + --config configfiles --header-files src/h --libs lib + --man-pages man --main-class com.greetings.Main --module-version 1.0 + --target-platform "macos-aarch64" greetingsmod +``` + ## jmod Hash Example The following example demonstrates what happens when you try to link a leaf diff --git a/src/jdk.jpackage/linux/classes/jdk/jpackage/internal/resources/LinuxResources_de.properties b/src/jdk.jpackage/linux/classes/jdk/jpackage/internal/resources/LinuxResources_de.properties index da983f76dd6..2f8fcddff73 100644 --- a/src/jdk.jpackage/linux/classes/jdk/jpackage/internal/resources/LinuxResources_de.properties +++ b/src/jdk.jpackage/linux/classes/jdk/jpackage/internal/resources/LinuxResources_de.properties @@ -1,5 +1,5 @@ # -# Copyright (c) 2017, 2022, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2017, 2025, 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 @@ -44,10 +44,13 @@ resource.systemd-unit-file=systemd-Einheitsdatei error.tool-not-found.advice=Installieren Sie die erforderlichen Packages error.tool-old-version.advice=Installieren Sie die erforderlichen Packages -error.invalid-install-dir=Ungültiges Installationsverzeichnis "{0}" +error.deb-invalid-value-for-package-name=Ungültiger Wert "{0}" für den Packagenamen. +error.deb-invalid-value-for-package-name.advice=Setzen Sie die Option "--linux-package-name" auf einen gültigen Debian-Packagenamen. Die Packagenamen dürfen nur Kleinbuchstaben (a-z), Ziffern (0-9), Pluszeichen (+), Minuszeichen (-) und Punkte (.) umfassen. Sie müssen mindestens zwei Zeichen lang sein und mit einem Buchstaben beginnen. -error.invalid-value-for-package-name=Ungültiger Wert "{0}" für den Bundle-Namen. -error.invalid-value-for-package-name.advice=Setzen Sie die Option "linux-bundle-name" auf einen gültigen Debian-Packagenamen. Die Packagenamen dürfen nur Kleinbuchstaben (a-z), Ziffern (0-9), Pluszeichen (+), Minuszeichen (-) und Punkte (.) umfassen. Sie müssen mindestens zwei Zeichen lang sein und mit einem alphanumerischen Zeichen beginnen. +error.rpm-invalid-value-for-package-name=Ungültiger Wert "{0}" für den Packagenamen. +error.rpm-invalid-value-for-package-name.advice=Setzen Sie die Option "--linux-package-name" auf einen gültigen RPM-Packagenamen. Die Packagenamen dürfen nur Buchstaben (a-z, A-Z), Ziffern (0-9), Pluszeichen (+), Minuszeichen (-), Punkte (.) und Unterstriche (_) umfassen. Sie müssen mindestens ein Zeichen lang sein und mit einem Buchstaben beginnen. + +error.rpm-arch-not-detected="RPM-Architektur konnte nicht erkannt werden" message.icon-not-png=Das angegebene Symbol "{0}" ist keine PNG-Datei und wird nicht verwendet. Stattdessen wird das Standardsymbol verwendet. message.test-for-tool=Test für [{0}]. Ergebnis: {1} diff --git a/src/jdk.jpackage/linux/classes/jdk/jpackage/internal/resources/LinuxResources_ja.properties b/src/jdk.jpackage/linux/classes/jdk/jpackage/internal/resources/LinuxResources_ja.properties index 002fc0baf48..be2cd00b42c 100644 --- a/src/jdk.jpackage/linux/classes/jdk/jpackage/internal/resources/LinuxResources_ja.properties +++ b/src/jdk.jpackage/linux/classes/jdk/jpackage/internal/resources/LinuxResources_ja.properties @@ -1,5 +1,5 @@ # -# Copyright (c) 2017, 2022, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2017, 2025, 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 @@ -44,10 +44,13 @@ resource.systemd-unit-file=systemdユニット・ファイル error.tool-not-found.advice=必要なパッケージをインストールしてください error.tool-old-version.advice=必要なパッケージをインストールしてください -error.invalid-install-dir=無効なインストール・ディレクトリ"{0}" +error.deb-invalid-value-for-package-name=パッケージ名に対して値"{0}"は無効です。 +error.deb-invalid-value-for-package-name.advice="--linux-package-name"オプションを有効なDebianパッケージ名に設定してください。パッケージ名には、小文字(a-z)、数字(0-9)、プラス(+)とマイナス(-)の記号およびピリオド(.)のみを含めるようにしてください。長さは2文字以上とし、文字で始める必要があります。 -error.invalid-value-for-package-name=バンドル名の値"{0}"が無効です。 -error.invalid-value-for-package-name.advice="linux-bundle-name"オプションを有効なDebianパッケージ名に設定してください。パッケージ名には、小文字(a-z)、数字(0-9)、プラス(+)とマイナス(-)の記号およびピリオド(.)のみを含めるようにしてください。長さは2文字以上とし、英数字で始める必要があります。 +error.rpm-invalid-value-for-package-name=パッケージ名に対して値"{0}"は無効です。 +error.rpm-invalid-value-for-package-name.advice="--linux-package-name"オプションを有効なRPMパッケージ名に設定してください。パッケージ名には、文字(a-z、A-Z)、数字(0-9)、プラス(+)とマイナス(-)の記号、ピリオド(.)およびアダースコア(_)のみを含めるようにしてください。長さは1文字以上とし、文字で始める必要があります。 + +error.rpm-arch-not-detected="RPM archの検出に失敗しました" message.icon-not-png=指定したアイコン"{0}"はPNGファイルではなく、使用されません。デフォルト・アイコンがその位置に使用されます。 message.test-for-tool=[{0}]のテスト。結果: {1} diff --git a/src/jdk.jpackage/linux/classes/jdk/jpackage/internal/resources/LinuxResources_zh_CN.properties b/src/jdk.jpackage/linux/classes/jdk/jpackage/internal/resources/LinuxResources_zh_CN.properties index 034128f653a..5b583062ab6 100644 --- a/src/jdk.jpackage/linux/classes/jdk/jpackage/internal/resources/LinuxResources_zh_CN.properties +++ b/src/jdk.jpackage/linux/classes/jdk/jpackage/internal/resources/LinuxResources_zh_CN.properties @@ -1,5 +1,5 @@ # -# Copyright (c) 2017, 2022, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2017, 2025, 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 @@ -44,10 +44,13 @@ resource.systemd-unit-file=systemd 单元文件 error.tool-not-found.advice=请安装所需的程序包 error.tool-old-version.advice=请安装所需的程序包 -error.invalid-install-dir=安装目录 "{0}" 无效 +error.deb-invalid-value-for-package-name=程序包名称的值 "{0}" 无效。 +error.deb-invalid-value-for-package-name.advice=将 "--linux-package-name" 选项设置为有效的 Debian 程序包名称。请注意,程序包名称只能包含小写字母 (a-z)、数字 (0-9)、加号 (+) 和减号 (-) 以及句点 (.)。名称长度必须至少为两个字符并且必须以字母字符开头。 -error.invalid-value-for-package-name=包名的值 "{0}" 无效。 -error.invalid-value-for-package-name.advice=将 "linux-bundle-name" 选项设置为有效的 Debian 程序包名称。请注意,程序包名称只能包含小写字母 (a-z)、数字 (0-9)、加号 (+) 和减号 (-) 以及句点 (.)。名称长度必须至少为两个字符并且必须以字母数字字符开头。 +error.rpm-invalid-value-for-package-name=程序包名称的值 "{0}" 无效。 +error.rpm-invalid-value-for-package-name.advice=将 "--linux-package-name" 选项设置为有效的 RPM 程序包名称。请注意,程序包名称只能包含字母 (a-z, A-Z)、数字 (0-9)、加号 (+) 和减号 (-)、句点 (.) 以及下划线 (_)。名称长度必须至少为一个字符并且必须以字母开头。 + +error.rpm-arch-not-detected="无法检测 RPM 体系结构" message.icon-not-png=指定的图标 "{0}" 不是 PNG 文件, 不会使用。将使用默认图标代替。 message.test-for-tool=[{0}] 的测试。结果: {1} diff --git a/src/jdk.jpackage/macosx/classes/jdk/jpackage/internal/resources/MacResources_de.properties b/src/jdk.jpackage/macosx/classes/jdk/jpackage/internal/resources/MacResources_de.properties index f76d3a3743f..7e36a260c3f 100644 --- a/src/jdk.jpackage/macosx/classes/jdk/jpackage/internal/resources/MacResources_de.properties +++ b/src/jdk.jpackage/macosx/classes/jdk/jpackage/internal/resources/MacResources_de.properties @@ -1,5 +1,5 @@ # -# Copyright (c) 2017, 2024, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2017, 2025, 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 @@ -34,10 +34,6 @@ error.explicit-sign-no-cert=Signatur wurde explizit angefordert, doch es wurde k error.explicit-sign-no-cert.advice=Geben Sie gültige Werte für mac-signing-key-user-name und mac-signing-keychain an error.must-sign-app-store=Mac App Store-Apps müssen signiert werden. Die Signierung wurde von der Bundler-Konfiguration deaktiviert error.must-sign-app-store.advice=Verwenden Sie die Option --mac-sign mit entsprechenden Werten für user-name und keychain -error.no-app-signing-key=Kein Signaturschlüssel für Mac App Store-App -error.no-app-signing-key.advice=Installieren Sie Ihre App-Signaturschlüssel mit XCode in Ihrem Mac-Schlüsselbund. -error.no-pkg-signing-key=Kein Signaturschlüssel für Mac App Store-Installationsprogramm -error.no-pkg-signing-key.advice=Installieren Sie Ihre App-Signaturschlüssel mit XCode in Ihrem Mac-Schlüsselbund. error.certificate.expired=Fehler: Zertifikat abgelaufen {0} error.cert.not.found=Kein Zertifikat gefunden, das [{0}] mit Schlüsselbund [{1}] entspricht error.multiple.certs.found=WARNUNG: Mehrere Zertifikate gefunden, die [{0}] mit Schlüsselbund [{1}] entsprechen. Es wird das erste Zertifikat verwendet @@ -51,7 +47,6 @@ resource.dmg-setup-script=DMG-Setupskript resource.license-setup=Lizenzsetup resource.dmg-background=DMG-Hintergrund resource.volume-icon=Symbol "Datenträger" -resource.post-install-script=Auszuführendes Skript nach dem Auffüllen des Anwendungsimages resource.pkg-preinstall-script=PKG-Preinstall-Skript resource.pkg-postinstall-script=PKG-Postinstall-Skript resource.pkg-services-preinstall-script=PKG-Preinstall-Skript für Servicepackage @@ -72,12 +67,6 @@ message.ignoring.symlink=Warnung: codesign überspringt den Symlink {0}. message.already.signed=Datei ist bereits signiert: {0}. message.keychain.error=Fehler: Schlüsselbundliste kann nicht abgerufen werden. message.building-bundle=Mac App Store-Package für {0} wird erstellt. -message.app-image-dir-does-not-exist=Angegebenes Anwendungsimageverzeichnis {0}: {1} ist nicht vorhanden. -message.app-image-dir-does-not-exist.advice=Bestätigen Sie, dass der Wert für {0} vorhanden ist. -message.app-image-requires-app-name=Beim Verwenden eines internen Anwendungsimages müssen Sie den Anwendungsnamen angeben. -message.app-image-requires-app-name.advice=Legen Sie den Anwendungsnamen mit dem CLI-Kennzeichen -name, dem fx:application/@name ANT-Attribut oder dem Bundler-Argument "appName" fest. -message.app-image-requires-identifier=ID kann nicht aus Anwendungsimage extrahiert werden. -message.app-image-requires-identifier.advice=Verwenden Sie "--verbose" für eine erweiterte Fehlermeldung, oder geben Sie sie mit "--mac-package-identifier" an. message.invalid-identifier=Ungültige Mac-Bundle-ID [{0}]. message.invalid-identifier.advice=Geben Sie die ID mit "--mac-package-identifier" an. message.building-dmg=DMG-Package für {0} wird erstellt. @@ -91,7 +80,6 @@ message.preparing-scripts=Packageskripte werden vorbereitet. message.preparing-distribution-dist=distribution.dist wird vorbereitet: {0}. message.signing.pkg=Warnung: Zum Signieren von PKG müssen Sie möglicherweise mit dem Schlüsselbundverwaltungstool die Option "Immer vertrauen" für Ihr Zertifikat festlegen. message.setfile.dmg=Das Festlegen des benutzerdefinierten Symbols für die DMG-Datei wurde übersprungen, weil das Utility "SetFile" nicht gefunden wurde. Durch Installieren von Xcode mit Befehlszeilentools sollte dieses Problem behoben werden. -message.install-dir-ignored=Warnung: "--install-dir" wird von DMG nicht unterstützt. Stattdessen wird standardmäßig /Applications verwendet. message.codesign.failed.reason.app.content="codesign" war nicht erfolgreich, und zusätzlicher Anwendungsinhalt wurde über den Parameter "--app-content" angegeben. Wahrscheinlich hat der zusätzliche Inhalt die Integrität des Anwendungs-Bundles beeinträchtigt und den Fehler verursacht. Stellen Sie sicher, das der über den Parameter "--app-content" angegebene Inhalt nicht die Integrität des Anwendungs-Bundles beeinträchtigt, oder fügen Sie ihn im Nachverarbeitungsschritt hinzu. message.codesign.failed.reason.xcode.tools=Möglicher Grund für "codesign"-Fehler ist fehlender Xcode mit Befehlszeilen-Entwicklertools. Installieren Sie Xcode mit Befehlszeilen-Entwicklertools, und prüfen Sie, ob das Problem dadurch beseitigt wird. warning.unsigned.app.image=Warnung: Nicht signiertes app-image wird zum Erstellen von signiertem {0} verwendet. diff --git a/src/jdk.jpackage/macosx/classes/jdk/jpackage/internal/resources/MacResources_ja.properties b/src/jdk.jpackage/macosx/classes/jdk/jpackage/internal/resources/MacResources_ja.properties index 5ea13254e93..4384d6507f9 100644 --- a/src/jdk.jpackage/macosx/classes/jdk/jpackage/internal/resources/MacResources_ja.properties +++ b/src/jdk.jpackage/macosx/classes/jdk/jpackage/internal/resources/MacResources_ja.properties @@ -1,5 +1,5 @@ # -# Copyright (c) 2017, 2024, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2017, 2025, 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 @@ -34,10 +34,6 @@ error.explicit-sign-no-cert=署名が明示的に要求されましたが、署 error.explicit-sign-no-cert.advice=有効なmac-signing-key-user-nameおよびmac-signing-keychainを指定してください error.must-sign-app-store=Mac App Storeアプリケーションは署名されている必要がありますが、署名はバンドラ構成によって無効化されています error.must-sign-app-store.advice=--mac-signオプションを適切なuser-nameおよびkeychain付きで使用してください -error.no-app-signing-key=Mac App Storeアプリケーションの署名キーがありません -error.no-app-signing-key.advice=XCodeを使用してアプリケーションの署名キーをMacキーチェーンにインストールします。 -error.no-pkg-signing-key=Mac App Storeインストーラの署名キーがありません -error.no-pkg-signing-key.advice=XCodeを使用してアプリケーションの署名キーをMacキーチェーンにインストールします。 error.certificate.expired=エラー: 証明書は{0}に期限が切れました error.cert.not.found=キーチェーン[{1}]を使用する[{0}]と一致する証明書が見つかりません error.multiple.certs.found=警告: キーチェーン[{1}]を使用する[{0}]と一致する複数の証明書が見つかりました。最初のものを使用します @@ -51,7 +47,6 @@ resource.dmg-setup-script=DMG設定スクリプト resource.license-setup=ライセンスの設定 resource.dmg-background=dmg背景 resource.volume-icon=ボリューム・アイコン -resource.post-install-script=アプリケーション・イメージを移入した後に実行するスクリプト resource.pkg-preinstall-script=PKGインストール前スクリプト resource.pkg-postinstall-script=PKGインストール後スクリプト resource.pkg-services-preinstall-script=サービス・パッケージのPKGインストール前スクリプト @@ -72,12 +67,6 @@ message.ignoring.symlink=警告: codesignがsymlink {0}をスキップしてい message.already.signed=ファイルはすでに署名されています: {0}。 message.keychain.error=エラー: キーチェーン・リストを取得できません。 message.building-bundle={0}のMac App Storeパッケージを作成しています。 -message.app-image-dir-does-not-exist=指定されたアプリケーション・イメージ・ディレクトリ {0}: {1}は存在しません。 -message.app-image-dir-does-not-exist.advice={0}の値が存在することを確認してください -message.app-image-requires-app-name=外部アプリケーション・イメージを使用する場合、アプリケーション名を指定する必要があります。 -message.app-image-requires-app-name.advice=-name CLIフラグ、fx:application/@name ANT属性または'appName'バンドラ引数でアプリケーション名を設定します。 -message.app-image-requires-identifier=アプリケーション・イメージから識別子を抽出できません。 -message.app-image-requires-identifier.advice=拡張エラー・メッセージに"--verbose"を使用するか、"--mac-package-identifier"を使用して指定します。 message.invalid-identifier=macバンドル識別子[{0}]が無効です。 message.invalid-identifier.advice="--mac-package-identifier"で識別子を指定してください。 message.building-dmg={0}のDMGパッケージを作成しています @@ -91,7 +80,6 @@ message.preparing-scripts=パッケージ・スクリプトを準備していま message.preparing-distribution-dist=distribution.distを準備しています: {0} message.signing.pkg=警告: PKGへの署名の場合、「キーチェーン・アクセス」ツールを使用して証明書に「常に信頼する」を設定する必要があります。 message.setfile.dmg='SetFile'ユーティリティが見つからないため、DMGファイルでのカスタム・アイコンの設定がスキップされました。Xcodeとコマンド・ライン・ツールをインストールすると、この問題は解決されます。 -message.install-dir-ignored=警告: "--install-dir"はDMGでサポートされていません。/Applicationsにデフォルト設定されます。 message.codesign.failed.reason.app.content="codesign"が失敗したため、追加のアプリケーション・コンテンツが、"--app-content"パラメータを介して提供されました。追加のコンテンツにより、アプリケーション・バンドルの整合性が損われ、失敗の原因になった可能性があります。"--app-content"パラメータを介して提供されたコンテンツによって、アプリケーション・バンドルの整合性が損われていないことを確認するか、処理後のステップで追加してください。 message.codesign.failed.reason.xcode.tools="codesign"失敗の考えられる理由は、Xcodeとコマンドライン・デベロッパ・ツールの欠落です。Xcodeとコマンドライン・デベロッパ・ツールをインストールして、問題が解決されるかを確認してください。 warning.unsigned.app.image=警告: 署名されていないapp-imageを使用して署名された{0}を作成します。 diff --git a/src/jdk.jpackage/macosx/classes/jdk/jpackage/internal/resources/MacResources_zh_CN.properties b/src/jdk.jpackage/macosx/classes/jdk/jpackage/internal/resources/MacResources_zh_CN.properties index 1a262f461ac..09c6d77694a 100644 --- a/src/jdk.jpackage/macosx/classes/jdk/jpackage/internal/resources/MacResources_zh_CN.properties +++ b/src/jdk.jpackage/macosx/classes/jdk/jpackage/internal/resources/MacResources_zh_CN.properties @@ -1,5 +1,5 @@ # -# Copyright (c) 2017, 2024, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2017, 2025, 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 @@ -34,10 +34,6 @@ error.explicit-sign-no-cert=已明确请求签名,但找不到签名证书 error.explicit-sign-no-cert.advice=指定有效的 mac-signing-key-user-name 和 mac-signing-keychain error.must-sign-app-store=Mac App Store 应用程序必须签名, 而打包程序配置已禁用签名 error.must-sign-app-store.advice=将 --mac-sign 选项用于适当的用户名和密钥链 -error.no-app-signing-key=无 Mac App Store 应用程序签名密钥 -error.no-app-signing-key.advice=使用 XCode 将应用程序签名密钥安装到 Mac 密钥链中。 -error.no-pkg-signing-key=无 Mac App Store 安装程序签名密钥 -error.no-pkg-signing-key.advice=使用 XCode 将应用程序签名密钥安装到 Mac 密钥链中。 error.certificate.expired=错误: 证书已失效 {0} error.cert.not.found=使用密钥链 [{1}] 找不到与 [{0}] 匹配的证书 error.multiple.certs.found=警告:使用密钥链 [{1}] 找到多个与 [{0}] 匹配的证书,将使用第一个证书 @@ -51,7 +47,6 @@ resource.dmg-setup-script=DMG 设置脚本 resource.license-setup=许可证设置 resource.dmg-background=DMG 背景 resource.volume-icon=卷图标 -resource.post-install-script=要在填充应用程序映像之后运行的脚本 resource.pkg-preinstall-script=PKG 安装前脚本 resource.pkg-postinstall-script=PKG 安装后脚本 resource.pkg-services-preinstall-script=服务程序包的 PKG 安装前脚本 @@ -72,12 +67,6 @@ message.ignoring.symlink=警告: codesign 正在跳过符号链接 {0}。 message.already.signed=文件已签名:{0}。 message.keychain.error=错误:无法获取密钥链列表。 message.building-bundle=正在为 {0} 构建 Mac App Store 程序包。 -message.app-image-dir-does-not-exist=指定的应用程序映像目录 {0}:{1} 不存在。 -message.app-image-dir-does-not-exist.advice=确认 {0} 的值是否存在。 -message.app-image-requires-app-name=使用外部应用程序映像时, 必须指定应用程序名称。 -message.app-image-requires-app-name.advice=通过 -name CLI 标记, fx:application/@name ANT 属性或通过 'appName' 打包程序参数设置应用程序名称。 -message.app-image-requires-identifier=无法从应用程序映像提取标识符。 -message.app-image-requires-identifier.advice=请使用 "--verbose" 获取扩展错误消息,或者通过 "--mac-package-identifier" 指定它。 message.invalid-identifier=无效的 Mac 包标识符 [{0}]。 message.invalid-identifier.advice=请使用 "--mac-package-identifier" 指定标识符。 message.building-dmg=正在为 {0} 构建 DMG 程序包。 @@ -91,7 +80,6 @@ message.preparing-scripts=正在准备程序包脚本。 message.preparing-distribution-dist=正在准备 distribution.dist: {0}。 message.signing.pkg=警告:要对 PKG 进行签名,可能需要使用“密钥链访问”工具为证书设置“始终信任”。 message.setfile.dmg=由于未找到 'SetFile' 实用程序,跳过了针对 DMG 文件设置定制图标的操作。安装带命令行工具的 Xcode 应能解决此问题。 -message.install-dir-ignored=警告:"--install-dir" 不受 DMG 支持,将默认为 /Applications。 message.codesign.failed.reason.app.content="codesign" 失败,并通过 "--app-content" 参数提供了附加应用程序内容。可能是附加内容破坏了应用程序包的完整性,导致了故障。请确保通过 "--app-content" 参数提供的内容不会破坏应用程序包的完整性,或者在后处理步骤中添加该内容。 message.codesign.failed.reason.xcode.tools="codesign" 失败可能是因为缺少带命令行开发人员工具的 Xcode。请安装带命令行开发人员工具的 Xcode,看看是否可以解决问题。 warning.unsigned.app.image=警告:使用未签名的 app-image 生成已签名的 {0}。 diff --git a/src/jdk.jpackage/share/classes/jdk/jpackage/internal/resources/HelpResources_de.properties b/src/jdk.jpackage/share/classes/jdk/jpackage/internal/resources/HelpResources_de.properties index 3c66e8bb151..c1cb5bf4283 100644 --- a/src/jdk.jpackage/share/classes/jdk/jpackage/internal/resources/HelpResources_de.properties +++ b/src/jdk.jpackage/share/classes/jdk/jpackage/internal/resources/HelpResources_de.properties @@ -33,7 +33,7 @@ MSG_Help_win_install=\ --win-dir-chooser\n Fügt ein Dialogfeld hinzu, MSG_Help_win_install_dir=Relativer Unterpfad unter dem Standardinstallationsverzeichnis\n MSG_Help_mac_install=\ --mac-dmg-content [,...]\n Nimmt den gesamten referenzierten Inhalt in die DMG-Datei auf.\n Diese Option kann mehrmals verwendet werden. \n MSG_Help_mac_launcher=\ --mac-package-identifier \n Eine ID, die die Anwendung für macOS eindeutig identifiziert\n Standardwert ist der Hauptklassenname.\n Es dürfen nur alphanumerische Zeichen (A-Z, a-z, 0-9), Bindestriche (-)\n und Punkte (.) verwendet werden.\n --mac-package-name \n Name der Anwendung, wie in der Menüleiste angezeigt\n Dieser kann vom Anwendungsnamen abweichen.\n Er darf maximal 15 Zeichen enthalten und muss für die Anzeige\n in der Menüleiste und im Infofenster der Anwendung geeignet sein.\n Standardwert: Anwendungsname.\n --mac-package-signing-prefix \n Beim Signieren des Anwendungspackages wird dieser Wert\n allen zu signierenden Komponenten ohne vorhandene\n Package-ID als Präfix vorangestellt.\n --mac-sign\n Anforderung zum Signieren des Packages oder des vordefinierten\nAnwendungsimages\n --mac-signing-keychain \n Name des Schlüsselbundes für die Suche nach der Signaturidentität\n Bei fehlender Angabe werden die Standardschlüsselbunde verwendet.\n --mac-signing-key-user-name \n Team- oder Benutzernamensteil der Apple-Signaturidentitäten. Um direkt zu steuern,\n welche Signaturidentität zum Signieren eines Anwendungsimages oder\n Installationsprogramms verwendet wird, verwenden Sie --mac-app-image-sign-identity und/oder\n --mac-installer-sign-identity. Diese Option kann nicht mit\n --mac-app-image-sign-identity oder --mac-installer-sign-identity kombiniert werden.\n --mac-app-image-sign-identity \n Zum Signieren des Anwendungsimages verwendete Identität. Dieser Wert wird\n direkt an die Option --sign des Tools "codesign" übergeben. Diese Option kann nicht\n mit --mac-signing-key-user-name kombiniert werden.\n --mac-installer-sign-identity \n Zum Signieren des Installationsprogramms "pkg" verwendete Identität. Dieser Wert wird\n direkt an die Option --sign des Tools "productbuild" übergeben. Diese Option\n kann nicht mit --mac-signing-key-user-name kombiniert werden.\n --mac-app-store\n Gibt an, dass die jpackage-Ausgabe für den\n Mac App Store bestimmt ist.\n --mac-entitlements \n Pfad zu einer Datei mit Berechtigungen, die beim Signieren\n von ausführbaren Dateien und Librarys im Bundle verwendet werden sollen.\n --mac-app-category \n Zeichenfolge für das Erstellen von LSApplicationCategoryType in\n Anwendungs-plist. Standardwert: "utilities".\n -MSG_Help_linux_install=\ --linux-package-name \n Name für das Linux-Package, Standardwert: Anwendungsname\n --linux-deb-maintainer \n Maintainer für .deb-Package\n --linux-menu-group \n Menügruppe, in der diese Anwendung abgelegt wird\n --linux-package-deps \n Erforderliche Packages oder Funktionen für die Anwendung\n --linux-rpm-license-type \n Typ der Lizenz ("License: " der RPM-SPEC-Datei)\n --linux-app-release \n Releasewert der RPM-SPEC-Datei oder \n Debian-Revisionswert der DEB-Kontrolldatei\n --linux-app-category \n Gruppenwert der RPM-SPEC-Datei oder \n Abschnittswert der DEB-Kontrolldatei\n --linux-shortcut\n Erstellt eine Verknüpfung für die Anwendung.\n +MSG_Help_linux_install=\ --linux-package-name \n Name für das Linux-Package, Standardwert: Anwendungsname\n --linux-deb-maintainer \n Maintainer für .deb-Package\n --linux-menu-group \n Menügruppe, in der diese Anwendung abgelegt wird\n --linux-package-deps \n Erforderliche Packages oder Funktionen für die Anwendung\n --linux-rpm-license-type \n Typ der Lizenz ("License: " der RPM-SPEC-Datei)\n --linux-app-release \n Releasewert der RPM-Datei .spec oder \n Debian-Revisionswert der DEB-Kontrolldatei\n --linux-app-category \n Gruppenwert der RPM-Datei .spec oder \n Abschnittswert der DEB-Kontrolldatei\n --linux-shortcut\n Erstellt einen Shortcut für die Anwendung.\n MSG_Help_mac_linux_install_dir=Absoluter Pfad des Installationsverzeichnisses der Anwendung\n MSG_Help_default_install_dir=Absoluter Pfad des Installationsverzeichnisses der Anwendung auf OS X\n oder Linux. Relativer Unterpfad des Installationsverzeichnisses der\n Anwendung wie "Programme" oder "AppData" unter Windows.\n MSG_Help_no_args=Verwendung: jpackage \nVerwenden Sie jpackage --help (oder -h), um eine Liste möglicher Optionen aufzurufen diff --git a/src/jdk.jpackage/share/classes/jdk/jpackage/internal/resources/MainResources_de.properties b/src/jdk.jpackage/share/classes/jdk/jpackage/internal/resources/MainResources_de.properties index e50af2320ce..1221ae747de 100644 --- a/src/jdk.jpackage/share/classes/jdk/jpackage/internal/resources/MainResources_de.properties +++ b/src/jdk.jpackage/share/classes/jdk/jpackage/internal/resources/MainResources_de.properties @@ -1,5 +1,5 @@ # -# Copyright (c) 2017, 2023, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2017, 2025, 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 @@ -30,24 +30,23 @@ param.copyright.default=Copyright (C) {0,date,YYYY} param.description.default=Kein Wert param.vendor.default=Unbekannt +resource.post-app-image-script=Auszuführendes Skript nach dem Auffüllen des Anwendungsimages + message.using-default-resource=Standardpackageressource {0} {1} wird verwendet (durch Hinzufügen von {2} zu resource-dir ist eine Anpassung möglich). message.no-default-resource=Keine Standardpackageressource {0} {1} (durch Hinzufügen von {2} zu resource-dir ist eine Anpassung möglich). message.using-custom-resource-from-file=Benutzerdefinierte Packageressource {0} wird verwendet (aus Datei {1} geladen). message.using-custom-resource=Benutzerdefinierte Packageressource {0} wird verwendet (aus {1} geladen). message.creating-app-bundle=Anwendungspackage {0} wird in {1} erstellt -message.app-image-dir-does-not-exist=Angegebenes Anwendungsimageverzeichnis {0}: {1} ist nicht vorhanden -message.app-image-dir-does-not-exist.advice=Bestätigen Sie, dass der Wert für {0} vorhanden ist message.runtime-image-dir-does-not-exist=Angegebenes Laufzeitimageverzeichnis {0}: {1} ist nicht vorhanden -message.runtime-image-dir-does-not-exist.advice=Bestätigen Sie, dass der Wert für {0} vorhanden ist message.resource-dir-does-not-exist=Angegebenes Ressourcenverzeichnis {0}: {1} ist nicht vorhanden message.debug-working-directory=Arbeitsverzeichnis für Debug beibehalten: {0} message.bundle-created={0}-Package wurde erfolgreich erstellt message.module-version=Version "{0}" aus Modul "{1}" wird als Anwendungsversion verwendet message.module-class=Klasse "{0}" aus Modul "{1}" wird als Anwendungshauptklasse verwendet -error.version-string-empty="Version darf keine leere Zeichenfolge sein" -error.version-string-zero-length-component="Version [{0}] enthält eine Komponente mit einer Nulllänge" -error.version-string-invalid-component="Version [{0}] enthält ungültige Komponente [{1}]" +error.version-string-empty=Version darf keine leere Zeichenfolge sein +error.version-string-zero-length-component=Version [{0}] enthält eine Komponente mit Nulllänge +error.version-string-invalid-component=Version [{0}] enthält ungültige Komponente [{1}] error.cannot-create-output-dir=Zielverzeichnis {0} kann nicht erstellt werden error.cannot-write-to-output-dir=Zielverzeichnis {0} ist schreibgeschützt @@ -61,7 +60,6 @@ error.main-jar-does-not-exist.advice=Die Haupt-JAR-Datei muss relativ zum Eingab error.no-module-in-path="{0}-Modul im Modulpfad nicht gefunden" error.not-path-parameter="Ungültiger Wert für Parameter {0}: {1}" error.no-input-parameter="--input-Parameter für nicht modulare Anwendung fehlt" -error.no-main-jar-parameter="--main-jar-Parameter für nicht modulare Anwendung fehlt" error.no-content-types-for-file-association=Für Dateiverknüpfungsnummer {0} wurden keine MIME-Typen angegeben error.no-content-types-for-file-association.advice=Geben Sie einen MIME-Typ für Dateiverknüpfungsnummer {0} an @@ -75,11 +73,14 @@ error.tool-old-version.advice=Installieren Sie {0} {1} oder eine neuere Version error.jlink.failed=jlink nicht erfolgreich mit: {0} error.blocked.option=jlink-Option [{0}] ist in --jlink-options nicht zulässig error.no.name=Name nicht mit --name angegeben. Es kann auch kein Name aus app-image abgeleitet werden +error.no.name.advice=Geben Sie den Namen mit --name an warning.no.jdk.modules.found=Warnung: Keine JDK-Module gefunden error.foreign-app-image=Fehler : Fehlende .jpackage.xml-Datei in app-image-Verzeichnis "{0}" -error.invalid-app-image=Fehler: app-image-Verzeichnis "{0}" wurde von einer anderen jpackage-Version generiert, oder "{1}" ist nicht wohlgeformt +error.invalid-app-image=Fehler: app-image-Verzeichnis "{0}" wurde von einer anderen jpackage-Version generiert, oder Datei "{1}" ist nicht wohlgeformt + +error.invalid-install-dir=Ungültiges Installationsverzeichnis "{0}" MSG_BundlerFailed=Fehler: Bundler "{1}" ({0}) konnte kein Package generieren MSG_BundlerConfigException=Bundler {0} aufgrund eines Konfigurationsproblems übersprungen: {1} \nEmpfehlung zur Behebung: {2} @@ -96,11 +97,9 @@ ERR_InvalidOptionWithAppImageSigning=Fehler: Option [{0}] ist nicht gültig beim ERR_MissingArgument=Fehler: Fehlendes Argument: {0} ERR_MissingRequiredArgument=Fehler: Für das Argument {0} ist mindestens eines der folgenden Argumente erforderlich: [{1}] -ERR_MissingAppResources=Fehler: Keine Anwendungs-JAR-Dateien gefunden ERR_AppImageNotExist=Fehler: Anwendungsimageverzeichnis "{0}" ist nicht vorhanden ERR_NoAddLauncherName=Fehler: Für Option --add-launcher müssen ein Name und ein Dateipfad angegeben werden (--add-launcher =) ERR_NoUniqueName=Fehler: Für --add-launcher = ist ein eindeutiger Name erforderlich -ERR_NoJreInstallerName=Fehler: Für JRE-Installationsprogramme ist ein Namensparameter erforderlich ERR_InvalidAppName=Fehler: Ungültiger Anwendungsname: {0} ERR_InvalidSLName=Fehler: Ungültiger Name für hinzuzufügenden Launcher: {0} ERR_IconFileNotExit=Fehler: Die angegebene Symboldatei [{0}] ist nicht vorhanden @@ -110,8 +109,6 @@ ERR_InvalidOption=Fehler: Ungültige Option: [{0}] ERR_InvalidInstallerType=Fehler: Ungültiger oder nicht unterstützter Typ: [{0}] ERR_BothMainJarAndModule=Fehler: Die Optionen --main-jar und --module dürfen nicht beide vorhanden sein ERR_NoEntryPoint=Fehler: Für das Erstellen des Anwendungsimages muss entweder die Option --main-jar oder die Option --module angegeben werden -ERR_InputNotDirectory=Fehler: Das angegebene Eingabeverzeichnis ist kein Verzeichnis: {0} -ERR_CannotReadInputDir=Fehler: Keine Berechtigung zum Lesen aus Eingabeverzeichnis vorhanden: {0} ERR_CannotParseOptions=Fehler: Option @filename wird verarbeitet: {0} ERR_MissingJLinkOptMacAppStore=Fehler: Argument "--mac-app-store" erfordert eine {0}-Option für Argument "--jlink-options" ERR_MacAppStoreRuntimeBinExists=Fehler: Laufzeitimage "{0}" darf nicht den Ordner "bin" enthalten. Verwenden Sie die jlink-Option "--strip-native-commands" beim Generieren des Laufzeitimages mit dem Argument "--mac-app-store". diff --git a/src/jdk.jpackage/share/classes/jdk/jpackage/internal/resources/MainResources_ja.properties b/src/jdk.jpackage/share/classes/jdk/jpackage/internal/resources/MainResources_ja.properties index c5f0dc328d2..5a04af8a7bc 100644 --- a/src/jdk.jpackage/share/classes/jdk/jpackage/internal/resources/MainResources_ja.properties +++ b/src/jdk.jpackage/share/classes/jdk/jpackage/internal/resources/MainResources_ja.properties @@ -1,5 +1,5 @@ # -# Copyright (c) 2017, 2023, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2017, 2025, 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 @@ -30,24 +30,23 @@ param.copyright.default=Copyright (C) {0,date,YYYY} param.description.default=なし param.vendor.default=不明 +resource.post-app-image-script=アプリケーション・イメージを移入した後に実行するスクリプト + message.using-default-resource=デフォルトのパッケージ・リソース{0} {1}の使用({2}をresource-dirに追加してカスタマイズ)。 message.no-default-resource=デフォルトのパッケージ・リソース{0} {1}なし({2}をresource-dirに追加してカスタマイズ)。 message.using-custom-resource-from-file=カスタム・パッケージ・リソース{0}の使用(ファイル{1}からロード済) message.using-custom-resource=カスタム・パッケージ・リソース{0}の使用({1}からロード済) message.creating-app-bundle=アプリケーション・パッケージを作成しています: {1}内の{0} -message.app-image-dir-does-not-exist=指定されたアプリケーション・イメージ・ディレクトリ{0}: {1}は存在しません -message.app-image-dir-does-not-exist.advice={0}の値が存在することを確認してください message.runtime-image-dir-does-not-exist=指定されたランタイム・イメージ・ディレクトリ{0}: {1}は存在しません -message.runtime-image-dir-does-not-exist.advice={0}の値が存在することを確認してください message.resource-dir-does-not-exist=指定されたリソース・ディレクトリ{0}: {1}は存在しません message.debug-working-directory=デバッグの作業ディレクトリが保持されました: {0} message.bundle-created={0}パッケージの作成に成功しました message.module-version=モジュール"{1}"のバージョン"{0}"をアプリケーション・バージョンとして使用 message.module-class=モジュール"{1}"のクラス"{0}"をアプリケーション・メイン・クラスとして使用 -error.version-string-empty="バージョンを空の文字列にすることはできません" -error.version-string-zero-length-component="バージョン[{0}]に長さゼロのコンポーネントが含まれます" -error.version-string-invalid-component="バージョン[{0}]に無効なコンポーネント[{1}]が含まれます" +error.version-string-empty=バージョンを空の文字列にすることはできません +error.version-string-zero-length-component=バージョン[{0}]に長さゼロのコンポーネントが含まれます +error.version-string-invalid-component=バージョン[{0}]に無効なコンポーネント[{1}]が含まれます error.cannot-create-output-dir=宛先ディレクトリ{0}を作成できません。 error.cannot-write-to-output-dir=宛先ディレクトリ{0}は書込み不可です @@ -61,7 +60,6 @@ error.main-jar-does-not-exist.advice=入力ディレクトリに対して相対 error.no-module-in-path="モジュール・パスに{0}モジュールが見つかりませんでした" error.not-path-parameter="{0}パラメータの無効な値: {1}" error.no-input-parameter="非モジュラ・アプリケーションに--inputパラメータがありません" -error.no-main-jar-parameter="非モジュラ・アプリケーションに--main-jarパラメータがありません" error.no-content-types-for-file-association=ファイル・アソシエーション番号{0}にMIMEタイプが指定されませんでした error.no-content-types-for-file-association.advice=ファイル・アソシエーション番号{0}にMIMEタイプを指定してください @@ -75,11 +73,14 @@ error.tool-old-version.advice={0} {1}以降をインストールしてくださ error.jlink.failed=jlinkが次で失敗しました: {0} error.blocked.option=jlinkオプション[{0}]は--jlink-optionsでは許可されません error.no.name=名前が--nameで指定されておらず、app-imageから推論できません +error.no.name.advice=--nameで名前を指定します warning.no.jdk.modules.found=警告: JDKモジュールが見つかりません error.foreign-app-image=エラー: app-imageディレクトリ"{0}"に.jpackage.xmlファイルがありません -error.invalid-app-image=エラー: app-imageディレクトリ"{0}"は、別のjpackageバージョンまたは不正な"{1}"で生成されました +error.invalid-app-image=エラー: app-imageディレクトリ"{0}"は、別のjpackageバージョンまたは不正な"{1}"ファイルで生成されました + +error.invalid-install-dir=無効なインストール・ディレクトリ"{0}" MSG_BundlerFailed=エラー: バンドラ"{1}" ({0})がパッケージの生成に失敗しました MSG_BundlerConfigException=構成の問題のため、バンドラ{0}がスキップされました: {1} \n次の修正を行ってください: {2} @@ -96,11 +97,9 @@ ERR_InvalidOptionWithAppImageSigning=エラー: アプリケーション・イ ERR_MissingArgument=エラー: 引数がありません: {0} ERR_MissingRequiredArgument=エラー: {0}引数には少なくとも1つの[{1}]引数が必要です -ERR_MissingAppResources=エラー: アプリケーションjarが見つかりませんでした ERR_AppImageNotExist=エラー: アプリケーション・イメージ・ディレクトリ"{0}"は存在しません ERR_NoAddLauncherName=エラー: --add-launcherオプションには名前およびファイル・パスが必要です(--add-launcher =) ERR_NoUniqueName=エラー: --add-launcher =には一意の名前が必要です -ERR_NoJreInstallerName=エラー: Jreインストーラには名前パラメータが必要です ERR_InvalidAppName=エラー: 無効なアプリケーション名: {0} ERR_InvalidSLName=エラー: 無効な追加ランチャ名: {0} ERR_IconFileNotExit=エラー: 指定されたアイコン・ファイル[{0}]は存在しません @@ -110,8 +109,6 @@ ERR_InvalidOption=エラー: 無効なオプション: [{0}] ERR_InvalidInstallerType=エラー: 無効またはサポートされていないタイプ: [{0}] ERR_BothMainJarAndModule=エラー: --main-jarオプションと--moduleオプションの両方を指定することはできません ERR_NoEntryPoint=エラー: アプリケーション・イメージの作成には--main-jarまたは--moduleオプションが必要です -ERR_InputNotDirectory=エラー: 指定された入力ディレクトリはディレクトリではありません: {0} -ERR_CannotReadInputDir=エラー: 入力ディレクトリから読み取る権限がありません: {0} ERR_CannotParseOptions=エラー: @filenameオプションの処理: {0} ERR_MissingJLinkOptMacAppStore=エラー: --mac-app-store引数では、--jlink-options引数に{0}オプションが必要です ERR_MacAppStoreRuntimeBinExists=エラー: ランタイム・イメージ"{0}"に"bin"フォルダを含めることはできません。--mac-app-store引数で使用されるランタイム・イメージを生成する際に、--strip-native-commands jlinkオプションを使用します。 diff --git a/src/jdk.jpackage/share/classes/jdk/jpackage/internal/resources/MainResources_zh_CN.properties b/src/jdk.jpackage/share/classes/jdk/jpackage/internal/resources/MainResources_zh_CN.properties index 0d9c3b5a676..5546abef09f 100644 --- a/src/jdk.jpackage/share/classes/jdk/jpackage/internal/resources/MainResources_zh_CN.properties +++ b/src/jdk.jpackage/share/classes/jdk/jpackage/internal/resources/MainResources_zh_CN.properties @@ -1,5 +1,5 @@ # -# Copyright (c) 2017, 2023, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2017, 2025, 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 @@ -30,24 +30,23 @@ param.copyright.default=版权所有 (C) {0,date,YYYY} param.description.default=无 param.vendor.default=未知 +resource.post-app-image-script=要在填充应用程序映像之后运行的脚本 + message.using-default-resource=使用默认程序包资源 {0} {1}(将 {2} 添加到 resource-dir 中以进行定制)。 message.no-default-resource=无默认程序包资源 {0} {1}(将 {2} 添加到 resource-dir 中以进行定制)。 message.using-custom-resource-from-file=使用定制程序包资源 {0} (从文件 {1} 加载)。 message.using-custom-resource=使用定制程序包资源 {0} (从 {1} 加载)。 message.creating-app-bundle=正在 {1} 中创建应用程序包 {0} -message.app-image-dir-does-not-exist=指定的应用程序映像目录 {0}:{1} 不存在 -message.app-image-dir-does-not-exist.advice=确认 {0} 的值是否存在 message.runtime-image-dir-does-not-exist=指定的运行时映像目录 {0}:{1} 不存在 -message.runtime-image-dir-does-not-exist.advice=确认 {0} 的值是否存在 message.resource-dir-does-not-exist=指定的资源目录 {0}:{1} 不存在 message.debug-working-directory=用于调试的已保留工作目录: {0} message.bundle-created=已成功地构建 {0} 程序包 message.module-version=正在将模块 "{1}" 中的版本 "{0}" 用作应用程序版本 message.module-class=正在将模块 "{1}" 中的类 "{0}" 用作应用程序主类 -error.version-string-empty="版本不能为空字符串" -error.version-string-zero-length-component="版本 [{0}] 包含长度为零的组件" -error.version-string-invalid-component="版本 [{0}] 包含无效组件 [{1}]" +error.version-string-empty=版本不能为空字符串 +error.version-string-zero-length-component=版本 [{0}] 包含长度为零的组件 +error.version-string-invalid-component=版本 [{0}] 包含无效组件 [{1}] error.cannot-create-output-dir=无法创建目标目录 {0} error.cannot-write-to-output-dir=目标目录 {0} 不可写 @@ -61,7 +60,6 @@ error.main-jar-does-not-exist.advice=必须使用相对于输入目录的路径 error.no-module-in-path="无法在模块路径中找到 {0} 模块" error.not-path-parameter="{0} 参数的值无效:{1}" error.no-input-parameter="非模块化应用程序缺少 --input 参数" -error.no-main-jar-parameter="非模块化应用程序缺少 --main-jar 参数" error.no-content-types-for-file-association=没有为文件关联号{0}指定 MIME 类型 error.no-content-types-for-file-association.advice=为文件关联号 {0} 指定 MIME 类型 @@ -75,11 +73,14 @@ error.tool-old-version.advice=请安装 {0} {1}或更新版本 error.jlink.failed=jlink 失败,出现 {0} error.blocked.option=不允许在 --jlink-options 中使用 jlink 选项 [{0}] error.no.name=未使用 --name 指定名称,无法从 app-image 推断名称 +error.no.name.advice=使用 --name 指定名称 warning.no.jdk.modules.found=警告: 未找到 JDK 模块 error.foreign-app-image=错误:app-image 目录 "{0}" 中缺少 .jpackage.xml 文件 -error.invalid-app-image=错误:另一个 jpackage 版本或格式错误的 "{1}" 生成了 app-image 目录 "{0}" +error.invalid-app-image=错误:另一个 jpackage 版本或格式错误的 "{1}" 文件生成了 app-image 目录 "{0}" + +error.invalid-install-dir=安装目录 "{0}" 无效 MSG_BundlerFailed=错误:打包程序 "{1}" ({0}) 无法生成程序包 MSG_BundlerConfigException=由于配置问题, 跳过了打包程序{0}: {1} \n修复建议: {2} @@ -96,11 +97,9 @@ ERR_InvalidOptionWithAppImageSigning=错误:对应用程序映像签名时, ERR_MissingArgument=错误: 缺少参数: {0} ERR_MissingRequiredArgument=错误:{0} 参数至少需要 [{1}] 参数之一 -ERR_MissingAppResources=错误: 找不到应用程序 jar ERR_AppImageNotExist=错误:应用程序映像目录 "{0}" 不存在 ERR_NoAddLauncherName=错误:--add-launcher 选项需要一个名称和一个文件路径 (--add-launcher =) ERR_NoUniqueName=错误:--add-launcher = 需要一个唯一的名称 -ERR_NoJreInstallerName=错误:Jre 安装程序需要一个名称参数 ERR_InvalidAppName=错误:应用程序名称 {0} 无效 ERR_InvalidSLName=错误:添加启动程序名称 {0} 无效 ERR_IconFileNotExit=错误:指定的图标文件 [{0}] 不存在 @@ -110,8 +109,6 @@ ERR_InvalidOption=错误:选项 [{0}] 无效 ERR_InvalidInstallerType=错误:类型 [{0}] 无效或不受支持 ERR_BothMainJarAndModule=错误:不能同时包含 --main-jar 和 --module 选项 ERR_NoEntryPoint=错误:创建应用程序映像需要 --main-jar 或 --module 选项 -ERR_InputNotDirectory=错误:指定的输入目录不是目录:{0} -ERR_CannotReadInputDir=错误:无权从输入目录读取:{0} ERR_CannotParseOptions=错误:正在处理 @filename 选项:{0} ERR_MissingJLinkOptMacAppStore=错误:对于 --jlink-options 参数,--mac-app-store 参数需要 {0} 选项 ERR_MacAppStoreRuntimeBinExists=错误:运行时映像 "{0}" 不应包含 "bin" 文件夹。生成与 --mac-app-store 参数一起使用的运行时映像时,使用 --strip-native-commands jlink 选项。 diff --git a/src/jdk.jpackage/windows/classes/jdk/jpackage/internal/resources/MsiInstallerStrings_de.wxl b/src/jdk.jpackage/windows/classes/jdk/jpackage/internal/resources/MsiInstallerStrings_de.wxl index 5e30d3744ec..2d0d1d098f8 100644 --- a/src/jdk.jpackage/windows/classes/jdk/jpackage/internal/resources/MsiInstallerStrings_de.wxl +++ b/src/jdk.jpackage/windows/classes/jdk/jpackage/internal/resources/MsiInstallerStrings_de.wxl @@ -16,5 +16,5 @@ Mit [ProductName] öffnen - [ProductName][ProductVersion] is not supported on this version of Windows + [ProductName][ProductVersion] wird unter dieser Windows-Version nicht unterstützt diff --git a/src/jdk.jpackage/windows/classes/jdk/jpackage/internal/resources/MsiInstallerStrings_ja.wxl b/src/jdk.jpackage/windows/classes/jdk/jpackage/internal/resources/MsiInstallerStrings_ja.wxl index 4639e2f8fed..88a662b4b1f 100644 --- a/src/jdk.jpackage/windows/classes/jdk/jpackage/internal/resources/MsiInstallerStrings_ja.wxl +++ b/src/jdk.jpackage/windows/classes/jdk/jpackage/internal/resources/MsiInstallerStrings_ja.wxl @@ -16,5 +16,5 @@ [ProductName]で開く - [ProductName][ProductVersion] is not supported on this version of Windows + [ProductName][ProductVersion]は、 このバージョンのWindowsでサポートされていません diff --git a/src/jdk.jpackage/windows/classes/jdk/jpackage/internal/resources/MsiInstallerStrings_zh_CN.wxl b/src/jdk.jpackage/windows/classes/jdk/jpackage/internal/resources/MsiInstallerStrings_zh_CN.wxl index 06974dd84e5..48a342e58a3 100644 --- a/src/jdk.jpackage/windows/classes/jdk/jpackage/internal/resources/MsiInstallerStrings_zh_CN.wxl +++ b/src/jdk.jpackage/windows/classes/jdk/jpackage/internal/resources/MsiInstallerStrings_zh_CN.wxl @@ -16,5 +16,5 @@ 使用 [ProductName] 打开 - [ProductName][ProductVersion] is not supported on this version of Windows + 此版本的 Windows 不支持 [ProductName][ProductVersion] diff --git a/src/jdk.jpackage/windows/classes/jdk/jpackage/internal/resources/WinResources_de.properties b/src/jdk.jpackage/windows/classes/jdk/jpackage/internal/resources/WinResources_de.properties index b6561747ce0..3e6f8e30d6a 100644 --- a/src/jdk.jpackage/windows/classes/jdk/jpackage/internal/resources/WinResources_de.properties +++ b/src/jdk.jpackage/windows/classes/jdk/jpackage/internal/resources/WinResources_de.properties @@ -1,5 +1,5 @@ # -# Copyright (c) 2017, 2024, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2017, 2025, 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 @@ -32,7 +32,6 @@ param.menu-group.default=Unbekannt resource.executable-properties-template=Vorlage für das Erstellen der ausführbaren Eigenschaftendatei resource.setup-icon=Symbol für Dialogfeld "Setup" -resource.post-app-image-script=Auszuführendes Skript nach dem Auffüllen des Anwendungsimages resource.post-msi-script=Auszuführendes Skript nach dem Erstellen der MSI-Datei für das EXE-Installationsprogramm resource.wxl-file=WiX-Lokalisierungsdatei resource.main-wix-file=Haupt-WiX-Projektdatei @@ -41,6 +40,7 @@ resource.shortcutpromptdlg-wix-file=Dialogfeld für Verknüpfungs-Prompt der WiX resource.installdirnotemptydlg-wix-file=Nicht leeres Installationsverzeichnis in Dialogfeld für WiX-Projektdatei resource.launcher-as-service-wix-file=WiX-Projektdatei für Serviceinstallationsprogramm resource.wix-src-conv=XSLT-Stylesheet zum Konvertieren von WiX-Quellen vom Format WiX v3 in WiX v4 +resource.installer-exe=Ausführbares Installationsprogramm error.no-wix-tools=WiX-Tools nicht gefunden. Gesucht wurden WiX v3 light.exe und candle.exe oder WiX v4/v5 wix.exe, aber keine der Dateien wurde gefunden error.no-wix-tools.advice=Laden Sie WiX 3.0 oder höher von https://wixtoolset.org herunter, und fügen Sie es zu PATH hinzu. @@ -67,7 +67,6 @@ message.output-location=Installationsprogramm (.exe) gespeichert in: {0} message.tool-version=[{0}]-Version [{1}] erkannt. message.creating-association-with-null-extension=Verknüpfung mit Nullerweiterung wird erstellt. message.wrong-tool-version=[{0}]-Version {1} wurde erkannt. Erforderlich ist jedoch Version {2}. -message.version-string-too-many-components=Versionszeichenfolge kann bis zu 3 Komponenten aufweisen: major.minor.build. message.use-wix36-features=WiX {0} erkannt. Erweiterte Bereinigungsaktion wird aktiviert. message.product-code=MSI-ProductCode: {0}. message.upgrade-code=MSI-UpgradeCode: {0}. diff --git a/src/jdk.jpackage/windows/classes/jdk/jpackage/internal/resources/WinResources_ja.properties b/src/jdk.jpackage/windows/classes/jdk/jpackage/internal/resources/WinResources_ja.properties index 5dbf0eaa058..07604dc9980 100644 --- a/src/jdk.jpackage/windows/classes/jdk/jpackage/internal/resources/WinResources_ja.properties +++ b/src/jdk.jpackage/windows/classes/jdk/jpackage/internal/resources/WinResources_ja.properties @@ -1,5 +1,5 @@ # -# Copyright (c) 2017, 2024, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2017, 2025, 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 @@ -32,7 +32,6 @@ param.menu-group.default=不明 resource.executable-properties-template=実行可能なプロパティ・ファイル作成用のテンプレート resource.setup-icon=設定ダイアログ・アイコン -resource.post-app-image-script=アプリケーション・イメージを移入した後に実行するスクリプト resource.post-msi-script=exeインストーラのmsiファイルが作成された後に実行するスクリプト resource.wxl-file=WiXローカリゼーション・ファイル resource.main-wix-file=メインWiXプロジェクト・ファイル @@ -41,6 +40,7 @@ resource.shortcutpromptdlg-wix-file=ショートカット・プロンプト・ resource.installdirnotemptydlg-wix-file=インストール・ディレクトリ・ダイアログのWiXプロジェクト・ファイルが空ではありません resource.launcher-as-service-wix-file=サービス・インストーラWiXプロジェクト・ファイル resource.wix-src-conv=WiXソースをWiX v3からWiX v4フォーマットに変換するXSLTスタイルシート +resource.installer-exe=インストーラ実行可能ファイル error.no-wix-tools=WiXツールが見つかりません。WiX v3 light.exeとcandle.exeまたはWiX v4/v5 wix.exeを探しましたが、いずれも見つかりませんでした error.no-wix-tools.advice=WiX 3.0以降をhttps://wixtoolset.orgからダウンロードし、PATHに追加します。 @@ -67,7 +67,6 @@ message.output-location=インストーラ(.exe)は次に保存されました: message.tool-version=[{0}]バージョン[{1}]が検出されました。 message.creating-association-with-null-extension=null拡張子との関連付けを作成しています。 message.wrong-tool-version=[{0}]バージョン{1}が検出されましたが、バージョン{2}が必要です。 -message.version-string-too-many-components=バージョン文字列には、コンポーネントを3つ(メジャー.マイナー.ビルド)まで含めることができます。 message.use-wix36-features=WiX {0}が検出されました。拡張クリーンアップ・アクションを有効化しています。 message.product-code=MSI ProductCode: {0}。 message.upgrade-code=MSI UpgradeCode: {0}。 diff --git a/src/jdk.jpackage/windows/classes/jdk/jpackage/internal/resources/WinResources_zh_CN.properties b/src/jdk.jpackage/windows/classes/jdk/jpackage/internal/resources/WinResources_zh_CN.properties index 2fb4e8e40e7..7eae69fba2f 100644 --- a/src/jdk.jpackage/windows/classes/jdk/jpackage/internal/resources/WinResources_zh_CN.properties +++ b/src/jdk.jpackage/windows/classes/jdk/jpackage/internal/resources/WinResources_zh_CN.properties @@ -1,5 +1,5 @@ # -# Copyright (c) 2017, 2024, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2017, 2025, 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 @@ -32,7 +32,6 @@ param.menu-group.default=未知 resource.executable-properties-template=用于创建可执行属性文件的模板 resource.setup-icon=设置对话框图标 -resource.post-app-image-script=要在填充应用程序映像之后运行的脚本 resource.post-msi-script=在为 exe 安装程序创建 msi 文件之后要运行的脚本 resource.wxl-file=WiX 本地化文件 resource.main-wix-file=主 WiX 项目文件 @@ -41,6 +40,7 @@ resource.shortcutpromptdlg-wix-file=快捷方式提示对话框 WiX 项目文件 resource.installdirnotemptydlg-wix-file=安装目录对话框 WiX 项目文件非空 resource.launcher-as-service-wix-file=服务安装程序 WiX 项目文件 resource.wix-src-conv=将 WiX 源码从 WiX v3 格式转换为 WiX v4 格式的 XSLT 样式表 +resource.installer-exe=安装程序可执行文件 error.no-wix-tools=找不到 WiX 工具。已查找 WiX v3 light.exe 和 candle.exe 或 WiX v4/v5 wix.exe,但都未找到 error.no-wix-tools.advice=从 https://wixtoolset.org 下载 WiX 3.0 或更高版本,然后将其添加到 PATH。 @@ -67,7 +67,6 @@ message.output-location=安装程序 (.exe) 已保存到: {0} message.tool-version=检测到 [{0}] 版本 [{1}]。 message.creating-association-with-null-extension=正在使用空扩展名创建关联。 message.wrong-tool-version=检测到 [{0}] 版本 {1}, 但需要版本 {2}。 -message.version-string-too-many-components=版本字符串最多可以具有 3 个组成部分 - major.minor.build。 message.use-wix36-features=检测到 WiX {0}。正在启用高级清除操作。 message.product-code=MSI ProductCode:{0}。 message.upgrade-code=MSI UpgradeCode:{0}。 diff --git a/src/jdk.jshell/share/classes/jdk/internal/jshell/tool/resources/l10n_de.properties b/src/jdk.jshell/share/classes/jdk/internal/jshell/tool/resources/l10n_de.properties index dbd4a5183c3..cb93ae4ed57 100644 --- a/src/jdk.jshell/share/classes/jdk/internal/jshell/tool/resources/l10n_de.properties +++ b/src/jdk.jshell/share/classes/jdk/internal/jshell/tool/resources/l10n_de.properties @@ -154,6 +154,7 @@ jshell.err.exception.thrown = Ausnahme {0} jshell.err.exception.thrown.message = Ausnahme {0}: {1} jshell.err.exception.cause = Verursacht von: {0} jshell.err.exception.cause.message = Verursacht von: {0}: {1} +jshell.err.incomplete.input = Unvollständige Eingabe: {0} jshell.console.see.synopsis = jshell.console.see.full.documentation = diff --git a/src/jdk.jshell/share/classes/jdk/internal/jshell/tool/resources/l10n_ja.properties b/src/jdk.jshell/share/classes/jdk/internal/jshell/tool/resources/l10n_ja.properties index 14a88c56b70..fa84c3f38fb 100644 --- a/src/jdk.jshell/share/classes/jdk/internal/jshell/tool/resources/l10n_ja.properties +++ b/src/jdk.jshell/share/classes/jdk/internal/jshell/tool/resources/l10n_ja.properties @@ -154,6 +154,7 @@ jshell.err.exception.thrown = 例外{0} jshell.err.exception.thrown.message = 例外{0}: {1} jshell.err.exception.cause = 原因: {0} jshell.err.exception.cause.message = 原因: {0}: {1} +jshell.err.incomplete.input = 不完全な入力: {0} jshell.console.see.synopsis = <概要を表示するにはタブを再度押してください> jshell.console.see.full.documentation = <ドキュメント全体を表示するにはタブを再度押してください> diff --git a/src/jdk.jshell/share/classes/jdk/internal/jshell/tool/resources/l10n_zh_CN.properties b/src/jdk.jshell/share/classes/jdk/internal/jshell/tool/resources/l10n_zh_CN.properties index 0bbc5d76404..879e9633e6a 100644 --- a/src/jdk.jshell/share/classes/jdk/internal/jshell/tool/resources/l10n_zh_CN.properties +++ b/src/jdk.jshell/share/classes/jdk/internal/jshell/tool/resources/l10n_zh_CN.properties @@ -154,6 +154,7 @@ jshell.err.exception.thrown = 异常错误 {0} jshell.err.exception.thrown.message = 异常错误 {0}:{1} jshell.err.exception.cause = 原因:{0} jshell.err.exception.cause.message = 原因: {0}: {1} +jshell.err.incomplete.input = 输入不完整:{0} jshell.console.see.synopsis = <再次按 Tab 可查看提要> jshell.console.see.full.documentation = <再次按 Tab 可查看完整文档> diff --git a/src/jdk.localedata/share/classes/module-info.java b/src/jdk.localedata/share/classes/module-info.java index 3705cf3137e..a04cf2f6f63 100644 --- a/src/jdk.localedata/share/classes/module-info.java +++ b/src/jdk.localedata/share/classes/module-info.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2025, 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 @@ -33,6 +33,6 @@ provides sun.util.locale.provider.LocaleDataMetaInfo with sun.util.resources.cldr.provider.CLDRLocaleDataMetaInfo, sun.util.resources.provider.NonBaseLocaleDataMetaInfo; - provides sun.util.resources.LocaleData.CommonResourceBundleProvider with + provides sun.util.resources.LocaleData.LocaleDataResourceBundleProvider with sun.util.resources.provider.LocaleDataProvider; } diff --git a/src/jdk.localedata/share/classes/sun/text/resources/ext/FormatData.java b/src/jdk.localedata/share/classes/sun/text/resources/ext/FormatData.java index 0bbbd735f48..f393d5fd041 100644 --- a/src/jdk.localedata/share/classes/sun/text/resources/ext/FormatData.java +++ b/src/jdk.localedata/share/classes/sun/text/resources/ext/FormatData.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2024, 2025, 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 @@ -25,9 +25,9 @@ package sun.text.resources.ext; -import sun.util.resources.ParallelListResourceBundle; +import sun.util.resources.OpenListResourceBundle; -public class FormatData extends ParallelListResourceBundle { +public class FormatData extends OpenListResourceBundle { /** * Exists to keep sun.text.resources.ext package alive * with IncludeLocales jlink plugin diff --git a/src/jdk.localedata/share/classes/sun/text/resources/ext/FormatData_ja.java b/src/jdk.localedata/share/classes/sun/text/resources/ext/FormatData_ja.java index d9a3ebafe14..4ae7bf08a0a 100644 --- a/src/jdk.localedata/share/classes/sun/text/resources/ext/FormatData_ja.java +++ b/src/jdk.localedata/share/classes/sun/text/resources/ext/FormatData_ja.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1996, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1996, 2025, 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 @@ -76,11 +76,11 @@ package sun.text.resources.ext; -import sun.util.resources.ParallelListResourceBundle; +import sun.util.resources.OpenListResourceBundle; -public class FormatData_ja extends ParallelListResourceBundle { +public class FormatData_ja extends OpenListResourceBundle { /** - * Overrides ParallelListResourceBundle + * Overrides OpenListResourceBundle */ @Override protected final Object[][] getContents() { diff --git a/src/jdk.localedata/share/classes/sun/util/resources/provider/LocaleDataProvider.java b/src/jdk.localedata/share/classes/sun/util/resources/provider/LocaleDataProvider.java index 96041fea03f..c901af3a41b 100644 --- a/src/jdk.localedata/share/classes/sun/util/resources/provider/LocaleDataProvider.java +++ b/src/jdk.localedata/share/classes/sun/util/resources/provider/LocaleDataProvider.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2025, 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 @@ -32,7 +32,7 @@ /** * Service Provider for loading locale data resource bundles in jdk.localedata */ -public class LocaleDataProvider extends LocaleData.CommonResourceBundleProvider { +public class LocaleDataProvider extends LocaleData.LocaleDataResourceBundleProvider { @Override public ResourceBundle getBundle(String baseName, Locale locale) { var bundleName = toBundleName(baseName, locale); diff --git a/src/jdk.management/share/classes/com/sun/management/HotSpotDiagnosticMXBean.java b/src/jdk.management/share/classes/com/sun/management/HotSpotDiagnosticMXBean.java index 067cfffb158..8ce7c03f62d 100644 --- a/src/jdk.management/share/classes/com/sun/management/HotSpotDiagnosticMXBean.java +++ b/src/jdk.management/share/classes/com/sun/management/HotSpotDiagnosticMXBean.java @@ -158,7 +158,8 @@ public static enum ThreadDumpFormat { TEXT_PLAIN, /** * JSON (JavaScript Object Notation) format. - * @spec https://datatracker.ietf.org/doc/html/rfc8259 JavaScript Object Notation + * @spec https://datatracker.ietf.org/doc/html/rfc8259 RFC 8259: The JavaScript + * Object Notation (JSON) Data Interchange Format */ JSON, } diff --git a/test/docs/jdk/javadoc/doccheck/DocCheck.java b/test/docs/jdk/javadoc/doccheck/DocCheck.java index acd61b0e76e..5819f641d6e 100644 --- a/test/docs/jdk/javadoc/doccheck/DocCheck.java +++ b/test/docs/jdk/javadoc/doccheck/DocCheck.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2024, 2025, 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 @@ -140,6 +140,9 @@ public void init() { var baseDir = DOCS_DIR.resolve(DIR); fileTester.processFiles(baseDir); files = fileTester.getFiles(); + if (html) { + new TidyChecker(); + } } public List getCheckers() { diff --git a/test/docs/jdk/javadoc/doccheck/checks/jdkCheckHtml.java b/test/docs/jdk/javadoc/doccheck/checks/jdkCheckHtml.java index 3e9f3ab9f82..fdf6ab7e78d 100644 --- a/test/docs/jdk/javadoc/doccheck/checks/jdkCheckHtml.java +++ b/test/docs/jdk/javadoc/doccheck/checks/jdkCheckHtml.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2024, 2025, 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 @@ -26,6 +26,6 @@ * @bug 8337109 * @summary Check the html in the generated documentation * @library /test/langtools/tools/lib ../../doccheck /test/lib ../../../../tools/tester - * @build DocTester toolbox.TestRunner + * @build DocTester toolbox.TestRunner jtreg.SkippedException * @run main/othervm -Ddoccheck.checks=html DocCheck */ diff --git a/test/docs/jdk/javadoc/doccheck/doccheckutils/checkers/TidyChecker.java b/test/docs/jdk/javadoc/doccheck/doccheckutils/checkers/TidyChecker.java index 727e90a76e3..36a6a4a7b7a 100644 --- a/test/docs/jdk/javadoc/doccheck/doccheckutils/checkers/TidyChecker.java +++ b/test/docs/jdk/javadoc/doccheck/doccheckutils/checkers/TidyChecker.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2024, 2025, 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 @@ -38,6 +38,7 @@ import java.util.regex.Pattern; import java.util.stream.Collectors; import java.util.stream.Stream; +import jtreg.SkippedException; public class TidyChecker implements FileChecker, AutoCloseable { private final Path TIDY; @@ -164,8 +165,7 @@ private Path initTidy() { if (p.isPresent()) { tidyExePath = p.get(); } else { - System.err.println("tidy not found on PATH"); - return Path.of("tidy"); //non-null placeholder return; exception would be better + throw new jtreg.SkippedException("tidy not found on PATH"); } } diff --git a/test/hotspot/gtest/aarch64/aarch64-asmtest.py b/test/hotspot/gtest/aarch64/aarch64-asmtest.py index b0c8cdbc330..5b2c18b0a2b 100644 --- a/test/hotspot/gtest/aarch64/aarch64-asmtest.py +++ b/test/hotspot/gtest/aarch64/aarch64-asmtest.py @@ -1605,7 +1605,7 @@ def generate(kind, names): generate (Op, ["nop", "yield", "wfe", "sev", "sevl", "autia1716", "autiasp", "autiaz", "autib1716", "autibsp", "autibz", "pacia1716", "paciasp", "paciaz", "pacib1716", "pacibsp", "pacibz", - "eret", "drps", "isb",]) + "eret", "drps", "isb", "sb",]) # Ensure the "i" is not stripped off the end of the instruction generate (PostfixExceptionOp, ["wfi", "xpaclri"]) diff --git a/test/hotspot/gtest/aarch64/asmtest.out.h b/test/hotspot/gtest/aarch64/asmtest.out.h index 2b4ea356d70..d90c2479995 100644 --- a/test/hotspot/gtest/aarch64/asmtest.out.h +++ b/test/hotspot/gtest/aarch64/asmtest.out.h @@ -187,6 +187,7 @@ __ eret(); // eret __ drps(); // drps __ isb(); // isb + __ sb(); // sb // PostfixExceptionOp __ wfi(); // wfi @@ -1437,306 +1438,306 @@ 0x9101a1a0, 0xb10a5cc8, 0xd10810aa, 0xf10fd061, 0x120cb166, 0x321764bc, 0x52174681, 0x720c0227, 0x9241018e, 0xb25a2969, 0xd278b411, 0xf26aad01, - 0x14000000, 0x17ffffd7, 0x140004af, 0x94000000, - 0x97ffffd4, 0x940004ac, 0x3400000a, 0x34fffa2a, - 0x3400952a, 0x35000008, 0x35fff9c8, 0x350094c8, - 0xb400000b, 0xb4fff96b, 0xb400946b, 0xb500001d, - 0xb5fff91d, 0xb500941d, 0x10000013, 0x10fff8b3, - 0x100093b3, 0x90000013, 0x36300016, 0x3637f836, - 0x36309336, 0x3758000c, 0x375ff7cc, 0x375892cc, + 0x14000000, 0x17ffffd7, 0x140004b0, 0x94000000, + 0x97ffffd4, 0x940004ad, 0x3400000a, 0x34fffa2a, + 0x3400954a, 0x35000008, 0x35fff9c8, 0x350094e8, + 0xb400000b, 0xb4fff96b, 0xb400948b, 0xb500001d, + 0xb5fff91d, 0xb500943d, 0x10000013, 0x10fff8b3, + 0x100093d3, 0x90000013, 0x36300016, 0x3637f836, + 0x36309356, 0x3758000c, 0x375ff7cc, 0x375892ec, 0x128313a0, 0x528a32c7, 0x7289173b, 0x92ab3acc, 0xd2a0bf94, 0xf2c285e8, 0x9358722f, 0x330e652f, 0x53067f3b, 0x93577c53, 0xb34a1aac, 0xd35a4016, 0x13946c63, 0x93c3dbc8, 0x54000000, 0x54fff5a0, - 0x540090a0, 0x54000001, 0x54fff541, 0x54009041, - 0x54000002, 0x54fff4e2, 0x54008fe2, 0x54000002, - 0x54fff482, 0x54008f82, 0x54000003, 0x54fff423, - 0x54008f23, 0x54000003, 0x54fff3c3, 0x54008ec3, - 0x54000004, 0x54fff364, 0x54008e64, 0x54000005, - 0x54fff305, 0x54008e05, 0x54000006, 0x54fff2a6, - 0x54008da6, 0x54000007, 0x54fff247, 0x54008d47, - 0x54000008, 0x54fff1e8, 0x54008ce8, 0x54000009, - 0x54fff189, 0x54008c89, 0x5400000a, 0x54fff12a, - 0x54008c2a, 0x5400000b, 0x54fff0cb, 0x54008bcb, - 0x5400000c, 0x54fff06c, 0x54008b6c, 0x5400000d, - 0x54fff00d, 0x54008b0d, 0x5400000e, 0x54ffefae, - 0x54008aae, 0x5400000f, 0x54ffef4f, 0x54008a4f, + 0x540090c0, 0x54000001, 0x54fff541, 0x54009061, + 0x54000002, 0x54fff4e2, 0x54009002, 0x54000002, + 0x54fff482, 0x54008fa2, 0x54000003, 0x54fff423, + 0x54008f43, 0x54000003, 0x54fff3c3, 0x54008ee3, + 0x54000004, 0x54fff364, 0x54008e84, 0x54000005, + 0x54fff305, 0x54008e25, 0x54000006, 0x54fff2a6, + 0x54008dc6, 0x54000007, 0x54fff247, 0x54008d67, + 0x54000008, 0x54fff1e8, 0x54008d08, 0x54000009, + 0x54fff189, 0x54008ca9, 0x5400000a, 0x54fff12a, + 0x54008c4a, 0x5400000b, 0x54fff0cb, 0x54008beb, + 0x5400000c, 0x54fff06c, 0x54008b8c, 0x5400000d, + 0x54fff00d, 0x54008b2d, 0x5400000e, 0x54ffefae, + 0x54008ace, 0x5400000f, 0x54ffef4f, 0x54008a6f, 0xd40658e1, 0xd4014d22, 0xd4046543, 0xd4273f60, 0xd44cad80, 0xd503201f, 0xd503203f, 0xd503205f, 0xd503209f, 0xd50320bf, 0xd503219f, 0xd50323bf, 0xd503239f, 0xd50321df, 0xd50323ff, 0xd50323df, 0xd503211f, 0xd503233f, 0xd503231f, 0xd503215f, 0xd503237f, 0xd503235f, 0xd69f03e0, 0xd6bf03e0, - 0xd5033fdf, 0xd503207f, 0xd50320ff, 0xd5033e9f, - 0xd50332bf, 0xd61f0200, 0xd63f0280, 0xdac123ea, - 0xdac127fb, 0xdac12be8, 0xdac12fe0, 0xdac133e1, - 0xdac137f5, 0xdac13bf1, 0xdac13ffd, 0xdac147fd, - 0xd61f0b9f, 0xd61f0c3f, 0xd63f0aff, 0xd63f0ebf, - 0xd51b4434, 0xd51b4216, 0xd53b443b, 0xd53b4213, - 0xd53b00eb, 0xd53b0030, 0xdac143e6, 0xc8117c80, - 0xc80afed8, 0xc85f7e6a, 0xc85ffca1, 0xc89ffd1e, - 0xc8dffe2c, 0x88097cee, 0x8801fe05, 0x885f7d82, - 0x885ffd8a, 0x889fff83, 0x88dfff4e, 0x481e7dca, - 0x4815fd2d, 0x485f7f76, 0x485ffe7c, 0x489fffcb, - 0x48dffc53, 0x08027c37, 0x0800fe0c, 0x085f7ded, - 0x085ffeb1, 0x089ffd6d, 0x08dffd1e, 0xc87f3578, - 0xc87feaa1, 0xc83b506d, 0xc82c87a6, 0x887f1166, - 0x887f93d0, 0x883e32a4, 0x883bf12f, 0xf80011f9, - 0xb81b1022, 0x381ea354, 0x79002fd7, 0xf85cf39a, - 0xb8580309, 0x385e218c, 0x784051e1, 0x389e11d8, - 0x789fa1f8, 0x79c01865, 0xb881131b, 0xfc5dd3ad, - 0xbc5d1137, 0xfc00900b, 0xbc181015, 0xf818ec7d, - 0xb81b8c91, 0x381efc40, 0x78007c3d, 0xf857beb0, - 0xb8413dd4, 0x385fddd6, 0x78409e2f, 0x389eddea, - 0x789e7d94, 0x78de3d55, 0xb8805c13, 0xfc5cadc0, - 0xbc428c23, 0xfc1a2dc4, 0xbc1caf92, 0xf81475f6, - 0xb81f95d1, 0x381e757e, 0x78014561, 0xf8402436, - 0xb85896e2, 0x385f4763, 0x785db4f0, 0x3880374f, - 0x789e25e7, 0x78dd0563, 0xb88166f9, 0xfc529540, - 0xbc4374d3, 0xfc1166ae, 0xbc1ba6c0, 0xf820ea7b, - 0xb82d68c8, 0x38367a04, 0x782f4b59, 0xf878c8a4, - 0xb8674a24, 0x386b78f1, 0x78776bc0, 0x38a15aca, - 0x78bedbd5, 0x78fcd94b, 0xb8aa4a7c, 0xfc6ecbbe, - 0xbc65d8a8, 0xfc2de919, 0xbc3a7b11, 0xf91f1193, - 0xb91ed5f7, 0x391ec9bd, 0x79182ceb, 0xf95d4b0a, - 0xb9581010, 0x395fc034, 0x795fb221, 0x399d8731, - 0x799efb3b, 0x79dd1a2e, 0xb998e4ea, 0xfd583723, - 0xbd5ea12c, 0xfd18dc38, 0xbd1b0e83, 0x58ffdaa2, - 0x1800001d, 0xf885d1c0, 0xd8ffda40, 0xf8a77820, - 0xf9980220, 0x1a030301, 0x3a140311, 0x5a0d000b, - 0x7a07015c, 0x9a1001e4, 0xba140182, 0xda0d01bd, - 0xfa0c00ce, 0x0b31f194, 0x2b206d7b, 0xcb29f027, - 0x6b210f63, 0x8b2cb34d, 0xab2a88b1, 0xcb2f511e, - 0xeb3332f3, 0x3a4533aa, 0x7a4d312b, 0xba442146, - 0xfa42818c, 0x3a466a02, 0x7a4b68ed, 0xba4a9b6b, - 0xfa4dd86d, 0x1a8a637a, 0x1a9cd6aa, 0x5a9bd137, - 0x5a8fd7aa, 0x9a95233e, 0x9a95c620, 0xda9422b0, - 0xda8397d3, 0x5ac00173, 0x5ac00418, 0x5ac00b3b, - 0x5ac0106e, 0x5ac0162e, 0xdac001e7, 0xdac00798, - 0xdac00b31, 0xdac00f42, 0xdac010bc, 0xdac01759, - 0xdac1021b, 0xdac104d1, 0xdac10995, 0xdac10c80, - 0xdac1136c, 0xdac11791, 0xdac1185c, 0xdac11d51, - 0xd71f09ee, 0xd71f0dc3, 0xd73f0b2f, 0xd73f0e6e, - 0x1ac40a05, 0x1ac40f3a, 0x1acc2042, 0x1ac8263d, - 0x1ac42867, 0x1ada2c99, 0x9ad10899, 0x9ad10f40, - 0x9ad521f7, 0x9adb263c, 0x9ac0286a, 0x9ac92f27, - 0x9bdd7de6, 0x9b427d4f, 0x1b0b2cf1, 0x1b1ddcf7, - 0x9b0b2f6e, 0x9b0cbf04, 0x9b2b728e, 0x9b2cdd6d, - 0x9bae275e, 0x9ba7954d, 0x7ec315fe, 0x1ef0098c, - 0x1ef21bff, 0x1ef02ab3, 0x1ef5394f, 0x1efc4942, - 0x1eff5bc7, 0x1ee28832, 0x7ea3d546, 0x1e270979, - 0x1e201981, 0x1e3d2a63, 0x1e263ae6, 0x1e3b4b80, - 0x1e2758a2, 0x1e39899d, 0x7ef8d58d, 0x1e720913, - 0x1e751b56, 0x1e622a74, 0x1e683ade, 0x1e754a76, - 0x1e755a4c, 0x1e638a06, 0x1fc373a3, 0x1f0a35cf, - 0x1f0aea4c, 0x1f2f74e7, 0x1f2032e0, 0x1f4d21d8, - 0x1f49d0ef, 0x1f7f43b3, 0x1f705522, 0x1e20409e, - 0x1e20c361, 0x1e214319, 0x1e21c2ae, 0x1e22c0cd, - 0x1e23c32c, 0x1ee243d9, 0x1e6042bc, 0x1e60c2f0, - 0x1e6143a5, 0x1e61c276, 0x1e62428d, 0x1ee1c393, - 0x1e3800d1, 0x9e3800ed, 0x1e78035c, 0x9e7800d1, - 0x1e220081, 0x9e22028e, 0x1e6202a7, 0x9e6202fb, - 0x1e24028d, 0x9e64039e, 0x1e3002aa, 0x9e700225, - 0x1e2601cb, 0x9e6602ad, 0x1e2701db, 0x9e6702e4, - 0x1e3e2300, 0x1e6e2180, 0x1e202228, 0x1e602388, - 0x29021b40, 0x297c78c0, 0x69660970, 0xa908018f, - 0xa9427ae7, 0x29a03cfa, 0x29fc3d4b, 0x69c84033, - 0xa988240e, 0xa9fa0d9b, 0x28a02d88, 0x28c8408a, - 0x68f87a6a, 0xa8ba09f8, 0xa8c52a18, 0x280257be, - 0x28727948, 0xa83868de, 0xa8440a98, 0x0c40733f, - 0x4cdfa1e5, 0x0ccd6cea, 0x4cdf260d, 0x0d40c227, - 0x4ddfcb30, 0x0dc7cc6b, 0x4c408ced, 0x0cdf8769, - 0x4d60c346, 0x0dffca17, 0x4de8cda6, 0x4cda4834, - 0x0c4049ef, 0x4d40e6dd, 0x4ddfe946, 0x0dcfeccf, - 0x4cdf0546, 0x0cc7006b, 0x0d60e32c, 0x0dffe5eb, - 0x0dfce8de, 0x0e31bb9b, 0x4e31bbbc, 0x0e71b841, - 0x4e71bbbc, 0x4eb1b841, 0x0e30aab4, 0x4e30abdd, - 0x0e70aa30, 0x4e70a9cd, 0x4eb0a96a, 0x6e30fbdd, - 0x0e31abdd, 0x2e31aa93, 0x4e31aaf6, 0x6e31a96a, - 0x0e71a8a4, 0x2e71a81f, 0x4e71aad5, 0x6e71a928, - 0x4eb1a81f, 0x6eb1aa93, 0x6eb0f96a, 0x7e30fbbc, - 0x7e70f862, 0x7eb0fb59, 0x7ef0f8c5, 0x0ea0c883, - 0x4ea0c928, 0x4ee0caf6, 0x2ea0ca93, 0x6ea0c9cd, - 0x6ee0c8c5, 0x0ea0dbdd, 0x4ea0db38, 0x4ee0dad5, - 0x0ea0eb7a, 0x4ea0eb38, 0x4ee0e883, 0x2ea0db38, - 0x6ea0db7a, 0x6ee0db17, 0x0e20ba0f, 0x4e20bad5, - 0x0e60b883, 0x4e60bb38, 0x0ea0b928, 0x4ea0bb59, - 0x4ee0bab4, 0x0ea0fa30, 0x4ea0fa51, 0x4ee0f862, - 0x0ef8f841, 0x4ef8f820, 0x2ea0fb38, 0x6ea0f8a4, - 0x6ee0f883, 0x2ef8f9ac, 0x6ef8f81f, 0x2ea1fbbc, - 0x6ea1f96a, 0x6ee1fb7a, 0x2ef9f862, 0x6ef9f9ac, - 0x2e205a72, 0x6e20581f, 0x0e231c41, 0x4e2f1dcd, - 0x0ebf1fdd, 0x4ea21c20, 0x2e351e93, 0x6e2e1dac, - 0x0e338651, 0x4e3886f6, 0x0e6f85cd, 0x4e7e87bc, - 0x0ea087fe, 0x4ea1841f, 0x4ee38441, 0x0e3c0f7a, - 0x4e3e0fbc, 0x0e660ca4, 0x4e600ffe, 0x0ea60ca4, - 0x4ea80ce6, 0x4ee00ffe, 0x2e3c0f7a, 0x6e340e72, - 0x2e6b0d49, 0x6e6a0d28, 0x2eae0dac, 0x6ea20c20, - 0x6ef60eb4, 0x0e23d441, 0x4e3ad738, 0x4e64d462, - 0x0e421420, 0x4e4b1549, 0x2e3a8738, 0x6e3c877a, - 0x2e728630, 0x6e6087fe, 0x2ea58483, 0x6eac856a, - 0x6ef98717, 0x0e2c2d6a, 0x4e262ca4, 0x0e742e72, - 0x4e642c62, 0x0ead2d8b, 0x4eaa2d28, 0x4eec2d6a, - 0x2e312e0f, 0x6e332e51, 0x2e642c62, 0x6e6c2d6a, - 0x2eae2dac, 0x6eae2dac, 0x6ef12e0f, 0x0eafd5cd, - 0x4ea4d462, 0x4ee9d507, 0x0ed616b4, 0x4edc177a, - 0x0e329e30, 0x4e269ca4, 0x0e649c62, 0x4e669ca4, - 0x0eae9dac, 0x4eb49e72, 0x2eb7d6d5, 0x6eb2d630, - 0x6ef4d672, 0x2ecd158b, 0x6ed716d5, 0x2e39d717, - 0x6e2ed5ac, 0x6e7cd77a, 0x2e591717, 0x6e5e17bc, - 0x2e30ddee, 0x6e2ddd8b, 0x6e7adf38, 0x2e431c41, - 0x6e4e1dac, 0x0e61941f, 0x4e6c956a, 0x0eb29630, - 0x4ea99507, 0x0e24cc62, 0x4e25cc83, 0x4e6fcdcd, - 0x0e550e93, 0x4e530e51, 0x2e729630, 0x6e659483, - 0x2ea39441, 0x6ead958b, 0x0ea0cffe, 0x4ea7ccc5, - 0x4eeacd28, 0x0ed10e0f, 0x4edf0fdd, 0x2e20fffe, - 0x6e22fc20, 0x6e76feb4, 0x2e493d07, 0x6e563eb4, - 0x0e396717, 0x4e3e67bc, 0x0e7766d5, 0x4e7d679b, - 0x0ebb6759, 0x4ea764c5, 0x2e236441, 0x6e396717, - 0x2e726630, 0x6e61641f, 0x2ea764c5, 0x6eae65ac, - 0x0e2ba549, 0x4e3ea7bc, 0x0e71a60f, 0x4e7fa7dd, - 0x0eb8a6f6, 0x4ea1a41f, 0x0e35f693, 0x4e21f41f, - 0x4e67f4c5, 0x0e5035ee, 0x4e543672, 0x0e216c1f, - 0x4e346e72, 0x0e7d6f9b, 0x4e766eb4, 0x0eb26e30, - 0x4eae6dac, 0x2e2d6d8b, 0x6e2b6d49, 0x2e686ce6, - 0x6e606ffe, 0x2eb36e51, 0x6ebd6f9b, 0x0e3eafbc, - 0x4e20affe, 0x0e69ad07, 0x4e6cad6a, 0x0eb6aeb4, - 0x4eacad6a, 0x0e66b4a4, 0x4e7ab738, 0x0eb3b651, - 0x4eb3b651, 0x0e3826f6, 0x4e252483, 0x0e7f27dd, - 0x4e71260f, 0x0eb826f6, 0x4eb52693, 0x0eb5f693, - 0x4eb8f6f6, 0x4ee4f462, 0x0ed1360f, 0x4ec834e6, - 0x2eaeedac, 0x6eb2ee30, 0x6eeded8b, 0x2ecf2dcd, - 0x6ed92f17, 0x0f81100f, 0x4f848862, 0x4fc31841, - 0x0fad518b, 0x4fa780c5, 0x4fd059ee, 0x2fa890e6, - 0x4fa38841, 0x6fc1900f, 0x0f7b8149, 0x4f4688a4, - 0x0faf81cd, 0x4fa58083, 0x0e3736d5, 0x4e393717, - 0x0e61341f, 0x4e7b3759, 0x0ea43462, 0x4ea1341f, - 0x4efd379b, 0x0e343e72, 0x4e2c3d6a, 0x0e793f17, - 0x4e753e93, 0x0ea53c83, 0x4eb43e72, 0x4ee23c20, - 0x2e3b8f59, 0x6e3c8f7a, 0x2e798f17, 0x6e648c62, - 0x2eb48e72, 0x6eae8dac, 0x6ee68ca4, 0x2e3e37bc, - 0x6e2037fe, 0x2e7f37dd, 0x6e723630, 0x2ebd379b, - 0x6ea834e6, 0x6eeb3549, 0x2e3f3fdd, 0x6e343e72, - 0x2e693d07, 0x6e663ca4, 0x2ea93d07, 0x6eb13e0f, - 0x6eeb3d49, 0x0e39e717, 0x4e2ae528, 0x4e64e462, - 0x2ebee7bc, 0x6eb7e6d5, 0x6ee1e41f, 0x2e27e4c5, - 0x6e3de79b, 0x6e62e420, 0x659239e8, 0x65d03b94, - 0x65d0232d, 0x65d120c2, 0x659129f2, 0x65933ca3, - 0x25969683, 0x25961d15, 0x254d1c48, 0x259e3f61, - 0x25953b96, 0x255b91d1, 0x247686ed, 0x24309098, - 0x2462edb9, 0x24a57468, 0xba5fd3e3, 0x3a5f03e5, - 0xfa411be4, 0x7a42cbe2, 0x93df03ff, 0xc820ffff, - 0x8822fc7f, 0xc8247cbf, 0x88267fff, 0x4e010fe0, - 0x5e040420, 0x4e081fe1, 0x4e0c1fe1, 0x4e0a1fe1, - 0x4e071fe1, 0x4e042c20, 0x4e062c20, 0x4e052c20, - 0x4e083c20, 0x0e0c3c20, 0x0e0a3c20, 0x0e073c20, - 0x9eae0020, 0x0f03f409, 0x6f03f40e, 0x4cc0ac3f, - 0x0ea1b820, 0x0ef9b820, 0x4ef9b820, 0x4e21c862, - 0x0e79c862, 0x4e79c862, 0x4e61b8a4, 0x0e79b8a4, - 0x4e79b8a4, 0x05a08020, 0x05104fe0, 0x05505001, - 0x05906fe2, 0x05d03005, 0x05101fea, 0x05901feb, - 0x04b0e3e0, 0x0470e7e1, 0x042f9c20, 0x043f9c35, - 0x047f9c20, 0x04ff9c20, 0x04299420, 0x04319160, - 0x0461943e, 0x04a19020, 0x04038100, 0x040381a0, - 0x040387e1, 0x04438be2, 0x04c38fe3, 0x040181e0, - 0x04018100, 0x04018621, 0x04418b22, 0x04418822, - 0x04818c23, 0x040081e0, 0x04008120, 0x04008761, - 0x04008621, 0x04408822, 0x04808c23, 0x042053ff, - 0x047f5401, 0x25208028, 0x2538cfe0, 0x2578d001, - 0x25b8efe2, 0x25f8f007, 0x2538dfea, 0x25b8dfeb, - 0xa400a3e0, 0xa420a7e0, 0xa4484be0, 0xa467afe0, - 0xa4a8a7ea, 0xa547a814, 0xa4084ffe, 0xa55c53e0, - 0xa5e1540b, 0xe400fbf6, 0xe408ffff, 0xe420e7e0, - 0xe4484be0, 0xe460efe0, 0xe547e400, 0xe4014be0, - 0xe4a84fe0, 0xe5f15000, 0x858043e0, 0x85a043ff, - 0xe59f5d08, 0x0420e3e9, 0x0460e3ea, 0x04a0e3eb, - 0x04e0e3ec, 0x25104042, 0x25104871, 0x25904861, - 0x25904c92, 0x05344020, 0x05744041, 0x05b44062, - 0x05f44083, 0x252c8840, 0x253c1420, 0x25681572, - 0x25a21ce3, 0x25ea1e34, 0x253c0421, 0x25680572, - 0x25a20ce3, 0x25ea0e34, 0x0522c020, 0x05e6c0a4, - 0x2401a001, 0x2443a051, 0x24858881, 0x24c78cd1, - 0x24850891, 0x24c70cc1, 0x250f9001, 0x25508051, - 0x25802491, 0x25df28c1, 0x25850c81, 0x251e10d1, - 0x65816001, 0x65c36051, 0x65854891, 0x65c74cc1, - 0x05733820, 0x05b238a4, 0x05f138e6, 0x0570396a, - 0x65d0a001, 0x65d6a443, 0x65d4a826, 0x6594ac26, - 0x6554ac26, 0x6556ac26, 0x6552ac26, 0x65cbac85, - 0x65caac01, 0x6589ac85, 0x6588ac01, 0x65c9ac85, - 0x65c8ac01, 0x65dea833, 0x659ca509, 0x65d8a801, - 0x65dcac01, 0x655cb241, 0x0520a1e0, 0x0521a601, - 0x052281e0, 0x05238601, 0x04a14026, 0x042244a6, - 0x046344a6, 0x04a444a6, 0x04e544a7, 0x0568aca7, - 0x05b23230, 0x853040af, 0xc5b040af, 0xe57080af, - 0xe5b080af, 0x25034440, 0x254054c4, 0x25034640, - 0x25415a05, 0x25834440, 0x25c54489, 0x250b5d3a, - 0x2550dc20, 0x2518e3e1, 0x2518e021, 0x2518e0a1, - 0x2518e121, 0x2518e1a1, 0x2558e3e2, 0x2558e042, - 0x2558e0c2, 0x2558e142, 0x2598e3e3, 0x2598e063, - 0x2598e0e3, 0x2598e163, 0x25d8e3e4, 0x25d8e084, - 0x25d8e104, 0x25d8e184, 0x2518e407, 0x05214800, - 0x05614800, 0x05a14800, 0x05e14800, 0x05214c00, - 0x05614c00, 0x05a14c00, 0x05e14c00, 0x05304001, - 0x05314001, 0x05a18610, 0x05e18610, 0x05271e11, - 0x6545e891, 0x6585e891, 0x65c5e891, 0x6545c891, - 0x6585c891, 0x65c5c891, 0x45b0c210, 0x45f1c231, - 0x1e601000, 0x1e603000, 0x1e621000, 0x1e623000, - 0x1e641000, 0x1e643000, 0x1e661000, 0x1e663000, - 0x1e681000, 0x1e683000, 0x1e6a1000, 0x1e6a3000, - 0x1e6c1000, 0x1e6c3000, 0x1e6e1000, 0x1e6e3000, - 0x1e701000, 0x1e703000, 0x1e721000, 0x1e723000, - 0x1e741000, 0x1e743000, 0x1e761000, 0x1e763000, - 0x1e781000, 0x1e783000, 0x1e7a1000, 0x1e7a3000, - 0x1e7c1000, 0x1e7c3000, 0x1e7e1000, 0x1e7e3000, - 0xf8268267, 0xf82d023c, 0xf8301046, 0xf83d2083, - 0xf8263290, 0xf82d528c, 0xf8284299, 0xf8337160, - 0xf8386286, 0xf8bf820e, 0xf8a600e0, 0xf8af1353, - 0xf8a922ea, 0xf8b53396, 0xf8a251e3, 0xf8b340f4, - 0xf8a470fd, 0xf8a06209, 0xf8f48097, 0xf8f002ea, - 0xf8eb10d9, 0xf8ff21b0, 0xf8f7302c, 0xf8ee52a9, - 0xf8f041fa, 0xf8e471e4, 0xf8e863c6, 0xf864823d, - 0xf87d013a, 0xf86f1162, 0xf87d20e3, 0xf86132bb, - 0xf870510e, 0xf8704336, 0xf86572b4, 0xf8706217, - 0xb83e8294, 0xb8200264, 0xb8381284, 0xb8242358, - 0xb8333102, 0xb828530e, 0xb83042df, 0xb824703f, - 0xb82a6194, 0xb8a080e9, 0xb8b80090, 0xb8bb1146, - 0xb8bb21b8, 0xb8b032df, 0xb8b653f4, 0xb8bd41c9, - 0xb8b47287, 0xb8bc6169, 0xb8ee828c, 0xb8e10138, - 0xb8f3126d, 0xb8f020b0, 0xb8e03183, 0xb8e851ef, - 0xb8f041e4, 0xb8fe7005, 0xb8ea6376, 0xb8638120, - 0xb873015d, 0xb8781284, 0xb86723b8, 0xb86e3175, - 0xb87b51ed, 0xb87f41d1, 0xb863721e, 0xb87660f4, - 0xce216874, 0xce104533, 0xce648c15, 0xce8e3302, - 0xce6e82ab, 0xce6c87d1, 0xcec08063, 0xce638937, - 0x25e0c358, 0x25a1c7d3, 0x0580785a, 0x05426328, - 0x05009892, 0x25a0cc29, 0x2561cec8, 0x058044b3, - 0x05401c99, 0x05006b49, 0x25e0d6f7, 0x2561c528, - 0x0583c8bc, 0x0542522f, 0x05001ec0, 0x25e0de65, - 0x25a1c113, 0x05803cad, 0x0540f3c0, 0x0500ab15, - 0x2560c28c, 0x2561d7c0, 0x05801ed7, 0x0542633b, - 0x05003696, 0x2560d4b4, 0x25e1c918, 0x058021ff, - 0x05400e15, 0x0500f3de, 0x0473025a, 0x04bd05ab, - 0x658e0025, 0x658a08e2, 0x659a0493, 0x043e1062, - 0x04f418b4, 0x046d15bd, 0x04611fce, 0x04d6a07c, - 0x04001929, 0x041a09da, 0x04d098f4, 0x04db10d4, - 0x0459a3ad, 0x041aa029, 0x041919fb, 0x04d39e24, - 0x04118302, 0x04101dba, 0x04d7ae16, 0x04dea571, - 0x04180210, 0x05e786fc, 0x05e4915c, 0x04881cf1, - 0x044a0f04, 0x04090969, 0x048b16c4, 0x044101e4, - 0x04dcbf44, 0x65809745, 0x658d833f, 0x65c68468, - 0x65c79b07, 0x65829e38, 0x049dafca, 0x6582bba8, - 0x65c0b7ff, 0x65c1b4e0, 0x658dbadd, 0x65819a9d, - 0x65ed9246, 0x65b30815, 0x65e6263c, 0x65eebb94, - 0x65bad14e, 0x65efe178, 0x65fc5697, 0x65e07f14, - 0x040c55a6, 0x04977f4d, 0x043d3046, 0x04b733a0, - 0x046830a4, 0x04ed322d, 0x05686948, 0x05bd6c13, - 0x65c88ef0, 0x450db3d7, 0x4540b6d9, 0x043e3979, - 0x445896ce, 0x445a9005, 0x44d98069, 0x445b87ae, - 0x04da348e, 0x04982edb, 0x0499397f, 0x0408338c, - 0x04ca309c, 0x65c721e6, 0x65c63641, 0x65982882, - 0x04812b8b, 0x0e251083, 0x4e3712d5, 0x0e61101f, - 0x4e6d118b, 0x0eba1338, 0x4eb712d5, 0x2e31120f, - 0x6e2e11ac, 0x2e6810e6, 0x6e6f11cd, 0x2eaa1128, - 0x6eb1120f, + 0xd5033fdf, 0xd50330ff, 0xd503207f, 0xd50320ff, + 0xd5033e9f, 0xd50332bf, 0xd61f0200, 0xd63f0280, + 0xdac123ea, 0xdac127fb, 0xdac12be8, 0xdac12fe0, + 0xdac133e1, 0xdac137f5, 0xdac13bf1, 0xdac13ffd, + 0xdac147fd, 0xd61f0b9f, 0xd61f0c3f, 0xd63f0aff, + 0xd63f0ebf, 0xd51b4434, 0xd51b4216, 0xd53b443b, + 0xd53b4213, 0xd53b00eb, 0xd53b0030, 0xdac143e6, + 0xc8117c80, 0xc80afed8, 0xc85f7e6a, 0xc85ffca1, + 0xc89ffd1e, 0xc8dffe2c, 0x88097cee, 0x8801fe05, + 0x885f7d82, 0x885ffd8a, 0x889fff83, 0x88dfff4e, + 0x481e7dca, 0x4815fd2d, 0x485f7f76, 0x485ffe7c, + 0x489fffcb, 0x48dffc53, 0x08027c37, 0x0800fe0c, + 0x085f7ded, 0x085ffeb1, 0x089ffd6d, 0x08dffd1e, + 0xc87f3578, 0xc87feaa1, 0xc83b506d, 0xc82c87a6, + 0x887f1166, 0x887f93d0, 0x883e32a4, 0x883bf12f, + 0xf80011f9, 0xb81b1022, 0x381ea354, 0x79002fd7, + 0xf85cf39a, 0xb8580309, 0x385e218c, 0x784051e1, + 0x389e11d8, 0x789fa1f8, 0x79c01865, 0xb881131b, + 0xfc5dd3ad, 0xbc5d1137, 0xfc00900b, 0xbc181015, + 0xf818ec7d, 0xb81b8c91, 0x381efc40, 0x78007c3d, + 0xf857beb0, 0xb8413dd4, 0x385fddd6, 0x78409e2f, + 0x389eddea, 0x789e7d94, 0x78de3d55, 0xb8805c13, + 0xfc5cadc0, 0xbc428c23, 0xfc1a2dc4, 0xbc1caf92, + 0xf81475f6, 0xb81f95d1, 0x381e757e, 0x78014561, + 0xf8402436, 0xb85896e2, 0x385f4763, 0x785db4f0, + 0x3880374f, 0x789e25e7, 0x78dd0563, 0xb88166f9, + 0xfc529540, 0xbc4374d3, 0xfc1166ae, 0xbc1ba6c0, + 0xf820ea7b, 0xb82d68c8, 0x38367a04, 0x782f4b59, + 0xf878c8a4, 0xb8674a24, 0x386b78f1, 0x78776bc0, + 0x38a15aca, 0x78bedbd5, 0x78fcd94b, 0xb8aa4a7c, + 0xfc6ecbbe, 0xbc65d8a8, 0xfc2de919, 0xbc3a7b11, + 0xf91f1193, 0xb91ed5f7, 0x391ec9bd, 0x79182ceb, + 0xf95d4b0a, 0xb9581010, 0x395fc034, 0x795fb221, + 0x399d8731, 0x799efb3b, 0x79dd1a2e, 0xb998e4ea, + 0xfd583723, 0xbd5ea12c, 0xfd18dc38, 0xbd1b0e83, + 0x58ffda82, 0x1800001d, 0xf885d1c0, 0xd8ffda20, + 0xf8a77820, 0xf9980220, 0x1a030301, 0x3a140311, + 0x5a0d000b, 0x7a07015c, 0x9a1001e4, 0xba140182, + 0xda0d01bd, 0xfa0c00ce, 0x0b31f194, 0x2b206d7b, + 0xcb29f027, 0x6b210f63, 0x8b2cb34d, 0xab2a88b1, + 0xcb2f511e, 0xeb3332f3, 0x3a4533aa, 0x7a4d312b, + 0xba442146, 0xfa42818c, 0x3a466a02, 0x7a4b68ed, + 0xba4a9b6b, 0xfa4dd86d, 0x1a8a637a, 0x1a9cd6aa, + 0x5a9bd137, 0x5a8fd7aa, 0x9a95233e, 0x9a95c620, + 0xda9422b0, 0xda8397d3, 0x5ac00173, 0x5ac00418, + 0x5ac00b3b, 0x5ac0106e, 0x5ac0162e, 0xdac001e7, + 0xdac00798, 0xdac00b31, 0xdac00f42, 0xdac010bc, + 0xdac01759, 0xdac1021b, 0xdac104d1, 0xdac10995, + 0xdac10c80, 0xdac1136c, 0xdac11791, 0xdac1185c, + 0xdac11d51, 0xd71f09ee, 0xd71f0dc3, 0xd73f0b2f, + 0xd73f0e6e, 0x1ac40a05, 0x1ac40f3a, 0x1acc2042, + 0x1ac8263d, 0x1ac42867, 0x1ada2c99, 0x9ad10899, + 0x9ad10f40, 0x9ad521f7, 0x9adb263c, 0x9ac0286a, + 0x9ac92f27, 0x9bdd7de6, 0x9b427d4f, 0x1b0b2cf1, + 0x1b1ddcf7, 0x9b0b2f6e, 0x9b0cbf04, 0x9b2b728e, + 0x9b2cdd6d, 0x9bae275e, 0x9ba7954d, 0x7ec315fe, + 0x1ef0098c, 0x1ef21bff, 0x1ef02ab3, 0x1ef5394f, + 0x1efc4942, 0x1eff5bc7, 0x1ee28832, 0x7ea3d546, + 0x1e270979, 0x1e201981, 0x1e3d2a63, 0x1e263ae6, + 0x1e3b4b80, 0x1e2758a2, 0x1e39899d, 0x7ef8d58d, + 0x1e720913, 0x1e751b56, 0x1e622a74, 0x1e683ade, + 0x1e754a76, 0x1e755a4c, 0x1e638a06, 0x1fc373a3, + 0x1f0a35cf, 0x1f0aea4c, 0x1f2f74e7, 0x1f2032e0, + 0x1f4d21d8, 0x1f49d0ef, 0x1f7f43b3, 0x1f705522, + 0x1e20409e, 0x1e20c361, 0x1e214319, 0x1e21c2ae, + 0x1e22c0cd, 0x1e23c32c, 0x1ee243d9, 0x1e6042bc, + 0x1e60c2f0, 0x1e6143a5, 0x1e61c276, 0x1e62428d, + 0x1ee1c393, 0x1e3800d1, 0x9e3800ed, 0x1e78035c, + 0x9e7800d1, 0x1e220081, 0x9e22028e, 0x1e6202a7, + 0x9e6202fb, 0x1e24028d, 0x9e64039e, 0x1e3002aa, + 0x9e700225, 0x1e2601cb, 0x9e6602ad, 0x1e2701db, + 0x9e6702e4, 0x1e3e2300, 0x1e6e2180, 0x1e202228, + 0x1e602388, 0x29021b40, 0x297c78c0, 0x69660970, + 0xa908018f, 0xa9427ae7, 0x29a03cfa, 0x29fc3d4b, + 0x69c84033, 0xa988240e, 0xa9fa0d9b, 0x28a02d88, + 0x28c8408a, 0x68f87a6a, 0xa8ba09f8, 0xa8c52a18, + 0x280257be, 0x28727948, 0xa83868de, 0xa8440a98, + 0x0c40733f, 0x4cdfa1e5, 0x0ccd6cea, 0x4cdf260d, + 0x0d40c227, 0x4ddfcb30, 0x0dc7cc6b, 0x4c408ced, + 0x0cdf8769, 0x4d60c346, 0x0dffca17, 0x4de8cda6, + 0x4cda4834, 0x0c4049ef, 0x4d40e6dd, 0x4ddfe946, + 0x0dcfeccf, 0x4cdf0546, 0x0cc7006b, 0x0d60e32c, + 0x0dffe5eb, 0x0dfce8de, 0x0e31bb9b, 0x4e31bbbc, + 0x0e71b841, 0x4e71bbbc, 0x4eb1b841, 0x0e30aab4, + 0x4e30abdd, 0x0e70aa30, 0x4e70a9cd, 0x4eb0a96a, + 0x6e30fbdd, 0x0e31abdd, 0x2e31aa93, 0x4e31aaf6, + 0x6e31a96a, 0x0e71a8a4, 0x2e71a81f, 0x4e71aad5, + 0x6e71a928, 0x4eb1a81f, 0x6eb1aa93, 0x6eb0f96a, + 0x7e30fbbc, 0x7e70f862, 0x7eb0fb59, 0x7ef0f8c5, + 0x0ea0c883, 0x4ea0c928, 0x4ee0caf6, 0x2ea0ca93, + 0x6ea0c9cd, 0x6ee0c8c5, 0x0ea0dbdd, 0x4ea0db38, + 0x4ee0dad5, 0x0ea0eb7a, 0x4ea0eb38, 0x4ee0e883, + 0x2ea0db38, 0x6ea0db7a, 0x6ee0db17, 0x0e20ba0f, + 0x4e20bad5, 0x0e60b883, 0x4e60bb38, 0x0ea0b928, + 0x4ea0bb59, 0x4ee0bab4, 0x0ea0fa30, 0x4ea0fa51, + 0x4ee0f862, 0x0ef8f841, 0x4ef8f820, 0x2ea0fb38, + 0x6ea0f8a4, 0x6ee0f883, 0x2ef8f9ac, 0x6ef8f81f, + 0x2ea1fbbc, 0x6ea1f96a, 0x6ee1fb7a, 0x2ef9f862, + 0x6ef9f9ac, 0x2e205a72, 0x6e20581f, 0x0e231c41, + 0x4e2f1dcd, 0x0ebf1fdd, 0x4ea21c20, 0x2e351e93, + 0x6e2e1dac, 0x0e338651, 0x4e3886f6, 0x0e6f85cd, + 0x4e7e87bc, 0x0ea087fe, 0x4ea1841f, 0x4ee38441, + 0x0e3c0f7a, 0x4e3e0fbc, 0x0e660ca4, 0x4e600ffe, + 0x0ea60ca4, 0x4ea80ce6, 0x4ee00ffe, 0x2e3c0f7a, + 0x6e340e72, 0x2e6b0d49, 0x6e6a0d28, 0x2eae0dac, + 0x6ea20c20, 0x6ef60eb4, 0x0e23d441, 0x4e3ad738, + 0x4e64d462, 0x0e421420, 0x4e4b1549, 0x2e3a8738, + 0x6e3c877a, 0x2e728630, 0x6e6087fe, 0x2ea58483, + 0x6eac856a, 0x6ef98717, 0x0e2c2d6a, 0x4e262ca4, + 0x0e742e72, 0x4e642c62, 0x0ead2d8b, 0x4eaa2d28, + 0x4eec2d6a, 0x2e312e0f, 0x6e332e51, 0x2e642c62, + 0x6e6c2d6a, 0x2eae2dac, 0x6eae2dac, 0x6ef12e0f, + 0x0eafd5cd, 0x4ea4d462, 0x4ee9d507, 0x0ed616b4, + 0x4edc177a, 0x0e329e30, 0x4e269ca4, 0x0e649c62, + 0x4e669ca4, 0x0eae9dac, 0x4eb49e72, 0x2eb7d6d5, + 0x6eb2d630, 0x6ef4d672, 0x2ecd158b, 0x6ed716d5, + 0x2e39d717, 0x6e2ed5ac, 0x6e7cd77a, 0x2e591717, + 0x6e5e17bc, 0x2e30ddee, 0x6e2ddd8b, 0x6e7adf38, + 0x2e431c41, 0x6e4e1dac, 0x0e61941f, 0x4e6c956a, + 0x0eb29630, 0x4ea99507, 0x0e24cc62, 0x4e25cc83, + 0x4e6fcdcd, 0x0e550e93, 0x4e530e51, 0x2e729630, + 0x6e659483, 0x2ea39441, 0x6ead958b, 0x0ea0cffe, + 0x4ea7ccc5, 0x4eeacd28, 0x0ed10e0f, 0x4edf0fdd, + 0x2e20fffe, 0x6e22fc20, 0x6e76feb4, 0x2e493d07, + 0x6e563eb4, 0x0e396717, 0x4e3e67bc, 0x0e7766d5, + 0x4e7d679b, 0x0ebb6759, 0x4ea764c5, 0x2e236441, + 0x6e396717, 0x2e726630, 0x6e61641f, 0x2ea764c5, + 0x6eae65ac, 0x0e2ba549, 0x4e3ea7bc, 0x0e71a60f, + 0x4e7fa7dd, 0x0eb8a6f6, 0x4ea1a41f, 0x0e35f693, + 0x4e21f41f, 0x4e67f4c5, 0x0e5035ee, 0x4e543672, + 0x0e216c1f, 0x4e346e72, 0x0e7d6f9b, 0x4e766eb4, + 0x0eb26e30, 0x4eae6dac, 0x2e2d6d8b, 0x6e2b6d49, + 0x2e686ce6, 0x6e606ffe, 0x2eb36e51, 0x6ebd6f9b, + 0x0e3eafbc, 0x4e20affe, 0x0e69ad07, 0x4e6cad6a, + 0x0eb6aeb4, 0x4eacad6a, 0x0e66b4a4, 0x4e7ab738, + 0x0eb3b651, 0x4eb3b651, 0x0e3826f6, 0x4e252483, + 0x0e7f27dd, 0x4e71260f, 0x0eb826f6, 0x4eb52693, + 0x0eb5f693, 0x4eb8f6f6, 0x4ee4f462, 0x0ed1360f, + 0x4ec834e6, 0x2eaeedac, 0x6eb2ee30, 0x6eeded8b, + 0x2ecf2dcd, 0x6ed92f17, 0x0f81100f, 0x4f848862, + 0x4fc31841, 0x0fad518b, 0x4fa780c5, 0x4fd059ee, + 0x2fa890e6, 0x4fa38841, 0x6fc1900f, 0x0f7b8149, + 0x4f4688a4, 0x0faf81cd, 0x4fa58083, 0x0e3736d5, + 0x4e393717, 0x0e61341f, 0x4e7b3759, 0x0ea43462, + 0x4ea1341f, 0x4efd379b, 0x0e343e72, 0x4e2c3d6a, + 0x0e793f17, 0x4e753e93, 0x0ea53c83, 0x4eb43e72, + 0x4ee23c20, 0x2e3b8f59, 0x6e3c8f7a, 0x2e798f17, + 0x6e648c62, 0x2eb48e72, 0x6eae8dac, 0x6ee68ca4, + 0x2e3e37bc, 0x6e2037fe, 0x2e7f37dd, 0x6e723630, + 0x2ebd379b, 0x6ea834e6, 0x6eeb3549, 0x2e3f3fdd, + 0x6e343e72, 0x2e693d07, 0x6e663ca4, 0x2ea93d07, + 0x6eb13e0f, 0x6eeb3d49, 0x0e39e717, 0x4e2ae528, + 0x4e64e462, 0x2ebee7bc, 0x6eb7e6d5, 0x6ee1e41f, + 0x2e27e4c5, 0x6e3de79b, 0x6e62e420, 0x659239e8, + 0x65d03b94, 0x65d0232d, 0x65d120c2, 0x659129f2, + 0x65933ca3, 0x25969683, 0x25961d15, 0x254d1c48, + 0x259e3f61, 0x25953b96, 0x255b91d1, 0x247686ed, + 0x24309098, 0x2462edb9, 0x24a57468, 0xba5fd3e3, + 0x3a5f03e5, 0xfa411be4, 0x7a42cbe2, 0x93df03ff, + 0xc820ffff, 0x8822fc7f, 0xc8247cbf, 0x88267fff, + 0x4e010fe0, 0x5e040420, 0x4e081fe1, 0x4e0c1fe1, + 0x4e0a1fe1, 0x4e071fe1, 0x4e042c20, 0x4e062c20, + 0x4e052c20, 0x4e083c20, 0x0e0c3c20, 0x0e0a3c20, + 0x0e073c20, 0x9eae0020, 0x0f03f409, 0x6f03f40e, + 0x4cc0ac3f, 0x0ea1b820, 0x0ef9b820, 0x4ef9b820, + 0x4e21c862, 0x0e79c862, 0x4e79c862, 0x4e61b8a4, + 0x0e79b8a4, 0x4e79b8a4, 0x05a08020, 0x05104fe0, + 0x05505001, 0x05906fe2, 0x05d03005, 0x05101fea, + 0x05901feb, 0x04b0e3e0, 0x0470e7e1, 0x042f9c20, + 0x043f9c35, 0x047f9c20, 0x04ff9c20, 0x04299420, + 0x04319160, 0x0461943e, 0x04a19020, 0x04038100, + 0x040381a0, 0x040387e1, 0x04438be2, 0x04c38fe3, + 0x040181e0, 0x04018100, 0x04018621, 0x04418b22, + 0x04418822, 0x04818c23, 0x040081e0, 0x04008120, + 0x04008761, 0x04008621, 0x04408822, 0x04808c23, + 0x042053ff, 0x047f5401, 0x25208028, 0x2538cfe0, + 0x2578d001, 0x25b8efe2, 0x25f8f007, 0x2538dfea, + 0x25b8dfeb, 0xa400a3e0, 0xa420a7e0, 0xa4484be0, + 0xa467afe0, 0xa4a8a7ea, 0xa547a814, 0xa4084ffe, + 0xa55c53e0, 0xa5e1540b, 0xe400fbf6, 0xe408ffff, + 0xe420e7e0, 0xe4484be0, 0xe460efe0, 0xe547e400, + 0xe4014be0, 0xe4a84fe0, 0xe5f15000, 0x858043e0, + 0x85a043ff, 0xe59f5d08, 0x0420e3e9, 0x0460e3ea, + 0x04a0e3eb, 0x04e0e3ec, 0x25104042, 0x25104871, + 0x25904861, 0x25904c92, 0x05344020, 0x05744041, + 0x05b44062, 0x05f44083, 0x252c8840, 0x253c1420, + 0x25681572, 0x25a21ce3, 0x25ea1e34, 0x253c0421, + 0x25680572, 0x25a20ce3, 0x25ea0e34, 0x0522c020, + 0x05e6c0a4, 0x2401a001, 0x2443a051, 0x24858881, + 0x24c78cd1, 0x24850891, 0x24c70cc1, 0x250f9001, + 0x25508051, 0x25802491, 0x25df28c1, 0x25850c81, + 0x251e10d1, 0x65816001, 0x65c36051, 0x65854891, + 0x65c74cc1, 0x05733820, 0x05b238a4, 0x05f138e6, + 0x0570396a, 0x65d0a001, 0x65d6a443, 0x65d4a826, + 0x6594ac26, 0x6554ac26, 0x6556ac26, 0x6552ac26, + 0x65cbac85, 0x65caac01, 0x6589ac85, 0x6588ac01, + 0x65c9ac85, 0x65c8ac01, 0x65dea833, 0x659ca509, + 0x65d8a801, 0x65dcac01, 0x655cb241, 0x0520a1e0, + 0x0521a601, 0x052281e0, 0x05238601, 0x04a14026, + 0x042244a6, 0x046344a6, 0x04a444a6, 0x04e544a7, + 0x0568aca7, 0x05b23230, 0x853040af, 0xc5b040af, + 0xe57080af, 0xe5b080af, 0x25034440, 0x254054c4, + 0x25034640, 0x25415a05, 0x25834440, 0x25c54489, + 0x250b5d3a, 0x2550dc20, 0x2518e3e1, 0x2518e021, + 0x2518e0a1, 0x2518e121, 0x2518e1a1, 0x2558e3e2, + 0x2558e042, 0x2558e0c2, 0x2558e142, 0x2598e3e3, + 0x2598e063, 0x2598e0e3, 0x2598e163, 0x25d8e3e4, + 0x25d8e084, 0x25d8e104, 0x25d8e184, 0x2518e407, + 0x05214800, 0x05614800, 0x05a14800, 0x05e14800, + 0x05214c00, 0x05614c00, 0x05a14c00, 0x05e14c00, + 0x05304001, 0x05314001, 0x05a18610, 0x05e18610, + 0x05271e11, 0x6545e891, 0x6585e891, 0x65c5e891, + 0x6545c891, 0x6585c891, 0x65c5c891, 0x45b0c210, + 0x45f1c231, 0x1e601000, 0x1e603000, 0x1e621000, + 0x1e623000, 0x1e641000, 0x1e643000, 0x1e661000, + 0x1e663000, 0x1e681000, 0x1e683000, 0x1e6a1000, + 0x1e6a3000, 0x1e6c1000, 0x1e6c3000, 0x1e6e1000, + 0x1e6e3000, 0x1e701000, 0x1e703000, 0x1e721000, + 0x1e723000, 0x1e741000, 0x1e743000, 0x1e761000, + 0x1e763000, 0x1e781000, 0x1e783000, 0x1e7a1000, + 0x1e7a3000, 0x1e7c1000, 0x1e7c3000, 0x1e7e1000, + 0x1e7e3000, 0xf8268267, 0xf82d023c, 0xf8301046, + 0xf83d2083, 0xf8263290, 0xf82d528c, 0xf8284299, + 0xf8337160, 0xf8386286, 0xf8bf820e, 0xf8a600e0, + 0xf8af1353, 0xf8a922ea, 0xf8b53396, 0xf8a251e3, + 0xf8b340f4, 0xf8a470fd, 0xf8a06209, 0xf8f48097, + 0xf8f002ea, 0xf8eb10d9, 0xf8ff21b0, 0xf8f7302c, + 0xf8ee52a9, 0xf8f041fa, 0xf8e471e4, 0xf8e863c6, + 0xf864823d, 0xf87d013a, 0xf86f1162, 0xf87d20e3, + 0xf86132bb, 0xf870510e, 0xf8704336, 0xf86572b4, + 0xf8706217, 0xb83e8294, 0xb8200264, 0xb8381284, + 0xb8242358, 0xb8333102, 0xb828530e, 0xb83042df, + 0xb824703f, 0xb82a6194, 0xb8a080e9, 0xb8b80090, + 0xb8bb1146, 0xb8bb21b8, 0xb8b032df, 0xb8b653f4, + 0xb8bd41c9, 0xb8b47287, 0xb8bc6169, 0xb8ee828c, + 0xb8e10138, 0xb8f3126d, 0xb8f020b0, 0xb8e03183, + 0xb8e851ef, 0xb8f041e4, 0xb8fe7005, 0xb8ea6376, + 0xb8638120, 0xb873015d, 0xb8781284, 0xb86723b8, + 0xb86e3175, 0xb87b51ed, 0xb87f41d1, 0xb863721e, + 0xb87660f4, 0xce216874, 0xce104533, 0xce648c15, + 0xce8e3302, 0xce6e82ab, 0xce6c87d1, 0xcec08063, + 0xce638937, 0x25e0c358, 0x25a1c7d3, 0x0580785a, + 0x05426328, 0x05009892, 0x25a0cc29, 0x2561cec8, + 0x058044b3, 0x05401c99, 0x05006b49, 0x25e0d6f7, + 0x2561c528, 0x0583c8bc, 0x0542522f, 0x05001ec0, + 0x25e0de65, 0x25a1c113, 0x05803cad, 0x0540f3c0, + 0x0500ab15, 0x2560c28c, 0x2561d7c0, 0x05801ed7, + 0x0542633b, 0x05003696, 0x2560d4b4, 0x25e1c918, + 0x058021ff, 0x05400e15, 0x0500f3de, 0x0473025a, + 0x04bd05ab, 0x658e0025, 0x658a08e2, 0x659a0493, + 0x043e1062, 0x04f418b4, 0x046d15bd, 0x04611fce, + 0x04d6a07c, 0x04001929, 0x041a09da, 0x04d098f4, + 0x04db10d4, 0x0459a3ad, 0x041aa029, 0x041919fb, + 0x04d39e24, 0x04118302, 0x04101dba, 0x04d7ae16, + 0x04dea571, 0x04180210, 0x05e786fc, 0x05e4915c, + 0x04881cf1, 0x044a0f04, 0x04090969, 0x048b16c4, + 0x044101e4, 0x04dcbf44, 0x65809745, 0x658d833f, + 0x65c68468, 0x65c79b07, 0x65829e38, 0x049dafca, + 0x6582bba8, 0x65c0b7ff, 0x65c1b4e0, 0x658dbadd, + 0x65819a9d, 0x65ed9246, 0x65b30815, 0x65e6263c, + 0x65eebb94, 0x65bad14e, 0x65efe178, 0x65fc5697, + 0x65e07f14, 0x040c55a6, 0x04977f4d, 0x043d3046, + 0x04b733a0, 0x046830a4, 0x04ed322d, 0x05686948, + 0x05bd6c13, 0x65c88ef0, 0x450db3d7, 0x4540b6d9, + 0x043e3979, 0x445896ce, 0x445a9005, 0x44d98069, + 0x445b87ae, 0x04da348e, 0x04982edb, 0x0499397f, + 0x0408338c, 0x04ca309c, 0x65c721e6, 0x65c63641, + 0x65982882, 0x04812b8b, 0x0e251083, 0x4e3712d5, + 0x0e61101f, 0x4e6d118b, 0x0eba1338, 0x4eb712d5, + 0x2e31120f, 0x6e2e11ac, 0x2e6810e6, 0x6e6f11cd, + 0x2eaa1128, 0x6eb1120f, }; // END Generated code -- do not edit diff --git a/test/hotspot/gtest/nmt/test_nmt_reserved_region.cpp b/test/hotspot/gtest/nmt/test_nmt_reserved_region.cpp deleted file mode 100644 index 2acf54ab4be..00000000000 --- a/test/hotspot/gtest/nmt/test_nmt_reserved_region.cpp +++ /dev/null @@ -1,53 +0,0 @@ -/* - * Copyright (c) 2023 SAP SE. All rights reserved. - * Copyright (c) 2023, 2025, 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. - * - * 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. - */ - -#include "nmt/nmtCommon.hpp" -#include "nmt/memTracker.hpp" -#include "nmt/virtualMemoryTracker.hpp" -#include "runtime/os.hpp" -#include "unittest.hpp" - -// Tests the assignment operator of ReservedMemoryRegion -TEST_VM(NMT, ReservedRegionCopy) { - address dummy1 = (address)0x10000000; - NativeCallStack stack1(&dummy1, 1); - ReservedMemoryRegion region1(dummy1, os::vm_page_size(), stack1, mtThreadStack); - VirtualMemorySummary::record_reserved_memory(os::vm_page_size(), region1.mem_tag()); - region1.add_committed_region(dummy1, os::vm_page_size(), stack1); - address dummy2 = (address)0x20000000; - NativeCallStack stack2(&dummy2, 1); - ReservedMemoryRegion region2(dummy2, os::vm_page_size(), stack2, mtCode); - VirtualMemorySummary::record_reserved_memory(os::vm_page_size(), region2.mem_tag()); - region2.add_committed_region(dummy2, os::vm_page_size(), stack2); - - region2 = region1; - - CommittedRegionIterator itr = region2.iterate_committed_regions(); - const CommittedMemoryRegion* rgn = itr.next(); - ASSERT_EQ(rgn->base(), dummy1); // Now we should see dummy1 - ASSERT_EQ(region2.mem_tag(), mtThreadStack); // Should be correct memory tag - ASSERT_EQ(region2.call_stack()->get_frame(0), dummy1); // Check the stack - rgn = itr.next(); - ASSERT_EQ(rgn, (const CommittedMemoryRegion*)nullptr); // and nothing else -} diff --git a/test/hotspot/gtest/nmt/test_nmt_treap.cpp b/test/hotspot/gtest/nmt/test_nmt_treap.cpp index 094b3348fdf..bc8c24b592f 100644 --- a/test/hotspot/gtest/nmt/test_nmt_treap.cpp +++ b/test/hotspot/gtest/nmt/test_nmt_treap.cpp @@ -24,9 +24,9 @@ #include "memory/resourceArea.hpp" #include "nmt/nmtTreap.hpp" +#include "nmt/virtualMemoryTracker.hpp" #include "runtime/os.hpp" #include "unittest.hpp" - class NMTTreapTest : public testing::Test { public: struct Cmp { @@ -72,6 +72,7 @@ class NMTTreapTest : public testing::Test { treap.visit_in_order([&](TreapCHeap::TreapNode* node) { nums_seen.at(node->key())++; + return true; }); for (int i = 0; i < up_to; i++) { EXPECT_EQ(1, nums_seen.at(i)); @@ -161,6 +162,7 @@ TEST_VM_F(NMTTreapTest, TestVisitors) { treap.visit_range_in_order(0, 100, [&](Node* x) { EXPECT_TRUE(false) << "Empty treap has no nodes to visit"; + return true; }); // Single-element set @@ -168,12 +170,14 @@ TEST_VM_F(NMTTreapTest, TestVisitors) { int count = 0; treap.visit_range_in_order(0, 100, [&](Node* x) { count++; + return true; }); EXPECT_EQ(1, count); count = 0; treap.visit_in_order([&](Node* x) { count++; + return true; }); EXPECT_EQ(1, count); @@ -184,12 +188,14 @@ TEST_VM_F(NMTTreapTest, TestVisitors) { count = 0; treap.visit_range_in_order(0, 100, [&](Node* x) { count++; + return true; }); EXPECT_EQ(1, count); count = 0; treap.visit_in_order([&](Node* x) { count++; + return true; }); EXPECT_EQ(3, count); @@ -197,6 +203,7 @@ TEST_VM_F(NMTTreapTest, TestVisitors) { treap.upsert(0, 0); // This node should not be visited. treap.visit_range_in_order(0, 0, [&](Node* x) { EXPECT_TRUE(false) << "Empty visiting range should not visit any node"; + return true; }); treap.remove_all(); @@ -208,6 +215,7 @@ TEST_VM_F(NMTTreapTest, TestVisitors) { GrowableArray seen; treap.visit_range_in_order(0, 10, [&](Node* x) { seen.push(x->key()); + return true; }); EXPECT_EQ(10, seen.length()); for (int i = 0; i < 10; i++) { @@ -217,6 +225,7 @@ TEST_VM_F(NMTTreapTest, TestVisitors) { seen.clear(); treap.visit_in_order([&](Node* x) { seen.push(x->key()); + return true; }); EXPECT_EQ(11, seen.length()); for (int i = 0; i < 10; i++) { @@ -226,6 +235,7 @@ TEST_VM_F(NMTTreapTest, TestVisitors) { seen.clear(); treap.visit_range_in_order(10, 12, [&](Node* x) { seen.push(x->key()); + return true; }); EXPECT_EQ(1, seen.length()); EXPECT_EQ(10, seen.at(0)); @@ -241,6 +251,7 @@ TEST_VM_F(NMTTreapTest, TestVisitors) { GrowableArray seen; treap.visit_range_in_order(9, -1, [&](Node* x) { seen.push(x->key()); + return true; }); EXPECT_EQ(10, seen.length()); for (int i = 0; i < 10; i++) { @@ -250,6 +261,7 @@ TEST_VM_F(NMTTreapTest, TestVisitors) { treap.visit_in_order([&](Node* x) { seen.push(x->key()); + return true; }); EXPECT_EQ(10, seen.length()); for (int i = 0; i < 10; i++) { diff --git a/test/hotspot/gtest/nmt/test_regions_tree.cpp b/test/hotspot/gtest/nmt/test_regions_tree.cpp new file mode 100644 index 00000000000..394c863746e --- /dev/null +++ b/test/hotspot/gtest/nmt/test_regions_tree.cpp @@ -0,0 +1,131 @@ +/* + * Copyright (c) 2025, 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. + * + * 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. + * + */ + +#include "memory/allocation.hpp" +#include "nmt/memTag.hpp" +#include "nmt/nmtNativeCallStackStorage.hpp" +#include "nmt/regionsTree.inline.hpp" +#include "nmt/virtualMemoryTracker.hpp" +#include "nmt/vmatree.hpp" +#include "runtime/os.hpp" +#include "unittest.hpp" + +class NMTRegionsTreeTest : public testing::Test { + public: + RegionsTree rt; + NMTRegionsTreeTest() : rt(true) { } +}; + +TEST_VM_F(NMTRegionsTreeTest, ReserveCommitTwice) { + NativeCallStack ncs; + VMATree::RegionData rd = rt.make_region_data(ncs, mtTest); + VMATree::RegionData rd2 = rt.make_region_data(ncs, mtGC); + VMATree::SummaryDiff diff; + diff = rt.reserve_mapping(0, 100, rd); + EXPECT_EQ(100, diff.tag[NMTUtil::tag_to_index(mtTest)].reserve); + diff = rt.commit_region(0, 50, ncs); + diff = rt.reserve_mapping(0, 100, rd); + EXPECT_EQ(0, diff.tag[NMTUtil::tag_to_index(mtTest)].reserve); + EXPECT_EQ(-50, diff.tag[NMTUtil::tag_to_index(mtTest)].commit); + diff = rt.reserve_mapping(0, 100, rd2); + EXPECT_EQ(-100, diff.tag[NMTUtil::tag_to_index(mtTest)].reserve); + EXPECT_EQ(100, diff.tag[NMTUtil::tag_to_index(mtGC)].reserve); + diff = rt.commit_region(0, 50, ncs); + EXPECT_EQ(0, diff.tag[NMTUtil::tag_to_index(mtGC)].reserve); + EXPECT_EQ(50, diff.tag[NMTUtil::tag_to_index(mtGC)].commit); + diff = rt.commit_region(0, 50, ncs); + EXPECT_EQ(0, diff.tag[NMTUtil::tag_to_index(mtTest)].reserve); + EXPECT_EQ(0, diff.tag[NMTUtil::tag_to_index(mtTest)].commit); +} + +TEST_VM_F(NMTRegionsTreeTest, CommitUncommitRegion) { + NativeCallStack ncs; + VMATree::RegionData rd = rt.make_region_data(ncs, mtTest); + rt.reserve_mapping(0, 100, rd); + VMATree::SummaryDiff diff = rt.commit_region(0, 50, ncs); + EXPECT_EQ(0, diff.tag[NMTUtil::tag_to_index(mtTest)].reserve); + EXPECT_EQ(50, diff.tag[NMTUtil::tag_to_index(mtTest)].commit); + diff = rt.commit_region((address)60, 10, ncs); + EXPECT_EQ(0, diff.tag[NMTUtil::tag_to_index(mtTest)].reserve); + EXPECT_EQ(10, diff.tag[NMTUtil::tag_to_index(mtTest)].commit); + diff = rt.uncommit_region(0, 50); + EXPECT_EQ(0, diff.tag[NMTUtil::tag_to_index(mtTest)].reserve); + EXPECT_EQ(-50, diff.tag[NMTUtil::tag_to_index(mtTest)].commit); +} + +TEST_VM_F(NMTRegionsTreeTest, FindReservedRegion) { + NativeCallStack ncs; + VMATree::RegionData rd = rt.make_region_data(ncs, mtTest); + rt.reserve_mapping(1000, 50, rd); + rt.reserve_mapping(1200, 50, rd); + rt.reserve_mapping(1300, 50, rd); + rt.reserve_mapping(1400, 50, rd); + ReservedMemoryRegion rmr; + rmr = rt.find_reserved_region((address)1205); + EXPECT_EQ(rmr.base(), (address)1200); + rmr = rt.find_reserved_region((address)1305); + EXPECT_EQ(rmr.base(), (address)1300); + rmr = rt.find_reserved_region((address)1405); + EXPECT_EQ(rmr.base(), (address)1400); + rmr = rt.find_reserved_region((address)1005); + EXPECT_EQ(rmr.base(), (address)1000); +} + +TEST_VM_F(NMTRegionsTreeTest, VisitReservedRegions) { + NativeCallStack ncs; + VMATree::RegionData rd = rt.make_region_data(ncs, mtTest); + rt.reserve_mapping(1000, 50, rd); + rt.reserve_mapping(1200, 50, rd); + rt.reserve_mapping(1300, 50, rd); + rt.reserve_mapping(1400, 50, rd); + + rt.visit_reserved_regions([&](const ReservedMemoryRegion& rgn) { + EXPECT_EQ(((size_t)rgn.base()) % 100, 0UL); + EXPECT_EQ(rgn.size(), 50UL); + return true; + }); +} + +TEST_VM_F(NMTRegionsTreeTest, VisitCommittedRegions) { + NativeCallStack ncs; + VMATree::RegionData rd = rt.make_region_data(ncs, mtTest); + rt.reserve_mapping(1000, 50, rd); + rt.reserve_mapping(1200, 50, rd); + rt.reserve_mapping(1300, 50, rd); + rt.reserve_mapping(1400, 50, rd); + + rt.commit_region((address)1010, 5UL, ncs); + rt.commit_region((address)1020, 5UL, ncs); + rt.commit_region((address)1030, 5UL, ncs); + rt.commit_region((address)1040, 5UL, ncs); + ReservedMemoryRegion rmr((address)1000, 50); + size_t count = 0; + rt.visit_committed_regions(rmr, [&](CommittedMemoryRegion& crgn) { + count++; + EXPECT_EQ((((size_t)crgn.base()) % 100) / 10, count); + EXPECT_EQ(crgn.size(), 5UL); + return true; + }); + EXPECT_EQ(count, 4UL); +} \ No newline at end of file diff --git a/test/hotspot/gtest/nmt/test_vmatree.cpp b/test/hotspot/gtest/nmt/test_vmatree.cpp index 80b5df50062..b43bfc58c69 100644 --- a/test/hotspot/gtest/nmt/test_vmatree.cpp +++ b/test/hotspot/gtest/nmt/test_vmatree.cpp @@ -24,6 +24,7 @@ #include "memory/allocation.hpp" #include "nmt/memTag.hpp" +#include "nmt/memTracker.hpp" #include "nmt/nmtNativeCallStackStorage.hpp" #include "nmt/vmatree.hpp" #include "runtime/os.hpp" @@ -36,15 +37,19 @@ using NCS = NativeCallStackStorage; class NMTVMATreeTest : public testing::Test { public: NCS ncs; - constexpr static const int si_len = 2; + constexpr static const int si_len = 4; NCS::StackIndex si[si_len]; NativeCallStack stacks[si_len]; NMTVMATreeTest() : ncs(true) { stacks[0] = make_stack(0xA); stacks[1] = make_stack(0xB); + stacks[2] = make_stack(0xC); + stacks[3] = make_stack(0xD); si[0] = ncs.push(stacks[0]); - si[1] = ncs.push(stacks[0]); + si[1] = ncs.push(stacks[1]); + si[2] = ncs.push(stacks[2]); + si[3] = ncs.push(stacks[3]); } // Utilities @@ -78,6 +83,7 @@ class NMTVMATreeTest : public testing::Test { int count = 0; treap(tree).visit_in_order([&](TNode* x) { ++count; + return true; }); return count; } @@ -99,6 +105,11 @@ class NMTVMATreeTest : public testing::Test { // Do it backwards instead. Tree tree2; + // 900---1000 + // 800--900 + // 700--800 + // ... + // 0--100 for (int i = 9; i >= 0; i--) { tree2.reserve_mapping(i * 100, 100, rd); } @@ -134,6 +145,7 @@ class NMTVMATreeTest : public testing::Test { VMATree::StateType out = out_type_of(x); EXPECT_TRUE((in == VMATree::StateType::Released && out == VMATree::StateType::Committed) || (in == VMATree::StateType::Committed && out == VMATree::StateType::Released)); + return true; }); EXPECT_EQ(2, count_nodes(tree)); } @@ -159,6 +171,7 @@ class NMTVMATreeTest : public testing::Test { found[i] = x->key(); } i++; + return true; }); ASSERT_EQ(4, i) << "0 - 50 - 75 - 100 nodes expected"; @@ -167,6 +180,162 @@ class NMTVMATreeTest : public testing::Test { EXPECT_TRUE(exists(found[2])); EXPECT_TRUE(exists(found[3])); }; + template struct ExpectedTree { + int nodes[NodeCount]; + MemTag tags[NodeCount + 1]; + VMATree::StateType states[NodeCount + 1]; + NativeCallStackStorage::StackIndex res_si[NodeCount + 1]; + NativeCallStackStorage::StackIndex com_si[NodeCount + 1]; + }; + + using State = VMATree::StateType; + using SIndex = VMATree::SIndex; + + struct UpdateCallInfo { + VMATree::IntervalState ex_st; + VMATree::RequestInfo req; + VMATree::IntervalState new_st; + int reserve[2], commit[2]; + }; + + void call_update_region(const UpdateCallInfo upd) { + VMATree::TreapNode n1{upd.req.A, {}, 0}, n2{upd.req.B, {}, 0}; + n1.val().out= upd.ex_st; + n2.val().in = n1.val().out; + Tree tree; + VMATree::SummaryDiff diff; + tree.update_region(&n1, &n2, upd.req, diff); + int from = NMTUtil::tag_to_index(upd.ex_st.mem_tag()); + int to = NMTUtil::tag_to_index(upd.new_st.mem_tag()); + stringStream ss; + ss.print("Ex. State: %d, op: %d, use-tag:%d, from==to: %d", + (int)upd.ex_st.type(), (int)upd.req.op_to_index(), upd.req.use_tag_inplace, from == to); + const char* failed_case = ss.base(); + EXPECT_EQ(n1.val().out.type(), upd.new_st.type()) << failed_case; + EXPECT_EQ(n1.val().out.mem_tag(), upd.new_st.mem_tag()) << failed_case; + EXPECT_EQ(n1.val().out.reserved_stack(), upd.new_st.reserved_stack()) << failed_case; + EXPECT_EQ(n1.val().out.committed_stack(), upd.new_st.committed_stack()) << failed_case; + + if (from == to) { + EXPECT_EQ(diff.tag[from].reserve, upd.reserve[0] + upd.reserve[1]) << failed_case; + EXPECT_EQ(diff.tag[from].commit, upd.commit[0] + upd.commit[1]) << failed_case; + } else { + EXPECT_EQ(diff.tag[from].reserve, upd.reserve[0]) << failed_case; + EXPECT_EQ(diff.tag[from].commit, upd.commit[0]) << failed_case; + EXPECT_EQ(diff.tag[to].reserve, upd.reserve[1]) << failed_case; + EXPECT_EQ(diff.tag[to].commit, upd.commit[1]) << failed_case; + } + } + + template + void create_tree(Tree& tree, ExpectedTree& et, int line_no) { + using SIndex = NativeCallStackStorage::StackIndex; + const SIndex ES = NativeCallStackStorage::invalid; // Empty Stack + VMATree::IntervalChange st; + for (int i = 0; i < N; i++) { + st.in.set_type(et.states[i]); + st.in.set_tag(et.tags[i]); + if (et.res_si[i] >= 0) { + st.in.set_reserve_stack(et.res_si[i]); + } else { + st.in.set_reserve_stack(ES); + } + if (et.com_si[i] >= 0) { + st.in.set_commit_stack(et.com_si[i]); + } else { + st.in.set_commit_stack(ES); + } + + st.out.set_type(et.states[i+1]); + st.out.set_tag(et.tags[i+1]); + if (et.res_si[i+1] >= 0) { + st.out.set_reserve_stack(et.res_si[i+1]); + } else { + st.out.set_reserve_stack(ES); + } + if (et.com_si[i+1] >= 0) { + st.out.set_commit_stack(et.com_si[i+1]); + } else { + st.out.set_commit_stack(ES); + } + tree.tree().upsert((VMATree::position)et.nodes[i], st); + } +} + + template + void check_tree(Tree& tree, const ExpectedTree& et, int line_no) { + using Node = VMATree::TreapNode; + auto left_released = [&](Node n) -> bool { + return n.val().in.type() == VMATree::StateType::Released and + n.val().in.mem_tag() == mtNone; + }; + auto right_released = [&](Node n) -> bool { + return n.val().out.type() == VMATree::StateType::Released and + n.val().out.mem_tag() == mtNone; + }; + for (int i = 0; i < N; i++) { + VMATree::VMATreap::Range r = tree.tree().find_enclosing_range(et.nodes[i]); + ASSERT_TRUE(r.start != nullptr); + Node node = *r.start; + ASSERT_EQ(node.key(), (VMATree::position)et.nodes[i]) << "at line " << line_no; + if (i == (N -1)) { // last node + EXPECT_TRUE(right_released(node)) << "right-of last node is not Released"; + break; + } + if (i == 0) { // first node + EXPECT_TRUE(left_released(node)) << "left-of first node is not Released"; + } + stringStream ss(50); + ss.print("test at line: %d, for node: %d", line_no, et.nodes[i]); + const char* for_this_node = ss.base(); + EXPECT_EQ(node.val().out.type(), et.states[i+1]) << for_this_node; + EXPECT_EQ(node.val().out.mem_tag(), et.tags[i+1]) << for_this_node; + if (et.res_si[i+1] >= 0) { + EXPECT_EQ(node.val().out.reserved_stack(), et.res_si[i+1]) << for_this_node; + EXPECT_EQ(r.end->val().in.reserved_stack(), et.res_si[i+1]) << for_this_node; + } else { + EXPECT_FALSE(node.val().out.has_reserved_stack()) << for_this_node; + EXPECT_FALSE(r.end->val().in.has_reserved_stack()) << for_this_node; + } + if (et.com_si[i+1] >= 0) { + EXPECT_EQ(node.val().out.committed_stack(), et.com_si[i+1]) << for_this_node; + EXPECT_EQ(r.end->val().in.committed_stack(), et.com_si[i+1]) << for_this_node; + } else { + EXPECT_FALSE(node.val().out.has_committed_stack()) << for_this_node; + EXPECT_FALSE(r.end->val().in.has_committed_stack()) << for_this_node; + } + } + } + + template + void print_tree(const ExpectedTree& et, int line_no) { + const State Rs = State::Reserved; + const State Rl = State::Released; + const State C = State::Committed; + stringStream ss; + ss.print_cr("Tree nodes for line %d", line_no); + ss.print_cr(" // 1 2 3 4 5"); + ss.print_cr(" // 012345678901234567890123456789012345678901234567890"); + ss.print (" // "); + int j = 0; + for (int i = 0; i < N; i++) { + char state_char = et.states[i+1] == Rl ? '.' : + et.states[i+1] == Rs ? 'r' : + et.states[i+1] == C ? 'C' : ' '; + if (i == 0 && et.nodes[i] != 0) { + for (j = 0; j < et.nodes[i]; j++) { + ss.put('.'); + } + } + for (j = et.nodes[i]; i < (N - 1) && j < et.nodes[i + 1]; j++) { + ss.put(state_char); + } + } + for (; j <= 50; j++) { + ss.put('.'); + } + tty->print_cr("%s", ss.base()); + } }; @@ -179,13 +348,27 @@ TEST_VM_F(NMTVMATreeTest, OverlappingReservationsResultInTwoNodes) { EXPECT_EQ(2, count_nodes(tree)); } -TEST_VM_F(NMTVMATreeTest, UseFlagInplace) { +TEST_VM_F(NMTVMATreeTest, DuplicateReserve) { + VMATree::RegionData rd{si[0], mtTest}; + Tree tree; + tree.reserve_mapping(100, 100, rd); + tree.reserve_mapping(100, 100, rd); + EXPECT_EQ(2, count_nodes(tree)); + VMATree::VMATreap::Range r = tree.tree().find_enclosing_range(110); + EXPECT_EQ(100, (int)(r.end->key() - r.start->key())); +} + +TEST_VM_F(NMTVMATreeTest, UseTagInplace) { Tree tree; - VMATree::RegionData rd1(si[0], mtTest); - VMATree::RegionData rd2(si[1], mtNone); - tree.reserve_mapping(0, 100, rd1); - tree.commit_mapping(20, 50, rd2, true); - tree.uncommit_mapping(30, 10, rd2); + VMATree::RegionData rd_Test_cs0(si[0], mtTest); + VMATree::RegionData rd_None_cs1(si[1], mtNone); + tree.reserve_mapping(0, 100, rd_Test_cs0); + // reserve: 0---------------------100 + // commit: 20**********70 + // uncommit: 30--40 + // post-cond: 0---20**30--40**70----100 + tree.commit_mapping(20, 50, rd_None_cs1, true); + tree.uncommit_mapping(30, 10, rd_None_cs1); tree.visit_in_order([&](TNode* node) { if (node->key() != 100) { EXPECT_EQ(mtTest, node->val().out.mem_tag()) << "failed at: " << node->key(); @@ -193,6 +376,7 @@ TEST_VM_F(NMTVMATreeTest, UseFlagInplace) { EXPECT_EQ(VMATree::StateType::Reserved, node->val().out.type()); } } + return true; }); } @@ -211,10 +395,10 @@ TEST_VM_F(NMTVMATreeTest, LowLevel) { { // Identical operation but different metadata should not merge Tree tree; - VMATree::RegionData rd{si[0], mtTest }; - VMATree::RegionData rd2{si[1], mtNMT }; - tree.reserve_mapping(0, 100, rd); - tree.reserve_mapping(100, 100, rd2); + VMATree::RegionData rd_Test_cs0{si[0], mtTest}; + VMATree::RegionData rd_NMT_cs1{si[1], mtNMT}; + tree.reserve_mapping(0, 100, rd_Test_cs0); + tree.reserve_mapping(100, 100, rd_NMT_cs1); EXPECT_EQ(3, count_nodes(tree)); int found_nodes = 0; @@ -222,15 +406,16 @@ TEST_VM_F(NMTVMATreeTest, LowLevel) { { // Reserving after commit should overwrite commit Tree tree; - VMATree::RegionData rd{si[0], mtTest }; - VMATree::RegionData rd2{si[1], mtNMT }; - tree.commit_mapping(50, 50, rd2); - tree.reserve_mapping(0, 100, rd); + VMATree::RegionData rd_Test_cs0{si[0], mtTest}; + VMATree::RegionData rd_NMT_cs1{si[1], mtNMT}; + tree.commit_mapping(50, 50, rd_NMT_cs1); + tree.reserve_mapping(0, 100, rd_Test_cs0); treap(tree).visit_in_order([&](TNode* x) { EXPECT_TRUE(x->key() == 0 || x->key() == 100); if (x->key() == 0) { - EXPECT_EQ(x->val().out.regiondata().mem_tag, mtTest); + EXPECT_EQ(x->val().out.reserved_regiondata().mem_tag, mtTest); } + return true; }); EXPECT_EQ(2, count_nodes(tree)); @@ -238,19 +423,19 @@ TEST_VM_F(NMTVMATreeTest, LowLevel) { { // Split a reserved region into two different reserved regions Tree tree; - VMATree::RegionData rd{si[0], mtTest }; - VMATree::RegionData rd2{si[1], mtNMT }; - VMATree::RegionData rd3{si[0], mtNone }; - tree.reserve_mapping(0, 100, rd); - tree.reserve_mapping(0, 50, rd2); - tree.reserve_mapping(50, 50, rd3); + VMATree::RegionData rd_Test_cs0{si[0], mtTest}; + VMATree::RegionData rd_NMT_cs1{si[1], mtNMT}; + VMATree::RegionData rd_None_cs0{si[0], mtNone}; + tree.reserve_mapping(0, 100, rd_Test_cs0); + tree.reserve_mapping(0, 50, rd_NMT_cs1); + tree.reserve_mapping(50, 50, rd_None_cs0); EXPECT_EQ(3, count_nodes(tree)); } { // One big reserve + release leaves an empty tree - Tree::RegionData rd{si[0], mtNMT}; + VMATree::RegionData rd_NMT_cs0{si[0], mtNMT}; Tree tree; - tree.reserve_mapping(0, 500000, rd); + tree.reserve_mapping(0, 500000, rd_NMT_cs0); tree.release_mapping(0, 500000); EXPECT_EQ(nullptr, treap_root(tree)); @@ -258,27 +443,28 @@ TEST_VM_F(NMTVMATreeTest, LowLevel) { { // A committed region inside of/replacing a reserved region // should replace the reserved region's metadata. - Tree::RegionData rd{si[0], mtNMT}; - VMATree::RegionData rd2{si[1], mtTest}; + VMATree::RegionData rd_NMT_cs0{si[0], mtNMT}; + VMATree::RegionData rd_Test_cs1{si[1], mtTest}; Tree tree; - tree.reserve_mapping(0, 100, rd); - tree.commit_mapping(0, 100, rd2); + tree.reserve_mapping(0, 100, rd_NMT_cs0); + tree.commit_mapping(0, 100, rd_Test_cs1); treap(tree).visit_range_in_order(0, 99999, [&](TNode* x) { if (x->key() == 0) { - EXPECT_EQ(mtTest, x->val().out.regiondata().mem_tag); + EXPECT_EQ(mtTest, x->val().out.reserved_regiondata().mem_tag); } if (x->key() == 100) { - EXPECT_EQ(mtTest, x->val().in.regiondata().mem_tag); + EXPECT_EQ(mtTest, x->val().in.reserved_regiondata().mem_tag); } + return true; }); } { // Attempting to reserve or commit an empty region should not change the tree. Tree tree; - Tree::RegionData rd{si[0], mtNMT}; - tree.reserve_mapping(0, 0, rd); + VMATree::RegionData rd_NMT_cs0{si[0], mtNMT}; + tree.reserve_mapping(0, 0, rd_NMT_cs0); EXPECT_EQ(nullptr, treap_root(tree)); - tree.commit_mapping(0, 0, rd); + tree.commit_mapping(0, 0, rd_NMT_cs0); EXPECT_EQ(nullptr, treap_root(tree)); } } @@ -289,12 +475,12 @@ TEST_VM_F(NMTVMATreeTest, SetTag) { VMATree::position from; VMATree::position to; MemTag tag; - NCS::StackIndex stack; + NCS::StackIndex reserve_stack; State state; }; // Take a sorted list of testranges and check that those and only those are found in the tree. - auto expect_equivalent_form = [&](auto& expected, VMATree& tree) { + auto expect_equivalent_form = [&](auto& expected, VMATree& tree, int line_no) { // With auto& our arrays do not deteriorate to pointers but are kept as testrange[N] // so this actually works! int len = sizeof(expected) / sizeof(testrange); @@ -311,11 +497,11 @@ TEST_VM_F(NMTVMATreeTest, SetTag) { EXPECT_EQ(expect.from, found.start->key()); EXPECT_EQ(expect.to, found.end->key()); // Same tag - EXPECT_EQ(expect.tag, found.start->val().out.mem_tag()); - EXPECT_EQ(expect.tag, found.end->val().in.mem_tag()); + EXPECT_EQ(expect.tag, found.start->val().out.mem_tag()) << " and at test-line: " << line_no; + EXPECT_EQ(expect.tag, found.end->val().in.mem_tag()) << " and at test-line: " << line_no; // Same stack - EXPECT_EQ(expect.stack, found.start->val().out.stack()); - EXPECT_EQ(expect.stack, found.end->val().in.stack()); + EXPECT_EQ(expect.reserve_stack, found.start->val().out.reserved_stack()) << "Unexpected stack at region: " << i << " and at test-line: " << line_no; + EXPECT_EQ(expect.reserve_stack, found.end->val().in.reserved_stack()) << "Unexpected stack at region: " << i << " and at test-line: " << line_no; // Same state EXPECT_EQ(expect.state, found.start->val().out.type()); EXPECT_EQ(expect.state, found.end->val().in.type()); @@ -324,6 +510,8 @@ TEST_VM_F(NMTVMATreeTest, SetTag) { EXPECT_EQ(len+1, tree.tree().size()); }; NCS::StackIndex si = NCS::StackIndex(); + NCS::StackIndex es = NCS::invalid; // empty or no stack is stored + Tree::RegionData rd(si, mtNone); { // The gc/cds case with only reserved data @@ -337,7 +525,7 @@ TEST_VM_F(NMTVMATreeTest, SetTag) { tree.set_tag(0, 500, mtGC); tree.set_tag(500, 100, mtClassShared); - expect_equivalent_form(expected, tree); + expect_equivalent_form(expected, tree, __LINE__); } { // Now let's add in some committed data @@ -353,6 +541,13 @@ TEST_VM_F(NMTVMATreeTest, SetTag) { }; VMATree tree; + // 0---------------------------------------------------600 + // 100****225 + // 550***560 + // 565***575 + // 0------100****225---------550***560---565***575-----600 + // 0------100****225---500---550***560---565***575-----600 + // <-------mtGC---------><-----------mtClassShared-------> tree.reserve_mapping(0, 600, rd); // The committed areas tree.commit_mapping(100, 125, rd); @@ -361,7 +556,7 @@ TEST_VM_F(NMTVMATreeTest, SetTag) { // OK, set tag tree.set_tag(0, 500, mtGC); tree.set_tag(500, 100, mtClassShared); - expect_equivalent_form(expected, tree); + expect_equivalent_form(expected, tree, __LINE__); } { // Setting the tag for adjacent regions with same stacks should merge the regions @@ -374,7 +569,7 @@ TEST_VM_F(NMTVMATreeTest, SetTag) { tree.reserve_mapping(0, 100, gc); tree.reserve_mapping(100, 100, compiler); tree.set_tag(0, 200, mtGC); - expect_equivalent_form(expected, tree); + expect_equivalent_form(expected, tree, __LINE__); } { // Setting the tag for adjacent regions with different stacks should NOT merge the regions @@ -390,7 +585,7 @@ TEST_VM_F(NMTVMATreeTest, SetTag) { tree.reserve_mapping(0, 100, gc); tree.reserve_mapping(100, 100, compiler); tree.set_tag(0, 200, mtGC); - expect_equivalent_form(expected, tree); + expect_equivalent_form(expected, tree, __LINE__); } { // Setting the tag in the middle of a range causes a split @@ -403,7 +598,7 @@ TEST_VM_F(NMTVMATreeTest, SetTag) { Tree::RegionData compiler(si, mtCompiler); tree.reserve_mapping(0, 200, compiler); tree.set_tag(100, 50, mtGC); - expect_equivalent_form(expected, tree); + expect_equivalent_form(expected, tree, __LINE__); } { // Setting the tag in between two ranges causes a split @@ -418,13 +613,13 @@ TEST_VM_F(NMTVMATreeTest, SetTag) { tree.reserve_mapping(0, 100, gc); tree.reserve_mapping(100, 100, compiler); tree.set_tag(75, 50, mtClass); - expect_equivalent_form(expected, tree); + expect_equivalent_form(expected, tree, __LINE__); } { // Holes in the address range are acceptable and untouched testrange expected[]{ { 0, 50, mtGC, si, State::Reserved}, - {50, 75, mtNone, si, State::Released}, + {50, 75, mtNone, es, State::Released}, {75, 80, mtGC, si, State::Reserved}, {80, 100, mtClassShared, si, State::Reserved} }; @@ -433,7 +628,7 @@ TEST_VM_F(NMTVMATreeTest, SetTag) { tree.reserve_mapping(0, 50, class_shared); tree.reserve_mapping(75, 25, class_shared); tree.set_tag(0, 80, mtGC); - expect_equivalent_form(expected, tree); + expect_equivalent_form(expected, tree, __LINE__); } { // Check that setting tag with 'hole' not consisting of any regions work @@ -444,15 +639,15 @@ TEST_VM_F(NMTVMATreeTest, SetTag) { Tree::RegionData class_shared(si, mtClassShared); tree.reserve_mapping(10, 10, class_shared); tree.set_tag(0, 100, mtCompiler); - expect_equivalent_form(expected, tree); + expect_equivalent_form(expected, tree, __LINE__); } { // Check that multiple holes still work testrange expected[]{ { 0, 1, mtGC, si, State::Reserved}, - { 1, 50, mtNone, si, State::Released}, + { 1, 50, mtNone, es, State::Released}, {50, 75, mtGC, si, State::Reserved}, - {75, 99, mtNone, si, State::Released}, + {75, 99, mtNone, es, State::Released}, {99, 100, mtGC, si, State::Reserved} }; VMATree tree; @@ -461,82 +656,173 @@ TEST_VM_F(NMTVMATreeTest, SetTag) { tree.release_mapping(1, 49); tree.release_mapping(75, 24); tree.set_tag(0, 100, mtGC); - expect_equivalent_form(expected, tree); + expect_equivalent_form(expected, tree, __LINE__); } } // Tests for summary accounting TEST_VM_F(NMTVMATreeTest, SummaryAccounting) { { // Fully enclosed re-reserving works correctly. - Tree::RegionData rd(NCS::StackIndex(), mtTest); - Tree::RegionData rd2(NCS::StackIndex(), mtNMT); + Tree::RegionData rd_Test_cs0(NCS::StackIndex(), mtTest); + Tree::RegionData rd_NMT_cs0(NCS::StackIndex(), mtNMT); Tree tree; - VMATree::SummaryDiff all_diff = tree.reserve_mapping(0, 100, rd); + VMATree::SummaryDiff all_diff = tree.reserve_mapping(0, 100, rd_Test_cs0); +// 1 2 3 4 5 6 7 8 9 10 11 +// 01234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789 +// AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA.......... +// Legend: +// A - Test (reserved) +// . - free VMATree::SingleDiff diff = all_diff.tag[NMTUtil::tag_to_index(mtTest)]; EXPECT_EQ(100, diff.reserve); - all_diff = tree.reserve_mapping(50, 25, rd2); + all_diff = tree.reserve_mapping(50, 25, rd_NMT_cs0); +// 1 2 3 4 5 6 7 8 9 10 11 +// 01234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789 +// AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABBBBBBBBBBBBBBBBBBBBBBBBBCCCCCCCCCCCCCCCCCCCCCCCCC.......... +// Legend: +// A - Test (reserved) +// B - Native Memory Tracking (reserved) +// C - Test (reserved) +// . - free diff = all_diff.tag[NMTUtil::tag_to_index(mtTest)]; VMATree::SingleDiff diff2 = all_diff.tag[NMTUtil::tag_to_index(mtNMT)]; EXPECT_EQ(-25, diff.reserve); EXPECT_EQ(25, diff2.reserve); } { // Fully release reserved mapping - Tree::RegionData rd(NCS::StackIndex(), mtTest); + Tree::RegionData rd_Test_cs0(NCS::StackIndex(), mtTest); Tree tree; - VMATree::SummaryDiff all_diff = tree.reserve_mapping(0, 100, rd); + VMATree::SummaryDiff all_diff = tree.reserve_mapping(0, 100, rd_Test_cs0); +// 1 2 3 4 5 6 7 8 9 10 11 +// 01234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789 +// AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA.......... +// Legend: +// A - Test (reserved) +// . - free VMATree::SingleDiff diff = all_diff.tag[NMTUtil::tag_to_index(mtTest)]; EXPECT_EQ(100, diff.reserve); all_diff = tree.release_mapping(0, 100); +// 1 2 3 4 5 6 7 8 9 10 11 +// 01234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789 +// .............................................................................................................. +// Legend: diff = all_diff.tag[NMTUtil::tag_to_index(mtTest)]; EXPECT_EQ(-100, diff.reserve); } { // Convert some of a released mapping to a committed one - Tree::RegionData rd(NCS::StackIndex(), mtTest); + Tree::RegionData rd_Test_cs0(NCS::StackIndex(), mtTest); Tree tree; - VMATree::SummaryDiff all_diff = tree.reserve_mapping(0, 100, rd); + VMATree::SummaryDiff all_diff = tree.reserve_mapping(0, 100, rd_Test_cs0); +// 1 2 3 4 5 6 7 8 9 10 11 +// 01234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789 +// AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA.......... +// Legend: +// A - Test (reserved) +// . - free VMATree::SingleDiff diff = all_diff.tag[NMTUtil::tag_to_index(mtTest)]; EXPECT_EQ(diff.reserve, 100); - all_diff = tree.commit_mapping(0, 100, rd); + all_diff = tree.commit_mapping(0, 100, rd_Test_cs0); +// 1 2 3 4 5 6 7 8 9 10 11 +// 01234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789 +// aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa.......... +// Legend: +// a - Test (committed) +// . - free diff = all_diff.tag[NMTUtil::tag_to_index(mtTest)]; EXPECT_EQ(0, diff.reserve); EXPECT_EQ(100, diff.commit); } { // Adjacent reserved mappings with same type - Tree::RegionData rd(NCS::StackIndex(), mtTest); + Tree::RegionData rd_Test_cs0(NCS::StackIndex(), mtTest); Tree tree; - VMATree::SummaryDiff all_diff = tree.reserve_mapping(0, 100, rd); + VMATree::SummaryDiff all_diff = tree.reserve_mapping(0, 10, rd_Test_cs0); +// 1 2 +// 01234567890123456789 +// AAAAAAAAAA.......... +// Legend: +// A - Test (reserved) +// . - free VMATree::SingleDiff diff = all_diff.tag[NMTUtil::tag_to_index(mtTest)]; - EXPECT_EQ(diff.reserve, 100); - all_diff = tree.reserve_mapping(100, 100, rd); + EXPECT_EQ(diff.reserve, 10); + all_diff = tree.reserve_mapping(10, 10, rd_Test_cs0); +// 1 2 3 +// 012345678901234567890123456789 +// AAAAAAAAAAAAAAAAAAAA.......... +// Legend: +// A - Test (reserved) +// . - free diff = all_diff.tag[NMTUtil::tag_to_index(mtTest)]; - EXPECT_EQ(100, diff.reserve); + EXPECT_EQ(10, diff.reserve); } { // Adjacent reserved mappings with different tags - Tree::RegionData rd(NCS::StackIndex(), mtTest); - Tree::RegionData rd2(NCS::StackIndex(), mtNMT); + Tree::RegionData rd_Test_cs0(NCS::StackIndex(), mtTest); + Tree::RegionData rd_NMT_cs0(NCS::StackIndex(), mtNMT); Tree tree; - VMATree::SummaryDiff all_diff = tree.reserve_mapping(0, 100, rd); + VMATree::SummaryDiff all_diff = tree.reserve_mapping(0, 10, rd_Test_cs0); +// 1 2 +// 01234567890123456789 +// AAAAAAAAAA.......... +// Legend: +// A - Test (reserved) +// . - free VMATree::SingleDiff diff = all_diff.tag[NMTUtil::tag_to_index(mtTest)]; - EXPECT_EQ(diff.reserve, 100); - all_diff = tree.reserve_mapping(100, 100, rd2); + EXPECT_EQ(diff.reserve, 10); + all_diff = tree.reserve_mapping(10, 10, rd_NMT_cs0); +// 1 2 3 +// 012345678901234567890123456789 +// AAAAAAAAAABBBBBBBBBB.......... +// Legend: +// A - Test (reserved) +// B - Native Memory Tracking (reserved) +// . - free diff = all_diff.tag[NMTUtil::tag_to_index(mtTest)]; EXPECT_EQ(0, diff.reserve); diff = all_diff.tag[NMTUtil::tag_to_index(mtNMT)]; - EXPECT_EQ(100, diff.reserve); + EXPECT_EQ(10, diff.reserve); } { // A commit with two previous commits inside of it should only register // the new memory in the commit diff. Tree tree; - Tree::RegionData rd(NCS::StackIndex(), mtTest); - tree.commit_mapping(128, 128, rd); - tree.commit_mapping(512, 128, rd); - VMATree::SummaryDiff diff = tree.commit_mapping(0, 1024, rd); - EXPECT_EQ(768, diff.tag[NMTUtil::tag_to_index(mtTest)].commit); - EXPECT_EQ(768, diff.tag[NMTUtil::tag_to_index(mtTest)].reserve); + Tree::RegionData rd_Test_cs0(NCS::StackIndex(), mtTest); + tree.commit_mapping(16, 16, rd_Test_cs0); +// 1 2 3 4 +// 0123456789012345678901234567890123456789 +// ................aaaaaaaaaaaaaaaa.......... +// Legend: +// a - Test (committed) +// . - free + tree.commit_mapping(32, 32, rd_Test_cs0); +// 1 2 3 4 5 6 7 +// 0123456789012345678901234567890123456789012345678901234567890123456789 +// ................aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa.......... +// Legend: +// a - Test (committed) +// . - free + VMATree::SummaryDiff diff = tree.commit_mapping(0, 64, rd_Test_cs0); +// 1 2 3 4 5 6 7 +// 0123456789012345678901234567890123456789012345678901234567890123456789 +// aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa.......... +// Legend: +// a - Test (committed) +// . - free + EXPECT_EQ(16, diff.tag[NMTUtil::tag_to_index(mtTest)].commit); + EXPECT_EQ(16, diff.tag[NMTUtil::tag_to_index(mtTest)].reserve); } } +TEST_VM_F(NMTVMATreeTest, SummaryAccountingReserveAsUncommit) { + Tree tree; + Tree::RegionData rd(NCS::StackIndex(), mtTest); + VMATree::SummaryDiff diff1 = tree.reserve_mapping(1200, 100, rd); + VMATree::SummaryDiff diff2 = tree.commit_mapping(1210, 50, rd); + EXPECT_EQ(100, diff1.tag[NMTUtil::tag_to_index(mtTest)].reserve); + EXPECT_EQ(50, diff2.tag[NMTUtil::tag_to_index(mtTest)].commit); + VMATree::SummaryDiff diff3 = tree.reserve_mapping(1220, 20, rd); + EXPECT_EQ(-20, diff3.tag[NMTUtil::tag_to_index(mtTest)].commit); + EXPECT_EQ(0, diff3.tag[NMTUtil::tag_to_index(mtTest)].reserve); +} + // Exceedingly simple tracker for page-granular allocations // Use it for testing consistency with VMATree. struct SimpleVMATracker : public CHeapObj { @@ -713,10 +999,21 @@ TEST_VM_F(NMTVMATreeTest, TestConsistencyWithSimpleTracker) { VMATree::TreapNode* endn = find(treap, (end * page_size) + page_size); ASSERT_NE(nullptr, endn); - const NativeCallStack& start_stack = ncss.get(startn->val().out.stack()); - const NativeCallStack& end_stack = ncss.get(endn->val().in.stack()); - ASSERT_TRUE(starti.stack.equals(start_stack)); - ASSERT_TRUE(endi.stack.equals(end_stack)); + const NativeCallStack& start_stack = ncss.get(startn->val().out.reserved_stack()); + const NativeCallStack& end_stack = ncss.get(endn->val().in.reserved_stack()); + // If start-node of a reserved region is committed, the stack is stored in the second_stack of the node. + if (startn->val().out.has_committed_stack()) { + const NativeCallStack& start_second_stack = ncss.get(startn->val().out.committed_stack()); + ASSERT_TRUE(starti.stack.equals(start_stack) || starti.stack.equals(start_second_stack)); + } else { + ASSERT_TRUE(starti.stack.equals(start_stack)); + } + if (endn->val().in.has_committed_stack()) { + const NativeCallStack& end_second_stack = ncss.get(endn->val().in.committed_stack()); + ASSERT_TRUE(endi.stack.equals(end_stack) || endi.stack.equals(end_second_stack)); + } else { + ASSERT_TRUE(endi.stack.equals(end_stack)); + } ASSERT_EQ(starti.mem_tag, startn->val().out.mem_tag()); ASSERT_EQ(endi.mem_tag, endn->val().in.mem_tag()); @@ -725,18 +1022,994 @@ TEST_VM_F(NMTVMATreeTest, TestConsistencyWithSimpleTracker) { } } -TEST_VM_F(NMTVMATreeTest, SummaryAccountingWhenUseFlagInplace) { +TEST_VM_F(NMTVMATreeTest, SummaryAccountingWhenUseTagInplace) { Tree tree; - VMATree::RegionData rd1(si[0], mtTest); - VMATree::RegionData rd2(si[1], mtNone); - tree.reserve_mapping(0, 100, rd1); - VMATree::SummaryDiff diff = tree.commit_mapping(0, 50, rd2, true); + VMATree::RegionData rd_Test_cs0(si[0], mtTest); + VMATree::RegionData rd_None_cs1(si[1], mtNone); +// 1 2 3 4 5 +// 012345678901234567890123456789012345678901234567890 +// .................................................. + tree.reserve_mapping(0, 50, rd_Test_cs0); +// 1 2 3 4 5 +// 012345678901234567890123456789012345678901234567890 +// rrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrr +VMATree::SummaryDiff diff = tree.commit_mapping(0, 25, rd_None_cs1, true); +// 1 2 3 4 5 +// 012345678901234567890123456789012345678901234567890 +// CCCCCCCCCCCCCCCCCCCCCCCCCrrrrrrrrrrrrrrrrrrrrrrrrr EXPECT_EQ(0, diff.tag[NMTUtil::tag_to_index(mtTest)].reserve); - EXPECT_EQ(50, diff.tag[NMTUtil::tag_to_index(mtTest)].commit); - diff = tree.commit_mapping(60, 10, rd2, true); + EXPECT_EQ(25, diff.tag[NMTUtil::tag_to_index(mtTest)].commit); + + diff = tree.commit_mapping(30, 5, rd_None_cs1, true); +// 1 2 3 4 5 +// 012345678901234567890123456789012345678901234567890 +// CCCCCCCCCCCCCCCCCCCCCCCCCrrrrrCCCCCrrrrrrrrrrrrrrr EXPECT_EQ(0, diff.tag[NMTUtil::tag_to_index(mtTest)].reserve); - EXPECT_EQ(10, diff.tag[NMTUtil::tag_to_index(mtTest)].commit); - diff = tree.uncommit_mapping(0, 50, rd2); + EXPECT_EQ(5, diff.tag[NMTUtil::tag_to_index(mtTest)].commit); + + diff = tree.uncommit_mapping(0, 25, rd_None_cs1); +// 1 2 3 4 5 +// 012345678901234567890123456789012345678901234567890 +// rrrrrrrrrrrrrrrrrrrrrrrrrrrrrrCCCCCrrrrrrrrrrrrrrr EXPECT_EQ(0, diff.tag[NMTUtil::tag_to_index(mtTest)].reserve); - EXPECT_EQ(-50, diff.tag[NMTUtil::tag_to_index(mtTest)].commit); + EXPECT_EQ(-25, diff.tag[NMTUtil::tag_to_index(mtTest)].commit); +} + +// How the memory regions are visualized: +// 1 2 3 4 5 6 7 | +// 0123456789012345678901234567890123456789012345678901234567890123456789 |_> memory address +// aaaaaaBBBBBBBcccccccDDDDDDDeeeeeeeFFFFFFFF........................... |->some letters showing the state of the memory +// Legend: +// . - None (free/released) +// r - MemTag (reserved) +// C - MemTag (committed) +// MemTag is Test if omitted. + +TEST_VM_F(NMTVMATreeTest, SeparateStacksForCommitAndReserve) { + using SIndex = NativeCallStackStorage::StackIndex; + using State = VMATree::StateType; + SIndex si_1 = si[0]; + SIndex si_2 = si[1]; + + const State Rs = State::Reserved; + const State Rl = State::Released; + const State C = State::Committed; + VMATree::RegionData rd_Test_cs1(si_1, mtTest); + VMATree::RegionData rd_None_cs2(si_2, mtNone); + + {// Check committing into a reserved region inherits the call stacks + Tree tree; + tree.reserve_mapping(0, 50, rd_Test_cs1); // reserve in an empty tree + // Pre: empty tree. + // Post: + // 1 2 3 4 5 + // 012345678901234567890123456789012345678901234567890 + // rrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrr. + ExpectedTree<2> et1 = {{ 0, 50 }, + {mtNone, mtTest, mtNone}, + {Rl , Rs , Rl }, + {-1 , si_1 , -1 }, + {-1 , -1 , -1 }}; + check_tree(tree, et1, __LINE__); + tree.commit_mapping(25, 10, rd_None_cs2, true); // commit at the middle of the region + // Post: + // 1 2 3 4 5 + // 012345678901234567890123456789012345678901234567890 + // rrrrrrrrrrrrrrrrrrrrrrrrrCCCCCCCCCCrrrrrrrrrrrrrrr. + ExpectedTree<4> et2 = {{ 0, 25, 35, 50 }, + {mtNone, mtTest, mtTest, mtTest, mtNone}, + {Rl , Rs , C , Rs , Rl }, + {-1 , si_1 , si_1 , si_1 , -1 }, + {-1 , -1 , si_2 , -1 , -1 }}; + check_tree(tree, et2, __LINE__); + + tree.commit_mapping(0, 20, rd_None_cs2, true); // commit at the beginning of the region + // 1 2 3 4 5 + // 012345678901234567890123456789012345678901234567890 + // CCCCCCCCCCCCCCCCCCCCrrrrrCCCCCCCCCCrrrrrrrrrrrrrrr. + ExpectedTree<5> et3 = {{ 0, 20, 25, 35, 50 }, + {mtNone, mtTest, mtTest, mtTest, mtTest, mtNone}, + {Rl , C , Rs , C , Rs , Rl }, + {-1 , si_1 , si_1 , si_1 , si_1 , -1 }, + {-1 , si_2 , -1 , si_2 , -1 , -1 }}; + check_tree(tree, et3, __LINE__); + + tree.commit_mapping(40, 10, rd_None_cs2, true); // commit at the end of the region + // Post: + // 1 2 3 4 5 + // 012345678901234567890123456789012345678901234567890 + // CCCCCCCCCCCCCCCCCCCCrrrrrCCCCCCCCCCrrrrrCCCCCCCCCC. + ExpectedTree<6> et4 = {{ 0, 20, 25, 35, 40, 50 }, + {mtNone, mtTest, mtTest, mtTest, mtTest, mtTest, mtNone}, + {Rl , C , Rs , C , Rs , C , Rl }, + {-1 , si_1 , si_1 , si_1 , si_1 , si_1 , -1 }, + {-1 , si_2 , -1 , si_2 , -1 , si_2 , -1 }}; + check_tree(tree, et4, __LINE__); + } + {// committing overlapped regions does not destroy the old call-stacks + Tree tree; + tree.reserve_mapping(0, 50, rd_Test_cs1); // reserving in an empty tree + // Pre: empty tree. + // 1 2 3 4 5 + // 012345678901234567890123456789012345678901234567890 + // rrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrr + ExpectedTree<2> et1 = {{ 0 , 50 }, + {mtNone, mtTest, mtNone}, + {Rl , Rs , Rl }, + {-1 , si_1 , -1 }, + {-1 , -1 , -1 }}; + check_tree(tree, et1, __LINE__); + + tree.commit_mapping(10, 10, rd_None_cs2, true); + // 1 2 3 4 5 + // 012345678901234567890123456789012345678901234567890 + // rrrrrrrrrrCCCCCCCCCCrrrrrrrrrrrrrrrrrrrrrrrrrrrrrr + ExpectedTree<4> et2 = {{ 0, 10, 20, 50 }, + {mtNone, mtTest, mtTest, mtTest, mtNone}, + {Rl , Rs , C , Rs , Rl }, + {-1 , si_1 , si_1 , si_1 , -1 }, + {-1 , -1 , si_2 , -1 , -1 }}; + check_tree(tree, et2, __LINE__); + + SIndex si_3 = si[2]; + VMATree::RegionData rd_Test_cs3(si_3, mtTest); + // commit with overlap at the region's start + tree.commit_mapping(5, 10, rd_Test_cs3); + // 1 2 3 4 5 + // 012345678901234567890123456789012345678901234567890 + // rrrrrCCCCCCCCCCCCCCCrrrrrrrrrrrrrrrrrrrrrrrrrrrrrr + ExpectedTree<5> et3 = {{ 0, 5, 15, 20, 50 }, + {mtNone, mtTest, mtTest, mtTest, mtTest, mtNone}, + {Rl , Rs , C , C , Rs , Rl }, + {-1 , si_1 , si_1 , si_1 , si_1 , -1 }, + {-1 , -1 , si_3 , si_2 , -1 , -1 }}; + check_tree(tree, et3, __LINE__); + + SIndex si_4 = si[3]; + VMATree::RegionData call_stack_4(si_4, mtTest); + // commit with overlap at the region's end + tree.commit_mapping(15, 10, call_stack_4); + // 1 2 3 4 5 + // 012345678901234567890123456789012345678901234567890 + // rrrrrCCCCCCCCCCCCCCCCCCCCrrrrrrrrrrrrrrrrrrrrrrrrr + ExpectedTree<5> et4 = {{ 0, 5, 15, 25, 50 }, + {mtNone, mtTest, mtTest, mtTest, mtTest, mtNone}, + {Rl , Rs , C , C , Rs , Rl }, + {-1 , si_1 , si_1 , si_1 , si_1 , -1 }, + {-1 , -1 , si_3 , si_4 , -1 , -1 }}; + check_tree(tree, et4, __LINE__); + } + {// uncommit should not store any call-stack + Tree tree; + tree.reserve_mapping(0, 50, rd_Test_cs1); + + tree.commit_mapping(10, 10, rd_None_cs2, true); + + tree.commit_mapping(0, 5, rd_None_cs2, true); + + tree.uncommit_mapping(0, 3, rd_None_cs2); + // 1 2 3 4 5 + // 012345678901234567890123456789012345678901234567890 + // rrrCCrrrrrCCCCCCCCCCrrrrrrrrrrrrrrrrrrrrrrrrrrrrrr + ExpectedTree<6> et1 = {{ 0, 3, 5, 10, 20, 50 }, + {mtNone, mtTest, mtTest, mtTest, mtTest, mtTest, mtNone}, + {Rl , Rs , C , Rs , C , Rs , Rl }, + {-1 , si_1 , si_1 , si_1 , si_1 , si_1 , -1 }, + {-1 , -1 , si_2 , -1 , si_2 , -1 , -1 }}; + check_tree(tree, et1, __LINE__); + + tree.uncommit_mapping(5, 10, rd_None_cs2); + // 1 2 3 4 5 + // 012345678901234567890123456789012345678901234567890 + // rrrCCrrrrrrrrrrCCCCCrrrrrrrrrrrrrrrrrrrrrrrrrrrrrr. + ExpectedTree<6> et2 = {{ 0, 3, 5, 15, 20, 50 }, + {mtNone, mtTest, mtTest, mtTest, mtTest, mtTest, mtNone}, + {Rl , Rs , C , Rs , C , Rs , Rl }, + {-1 , si_1 , si_1 , si_1 , si_1 , si_1 , -1 }, + {-1 , -1 , si_2 , -1 , si_2 , -1 , -1 }}; + check_tree(tree, et2, __LINE__); + } + {// reserve after reserve, but only different call-stacks + SIndex si_4 = si[3]; + VMATree::RegionData call_stack_4(si_4, mtTest); + + Tree tree; + tree.reserve_mapping(0, 50, rd_Test_cs1); + tree.reserve_mapping(10, 10, call_stack_4); + // 1 2 3 4 5 + // 012345678901234567890123456789012345678901234567890 + // rrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrr + ExpectedTree<4> et1 = {{ 0, 10, 20, 50 }, + {mtNone, mtTest, mtTest, mtTest, mtNone}, + {Rl , Rs , Rs , Rs , Rl }, + {-1 , si_1 , si_4 , si_1 , -1 }, + {-1 , -1 , -1 , -1 , -1 }}; + check_tree(tree, et1, __LINE__); + } + {// commit without reserve + Tree tree; + tree.commit_mapping(0, 50, rd_Test_cs1); + // 1 2 3 4 5 + // 012345678901234567890123456789012345678901234567890 + // CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC + ExpectedTree<2> et = {{ 0, 50 }, + {mtNone, mtTest, mtNone}, + {Rl , C , Rl }, + {-1 , si_1 , -1 }, + {-1 , si_1 , -1 }}; + check_tree(tree, et, __LINE__); + } + {// reserve after commit + Tree tree; + tree.commit_mapping(0, 50, rd_None_cs2); + tree.reserve_mapping(0, 50, rd_Test_cs1); + // 1 2 3 4 5 + // 012345678901234567890123456789012345678901234567890 + // rrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrr + ExpectedTree<2> et = {{ 0, 50 }, + {mtNone, mtTest, mtNone}, + {Rl , Rs , Rl }, + {-1 , si_1 , -1 }, + {-1 , -1 , -1 }}; + check_tree(tree, et, __LINE__); + } +} + +TEST_VM_F(NMTVMATreeTest, OverlapTableRows0To3) { + using SIndex = NativeCallStackStorage::StackIndex; + using State = VMATree::StateType; + SIndex si_1 = si[0]; + SIndex si_2 = si[1]; + SIndex si_3 = si[2]; + + const State Rs = State::Reserved; + const State Rl = State::Released; + const State C = State::Committed; + VMATree::RegionData rd_Test_cs1(si_1, mtTest); + VMATree::RegionData rd_None_cs1(si_1, mtNone); + VMATree::RegionData rd_Test_cs2(si_2, mtTest); + VMATree::RegionData rd_None_cs2(si_2, mtNone); + VMATree::RegionData rd_None_cs3(si_3, mtNone); + + // row 0: .........A..................B..... + // case of empty tree is already covered in other tests. + // row 1 is impossible. See the implementation. + { + // row 2: .........A...Y.......................W.....B.......... + // 1 2 3 4 5 + // 012345678901234567890123456789012345678901234567890 + // rrrrrrrrrr......................................... + Tree tree; + ExpectedTree<5> pre = {{ 10, 12, 14, 16, 20 }, + {mtNone, mtTest, mtTest, mtTest, mtTest, mtNone}, + {Rl , Rs , Rs , Rs , Rs , Rl }, + {-1 , si_1 , si_2 , si_1 , si_2 , -1 }, + {-1 , -1 , -1 , -1 , -1 , -1 } + }; + create_tree(tree, pre, __LINE__); + VMATree::SummaryDiff diff = tree.commit_mapping(5, 20, rd_Test_cs2, false); + // 1 2 3 4 5 + // 012345678901234567890123456789012345678901234567890 + // .....CCCCCCCCCCCCCCCCCCCC.......................... + EXPECT_EQ(diff.tag[NMTUtil::tag_to_index(mtTest)].commit, 20); + EXPECT_EQ(diff.tag[NMTUtil::tag_to_index(mtTest)].reserve, 10); + ExpectedTree<6> et = {{ 5, 10, 12, 14, 16, 25 }, + {mtNone, mtTest, mtTest, mtTest, mtTest, mtTest, mtNone}, + {Rl , C , C , C , C , C , Rl }, + {-1 , si_2 , si_1 , si_2 , si_1 , si_2 , -1 }, + {-1 , si_2 , si_2 , si_2 , si_2 , si_2 , -1 } + }; + check_tree(tree, et, __LINE__); + } + { + // row 3: .........A...Y.......................WB..... + // 1 2 3 4 5 + // 012345678901234567890123456789012345678901234567890 + // ..........rrrrrrrrrr............................... + Tree tree; + ExpectedTree<5> pre = {{ 10, 12, 14, 16, 20 }, + {mtNone, mtTest, mtTest, mtTest, mtTest, mtNone}, + {Rl , Rs , Rs , Rs , Rs , Rl }, + {-1 , si_1 , si_2 , si_1 , si_2 , -1 }, + {-1 , -1 , -1 , -1 , -1 , -1 } + }; + create_tree(tree, pre, __LINE__); + VMATree::SummaryDiff diff = tree.commit_mapping(5, 15, rd_Test_cs2, false); + // 1 2 3 4 5 + // 012345678901234567890123456789012345678901234567890 + // .....CCCCCCCCCCCCCCC............................... + EXPECT_EQ(diff.tag[NMTUtil::tag_to_index(mtTest)].commit, 15); + EXPECT_EQ(diff.tag[NMTUtil::tag_to_index(mtTest)].reserve, 5); + ExpectedTree<6> et = {{ 5, 10, 12, 14, 16, 20 }, + {mtNone, mtTest, mtTest, mtTest, mtTest, mtTest, mtNone}, + {Rl , C , C , C , C , C , Rl }, + {-1 , si_2 , si_1 , si_2 , si_1 , si_2 , -1 }, + {-1 , si_2 , si_2 , si_2 , si_2 , si_2 , -1 } + }; + check_tree(tree, et, __LINE__); + } +} + +TEST_VM_F(NMTVMATreeTest, OverlapTableRows4to7) { + using SIndex = NativeCallStackStorage::StackIndex; + using State = VMATree::StateType; + SIndex si_1 = si[0]; + SIndex si_2 = si[1]; + SIndex si_3 = si[2]; + + const State Rs = State::Reserved; + const State Rl = State::Released; + const State C = State::Committed; + VMATree::RegionData rd_Test_cs1(si_1, mtTest); + VMATree::RegionData rd_None_cs1(si_1, mtNone); + VMATree::RegionData rd_Test_cs2(si_2, mtTest); + VMATree::RegionData rd_None_cs2(si_2, mtNone); + VMATree::RegionData rd_None_cs3(si_3, mtNone); + + { + // row 4: .....X...A..................B..... + // 1 2 3 4 5 + // 012345678901234567890123456789012345678901234567890 + // rrrrrrrrrr......................................... + Tree tree; + ExpectedTree<2> pre = {{ 0, 10, }, + {mtNone, mtTest, mtNone}, + {Rl , Rs , Rl }, + {-1 , si_1 , -1 }, + {-1 , -1 , -1 } + }; + create_tree(tree, pre, __LINE__); + VMATree::SummaryDiff diff = tree.commit_mapping(20, 20, rd_Test_cs2, false); + // 1 2 3 4 5 + // 012345678901234567890123456789012345678901234567890 + // rrrrrrrrrr..........CCCCCCCCCCCCCCCCCCCC........... + EXPECT_EQ(diff.tag[NMTUtil::tag_to_index(mtTest)].commit, 20); + EXPECT_EQ(diff.tag[NMTUtil::tag_to_index(mtTest)].reserve, 20); + ExpectedTree<4> et = {{ 0, 10, 20, 40 }, + {mtNone, mtTest, mtNone, mtTest, mtNone}, + {Rl , Rs , Rl , C , Rl }, + {-1 , si_1 , -1 , si_2 , -1 }, + {-1 , -1 , -1 , si_2 , -1 } + }; + check_tree(tree, et, __LINE__); + } + { + // row 5: .....X...A...YW.............B..... + // 1 2 3 4 5 + // 012345678901234567890123456789012345678901234567890 + // .....rrrrrrrrrr.................................... + Tree tree; + ExpectedTree<2> pre = {{ 5, 15, }, + {mtNone, mtTest, mtNone}, + {Rl , Rs , Rl }, + {-1 , si_1 , -1 }, + {-1 , -1 , -1 } + }; + create_tree(tree, pre, __LINE__); + VMATree::SummaryDiff diff = tree.commit_mapping(10, 10, rd_Test_cs2, false); + // 1 2 3 4 5 + // 012345678901234567890123456789012345678901234567890 + // .....rrrrrCCCCCCCCCC............................... + EXPECT_EQ(diff.tag[NMTUtil::tag_to_index(mtTest)].commit, 10); + EXPECT_EQ(diff.tag[NMTUtil::tag_to_index(mtTest)].reserve, 20 - 15); + ExpectedTree<4> et = {{ 5, 10, 15, 20 }, + {mtNone, mtTest, mtTest, mtTest, mtNone}, + {Rl , Rs , C , C , Rl }, + {-1 , si_1 , si_1 , si_2 , -1 }, + {-1 , -1 , si_2 , si_2 , -1 } + }; + check_tree(tree, et, __LINE__); + } + { + // row 6: .....X...A.....Y.......................W.....B... + // 1 2 3 4 5 + // 012345678901234567890123456789012345678901234567890 + // rrrrr.....rrrrrrrrrr............................... + Tree tree; + ExpectedTree<7> pre = {{ 0, 5, 10, 12, 14, 16, 20 }, + {mtNone, mtTest, mtNone, mtTest, mtTest, mtTest, mtTest, mtNone}, + {Rl , Rs , Rl , Rs , Rs , Rs , Rs , Rl }, + {-1 , si_1 , -1 , si_1 , si_2 , si_1 , si_2 , -1 }, + {-1 , -1 , -1 , -1 , -1 , -1 , -1 , -1 } + }; + create_tree(tree, pre, __LINE__); + VMATree::SummaryDiff diff = tree.commit_mapping(7, 20, rd_Test_cs2, false); + // 1 2 3 4 5 + // 012345678901234567890123456789012345678901234567890 + // rrrrr..CCCCCCCCCCCCCCCCCCCC........................ + EXPECT_EQ(diff.tag[NMTUtil::tag_to_index(mtTest)].commit, 20); + EXPECT_EQ(diff.tag[NMTUtil::tag_to_index(mtTest)].reserve, 10); + ExpectedTree<8> et = {{ 0, 5, 7, 10, 12, 14, 16, 27 }, + {mtNone, mtTest, mtNone, mtTest, mtTest, mtTest, mtTest, mtTest, mtNone}, + {Rl , Rs , Rl , C , C , C , C , C , Rl }, + {-1 , si_1 , -1 , si_2 , si_1 , si_2 , si_1 , si_2 , -1 }, + {-1 , -1 , -1 , si_2 , si_2 , si_2 , si_2 , si_2 , -1 } + }; + check_tree(tree, et, __LINE__); + } + { + // row 7: .....X...A...Y.......................WB..... + // 1 2 3 4 5 + // 012345678901234567890123456789012345678901234567890 + // rrrrr.....rrrrrrrrrr............................... + Tree tree; + ExpectedTree<7> pre = {{ 0, 5, 10, 12, 14, 16, 20 }, + {mtNone, mtTest, mtNone, mtTest, mtTest, mtTest, mtTest, mtNone}, + {Rl , Rs , Rl , Rs , Rs , Rs , Rs , Rl }, + {-1 , si_1 , -1 , si_1 , si_2 , si_1 , si_2 , -1 }, + {-1 , -1 , -1 , -1 , -1 , -1 , -1 , -1 } + }; + create_tree(tree, pre, __LINE__); + VMATree::SummaryDiff diff = tree.commit_mapping(7, 13, rd_Test_cs2, false); + // 1 2 3 4 5 + // 012345678901234567890123456789012345678901234567890 + // rrrrr..CCCCCCCCCCCCC............................... + EXPECT_EQ(diff.tag[NMTUtil::tag_to_index(mtTest)].commit, 13); + EXPECT_EQ(diff.tag[NMTUtil::tag_to_index(mtTest)].reserve, 3); + ExpectedTree<8> et = {{ 0, 5, 7, 10, 12, 14, 16, 20 }, + {mtNone, mtTest, mtNone, mtTest, mtTest, mtTest, mtTest, mtTest, mtNone}, + {Rl , Rs , Rl , C , C , C , C , C , Rl }, + {-1 , si_1 , -1 , si_2 , si_1 , si_2 , si_1 , si_2 , -1 }, + {-1 , -1 , -1 , si_2 , si_2 , si_2 , si_2 , si_2 , -1 } + }; + check_tree(tree, et, __LINE__); + } + +} + +TEST_VM_F(NMTVMATreeTest, OverlapTableRows8to11) { + using SIndex = NativeCallStackStorage::StackIndex; + using State = VMATree::StateType; + SIndex si_1 = si[0]; + SIndex si_2 = si[1]; + SIndex si_3 = si[2]; + + const State Rs = State::Reserved; + const State Rl = State::Released; + const State C = State::Committed; + VMATree::RegionData rd_Test_cs1(si_1, mtTest); + VMATree::RegionData rd_None_cs1(si_1, mtNone); + VMATree::RegionData rd_Test_cs2(si_2, mtTest); + VMATree::RegionData rd_None_cs2(si_2, mtNone); + VMATree::RegionData rd_None_cs3(si_3, mtNone); + { + // row 8: ........XA..................B..... + // 1 2 3 4 5 + // 012345678901234567890123456789012345678901234567890 + // rrrrrrrrrr......................................... + // nodes: 0--------50........................... + // si1 + // - + // request: 50*****************250 + // post: 0--------50*****************250 + // si1 si2 + // - si2 + Tree tree; + ExpectedTree<2> pre = {{ 0, 10, }, + {mtNone, mtTest, mtNone}, + {Rl , Rs , Rl }, + {-1 , si_1 , -1 }, + {-1 , -1 , -1 } + }; + create_tree(tree, pre, __LINE__); + VMATree::SummaryDiff diff = tree.commit_mapping(10, 20, rd_Test_cs2, false); + // 1 2 3 4 5 + // 012345678901234567890123456789012345678901234567890 + // rrrrrrrrrrCCCCCCCCCCCCCCCCCCCC..................... + EXPECT_EQ(diff.tag[NMTUtil::tag_to_index(mtTest)].commit, 20); + EXPECT_EQ(diff.tag[NMTUtil::tag_to_index(mtTest)].reserve, 20); + ExpectedTree<3> et = {{ 0, 10, 30 }, + {mtNone, mtTest, mtTest, mtNone}, + {Rl , Rs , C , Rl }, + {-1 , si_1 , si_2 , -1 }, + {-1 , -1 , si_2 , -1 } + }; + check_tree(tree, et, __LINE__); + } + { + // row 9: ........XA....YW.............B..... + // 1 2 3 4 5 + // 012345678901234567890123456789012345678901234567890 + // rrrrrrrrrr......................................... + Tree tree; + ExpectedTree<2> pre = {{ 0, 10, }, + {mtNone, mtTest, mtNone}, + {Rl , Rs , Rl }, + {-1 , si_1 , -1 }, + {-1 , -1 , -1 } + }; + create_tree(tree, pre, __LINE__); + VMATree::SummaryDiff diff = tree.commit_mapping(0, 20, rd_Test_cs2, false); + // 1 2 3 4 5 + // 012345678901234567890123456789012345678901234567890 + // CCCCCCCCCCCCCCCCCCCC............................... + EXPECT_EQ(diff.tag[NMTUtil::tag_to_index(mtTest)].commit, 20); + EXPECT_EQ(diff.tag[NMTUtil::tag_to_index(mtTest)].reserve, 10); + ExpectedTree<3> et = {{ 0, 10, 20 }, + {mtNone, mtTest, mtTest, mtNone}, + {Rl , C , C , Rl }, + {-1 , si_1 , si_2 , -1 }, + {-1 , si_2 , si_2 , -1 } + }; + check_tree(tree, et, __LINE__); + } + { + // row 10: ........XA...Y.......................W.....B... + // 1 2 3 4 5 + // 012345678901234567890123456789012345678901234567890 + // .....rrrrrrrrrrrrrrr............................... + Tree tree; + ExpectedTree<6> pre = {{ 5, 10, 12, 14, 16, 20 }, + {mtNone, mtTest, mtTest, mtTest, mtTest, mtTest, mtNone}, + {Rl , Rs , Rs , Rs , Rs , Rs , Rl }, + {-1 , si_2 , si_1 , si_2 , si_1 , si_2 , -1 }, + {-1 , -1 , -1 , -1 , -1 , -1 , -1 } + }; + create_tree(tree, pre, __LINE__); + VMATree::SummaryDiff diff = tree.commit_mapping(5, 20, rd_Test_cs2, false); + // 1 2 3 4 5 + // 012345678901234567890123456789012345678901234567890 + // .....CCCCCCCCCCCCCCCCCCCC.......................... + EXPECT_EQ(diff.tag[NMTUtil::tag_to_index(mtTest)].commit, 20); + EXPECT_EQ(diff.tag[NMTUtil::tag_to_index(mtTest)].reserve, 25 - 20); + ExpectedTree<6> et = {{ 5, 10, 12, 14, 16, 25 }, + {mtNone, mtTest, mtTest, mtTest, mtTest, mtTest, mtNone}, + {Rl , C , C , C , C , C , Rl }, + {-1 , si_2 , si_1 , si_2 , si_1 , si_2 , -1 }, + {-1 , si_2 , si_2 , si_2 , si_2 , si_2 , -1 } + }; + check_tree(tree, et, __LINE__); + } + { + // row 11: ........XA...Y.......................WB..... + // 1 2 3 4 5 + // 012345678901234567890123456789012345678901234567890 + // .....rrrrrrrrrrrrrrr............................... + Tree tree; + ExpectedTree<6> pre = {{ 5, 10, 12, 14, 16, 20 }, + {mtNone, mtTest, mtTest, mtTest, mtTest, mtTest, mtNone}, + {Rl , Rs , Rs , Rs , Rs , Rs , Rl }, + {-1 , si_2 , si_1 , si_2 , si_1 , si_2 , -1 }, + {-1 , -1 , -1 , -1 , -1 , -1 , -1 } + }; + create_tree(tree, pre, __LINE__); + VMATree::SummaryDiff diff = tree.commit_mapping(5, 15, rd_Test_cs2, false); + // 1 2 3 4 5 + // 012345678901234567890123456789012345678901234567890 + // .....CCCCCCCCCCCCCCC............................... + EXPECT_EQ(diff.tag[NMTUtil::tag_to_index(mtTest)].commit, 15); + EXPECT_EQ(diff.tag[NMTUtil::tag_to_index(mtTest)].reserve, 0); + ExpectedTree<6> et = {{ 5, 10, 12, 14, 16, 20 }, + {mtNone, mtTest, mtTest, mtTest, mtTest, mtTest, mtNone}, + {Rl , C , C , C , C , C , Rl }, + {-1 , si_2 , si_1 , si_2 , si_1 , si_2 , -1 }, + {-1 , si_2 , si_2 , si_2 , si_2 , si_2 , -1 } + }; + check_tree(tree, et, __LINE__); + } + +} + +TEST_VM_F(NMTVMATreeTest, OverlapTableRows12to15) { + using SIndex = NativeCallStackStorage::StackIndex; + using State = VMATree::StateType; + SIndex si_1 = si[0]; + SIndex si_2 = si[1]; + SIndex si_3 = si[2]; + + const State Rs = State::Reserved; + const State Rl = State::Released; + const State C = State::Committed; + VMATree::RegionData rd_Test_cs1(si_1, mtTest); + VMATree::RegionData rd_None_cs1(si_1, mtNone); + VMATree::RegionData rd_Test_cs2(si_2, mtTest); + VMATree::RegionData rd_None_cs2(si_2, mtNone); + VMATree::RegionData rd_None_cs3(si_3, mtNone); + + { + // row 12: .........A..................B.....U + // 1 2 3 4 5 + // 012345678901234567890123456789012345678901234567890 + // ..............................rrrrrrrrrr........... + Tree tree; + ExpectedTree<2> pre = {{ 30, 40 }, + {mtNone, mtTest, mtNone}, + {Rl , Rs , Rl }, + {-1 , si_1 , -1 }, + {-1 , -1 , -1 } + }; + create_tree(tree, pre, __LINE__); + VMATree::SummaryDiff diff = tree.commit_mapping(5, 20, rd_Test_cs2, false); + // 1 2 3 4 5 + // 012345678901234567890123456789012345678901234567890 + // .....CCCCCCCCCCCCCCCCCCCC.....rrrrrrrrrr........... + EXPECT_EQ(diff.tag[NMTUtil::tag_to_index(mtTest)].commit, 20); + EXPECT_EQ(diff.tag[NMTUtil::tag_to_index(mtTest)].reserve, 20); + ExpectedTree<4> et = {{ 5, 25, 30, 40 }, + {mtNone, mtTest, mtNone, mtTest, mtNone}, + {Rl , C , Rl , Rs , Rl }, + {-1 , si_2 , -1 , si_1 , -1 }, + {-1 , si_2 , -1 , -1 , -1 } + }; + check_tree(tree, et, __LINE__); + } + { + // row 13: .........A...YW.............B....U + // 1 2 3 4 5 + // 012345678901234567890123456789012345678901234567890 + // ..........rrrrrrrrrrrrrrrrrrrr..................... + Tree tree; + ExpectedTree<2> pre = {{ 10, 30 }, + {mtNone, mtTest, mtNone}, + {Rl , Rs , Rl }, + {-1 , si_1 , -1 }, + {-1 , -1 , -1 } + }; + create_tree(tree, pre, __LINE__); + VMATree::SummaryDiff diff = tree.commit_mapping(5, 20, rd_Test_cs2, false); + // 1 2 3 4 5 + // 012345678901234567890123456789012345678901234567890 + // .....CCCCCCCCCCCCCCCCCCCCrrrrr..................... + EXPECT_EQ(diff.tag[NMTUtil::tag_to_index(mtTest)].commit, 20); + EXPECT_EQ(diff.tag[NMTUtil::tag_to_index(mtTest)].reserve, 30 - 25); + ExpectedTree<4> et = {{ 5, 10, 25, 30 }, + {mtNone, mtTest, mtTest, mtTest, mtNone}, + {Rl , C , C , Rs , Rl }, + {-1 , si_2 , si_1 , si_1 , -1 }, + {-1 , si_2 , si_2 , -1 , -1 } + }; + check_tree(tree, et, __LINE__); + } + { + // row 14: .........A...Y.......................W....B....U + // 1 2 3 4 5 + // 012345678901234567890123456789012345678901234567890 + // ..........rrrrrrrrrr..........rrrrrrrrrr........... + Tree tree; + ExpectedTree<7> pre = {{ 10, 12, 14, 16, 20, 30, 40 }, + {mtNone, mtTest, mtTest, mtTest, mtTest, mtNone, mtTest, mtNone}, + {Rl , Rs , Rs , Rs , Rs , Rl , Rs , Rl }, + {-1 , si_1 , si_2 , si_1 , si_2 , -1 , si_1 , -1 }, + {-1 , -1 , -1 , -1 , -1 , -1 , -1 , -1 } + }; + create_tree(tree, pre, __LINE__); + VMATree::SummaryDiff diff = tree.commit_mapping(5, 20, rd_Test_cs2, false); + // 1 2 3 4 5 + // 012345678901234567890123456789012345678901234567890 + // .....CCCCCCCCCCCCCCCCCCCC.....rrrrrrrrrr........... + EXPECT_EQ(diff.tag[NMTUtil::tag_to_index(mtTest)].commit, 20); + EXPECT_EQ(diff.tag[NMTUtil::tag_to_index(mtTest)].reserve, (10 - 5) + ( 25 - 20)); + ExpectedTree<8> et = {{ 5, 10, 12, 14, 16, 25, 30, 40 }, + {mtNone, mtTest, mtTest, mtTest, mtTest, mtTest, mtNone, mtTest, mtNone}, + {Rl , C , C , C , C , C , Rl , Rs , Rl }, + {-1 , si_2 , si_1 , si_2 , si_1 , si_2 , -1 , si_1 , -1 }, + {-1 , si_2 , si_2 , si_2 , si_2 , si_2 , -1 , -1 , -1 } + }; + check_tree(tree, et, __LINE__); + } + { + // row 15: .........A...Y.......................WB....U + // 1 2 3 4 5 + // 012345678901234567890123456789012345678901234567890 + // ..........rrrrrrrrrr..........rrrrrrrrrr........... + Tree tree; + ExpectedTree<7> pre = {{ 10, 12, 14, 16, 20, 30, 40 }, + {mtNone, mtTest, mtTest, mtTest, mtTest, mtNone, mtTest, mtNone}, + {Rl , Rs , Rs , Rs , Rs , Rl , Rs , Rl }, + {-1 , si_1 , si_2 , si_1 , si_2 , -1 , si_1 , -1 }, + {-1 , -1 , -1 , -1 , -1 , -1 , -1 , -1 } + }; + create_tree(tree, pre, __LINE__); + VMATree::SummaryDiff diff = tree.commit_mapping(5, 15, rd_Test_cs2, false); + // 1 2 3 4 5 + // 012345678901234567890123456789012345678901234567890 + // .....CCCCCCCCCCCCCCC..........rrrrrrrrrr........... + EXPECT_EQ(diff.tag[NMTUtil::tag_to_index(mtTest)].commit, 15); + EXPECT_EQ(diff.tag[NMTUtil::tag_to_index(mtTest)].reserve, 10 - 5); + ExpectedTree<8> et = {{ 5, 10, 12, 14, 16, 20, 30, 40 }, + {mtNone, mtTest, mtTest, mtTest, mtTest, mtTest, mtNone, mtTest, mtNone}, + {Rl , C , C , C , C , C , Rl , Rs , Rl }, + {-1 , si_2 , si_1 , si_2 , si_1 , si_2 , -1 , si_1 , -1 }, + {-1 , si_2 , si_2 , si_2 , si_2 , si_2 , -1 , -1 , -1 } + }; + check_tree(tree, et, __LINE__); + } + +} + +TEST_VM_F(NMTVMATreeTest, OverlapTableRows16to19) { + using SIndex = NativeCallStackStorage::StackIndex; + using State = VMATree::StateType; + SIndex si_1 = si[0]; + SIndex si_2 = si[1]; + SIndex si_3 = si[2]; + + const State Rs = State::Reserved; + const State Rl = State::Released; + const State C = State::Committed; + VMATree::RegionData rd_Test_cs1(si_1, mtTest); + VMATree::RegionData rd_None_cs1(si_1, mtNone); + VMATree::RegionData rd_Test_cs2(si_2, mtTest); + VMATree::RegionData rd_None_cs2(si_2, mtNone); + VMATree::RegionData rd_None_cs3(si_3, mtNone); + { + // row 16: .....X...A..................B....U + // 1 2 3 4 5 + // 012345678901234567890123456789012345678901234567890 + // rrrrrrrrrr....................rrrrrrrrrr........... + Tree tree; + ExpectedTree<4> pre = {{ 0, 10, 30, 40 }, + {mtNone, mtTest, mtNone, mtTest, mtNone}, + {Rl , Rs , Rl , Rs , Rl }, + {-1 , si_1 , -1 , si_1 , -1 }, + {-1 , -1 , -1 , -1 , -1 } + }; + create_tree(tree, pre, __LINE__); + VMATree::SummaryDiff diff = tree.commit_mapping(15, 10, rd_Test_cs2, false); + // 1 2 3 4 5 + // 012345678901234567890123456789012345678901234567890 + // rrrrrrrrrr.....CCCCCCCCCC.....rrrrrrrrrr........... + EXPECT_EQ(diff.tag[NMTUtil::tag_to_index(mtTest)].commit, 10); + EXPECT_EQ(diff.tag[NMTUtil::tag_to_index(mtTest)].reserve, 10); + ExpectedTree<6> et = {{ 0, 10, 15, 25, 30, 40 }, + {mtNone, mtTest, mtNone, mtTest, mtNone, mtTest, mtNone}, + {Rl , Rs , Rl , C , Rl , Rs , Rl }, + {-1 , si_1 , -1 , si_2 , -1 , si_1 , -1 }, + {-1 , -1 , -1 , si_2 , -1 , -1 , -1 } + }; + check_tree(tree, et, __LINE__); + } + { + // row 17: .....X...A...YW.............B....U + // 1 2 3 4 5 + // 012345678901234567890123456789012345678901234567890 + // rrrrrrrrrr..........rrrrrrrrrr..................... + Tree tree; + ExpectedTree<4> pre = {{ 0, 10, 20, 30 }, + {mtNone, mtTest, mtNone, mtTest, mtNone}, + {Rl , Rs , Rl , Rs , Rl }, + {-1 , si_1 , -1 , si_1 , -1 }, + {-1 , -1 , -1 , -1 , -1 } + }; + create_tree(tree, pre, __LINE__); + VMATree::SummaryDiff diff = tree.commit_mapping(15, 10, rd_Test_cs2, false); + // 1 2 3 4 5 + // 012345678901234567890123456789012345678901234567890 + // rrrrrrrrrr.....CCCCCCCCCCrrrrr..................... + EXPECT_EQ(diff.tag[NMTUtil::tag_to_index(mtTest)].commit, 10); + EXPECT_EQ(diff.tag[NMTUtil::tag_to_index(mtTest)].reserve, 20 - 15); + ExpectedTree<6> et = {{ 0, 10, 15, 20, 25, 30 }, + {mtNone, mtTest, mtNone, mtTest, mtTest, mtTest, mtNone}, + {Rl , Rs , Rl , C , C , Rs , Rl }, + {-1 , si_1 , -1 , si_2 , si_1 , si_1 , -1 }, + {-1 , -1 , -1 , si_2 , si_2 , -1 , -1 } + }; + check_tree(tree, et, __LINE__); + } + { + // row 18: ....X....A...Y.......................W....B....U + // 1 2 3 4 5 + // 012345678901234567890123456789012345678901234567890 + // rrrrr.....rrrrrrrrrr..........rrrrrrrrrr........... + Tree tree; + ExpectedTree<9> pre = {{ 0, 5, 10, 12, 14, 16, 20, 30, 40 }, + {mtNone, mtTest, mtNone, mtTest, mtTest, mtTest, mtTest, mtNone, mtTest, mtNone}, + {Rl , Rs , Rl , Rs , Rs , Rs , Rs , Rl , Rs , Rl }, + {-1 , si_1 , -1 , si_2 , si_1 , si_2 , si_1 , -1 , si_1 , -1 }, + {-1 , -1 , -1 , -1 , -1 , -1 , -1 , -1 , -1 , -1 } + }; + create_tree(tree, pre, __LINE__); + VMATree::SummaryDiff diff = tree.commit_mapping(7, 20, rd_Test_cs2, false); + // 1 2 3 4 5 + // 012345678901234567890123456789012345678901234567890 + // rrrrr..CCCCCCCCCCCCCCCCCCCC...rrrrrrrrrr........... + EXPECT_EQ(diff.tag[NMTUtil::tag_to_index(mtTest)].commit, 20); + EXPECT_EQ(diff.tag[NMTUtil::tag_to_index(mtTest)].reserve, (10 - 7) + (27 - 20)); + ExpectedTree<10> et = {{ 0, 5, 7, 12, 14, 16, 20, 27, 30, 40 }, + {mtNone, mtTest, mtNone, mtTest, mtTest, mtTest, mtTest, mtTest, mtNone, mtTest, mtNone}, + {Rl , Rs , Rl , C , C , C , C , C , Rl , Rs , Rl }, + {-1 , si_1 , -1 , si_2 , si_1 , si_2 , si_1 , si_2 , -1 , si_1 , -1 }, + {-1 , -1 , -1 , si_2 , si_2 , si_2 , si_2 , si_2 , -1 , -1 , -1 } + }; + check_tree(tree, et, __LINE__); + } + { + // row 19: .....X...A...Y.......................WB....U + // 1 2 3 4 5 + // 012345678901234567890123456789012345678901234567890 + // rrrrr.....rrrrrrrrrr..........rrrrrrrrrr........... + Tree tree; + ExpectedTree<9> pre = {{ 0, 5, 10, 12, 14, 16, 20, 30, 40 }, + {mtNone, mtTest, mtNone, mtTest, mtTest, mtTest, mtTest, mtNone, mtTest, mtNone}, + {Rl , Rs , Rl , Rs , Rs , Rs , Rs , Rl , Rs , Rl }, + {-1 , si_1 , -1 , si_1 , si_2 , si_1 , si_2 , -1 , si_1 , -1 }, + {-1 , -1 , -1 , -1 , -1 , -1 , -1 , -1 , -1 , -1 } + }; + create_tree(tree, pre, __LINE__); + VMATree::SummaryDiff diff = tree.commit_mapping(7, 13, rd_Test_cs2, false); + // 1 2 3 4 5 + // 012345678901234567890123456789012345678901234567890 + // rrrrr..CCCCCCCCCCCCC..........rrrrrrrrrr........... + EXPECT_EQ(diff.tag[NMTUtil::tag_to_index(mtTest)].commit, 13); + EXPECT_EQ(diff.tag[NMTUtil::tag_to_index(mtTest)].reserve, 10 - 7); + ExpectedTree<10> et = {{ 0, 5, 7, 10, 12, 14, 16, 20, 30, 40 }, + {mtNone, mtTest, mtNone, mtTest, mtTest, mtTest, mtTest, mtTest, mtNone, mtTest, mtNone}, + {Rl , Rs , Rl , C , C , C , C , C , Rl , Rs , Rl }, + {-1 , si_1 , -1 , si_2 , si_1 , si_2 , si_1 , si_2 , -1 , si_1 , -1 }, + {-1 , -1 , -1 , si_2 , si_2 , si_2 , si_2 , si_2 , -1 , -1 , -1 } + }; + check_tree(tree, et, __LINE__); + } + +} + +TEST_VM_F(NMTVMATreeTest, OverlapTableRows20to23) { + using SIndex = NativeCallStackStorage::StackIndex; + using State = VMATree::StateType; + SIndex si_1 = si[0]; + SIndex si_2 = si[1]; + SIndex si_3 = si[2]; + + const State Rs = State::Reserved; + const State Rl = State::Released; + const State C = State::Committed; + VMATree::RegionData rd_Test_cs1(si_1, mtTest); + VMATree::RegionData rd_None_cs1(si_1, mtNone); + VMATree::RegionData rd_Test_cs2(si_2, mtTest); + VMATree::RegionData rd_None_cs2(si_2, mtNone); + VMATree::RegionData rd_None_cs3(si_3, mtNone); + + { + // row 20: ........XA..................B....U + // 1 2 3 4 5 + // 012345678901234567890123456789012345678901234567890 + // rrrrrrrrrr....................rrrrrrrrrr........... + Tree tree; + ExpectedTree<4> pre = {{ 0, 10, 30, 40 }, + {mtNone, mtTest, mtNone, mtTest, mtNone}, + {Rl , Rs , Rl , Rs , Rl }, + {-1 , si_1 , -1 , si_1 , -1 }, + {-1 , -1 , -1 , -1 , -1 } + }; + create_tree(tree, pre, __LINE__); + VMATree::SummaryDiff diff = tree.commit_mapping(10, 15, rd_Test_cs2, false); + // 1 2 3 4 5 + // 012345678901234567890123456789012345678901234567890 + // rrrrrrrrrrCCCCCCCCCCCCCCC.....rrrrrrrrrr........... + EXPECT_EQ(diff.tag[NMTUtil::tag_to_index(mtTest)].commit, 15); + EXPECT_EQ(diff.tag[NMTUtil::tag_to_index(mtTest)].reserve, 15); + ExpectedTree<5> et = {{ 0, 10, 25, 30, 40 }, + {mtNone, mtTest, mtTest, mtNone, mtTest, mtNone}, + {Rl , Rs , C , Rl , Rs , Rl }, + {-1 , si_1 , si_2 , -1 , si_1 , -1 }, + {-1 , -1 , si_2 , -1 , -1 , -1 } + }; + check_tree(tree, et, __LINE__); + } + { + // row 21: ........XA...YW.............B....U + // 1 2 3 4 5 + // 012345678901234567890123456789012345678901234567890 + // rrrrrrrrrr..........rrrrrrrrrr..................... + Tree tree; + ExpectedTree<4> pre = {{ 0, 10, 20, 30 }, + {mtNone, mtTest, mtNone, mtTest, mtNone}, + {Rl , Rs , Rl , Rs , Rl }, + {-1 , si_1 , -1 , si_1 , -1 }, + {-1 , -1 , -1 , -1 , -1 } + }; + create_tree(tree, pre, __LINE__); + VMATree::SummaryDiff diff = tree.commit_mapping(10, 15, rd_Test_cs2, false); + // 1 2 3 4 5 + // 012345678901234567890123456789012345678901234567890 + // rrrrrrrrrrCCCCCCCCCCCCCCCrrrrr..................... + EXPECT_EQ(diff.tag[NMTUtil::tag_to_index(mtTest)].commit, 15); + EXPECT_EQ(diff.tag[NMTUtil::tag_to_index(mtTest)].reserve, 20 - 10); + ExpectedTree<5> et = {{ 0, 10, 20, 25, 30 }, + {mtNone, mtTest, mtTest, mtTest, mtTest, mtNone}, + {Rl , Rs , C , C , Rs , Rl }, + {-1 , si_1 , si_2 , si_1 , si_1 , -1 }, + {-1 , -1 , si_2 , si_2 , -1 , -1 } + }; + check_tree(tree, et, __LINE__); + } + { + // row 22: ........XA...Y.......................W....B....U + // 1 2 3 4 5 + // 012345678901234567890123456789012345678901234567890 + // rrrrr.....rrrrrrrrrr..........rrrrrrrrrr........... + Tree tree; + ExpectedTree<9> pre = {{ 0, 5, 10, 12, 14, 16, 20, 30, 40 }, + {mtNone, mtTest, mtNone, mtTest, mtTest, mtTest, mtTest, mtNone, mtTest, mtNone}, + {Rl , Rs , Rl , Rs , Rs , Rs , Rs , Rl , Rs , Rl }, + {-1 , si_1 , -1 , si_2 , si_1 , si_2 , si_1 , -1 , si_1 , -1 }, + {-1 , -1 , -1 , -1 , -1 , -1 , -1 , -1 , -1 , -1 } + }; + create_tree(tree, pre, __LINE__); + VMATree::SummaryDiff diff = tree.commit_mapping(5, 20, rd_Test_cs2, false); + // 1 2 3 4 5 + // 012345678901234567890123456789012345678901234567890 + // rrrrrCCCCCCCCCCCCCCCCCCCC.....rrrrrrrrrr........... + EXPECT_EQ(diff.tag[NMTUtil::tag_to_index(mtTest)].commit, 20); + EXPECT_EQ(diff.tag[NMTUtil::tag_to_index(mtTest)].reserve, (10 - 5) + (25 - 20)); + ExpectedTree<9> et = {{ 0, 5, 12, 14, 16, 20, 25, 30, 40 }, + {mtNone, mtTest, mtTest, mtTest, mtTest, mtTest, mtTest, mtNone, mtTest, mtNone}, + {Rl , Rs , C , C , C , C , C , Rl , Rs , Rl }, + {-1 , si_1 , si_2 , si_1 , si_2 , si_1 , si_2 , -1 , si_1 , -1 }, + {-1 , -1 , si_2 , si_2 , si_2 , si_2 , si_2 , -1 , -1 , -1 } + }; + check_tree(tree, et, __LINE__); + } + { + // row 23: ........XA...Y.......................WB....U + // 1 2 3 4 5 + // 012345678901234567890123456789012345678901234567890 + // rrrrr.....rrrrrrrrrr..........rrrrrrrrrr........... + Tree tree; + ExpectedTree<9> pre = {{ 0, 5, 10, 12, 14, 16, 20, 30, 40 }, + {mtNone, mtTest, mtNone, mtTest, mtTest, mtTest, mtTest, mtNone, mtTest, mtNone}, + {Rl , Rs , Rl , Rs , Rs , Rs , Rs , Rl , Rs , Rl }, + {-1 , si_1 , -1 , si_1 , si_2 , si_1 , si_2 , -1 , si_1 , -1 }, + {-1 , -1 , -1 , -1 , -1 , -1 , -1 , -1 , -1 , -1 } + }; + create_tree(tree, pre, __LINE__); + VMATree::SummaryDiff diff = tree.commit_mapping(5, 15, rd_Test_cs2, false); + // 1 2 3 4 5 + // 012345678901234567890123456789012345678901234567890 + // rrrrrCCCCCCCCCCCCCCC..........rrrrrrrrrr........... + EXPECT_EQ(diff.tag[NMTUtil::tag_to_index(mtTest)].commit, 15); + EXPECT_EQ(diff.tag[NMTUtil::tag_to_index(mtTest)].reserve, 10 - 5); + ExpectedTree<9> et = {{ 0, 5, 10, 12, 14, 16, 20, 30, 40 }, + {mtNone, mtTest, mtTest, mtTest, mtTest, mtTest, mtTest, mtNone, mtTest, mtNone}, + {Rl , Rs , C , C , C , C , C , Rl , Rs , Rl }, + {-1 , si_1 , si_2 , si_1 , si_2 , si_1 , si_2 , -1 , si_1 , -1 }, + {-1 , -1 , si_2 , si_2 , si_2 , si_2 , si_2 , -1 , -1 , -1 } + }; + check_tree(tree, et, __LINE__); + } + +} + +TEST_VM_F(NMTVMATreeTest, UpdateRegionTest) { + using State = VMATree::StateType; + using SIndex = VMATree::SIndex; + SIndex ES = NativeCallStackStorage::invalid; + SIndex s0 = si[0]; + SIndex s1 = si[1]; + SIndex s2 = si[2]; + + const State Rs = State::Reserved; + const State Rl = State::Released; + const State C = State::Committed; + const int a = 100; + const MemTag ReqTag = mtTest; + const VMATree::RequestInfo ReleaseRequest{0, a, Rl, mtNone, ES, false}; + const VMATree::RequestInfo ReserveRequest{0, a, Rs, ReqTag, s2, false}; + const VMATree::RequestInfo CommitRequest{0, a, C, ReqTag, s2, false}; + const VMATree::RequestInfo UncommitRequest{0, a, Rs, mtNone, ES, true}; + const VMATree::RequestInfo CopyTagCommitRequest{0, a, C, ReqTag, s2, true}; + // existing state request expected state expected diff + // st tag stacks st tag stacks reserve commit + // -- ------ ------ ---------------------- -- ------ ------ ------- ------- + UpdateCallInfo call_info[]={{{Rl, mtNone, ES, ES}, ReleaseRequest, {Rl, mtNone, ES, ES}, {0, 0}, {0, 0}}, + {{Rl, mtNone, ES, ES}, ReserveRequest, {Rs, ReqTag, s2, ES}, {0, a}, {0, 0}}, + {{Rl, mtNone, ES, ES}, CommitRequest, { C, ReqTag, s2, s2}, {0, a}, {0, a}}, + {{Rl, mtNone, ES, ES}, CopyTagCommitRequest, { C, mtNone, s2, s2}, {0, a}, {0, a}}, + {{Rl, mtNone, ES, ES}, UncommitRequest, {Rl, mtNone, ES, ES}, {0, 0}, {0, 0}}, + {{Rs, mtGC, s0, ES}, ReleaseRequest, {Rl, mtNone, ES, ES}, {-a, 0}, {0, 0}}, + {{Rs, mtGC, s0, ES}, ReserveRequest, {Rs, ReqTag, s2, ES}, {-a, a}, {0, 0}}, // diff tag + {{Rs, mtTest, s0, ES}, ReserveRequest, {Rs, ReqTag, s2, ES}, {0, 0}, {0, 0}}, // same tag + {{Rs, mtGC, s0, ES}, CommitRequest, { C, ReqTag, s0, s2}, {-a, a}, {0, a}}, + {{Rs, mtGC, s0, ES}, CopyTagCommitRequest, { C, mtGC, s0, s2}, {0, 0}, {0, a}}, + {{Rs, mtGC, s0, ES}, UncommitRequest, {Rs, mtGC, s0, ES}, {0, 0}, {0, 0}}, + {{ C, mtGC, s0, s1}, ReleaseRequest, {Rl, mtNone, ES, ES}, {-a, 0}, {-a, 0}}, + {{ C, mtGC, s0, s1}, ReserveRequest, {Rs, ReqTag, s2, ES}, {-a, a}, {-a, 0}}, // diff tag + {{ C, mtTest, s0, s1}, ReserveRequest, {Rs, ReqTag, s2, ES}, {0, 0}, {-a, 0}}, // same tag + {{ C, mtGC, s0, s1}, CommitRequest, { C, ReqTag, s0, s2}, {-a, a}, {-a, a}}, + {{ C, mtGC, s0, s1}, CopyTagCommitRequest, { C, mtGC, s0, s2}, {0, 0}, {-a, a}}, + {{ C, mtGC, s0, s1}, UncommitRequest, {Rs, mtGC, s0, ES}, {0, 0}, {-a, 0}} + }; + for (auto ci : call_info) { + call_update_region(ci); + } } \ No newline at end of file diff --git a/test/hotspot/gtest/oops/test_jmethodIDTable.cpp b/test/hotspot/gtest/oops/test_jmethodIDTable.cpp new file mode 100644 index 00000000000..12ee939a9b1 --- /dev/null +++ b/test/hotspot/gtest/oops/test_jmethodIDTable.cpp @@ -0,0 +1,59 @@ +/* + * Copyright (c) 2025, 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. + * + * 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. + */ + +#include "classfile/vmClasses.hpp" +#include "memory/resourceArea.hpp" +#include "oops/instanceKlass.hpp" +#include "oops/jmethodIDTable.hpp" +#include "oops/method.hpp" +#include "unittest.hpp" +#include "utilities/growableArray.hpp" + +// Tests for creating and deleting jmethodIDs +TEST_VM(jmethodIDTable, test_jmethod_ids) { + InstanceKlass* klass = vmClasses::ClassLoader_klass(); + Array* methods = klass->methods(); + int length = methods->length(); + // How many entries are in the jmethodID table? + uint64_t initial_entries = JmethodIDTable::get_entry_count(); + ResourceMark rm; + GrowableArray ints(10); + for (int i = 0; i < length; i++) { + Method* m = methods->at(i); + jmethodID mid = m->jmethod_id(); + ints.push((uint64_t)mid); + } + uint64_t entries_now = JmethodIDTable::get_entry_count(); + ASSERT_TRUE(entries_now == initial_entries + length) << "should have more entries " << entries_now << " " << initial_entries + length; + + // Test that new entries aren't created, and the values are the same. + for (int i = 0; i < length; i++) { + Method* m = methods->at(i); + jmethodID mid = m->jmethod_id(); + ASSERT_TRUE(ints.at(i) == (uint64_t)mid) << "should be the same"; + } + // should have the same number of entries + entries_now = JmethodIDTable::get_entry_count(); + ASSERT_TRUE(entries_now == initial_entries + length) << "should have more entries " << entries_now << " " << initial_entries + length; +} + diff --git a/test/hotspot/gtest/opto/test_rangeinference.cpp b/test/hotspot/gtest/opto/test_rangeinference.cpp new file mode 100644 index 00000000000..1a62941a486 --- /dev/null +++ b/test/hotspot/gtest/opto/test_rangeinference.cpp @@ -0,0 +1,214 @@ +/* + * Copyright (c) 2025, 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. + * + * 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. + * + */ + +#include "opto/rangeinference.hpp" +#include "opto/type.hpp" +#include "runtime/os.hpp" +#include "utilities/intn_t.hpp" +#include "unittest.hpp" + +template +static U uniform_random(); + +template <> +juint uniform_random() { + return os::random(); +} + +template <> +julong uniform_random() { + return (julong(os::random()) << 32) | julong(juint(os::random())); +} + +static void test_canonicalize_constraints_trivial() { + ASSERT_FALSE(TypeInt::NON_ZERO->contains(0)); + ASSERT_TRUE(TypeInt::NON_ZERO->contains(1)); + ASSERT_TRUE(TypeInt::NON_ZERO->contains(-1)); + ASSERT_TRUE(TypeInt::CC_NE->contains(-1)); + ASSERT_TRUE(TypeInt::CC_NE->contains(1)); + ASSERT_FALSE(TypeInt::CC_NE->contains(0)); + ASSERT_FALSE(TypeInt::CC_NE->contains(-2)); + ASSERT_FALSE(TypeInt::CC_NE->contains(2)); + ASSERT_FALSE(TypeLong::NON_ZERO->contains(jlong(0))); + ASSERT_TRUE(TypeLong::NON_ZERO->contains(jlong(1))); + ASSERT_TRUE(TypeLong::NON_ZERO->contains(jlong(-1))); +} + +template +static void test_canonicalize_constraints_exhaustive() { + { + TypeIntPrototype t{{S(0), S(0)}, {U(0), U(0)}, {U(-1), U(0)}}; + auto new_t = t.canonicalize_constraints(); + ASSERT_TRUE(new_t._present); + DEBUG_ONLY(ASSERT_TRUE(t.contains(S(0)))); + DEBUG_ONLY(ASSERT_FALSE(t.contains(S(1)))); + } + { + TypeIntPrototype t{{S(0), S(0)}, {U(1), U(1)}, {U(-1), U(0)}}; + auto new_t = t.canonicalize_constraints(); + ASSERT_FALSE(new_t._present); + DEBUG_ONLY(ASSERT_FALSE(t.contains(S(0)))); + DEBUG_ONLY(ASSERT_FALSE(t.contains(S(1)))); + } + { + TypeIntPrototype t{{S(S::min), S(S::max)}, {U(U::min), U(U::max)}, {U(0), U(0)}}; + auto new_t = t.canonicalize_constraints(); + ASSERT_TRUE(new_t._present); + for (int v = S::min; v <= S::max; v++) { + DEBUG_ONLY(ASSERT_TRUE(t.contains(S(v)))); + } + } + for (int lo = S::min; lo <= S::max; lo++) { + for (int hi = lo; hi <= S::max; hi++) { + for (int ulo = U::min; ulo <= U::max; ulo++) { + for (int uhi = ulo; uhi <= U::max; uhi++) { + for (int zeros = U::min; zeros <= U::max; zeros++) { + for (int ones = U::min; ones <= U::max; ones++) { + TypeIntPrototype t{{S(lo), S(hi)}, {U(ulo), U(uhi)}, {U(zeros), U(ones)}}; + auto new_t = t.canonicalize_constraints(); + if (new_t._present) { + DEBUG_ONLY(new_t._data.verify_constraints()); + } + for (int v = S::min; v <= S::max; v++) { + if (!new_t._present) { + DEBUG_ONLY(ASSERT_FALSE(t.contains(S(v)))); + } else { + DEBUG_ONLY(ASSERT_EQ(t.contains(S(v)), new_t._data.contains(S(v)))); + } + } + } + } + } + } + } + } +} + +template +static void test_canonicalize_constraints_simple() { + constexpr int parameters = 1000; + for (int i = 0; i < parameters; i++) { + S a = uniform_random(); + S b = uniform_random(); + + { + S lo = MIN2(a, b); + S hi = MAX2(a, b); + TypeIntPrototype t{{lo, hi}, {std::numeric_limits::min(), std::numeric_limits::max()}, + {0, 0}}; + auto new_t = t.canonicalize_constraints(); + ASSERT_TRUE(new_t._present); + DEBUG_ONLY(new_t._data.verify_constraints()); + ASSERT_EQ(lo, new_t._data._srange._lo); + ASSERT_EQ(hi, new_t._data._srange._hi); + if (U(lo) <= U(hi)) { + ASSERT_EQ(U(lo), new_t._data._urange._lo); + ASSERT_EQ(U(hi), new_t._data._urange._hi); + } else { + ASSERT_EQ(std::numeric_limits::min(), new_t._data._urange._lo); + ASSERT_EQ(std::numeric_limits::max(), new_t._data._urange._hi); + } + } + + { + U ulo = MIN2(a, b); + U uhi = MAX2(a, b); + TypeIntPrototype t{{std::numeric_limits::min(), std::numeric_limits::max()}, + {ulo, uhi}, {0, 0}}; + auto new_t = t.canonicalize_constraints(); + ASSERT_TRUE(new_t._present); + DEBUG_ONLY(new_t._data.verify_constraints()); + ASSERT_EQ(ulo, new_t._data._urange._lo); + ASSERT_EQ(uhi, new_t._data._urange._hi); + if (S(ulo) <= S(uhi)) { + ASSERT_EQ(S(ulo), new_t._data._srange._lo); + ASSERT_EQ(S(uhi), new_t._data._srange._hi); + } else { + ASSERT_EQ(std::numeric_limits::min(), new_t._data._srange._lo); + ASSERT_EQ(std::numeric_limits::max(), new_t._data._srange._hi); + } + } + + { + U intersection = a & b; + U zeros = a ^ intersection; + U ones = b ^ intersection; + TypeIntPrototype t{{std::numeric_limits::min(), std::numeric_limits::max()}, + {std::numeric_limits::min(), std::numeric_limits::max()}, {zeros, ones}}; + auto new_t = t.canonicalize_constraints(); + ASSERT_TRUE(new_t._present); + DEBUG_ONLY(new_t._data.verify_constraints()); + ASSERT_EQ(zeros, new_t._data._bits._zeros); + ASSERT_EQ(ones, new_t._data._bits._ones); + ASSERT_EQ(ones, new_t._data._urange._lo); + ASSERT_EQ(~zeros, new_t._data._urange._hi); + } + } +} + +template +static void test_canonicalize_constraints_random() { + constexpr int samples = 1000; + constexpr int parameters = 1000; + for (int i = 0; i < parameters; i++) { + S s1 = uniform_random(); + S s2 = uniform_random(); + S lo = MIN2(s1, s2); + S hi = MAX2(s1, s2); + U u1 = uniform_random(); + U u2 = uniform_random(); + U ulo = MIN2(u1, u2); + U uhi = MAX2(u1, u2); + U b1 = uniform_random(); + U b2 = uniform_random(); + U intersection = b1 & b2; + U zeros = b1 ^ intersection; + U ones = b2 ^ intersection; + TypeIntPrototype t{{lo, hi}, {ulo, uhi}, {zeros, ones}}; + auto new_t = t.canonicalize_constraints(); + if (new_t._present) { + DEBUG_ONLY(new_t._data.verify_constraints()); + } + for (int j = 0; j < samples; j++) { + S v = uniform_random(); + if (!new_t._present) { + DEBUG_ONLY(ASSERT_FALSE(t.contains(v))); + } else { + DEBUG_ONLY(ASSERT_EQ(t.contains(v), new_t._data.contains(v))); + } + } + } +} + +TEST_VM(opto, canonicalize_constraints) { + test_canonicalize_constraints_trivial(); + test_canonicalize_constraints_exhaustive, uintn_t<1>>(); + test_canonicalize_constraints_exhaustive, uintn_t<2>>(); + test_canonicalize_constraints_exhaustive, uintn_t<3>>(); + test_canonicalize_constraints_exhaustive, uintn_t<4>>(); + test_canonicalize_constraints_simple(); + test_canonicalize_constraints_simple(); + test_canonicalize_constraints_random(); + test_canonicalize_constraints_random(); +} diff --git a/test/hotspot/gtest/runtime/test_arguments.cpp b/test/hotspot/gtest/runtime/test_arguments.cpp index 132157c98b6..074636fea0d 100644 --- a/test/hotspot/gtest/runtime/test_arguments.cpp +++ b/test/hotspot/gtest/runtime/test_arguments.cpp @@ -22,7 +22,6 @@ */ #include "jvm.h" -#include "unittest.hpp" #include "runtime/arguments.hpp" #include "runtime/flags/jvmFlag.hpp" #include "utilities/align.hpp" @@ -30,6 +29,8 @@ #include +#include "unittest.hpp" + class ArgumentsTest : public ::testing::Test { public: static intx parse_xss_inner_annotated(const char* str, jint expected_err, const char* file, int line_number); @@ -57,7 +58,7 @@ class ArgumentsTest : public ::testing::Test { TEST_F(ArgumentsTest, atojulong) { char ullong_max[32]; - int ret = jio_snprintf(ullong_max, sizeof(ullong_max), JULONG_FORMAT, ULLONG_MAX); + int ret = jio_snprintf(ullong_max, sizeof(ullong_max), "%llu", ULLONG_MAX); ASSERT_NE(-1, ret); julong value; diff --git a/test/hotspot/gtest/runtime/test_committed_virtualmemory.cpp b/test/hotspot/gtest/runtime/test_committed_virtualmemory.cpp index f07b45bc32d..cd47e3a4e17 100644 --- a/test/hotspot/gtest/runtime/test_committed_virtualmemory.cpp +++ b/test/hotspot/gtest/runtime/test_committed_virtualmemory.cpp @@ -22,7 +22,8 @@ */ #include "nmt/memTracker.hpp" -#include "nmt/virtualMemoryTracker.hpp" +#include "nmt/regionsTree.hpp" +#include "nmt/regionsTree.inline.hpp" #include "runtime/thread.hpp" #include "utilities/globalDefinitions.hpp" #include "utilities/macros.hpp" @@ -37,18 +38,15 @@ class CommittedVirtualMemoryTest { MemTracker::record_thread_stack(stack_end, stack_size); - VirtualMemoryTracker::add_reserved_region(stack_end, stack_size, CALLER_PC, mtThreadStack); + VirtualMemoryTracker::Instance::add_reserved_region(stack_end, stack_size, CALLER_PC, mtThreadStack); // snapshot current stack usage - VirtualMemoryTracker::snapshot_thread_stacks(); + VirtualMemoryTracker::Instance::snapshot_thread_stacks(); - ReservedMemoryRegion* rmr = VirtualMemoryTracker::_reserved_regions->find(ReservedMemoryRegion(stack_end, stack_size)); - ASSERT_TRUE(rmr != nullptr); + ReservedMemoryRegion rmr_found = VirtualMemoryTracker::Instance::tree()->find_reserved_region(stack_end); + ASSERT_TRUE(rmr_found.is_valid()); + ASSERT_EQ(rmr_found.base(), stack_end); - ASSERT_EQ(rmr->base(), stack_end); - ASSERT_EQ(rmr->size(), stack_size); - - CommittedRegionIterator iter = rmr->iterate_committed_regions(); int i = 0; address i_addr = (address)&i; bool found_i_addr = false; @@ -56,24 +54,23 @@ class CommittedVirtualMemoryTest { // stack grows downward address stack_top = stack_end + stack_size; bool found_stack_top = false; - - for (const CommittedMemoryRegion* region = iter.next(); region != nullptr; region = iter.next()) { - if (region->base() + region->size() == stack_top) { - ASSERT_TRUE(region->size() <= stack_size); + VirtualMemoryTracker::Instance::tree()->visit_committed_regions(rmr_found, [&](const CommittedMemoryRegion& cmr) { + if (cmr.base() + cmr.size() == stack_top) { + EXPECT_TRUE(cmr.size() <= stack_size); found_stack_top = true; } - - if(i_addr < stack_top && i_addr >= region->base()) { + if(i_addr < stack_top && i_addr >= cmr.base()) { found_i_addr = true; } - i++; - } + return true; + }); + // stack and guard pages may be contiguous as one region ASSERT_TRUE(i >= 1); - ASSERT_TRUE(found_stack_top); ASSERT_TRUE(found_i_addr); + ASSERT_TRUE(found_stack_top); } static void check_covered_pages(address addr, size_t size, address base, size_t touch_pages, int* page_num) { @@ -100,28 +97,24 @@ class CommittedVirtualMemoryTest { *touch_addr = 'a'; } - address frame = (address)0x1235; - NativeCallStack stack(&frame, 1); - VirtualMemoryTracker::add_reserved_region((address)base, size, stack, mtThreadStack); - // trigger the test - VirtualMemoryTracker::snapshot_thread_stacks(); + VirtualMemoryTracker::Instance::snapshot_thread_stacks(); + + ReservedMemoryRegion rmr_found = VirtualMemoryTracker::Instance::tree()->find_reserved_region((address)base); + ASSERT_TRUE(rmr_found.is_valid()); + ASSERT_EQ(rmr_found.base(), (address)base); - ReservedMemoryRegion* rmr = VirtualMemoryTracker::_reserved_regions->find(ReservedMemoryRegion((address)base, size)); - ASSERT_TRUE(rmr != nullptr); bool precise_tracking_supported = false; - CommittedRegionIterator iter = rmr->iterate_committed_regions(); - for (const CommittedMemoryRegion* region = iter.next(); region != nullptr; region = iter.next()) { - if (region->size() == size) { - // platforms that do not support precise tracking. - ASSERT_TRUE(iter.next() == nullptr); - break; + VirtualMemoryTracker::Instance::tree()->visit_committed_regions(rmr_found, [&](const CommittedMemoryRegion& cmr){ + if (cmr.size() == size) { + return false; } else { precise_tracking_supported = true; - check_covered_pages(region->base(), region->size(), (address)base, touch_pages, page_num); + check_covered_pages(cmr.base(), cmr.size(), (address)base, touch_pages, page_num); } - } + return true; + }); if (precise_tracking_supported) { // All touched pages should be committed @@ -132,10 +125,9 @@ class CommittedVirtualMemoryTest { // Cleanup os::disclaim_memory(base, size); - VirtualMemoryTracker::remove_released_region((address)base, size); - - rmr = VirtualMemoryTracker::_reserved_regions->find(ReservedMemoryRegion((address)base, size)); - ASSERT_TRUE(rmr == nullptr); + VirtualMemoryTracker::Instance::remove_released_region((address)base, size); + rmr_found = VirtualMemoryTracker::Instance::tree()->find_reserved_region((address)base); + ASSERT_TRUE(!rmr_found.is_valid()); } static void test_committed_region() { @@ -233,8 +225,7 @@ class CommittedVirtualMemoryTest { } }; -TEST_VM(CommittedVirtualMemoryTracker, test_committed_virtualmemory_region) { - +TEST_VM(NMTCommittedVirtualMemoryTracker, test_committed_virtualmemory_region) { // This tests the VM-global NMT facility. The test must *not* modify global state, // since that interferes with other tests! // The gtestLauncher are called with and without -XX:NativeMemoryTracking during jtreg-controlled @@ -251,7 +242,7 @@ TEST_VM(CommittedVirtualMemoryTracker, test_committed_virtualmemory_region) { } #if !defined(_WINDOWS) && !defined(_AIX) -TEST_VM(CommittedVirtualMemory, test_committed_in_range){ +TEST_VM(NMTCommittedVirtualMemory, test_committed_in_range){ CommittedVirtualMemoryTest::test_committed_in_range(1024, 1024); CommittedVirtualMemoryTest::test_committed_in_range(2, 1); } diff --git a/test/hotspot/gtest/runtime/test_virtualMemoryTracker.cpp b/test/hotspot/gtest/runtime/test_virtualMemoryTracker.cpp index 2985dd7438d..a6fee2c8fe1 100644 --- a/test/hotspot/gtest/runtime/test_virtualMemoryTracker.cpp +++ b/test/hotspot/gtest/runtime/test_virtualMemoryTracker.cpp @@ -32,6 +32,7 @@ #include "memory/memoryReserver.hpp" #include "nmt/memTracker.hpp" +#include "nmt/regionsTree.inline.hpp" #include "nmt/virtualMemoryTracker.hpp" #include "utilities/globalDefinitions.hpp" #include "utilities/macros.hpp" @@ -56,16 +57,15 @@ namespace { check_inner((rmr), nullptr, 0, __FILE__, __LINE__); \ } while (false) -static void diagnostic_print(ReservedMemoryRegion* rmr) { - CommittedRegionIterator iter = rmr->iterate_committed_regions(); - LOG("In reserved region " PTR_FORMAT ", size 0x%zx:", p2i(rmr->base()), rmr->size()); - for (const CommittedMemoryRegion* region = iter.next(); region != nullptr; region = iter.next()) { - LOG(" committed region: " PTR_FORMAT ", size 0x%zx", p2i(region->base()), region->size()); - } +static void diagnostic_print(const ReservedMemoryRegion& rmr) { + LOG("In reserved region " PTR_FORMAT ", size %X:", p2i(rmr.base()), rmr.size()); + VirtualMemoryTracker::Instance::tree()->visit_committed_regions(rmr, [&](CommittedMemoryRegion& region) { + LOG(" committed region: " PTR_FORMAT ", size %X", p2i(region.base()), region.size()); + return true; + }); } -static void check_inner(ReservedMemoryRegion* rmr, R* regions, size_t regions_size, const char* file, int line) { - CommittedRegionIterator iter = rmr->iterate_committed_regions(); +static void check_inner(const ReservedMemoryRegion& rmr, R* regions, size_t regions_size, const char* file, int line) { size_t i = 0; size_t size = 0; @@ -74,16 +74,17 @@ static void check_inner(ReservedMemoryRegion* rmr, R* regions, size_t regions_si #define WHERE " from " << file << ":" << line - for (const CommittedMemoryRegion* region = iter.next(); region != nullptr; region = iter.next()) { + VirtualMemoryTracker::Instance::tree()->visit_committed_regions(rmr, [&](CommittedMemoryRegion& region) { EXPECT_LT(i, regions_size) << WHERE; - EXPECT_EQ(region->base(), regions[i]._addr) << WHERE; - EXPECT_EQ(region->size(), regions[i]._size) << WHERE; - size += region->size(); + EXPECT_EQ(region.base(), regions[i]._addr) << WHERE; + EXPECT_EQ(region.size(), regions[i]._size) << WHERE; + size += region.size(); i++; - } + return true; + }); EXPECT_EQ(i, regions_size) << WHERE; - EXPECT_EQ(size, rmr->committed_size()) << WHERE; + EXPECT_EQ(size, rmr.committed_size()) << WHERE; } class VirtualMemoryTrackerTest { @@ -103,10 +104,11 @@ class VirtualMemoryTrackerTest { NativeCallStack stack2(&frame2, 1); // Fetch the added RMR for the space - ReservedMemoryRegion* rmr = VirtualMemoryTracker::_reserved_regions->find(ReservedMemoryRegion(addr, size)); + ReservedMemoryRegion rmr = VirtualMemoryTracker::Instance::tree()->find_reserved_region(addr); + RegionsTree* rtree = VirtualMemoryTracker::Instance::tree(); - ASSERT_EQ(rmr->size(), size); - ASSERT_EQ(rmr->base(), addr); + ASSERT_EQ(rmr.size(), size); + ASSERT_EQ(rmr.base(), addr); // Commit Size Granularity const size_t cs = 0x1000; @@ -114,45 +116,45 @@ class VirtualMemoryTrackerTest { // Commit adjacent regions with same stack { // Commit one region - rmr->add_committed_region(addr + cs, cs, stack); + rtree->commit_region(addr + cs, cs, stack); R r[] = { {addr + cs, cs} }; check(rmr, r); } { // Commit adjacent - lower address - rmr->add_committed_region(addr, cs, stack); + rtree->commit_region(addr, cs, stack); R r[] = { {addr, 2 * cs} }; check(rmr, r); } { // Commit adjacent - higher address - rmr->add_committed_region(addr + 2 * cs, cs, stack); + rtree->commit_region(addr + 2 * cs, cs, stack); R r[] = { {addr, 3 * cs} }; check(rmr, r); } // Cleanup - rmr->remove_uncommitted_region(addr, 3 * cs); - ASSERT_EQ(rmr->committed_size(), 0u); + rtree->uncommit_region(addr, 3 * cs); + ASSERT_EQ(rmr.committed_size(), 0u); // Commit adjacent regions with different stacks { // Commit one region - rmr->add_committed_region(addr + cs, cs, stack); + rtree->commit_region(addr + cs, cs, stack); R r[] = { {addr + cs, cs} }; check(rmr, r); } { // Commit adjacent - lower address - rmr->add_committed_region(addr, cs, stack2); + rtree->commit_region(addr, cs, stack2); R r[] = { {addr, cs}, {addr + cs, cs} }; check(rmr, r); } { // Commit adjacent - higher address - rmr->add_committed_region(addr + 2 * cs, cs, stack2); + rtree->commit_region(addr + 2 * cs, cs, stack2); R r[] = { {addr, cs}, {addr + cs, cs}, {addr + 2 * cs, cs} }; @@ -160,11 +162,13 @@ class VirtualMemoryTrackerTest { } // Cleanup - rmr->remove_uncommitted_region(addr, 3 * cs); - ASSERT_EQ(rmr->committed_size(), 0u); + rtree->uncommit_region(addr, 3 * cs); + ASSERT_EQ(rmr.committed_size(), 0u); } static void test_add_committed_region_adjacent_overlapping() { + RegionsTree* rtree = VirtualMemoryTracker::Instance::tree(); + rtree->tree().remove_all(); size_t size = 0x01000000; ReservedSpace rs = MemoryReserver::reserve(size, mtTest); @@ -178,14 +182,11 @@ class VirtualMemoryTrackerTest { NativeCallStack stack(&frame1, 1); NativeCallStack stack2(&frame2, 1); - // Add the reserved memory - VirtualMemoryTracker::add_reserved_region(addr, size, stack, mtTest); - // Fetch the added RMR for the space - ReservedMemoryRegion* rmr = VirtualMemoryTracker::_reserved_regions->find(ReservedMemoryRegion(addr, size)); + ReservedMemoryRegion rmr = rtree->find_reserved_region(addr); - ASSERT_EQ(rmr->size(), size); - ASSERT_EQ(rmr->base(), addr); + ASSERT_EQ(rmr.size(), size); + ASSERT_EQ(rmr.base(), addr); // Commit Size Granularity const size_t cs = 0x1000; @@ -193,46 +194,46 @@ class VirtualMemoryTrackerTest { // Commit adjacent and overlapping regions with same stack { // Commit two non-adjacent regions - rmr->add_committed_region(addr, 2 * cs, stack); - rmr->add_committed_region(addr + 3 * cs, 2 * cs, stack); + rtree->commit_region(addr, 2 * cs, stack); + rtree->commit_region(addr + 3 * cs, 2 * cs, stack); R r[] = { {addr, 2 * cs}, {addr + 3 * cs, 2 * cs} }; check(rmr, r); } { // Commit adjacent and overlapping - rmr->add_committed_region(addr + 2 * cs, 2 * cs, stack); + rtree->commit_region(addr + 2 * cs, 2 * cs, stack); R r[] = { {addr, 5 * cs} }; check(rmr, r); } // revert to two non-adjacent regions - rmr->remove_uncommitted_region(addr + 2 * cs, cs); - ASSERT_EQ(rmr->committed_size(), 4 * cs); + rtree->uncommit_region(addr + 2 * cs, cs); + ASSERT_EQ(rmr.committed_size(), 4 * cs); { // Commit overlapping and adjacent - rmr->add_committed_region(addr + cs, 2 * cs, stack); + rtree->commit_region(addr + cs, 2 * cs, stack); R r[] = { {addr, 5 * cs} }; check(rmr, r); } // Cleanup - rmr->remove_uncommitted_region(addr, 5 * cs); - ASSERT_EQ(rmr->committed_size(), 0u); + rtree->uncommit_region(addr, 5 * cs); + ASSERT_EQ(rmr.committed_size(), 0u); // Commit adjacent and overlapping regions with different stacks { // Commit two non-adjacent regions - rmr->add_committed_region(addr, 2 * cs, stack); - rmr->add_committed_region(addr + 3 * cs, 2 * cs, stack); + rtree->commit_region(addr, 2 * cs, stack); + rtree->commit_region(addr + 3 * cs, 2 * cs, stack); R r[] = { {addr, 2 * cs}, {addr + 3 * cs, 2 * cs} }; check(rmr, r); } { // Commit adjacent and overlapping - rmr->add_committed_region(addr + 2 * cs, 2 * cs, stack2); + rtree->commit_region(addr + 2 * cs, 2 * cs, stack2); R r[] = { {addr, 2 * cs}, {addr + 2 * cs, 2 * cs}, {addr + 4 * cs, cs} }; @@ -240,12 +241,12 @@ class VirtualMemoryTrackerTest { } // revert to two non-adjacent regions - rmr->add_committed_region(addr, 5 * cs, stack); - rmr->remove_uncommitted_region(addr + 2 * cs, cs); - ASSERT_EQ(rmr->committed_size(), 4 * cs); + rtree->commit_region(addr, 5 * cs, stack); + rtree->uncommit_region(addr + 2 * cs, cs); + ASSERT_EQ(rmr.committed_size(), 4 * cs); { // Commit overlapping and adjacent - rmr->add_committed_region(addr + cs, 2 * cs, stack2); + rtree->commit_region(addr + cs, 2 * cs, stack2); R r[] = { {addr, cs}, {addr + cs, 2 * cs}, {addr + 3 * cs, 2 * cs} }; @@ -254,6 +255,8 @@ class VirtualMemoryTrackerTest { } static void test_add_committed_region_overlapping() { + RegionsTree* rtree = VirtualMemoryTracker::Instance::tree(); + rtree->tree().remove_all(); size_t size = 0x01000000; @@ -269,10 +272,11 @@ class VirtualMemoryTrackerTest { NativeCallStack stack2(&frame2, 1); // Fetch the added RMR for the space - ReservedMemoryRegion* rmr = VirtualMemoryTracker::_reserved_regions->find(ReservedMemoryRegion(addr, size)); + ReservedMemoryRegion rmr = rtree->find_reserved_region(addr); - ASSERT_EQ(rmr->size(), size); - ASSERT_EQ(rmr->base(), addr); + + ASSERT_EQ(rmr.size(), size); + ASSERT_EQ(rmr.base(), addr); // Commit Size Granularity const size_t cs = 0x1000; @@ -280,77 +284,77 @@ class VirtualMemoryTrackerTest { // With same stack { // Commit one region - rmr->add_committed_region(addr, cs, stack); + rtree->commit_region(addr, cs, stack); R r[] = { {addr, cs} }; check(rmr, r); } { // Commit the same region - rmr->add_committed_region(addr, cs, stack); + rtree->commit_region(addr, cs, stack); R r[] = { {addr, cs} }; check(rmr, r); } { // Commit a succeeding region - rmr->add_committed_region(addr + cs, cs, stack); + rtree->commit_region(addr + cs, cs, stack); R r[] = { {addr, 2 * cs} }; check(rmr, r); } { // Commit over two regions - rmr->add_committed_region(addr, 2 * cs, stack); + rtree->commit_region(addr, 2 * cs, stack); R r[] = { {addr, 2 * cs} }; check(rmr, r); } {// Commit first part of a region - rmr->add_committed_region(addr, cs, stack); + rtree->commit_region(addr, cs, stack); R r[] = { {addr, 2 * cs} }; check(rmr, r); } { // Commit second part of a region - rmr->add_committed_region(addr + cs, cs, stack); + rtree->commit_region(addr + cs, cs, stack); R r[] = { {addr, 2 * cs} }; check(rmr, r); } { // Commit a third part - rmr->add_committed_region(addr + 2 * cs, cs, stack); + rtree->commit_region(addr + 2 * cs, cs, stack); R r[] = { {addr, 3 * cs} }; check(rmr, r); } { // Commit in the middle of a region - rmr->add_committed_region(addr + 1 * cs, cs, stack); + rtree->commit_region(addr + 1 * cs, cs, stack); R r[] = { {addr, 3 * cs} }; check(rmr, r); } // Cleanup - rmr->remove_uncommitted_region(addr, 3 * cs); - ASSERT_EQ(rmr->committed_size(), 0u); + rtree->uncommit_region(addr, 3 * cs); + ASSERT_EQ(rmr.committed_size(), 0u); // With preceding region - rmr->add_committed_region(addr, cs, stack); - rmr->add_committed_region(addr + 2 * cs, 3 * cs, stack); + rtree->commit_region(addr, cs, stack); + rtree->commit_region(addr + 2 * cs, 3 * cs, stack); - rmr->add_committed_region(addr + 2 * cs, cs, stack); + rtree->commit_region(addr + 2 * cs, cs, stack); { R r[] = { {addr, cs}, {addr + 2 * cs, 3 * cs} }; check(rmr, r); } - rmr->add_committed_region(addr + 3 * cs, cs, stack); + rtree->commit_region(addr + 3 * cs, cs, stack); { R r[] = { {addr, cs}, {addr + 2 * cs, 3 * cs} }; check(rmr, r); } - rmr->add_committed_region(addr + 4 * cs, cs, stack); + rtree->commit_region(addr + 4 * cs, cs, stack); { R r[] = { {addr, cs}, {addr + 2 * cs, 3 * cs} }; @@ -358,57 +362,57 @@ class VirtualMemoryTrackerTest { } // Cleanup - rmr->remove_uncommitted_region(addr, 5 * cs); - ASSERT_EQ(rmr->committed_size(), 0u); + rtree->uncommit_region(addr, 5 * cs); + ASSERT_EQ(rmr.committed_size(), 0u); // With different stacks { // Commit one region - rmr->add_committed_region(addr, cs, stack); + rtree->commit_region(addr, cs, stack); R r[] = { {addr, cs} }; check(rmr, r); } { // Commit the same region - rmr->add_committed_region(addr, cs, stack2); + rtree->commit_region(addr, cs, stack2); R r[] = { {addr, cs} }; check(rmr, r); } { // Commit a succeeding region - rmr->add_committed_region(addr + cs, cs, stack); + rtree->commit_region(addr + cs, cs, stack); R r[] = { {addr, cs}, {addr + cs, cs} }; check(rmr, r); } { // Commit over two regions - rmr->add_committed_region(addr, 2 * cs, stack); + rtree->commit_region(addr, 2 * cs, stack); R r[] = { {addr, 2 * cs} }; check(rmr, r); } {// Commit first part of a region - rmr->add_committed_region(addr, cs, stack2); + rtree->commit_region(addr, cs, stack2); R r[] = { {addr, cs}, {addr + cs, cs} }; check(rmr, r); } { // Commit second part of a region - rmr->add_committed_region(addr + cs, cs, stack2); + rtree->commit_region(addr + cs, cs, stack2); R r[] = { {addr, 2 * cs} }; check(rmr, r); } { // Commit a third part - rmr->add_committed_region(addr + 2 * cs, cs, stack2); + rtree->commit_region(addr + 2 * cs, cs, stack2); R r[] = { {addr, 3 * cs} }; check(rmr, r); } { // Commit in the middle of a region - rmr->add_committed_region(addr + 1 * cs, cs, stack); + rtree->commit_region(addr + 1 * cs, cs, stack); R r[] = { {addr, cs}, {addr + cs, cs}, {addr + 2 * cs, cs} }; @@ -428,6 +432,8 @@ class VirtualMemoryTrackerTest { } static void test_remove_uncommitted_region() { + RegionsTree* rtree = VirtualMemoryTracker::Instance::tree(); + rtree->tree().remove_all(); size_t size = 0x01000000; ReservedSpace rs = MemoryReserver::reserve(size, mtTest); @@ -442,114 +448,114 @@ class VirtualMemoryTrackerTest { NativeCallStack stack2(&frame2, 1); // Fetch the added RMR for the space - ReservedMemoryRegion* rmr = VirtualMemoryTracker::_reserved_regions->find(ReservedMemoryRegion(addr, size)); + ReservedMemoryRegion rmr = rtree->find_reserved_region(addr); - ASSERT_EQ(rmr->size(), size); - ASSERT_EQ(rmr->base(), addr); + ASSERT_EQ(rmr.size(), size); + ASSERT_EQ(rmr.base(), addr); // Commit Size Granularity const size_t cs = 0x1000; { // Commit regions - rmr->add_committed_region(addr, 3 * cs, stack); + rtree->commit_region(addr, 3 * cs, stack); R r[] = { {addr, 3 * cs} }; check(rmr, r); // Remove only existing - rmr->remove_uncommitted_region(addr, 3 * cs); + rtree->uncommit_region(addr, 3 * cs); check_empty(rmr); } { - rmr->add_committed_region(addr + 0 * cs, cs, stack); - rmr->add_committed_region(addr + 2 * cs, cs, stack); - rmr->add_committed_region(addr + 4 * cs, cs, stack); + rtree->commit_region(addr + 0 * cs, cs, stack); + rtree->commit_region(addr + 2 * cs, cs, stack); + rtree->commit_region(addr + 4 * cs, cs, stack); { // Remove first - rmr->remove_uncommitted_region(addr, cs); + rtree->uncommit_region(addr, cs); R r[] = { {addr + 2 * cs, cs}, {addr + 4 * cs, cs} }; check(rmr, r); } // add back - rmr->add_committed_region(addr, cs, stack); + rtree->commit_region(addr, cs, stack); { // Remove middle - rmr->remove_uncommitted_region(addr + 2 * cs, cs); + rtree->uncommit_region(addr + 2 * cs, cs); R r[] = { {addr + 0 * cs, cs}, {addr + 4 * cs, cs} }; check(rmr, r); } // add back - rmr->add_committed_region(addr + 2 * cs, cs, stack); + rtree->commit_region(addr + 2 * cs, cs, stack); { // Remove end - rmr->remove_uncommitted_region(addr + 4 * cs, cs); + rtree->uncommit_region(addr + 4 * cs, cs); R r[] = { {addr + 0 * cs, cs}, {addr + 2 * cs, cs} }; check(rmr, r); } - rmr->remove_uncommitted_region(addr, 5 * cs); + rtree->uncommit_region(addr, 5 * cs); check_empty(rmr); } { // Remove larger region - rmr->add_committed_region(addr + 1 * cs, cs, stack); - rmr->remove_uncommitted_region(addr, 3 * cs); + rtree->commit_region(addr + 1 * cs, cs, stack); + rtree->uncommit_region(addr, 3 * cs); check_empty(rmr); } { // Remove smaller region - in the middle - rmr->add_committed_region(addr, 3 * cs, stack); - rmr->remove_uncommitted_region(addr + 1 * cs, cs); + rtree->commit_region(addr, 3 * cs, stack); + rtree->uncommit_region(addr + 1 * cs, cs); R r[] = { { addr + 0 * cs, cs}, { addr + 2 * cs, cs} }; check(rmr, r); - rmr->remove_uncommitted_region(addr, 3 * cs); + rtree->uncommit_region(addr, 3 * cs); check_empty(rmr); } { // Remove smaller region - at the beginning - rmr->add_committed_region(addr, 3 * cs, stack); - rmr->remove_uncommitted_region(addr + 0 * cs, cs); + rtree->commit_region(addr, 3 * cs, stack); + rtree->uncommit_region(addr + 0 * cs, cs); R r[] = { { addr + 1 * cs, 2 * cs} }; check(rmr, r); - rmr->remove_uncommitted_region(addr, 3 * cs); + rtree->uncommit_region(addr, 3 * cs); check_empty(rmr); } { // Remove smaller region - at the end - rmr->add_committed_region(addr, 3 * cs, stack); - rmr->remove_uncommitted_region(addr + 2 * cs, cs); + rtree->commit_region(addr, 3 * cs, stack); + rtree->uncommit_region(addr + 2 * cs, cs); R r[] = { { addr, 2 * cs} }; check(rmr, r); - rmr->remove_uncommitted_region(addr, 3 * cs); + rtree->uncommit_region(addr, 3 * cs); check_empty(rmr); } { // Remove smaller, overlapping region - at the beginning - rmr->add_committed_region(addr + 1 * cs, 4 * cs, stack); - rmr->remove_uncommitted_region(addr, 2 * cs); + rtree->commit_region(addr + 1 * cs, 4 * cs, stack); + rtree->uncommit_region(addr, 2 * cs); R r[] = { { addr + 2 * cs, 3 * cs} }; check(rmr, r); - rmr->remove_uncommitted_region(addr + 1 * cs, 4 * cs); + rtree->uncommit_region(addr + 1 * cs, 4 * cs); check_empty(rmr); } { // Remove smaller, overlapping region - at the end - rmr->add_committed_region(addr, 3 * cs, stack); - rmr->remove_uncommitted_region(addr + 2 * cs, 2 * cs); + rtree->commit_region(addr, 3 * cs, stack); + rtree->uncommit_region(addr + 2 * cs, 2 * cs); R r[] = { { addr, 2 * cs} }; check(rmr, r); - rmr->remove_uncommitted_region(addr, 3 * cs); + rtree->uncommit_region(addr, 3 * cs); check_empty(rmr); } } @@ -569,4 +575,4 @@ TEST_VM(NMT_VirtualMemoryTracker, remove_uncommitted_region) { } else { tty->print_cr("skipped."); } -} +} \ No newline at end of file diff --git a/test/hotspot/gtest/utilities/test_deferredStatic.cpp b/test/hotspot/gtest/utilities/test_deferredStatic.cpp new file mode 100644 index 00000000000..b41b1e4ee60 --- /dev/null +++ b/test/hotspot/gtest/utilities/test_deferredStatic.cpp @@ -0,0 +1,120 @@ +/* + * Copyright (c) 2025, 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. + * + * 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. + * + */ + +#include "utilities/debug.hpp" +#include "utilities/deferredStatic.hpp" +#include "utilities/globalDefinitions.hpp" + +#include + +#include "unittest.hpp" + +class DeferredStaticTestClass { +public: + static unsigned _initialized_count; + int _value; + bool _allow_destruction; + + DeferredStaticTestClass() : DeferredStaticTestClass(0) {} + + DeferredStaticTestClass(int value, bool allow_destruction = false) + : _value(value), _allow_destruction(allow_destruction) + { + ++_initialized_count; + } + + ~DeferredStaticTestClass() { + if (!_allow_destruction) { + ShouldNotReachHere(); + } + } +}; + +unsigned DeferredStaticTestClass::_initialized_count = 0; + +using TC = DeferredStaticTestClass; + +DeferredStatic default_constructed; + +static_assert(std::is_same::value, + "expected"); + +TEST(DeferredStaticTest, default_constructed) { + unsigned init_count = TC::_initialized_count; + default_constructed.initialize(); + ASSERT_EQ(init_count + 1, TC::_initialized_count); + ASSERT_EQ(0, default_constructed->_value); + ASSERT_EQ(0, default_constructed.get()->_value); + ASSERT_EQ(0, (*default_constructed)._value); + + int new_value = 5; + *default_constructed.get() = TC(new_value, true /* allow_destruction */); + ASSERT_EQ(init_count + 2, TC::_initialized_count); + ASSERT_EQ(new_value, default_constructed->_value); + ASSERT_EQ(new_value, default_constructed.get()->_value); + ASSERT_EQ(new_value, (*default_constructed)._value); + + int new_value2 = 8; + default_constructed->_value = new_value2; + ASSERT_EQ(init_count + 2, TC::_initialized_count); + ASSERT_EQ(new_value2, default_constructed->_value); + ASSERT_EQ(new_value2, default_constructed.get()->_value); + ASSERT_EQ(new_value2, (*default_constructed)._value); +} + +DeferredStatic arg_constructed; + +TEST(DeferredStaticTest, arg_constructed) { + unsigned init_count = TC::_initialized_count; + int arg = 10; + arg_constructed.initialize(arg); + ASSERT_EQ(init_count + 1, TC::_initialized_count); + ASSERT_EQ(arg, arg_constructed->_value); + ASSERT_EQ(arg, arg_constructed.get()->_value); + ASSERT_EQ(arg, (*arg_constructed)._value); +} + +DeferredStatic const_test_object; + +static_assert(std::is_same::value, + "expected"); + +static_assert(std::is_same_value)>::value, + "expected"); + +TEST(DeferredStaticTest, const_test_object) { + unsigned init_count = TC::_initialized_count; + int arg = 20; + const_test_object.initialize(arg); + ASSERT_EQ(init_count + 1, TC::_initialized_count); + ASSERT_EQ(arg, const_test_object->_value); + ASSERT_EQ(arg, const_test_object.get()->_value); + ASSERT_EQ(arg, (*const_test_object)._value); + + // Doesn't compile, as expected. + // *const_test_object.get() = TC(0, true /* allow_destruction */); + + // Doesn't compile, as expected. + // const_test_object->_value = 0; +} diff --git a/test/hotspot/gtest/utilities/test_intn_t.cpp b/test/hotspot/gtest/utilities/test_intn_t.cpp new file mode 100644 index 00000000000..89958e0757e --- /dev/null +++ b/test/hotspot/gtest/utilities/test_intn_t.cpp @@ -0,0 +1,70 @@ +/* + * Copyright (c) 2025, 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. + * + * 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. + * + */ + +#include "utilities/intn_t.hpp" +#include "unittest.hpp" + +// Sanity tests for off-by-one errors +static_assert(intn_t<1>::min == -1 && intn_t<1>::max == 0, ""); +static_assert(intn_t<2>::min == -2 && intn_t<2>::max == 1, ""); +static_assert(intn_t<3>::min == -4 && intn_t<3>::max == 3, ""); +static_assert(uintn_t<1>::max == 1, ""); +static_assert(uintn_t<2>::max == 3, ""); +static_assert(uintn_t<3>::max == 7, ""); + +template +static void test_intn_t() { + static_assert(std::numeric_limits>::min() <= intn_t(-1) && + intn_t(-1) < intn_t(0) && + intn_t(0) <= std::numeric_limits>::max(), "basic sanity"); + constexpr int period = intn_t::max - intn_t::min + 1; + for (int i = std::numeric_limits::min(); i < std::numeric_limits::max(); i++) { + ASSERT_EQ(intn_t(i), intn_t(i + period)); + ASSERT_EQ(int(intn_t(i)), int(intn_t(i + period))); + } + for (int i = intn_t::min; i <= intn_t::max; i++) { + ASSERT_EQ(i, int(intn_t(i))); + if (i > intn_t::min) { + ASSERT_TRUE(intn_t(i - 1) < intn_t(i)); + } else { + ASSERT_TRUE(intn_t(i - 1) > intn_t(i)); + } + if (i < intn_t::max) { + ASSERT_TRUE(intn_t(i) < intn_t(i + 1)); + } else { + ASSERT_TRUE(intn_t(i) > intn_t(i + 1)); + } + } +} + +TEST(utilities, intn_t) { + test_intn_t<1>(); + test_intn_t<2>(); + test_intn_t<3>(); + test_intn_t<4>(); + test_intn_t<5>(); + test_intn_t<6>(); + test_intn_t<7>(); + test_intn_t<8>(); +} diff --git a/test/hotspot/gtest/utilities/test_packedTable.cpp b/test/hotspot/gtest/utilities/test_packedTable.cpp new file mode 100644 index 00000000000..2adf8a1f08d --- /dev/null +++ b/test/hotspot/gtest/utilities/test_packedTable.cpp @@ -0,0 +1,158 @@ +/* + * Copyright (c) 2025, 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. + * + * 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. + * + */ +#include "utilities/packedTable.hpp" +#include "unittest.hpp" + +class Supplier: public PackedTableBuilder::Supplier { + uint32_t* _keys; + uint32_t* _values; + size_t _num_keys; + +public: + Supplier(uint32_t* keys, uint32_t* values, size_t num_keys): + _keys(keys), _values(values), _num_keys(num_keys) {} + + bool next(uint32_t* key, uint32_t* value) override { + if (_num_keys == 0) { + return false; + } + *key = *_keys; + ++_keys; + if (_values != nullptr) { + *value = *_values; + ++_values; + } else { + *value = 0; + } + --_num_keys; + return true; + } +}; + +class Comparator: public PackedTableLookup::Comparator { + uint32_t _current; + +public: + int compare_to(uint32_t key) override { + return _current < key ? -1 : (_current > key ? 1 : 0); + } + + void reset(uint32_t key) DEBUG_ONLY(override) { + _current = key; + } +}; + +static void test(uint32_t max_key, uint32_t max_value, unsigned int length) { + if (length > max_key + 1) { + // can't generate more keys, as keys must be unique + return; + } + PackedTableBuilder builder(max_key, max_value); + size_t table_length = length * builder.element_bytes(); + u1* table = new u1[table_length]; + + uint32_t* keys = new uint32_t[length]; + uint32_t* values = max_value != 0 ? new uint32_t[length] : nullptr; + for (unsigned int i = 0; i < length; ++i) { + keys[i] = i; + if (values != nullptr) { + values[i] = i % max_value; + } + } + Supplier sup(keys, values, length); + builder.fill(table, table_length, sup); + + Comparator comparator; + PackedTableLookup lookup(max_key, max_value, table, table_length); +#ifdef ASSERT + lookup.validate_order(comparator); +#endif + + for (unsigned int i = 0; i < length; ++i) { + uint32_t key, value; + comparator.reset(keys[i]); + EXPECT_TRUE(lookup.search(comparator, &key, &value)); + EXPECT_EQ(key, keys[i]); + if (values != nullptr) { + EXPECT_EQ(value, values[i]); + } else { + EXPECT_EQ(value, 0U); + } + } + + delete[] keys; + delete[] values; +} + +static void test_with_bits(uint32_t max_key, uint32_t max_value) { + // Some small sizes + for (unsigned int i = 0; i <= 100; ++i) { + test(max_key, max_value, i); + } + test(max_key, max_value, 10000); +} + +TEST(PackedTableLookup, lookup) { + for (int key_bits = 1; key_bits <= 32; ++key_bits) { + for (int value_bits = 0; value_bits <= 32; ++value_bits) { + test_with_bits(static_cast((1ULL << key_bits) - 1), + static_cast((1ULL << value_bits) - 1)); + } + } +} + +TEST(PackedTableBase, element_bytes) { + { + PackedTableBuilder builder(1, 0); + EXPECT_EQ(builder.element_bytes(), 1U); + } + { + PackedTableBuilder builder(15, 15); + EXPECT_EQ(builder.element_bytes(), 1U); + } + { + PackedTableBuilder builder(15, 16); + EXPECT_EQ(builder.element_bytes(), 2U); + } + { + PackedTableBuilder builder(31, 7); + EXPECT_EQ(builder.element_bytes(), 1U); + } + { + PackedTableBuilder builder(32, 7); + EXPECT_EQ(builder.element_bytes(), 2U); + } + { + PackedTableBuilder builder(-1, 0); + EXPECT_EQ(builder.element_bytes(), 4U); + } + { + PackedTableBuilder builder(-1, 1); + EXPECT_EQ(builder.element_bytes(), 5U); + } + { + PackedTableBuilder builder(-1, -1); + EXPECT_EQ(builder.element_bytes(), 8U); + } +} diff --git a/test/hotspot/jtreg/ProblemList-StaticJdk.txt b/test/hotspot/jtreg/ProblemList-StaticJdk.txt index cb727e470f3..1681fb74634 100644 --- a/test/hotspot/jtreg/ProblemList-StaticJdk.txt +++ b/test/hotspot/jtreg/ProblemList-StaticJdk.txt @@ -37,7 +37,6 @@ serviceability/sa/ClhsdbPstack.java#core 8346719 generic-all gtest/GTestWrapper.java 8356201 generic-all gtest/LargePageGtests.java#use-large-pages 8356201 generic-all gtest/LargePageGtests.java#use-large-pages-1G 8356201 generic-all -gtest/LockStackGtests.java 8356201 generic-all gtest/MetaspaceGtests.java#no-ccs 8356201 generic-all gtest/NMTGtests.java#nmt-detail 8356201 generic-all gtest/NMTGtests.java#nmt-off 8356201 generic-all diff --git a/test/hotspot/jtreg/ProblemList-Xcomp.txt b/test/hotspot/jtreg/ProblemList-Xcomp.txt index 6df68c1ed62..b30ab329495 100644 --- a/test/hotspot/jtreg/ProblemList-Xcomp.txt +++ b/test/hotspot/jtreg/ProblemList-Xcomp.txt @@ -1,5 +1,5 @@ # -# Copyright (c) 2018, 2024, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2018, 2025, 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 @@ -35,8 +35,6 @@ vmTestbase/vm/mlvm/mixed/stress/regression/b6969574/INDIFY_Test.java 8265295 lin serviceability/AsyncGetCallTrace/MyPackage/ASGCTBaseTest.java 8303168 linux-all -serviceability/jvmti/vthread/SuspendWithInterruptLock/SuspendWithInterruptLock.java#default 8312064 generic-all - serviceability/sa/ClhsdbInspect.java 8283578 windows-x64 vmTestbase/vm/mlvm/indy/func/jvmti/mergeCP_indy2manyDiff_a/TestDescription.java 8308367 generic-all diff --git a/test/hotspot/jtreg/ProblemList.txt b/test/hotspot/jtreg/ProblemList.txt index f0e50e58b2b..aa262aaf575 100644 --- a/test/hotspot/jtreg/ProblemList.txt +++ b/test/hotspot/jtreg/ProblemList.txt @@ -66,6 +66,7 @@ compiler/jvmci/jdk.vm.ci.code.test/src/jdk/vm/ci/code/test/NativeCallTest.java 8 compiler/jvmci/jdk.vm.ci.code.test/src/jdk/vm/ci/code/test/SimpleDebugInfoTest.java 8331704 linux-riscv64 compiler/jvmci/jdk.vm.ci.code.test/src/jdk/vm/ci/code/test/SimpleCodeInstallationTest.java 8331704 linux-riscv64 compiler/jvmci/jdk.vm.ci.code.test/src/jdk/vm/ci/code/test/VirtualObjectDebugInfoTest.java 8331704 linux-riscv64 +compiler/jvmci/jdk.vm.ci.code.test/src/jdk/vm/ci/code/test/CodeInvalidationReasonTest.java 8360168 linux-riscv64 compiler/floatingpoint/TestSubnormalFloat.java 8317810 generic-i586 compiler/floatingpoint/TestSubnormalDouble.java 8317810 generic-i586 @@ -79,7 +80,7 @@ compiler/ciReplay/TestIncrementalInlining.java 8349191 generic-all compiler/c2/TestVerifyConstraintCasts.java 8355574 generic-all -compiler/startup/StartupOutput.java 8358129 windows-all +compiler/c2/aarch64/TestStaticCallStub.java 8359963 linux-aarch64,macosx-aarch64 ############################################################################# @@ -126,7 +127,6 @@ containers/docker/TestJcmdWithSideCar.java 8341518 linux-x64 serviceability/sa/sadebugd/DebugdConnectTest.java 8239062,8270326 macosx-x64,macosx-aarch64 serviceability/sa/TestRevPtrsForInvokeDynamic.java 8241235 generic-all -serviceability/jvmti/ModuleAwareAgents/ThreadStart/MAAThreadStart.java 8225354 windows-all serviceability/jvmti/vthread/GetThreadStateMountedTest/GetThreadStateMountedTest.java 8318090,8318729 generic-all serviceability/jvmti/vthread/GetSetLocalTest/GetSetLocalTest.java 8286836 generic-all serviceability/jvmti/vthread/CarrierThreadEventNotification/CarrierThreadEventNotification.java 8333681 generic-all @@ -168,7 +168,6 @@ vmTestbase/metaspace/gc/firstGC_50m/TestDescription.java 8208250 generic-all vmTestbase/metaspace/gc/firstGC_99m/TestDescription.java 8208250 generic-all vmTestbase/metaspace/gc/firstGC_default/TestDescription.java 8208250 generic-all -vmTestbase/nsk/jvmti/AttachOnDemand/attach045/TestDescription.java 8358094 generic-all vmTestbase/nsk/jvmti/scenarios/capability/CM03/cm03t001/TestDescription.java 8073470 linux-all vmTestbase/nsk/jvmti/InterruptThread/intrpthrd003/TestDescription.java 8288911 macosx-all diff --git a/test/hotspot/jtreg/TEST.ROOT b/test/hotspot/jtreg/TEST.ROOT index 8f4ef153907..9071dfa2fbf 100644 --- a/test/hotspot/jtreg/TEST.ROOT +++ b/test/hotspot/jtreg/TEST.ROOT @@ -91,6 +91,8 @@ requires.properties= \ vm.compiler1.enabled \ vm.compiler2.enabled \ vm.musl \ + vm.asan \ + vm.ubsan \ vm.flagless \ container.support \ systemd.support \ diff --git a/test/hotspot/jtreg/TEST.groups b/test/hotspot/jtreg/TEST.groups index 2fa0862a186..c6609e248d3 100644 --- a/test/hotspot/jtreg/TEST.groups +++ b/test/hotspot/jtreg/TEST.groups @@ -142,7 +142,6 @@ tier1_common = \ sources \ sanity/BasicVMTest.java \ gtest/GTestWrapper.java \ - gtest/LockStackGtests.java \ gtest/MetaspaceGtests.java \ gtest/LargePageGtests.java \ gtest/NMTGtests.java \ diff --git a/test/hotspot/jtreg/compiler/arguments/TestC1Globals.java b/test/hotspot/jtreg/compiler/arguments/TestC1Globals.java index 2781f4e6b67..ba3d8aef191 100644 --- a/test/hotspot/jtreg/compiler/arguments/TestC1Globals.java +++ b/test/hotspot/jtreg/compiler/arguments/TestC1Globals.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2023, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2023, 2025, 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 @@ -21,42 +21,6 @@ * questions. */ -/** - * @test - * @bug 8316653 - * @requires vm.debug - * @summary Test flag with max value. - * - * @run main/othervm -XX:NMethodSizeLimit=1M - * compiler.arguments.TestC1Globals - */ - -/** - * @test - * @bug 8318817 - * @requires vm.debug - * @requires os.family == "linux" - * @summary Test flag with max value combined with transparent huge pages on - * Linux. - * - * @run main/othervm -XX:NMethodSizeLimit=1M - * -XX:+UseTransparentHugePages - * compiler.arguments.TestC1Globals - */ - -/** - * @test - * @bug 8320682 - * @requires vm.debug - * @summary Test flag with max value and specific compilation. - * - * @run main/othervm -XX:NMethodSizeLimit=1M - * -XX:CompileOnly=java.util.HashMap::putMapEntries - * -Xcomp - * compiler.arguments.TestC1Globals - * - */ - /** * @test * @bug 8322781 diff --git a/test/hotspot/jtreg/compiler/arguments/TestFastAllocateSizeLimit.java b/test/hotspot/jtreg/compiler/arguments/TestFastAllocateSizeLimit.java new file mode 100644 index 00000000000..d9bbdf3186e --- /dev/null +++ b/test/hotspot/jtreg/compiler/arguments/TestFastAllocateSizeLimit.java @@ -0,0 +1,58 @@ +/* + * Copyright (c) 2025, 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. + * + * 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. + */ + + /* + * @test + * @library /test/lib / + * @bug 8356865 + * @key randomness + * @requires vm.flagless & vm.compiler2.enabled & vm.debug == true + * @summary Tests that using reasonable values for -XX:FastAllocateSizeLimit does not crash the VM. + * @run driver compiler.arguments.TestFastAllocateSizeLimit + */ + +package compiler.arguments; + +import java.io.IOException; +import java.util.Random; + +import jdk.test.lib.process.ProcessTools; +import jdk.test.lib.process.OutputAnalyzer; +import jdk.test.lib.Utils; + +public class TestFastAllocateSizeLimit { + private static final Random RANDOM = Utils.getRandomInstance(); + + public static void main(String[] args) throws IOException { + if (args.length == 0) { + // range defined in globals.hpp is [0, (1 << (BitsPerInt - LogBytesPerLong - 1)) - 1] + int sizeLimit = RANDOM.nextInt(1 << 28); + ProcessBuilder pb = ProcessTools.createLimitedTestJavaProcessBuilder("-XX:FastAllocateSizeLimit=" + + sizeLimit, "-Xcomp", "compiler.arguments.TestFastAllocateSizeLimit", "run"); + OutputAnalyzer output = new OutputAnalyzer(pb.start()); + output.shouldHaveExitValue(0); + } else { + System.out.println("Test passed."); + } + } +} diff --git a/test/hotspot/jtreg/compiler/arguments/TestOptoNodeListSize.java b/test/hotspot/jtreg/compiler/arguments/TestOptoNodeListSize.java new file mode 100644 index 00000000000..26d04141de2 --- /dev/null +++ b/test/hotspot/jtreg/compiler/arguments/TestOptoNodeListSize.java @@ -0,0 +1,57 @@ +/* + * Copyright (c) 2025, 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. + * + * 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. + */ + + /* + * @test + * @library /test/lib / + * @bug 8359200 + * @key randomness + * @requires vm.flagless & vm.compiler2.enabled & vm.debug == true + * @summary Test that -XX:OptoNodeListSize does not crash the VM. + * @run driver compiler.arguments.TestOptoNodeListSize + */ + +package compiler.arguments; + +import java.io.IOException; +import java.util.Random; + +import jdk.test.lib.process.ProcessTools; +import jdk.test.lib.process.OutputAnalyzer; +import jdk.test.lib.Utils; + +public class TestOptoNodeListSize { + private static final Random RANDOM = Utils.getRandomInstance(); + + public static void main(String[] args) throws IOException { + if (args.length == 0) { + int size = RANDOM.nextInt(1000) + 1; + ProcessBuilder pb = ProcessTools.createLimitedTestJavaProcessBuilder("-XX:OptoNodeListSize=" + size, + "-Xcomp", "-XX:-TieredCompilation", "compiler.arguments.TestOptoNodeListSize", "run"); + OutputAnalyzer output = new OutputAnalyzer(pb.start()); + output.shouldHaveExitValue(0); + } else { + System.out.println("Test passed."); + } + } +} diff --git a/test/hotspot/jtreg/compiler/c1/TestLinearScanOrderMain.java b/test/hotspot/jtreg/compiler/c1/TestLinearScanOrderMain.java index a154427530a..8a8f4ca8853 100644 --- a/test/hotspot/jtreg/compiler/c1/TestLinearScanOrderMain.java +++ b/test/hotspot/jtreg/compiler/c1/TestLinearScanOrderMain.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018, 2025, 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 @@ -26,7 +26,6 @@ * @bug 8207355 * @compile TestLinearScanOrder.jasm * @run main/othervm -Xcomp -XX:+TieredCompilation -XX:TieredStopAtLevel=1 - * -XX:+IgnoreUnrecognizedVMOptions -XX:NMethodSizeLimit=655360 * -XX:CompileCommand=compileonly,compiler.c1.TestLinearScanOrder::test * compiler.c1.TestLinearScanOrderMain */ diff --git a/test/hotspot/jtreg/compiler/c1/TestStaticInitializerSideEffect.java b/test/hotspot/jtreg/compiler/c1/TestStaticInitializerSideEffect.java new file mode 100644 index 00000000000..4dd051afa43 --- /dev/null +++ b/test/hotspot/jtreg/compiler/c1/TestStaticInitializerSideEffect.java @@ -0,0 +1,69 @@ +/* + * Copyright (c) 2025, 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. + * + * 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. + */ + +/* + * @test + * @summary Test that C1 respects that static initializers can have memory side effects. + * @bug 8357782 + * @requires vm.compiler1.enabled + * @comment Since static initializers only execute in the first execution of the class initializer, we need -Xcomp. + * @run main/othervm -Xcomp -XX:TieredStopAtLevel=1 -XX:CompileCommand=compileonly,compiler/c1/A$B.test compiler.c1.TestStaticInitializerSideEffect + */ + +package compiler.c1; + +public class TestStaticInitializerSideEffect { + public static void main(String[] args) { + A.B.test(); + } +} + +class A { + static class B { + static String field; + + static void test() { + // This unused variable triggers local value numbering to remove + // the field load in the constructor below if it is not killed + // before. + String tmp = field; + // The class initializer of C should kill the LVN effect of tmp due + // to the memory side effects of the static initializer. + new C(field); + } + } + + static class C { + // When executing the class initializer, this has a side effect. + static { + B.field = "Hello"; + } + + C(String val) { + // If C1 does not respect that side effect, we crash here. + if (val == null) { + throw new RuntimeException("Should not reach here"); + } + } + } +} diff --git a/test/hotspot/jtreg/compiler/c2/TestVerifyIterativeGVN.java b/test/hotspot/jtreg/compiler/c2/TestVerifyIterativeGVN.java index f3f589f8fb1..83f3540226f 100644 --- a/test/hotspot/jtreg/compiler/c2/TestVerifyIterativeGVN.java +++ b/test/hotspot/jtreg/compiler/c2/TestVerifyIterativeGVN.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2020, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2020, 2025, 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 @@ -25,9 +25,9 @@ * @test * @bug 8238756 * @requires vm.debug == true & vm.flavor == "server" - * @summary Run with -Xcomp to test -XX:VerifyIterativeGVN=11 in debug builds. + * @summary Run with -Xcomp to test -XX:VerifyIterativeGVN=1111 in debug builds. * - * @run main/othervm/timeout=300 -Xbatch -Xcomp -XX:VerifyIterativeGVN=11 compiler.c2.TestVerifyIterativeGVN + * @run main/othervm/timeout=300 -Xcomp -XX:VerifyIterativeGVN=1111 compiler.c2.TestVerifyIterativeGVN */ package compiler.c2; diff --git a/test/hotspot/jtreg/compiler/c2/aarch64/TestStaticCallStub.java b/test/hotspot/jtreg/compiler/c2/aarch64/TestStaticCallStub.java new file mode 100644 index 00000000000..0c6535ff856 --- /dev/null +++ b/test/hotspot/jtreg/compiler/c2/aarch64/TestStaticCallStub.java @@ -0,0 +1,144 @@ +/* + * Copyright (c) 2025, Arm Limited. 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. + * + * 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 compiler.c2.aarch64; + +import jdk.test.lib.process.OutputAnalyzer; +import jdk.test.lib.process.ProcessTools; +import java.util.regex.Matcher; +import java.util.regex.Pattern; +import java.util.*; + +/* + * @test + * @summary Calls to c2i interface stubs should be generated with near branches + * for segmented code cache up to 250MB + * @library /test/lib / + * + * @requires vm.flagless + * @requires os.arch=="aarch64" + * @requires vm.debug == false + * @requires vm.compiler2.enabled + * + * @run driver compiler.c2.aarch64.TestStaticCallStub + */ +public class TestStaticCallStub { + + static String[] nearStaticCallOpcodeSeq = {"isb", "mov", "movk", "movk", "b"}; + static String[] farStaticCallOpcodeSeq = {"isb", "mov", "movk", "movk", "mov", "movk", "movk", "br"}; + + static String extractOpcode(String line) { + line = line.trim(); + int semicolonIndex = line.indexOf(';'); + if (semicolonIndex != -1) { + line = line.substring(0, semicolonIndex).trim(); + } + + String[] words = line.split("\\s+"); + if (words.length > 1) { + return words[1]; + } + + return ""; + } + + static List extractOpcodesN(ListIterator itr, int n) { + List extractedOpcodes = new ArrayList<>(); + + while (itr.hasNext() && extractedOpcodes.size() < n) { + String opcode = extractOpcode(itr.next()); + if (!opcode.isEmpty()) { + extractedOpcodes.add(opcode); + } + } + + return extractedOpcodes; + } + + static void verifyNearStaticCall(ListIterator itr) { + List extractedOpcodes = extractOpcodesN(itr, nearStaticCallOpcodeSeq.length); + + if (!Arrays.asList(nearStaticCallOpcodeSeq).equals(extractedOpcodes)) { + throw new RuntimeException("for code cache < 250MB the static call stub is expected to be implemented using near branch"); + } + + return; + } + + static void verifyFarStaticCall(ListIterator itr) { + List extractedOpcodes = extractOpcodesN(itr, farStaticCallOpcodeSeq.length); + + if (!Arrays.asList(farStaticCallOpcodeSeq).equals(extractedOpcodes)) { + throw new RuntimeException("for code cache > 250MB the static call stub is expected to be implemented using far branch"); + } + + return; + } + + static void runVM(boolean bigCodeCache) throws Exception { + String className = TestStaticCallStub.class.getName(); + String[] procArgs = { + "-XX:-Inline", + "-Xcomp", + "-Xbatch", + "-XX:+TieredCompilation", + "-XX:+SegmentedCodeCache", + "-XX:ReservedCodeCacheSize=" + (bigCodeCache ? "256M" : "200M"), + "-XX:+UnlockDiagnosticVMOptions", + "-XX:CompileCommand=option," + className + "::main,bool,PrintAssembly,true", + className}; + + + ProcessBuilder pb = ProcessTools.createLimitedTestJavaProcessBuilder(procArgs); + OutputAnalyzer output = new OutputAnalyzer(pb.start()); + List lines = output.asLines(); + + ListIterator itr = lines.listIterator(); + while (itr.hasNext()) { + String line = itr.next(); + if (line.contains("{static_stub}")) { + itr.previous(); + if (bigCodeCache) { + verifyFarStaticCall(itr); + } else { + verifyNearStaticCall(itr); + } + return; + } + } + throw new RuntimeException("Assembly output: static call stub is not found"); + } + + public static void main(String[] args) throws Exception { + if (args.length == 0) { + // Main VM: fork VM with options + runVM(true); + runVM(false); + return; + } + if (args.length > 0) { + // We are in a forked VM. Just exit + System.out.println("Ok"); + } + } +} + diff --git a/test/hotspot/jtreg/compiler/c2/gvn/TestCompressExpandTopInput.java b/test/hotspot/jtreg/compiler/c2/gvn/TestCompressExpandTopInput.java new file mode 100644 index 00000000000..fa78a11f6a1 --- /dev/null +++ b/test/hotspot/jtreg/compiler/c2/gvn/TestCompressExpandTopInput.java @@ -0,0 +1,129 @@ +/* + * Copyright (c) 2025, 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. + * + * 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. + */ + +/* + * @test + * @bug 8351645 + * @summary C2: ExpandBitsNode::Ideal hits assert because of TOP input + * @library /test/lib / + * @run driver compiler.intrinsics.TestCompressExpandTopInput + */ + +package compiler.intrinsics; + +import compiler.lib.ir_framework.*; +import compiler.lib.verify.*; +import java.util.stream.IntStream; +import java.util.stream.LongStream; + +public class TestCompressExpandTopInput { + + public static int [] array_I0 = IntStream.range(0, 10000).toArray(); + public static int [] array_I1 = IntStream.range(10000, 20000).toArray(); + public static long [] array_L0 = LongStream.range(0, 10000).toArray(); + public static long [] array_L1 = LongStream.range(10000, 20000).toArray(); + + public static int oneI = 1; + public static long oneL = 1L; + + public static long [] GOLD_COMPRESS_LONG = testCompressBitsLong(); + public static long [] GOLD_EXPAND_LONG = testExpandBitsLong(); + public static int [] GOLD_COMPRESS_INT = testCompressBitsInt(); + public static int [] GOLD_EXPAND_INT = testExpandBitsInt(); + + @Test + public static long[] testExpandBitsLong() { + long[] out = new long[10000]; + for (int i = 0; i < out.length; i++) { + long y = array_L0[i] % oneL; + long x = (array_L1[i] | 4294967298L) << -7640610671680100954L; + out[i] = Long.expand(y, x); + } + return out; + } + + @Check(test="testExpandBitsLong") + public static void checkExpandBitsLong(long [] actual) { + for (int i = 0; i < GOLD_EXPAND_LONG.length; i++) { + Verify.checkEQ(GOLD_EXPAND_LONG[i], actual[i]); + } + } + + @Test + public static long[] testCompressBitsLong() { + long[] out = new long[10000]; + for (int i = 0; i < out.length; i++) { + long y = array_L0[i] % oneL; + long x = (array_L1[i] | 4294967298L) << -7640610671680100954L; + out[i] = Long.compress(y, x); + } + return out; + } + + @Check(test="testCompressBitsLong") + public static void checkCompressBitsLong(long [] actual) { + for (int i = 0; i < GOLD_COMPRESS_LONG.length; i++) { + Verify.checkEQ(GOLD_COMPRESS_LONG[i], actual[i]); + } + } + + @Test + public static int[] testExpandBitsInt() { + int[] out = new int[10000]; + for (int i = 0; i < out.length; i++) { + int y = array_I0[i] % oneI; + int x = (array_I1[i] | 22949672) << -76406101; + out[i] = Integer.expand(y, x); + } + return out; + } + + @Check(test="testExpandBitsInt") + public static void checkExpandBitsInt(int [] actual) { + for (int i = 0; i < GOLD_EXPAND_INT.length; i++) { + Verify.checkEQ(GOLD_EXPAND_INT[i], actual[i]); + } + } + + @Test + public static int[] testCompressBitsInt() { + int[] out = new int[10000]; + for (int i = 0; i < out.length; i++) { + int y = array_I0[i] % oneI; + int x = (array_I1[i] | 429497) << -764061068; + out[i] = Integer.compress(y, x); + } + return out; + } + + @Check(test="testCompressBitsInt") + public static void checkCompressBitsInt(int [] actual) { + for (int i = 0; i < GOLD_COMPRESS_INT.length; i++) { + Verify.checkEQ(GOLD_COMPRESS_INT[i], actual[i]); + } + } + + public static void main(String[] args) { + TestFramework.runWithFlags("-XX:+StressIGVN"); + } +} diff --git a/test/hotspot/jtreg/compiler/c2/irTests/TestFPComparison2.java b/test/hotspot/jtreg/compiler/c2/irTests/TestFPComparison2.java new file mode 100644 index 00000000000..59c70b6873f --- /dev/null +++ b/test/hotspot/jtreg/compiler/c2/irTests/TestFPComparison2.java @@ -0,0 +1,1005 @@ +/* + * Copyright (c) 2025, Rivos Inc. 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. + * + * 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 compiler.c2.irTests; + +import compiler.lib.ir_framework.*; +import java.util.List; + +/* + * @test + * @bug 8358892 + * @summary The test is to trigger code path of BoolTest::ge/gt in C2_MacroAssembler::enc_cmove_cmp_fp + * @requires os.arch == "riscv64" + * @requires vm.debug + * @library /test/lib / + * @run driver compiler.c2.irTests.TestFPComparison2 + */ +public class TestFPComparison2 { + static final double[] DOUBLES = new double[] { + Double.NEGATIVE_INFINITY, + -Double.MAX_VALUE, + -1.0, + -Double.MIN_VALUE, + -0.0, + 0.0, + Double.MIN_VALUE, + 1.0, + Double.MAX_VALUE, + Double.POSITIVE_INFINITY, + Double.NaN, + }; + + static final float[] FLOATS = new float[] { + Float.NEGATIVE_INFINITY, + -Float.MAX_VALUE, + -1.0F, + -Float.MIN_VALUE, + -0.0F, + 0.0F, + Float.MIN_VALUE, + 1.0F, + Float.MAX_VALUE, + Float.POSITIVE_INFINITY, + Float.NaN, + }; + + static final int[] INTS = new int[] { + Integer.MIN_VALUE, + -100, + -1, + 0, + 1, + 100, + Integer.MAX_VALUE, + }; + + public static void main(String[] args) { + List options = List.of("-XX:-TieredCompilation", "-Xlog:jit+compilation=trace"); + // Booltest::ge + TestFramework framework = new TestFramework(Test_ge_1.class); + framework.addFlags(options.toArray(new String[0])).start(); + + framework = new TestFramework(Test_ge_2.class); + framework.addFlags(options.toArray(new String[0])).start(); + + // Booltest::gt + framework = new TestFramework(Test_gt_1.class); + framework.addFlags(options.toArray(new String[0])).start(); + + framework = new TestFramework(Test_gt_2.class); + framework.addFlags(options.toArray(new String[0])).start(); + } +} + +class Test_ge_1 { + @Test + @IR(counts = {IRNode.CMOVE_I, "1"}) + public static int test_float_BoolTest_ge_fixed_1_0(float x, float y) { + // return 1 + // when either x or y is NaN + // when neither is NaN, and x > y + // return 0 + // when neither is NaN, and x <= y + return !(x <= y) ? 1 : 0; + } + @DontCompile + public static int golden_float_BoolTest_ge_fixed_1_0(float x, float y) { + return !(x <= y) ? 1 : 0; + } + + @Test + @IR(counts = {IRNode.CMOVE_I, "1"}) + public static int test_double_BoolTest_ge_fixed_1_0(double x, double y) { + // return 1 + // when either x or y is NaN + // when neither is NaN, and x > y + // return 0 + // when neither is NaN, and x <= y + return !(x <= y) ? 1 : 0; + } + @DontCompile + public static int golden_double_BoolTest_ge_fixed_1_0(double x, double y) { + return !(x <= y) ? 1 : 0; + } + + @Test + @IR(counts = {IRNode.CMOVE_I, "1"}) + public static int test_float_BoolTest_ge_fixed_0_1(float x, float y) { + return !(x <= y) ? 0 : 1; + } + @DontCompile + public static int golden_float_BoolTest_ge_fixed_0_1(float x, float y) { + return !(x <= y) ? 0 : 1; + } + + @Test + @IR(counts = {IRNode.CMOVE_I, "1"}) + public static int test_double_BoolTest_ge_fixed_0_1(double x, double y) { + return !(x <= y) ? 0 : 1; + } + @DontCompile + public static int golden_double_BoolTest_ge_fixed_0_1(double x, double y) { + return !(x <= y) ? 0 : 1; + } + + @Test + @IR(counts = {IRNode.CMOVE_I, "1"}) + public static int test_float_BoolTest_ge_fixed_10_20(float x, float y) { + return !(x <= y) ? 10 : 20; + } + @DontCompile + public static int golden_float_BoolTest_ge_fixed_10_20(float x, float y) { + return !(x <= y) ? 10 : 20; + } + + @Test + @IR(counts = {IRNode.CMOVE_I, "1"}) + public static int test_double_BoolTest_ge_fixed_10_20(double x, double y) { + return !(x <= y) ? 10 : 20; + } + @DontCompile + public static int golden_double_BoolTest_ge_fixed_10_20(double x, double y) { + return !(x <= y) ? 10 : 20; + } + + @Test + @IR(counts = {IRNode.CMOVE_I, "1"}) + public static int test_float_BoolTest_ge_variable_results(float x, float y, int a, int b) { + return !(x <= y) ? a : b; + } + @DontCompile + public static int golden_float_BoolTest_ge_variable_results(float x, float y, int a, int b) { + return !(x <= y) ? a : b; + } + + @Test + @IR(counts = {IRNode.CMOVE_I, "1"}) + public static int test_double_BoolTest_ge_variable_results(double x, double y, int a, int b) { + return !(x <= y) ? a : b; + } + @DontCompile + public static int golden_double_BoolTest_ge_variable_results(double x, double y, int a, int b) { + return !(x <= y) ? a : b; + } + + @Run(test = {"test_float_BoolTest_ge_fixed_1_0", "test_double_BoolTest_ge_fixed_1_0", + "test_float_BoolTest_ge_fixed_0_1", "test_double_BoolTest_ge_fixed_0_1", + "test_float_BoolTest_ge_fixed_10_20", "test_double_BoolTest_ge_fixed_10_20", + "test_float_BoolTest_ge_variable_results", "test_double_BoolTest_ge_variable_results"}) + public void runTests() { + int err = 0; + + for (int i = 0; i < TestFPComparison2.FLOATS.length; i++) { + for (int j = 0; j < TestFPComparison2.FLOATS.length; j++) { + float x = TestFPComparison2.FLOATS[i]; + float y = TestFPComparison2.FLOATS[j]; + int actual = test_float_BoolTest_ge_fixed_1_0(x, y); + int expected = golden_float_BoolTest_ge_fixed_1_0(x, y); + if (actual != expected) { + System.out.println("Float failed (ge, 1, 0), x: " + x + ", y: " + y + + ", actual: " + actual + ", expected: " + expected); + err++; + } + } + } + + for (int i = 0; i < TestFPComparison2.DOUBLES.length; i++) { + for (int j = 0; j < TestFPComparison2.DOUBLES.length; j++) { + double x = TestFPComparison2.DOUBLES[i]; + double y = TestFPComparison2.DOUBLES[j]; + int actual = test_double_BoolTest_ge_fixed_1_0(x, y); + int expected = golden_double_BoolTest_ge_fixed_1_0(x, y); + if (actual != expected) { + System.out.println("Double failed (ge, 1, 0), x: " + x + ", y: " + y + + ", actual: " + actual + ", expected: " + expected); + err++; + } + } + } + + for (int i = 0; i < TestFPComparison2.FLOATS.length; i++) { + for (int j = 0; j < TestFPComparison2.FLOATS.length; j++) { + float x = TestFPComparison2.FLOATS[i]; + float y = TestFPComparison2.FLOATS[j]; + int actual = test_float_BoolTest_ge_fixed_0_1(x, y); + int expected = golden_float_BoolTest_ge_fixed_0_1(x, y); + if (actual != expected) { + System.out.println("Float failed (ge, 0, 1), x: " + x + ", y: " + y + + ", actual: " + actual + ", expected: " + expected); + err++; + } + } + } + + for (int i = 0; i < TestFPComparison2.DOUBLES.length; i++) { + for (int j = 0; j < TestFPComparison2.DOUBLES.length; j++) { + double x = TestFPComparison2.DOUBLES[i]; + double y = TestFPComparison2.DOUBLES[j]; + int actual = test_double_BoolTest_ge_fixed_0_1(x, y); + int expected = golden_double_BoolTest_ge_fixed_0_1(x, y); + if (actual != expected) { + System.out.println("Double failed (ge, 0, 1), x: " + x + ", y: " + y + + ", actual: " + actual + ", expected: " + expected); + err++; + } + } + } + + for (int i = 0; i < TestFPComparison2.FLOATS.length; i++) { + for (int j = 0; j < TestFPComparison2.FLOATS.length; j++) { + float x = TestFPComparison2.FLOATS[i]; + float y = TestFPComparison2.FLOATS[j]; + int actual = test_float_BoolTest_ge_fixed_10_20(x, y); + int expected = golden_float_BoolTest_ge_fixed_10_20(x, y); + if (actual != expected) { + System.out.println("Float failed (ge, 10, 20), x: " + x + ", y: " + y + + ", actual: " + actual + ", expected: " + expected); + err++; + } + } + } + + for (int i = 0; i < TestFPComparison2.DOUBLES.length; i++) { + for (int j = 0; j < TestFPComparison2.DOUBLES.length; j++) { + double x = TestFPComparison2.DOUBLES[i]; + double y = TestFPComparison2.DOUBLES[j]; + int actual = test_double_BoolTest_ge_fixed_10_20(x, y); + int expected = golden_double_BoolTest_ge_fixed_10_20(x, y); + if (actual != expected) { + System.out.println("Double failed (ge, 10, 20), x: " + x + ", y: " + y + + ", actual: " + actual + ", expected: " + expected); + err++; + } + } + } + + for (int i = 0; i < TestFPComparison2.FLOATS.length; i++) { + for (int j = 0; j < TestFPComparison2.FLOATS.length; j++) { + float x = TestFPComparison2.FLOATS[i]; + float y = TestFPComparison2.FLOATS[j]; + for (int m = 0; m < TestFPComparison2.INTS.length; m++) { + for (int n = 0; n < TestFPComparison2.INTS.length; n++) { + int a = TestFPComparison2.INTS[m]; + int b = TestFPComparison2.INTS[n]; + int actual = test_float_BoolTest_ge_variable_results(x, y, a, b); + int expected = golden_float_BoolTest_ge_variable_results(x, y, a, b); + if (actual != expected) { + System.out.println("Float failed (ge), x: " + x + ", y: " + y + ", a: " + a + ", b: " + b + + ", actual: " + actual + ", expected: " + expected); + err++; + } + } + } + } + } + + for (int i = 0; i < TestFPComparison2.DOUBLES.length; i++) { + for (int j = 0; j < TestFPComparison2.DOUBLES.length; j++) { + double x = TestFPComparison2.DOUBLES[i]; + double y = TestFPComparison2.DOUBLES[j]; + for (int m = 0; m < TestFPComparison2.INTS.length; m++) { + for (int n = 0; n < TestFPComparison2.INTS.length; n++) { + int a = TestFPComparison2.INTS[m]; + int b = TestFPComparison2.INTS[n]; + int actual = test_double_BoolTest_ge_variable_results(x, y, a, b); + int expected = golden_double_BoolTest_ge_variable_results(x, y, a, b); + if (actual != expected) { + System.out.println("Double failed (ge), x: " + x + ", y: " + y + ", a: " + a + ", b: " + b + + ", actual: " + actual + ", expected: " + expected); + err++; + } + } + } + } + } + + if (err != 0) { + throw new RuntimeException("Some tests failed"); + } + } +} + +class Test_ge_2 { + @Test + @IR(counts = {IRNode.CMOVE_I, "1"}) + public static int test_float_BoolTest_ge_fixed_1_0(float x, float y) { + // return 1 + // when either x or y is NaN + // when neither is NaN, and x < y + // return 0 + // when neither is NaN, and x >= y + return !(x >= y) ? 1 : 0; + } + @DontCompile + public static int golden_float_BoolTest_ge_fixed_1_0(float x, float y) { + return !(x >= y) ? 1 : 0; + } + + @Test + @IR(counts = {IRNode.CMOVE_I, "1"}) + public static int test_double_BoolTest_ge_fixed_1_0(double x, double y) { + // return 1 + // when either x or y is NaN + // when neither is NaN, and x < y + // return 0 + // when neither is NaN, and x >= y + return !(x >= y) ? 1 : 0; + } + @DontCompile + public static int golden_double_BoolTest_ge_fixed_1_0(double x, double y) { + return !(x >= y) ? 1 : 0; + } + + @Test + @IR(counts = {IRNode.CMOVE_I, "1"}) + public static int test_float_BoolTest_ge_fixed_0_1(float x, float y) { + return !(x >= y) ? 0 : 1; + } + @DontCompile + public static int golden_float_BoolTest_ge_fixed_0_1(float x, float y) { + return !(x >= y) ? 0 : 1; + } + + @Test + @IR(counts = {IRNode.CMOVE_I, "1"}) + public static int test_double_BoolTest_ge_fixed_0_1(double x, double y) { + return !(x >= y) ? 0 : 1; + } + @DontCompile + public static int golden_double_BoolTest_ge_fixed_0_1(double x, double y) { + return !(x >= y) ? 0 : 1; + } + + @Test + @IR(counts = {IRNode.CMOVE_I, "1"}) + public static int test_float_BoolTest_ge_fixed_10_20(float x, float y) { + return !(x >= y) ? 10 : 20; + } + @DontCompile + public static int golden_float_BoolTest_ge_fixed_10_20(float x, float y) { + return !(x >= y) ? 10 : 20; + } + + @Test + @IR(counts = {IRNode.CMOVE_I, "1"}) + public static int test_double_BoolTest_ge_fixed_10_20(double x, double y) { + return !(x >= y) ? 10 : 20; + } + @DontCompile + public static int golden_double_BoolTest_ge_fixed_10_20(double x, double y) { + return !(x >= y) ? 10 : 20; + } + + @Test + @IR(counts = {IRNode.CMOVE_I, "1"}) + public static int test_float_BoolTest_ge_variable_results(float x, float y, int a, int b) { + return !(x >= y) ? a : b; + } + @DontCompile + public static int golden_float_BoolTest_ge_variable_results(float x, float y, int a, int b) { + return !(x >= y) ? a : b; + } + + @Test + @IR(counts = {IRNode.CMOVE_I, "1"}) + public static int test_double_BoolTest_ge_variable_results(double x, double y, int a, int b) { + return !(x >= y) ? a : b; + } + @DontCompile + public static int golden_double_BoolTest_ge_variable_results(double x, double y, int a, int b) { + return !(x >= y) ? a : b; + } + + @Run(test = {"test_float_BoolTest_ge_fixed_1_0", "test_double_BoolTest_ge_fixed_1_0", + "test_float_BoolTest_ge_fixed_0_1", "test_double_BoolTest_ge_fixed_0_1", + "test_float_BoolTest_ge_fixed_10_20", "test_double_BoolTest_ge_fixed_10_20", + "test_float_BoolTest_ge_variable_results", "test_double_BoolTest_ge_variable_results"}) + public void runTests() { + int err = 0; + + for (int i = 0; i < TestFPComparison2.FLOATS.length; i++) { + for (int j = 0; j < TestFPComparison2.FLOATS.length; j++) { + float x = TestFPComparison2.FLOATS[i]; + float y = TestFPComparison2.FLOATS[j]; + int actual = test_float_BoolTest_ge_fixed_1_0(x, y); + int expected = golden_float_BoolTest_ge_fixed_1_0(x, y); + if (actual != expected) { + System.out.println("Float failed (ge), x: " + x + ", y: " + y + + ", actual: " + actual + ", expected: " + expected); + err++; + } + } + } + + for (int i = 0; i < TestFPComparison2.DOUBLES.length; i++) { + for (int j = 0; j < TestFPComparison2.DOUBLES.length; j++) { + double x = TestFPComparison2.DOUBLES[i]; + double y = TestFPComparison2.DOUBLES[j]; + int actual = test_double_BoolTest_ge_fixed_1_0(x, y); + int expected = golden_double_BoolTest_ge_fixed_1_0(x, y); + if (actual != expected) { + System.out.println("Double failed (ge), x: " + x + ", y: " + y + + ", actual: " + actual + ", expected: " + expected); + err++; + } + } + } + + for (int i = 0; i < TestFPComparison2.FLOATS.length; i++) { + for (int j = 0; j < TestFPComparison2.FLOATS.length; j++) { + float x = TestFPComparison2.FLOATS[i]; + float y = TestFPComparison2.FLOATS[j]; + int actual = test_float_BoolTest_ge_fixed_0_1(x, y); + int expected = golden_float_BoolTest_ge_fixed_0_1(x, y); + if (actual != expected) { + System.out.println("Float failed (ge, 0, 1), x: " + x + ", y: " + y + + ", actual: " + actual + ", expected: " + expected); + err++; + } + } + } + + for (int i = 0; i < TestFPComparison2.DOUBLES.length; i++) { + for (int j = 0; j < TestFPComparison2.DOUBLES.length; j++) { + double x = TestFPComparison2.DOUBLES[i]; + double y = TestFPComparison2.DOUBLES[j]; + int actual = test_double_BoolTest_ge_fixed_0_1(x, y); + int expected = golden_double_BoolTest_ge_fixed_0_1(x, y); + if (actual != expected) { + System.out.println("Double failed (ge, 0, 1), x: " + x + ", y: " + y + + ", actual: " + actual + ", expected: " + expected); + err++; + } + } + } + + for (int i = 0; i < TestFPComparison2.FLOATS.length; i++) { + for (int j = 0; j < TestFPComparison2.FLOATS.length; j++) { + float x = TestFPComparison2.FLOATS[i]; + float y = TestFPComparison2.FLOATS[j]; + int actual = test_float_BoolTest_ge_fixed_10_20(x, y); + int expected = golden_float_BoolTest_ge_fixed_10_20(x, y); + if (actual != expected) { + System.out.println("Float failed (ge, 10, 20), x: " + x + ", y: " + y + + ", actual: " + actual + ", expected: " + expected); + err++; + } + } + } + + for (int i = 0; i < TestFPComparison2.DOUBLES.length; i++) { + for (int j = 0; j < TestFPComparison2.DOUBLES.length; j++) { + double x = TestFPComparison2.DOUBLES[i]; + double y = TestFPComparison2.DOUBLES[j]; + int actual = test_double_BoolTest_ge_fixed_10_20(x, y); + int expected = golden_double_BoolTest_ge_fixed_10_20(x, y); + if (actual != expected) { + System.out.println("Double failed (ge, 10, 20), x: " + x + ", y: " + y + + ", actual: " + actual + ", expected: " + expected); + err++; + } + } + } + + for (int i = 0; i < TestFPComparison2.FLOATS.length; i++) { + for (int j = 0; j < TestFPComparison2.FLOATS.length; j++) { + float x = TestFPComparison2.FLOATS[i]; + float y = TestFPComparison2.FLOATS[j]; + for (int m = 0; m < TestFPComparison2.INTS.length; m++) { + for (int n = 0; n < TestFPComparison2.INTS.length; n++) { + int a = TestFPComparison2.INTS[m]; + int b = TestFPComparison2.INTS[n]; + int actual = test_float_BoolTest_ge_variable_results(x, y, a, b); + int expected = golden_float_BoolTest_ge_variable_results(x, y, a, b); + if (actual != expected) { + System.out.println("Float failed (ge), x: " + x + ", y: " + y + ", a: " + a + ", b: " + b + + ", actual: " + actual + ", expected: " + expected); + err++; + } + } + } + } + } + + for (int i = 0; i < TestFPComparison2.DOUBLES.length; i++) { + for (int j = 0; j < TestFPComparison2.DOUBLES.length; j++) { + double x = TestFPComparison2.DOUBLES[i]; + double y = TestFPComparison2.DOUBLES[j]; + for (int m = 0; m < TestFPComparison2.INTS.length; m++) { + for (int n = 0; n < TestFPComparison2.INTS.length; n++) { + int a = TestFPComparison2.INTS[m]; + int b = TestFPComparison2.INTS[n]; + int actual = test_double_BoolTest_ge_variable_results(x, y, a, b); + int expected = golden_double_BoolTest_ge_variable_results(x, y, a, b); + if (actual != expected) { + System.out.println("Double failed (ge), x: " + x + ", y: " + y + ", a: " + a + ", b: " + b + + ", actual: " + actual + ", expected: " + expected); + err++; + } + } + } + } + } + + if (err != 0) { + throw new RuntimeException("Some tests failed"); + } + } +} + +class Test_gt_1 { + @Test + @IR(counts = {IRNode.CMOVE_I, "1"}) + public static int test_float_BoolTest_gt_fixed_1_0(float x, float y) { + // return 1 + // when either x or y is NaN + // when neither is NaN, and x >= y + // return 0 + // when neither is NaN, and x < y + return !(x < y) ? 1 : 0; + } + @DontCompile + public static int golden_float_BoolTest_gt_fixed_1_0(float x, float y) { + return !(x < y) ? 1 : 0; + } + + @Test + @IR(counts = {IRNode.CMOVE_I, "1"}) + public static int test_double_BoolTest_gt_fixed_1_0(double x, double y) { + // return 1 + // when either x or y is NaN + // when neither is NaN, and x >= y + // return 0 + // when neither is NaN, and x < y + return !(x < y) ? 1 : 0; + } + @DontCompile + public static int golden_double_BoolTest_gt_fixed_1_0(double x, double y) { + return !(x < y) ? 1 : 0; + } + + @Test + @IR(counts = {IRNode.CMOVE_I, "1"}) + public static int test_float_BoolTest_gt_fixed_0_1(float x, float y) { + return !(x < y) ? 0 : 1; + } + @DontCompile + public static int golden_float_BoolTest_gt_fixed_0_1(float x, float y) { + return !(x < y) ? 0 : 1; + } + + @Test + @IR(counts = {IRNode.CMOVE_I, "1"}) + public static int test_double_BoolTest_gt_fixed_0_1(double x, double y) { + return !(x < y) ? 0 : 1; + } + @DontCompile + public static int golden_double_BoolTest_gt_fixed_0_1(double x, double y) { + return !(x < y) ? 0 : 1; + } + + @Test + @IR(counts = {IRNode.CMOVE_I, "1"}) + public static int test_float_BoolTest_gt_fixed_10_20(float x, float y) { + return !(x < y) ? 10 : 20; + } + @DontCompile + public static int golden_float_BoolTest_gt_fixed_10_20(float x, float y) { + return !(x < y) ? 10 : 20; + } + + @Test + @IR(counts = {IRNode.CMOVE_I, "1"}) + public static int test_double_BoolTest_gt_fixed_10_20(double x, double y) { + return !(x < y) ? 10 : 20; + } + @DontCompile + public static int golden_double_BoolTest_gt_fixed_10_20(double x, double y) { + return !(x < y) ? 10 : 20; + } + + @Test + @IR(counts = {IRNode.CMOVE_I, "1"}) + public static int test_float_BoolTest_gt_variable_results(float x, float y, int a, int b) { + return !(x < y) ? a : b; + } + @DontCompile + public static int golden_float_BoolTest_gt_variable_results(float x, float y, int a, int b) { + return !(x < y) ? a : b; + } + + @Test + @IR(counts = {IRNode.CMOVE_I, "1"}) + public static int test_double_BoolTest_gt_variable_results(double x, double y, int a, int b) { + return !(x < y) ? a : b; + } + @DontCompile + public static int golden_double_BoolTest_gt_variable_results(double x, double y, int a, int b) { + return !(x < y) ? a : b; + } + + @Run(test = {"test_float_BoolTest_gt_fixed_1_0", "test_double_BoolTest_gt_fixed_1_0", + "test_float_BoolTest_gt_fixed_0_1", "test_double_BoolTest_gt_fixed_0_1", + "test_float_BoolTest_gt_fixed_10_20", "test_double_BoolTest_gt_fixed_10_20", + "test_float_BoolTest_gt_variable_results", "test_double_BoolTest_gt_variable_results"}) + public void runTests() { + int err = 0; + + for (int i = 0; i < TestFPComparison2.FLOATS.length; i++) { + for (int j = 0; j < TestFPComparison2.FLOATS.length; j++) { + float x = TestFPComparison2.FLOATS[i]; + float y = TestFPComparison2.FLOATS[j]; + int actual = test_float_BoolTest_gt_fixed_1_0(x, y); + int expected = golden_float_BoolTest_gt_fixed_1_0(x, y); + if (actual != expected) { + System.out.println("Float failed (gt), x: " + x + ", y: " + y + + ", actual: " + actual + ", expected: " + expected); + err++; + } + } + } + + for (int i = 0; i < TestFPComparison2.DOUBLES.length; i++) { + for (int j = 0; j < TestFPComparison2.DOUBLES.length; j++) { + double x = TestFPComparison2.DOUBLES[i]; + double y = TestFPComparison2.DOUBLES[j]; + int actual = test_double_BoolTest_gt_fixed_1_0(x, y); + int expected = golden_double_BoolTest_gt_fixed_1_0(x, y); + if (actual != expected) { + System.out.println("Double failed (gt), x: " + x + ", y: " + y + + ", actual: " + actual + ", expected: " + expected); + err++; + } + } + } + + for (int i = 0; i < TestFPComparison2.FLOATS.length; i++) { + for (int j = 0; j < TestFPComparison2.FLOATS.length; j++) { + float x = TestFPComparison2.FLOATS[i]; + float y = TestFPComparison2.FLOATS[j]; + int actual = test_float_BoolTest_gt_fixed_0_1(x, y); + int expected = golden_float_BoolTest_gt_fixed_0_1(x, y); + if (actual != expected) { + System.out.println("Float failed (gt, 0, 1), x: " + x + ", y: " + y + + ", actual: " + actual + ", expected: " + expected); + err++; + } + } + } + + for (int i = 0; i < TestFPComparison2.DOUBLES.length; i++) { + for (int j = 0; j < TestFPComparison2.DOUBLES.length; j++) { + double x = TestFPComparison2.DOUBLES[i]; + double y = TestFPComparison2.DOUBLES[j]; + int actual = test_double_BoolTest_gt_fixed_0_1(x, y); + int expected = golden_double_BoolTest_gt_fixed_0_1(x, y); + if (actual != expected) { + System.out.println("Double failed (gt, 0, 1), x: " + x + ", y: " + y + + ", actual: " + actual + ", expected: " + expected); + err++; + } + } + } + + for (int i = 0; i < TestFPComparison2.FLOATS.length; i++) { + for (int j = 0; j < TestFPComparison2.FLOATS.length; j++) { + float x = TestFPComparison2.FLOATS[i]; + float y = TestFPComparison2.FLOATS[j]; + int actual = test_float_BoolTest_gt_fixed_10_20(x, y); + int expected = golden_float_BoolTest_gt_fixed_10_20(x, y); + if (actual != expected) { + System.out.println("Float failed (gt, 10, 20), x: " + x + ", y: " + y + + ", actual: " + actual + ", expected: " + expected); + err++; + } + } + } + + for (int i = 0; i < TestFPComparison2.DOUBLES.length; i++) { + for (int j = 0; j < TestFPComparison2.DOUBLES.length; j++) { + double x = TestFPComparison2.DOUBLES[i]; + double y = TestFPComparison2.DOUBLES[j]; + int actual = test_double_BoolTest_gt_fixed_10_20(x, y); + int expected = golden_double_BoolTest_gt_fixed_10_20(x, y); + if (actual != expected) { + System.out.println("Double failed (gt, 10, 20), x: " + x + ", y: " + y + + ", actual: " + actual + ", expected: " + expected); + err++; + } + } + } + + for (int i = 0; i < TestFPComparison2.FLOATS.length; i++) { + for (int j = 0; j < TestFPComparison2.FLOATS.length; j++) { + float x = TestFPComparison2.FLOATS[i]; + float y = TestFPComparison2.FLOATS[j]; + for (int m = 0; m < TestFPComparison2.INTS.length; m++) { + for (int n = 0; n < TestFPComparison2.INTS.length; n++) { + int a = TestFPComparison2.INTS[m]; + int b = TestFPComparison2.INTS[n]; + int actual = test_float_BoolTest_gt_variable_results(x, y, a, b); + int expected = golden_float_BoolTest_gt_variable_results(x, y, a, b); + if (actual != expected) { + System.out.println("Float failed (gt), x: " + x + ", y: " + y + ", a: " + a + ", b: " + b + + ", actual: " + actual + ", expected: " + expected); + err++; + } + } + } + } + } + + for (int i = 0; i < TestFPComparison2.DOUBLES.length; i++) { + for (int j = 0; j < TestFPComparison2.DOUBLES.length; j++) { + double x = TestFPComparison2.DOUBLES[i]; + double y = TestFPComparison2.DOUBLES[j]; + for (int m = 0; m < TestFPComparison2.INTS.length; m++) { + for (int n = 0; n < TestFPComparison2.INTS.length; n++) { + int a = TestFPComparison2.INTS[m]; + int b = TestFPComparison2.INTS[n]; + int actual = test_double_BoolTest_gt_variable_results(x, y, a, b); + int expected = golden_double_BoolTest_gt_variable_results(x, y, a, b); + if (actual != expected) { + System.out.println("Double failed (gt), x: " + x + ", y: " + y + ", a: " + a + ", b: " + b + + ", actual: " + actual + ", expected: " + expected); + err++; + } + } + } + } + } + + if (err != 0) { + throw new RuntimeException("Some tests failed"); + } + } +} + +class Test_gt_2 { + @Test + @IR(counts = {IRNode.CMOVE_I, "1"}) + public static int test_float_BoolTest_gt_fixed_1_0(float x, float y) { + // return 1 + // when either x or y is NaN + // when neither is NaN, and x <= y + // return 0 + // when neither is NaN, and x > y + return !(x > y) ? 1 : 0; + } + @DontCompile + public static int golden_float_BoolTest_gt_fixed_1_0(float x, float y) { + return !(x > y) ? 1 : 0; + } + + @Test + @IR(counts = {IRNode.CMOVE_I, "1"}) + public static int test_double_BoolTest_gt_fixed_1_0(double x, double y) { + // return 1 + // when either x or y is NaN + // when neither is NaN, and x <= y + // return 0 + // when neither is NaN, and x > y + return !(x > y) ? 1 : 0; + } + @DontCompile + public static int golden_double_BoolTest_gt_fixed_1_0(double x, double y) { + return !(x > y) ? 1 : 0; + } + + @Test + @IR(counts = {IRNode.CMOVE_I, "1"}) + public static int test_float_BoolTest_gt_fixed_0_1(float x, float y) { + return !(x > y) ? 0 : 1; + } + @DontCompile + public static int golden_float_BoolTest_gt_fixed_0_1(float x, float y) { + return !(x > y) ? 0 : 1; + } + + @Test + @IR(counts = {IRNode.CMOVE_I, "1"}) + public static int test_double_BoolTest_gt_fixed_0_1(double x, double y) { + return !(x > y) ? 0 : 1; + } + @DontCompile + public static int golden_double_BoolTest_gt_fixed_0_1(double x, double y) { + return !(x > y) ? 0 : 1; + } + + @Test + @IR(counts = {IRNode.CMOVE_I, "1"}) + public static int test_float_BoolTest_gt_fixed_10_20(float x, float y) { + return !(x > y) ? 10 : 20; + } + @DontCompile + public static int golden_float_BoolTest_gt_fixed_10_20(float x, float y) { + return !(x > y) ? 10 : 20; + } + + @Test + @IR(counts = {IRNode.CMOVE_I, "1"}) + public static int test_double_BoolTest_gt_fixed_10_20(double x, double y) { + return !(x > y) ? 10 : 20; + } + @DontCompile + public static int golden_double_BoolTest_gt_fixed_10_20(double x, double y) { + return !(x > y) ? 10 : 20; + } + + @Test + @IR(counts = {IRNode.CMOVE_I, "1"}) + public static int test_float_BoolTest_gt_variable_results(float x, float y, int a, int b) { + return !(x > y) ? a : b; + } + @DontCompile + public static int golden_float_BoolTest_gt_variable_results(float x, float y, int a, int b) { + return !(x > y) ? a : b; + } + + @Test + @IR(counts = {IRNode.CMOVE_I, "1"}) + public static int test_double_BoolTest_gt_variable_results(double x, double y, int a, int b) { + return !(x > y) ? a : b; + } + @DontCompile + public static int golden_double_BoolTest_gt_variable_results(double x, double y, int a, int b) { + return !(x > y) ? a : b; + } + + @Run(test = {"test_float_BoolTest_gt_fixed_1_0", "test_double_BoolTest_gt_fixed_1_0", + "test_float_BoolTest_gt_fixed_0_1", "test_double_BoolTest_gt_fixed_0_1", + "test_float_BoolTest_gt_fixed_10_20", "test_double_BoolTest_gt_fixed_10_20", + "test_float_BoolTest_gt_variable_results", "test_double_BoolTest_gt_variable_results"}) + public void runTests() { + int err = 0; + + for (int i = 0; i < TestFPComparison2.FLOATS.length; i++) { + for (int j = 0; j < TestFPComparison2.FLOATS.length; j++) { + float x = TestFPComparison2.FLOATS[i]; + float y = TestFPComparison2.FLOATS[j]; + int actual = test_float_BoolTest_gt_fixed_1_0(x, y); + int expected = golden_float_BoolTest_gt_fixed_1_0(x, y); + if (actual != expected) { + System.out.println("Float failed (gt), x: " + x + ", y: " + y + + ", actual: " + actual + ", expected: " + expected); + err++; + } + } + } + + for (int i = 0; i < TestFPComparison2.DOUBLES.length; i++) { + for (int j = 0; j < TestFPComparison2.DOUBLES.length; j++) { + double x = TestFPComparison2.DOUBLES[i]; + double y = TestFPComparison2.DOUBLES[j]; + int actual = test_double_BoolTest_gt_fixed_1_0(x, y); + int expected = golden_double_BoolTest_gt_fixed_1_0(x, y); + if (actual != expected) { + System.out.println("Double failed (gt), x: " + x + ", y: " + y + + ", actual: " + actual + ", expected: " + expected); + err++; + } + } + } + + for (int i = 0; i < TestFPComparison2.FLOATS.length; i++) { + for (int j = 0; j < TestFPComparison2.FLOATS.length; j++) { + float x = TestFPComparison2.FLOATS[i]; + float y = TestFPComparison2.FLOATS[j]; + int actual = test_float_BoolTest_gt_fixed_0_1(x, y); + int expected = golden_float_BoolTest_gt_fixed_0_1(x, y); + if (actual != expected) { + System.out.println("Float failed (gt, 0, 1), x: " + x + ", y: " + y + + ", actual: " + actual + ", expected: " + expected); + err++; + } + } + } + + for (int i = 0; i < TestFPComparison2.DOUBLES.length; i++) { + for (int j = 0; j < TestFPComparison2.DOUBLES.length; j++) { + double x = TestFPComparison2.DOUBLES[i]; + double y = TestFPComparison2.DOUBLES[j]; + int actual = test_double_BoolTest_gt_fixed_0_1(x, y); + int expected = golden_double_BoolTest_gt_fixed_0_1(x, y); + if (actual != expected) { + System.out.println("Double failed (gt, 0, 1), x: " + x + ", y: " + y + + ", actual: " + actual + ", expected: " + expected); + err++; + } + } + } + + for (int i = 0; i < TestFPComparison2.FLOATS.length; i++) { + for (int j = 0; j < TestFPComparison2.FLOATS.length; j++) { + float x = TestFPComparison2.FLOATS[i]; + float y = TestFPComparison2.FLOATS[j]; + int actual = test_float_BoolTest_gt_fixed_10_20(x, y); + int expected = golden_float_BoolTest_gt_fixed_10_20(x, y); + if (actual != expected) { + System.out.println("Float failed (gt, 10, 20), x: " + x + ", y: " + y + + ", actual: " + actual + ", expected: " + expected); + err++; + } + } + } + + for (int i = 0; i < TestFPComparison2.DOUBLES.length; i++) { + for (int j = 0; j < TestFPComparison2.DOUBLES.length; j++) { + double x = TestFPComparison2.DOUBLES[i]; + double y = TestFPComparison2.DOUBLES[j]; + int actual = test_double_BoolTest_gt_fixed_10_20(x, y); + int expected = golden_double_BoolTest_gt_fixed_10_20(x, y); + if (actual != expected) { + System.out.println("Double failed (gt, 10, 20), x: " + x + ", y: " + y + + ", actual: " + actual + ", expected: " + expected); + err++; + } + } + } + + for (int i = 0; i < TestFPComparison2.FLOATS.length; i++) { + for (int j = 0; j < TestFPComparison2.FLOATS.length; j++) { + float x = TestFPComparison2.FLOATS[i]; + float y = TestFPComparison2.FLOATS[j]; + for (int m = 0; m < TestFPComparison2.INTS.length; m++) { + for (int n = 0; n < TestFPComparison2.INTS.length; n++) { + int a = TestFPComparison2.INTS[m]; + int b = TestFPComparison2.INTS[n]; + int actual = test_float_BoolTest_gt_variable_results(x, y, a, b); + int expected = golden_float_BoolTest_gt_variable_results(x, y, a, b); + if (actual != expected) { + System.out.println("Float failed (gt), x: " + x + ", y: " + y + ", a: " + a + ", b: " + b + + ", actual: " + actual + ", expected: " + expected); + err++; + } + } + } + } + } + + for (int i = 0; i < TestFPComparison2.DOUBLES.length; i++) { + for (int j = 0; j < TestFPComparison2.DOUBLES.length; j++) { + double x = TestFPComparison2.DOUBLES[i]; + double y = TestFPComparison2.DOUBLES[j]; + for (int m = 0; m < TestFPComparison2.INTS.length; m++) { + for (int n = 0; n < TestFPComparison2.INTS.length; n++) { + int a = TestFPComparison2.INTS[m]; + int b = TestFPComparison2.INTS[n]; + int actual = test_double_BoolTest_gt_variable_results(x, y, a, b); + int expected = golden_double_BoolTest_gt_variable_results(x, y, a, b); + if (actual != expected) { + System.out.println("Double failed (gt), x: " + x + ", y: " + y + ", a: " + a + ", b: " + b + + ", actual: " + actual + ", expected: " + expected); + err++; + } + } + } + } + } + + if (err != 0) { + throw new RuntimeException("Some tests failed"); + } + } +} diff --git a/test/hotspot/jtreg/compiler/c2/irTests/TestFloat16ScalarOperations.java b/test/hotspot/jtreg/compiler/c2/irTests/TestFloat16ScalarOperations.java index c96146b8e39..c8ee5e730fa 100644 --- a/test/hotspot/jtreg/compiler/c2/irTests/TestFloat16ScalarOperations.java +++ b/test/hotspot/jtreg/compiler/c2/irTests/TestFloat16ScalarOperations.java @@ -32,10 +32,14 @@ * @run driver TestFloat16ScalarOperations */ import compiler.lib.ir_framework.*; +import compiler.lib.verify.*; import jdk.incubator.vector.Float16; import static jdk.incubator.vector.Float16.*; import java.util.Random; +import compiler.lib.generators.Generator; +import static compiler.lib.generators.Generators.G; + public class TestFloat16ScalarOperations { private static final int count = 1024; @@ -55,19 +59,35 @@ public class TestFloat16ScalarOperations { private static final Float16 MAX_HALF_ULP = Float16.valueOf(16.0f); private static final Float16 SIGNALING_NAN = shortBitsToFloat16((short)31807); - private static Random r = jdk.test.lib.Utils.getRandomInstance(); + private static Generator genF = G.uniformFloats(); + private static Generator genHF = G.uniformFloat16s(); - private static final Float16 RANDOM1 = Float16.valueOf(r.nextFloat() * MAX_VALUE.floatValue()); - private static final Float16 RANDOM2 = Float16.valueOf(r.nextFloat() * MAX_VALUE.floatValue()); - private static final Float16 RANDOM3 = Float16.valueOf(r.nextFloat() * MAX_VALUE.floatValue()); - private static final Float16 RANDOM4 = Float16.valueOf(r.nextFloat() * MAX_VALUE.floatValue()); - private static final Float16 RANDOM5 = Float16.valueOf(r.nextFloat() * MAX_VALUE.floatValue()); + private static final Float16 RANDOM1 = Float16.valueOf(genF.next()); + private static final Float16 RANDOM2 = Float16.valueOf(genF.next()); + private static final Float16 RANDOM3 = Float16.valueOf(genF.next()); + private static final Float16 RANDOM4 = Float16.valueOf(genF.next()); + private static final Float16 RANDOM5 = Float16.valueOf(genF.next()); private static Float16 RANDOM1_VAR = RANDOM1; private static Float16 RANDOM2_VAR = RANDOM2; private static Float16 RANDOM3_VAR = RANDOM3; private static Float16 RANDOM4_VAR = RANDOM4; private static Float16 RANDOM5_VAR = RANDOM5; + private static Float16 POSITIVE_ZERO_VAR = POSITIVE_ZERO; + + private static final float INEXACT_FP16 = 2051.0f; + private static final float EXACT_FP16 = 2052.0f; + private static final float SNAN_FP16 = Float.intBitsToFloat(0x7F8000F0); + private static final float QNAN_FP16 = Float.intBitsToFloat(0x7FC00000); + + private Float16 GOLDEN_DIV_POT; + private Float16 GOLDEN_MUL2; + private short GOLDEN_INEXACT; + private short GOLDEN_EXACT; + private short GOLDEN_RANDOM_PAT1; + private short GOLDEN_RANDOM_PAT2; + private short GOLDEN_SNAN; + private short GOLDEN_QNAN; public static void main(String args[]) { Scenario s0 = new Scenario(0, "--add-modules=jdk.incubator.vector", "-Xint"); @@ -78,11 +98,19 @@ public static void main(String args[]) { public TestFloat16ScalarOperations() { src = new short[count]; dst = new short[count]; - fl = new float[count]; - for (int i = 0; i < count; i++) { - src[i] = Float.floatToFloat16(r.nextFloat() * MAX_VALUE.floatValue()); - fl[i] = r.nextFloat(); - } + fl = new float[count]; + + G.fill(genF, fl); + G.fill(genHF, src); + + GOLDEN_DIV_POT = testDivByPOT(); + GOLDEN_MUL2 = testMulByTWO(); + GOLDEN_INEXACT = testInexactFP16ConstantPatterns(); + GOLDEN_EXACT = testExactFP16ConstantPatterns(); + GOLDEN_RANDOM_PAT1 = testRandomFP16ConstantPatternSet1(); + GOLDEN_RANDOM_PAT2 = testRandomFP16ConstantPatternSet2(); + GOLDEN_SNAN = testSNaNFP16ConstantPatterns(); + GOLDEN_QNAN = testQNaNFP16ConstantPatterns(); } static void assertResult(float actual, float expected, String msg) { @@ -270,7 +298,7 @@ public void testFma() { applyIfCPUFeatureOr = {"avx512_fp16", "true", "zfh", "true"}) @IR(counts = {IRNode.MUL_HF, " >0 ", IRNode.REINTERPRET_S2HF, " >0 ", IRNode.REINTERPRET_HF2S, " >0 "}, applyIfCPUFeatureAnd = {"fphp", "true", "asimdhp", "true"}) - public void testDivByPOT() { + public Float16 testDivByPOT() { Float16 res = valueOf(0.0f); for (int i = 0; i < 50; i++) { Float16 divisor = valueOf(8.0f); @@ -281,7 +309,12 @@ public void testDivByPOT() { divisor = valueOf(32.0f); res = add(res, divide(dividend, divisor)); } - dst[0] = float16ToRawShortBits(res); + return res; + } + + @Check(test="testDivByPOT") + public void checkDivByPOT(Float16 actual) { + Verify.checkEQ(Float16.float16ToRawShortBits(GOLDEN_DIV_POT), Float16.float16ToRawShortBits(actual)); } @Test @@ -289,16 +322,151 @@ public void testDivByPOT() { applyIfCPUFeatureOr = {"avx512_fp16", "true", "zfh", "true"}) @IR(counts = {IRNode.MUL_HF, " 0 ", IRNode.ADD_HF, " >0 ", IRNode.REINTERPRET_S2HF, " >0 ", IRNode.REINTERPRET_HF2S, " >0 "}, applyIfCPUFeatureAnd = {"fphp", "true", "asimdhp", "true"}) - public void testMulByTWO() { + public Float16 testMulByTWO() { Float16 res = valueOf(0.0f); Float16 multiplier = valueOf(2.0f); for (int i = 0; i < 20; i++) { Float16 multiplicand = valueOf((float)i); res = add(res, multiply(multiplicand, multiplier)); } - assertResult(res.floatValue(), (float)((20 * (20 - 1))/2) * 2.0f, "testMulByTWO"); + return res; + } + + @Check(test="testMulByTWO") + public void checkMulByTWO(Float16 actual) { + Verify.checkEQ(Float16.float16ToRawShortBits(GOLDEN_MUL2), Float16.float16ToRawShortBits(actual)); } + @Test + @IR(counts = {IRNode.ADD_HF, " 0 ", IRNode.SUB_HF, " 0 ", IRNode.MUL_HF, " 0 ", IRNode.DIV_HF, " 0 "}, + applyIfCPUFeatureOr = {"avx512_fp16", "true", "zfh", "true"}) + @IR(counts = {IRNode.ADD_HF, " 0 ", IRNode.SUB_HF, " 0 ", IRNode.MUL_HF, " 0 ", IRNode.DIV_HF, " 0 "}, + applyIfCPUFeatureAnd = {"fphp", "true", "asimdhp", "true"}) + // Test point checks various floating point operations with exactly one floating + // point constant value passed as left or right argument, it then downcasts the + // result of computation to a float16 value. This pattern is used to infer a + // float16 IR during idealization. Floating point constant input is not-representable + // in float16 value range and is an inexact float16 value thereby preventing + // float16 IR inference. + public short testInexactFP16ConstantPatterns() { + short res = 0; + res += Float.floatToFloat16(POSITIVE_ZERO_VAR.floatValue() + INEXACT_FP16); + res += Float.floatToFloat16(POSITIVE_ZERO_VAR.floatValue() - INEXACT_FP16); + res += Float.floatToFloat16(INEXACT_FP16 * POSITIVE_ZERO_VAR.floatValue()); + res += Float.floatToFloat16(POSITIVE_ZERO_VAR.floatValue() / INEXACT_FP16); + return res; + } + + @Check(test="testInexactFP16ConstantPatterns") + public void checkInexactFP16ConstantPatterns(short actual) { + Verify.checkEQ(GOLDEN_INEXACT, actual); + } + + @Test + @IR(counts = {IRNode.ADD_HF, " >0 ", IRNode.SUB_HF, " >0 ", IRNode.MUL_HF, " >0 ", IRNode.DIV_HF, " >0 "}, + applyIfCPUFeatureOr = {"avx512_fp16", "true", "zfh", "true"}) + @IR(counts = {IRNode.ADD_HF, " >0 ", IRNode.SUB_HF, " >0 ", IRNode.MUL_HF, " >0 ", IRNode.DIV_HF, " >0 "}, + applyIfCPUFeatureAnd = {"fphp", "true", "asimdhp", "true"}) + @Warmup(10000) + public short testSNaNFP16ConstantPatterns() { + short res = 0; + res += Float.floatToFloat16(POSITIVE_ZERO_VAR.floatValue() + SNAN_FP16); + res += Float.floatToFloat16(POSITIVE_ZERO_VAR.floatValue() - SNAN_FP16); + res += Float.floatToFloat16(POSITIVE_ZERO_VAR.floatValue() * SNAN_FP16); + res += Float.floatToFloat16(POSITIVE_ZERO_VAR.floatValue() / SNAN_FP16); + return res; + } + + @Check(test="testSNaNFP16ConstantPatterns") + public void checkSNaNFP16ConstantPatterns(short actual) { + Verify.checkEQ(GOLDEN_SNAN, actual); + } + + @Test + @IR(counts = {IRNode.ADD_HF, " >0 ", IRNode.SUB_HF, " >0 ", IRNode.MUL_HF, " >0 ", IRNode.DIV_HF, " >0 "}, + applyIfCPUFeatureOr = {"avx512_fp16", "true", "zfh", "true"}) + @IR(counts = {IRNode.ADD_HF, " >0 ", IRNode.SUB_HF, " >0 ", IRNode.MUL_HF, " >0 ", IRNode.DIV_HF, " >0 "}, + applyIfCPUFeatureAnd = {"fphp", "true", "asimdhp", "true"}) + @Warmup(10000) + public short testQNaNFP16ConstantPatterns() { + short res = 0; + res += Float.floatToFloat16(POSITIVE_ZERO_VAR.floatValue() + QNAN_FP16); + res += Float.floatToFloat16(POSITIVE_ZERO_VAR.floatValue() - QNAN_FP16); + res += Float.floatToFloat16(POSITIVE_ZERO_VAR.floatValue() * QNAN_FP16); + res += Float.floatToFloat16(POSITIVE_ZERO_VAR.floatValue() / QNAN_FP16); + return res; + } + + @Check(test="testQNaNFP16ConstantPatterns") + public void checkQNaNFP16ConstantPatterns(short actual) { + Verify.checkEQ(GOLDEN_QNAN, actual); + } + + @Test + @IR(counts = {IRNode.ADD_HF, " >0 ", IRNode.SUB_HF, " >0 ", IRNode.MUL_HF, " >0 ", IRNode.DIV_HF, " >0 "}, + applyIfCPUFeatureOr = {"avx512_fp16", "true", "zfh", "true"}) + @IR(counts = {IRNode.ADD_HF, " >0 ", IRNode.SUB_HF, " >0 ", IRNode.MUL_HF, " >0 ", IRNode.DIV_HF, " >0 "}, + applyIfCPUFeatureAnd = {"fphp", "true", "asimdhp", "true"}) + @Warmup(10000) + // Test point checks various floating point operations with exactly one floating + // point constant value passed as left or right argument, it then downcasts the + // result of computation to a float16 value. This pattern is used to infer a + // Float16 IR during idealization. Floating point constant input is representable + // in Float16 value range thereby leading to a successful Float16 IR inference. + public short testExactFP16ConstantPatterns() { + short res = 0; + res += Float.floatToFloat16(EXACT_FP16 + POSITIVE_ZERO_VAR.floatValue()); + res += Float.floatToFloat16(POSITIVE_ZERO_VAR.floatValue() - EXACT_FP16); + res += Float.floatToFloat16(POSITIVE_ZERO_VAR.floatValue() * EXACT_FP16); + res += Float.floatToFloat16(POSITIVE_ZERO_VAR.floatValue() / EXACT_FP16); + return res; + } + + @Check(test="testExactFP16ConstantPatterns") + public void checkExactFP16ConstantPatterns(short actual) { + Verify.checkEQ(GOLDEN_EXACT, actual); + } + + @Test + @IR(counts = {IRNode.ADD_HF, " >0 ", IRNode.SUB_HF, " >0 ", IRNode.MUL_HF, " >0 ", IRNode.DIV_HF, " >0 "}, + applyIfCPUFeatureOr = {"avx512_fp16", "true", "zfh", "true"}) + @IR(counts = {IRNode.ADD_HF, " >0 ", IRNode.SUB_HF, " >0 ", IRNode.MUL_HF, " >0 ", IRNode.DIV_HF, " >0 "}, + applyIfCPUFeatureAnd = {"fphp", "true", "asimdhp", "true"}) + @Warmup(10000) + public short testRandomFP16ConstantPatternSet1() { + short res = 0; + res += Float.floatToFloat16(RANDOM1_VAR.floatValue() + RANDOM2.floatValue()); + res += Float.floatToFloat16(RANDOM2_VAR.floatValue() - RANDOM3.floatValue()); + res += Float.floatToFloat16(RANDOM3_VAR.floatValue() * RANDOM4.floatValue()); + res += Float.floatToFloat16(RANDOM4_VAR.floatValue() / RANDOM5.floatValue()); + return res; + } + + @Check(test="testRandomFP16ConstantPatternSet1") + public void checkRandomFP16ConstantPatternSet1(short actual) { + Verify.checkEQ(GOLDEN_RANDOM_PAT1, actual); + } + + + @Test + @IR(counts = {IRNode.ADD_HF, " >0 ", IRNode.SUB_HF, " >0 ", IRNode.MUL_HF, " >0 ", IRNode.DIV_HF, " >0 "}, + applyIfCPUFeatureOr = {"avx512_fp16", "true", "zfh", "true"}) + @IR(counts = {IRNode.ADD_HF, " >0 ", IRNode.SUB_HF, " >0 ", IRNode.MUL_HF, " >0 ", IRNode.DIV_HF, " >0 "}, + applyIfCPUFeatureAnd = {"fphp", "true", "asimdhp", "true"}) + @Warmup(10000) + public short testRandomFP16ConstantPatternSet2() { + short res = 0; + res += Float.floatToFloat16(RANDOM2.floatValue() + RANDOM1_VAR.floatValue()); + res += Float.floatToFloat16(RANDOM3.floatValue() - RANDOM2_VAR.floatValue()); + res += Float.floatToFloat16(RANDOM4.floatValue() * RANDOM3_VAR.floatValue()); + res += Float.floatToFloat16(RANDOM5.floatValue() / RANDOM4_VAR.floatValue()); + return res; + } + + @Check(test="testRandomFP16ConstantPatternSet2") + public void checkRandomFP16ConstantPatternSet2(short actual) { + Verify.checkEQ(GOLDEN_RANDOM_PAT2, actual); + } // // Tests points for various Float16 constant folding transforms. Following figure represents various @@ -373,41 +541,42 @@ public void testAddConstantFolding() { applyIfCPUFeatureOr = {"avx512_fp16", "true", "zfh", "true"}) @IR(counts = {IRNode.SUB_HF, " 0 ", IRNode.REINTERPRET_S2HF, " 0 ", IRNode.REINTERPRET_HF2S, " 0 "}, applyIfCPUFeatureAnd = {"fphp", "true", "asimdhp", "true"}) + @Warmup(10000) public void testSubConstantFolding() { // If either value is NaN, then the result is NaN. - assertResult(subtract(Float16.NaN, valueOf(2.0f)).floatValue(), Float.NaN, "testAddConstantFolding"); - assertResult(subtract(Float16.NaN, Float16.NaN).floatValue(), Float.NaN, "testAddConstantFolding"); - assertResult(subtract(Float16.NaN, Float16.POSITIVE_INFINITY).floatValue(), Float.NaN, "testAddConstantFolding"); + assertResult(subtract(Float16.NaN, valueOf(2.0f)).floatValue(), Float.NaN, "testSubConstantFolding"); + assertResult(subtract(Float16.NaN, Float16.NaN).floatValue(), Float.NaN, "testSubConstantFolding"); + assertResult(subtract(Float16.NaN, Float16.POSITIVE_INFINITY).floatValue(), Float.NaN, "testSubConstantFolding"); // The difference of two infinities of opposite sign is NaN. - assertResult(subtract(Float16.POSITIVE_INFINITY, Float16.NEGATIVE_INFINITY).floatValue(), Float.POSITIVE_INFINITY, "testAddConstantFolding"); + assertResult(subtract(Float16.POSITIVE_INFINITY, Float16.NEGATIVE_INFINITY).floatValue(), Float.POSITIVE_INFINITY, "testSubConstantFolding"); // The difference of two infinities of the same sign is NaN. - assertResult(subtract(Float16.POSITIVE_INFINITY, Float16.POSITIVE_INFINITY).floatValue(), Float.NaN, "testAddConstantFolding"); - assertResult(subtract(Float16.NEGATIVE_INFINITY, Float16.NEGATIVE_INFINITY).floatValue(), Float.NaN, "testAddConstantFolding"); + assertResult(subtract(Float16.POSITIVE_INFINITY, Float16.POSITIVE_INFINITY).floatValue(), Float.NaN, "testSubConstantFolding"); + assertResult(subtract(Float16.NEGATIVE_INFINITY, Float16.NEGATIVE_INFINITY).floatValue(), Float.NaN, "testSubConstantFolding"); // The difference of an infinity and a finite value is equal to the infinite operand. - assertResult(subtract(Float16.POSITIVE_INFINITY, valueOf(2.0f)).floatValue(), Float.POSITIVE_INFINITY, "testAddConstantFolding"); - assertResult(subtract(Float16.NEGATIVE_INFINITY, valueOf(2.0f)).floatValue(), Float.NEGATIVE_INFINITY, "testAddConstantFolding"); + assertResult(subtract(Float16.POSITIVE_INFINITY, valueOf(2.0f)).floatValue(), Float.POSITIVE_INFINITY, "testSubConstantFolding"); + assertResult(subtract(Float16.NEGATIVE_INFINITY, valueOf(2.0f)).floatValue(), Float.NEGATIVE_INFINITY, "testSubConstantFolding"); // The difference of two zeros of opposite sign is positive zero. - assertResult(subtract(NEGATIVE_ZERO, POSITIVE_ZERO).floatValue(), 0.0f, "testAddConstantFolding"); + assertResult(subtract(NEGATIVE_ZERO, POSITIVE_ZERO).floatValue(), 0.0f, "testSubConstantFolding"); // Number equal to -MAX_VALUE when subtracted by half upl of MAX_VALUE results into -Inf. - assertResult(subtract(NEGATIVE_MAX_VALUE, MAX_HALF_ULP).floatValue(), Float.NEGATIVE_INFINITY, "testAddConstantFolding"); + assertResult(subtract(NEGATIVE_MAX_VALUE, MAX_HALF_ULP).floatValue(), Float.NEGATIVE_INFINITY, "testSubConstantFolding"); // Number equal to -MAX_VALUE when subtracted by a number less than half upl for MAX_VALUE results into -MAX_VALUE. - assertResult(subtract(NEGATIVE_MAX_VALUE, LT_MAX_HALF_ULP).floatValue(), NEGATIVE_MAX_VALUE.floatValue(), "testAddConstantFolding"); + assertResult(subtract(NEGATIVE_MAX_VALUE, LT_MAX_HALF_ULP).floatValue(), NEGATIVE_MAX_VALUE.floatValue(), "testSubConstantFolding"); - assertResult(subtract(valueOf(1.0f), valueOf(2.0f)).floatValue(), -1.0f, "testAddConstantFolding"); + assertResult(subtract(valueOf(1.0f), valueOf(2.0f)).floatValue(), -1.0f, "testSubConstantFolding"); } @Test - @Warmup(value = 10000) @IR(counts = {IRNode.MAX_HF, " 0 ", IRNode.REINTERPRET_S2HF, " 0 ", IRNode.REINTERPRET_HF2S, " 0 "}, applyIfCPUFeatureOr = {"avx512_fp16", "true", "zfh", "true"}) @IR(counts = {IRNode.MAX_HF, " 0 ", IRNode.REINTERPRET_S2HF, " 0 ", IRNode.REINTERPRET_HF2S, " 0 "}, applyIfCPUFeatureAnd = {"fphp", "true", "asimdhp", "true"}) + @Warmup(10000) public void testMaxConstantFolding() { // If either value is NaN, then the result is NaN. assertResult(max(valueOf(2.0f), Float16.NaN).floatValue(), Float.NaN, "testMaxConstantFolding"); @@ -428,6 +597,7 @@ public void testMaxConstantFolding() { applyIfCPUFeatureOr = {"avx512_fp16", "true", "zfh", "true"}) @IR(counts = {IRNode.MIN_HF, " 0 ", IRNode.REINTERPRET_S2HF, " 0 ", IRNode.REINTERPRET_HF2S, " 0 "}, applyIfCPUFeatureAnd = {"fphp", "true", "asimdhp", "true"}) + @Warmup(10000) public void testMinConstantFolding() { // If either value is NaN, then the result is NaN. assertResult(min(valueOf(2.0f), Float16.NaN).floatValue(), Float.NaN, "testMinConstantFolding"); @@ -447,6 +617,7 @@ public void testMinConstantFolding() { applyIfCPUFeatureOr = {"avx512_fp16", "true", "zfh", "true"}) @IR(counts = {IRNode.DIV_HF, " 0 ", IRNode.REINTERPRET_S2HF, " 0 ", IRNode.REINTERPRET_HF2S, " 0 "}, applyIfCPUFeatureAnd = {"fphp", "true", "asimdhp", "true"}) + @Warmup(10000) public void testDivConstantFolding() { // If either value is NaN, then the result is NaN. assertResult(divide(Float16.NaN, POSITIVE_ZERO).floatValue(), Float.NaN, "testDivConstantFolding"); @@ -489,6 +660,7 @@ public void testDivConstantFolding() { applyIfCPUFeatureOr = {"avx512_fp16", "true", "zfh", "true"}) @IR(counts = {IRNode.MUL_HF, " 0 ", IRNode.REINTERPRET_S2HF, " 0 ", IRNode.REINTERPRET_HF2S, " 0 "}, applyIfCPUFeatureAnd = {"fphp", "true", "asimdhp", "true"}) + @Warmup(10000) public void testMulConstantFolding() { // If any operand is NaN, the result is NaN. assertResult(multiply(Float16.NaN, valueOf(4.0f)).floatValue(), Float.NaN, "testMulConstantFolding"); @@ -514,6 +686,7 @@ public void testMulConstantFolding() { applyIfCPUFeatureOr = {"avx512_fp16", "true", "zfh", "true"}) @IR(counts = {IRNode.SQRT_HF, " 0 ", IRNode.REINTERPRET_S2HF, " 0 ", IRNode.REINTERPRET_HF2S, " 0 "}, applyIfCPUFeatureAnd = {"fphp", "true", "asimdhp", "true"}) + @Warmup(10000) public void testSqrtConstantFolding() { // If the argument is NaN or less than zero, then the result is NaN. assertResult(sqrt(Float16.NaN).floatValue(), Float.NaN, "testSqrtConstantFolding"); @@ -535,6 +708,7 @@ public void testSqrtConstantFolding() { applyIfCPUFeatureOr = {"avx512_fp16", "true", "zfh", "true"}) @IR(counts = {IRNode.FMA_HF, " 0 ", IRNode.REINTERPRET_S2HF, " 0 ", IRNode.REINTERPRET_HF2S, " 0 "}, applyIfCPUFeatureAnd = {"fphp", "true", "asimdhp", "true"}) + @Warmup(10000) public void testFMAConstantFolding() { // If any argument is NaN, the result is NaN. assertResult(fma(Float16.NaN, valueOf(2.0f), valueOf(3.0f)).floatValue(), Float.NaN, "testFMAConstantFolding"); @@ -572,6 +746,7 @@ public void testFMAConstantFolding() { applyIfCPUFeatureOr = {"avx512_fp16", "true", "zfh", "true"}) @IR(failOn = {IRNode.ADD_HF, IRNode.SUB_HF, IRNode.MUL_HF, IRNode.DIV_HF, IRNode.SQRT_HF, IRNode.FMA_HF}, applyIfCPUFeatureAnd = {"fphp", "true", "asimdhp", "true"}) + @Warmup(10000) public void testRounding1() { dst[0] = float16ToRawShortBits(add(RANDOM1, RANDOM2)); dst[1] = float16ToRawShortBits(subtract(RANDOM2, RANDOM3)); @@ -608,13 +783,13 @@ public void checkRounding1() { } @Test - @Warmup(value = 10000) @IR(counts = {IRNode.ADD_HF, " >0 ", IRNode.SUB_HF, " >0 ", IRNode.MUL_HF, " >0 ", IRNode.DIV_HF, " >0 ", IRNode.SQRT_HF, " >0 ", IRNode.FMA_HF, " >0 "}, applyIfCPUFeatureOr = {"avx512_fp16", "true", "zfh", "true"}) @IR(counts = {IRNode.ADD_HF, " >0 ", IRNode.SUB_HF, " >0 ", IRNode.MUL_HF, " >0 ", IRNode.DIV_HF, " >0 ", IRNode.SQRT_HF, " >0 ", IRNode.FMA_HF, " >0 "}, applyIfCPUFeatureAnd = {"fphp", "true", "asimdhp", "true"}) + @Warmup(10000) public void testRounding2() { dst[0] = float16ToRawShortBits(add(RANDOM1_VAR, RANDOM2_VAR)); dst[1] = float16ToRawShortBits(subtract(RANDOM2_VAR, RANDOM3_VAR)); diff --git a/test/hotspot/jtreg/compiler/c2/irTests/stringopts/TestArrayCopySelect.java b/test/hotspot/jtreg/compiler/c2/irTests/stringopts/TestArrayCopySelect.java new file mode 100644 index 00000000000..4743f61ac39 --- /dev/null +++ b/test/hotspot/jtreg/compiler/c2/irTests/stringopts/TestArrayCopySelect.java @@ -0,0 +1,118 @@ +/* + * Copyright (c) 2025, Institute of Software, Chinese Academy of Sciences. + * 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. + * + * 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 compiler.c2.irTests.stringopts; + +import compiler.lib.ir_framework.*; + +/** + * @test + * @bug 8359270 + * @requires vm.debug == true & vm.compiler2.enabled + * @requires os.arch=="amd64" | os.arch=="x86_64" | os.arch=="riscv64" | os.arch=="aarch64" + * @summary C2: alignment check should consider base offset when emitting arraycopy runtime call. + * @library /test/lib / + * @run driver compiler.c2.irTests.stringopts.TestArrayCopySelect + */ + +public class TestArrayCopySelect { + + public static final String input_strU = "\u0f21\u0f22\u0f23\u0f24\u0f25\u0f26\u0f27\u0f28"; + public static final char[] input_arrU = new char[] {'\u0f21', '\u0f22', '\u0f23', '\u0f24', + '\u0f25', '\u0f26', '\u0f27', '\u0f28'}; + + public static String output_strU; + public static char[] output_arrU; + + public static void main(String[] args) { + TestFramework.runWithFlags("-XX:-UseCompactObjectHeaders", + "-XX:-CompactStrings", + "-XX:CompileCommand=inline,java.lang.StringBuilder::toString", + "-XX:CompileCommand=inline,java.lang.StringUTF16::getChars", + "-XX:CompileCommand=inline,java.lang.StringUTF16::toBytes"); + + TestFramework.runWithFlags("-XX:+UseCompactObjectHeaders", + "-XX:-CompactStrings", + "-XX:CompileCommand=inline,java.lang.StringBuilder::toString", + "-XX:CompileCommand=inline,java.lang.StringUTF16::getChars", + "-XX:CompileCommand=inline,java.lang.StringUTF16::toBytes"); + } + + @Test + @Warmup(10000) + @IR(applyIf = {"UseCompactObjectHeaders", "false"}, + counts = {IRNode.CALL_OF, "arrayof_jshort_disjoint_arraycopy", ">0"}) + static void testSBToStringAligned() { + // Exercise the StringBuilder.toString API + StringBuilder sb = new StringBuilder(input_strU); + output_strU = sb.append(input_strU).toString(); + } + + @Test + @Warmup(10000) + @IR(applyIf = {"UseCompactObjectHeaders", "true"}, + counts = {IRNode.CALL_OF, "arrayof_jshort_disjoint_arraycopy", "0"}) + static void testSBToStringUnAligned() { + // Exercise the StringBuilder.toString API + StringBuilder sb = new StringBuilder(input_strU); + output_strU = sb.append(input_strU).toString(); + } + + @Test + @Warmup(10000) + @IR(applyIf = {"UseCompactObjectHeaders", "false"}, + counts = {IRNode.CALL_OF, "arrayof_jshort_disjoint_arraycopy", ">0"}) + static void testStrUGetCharsAligned() { + // Exercise the StringUTF16.getChars API + output_arrU = input_strU.toCharArray(); + } + + @Test + @Warmup(10000) + @IR(applyIf = {"UseCompactObjectHeaders", "true"}, + counts = {IRNode.CALL_OF, "arrayof_jshort_disjoint_arraycopy", "0"}) + static void testStrUGetCharsUnAligned() { + // Exercise the StringUTF16.getChars API + output_arrU = input_strU.toCharArray(); + } + + @Test + @Warmup(10000) + @IR(applyIf = {"UseCompactObjectHeaders", "false"}, + counts = {IRNode.CALL_OF, "arrayof_jshort_disjoint_arraycopy", ">0"}) + static void testStrUtoBytesAligned() { + // Exercise the StringUTF16.toBytes API + output_strU = String.valueOf(input_arrU); + } + + @Test + @Warmup(10000) + @IR(applyIf = {"UseCompactObjectHeaders", "true"}, + counts = {IRNode.CALL_OF, "arrayof_jshort_disjoint_arraycopy", "0"}) + static void testStrUtoBytesUnAligned() { + // Exercise the StringUTF16.toBytes API + output_strU = String.valueOf(input_arrU); + } + +} diff --git a/test/hotspot/jtreg/compiler/codecache/CheckSegmentedCodeCache.java b/test/hotspot/jtreg/compiler/codecache/CheckSegmentedCodeCache.java index 139ea6d76a2..06b51b1641d 100644 --- a/test/hotspot/jtreg/compiler/codecache/CheckSegmentedCodeCache.java +++ b/test/hotspot/jtreg/compiler/codecache/CheckSegmentedCodeCache.java @@ -188,7 +188,7 @@ public static void main(String[] args) throws Exception { failsWith(pb, "Invalid code heap sizes"); // Fails if not enough space for VM internal code - long minUseSpace = WHITE_BOX.getUintxVMFlag("CodeCacheMinimumUseSpace"); + long minUseSpace = WHITE_BOX.getSizeTVMFlag("CodeCacheMinimumUseSpace"); // minimum size: CodeCacheMinimumUseSpace DEBUG_ONLY(* 3) long minSize = (Platform.isDebugBuild() ? 3 : 1) * minUseSpace; pb = ProcessTools.createLimitedTestJavaProcessBuilder("-XX:+SegmentedCodeCache", diff --git a/test/hotspot/jtreg/compiler/codecache/CodeCacheSegmentSizeTest.java b/test/hotspot/jtreg/compiler/codecache/CodeCacheSegmentSizeTest.java new file mode 100644 index 00000000000..5531bdd1517 --- /dev/null +++ b/test/hotspot/jtreg/compiler/codecache/CodeCacheSegmentSizeTest.java @@ -0,0 +1,77 @@ +/* + * Copyright (c) 2025 IBM Corporation. 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. + * + * 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. + */ + +/* + * @test + * @bug 8358694 + * @summary Verifies that CodeCacheSegmentSize enforces power-of-two constraint: + * - fails gracefully for invalid value + * - succeeds for valid value + * @library /test/lib + * @run driver CodeCacheSegmentSizeTest + */ + +import jdk.test.lib.Platform; +import jdk.test.lib.process.ProcessTools; +import jdk.test.lib.process.OutputAnalyzer; + +public class CodeCacheSegmentSizeTest { + public static void main(String[] args) throws Exception { + testInvalidValue(); + testValidValue(); + } + + private static void testInvalidValue() throws Exception { + ProcessBuilder pb = ProcessTools.createLimitedTestJavaProcessBuilder( + "-XX:+UnlockExperimentalVMOptions", + "-XX:CodeCacheSegmentSize=65", // invalid value (not power of two) + "-version" + ); + + OutputAnalyzer output = new OutputAnalyzer(pb.start()); + + // Ensure no crash (no assert failure) + output.shouldNotContain("assert"); + + // Expected graceful error output + output.shouldContain("CodeCacheSegmentSize (65) must be a power of two"); + output.shouldContain("Error: Could not create the Java Virtual Machine."); + output.shouldContain("Error: A fatal exception has occurred. Program will exit."); + + // Graceful exit with error code 1 + output.shouldHaveExitValue(1); + } + + private static void testValidValue() throws Exception { + ProcessBuilder pb = ProcessTools.createLimitedTestJavaProcessBuilder( + "-XX:+UnlockExperimentalVMOptions", + "-XX:CodeCacheSegmentSize=64", // a valid power of 2 + "-version" + ); + + OutputAnalyzer output = new OutputAnalyzer(pb.start()); + + output.shouldHaveExitValue(0); + } +} + diff --git a/test/hotspot/jtreg/compiler/codecache/jmx/CodeCacheUtils.java b/test/hotspot/jtreg/compiler/codecache/jmx/CodeCacheUtils.java index 340021bb993..ab017a9ecf0 100644 --- a/test/hotspot/jtreg/compiler/codecache/jmx/CodeCacheUtils.java +++ b/test/hotspot/jtreg/compiler/codecache/jmx/CodeCacheUtils.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2025, 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 @@ -41,9 +41,9 @@ public final class CodeCacheUtils { = Integer.getInteger("codecache.allocation.size", 100); public static final WhiteBox WB = WhiteBox.getWhiteBox(); public static final long SEGMENT_SIZE - = WhiteBox.getWhiteBox().getUintxVMFlag("CodeCacheSegmentSize"); + = WhiteBox.getWhiteBox().getSizeTVMFlag("CodeCacheSegmentSize"); public static final long MIN_BLOCK_LENGTH - = WhiteBox.getWhiteBox().getUintxVMFlag("CodeCacheMinBlockLength"); + = WhiteBox.getWhiteBox().getSizeTVMFlag("CodeCacheMinBlockLength"); public static final long MIN_ALLOCATION = SEGMENT_SIZE * MIN_BLOCK_LENGTH; private CodeCacheUtils() { diff --git a/test/hotspot/jtreg/compiler/codecache/stress/RandomAllocationTest.java b/test/hotspot/jtreg/compiler/codecache/stress/RandomAllocationTest.java index 72e605397d0..26d3556d10e 100644 --- a/test/hotspot/jtreg/compiler/codecache/stress/RandomAllocationTest.java +++ b/test/hotspot/jtreg/compiler/codecache/stress/RandomAllocationTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2025, 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 @@ -53,7 +53,7 @@ public class RandomAllocationTest implements Runnable { private static final long CODE_CACHE_SIZE - = Helper.WHITE_BOX.getUintxVMFlag("ReservedCodeCacheSize"); + = Helper.WHITE_BOX.getSizeTVMFlag("ReservedCodeCacheSize"); private static final int MAX_BLOB_SIZE = (int) (CODE_CACHE_SIZE >> 7); private static final BlobType[] BLOB_TYPES = BlobType.getAvailable().toArray(new BlobType[0]); diff --git a/test/hotspot/jtreg/compiler/codecache/stress/ReturnBlobToWrongHeapTest.java b/test/hotspot/jtreg/compiler/codecache/stress/ReturnBlobToWrongHeapTest.java index c66c2a22f14..a77b3681bf2 100644 --- a/test/hotspot/jtreg/compiler/codecache/stress/ReturnBlobToWrongHeapTest.java +++ b/test/hotspot/jtreg/compiler/codecache/stress/ReturnBlobToWrongHeapTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2017, 2025, 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 @@ -48,8 +48,8 @@ import java.util.ArrayList; public class ReturnBlobToWrongHeapTest { - private static final long largeBlobSize = Helper.WHITE_BOX.getUintxVMFlag("ReservedCodeCacheSize") >> 6; - private static final long codeCacheMinBlockLength = Helper.WHITE_BOX.getUintxVMFlag("CodeCacheMinBlockLength"); + private static final long largeBlobSize = Helper.WHITE_BOX.getSizeTVMFlag("ReservedCodeCacheSize") >> 6; + private static final long codeCacheMinBlockLength = Helper.WHITE_BOX.getSizeTVMFlag("CodeCacheMinBlockLength"); private static final BlobType[] BLOB_TYPES = BlobType.getAvailable().toArray(new BlobType[0]); // Allocate blob in first code heap (the code heap with index 0). diff --git a/test/hotspot/jtreg/compiler/codegen/TestRedundantLea.java b/test/hotspot/jtreg/compiler/codegen/TestRedundantLea.java new file mode 100644 index 00000000000..e58f8660131 --- /dev/null +++ b/test/hotspot/jtreg/compiler/codegen/TestRedundantLea.java @@ -0,0 +1,382 @@ +/* + * Copyright (c) 2025, 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. + * + * 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. + */ + +/* + * @test id=GetAndSet + * @bug 8020282 + * @summary Test that we do not generate redundant leas on x86 for AtomicReference.getAndSet. + * @requires os.simpleArch == "x64" & vm.opt.TieredCompilation != false + * @modules jdk.compiler/com.sun.tools.javac.util + * @library /test/lib / + * @run driver compiler.codegen.TestRedundantLea GetAndSet + */ + +/* + * @test id=StringEquals + * @bug 8020282 + * @summary Test that we do not generate redundant leas on x86 for String.Equals. + * @requires os.simpleArch == "x64" & vm.opt.TieredCompilation != false + * @modules jdk.compiler/com.sun.tools.javac.util + * @library /test/lib / + * @run driver compiler.codegen.TestRedundantLea StringEquals + */ + +/* + * @test id=StringInflate + * @bug 8020282 + * @summary Test that we do not generate redundant leas on x86 for StringConcat intrinsics. + * @requires os.simpleArch == "x64" & vm.opt.TieredCompilation != false + * @modules jdk.compiler/com.sun.tools.javac.util + * @library /test/lib / + * @run driver compiler.codegen.TestRedundantLea StringInflate + */ + +/* + * @test id=RegexFind + * @bug 8020282 + * @summary Test that we do not generate redundant leas on x86 when performing regex matching. + * @requires os.simpleArch == "x64" & vm.opt.TieredCompilation != false & vm.opt.UseAvx == 3 + * @modules jdk.compiler/com.sun.tools.javac.util + * @library /test/lib / + * @run driver compiler.codegen.TestRedundantLea RegexFind + */ + +/* + * @test id=StoreNSerial + * @bug 8020282 + * @summary Test that we do not generate redundant leas on x86 when storing narrow oops to object arrays. + * @requires os.simpleArch == "x64" & vm.gc.Serial + * @modules jdk.compiler/com.sun.tools.javac.util + * @library /test/lib / + * @run driver compiler.codegen.TestRedundantLea StoreNSerial + */ + +/* + * @test id=StoreNParallel + * @bug 8020282 + * @summary Test that we do not generate redundant leas on x86 when storing narrow oops to object arrays. + * @requires os.simpleArch == "x64" & vm.gc.Parallel + * @modules jdk.compiler/com.sun.tools.javac.util + * @library /test/lib / + * @run driver compiler.codegen.TestRedundantLea StoreNParallel + */ + + +package compiler.codegen; + +import java.util.concurrent.atomic.*; +import java.util.regex.Matcher; +import java.util.regex.Pattern; + +import com.sun.tools.javac.util.*; + +import compiler.lib.ir_framework.*; + +// The following tests ensure that we do not generate a redundant lea instruction on x86. +// These get generated on chained dereferences for the rules leaPCompressedOopOffset, +// leaP8Narrow, and leaP32Narrow and stem from a decodeHeapOopNotNull that is not needed +// unless the derived oop is added to an oop map. The redundant lea is removed with an +// opto assembly peephole optimization. Hence, all tests below feature a negative test +// run with -XX:-OptoPeephole to detect changes that obsolete that peephole. +// Further, all tests are run with different max heap sizes to trigger the generation of +// different lea match rules: -XX:MaxHeapSize=32m generates leaP(8|32)Narrow and +// -XX:MaxHeapSize=4g generates leaPCompressedOopOffset, since the address computation +// needs to shift left by 3. +public class TestRedundantLea { + public static void main(String[] args) { + String testName = args[0]; + TestFramework framework; + switch (testName) { + case "GetAndSet" -> { + framework = new TestFramework(GetAndSetTest.class); + } + case "StringEquals" -> { + framework = new TestFramework(StringEqualsTest.class); + framework.addHelperClasses(StringEqualsTestHelper.class); + } + case "StringInflate" -> { + framework = new TestFramework(StringInflateTest.class); + framework.addFlags("--add-exports=jdk.compiler/com.sun.tools.javac.util=ALL-UNNAMED"); + } + case "RegexFind" -> { + framework = new TestFramework(RegexFindTest.class); + } + case "StoreNSerial" -> { + framework = new TestFramework(StoreNTest.class); + framework.addFlags("-XX:+UseSerialGC"); + } + case "StoreNParallel" -> { + framework = new TestFramework(StoreNTest.class); + framework.addFlags("-XX:+UseParallelGC"); + } + default -> { + throw new IllegalArgumentException("Unknown test name \"" + testName +"\""); + } + } + + Scenario[] scenarios = new Scenario[2]; + // Scenario for the negative test without peephole optimizations. + scenarios[0] = new Scenario(0, "-XX:+IgnoreUnrecognizedVMOptions", "-XX:-OptoPeephole"); + // Scenario for the positive test with +OptoPeephole (the default on x64). + scenarios[1] = new Scenario(1); + framework.addScenarios(scenarios).start(); + } +} + +// This generates a leaP* rule for the chained dereference of obj.value that +// gets passed to the get and set VM intrinsic. +class GetAndSetTest { + private static final Object CURRENT = new Object(); + private final AtomicReference obj = new AtomicReference(); + + @Test + @IR(counts = {IRNode.LEA_P, "=1"}, + phase = {CompilePhase.FINAL_CODE}, + applyIfPlatform = {"mac", "false"}) + // Negative test + @IR(counts = {IRNode.DECODE_HEAP_OOP_NOT_NULL, "=1"}, + phase = {CompilePhase.FINAL_CODE}, + applyIf = {"OptoPeephole", "false"}) + // Test that the peephole worked for leaP(8|32)Narrow + @IR(failOn = {IRNode.DECODE_HEAP_OOP_NOT_NULL}, + phase = {CompilePhase.FINAL_CODE}, + applyIf = {"OptoPeephole", "true"}) + public void testGetAndSet() { + obj.getAndSet(CURRENT); + } +} + +// This generates leaP* rules for the chained dereferences of the String.value +// fields that are used in the string_equals VM intrinsic. +class StringEqualsTest { + final StringEqualsTestHelper strEqHelper = new StringEqualsTestHelper("I am the string that is tested against"); + + @Setup + private static Object[] setup() { + return new Object[]{"I will be compared!"}; + } + + @Test + @IR(counts = {IRNode.LEA_P, "=2"}, + phase = {CompilePhase.FINAL_CODE}, + applyIfPlatform = {"mac", "false"}) + // Negative test + @IR(counts = {IRNode.DECODE_HEAP_OOP_NOT_NULL, "=3"}, + phase = {CompilePhase.FINAL_CODE}, + applyIf = {"OptoPeephole", "false"}) + // Test that the peephole worked for leaPCompressedOopOffset + @IR(counts = {IRNode.DECODE_HEAP_OOP_NOT_NULL, "=1"}, + phase = {CompilePhase.FINAL_CODE}, + applyIf = {"OptoPeephole", "true"}) + @Arguments(setup = "setup") + public boolean test(String str) { + return strEqHelper.doEquals(str); + } +} + +class StringEqualsTestHelper { + private String str; + + public StringEqualsTestHelper(String str) { + this.str = str; + } + + @ForceInline + public boolean doEquals(String other) { + return this.str.equals(other); + } +} + +// With all VM instrinsics disabled, this test only generates a leaP* rule +// before the string_inflate intrinsic (with -XX:-OptimizeStringConcat no +// leaP* rule is generated). With VM intrinsics enabled (this is the case +// here) leaP* rules are also generated for the string_equals and arrays_hashcode +// VM instrinsics. +// This generates a larger number of decodes for -XX:UseAVX={0,1} than for +// other flags. +class StringInflateTest { + @Setup + private static Object[] setup() { + Names names = new Names(new Context()); + Name n1 = names.fromString("one"); + Name n2 = names.fromString("two"); + return new Object[] {n1, n2}; + } + + @Test + @IR(counts = {IRNode.LEA_P, "=2"}, + phase = {CompilePhase.FINAL_CODE}, + applyIfPlatform = {"mac", "false"}) + // Negative + @IR(counts = {IRNode.DECODE_HEAP_OOP_NOT_NULL, "=5"}, + phase = {CompilePhase.FINAL_CODE}, + applyIfAnd = {"OptoPeephole", "false", "UseAVX", ">=2"}) + @IR(counts = {IRNode.DECODE_HEAP_OOP_NOT_NULL, "=13"}, + phase = {CompilePhase.FINAL_CODE}, + applyIfAnd = {"OptoPeephole", "false", "UseAVX", "<2"}) + // 2 decodes get removed + @IR(counts = {IRNode.DECODE_HEAP_OOP_NOT_NULL, "=3"}, + phase = {CompilePhase.FINAL_CODE}, + applyIfAnd = {"OptoPeephole", "true", "UseAVX", ">=2"}) + @IR(counts = {IRNode.DECODE_HEAP_OOP_NOT_NULL, "=11"}, + phase = {CompilePhase.FINAL_CODE}, + applyIfAnd = {"OptoPeephole", "true", "UseAVX", "<2"}) + @Arguments(setup = "setup") + public static Name test(Name n1, Name n2) { + return n1.append(n2); + } +} + +// This test case generates leaP* rules before arrayof_jint_fill intrinsics, +// but only with -XX:+UseAVX3. +class RegexFindTest { + @Setup + private static Object[] setup() { + Pattern pat = Pattern.compile("27"); + Matcher m = pat.matcher(" 274 leaPCompressedOopOffset === _ 275 277 [[ 2246 165 294 ]] #16/0x0000000000000010byte[int:>=0]"); + return new Object[] { m }; + } + + @Test + @IR(counts = {IRNode.LEA_P, "=1"}, + phase = {CompilePhase.FINAL_CODE}, + applyIfPlatform = {"mac", "false"}) + // Due to unpredictable code generation, we cannot match the exact number of decodes below. + // Negative test + @IR(counts = {IRNode.DECODE_HEAP_OOP_NOT_NULL, ">=7"}, + phase = {CompilePhase.FINAL_CODE}, + applyIfAnd = {"OptoPeephole", "false", "UseAVX", "=3"}) + // Test that the peephole worked for leaPCompressedOopOffset + @IR(counts = {IRNode.DECODE_HEAP_OOP_NOT_NULL, ">=6"}, + phase = {CompilePhase.FINAL_CODE}, + applyIfAnd = {"OptoPeephole", "true", "UseAVX", "=3"}) + @Arguments(setup = "setup") + public boolean test(Matcher m) { + return m.find(); + } +} + +// The matcher generates leaP* rules for storing an object in an array of objects +// at a constant offset, but only when using the Serial or Parallel GC. +// Here, we can also manipulate the offset such that we get a leaP32Narrow rule +// and we can demonstrate that the peephole also removes simple cases of unneeded +// spills. +class StoreNTest { + private static final int SOME_SIZE = 42; + private static final int OFFSET8BIT_IDX = 3; + private static final int OFFSET32BIT_IDX = 33; + + private static final Object CURRENT = new Object(); + private static final Object OTHER = new Object(); + + private StoreNTestHelper[] classArr8bit = new StoreNTestHelper[SOME_SIZE]; + private StoreNTestHelper[] classArr32bit = new StoreNTestHelper[SOME_SIZE]; + private Object[] objArr8bit = new Object[SOME_SIZE]; + private Object[] objArr32bit = new Object[SOME_SIZE]; + + @Test + @IR(counts = {IRNode.LEA_P, "=2"}, + phase = {CompilePhase.FINAL_CODE}, + applyIfPlatform = {"mac", "false"}) + // Negative test + @IR(counts = {IRNode.DECODE_HEAP_OOP_NOT_NULL, "=2"}, + phase = {CompilePhase.FINAL_CODE}, + applyIf = {"OptoPeephole", "false"}) + // Test that the peephole worked for leaPCompressedOopOffset + @IR(failOn = {IRNode.DECODE_HEAP_OOP_NOT_NULL}, + phase = {CompilePhase.FINAL_CODE}, + applyIf = {"OptoPeephole", "true"}) + // Test that the peephole removes a spill. + @IR(counts = {IRNode.MEM_TO_REG_SPILL_COPY, "=4"}, + phase = {CompilePhase.FINAL_CODE}, + applyIfAnd ={"OptoPeephole", "false", "UseCompactObjectHeaders", "false"}) + @IR(counts = {IRNode.MEM_TO_REG_SPILL_COPY, "=3"}, + phase = {CompilePhase.FINAL_CODE}, + applyIfAnd ={"OptoPeephole", "true", "UseCompactObjectHeaders", "false"}) + public void testRemoveSpill() { + this.classArr8bit[OFFSET8BIT_IDX] = new StoreNTestHelper(CURRENT, OTHER); + this.classArr32bit[OFFSET32BIT_IDX] = new StoreNTestHelper(OTHER, CURRENT); + } + + // This variation of the test above generates a split spill register path. + // Due to the complicated graph structure with the phis, the peephole + // cannot remove the redundant decode shared by both leaP*s. + @Test + @IR(counts = {IRNode.LEA_P, "=2"}, + phase = {CompilePhase.FINAL_CODE}, + applyIfPlatform = {"mac", "false"}) + @IR(counts = {IRNode.DECODE_HEAP_OOP_NOT_NULL, "=1"}, + phase = {CompilePhase.FINAL_CODE}, + applyIf = {"OptoPeephole", "false"}) + @IR(counts = {IRNode.DECODE_HEAP_OOP_NOT_NULL, "=1"}, + phase = {CompilePhase.FINAL_CODE}, + applyIf = {"OptoPeephole", "true"}) + public void testPhiSpill() { + this.classArr8bit[OFFSET8BIT_IDX] = new StoreNTestHelper(CURRENT, OTHER); + this.classArr8bit[OFFSET32BIT_IDX] = new StoreNTestHelper(CURRENT, OTHER); + } + + @Test + @IR(counts = {IRNode.LEA_P, "=2"}, + phase = {CompilePhase.FINAL_CODE}, + applyIfPlatform = {"mac", "false"}) + // Negative test + @IR(counts = {IRNode.DECODE_HEAP_OOP_NOT_NULL, "=2"}, + phase = {CompilePhase.FINAL_CODE}, + applyIf = {"OptoPeephole", "false"}) + // Test that the peephole worked for leaPCompressedOopOffset + @IR(failOn = {IRNode.DECODE_HEAP_OOP_NOT_NULL}, + phase = {CompilePhase.FINAL_CODE}, + applyIf = {"OptoPeephole", "true"}) + public void testNoAlloc() { + this.objArr8bit[OFFSET8BIT_IDX] = CURRENT; + this.objArr32bit[OFFSET32BIT_IDX] = OTHER; + } + + @Test + @IR(counts = {IRNode.LEA_P, "=2"}, + phase = {CompilePhase.FINAL_CODE}, + applyIfPlatform = {"mac", "false"}) + // Negative test + @IR(counts = {IRNode.DECODE_HEAP_OOP_NOT_NULL, "=1"}, + phase = {CompilePhase.FINAL_CODE}, + applyIf = {"OptoPeephole", "false"}) + // Test that the peephole worked for leaPCompressedOopOffset + @IR(failOn = {IRNode.DECODE_HEAP_OOP_NOT_NULL}, + phase = {CompilePhase.FINAL_CODE}, + applyIf = {"OptoPeephole", "true"}) + public void testNoAllocSameArray() { + this.objArr8bit[OFFSET8BIT_IDX] = CURRENT; + this.objArr8bit[OFFSET32BIT_IDX] = OTHER; + } +} + +class StoreNTestHelper { + Object o1; + Object o2; + + public StoreNTestHelper(Object o1, Object o2) { + this.o1 = o1; + this.o2 = o2; + } +} diff --git a/test/hotspot/jtreg/compiler/gcbarriers/TestImplicitNullChecks.java b/test/hotspot/jtreg/compiler/gcbarriers/TestImplicitNullChecks.java index a77a51312de..34583b8fea9 100644 --- a/test/hotspot/jtreg/compiler/gcbarriers/TestImplicitNullChecks.java +++ b/test/hotspot/jtreg/compiler/gcbarriers/TestImplicitNullChecks.java @@ -67,7 +67,10 @@ public static void main(String[] args) { } @Test - @IR(applyIfOr = {"UseZGC", "true", "UseG1GC", "true"}, + // On AIX, implicit null checks are limited because the zero page is + // readable (but not writable). See os::zero_page_read_protected(). + @IR(applyIfPlatform = {"aix", "false"}, + applyIfOr = {"UseZGC", "true", "UseG1GC", "true"}, counts = {IRNode.NULL_CHECK, "1"}, phase = CompilePhase.FINAL_CODE) static Object testLoad(Outer o) { diff --git a/test/hotspot/jtreg/compiler/igvn/RemoveDeadRegionFromVectorizedMismatchIntrinsic.java b/test/hotspot/jtreg/compiler/igvn/RemoveDeadRegionFromVectorizedMismatchIntrinsic.java new file mode 100644 index 00000000000..e2f0bbf547a --- /dev/null +++ b/test/hotspot/jtreg/compiler/igvn/RemoveDeadRegionFromVectorizedMismatchIntrinsic.java @@ -0,0 +1,54 @@ +/* + * Copyright (c) 2025, 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. + * + * 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. + */ + +/** + * @test + * @bug 8359121 + * @summary Region node introduced by ArraysSupport.mismatch must be disconnected, + * and not just put aside as dead: when simplifying + * Proj -> Region -> If -> ... + * into + * Proj -> If -> ... + * -> Region + * the dead Region node must be removed from Proj's outputs. + * @modules java.base/jdk.internal.util + * @run main/othervm -Xcomp + * -XX:CompileCommand=compileonly,compiler.igvn.RemoveDeadRegionFromVectorizedMismatchIntrinsic::test + * compiler.igvn.RemoveDeadRegionFromVectorizedMismatchIntrinsic + * @run main compiler.igvn.RemoveDeadRegionFromVectorizedMismatchIntrinsic + */ +package compiler.igvn; + +import jdk.internal.util.ArraysSupport; + +public class RemoveDeadRegionFromVectorizedMismatchIntrinsic { + public static void main(String[] args) { + ArraysSupport.mismatch(new int[0], new int[0], 0); // loads ArraysSupport + test(new byte[0], new byte[0]); + } + + public static int test(byte[] a, byte[] b) { + int i = ArraysSupport.vectorizedMismatch(a, 0, b, 0, 0, 0); + return i >= 0 ? i : 0; + } +} diff --git a/test/hotspot/jtreg/compiler/intrinsics/bmi/BMITestRunner.java b/test/hotspot/jtreg/compiler/intrinsics/bmi/BMITestRunner.java index b005d767287..9d2a731c6e5 100644 --- a/test/hotspot/jtreg/compiler/intrinsics/bmi/BMITestRunner.java +++ b/test/hotspot/jtreg/compiler/intrinsics/bmi/BMITestRunner.java @@ -122,10 +122,11 @@ public static OutputAnalyzer runTest(Class expr, List vmOpts = new LinkedList(); Collections.addAll(vmOpts, additionalVMOpts); - // Hide timestamps from warnings (e.g. due to potential CDS + // Hide timestamps from warnings (e.g. due to potential AOT // saved/runtime state mismatch), to avoid false positives when // comparing output across runs. vmOpts.add("-Xlog:all=warning:stdout:level,tags"); + vmOpts.add("-Xlog:aot=off"); //setup mode-specific options switch (testVMMode) { diff --git a/test/hotspot/jtreg/compiler/intrinsics/bmi/verifycode/AndnTestI.java b/test/hotspot/jtreg/compiler/intrinsics/bmi/verifycode/AndnTestI.java index 4ff18b0744c..4145b0f5641 100644 --- a/test/hotspot/jtreg/compiler/intrinsics/bmi/verifycode/AndnTestI.java +++ b/test/hotspot/jtreg/compiler/intrinsics/bmi/verifycode/AndnTestI.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2025, 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 @@ -57,6 +57,19 @@ protected AndnTestI(Method method) { (byte) 0x02, // 00010 implied 0F 38 leading opcode bytes (byte) 0x00, (byte) 0xF2}; + // from intel apx specifications EVEX.128.NP.0F38.W0 F2 /r + instrMaskAPX = new byte[]{ + (byte) 0xFF, + (byte) 0x07, + (byte) 0x00, + (byte) 0x00, + (byte) 0xFF}; + instrPatternAPX = new byte[]{ + (byte) 0x62, // fixed prefix byte 0x62 for extended EVEX instruction + (byte) 0x02, // 00010 implied 0F 38 leading opcode bytes + (byte) 0x00, + (byte) 0x00, + (byte) 0xF2}; } public static void main(String[] args) throws Exception { diff --git a/test/hotspot/jtreg/compiler/intrinsics/bmi/verifycode/BlsiTestI.java b/test/hotspot/jtreg/compiler/intrinsics/bmi/verifycode/BlsiTestI.java index 17a11146f4e..346169f1aad 100644 --- a/test/hotspot/jtreg/compiler/intrinsics/bmi/verifycode/BlsiTestI.java +++ b/test/hotspot/jtreg/compiler/intrinsics/bmi/verifycode/BlsiTestI.java @@ -59,6 +59,23 @@ protected BlsiTestI(Method method) { (byte) 0x00, (byte) 0xF3, (byte) 0b0001_1000}; // bits 543 == 011 (3) + + // from intel apx specifications EVEX.128.NP.0F38.W0 F3 /3(opcode extension) + instrMaskAPX = new byte[]{ + (byte) 0xFF, + (byte) 0x07, + (byte) 0x00, + (byte) 0x00, + (byte) 0xFF, + (byte) 0x38}; + + instrPatternAPX = new byte[]{ + (byte) 0x62, // fixed prefix byte 0x62 for extended EVEX instruction + (byte) 0x02, // 00010 implied 0F 38 leading opcode bytes + (byte) 0x00, + (byte) 0x00, + (byte) 0xF3, + (byte) 0b0001_1000}; // bits 543 == 011 (3) } public static void main(String[] args) throws Exception { diff --git a/test/hotspot/jtreg/compiler/intrinsics/bmi/verifycode/BlsmskTestI.java b/test/hotspot/jtreg/compiler/intrinsics/bmi/verifycode/BlsmskTestI.java index 1fc0e99fe08..55d0368b84b 100644 --- a/test/hotspot/jtreg/compiler/intrinsics/bmi/verifycode/BlsmskTestI.java +++ b/test/hotspot/jtreg/compiler/intrinsics/bmi/verifycode/BlsmskTestI.java @@ -57,7 +57,24 @@ protected BlsmskTestI(Method method) { (byte) 0x02, // 00010 implied 0F 38 leading opcode bytes (byte) 0x00, (byte) 0xF3, - (byte) 0b0001_0000}; // bits 543 == 011 (3) + (byte) 0b0001_0000}; // bits 543 == 010 (2) + + // from intel apx specifications EVEX.128.NP.0F38.W1 F3 /2(opcode extension part of ModRM.REG) + instrMaskAPX = new byte[]{ + (byte) 0xFF, + (byte) 0x07, + (byte) 0x00, + (byte) 0x00, + (byte) 0xFF, + (byte) 0x38}; + + instrPatternAPX = new byte[]{ + (byte) 0x62, // fixed prefix byte 0x62 for extended EVEX instruction + (byte) 0x02, // 00010 implied 0F 38 leading opcode bytes + (byte) 0x00, + (byte) 0x00, + (byte) 0xF3, + (byte) 0b0001_0000}; // bits 543 == 010 (2) } public static void main(String[] args) throws Exception { diff --git a/test/hotspot/jtreg/compiler/intrinsics/bmi/verifycode/BlsrTestI.java b/test/hotspot/jtreg/compiler/intrinsics/bmi/verifycode/BlsrTestI.java index 57523f11086..3841a2f155c 100644 --- a/test/hotspot/jtreg/compiler/intrinsics/bmi/verifycode/BlsrTestI.java +++ b/test/hotspot/jtreg/compiler/intrinsics/bmi/verifycode/BlsrTestI.java @@ -58,7 +58,25 @@ protected BlsrTestI(Method method) { (byte) 0x02, // 00010 implied 0F 38 leading opcode bytes (byte) 0x00, (byte) 0xF3, - (byte) 0b0000_1000}; // bits 543 == 011 (3) + (byte) 0b0000_1000}; // bits 543 == 001 (1) + + // from intel apx specifications EVEX.128.NP.0F38.W1 F3 /1(opcode extension part of ModRM.REG) + instrMaskAPX = new byte[]{ + (byte) 0xFF, + (byte) 0x07, + (byte) 0x00, + (byte) 0x00, + (byte) 0xFF, + (byte) 0x38}; + + instrPatternAPX = new byte[]{ + (byte) 0x62, // fixed prefix byte 0x62 for extended EVEX instruction + (byte) 0x02, // 00010 implied 0F 38 leading opcode bytes + (byte) 0x00, + (byte) 0x00, + (byte) 0xF3, + (byte) 0b0000_1000}; // bits 543 == 001 (1) + } public static void main(String[] args) throws Exception { diff --git a/test/hotspot/jtreg/compiler/intrinsics/bmi/verifycode/BmiIntrinsicBase.java b/test/hotspot/jtreg/compiler/intrinsics/bmi/verifycode/BmiIntrinsicBase.java index 743e371d5c2..0e8c8fe9514 100644 --- a/test/hotspot/jtreg/compiler/intrinsics/bmi/verifycode/BmiIntrinsicBase.java +++ b/test/hotspot/jtreg/compiler/intrinsics/bmi/verifycode/BmiIntrinsicBase.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2025, 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 @@ -111,7 +111,8 @@ protected void checkCompilation(Executable executable, int level) { protected void checkEmittedCode(Executable executable) { final byte[] nativeCode = NMethod.get(executable, false).insts; final byte[] matchInstrPattern = (((BmiTestCase) testCase).getTestCaseX64() && Platform.isX64()) ? ((BmiTestCase_x64) testCase).getInstrPattern_x64() : ((BmiTestCase) testCase).getInstrPattern(); - if (!((BmiTestCase) testCase).verifyPositive(nativeCode)) { + boolean use_apx = CPUInfo.hasFeature("apx_f"); + if (!((BmiTestCase) testCase).verifyPositive(nativeCode, use_apx)) { throw new AssertionError(testCase.name() + " " + "CPU instructions expected not found in nativeCode: " + Utils.toHexString(nativeCode) + " ---- Expected instrPattern: " + Utils.toHexString(matchInstrPattern)); } else { @@ -124,6 +125,8 @@ abstract static class BmiTestCase implements CompilerWhiteBoxTest.TestCase { private final Method method; protected byte[] instrMask; protected byte[] instrPattern; + protected byte[] instrMaskAPX; + protected byte[] instrPatternAPX; protected boolean isLongOperation; protected String cpuFlag = "bmi1"; protected String vmFlag = "UseBMI1Instructions"; @@ -160,6 +163,13 @@ protected int countCpuInstructions(byte[] nativeCode) { return countCpuInstructions(nativeCode, instrMask, instrPattern); } + protected int countCpuInstructionsAPX(byte[] nativeCode) { + if (instrMaskAPX == null || instrPatternAPX == null) { + return 0; + } + return countCpuInstructions(nativeCode, instrMaskAPX, instrPatternAPX); + } + public static int countCpuInstructions(byte[] nativeCode, byte[] instrMask, byte[] instrPattern) { int count = 0; int patternSize = Math.min(instrMask.length, instrPattern.length); @@ -181,8 +191,12 @@ public static int countCpuInstructions(byte[] nativeCode, byte[] instrMask, byte return count; } - public boolean verifyPositive(byte[] nativeCode) { - final int cnt = countCpuInstructions(nativeCode); + public boolean verifyPositive(byte[] nativeCode, boolean use_apx) { + int cnt = countCpuInstructions(nativeCode); + if (use_apx) { + System.out.println("CHECKING APX INST PATTERNS"); + cnt += countCpuInstructionsAPX(nativeCode); + } if (Platform.isX86()) { return cnt >= (isLongOperation ? 2 : 1); } else { diff --git a/test/hotspot/jtreg/compiler/intrinsics/bmi/verifycode/BzhiTestI2L.java b/test/hotspot/jtreg/compiler/intrinsics/bmi/verifycode/BzhiTestI2L.java index daba485be50..4cf94a0eb8b 100644 --- a/test/hotspot/jtreg/compiler/intrinsics/bmi/verifycode/BzhiTestI2L.java +++ b/test/hotspot/jtreg/compiler/intrinsics/bmi/verifycode/BzhiTestI2L.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2021, 2025, 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 @@ -73,6 +73,21 @@ protected BzhiTestI2L(Method method) { (byte) 0x62, // 00010 implied 0F 38 leading opcode bytes (byte) 0xA8, (byte) 0xF5}; + + // from intel apx specifications EVEX.128.NP.0F38.W0 F5 /r + instrMaskAPX = new byte[]{ + (byte) 0xFF, + (byte) 0x07, + (byte) 0x00, + (byte) 0x00, + (byte) 0xFF}; + + instrPatternAPX = new byte[]{ + (byte) 0x62, // fixed prefix byte 0x62 for extended EVEX instruction + (byte) 0x02, // 00010 implied 0F 38 leading opcode bytes + (byte) 0x00, + (byte) 0x00, + (byte) 0xF5}; } public static void main(String[] args) throws Exception { diff --git a/test/hotspot/jtreg/compiler/intrinsics/bmi/verifycode/LZcntTestI.java b/test/hotspot/jtreg/compiler/intrinsics/bmi/verifycode/LZcntTestI.java index d1b88ffd9d0..c905fca34a2 100644 --- a/test/hotspot/jtreg/compiler/intrinsics/bmi/verifycode/LZcntTestI.java +++ b/test/hotspot/jtreg/compiler/intrinsics/bmi/verifycode/LZcntTestI.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2025, 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 @@ -51,6 +51,10 @@ protected LZcntTestI(Method method) { instrMask_x64 = new byte[]{(byte) 0xFF, (byte) 0x00, (byte) 0xFF, (byte) 0xFF}; instrPattern_x64 = new byte[]{(byte) 0xF3, (byte) 0x00, (byte) 0x0F, (byte) 0xBD}; + + // REX2 variant + instrMaskAPX = new byte[]{(byte) 0xFF, (byte) 0xFF, (byte)0x80, (byte) 0xFF}; + instrPatternAPX = new byte[]{(byte) 0xF3, (byte) 0xD5, (byte) 0x80, (byte) 0xBD}; } public static void main(String[] args) throws Exception { diff --git a/test/hotspot/jtreg/compiler/intrinsics/bmi/verifycode/TZcntTestI.java b/test/hotspot/jtreg/compiler/intrinsics/bmi/verifycode/TZcntTestI.java index 641fdb0b203..8a8ce4508fa 100644 --- a/test/hotspot/jtreg/compiler/intrinsics/bmi/verifycode/TZcntTestI.java +++ b/test/hotspot/jtreg/compiler/intrinsics/bmi/verifycode/TZcntTestI.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2025, 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 @@ -50,6 +50,10 @@ protected TZcntTestI(Method method) { instrMask_x64 = new byte[]{(byte) 0xFF, (byte) 0x00, (byte) 0xFF, (byte) 0xFF}; instrPattern_x64 = new byte[]{(byte) 0xF3, (byte) 0x00, (byte) 0x0F, (byte) 0xBC}; + + // REX2 variant + instrMaskAPX = new byte[]{(byte) 0xFF, (byte) 0xFF, (byte)0x80, (byte) 0xFF}; + instrPatternAPX = new byte[]{(byte) 0xF3, (byte) 0xD5, (byte) 0x80, (byte) 0xBC}; } public static void main(String[] args) throws Exception { diff --git a/test/hotspot/jtreg/compiler/jvmci/common/patches/jdk.internal.vm.ci/jdk/vm/ci/hotspot/CompilerToVMHelper.java b/test/hotspot/jtreg/compiler/jvmci/common/patches/jdk.internal.vm.ci/jdk/vm/ci/hotspot/CompilerToVMHelper.java index 4285000e27f..4c8e63d0a42 100644 --- a/test/hotspot/jtreg/compiler/jvmci/common/patches/jdk.internal.vm.ci/jdk/vm/ci/hotspot/CompilerToVMHelper.java +++ b/test/hotspot/jtreg/compiler/jvmci/common/patches/jdk.internal.vm.ci/jdk/vm/ci/hotspot/CompilerToVMHelper.java @@ -229,8 +229,8 @@ public static void reprofile(HotSpotResolvedJavaMethod method) { CTVM.reprofile((HotSpotResolvedJavaMethodImpl)method); } - public static void invalidateHotSpotNmethod(HotSpotNmethod nmethodMirror, boolean deoptimize) { - CTVM.invalidateHotSpotNmethod(nmethodMirror, deoptimize); + public static void invalidateHotSpotNmethod(HotSpotNmethod nmethodMirror, boolean deoptimize, int invalidationReason) { + CTVM.invalidateHotSpotNmethod(nmethodMirror, deoptimize, invalidationReason); } public static long[] collectCounters() { diff --git a/test/hotspot/jtreg/compiler/jvmci/jdk.vm.ci.code.test/src/jdk/vm/ci/code/test/CodeInvalidationReasonTest.java b/test/hotspot/jtreg/compiler/jvmci/jdk.vm.ci.code.test/src/jdk/vm/ci/code/test/CodeInvalidationReasonTest.java new file mode 100644 index 00000000000..624a2290509 --- /dev/null +++ b/test/hotspot/jtreg/compiler/jvmci/jdk.vm.ci.code.test/src/jdk/vm/ci/code/test/CodeInvalidationReasonTest.java @@ -0,0 +1,77 @@ +/* + * Copyright (c) 2025, 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. + * + * 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. + */ + +/** + * @test + * @requires vm.jvmci + * @requires vm.simpleArch == "x64" | vm.simpleArch == "aarch64" | vm.simpleArch == "riscv64" + * @library /test/lib / + * @modules jdk.internal.vm.ci/jdk.vm.ci.hotspot + * jdk.internal.vm.ci/jdk.vm.ci.meta + * jdk.internal.vm.ci/jdk.vm.ci.code + * jdk.internal.vm.ci/jdk.vm.ci.code.site + * jdk.internal.vm.ci/jdk.vm.ci.runtime + * jdk.internal.vm.ci/jdk.vm.ci.aarch64 + * jdk.internal.vm.ci/jdk.vm.ci.amd64 + * jdk.internal.vm.ci/jdk.vm.ci.riscv64 + * @compile CodeInstallationTest.java DebugInfoTest.java TestAssembler.java TestHotSpotVMConfig.java amd64/AMD64TestAssembler.java aarch64/AArch64TestAssembler.java riscv64/RISCV64TestAssembler.java + * @run junit/othervm -XX:+UnlockExperimentalVMOptions -XX:+EnableJVMCI -XX:-UseJVMCICompiler jdk.vm.ci.code.test.CodeInvalidationReasonTest + */ + +package jdk.vm.ci.code.test; + +import jdk.test.lib.Asserts; +import jdk.vm.ci.code.Register; +import jdk.vm.ci.hotspot.HotSpotNmethod; + +import org.junit.Test; + +import java.lang.reflect.Method; + +/** + * Test if setting HotSpotNmethod invalidation reason around works. + */ +public class CodeInvalidationReasonTest extends CodeInstallationTest { + + public static int add(int a, int b) { + return a + b; + } + + private static void compileAdd(TestAssembler asm) { + Register arg0 = asm.emitIntArg0(); + Register arg1 = asm.emitIntArg1(); + Register ret = asm.emitIntAdd(arg0, arg1); + asm.emitIntRet(ret); + } + + @Test + public void test() { + Method method = getMethod("add", int.class, int.class); + + HotSpotNmethod nmethod = test(CodeInvalidationReasonTest::compileAdd, method, 5, 7); + Asserts.assertEquals(-1 /* since it was not invalidated yet. */, nmethod.getInvalidationReason()); + + nmethod.invalidate(true, config.NMETHOD_INVALIDATION_REASON_JVMCI_INVALIDATE); + Asserts.assertEquals(config.NMETHOD_INVALIDATION_REASON_JVMCI_INVALIDATE, nmethod.getInvalidationReason()); + } +} diff --git a/test/hotspot/jtreg/compiler/jvmci/jdk.vm.ci.code.test/src/jdk/vm/ci/code/test/SimpleCodeInstallationTest.java b/test/hotspot/jtreg/compiler/jvmci/jdk.vm.ci.code.test/src/jdk/vm/ci/code/test/SimpleCodeInstallationTest.java index c9c88024d99..4c76aea7a40 100644 --- a/test/hotspot/jtreg/compiler/jvmci/jdk.vm.ci.code.test/src/jdk/vm/ci/code/test/SimpleCodeInstallationTest.java +++ b/test/hotspot/jtreg/compiler/jvmci/jdk.vm.ci.code.test/src/jdk/vm/ci/code/test/SimpleCodeInstallationTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2025, 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 @@ -71,13 +71,13 @@ public void test() { Asserts.assertNotEquals(nmethod.getStart(), 0L); // Make nmethod non-entrant but still alive - nmethod.invalidate(false); + nmethod.invalidate(false, config.NMETHOD_INVALIDATION_REASON_JVMCI_INVALIDATE); Asserts.assertFalse(nmethod.isValid(), "code is valid, i = " + nmethod); Asserts.assertTrue(nmethod.isAlive(), "code is not alive, i = " + nmethod); Asserts.assertEquals(nmethod.getStart(), 0L); // Deoptimize the nmethod and cut the link to it from the HotSpotNmethod - nmethod.invalidate(true); + nmethod.invalidate(true, config.NMETHOD_INVALIDATION_REASON_JVMCI_INVALIDATE); Asserts.assertFalse(nmethod.isValid(), "code is valid, i = " + nmethod); Asserts.assertFalse(nmethod.isAlive(), "code is alive, i = " + nmethod); Asserts.assertEquals(nmethod.getStart(), 0L); diff --git a/test/hotspot/jtreg/compiler/jvmci/jdk.vm.ci.code.test/src/jdk/vm/ci/code/test/TestHotSpotVMConfig.java b/test/hotspot/jtreg/compiler/jvmci/jdk.vm.ci.code.test/src/jdk/vm/ci/code/test/TestHotSpotVMConfig.java index db30229d34f..79a0aa60892 100644 --- a/test/hotspot/jtreg/compiler/jvmci/jdk.vm.ci.code.test/src/jdk/vm/ci/code/test/TestHotSpotVMConfig.java +++ b/test/hotspot/jtreg/compiler/jvmci/jdk.vm.ci.code.test/src/jdk/vm/ci/code/test/TestHotSpotVMConfig.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2016, 2025, 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 @@ -55,6 +55,8 @@ public TestHotSpotVMConfig(HotSpotVMConfigStore config, Architecture arch) { public final int maxOopMapStackOffset = getFieldValue("CompilerToVM::Data::_max_oop_map_stack_offset", Integer.class, "int"); public final int heapWordSize = getConstant("HeapWordSize", Integer.class); + public final int NMETHOD_INVALIDATION_REASON_JVMCI_INVALIDATE = getConstant("nmethod::InvalidationReason::JVMCI_INVALIDATE", Integer.class); + public final boolean ropProtection; private Boolean initNmethodEntryBarrierConcurrentPatch(Architecture arch) { @@ -65,10 +67,11 @@ private Boolean initNmethodEntryBarrierConcurrentPatch(Architecture arch) { // There currently only 2 variants in use that differ only by the presence of a // dmb instruction int stw = getConstant("NMethodPatchingType::stw_instruction_and_data_patch", Integer.class); - int conc = getConstant("NMethodPatchingType::conc_data_patch", Integer.class); + int conc1 = getConstant("NMethodPatchingType::conc_data_patch", Integer.class); + int conc2 = getConstant("NMethodPatchingType::conc_instruction_and_data_patch", Integer.class); if (patchingType == stw) { patchConcurrent = false; - } else if (patchingType == conc) { + } else if (patchingType == conc1 || patchingType == conc2) { patchConcurrent = true; } else { throw new IllegalArgumentException("unsupported barrier sequence " + patchingType); diff --git a/test/hotspot/jtreg/compiler/lib/generators/Generators.java b/test/hotspot/jtreg/compiler/lib/generators/Generators.java index ac4062f19d5..c16b35cdae8 100644 --- a/test/hotspot/jtreg/compiler/lib/generators/Generators.java +++ b/test/hotspot/jtreg/compiler/lib/generators/Generators.java @@ -605,6 +605,29 @@ public void fill(Generator generator, float[] a) { fillFloat(generator, MemorySegment.ofArray(a)); } + /** + * Fills the memory segments with shorts obtained by calling next on the generator. + * + * @param generator The generator from which to source the values. + * @param ms Memory segment to be filled with random values. + */ + public void fillShort(Generator generator, MemorySegment ms) { + var layout = ValueLayout.JAVA_SHORT_UNALIGNED; + for (long i = 0; i < ms.byteSize() / layout.byteSize(); i++) { + ms.setAtIndex(layout, i, generator.next()); + } + } + + /** + * Fill the array with shorts using the distribution of the generator. + * + * @param a Array to be filled with random values. + */ + public void fill(Generator generator, short[] a) { + fillShort(generator, MemorySegment.ofArray(a)); + } + + /** * Fills the memory segments with ints obtained by calling next on the generator. * diff --git a/test/hotspot/jtreg/compiler/lib/ir_framework/CompilePhase.java b/test/hotspot/jtreg/compiler/lib/ir_framework/CompilePhase.java index 46900085b12..b0e5f2fda5c 100644 --- a/test/hotspot/jtreg/compiler/lib/ir_framework/CompilePhase.java +++ b/test/hotspot/jtreg/compiler/lib/ir_framework/CompilePhase.java @@ -37,95 +37,96 @@ * are treated as a separated compile phase as well. */ public enum CompilePhase { - DEFAULT("For IR node placeholder strings as defined in class IRNode only"), - - BEFORE_STRINGOPTS("Before StringOpts"), - AFTER_STRINGOPTS("After StringOpts"), - BEFORE_REMOVEUSELESS("Before RemoveUseless"), - AFTER_PARSING("After Parsing"), - BEFORE_ITER_GVN("Before Iter GVN"), - ITER_GVN1("Iter GVN 1"), - AFTER_ITER_GVN_STEP("After Iter GVN Step"), - AFTER_ITER_GVN("After Iter GVN"), - INCREMENTAL_INLINE_STEP("Incremental Inline Step"), - INCREMENTAL_INLINE_CLEANUP("Incremental Inline Cleanup"), - INCREMENTAL_INLINE("Incremental Inline"), - INCREMENTAL_BOXING_INLINE("Incremental Boxing Inline"), - EXPAND_VUNBOX("Expand VectorUnbox"), - SCALARIZE_VBOX("Scalarize VectorBox"), - INLINE_VECTOR_REBOX("Inline Vector Rebox Calls"), - EXPAND_VBOX("Expand VectorBox"), - ELIMINATE_VBOX_ALLOC("Eliminate VectorBoxAllocate"), - ITER_GVN_BEFORE_EA("Iter GVN before EA"), - ITER_GVN_AFTER_VECTOR("Iter GVN after vector box elimination"), - BEFORE_LOOP_OPTS("Before Loop Optimizations"), - BEFORE_BEAUTIFY_LOOPS("Before beautify loops"), - AFTER_BEAUTIFY_LOOPS("After beautify loops"), - BEFORE_LOOP_UNROLLING("Before Loop Unrolling"), - AFTER_LOOP_UNROLLING("After Loop Unrolling"), - BEFORE_SPLIT_IF("Before Split-If"), - AFTER_SPLIT_IF("After Split-If"), - BEFORE_LOOP_PREDICATION_IC("Before Loop Predication IC"), - AFTER_LOOP_PREDICATION_IC("After Loop Predication IC"), - BEFORE_LOOP_PREDICATION_RC("Before Loop Predication RC"), - AFTER_LOOP_PREDICATION_RC("After Loop Predication RC"), - BEFORE_PARTIAL_PEELING("Before Partial Peeling"), - AFTER_PARTIAL_PEELING("After Partial Peeling"), - BEFORE_LOOP_PEELING("Before Loop Peeling"), - AFTER_LOOP_PEELING("After Loop Peeling"), - BEFORE_LOOP_UNSWITCHING("Before Loop Unswitching"), - AFTER_LOOP_UNSWITCHING("After Loop Unswitching"), - BEFORE_RANGE_CHECK_ELIMINATION("Before Range Check Elimination"), - AFTER_RANGE_CHECK_ELIMINATION("After Range Check Elimination"), - BEFORE_PRE_MAIN_POST("Before Pre/Main/Post Loops"), - AFTER_PRE_MAIN_POST("After Pre/Main/Post Loops"), - SUPERWORD1_BEFORE_SCHEDULE("Superword 1, Before Schedule"), - SUPERWORD2_BEFORE_OUTPUT("Superword 2, Before Output"), - SUPERWORD3_AFTER_OUTPUT("Superword 3, After Output"), + DEFAULT( "For IR node placeholder strings as defined in class IRNode only"), + + BEFORE_STRINGOPTS( "Before StringOpts"), + AFTER_STRINGOPTS( "After StringOpts"), + BEFORE_REMOVEUSELESS( "Before RemoveUseless"), + AFTER_PARSING( "After Parsing"), + BEFORE_ITER_GVN( "Before Iter GVN"), + ITER_GVN1( "Iter GVN 1"), + AFTER_ITER_GVN_STEP( "After Iter GVN Step"), + AFTER_ITER_GVN( "After Iter GVN"), + INCREMENTAL_INLINE_STEP( "Incremental Inline Step"), + INCREMENTAL_INLINE_CLEANUP( "Incremental Inline Cleanup"), + INCREMENTAL_INLINE( "Incremental Inline"), + INCREMENTAL_BOXING_INLINE( "Incremental Boxing Inline"), + EXPAND_VUNBOX( "Expand VectorUnbox"), + SCALARIZE_VBOX( "Scalarize VectorBox"), + INLINE_VECTOR_REBOX( "Inline Vector Rebox Calls"), + EXPAND_VBOX( "Expand VectorBox"), + ELIMINATE_VBOX_ALLOC( "Eliminate VectorBoxAllocate"), + ITER_GVN_BEFORE_EA( "Iter GVN before EA"), + ITER_GVN_AFTER_VECTOR( "Iter GVN after Vector Box Elimination"), + BEFORE_LOOP_OPTS( "Before Loop Optimizations"), + PHASEIDEAL_BEFORE_EA( "PhaseIdealLoop before EA"), + AFTER_EA( "After Escape Analysis"), + ITER_GVN_AFTER_EA( "Iter GVN after EA"), + BEFORE_BEAUTIFY_LOOPS( "Before Beautify Loops"), + AFTER_BEAUTIFY_LOOPS( "After Beautify Loops"), // Match on very first BEFORE_CLOOPS phase (there could be multiple phases for multiple loops in the code). - BEFORE_CLOOPS("Before CountedLoop", RegexType.IDEAL_INDEPENDENT, ActionOnRepeat.KEEP_FIRST), - AFTER_CLOOPS("After CountedLoop"), - PHASEIDEAL_BEFORE_EA("PhaseIdealLoop before EA"), - AFTER_EA("After Escape Analysis"), - ITER_GVN_AFTER_EA("Iter GVN after EA"), - ITER_GVN_AFTER_ELIMINATION("Iter GVN after eliminating allocations and locks"), - PHASEIDEALLOOP1("PhaseIdealLoop 1"), - PHASEIDEALLOOP2("PhaseIdealLoop 2"), - PHASEIDEALLOOP3("PhaseIdealLoop 3"), - BEFORE_CCP1("Before PhaseCCP 1"), - CCP1("PhaseCCP 1"), - ITER_GVN2("Iter GVN 2"), - PHASEIDEALLOOP_ITERATIONS("PhaseIdealLoop iterations"), - AFTER_LOOP_OPTS("After Loop Optimizations"), - AFTER_MERGE_STORES("After Merge Stores"), - BEFORE_MACRO_EXPANSION("Before Macro Expansion"), - AFTER_MACRO_EXPANSION_STEP("After Macro Expansion Step"), - AFTER_MACRO_EXPANSION("After Macro Expansion"), - BARRIER_EXPANSION("Barrier expand"), - OPTIMIZE_FINISHED("Optimize finished"), - PRINT_IDEAL("PrintIdeal"), - BEFORE_MATCHING("Before matching"), - MATCHING("After matching", RegexType.MACH), - GLOBAL_CODE_MOTION("Global code motion", RegexType.MACH), - INITIAL_LIVENESS("Initial liveness", RegexType.MACH), - LIVE_RANGE_STRETCHING("Live range stretching", RegexType.MACH), - AGGRESSIVE_COALESCING("Aggressive coalescing", RegexType.MACH), - INITIAL_SPILLING("Initial spilling", RegexType.MACH), - CONSERVATIVE_COALESCING("Conservative coalescing", RegexType.MACH, ActionOnRepeat.KEEP_FIRST), - ITERATIVE_SPILLING("Iterative spilling", RegexType.MACH, ActionOnRepeat.KEEP_FIRST), - AFTER_ITERATIVE_SPILLING("After iterative spilling", RegexType.MACH), - POST_ALLOCATION_COPY_REMOVAL("Post-allocation copy removal", RegexType.MACH), - MERGE_MULTI_DEFS("Merge multiple definitions", RegexType.MACH), - FIX_UP_SPILLS("Fix up spills", RegexType.MACH), - REGISTER_ALLOCATION("Register Allocation", RegexType.MACH), - BLOCK_ORDERING("Block Ordering", RegexType.MACH), - PEEPHOLE("Peephole", RegexType.MACH), - POSTALLOC_EXPAND("Post-Allocation Expand", RegexType.MACH), - MACH_ANALYSIS("After mach analysis", RegexType.MACH), - FINAL_CODE("Final Code", RegexType.MACH), - END("End"), - - PRINT_OPTO_ASSEMBLY("PrintOptoAssembly", RegexType.OPTO_ASSEMBLY), + BEFORE_CLOOPS( "Before CountedLoop", RegexType.IDEAL_INDEPENDENT, ActionOnRepeat.KEEP_FIRST), + AFTER_CLOOPS( "After CountedLoop"), + BEFORE_LOOP_UNROLLING( "Before Loop Unrolling"), + AFTER_LOOP_UNROLLING( "After Loop Unrolling"), + BEFORE_SPLIT_IF( "Before Split-If"), + AFTER_SPLIT_IF( "After Split-If"), + BEFORE_LOOP_PREDICATION_IC( "Before Loop Predication IC"), + AFTER_LOOP_PREDICATION_IC( "After Loop Predication IC"), + BEFORE_LOOP_PREDICATION_RC( "Before Loop Predication RC"), + AFTER_LOOP_PREDICATION_RC( "After Loop Predication RC"), + BEFORE_PARTIAL_PEELING( "Before Partial Peeling"), + AFTER_PARTIAL_PEELING( "After Partial Peeling"), + BEFORE_LOOP_PEELING( "Before Loop Peeling"), + AFTER_LOOP_PEELING( "After Loop Peeling"), + BEFORE_LOOP_UNSWITCHING( "Before Loop Unswitching"), + AFTER_LOOP_UNSWITCHING( "After Loop Unswitching"), + BEFORE_RANGE_CHECK_ELIMINATION( "Before Range Check Elimination"), + AFTER_RANGE_CHECK_ELIMINATION( "After Range Check Elimination"), + ITER_GVN_AFTER_ELIMINATION( "Iter GVN after Eliminating Allocations and Locks"), + BEFORE_PRE_MAIN_POST( "Before Pre/Main/Post Loops"), + AFTER_PRE_MAIN_POST( "After Pre/Main/Post Loops"), + PHASEIDEALLOOP1( "PhaseIdealLoop 1"), + PHASEIDEALLOOP2( "PhaseIdealLoop 2"), + PHASEIDEALLOOP3( "PhaseIdealLoop 3"), + AUTO_VECTORIZATION1_BEFORE_APPLY( "AutoVectorization 1, before Apply"), + AUTO_VECTORIZATION2_AFTER_REORDER( "AutoVectorization 2, after Apply Memop Reordering"), + AUTO_VECTORIZATION3_AFTER_ADJUST_LIMIT( "AutoVectorization 3, after Adjusting Pre-loop Limit"), + AUTO_VECTORIZATION4_AFTER_SPECULATIVE_RUNTIME_CHECKS("AutoVectorization 4, after Adding Speculative Runtime Checks"), + BEFORE_CCP1( "Before PhaseCCP 1"), + CCP1( "PhaseCCP 1"), + ITER_GVN2( "Iter GVN 2"), + PHASEIDEALLOOP_ITERATIONS( "PhaseIdealLoop Iterations"), + AFTER_LOOP_OPTS( "After Loop Optimizations"), + AFTER_MERGE_STORES( "After Merge Stores"), + BEFORE_MACRO_EXPANSION( "Before Macro Expansion"), + AFTER_MACRO_EXPANSION_STEP( "After Macro Expansion Step"), + AFTER_MACRO_EXPANSION( "After Macro Expansion"), + BARRIER_EXPANSION( "Barrier Expand"), + OPTIMIZE_FINISHED( "Optimize Finished"), + PRINT_IDEAL( "PrintIdeal"), + BEFORE_MATCHING( "Before Matching"), + MATCHING( "After Matching", RegexType.MACH), + GLOBAL_CODE_MOTION( "Global Code Motion", RegexType.MACH), + INITIAL_LIVENESS( "Initial Liveness", RegexType.MACH), + LIVE_RANGE_STRETCHING( "Live Range Stretching", RegexType.MACH), + AGGRESSIVE_COALESCING( "Aggressive Coalescing", RegexType.MACH), + INITIAL_SPILLING( "Initial Spilling", RegexType.MACH), + CONSERVATIVE_COALESCING( "Conservative Coalescing", RegexType.MACH, ActionOnRepeat.KEEP_FIRST), + ITERATIVE_SPILLING( "Iterative Spilling", RegexType.MACH, ActionOnRepeat.KEEP_FIRST), + AFTER_ITERATIVE_SPILLING( "After Iterative Spilling", RegexType.MACH), + POST_ALLOCATION_COPY_REMOVAL( "Post-allocation Copy Removal", RegexType.MACH), + MERGE_MULTI_DEFS( "Merge Multiple Definitions", RegexType.MACH), + FIX_UP_SPILLS( "Fix up Spills", RegexType.MACH), + REGISTER_ALLOCATION( "Register Allocation", RegexType.MACH), + BLOCK_ORDERING( "Block Ordering", RegexType.MACH), + PEEPHOLE( "Peephole", RegexType.MACH), + POSTALLOC_EXPAND( "Post-allocation Expand", RegexType.MACH), + MACH_ANALYSIS( "After Mach Analysis", RegexType.MACH), + FINAL_CODE( "Final Code", RegexType.MACH), + END( "End"), + + PRINT_OPTO_ASSEMBLY( "PrintOptoAssembly", RegexType.OPTO_ASSEMBLY), ; private static final Map PHASES_BY_PARSED_NAME = new HashMap<>(); diff --git a/test/hotspot/jtreg/compiler/lib/ir_framework/IRNode.java b/test/hotspot/jtreg/compiler/lib/ir_framework/IRNode.java index 9388e1a8892..e7582015e86 100644 --- a/test/hotspot/jtreg/compiler/lib/ir_framework/IRNode.java +++ b/test/hotspot/jtreg/compiler/lib/ir_framework/IRNode.java @@ -649,6 +649,11 @@ public class IRNode { fromAfterCountedLoops(COUNTED_LOOP_MAIN, regex); } + public static final String DECODE_HEAP_OOP_NOT_NULL = PREFIX + "DECODE_HEAP_OOP_NOT_NULL" + POSTFIX; + static { + machOnly(DECODE_HEAP_OOP_NOT_NULL, "decodeHeapOop_not_null"); + } + public static final String DIV = PREFIX + "DIV" + POSTFIX; static { beforeMatchingNameRegex(DIV, "Div(I|L|F|D)"); @@ -870,6 +875,12 @@ public class IRNode { beforeMatchingNameRegex(IS_INFINITE_F, "IsInfiniteF"); } + // Only supported on x86. + public static final String LEA_P = PREFIX + "LEA_P" + POSTFIX; + static { + machOnly(LEA_P, "leaP(CompressedOopOffset|(8|32)Narrow)"); + } + public static final String LOAD = PREFIX + "LOAD" + POSTFIX; static { beforeMatchingNameRegex(LOAD, "Load(B|UB|S|US|I|L|F|D|P|N)"); @@ -1208,6 +1219,11 @@ public class IRNode { beforeMatchingNameRegex(MEMBAR_VOLATILE, "MemBarVolatile"); } + public static final String MEM_TO_REG_SPILL_COPY = PREFIX + "MEM_TO_REG_SPILL_COPY" + POSTFIX; + static { + machOnly(MEM_TO_REG_SPILL_COPY, "MemToRegSpillCopy"); + } + public static final String MIN = PREFIX + "MIN" + POSTFIX; static { beforeMatchingNameRegex(MIN, "Min(I|L)"); diff --git a/test/hotspot/jtreg/compiler/lib/ir_framework/test/IREncodingPrinter.java b/test/hotspot/jtreg/compiler/lib/ir_framework/test/IREncodingPrinter.java index 4ad95ab786f..eef9998ebf8 100644 --- a/test/hotspot/jtreg/compiler/lib/ir_framework/test/IREncodingPrinter.java +++ b/test/hotspot/jtreg/compiler/lib/ir_framework/test/IREncodingPrinter.java @@ -62,6 +62,7 @@ public class IREncodingPrinter { // as adding non-existent platforms can lead to skipped tests. private static final List irTestingPlatforms = new ArrayList(Arrays.asList( // os.family + "aix", "linux", "mac", "windows", @@ -346,7 +347,9 @@ private boolean checkPlatform(String platform, String value) { } String os = ""; - if (Platform.isLinux()) { + if (Platform.isAix()) { + os = "aix"; + } else if (Platform.isLinux()) { os = "linux"; } else if (Platform.isOSX()) { os = "mac"; diff --git a/test/hotspot/jtreg/compiler/lib/template_framework/Hook.java b/test/hotspot/jtreg/compiler/lib/template_framework/Hook.java index 48f7852d509..8ee2689eb2f 100644 --- a/test/hotspot/jtreg/compiler/lib/template_framework/Hook.java +++ b/test/hotspot/jtreg/compiler/lib/template_framework/Hook.java @@ -75,7 +75,7 @@ public record Hook(String name) { * @return A {@link Token} that captures the anchoring of the scope and the list of validated {@link Token}s. */ public Token anchor(Object... tokens) { - return new HookAnchorToken(this, Token.parse(tokens)); + return new HookAnchorToken(this, TokenParser.parse(tokens)); } /** diff --git a/test/hotspot/jtreg/compiler/lib/template_framework/Template.java b/test/hotspot/jtreg/compiler/lib/template_framework/Template.java index f01c5ccffd3..57d06e732bb 100644 --- a/test/hotspot/jtreg/compiler/lib/template_framework/Template.java +++ b/test/hotspot/jtreg/compiler/lib/template_framework/Template.java @@ -615,7 +615,7 @@ static Template.ThreeArgs make(String arg1Name, String * @throws IllegalArgumentException if the list of tokens contains an unexpected object. */ static TemplateBody body(Object... tokens) { - return new TemplateBody(Token.parse(tokens)); + return new TemplateBody(TokenParser.parse(tokens)); } /** diff --git a/test/hotspot/jtreg/compiler/lib/template_framework/Token.java b/test/hotspot/jtreg/compiler/lib/template_framework/Token.java index dc750c7f79f..0e9f9b272c5 100644 --- a/test/hotspot/jtreg/compiler/lib/template_framework/Token.java +++ b/test/hotspot/jtreg/compiler/lib/template_framework/Token.java @@ -23,17 +23,11 @@ package compiler.lib.template_framework; -import java.util.Arrays; -import java.util.ArrayList; -import java.util.List; - /** * The {@link Template#body} and {@link Hook#anchor} are given a list of tokens, which are either - * {@link Token}s or {@link String}s or some permitted boxed primitives. These are then parsed - * and all non-{@link Token}s are converted to {@link StringToken}s. The parsing also flattens - * {@link List}s. + * {@link Token}s or {@link String}s or some permitted boxed primitives. */ -sealed interface Token permits StringToken, +public sealed interface Token permits StringToken, TemplateToken, TemplateToken.ZeroArgs, TemplateToken.OneArg, @@ -42,37 +36,4 @@ sealed interface Token permits StringToken, HookAnchorToken, HookInsertToken, AddNameToken, - NothingToken -{ - static List parse(Object[] objects) { - if (objects == null) { - throw new IllegalArgumentException("Unexpected tokens: null"); - } - List outputList = new ArrayList<>(); - parseToken(Arrays.asList(objects), outputList); - return outputList; - } - - private static void parseList(List inputList, List outputList) { - for (Object o : inputList) { - parseToken(o, outputList); - } - } - - private static void parseToken(Object o, List outputList) { - if (o == null) { - throw new IllegalArgumentException("Unexpected token: null"); - } - switch (o) { - case Token t -> outputList.add(t); - case String s -> outputList.add(new StringToken(Renderer.format(s))); - case Integer s -> outputList.add(new StringToken(Renderer.format(s))); - case Long s -> outputList.add(new StringToken(Renderer.format(s))); - case Double s -> outputList.add(new StringToken(Renderer.format(s))); - case Float s -> outputList.add(new StringToken(Renderer.format(s))); - case Boolean s -> outputList.add(new StringToken(Renderer.format(s))); - case List l -> parseList(l, outputList); - default -> throw new IllegalArgumentException("Unexpected token: " + o); - } - } -} + NothingToken {} diff --git a/test/hotspot/jtreg/compiler/lib/template_framework/TokenParser.java b/test/hotspot/jtreg/compiler/lib/template_framework/TokenParser.java new file mode 100644 index 00000000000..0c335bd4fb8 --- /dev/null +++ b/test/hotspot/jtreg/compiler/lib/template_framework/TokenParser.java @@ -0,0 +1,71 @@ +/* + * Copyright (c) 2025, 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. + * + * 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 compiler.lib.template_framework; + +import java.util.Arrays; +import java.util.ArrayList; +import java.util.List; + +/** + * Helper class for {@link Token}, to keep the parsing methods package private. + * + *

    + * The {@link Template#body} and {@link Hook#anchor} are given a list of tokens, which are either + * {@link Token}s or {@link String}s or some permitted boxed primitives. These are then parsed + * and all non-{@link Token}s are converted to {@link StringToken}s. The parsing also flattens + * {@link List}s. + */ +final class TokenParser { + static List parse(Object[] objects) { + if (objects == null) { + throw new IllegalArgumentException("Unexpected tokens: null"); + } + List outputList = new ArrayList<>(); + parseToken(Arrays.asList(objects), outputList); + return outputList; + } + + private static void parseList(List inputList, List outputList) { + for (Object o : inputList) { + parseToken(o, outputList); + } + } + + private static void parseToken(Object o, List outputList) { + if (o == null) { + throw new IllegalArgumentException("Unexpected token: null"); + } + switch (o) { + case Token t -> outputList.add(t); + case String s -> outputList.add(new StringToken(Renderer.format(s))); + case Integer s -> outputList.add(new StringToken(Renderer.format(s))); + case Long s -> outputList.add(new StringToken(Renderer.format(s))); + case Double s -> outputList.add(new StringToken(Renderer.format(s))); + case Float s -> outputList.add(new StringToken(Renderer.format(s))); + case Boolean s -> outputList.add(new StringToken(Renderer.format(s))); + case List l -> parseList(l, outputList); + default -> throw new IllegalArgumentException("Unexpected token: " + o); + } + } +} diff --git a/test/hotspot/jtreg/compiler/lib/template_framework/library/CodeGenerationDataNameType.java b/test/hotspot/jtreg/compiler/lib/template_framework/library/CodeGenerationDataNameType.java new file mode 100644 index 00000000000..56f7afcbaeb --- /dev/null +++ b/test/hotspot/jtreg/compiler/lib/template_framework/library/CodeGenerationDataNameType.java @@ -0,0 +1,157 @@ +/* + * Copyright (c) 2025, 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. + * + * 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 compiler.lib.template_framework.library; + +import java.util.List; + +import compiler.lib.template_framework.DataName; +import compiler.lib.template_framework.Template; + +/** + * The {@link CodeGenerationDataNameType} extends the {@link DataName.Type} with + * additional functionality for code generation. These types with their extended + * functionality can be used with many other code generation facilities in the + * library, such as generating random {@code Expression}s. + */ +public interface CodeGenerationDataNameType extends DataName.Type { + + /** + * This method provides a random constant value for the type, which can + * be used as a token inside a {@link Template}. + * + * @return A random constant value. + */ + Object con(); + + /** + * The byte {@link PrimitiveType}. + * + * @return The byte {@link PrimitiveType}. + */ + static PrimitiveType bytes() { return PrimitiveType.BYTES; } + + /** + * The short {@link PrimitiveType}. + * + * @return The short {@link PrimitiveType}. + */ + static PrimitiveType shorts() { return PrimitiveType.SHORTS; } + + /** + * The char {@link PrimitiveType}. + * + * @return The char {@link PrimitiveType}. + */ + static PrimitiveType chars() { return PrimitiveType.CHARS; } + + /** + * The int {@link PrimitiveType}. + * + * @return The int {@link PrimitiveType}. + */ + static PrimitiveType ints() { return PrimitiveType.INTS; } + + /** + * The long {@link PrimitiveType}. + * + * @return The long {@link PrimitiveType}. + */ + static PrimitiveType longs() { return PrimitiveType.LONGS; } + + /** + * The float {@link PrimitiveType}. + * + * @return The float {@link PrimitiveType}. + */ + static PrimitiveType floats() { return PrimitiveType.FLOATS; } + + /** + * The double {@link PrimitiveType}. + * + * @return The double {@link PrimitiveType}. + */ + static PrimitiveType doubles() { return PrimitiveType.DOUBLES; } + + /** + * The boolean {@link PrimitiveType}. + * + * @return The boolean {@link PrimitiveType}. + */ + static PrimitiveType booleans() { return PrimitiveType.BOOLEANS; } + + /** + * List of all {@link PrimitiveType}s. + */ + List PRIMITIVE_TYPES = List.of( + bytes(), + chars(), + shorts(), + ints(), + longs(), + floats(), + doubles(), + booleans() + ); + + /** + * List of all integral {@link PrimitiveType}s (byte, char, short, int, long). + */ + List INTEGRAL_TYPES = List.of( + bytes(), + chars(), + shorts(), + ints(), + longs() + ); + + /** + * List of all subword {@link PrimitiveType}s (byte, char, short). + */ + List SUBWORD_TYPES = List.of( + bytes(), + chars(), + shorts() + ); + + /** + * List of all floating {@link PrimitiveType}s (float, double). + */ + List FLOATING_TYPES = List.of( + floats(), + doubles() + ); + + /** + * List of all integral and floating {@link PrimitiveType}s. + */ + List INTEGRAL_AND_FLOATING_TYPES = List.of( + bytes(), + chars(), + shorts(), + ints(), + longs(), + floats(), + doubles() + ); +} diff --git a/test/hotspot/jtreg/compiler/lib/template_framework/library/PrimitiveType.java b/test/hotspot/jtreg/compiler/lib/template_framework/library/PrimitiveType.java new file mode 100644 index 00000000000..3bf6c7f6288 --- /dev/null +++ b/test/hotspot/jtreg/compiler/lib/template_framework/library/PrimitiveType.java @@ -0,0 +1,151 @@ +/* + * Copyright (c) 2025, 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. + * + * 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 compiler.lib.template_framework.library; + +import java.util.Random; +import jdk.test.lib.Utils; + +import compiler.lib.generators.Generators; +import compiler.lib.generators.Generator; +import compiler.lib.generators.RestrictableGenerator; + +import compiler.lib.template_framework.DataName; + +/** + * The {@link PrimitiveType} models Java's primitive types, and provides a set + * of useful methods for code generation, such as the {@link #byteSize} and + * {@link #boxedTypeName}. + */ +public final class PrimitiveType implements CodeGenerationDataNameType { + private static final Random RANDOM = Utils.getRandomInstance(); + private static final RestrictableGenerator GEN_BYTE = Generators.G.safeRestrict(Generators.G.ints(), Byte.MIN_VALUE, Byte.MAX_VALUE); + private static final RestrictableGenerator GEN_CHAR = Generators.G.safeRestrict(Generators.G.ints(), Character.MIN_VALUE, Character.MAX_VALUE); + private static final RestrictableGenerator GEN_SHORT = Generators.G.safeRestrict(Generators.G.ints(), Short.MIN_VALUE, Short.MAX_VALUE); + private static final RestrictableGenerator GEN_INT = Generators.G.ints(); + private static final RestrictableGenerator GEN_LONG = Generators.G.longs(); + private static final Generator GEN_DOUBLE = Generators.G.doubles(); + private static final Generator GEN_FLOAT = Generators.G.floats(); + + private static enum Kind { BYTE, SHORT, CHAR, INT, LONG, FLOAT, DOUBLE, BOOLEAN }; + + // We have one static instance each, so we do not have duplicated instances. + static final PrimitiveType BYTES = new PrimitiveType(Kind.BYTE ); + static final PrimitiveType SHORTS = new PrimitiveType(Kind.SHORT ); + static final PrimitiveType CHARS = new PrimitiveType(Kind.CHAR ); + static final PrimitiveType INTS = new PrimitiveType(Kind.INT ); + static final PrimitiveType LONGS = new PrimitiveType(Kind.LONG ); + static final PrimitiveType FLOATS = new PrimitiveType(Kind.FLOAT ); + static final PrimitiveType DOUBLES = new PrimitiveType(Kind.DOUBLE ); + static final PrimitiveType BOOLEANS = new PrimitiveType(Kind.BOOLEAN); + + final Kind kind; + + // Private constructor so nobody can create duplicate instances. + private PrimitiveType(Kind kind) { + this.kind = kind; + } + + @Override + public boolean isSubtypeOf(DataName.Type other) { + return (other instanceof PrimitiveType pt) && pt.kind == kind; + } + + @Override + public String name() { + return switch (kind) { + case BYTE -> "byte"; + case SHORT -> "short"; + case CHAR -> "char"; + case INT -> "int"; + case LONG -> "long"; + case FLOAT -> "float"; + case DOUBLE -> "double"; + case BOOLEAN -> "boolean"; + }; + } + + @Override + public String toString() { + return name(); + } + + public Object con() { + return switch (kind) { + case BYTE -> "(byte)" + GEN_BYTE.next(); + case SHORT -> "(short)" + GEN_SHORT.next(); + case CHAR -> "(char)" + GEN_CHAR.next(); + case INT -> GEN_INT.next(); + case LONG -> GEN_LONG.next(); + case FLOAT -> GEN_FLOAT.next(); + case DOUBLE -> GEN_DOUBLE.next(); + case BOOLEAN -> RANDOM.nextBoolean(); + }; + } + + /** + * Provides the size of the type in bytes. + * + * @return Size of the type in bytes. + * @throws UnsupportedOperationException for boolean which has no defined size. + */ + public int byteSize() { + return switch (kind) { + case BYTE -> 1; + case SHORT, CHAR -> 2; + case INT, FLOAT -> 4; + case LONG, DOUBLE -> 8; + case BOOLEAN -> { throw new UnsupportedOperationException("boolean does not have a defined 'size'"); } + }; + } + + /** + * Provides the name of the boxed type. + * + * @return the name of the boxed type. + */ + public String boxedTypeName() { + return switch (kind) { + case BYTE -> "Byte"; + case SHORT -> "Short"; + case CHAR -> "Character"; + case INT -> "Integer"; + case LONG -> "Long"; + case FLOAT -> "Float"; + case DOUBLE -> "Double"; + case BOOLEAN -> "Boolean"; + }; + } + + /** + * Indicates if the type is a floating point type. + * + * @return true iff the type is a floating point type. + */ + public boolean isFloating() { + return switch (kind) { + case BYTE, SHORT, CHAR, INT, LONG, BOOLEAN -> false; + case FLOAT, DOUBLE -> true; + }; + } +} diff --git a/test/hotspot/jtreg/compiler/lib/template_framework/library/TestFrameworkClass.java b/test/hotspot/jtreg/compiler/lib/template_framework/library/TestFrameworkClass.java new file mode 100644 index 00000000000..5194b75af43 --- /dev/null +++ b/test/hotspot/jtreg/compiler/lib/template_framework/library/TestFrameworkClass.java @@ -0,0 +1,119 @@ +/* + * Copyright (c) 2025, 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. + * + * 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 compiler.lib.template_framework.library; + +import java.util.List; +import java.util.Set; + +import compiler.lib.ir_framework.TestFramework; +import compiler.lib.compile_framework.CompileFramework; +import compiler.lib.template_framework.Template; +import compiler.lib.template_framework.TemplateToken; +import static compiler.lib.template_framework.Template.body; +import static compiler.lib.template_framework.Template.let; + +/** + * This class provides a {@link #render} method that can be used to simplify generating + * source code when using the {@link TestFramework} (also known as IR Framework) to run + * a list of tests. + * + *

    + * The idea is that the user only has to generate the code for the individual tests, + * and can then pass the corresponding list of {@link TemplateToken}s to this + * provided {@link #render} method which generates the surrounding class and the main + * method that invokes the {@link TestFramework}, so that all the generated tests + * are run. + */ +public final class TestFrameworkClass { + + // Ensure there can be no instance, and we do not have to document the constructor. + private TestFrameworkClass() {} + + /** + * This method renders a list of {@code testTemplateTokens} into the body of a class + * and generates a {@code main} method which launches the {@link TestFramework} + * to run the generated tests. + * + *

    + * The generated {@code main} method is to be invoked with a {@code vmFlags} argument, + * which must be a {@link String[]}, specifying the VM flags for the Test VM, in which + * the tests will be run. Thus, one can generate the test class once, and invoke its + * {@code main} method multiple times, each time with a different set of VM flags. + * + *

    + * The internal {@link Template} sets the {@link Hooks#CLASS_HOOK} for the scope of + * all test methods. + * + * @param packageName The package name of the test class. + * @param className The name of the test class. + * @param imports A set of imports. + * @param classpath The classpath from {@link CompileFramework#getEscapedClassPathOfCompiledClasses}, + * so that the Test VM has access to the class files that are compiled from the + * generated source code. + * @param testTemplateTokens The list of tests to be generated into the test class. + * Every test must be annotated with {@code @Test}, so that + * the {@link TestFramework} can later find and run them. + * @return The generated source code of the test class as a {@link String}. + */ + public static String render(final String packageName, + final String className, + final Set imports, + final String classpath, + final List testTemplateTokens) { + var template = Template.make(() -> body( + let("packageName", packageName), + let("className", className), + let("classpath", classpath), + """ + package #packageName; + // --- IMPORTS start --- + import compiler.lib.ir_framework.*; + """, + imports.stream().map(i -> "import " + i + ";\n").toList(), + """ + // --- IMPORTS end --- + public class #className { + // --- CLASS_HOOK insertions start --- + """, + Hooks.CLASS_HOOK.anchor( + """ + // --- CLASS_HOOK insertions end --- + public static void main(String[] vmFlags) { + TestFramework framework = new TestFramework(#className.class); + framework.addFlags("-classpath", "#classpath"); + framework.addFlags(vmFlags); + framework.start(); + } + // --- LIST OF TESTS start --- + """, + testTemplateTokens + ), + """ + // --- LIST OF TESTS end --- + } + """ + )); + return template.render(); + } +} diff --git a/test/hotspot/jtreg/compiler/locks/TestSynchronizeWithEmptyBlock.java b/test/hotspot/jtreg/compiler/locks/TestSynchronizeWithEmptyBlock.java index 4165e6285b6..1f861f301e3 100644 --- a/test/hotspot/jtreg/compiler/locks/TestSynchronizeWithEmptyBlock.java +++ b/test/hotspot/jtreg/compiler/locks/TestSynchronizeWithEmptyBlock.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2024, 2025, 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 @@ -26,9 +26,6 @@ * @bug 8337660 * @summary Test that C2 does not remove blocks with BoxLock nodes that are * otherwise empty. - * @run main/othervm -Xbatch -XX:LockingMode=1 - * -XX:CompileOnly=compiler.locks.TestSynchronizeWithEmptyBlock::* - * compiler.locks.TestSynchronizeWithEmptyBlock * @run main/othervm -Xbatch * -XX:CompileOnly=compiler.locks.TestSynchronizeWithEmptyBlock::* * compiler.locks.TestSynchronizeWithEmptyBlock diff --git a/test/hotspot/jtreg/serviceability/jvmti/ModuleAwareAgents/ThreadStart/MAAThreadStart.java b/test/hotspot/jtreg/compiler/loopopts/LoopReductionHasControlOrBadInput.java similarity index 53% rename from test/hotspot/jtreg/serviceability/jvmti/ModuleAwareAgents/ThreadStart/MAAThreadStart.java rename to test/hotspot/jtreg/compiler/loopopts/LoopReductionHasControlOrBadInput.java index 1e973fc5064..b30939412f0 100644 --- a/test/hotspot/jtreg/serviceability/jvmti/ModuleAwareAgents/ThreadStart/MAAThreadStart.java +++ b/test/hotspot/jtreg/compiler/loopopts/LoopReductionHasControlOrBadInput.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2025, 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 @@ -21,32 +21,36 @@ * questions. */ -/** +/* * @test - * @summary Verify ThreadStart JVMTI event with can_generate_early_vmstart capability - * @requires vm.jvmti - * @run main/othervm/native -agentlib:MAAThreadStart MAAThreadStart + * @bug 8350576 + * @summary Optimization bails out and hits an assert: + * assert(false) failed: reduction has ctrl or bad vector_input + * @run main/othervm -Xbatch -XX:-TieredCompilation + * -XX:CompileCommand=compileonly,compiler.loopopts.LoopReductionHasControlOrBadInput::* + * compiler.loopopts.LoopReductionHasControlOrBadInput + * @run main compiler.loopopts.LoopReductionHasControlOrBadInput + * */ -public class MAAThreadStart { +package compiler.loopopts; - static { - try { - System.loadLibrary("MAAThreadStart"); - } catch (UnsatisfiedLinkError ule) { - System.err.println("Could not load MAAThreadStart library"); - System.err.println("java.library.path: " - + System.getProperty("java.library.path")); - throw ule; - } - } +public class LoopReductionHasControlOrBadInput { + static long lFld; + static long lArr[] = new long[400]; - native static int check(); + static void test() { + int i = 1; + do { + long x = -1; + lArr[i] = i; + lFld += i | x; + } while (++i < 355); + } - public static void main(String args[]) { - int status = check(); - if (status != 0) { - throw new RuntimeException("Non-zero status returned from the agent: " + status); + public static void main(String[] strArr) { + for (int i = 0; i < 100; i++) { + test(); } } } diff --git a/test/hotspot/jtreg/compiler/loopopts/TestCountedLoopCastIV.java b/test/hotspot/jtreg/compiler/loopopts/TestCountedLoopCastIV.java new file mode 100644 index 00000000000..6f31084ac7b --- /dev/null +++ b/test/hotspot/jtreg/compiler/loopopts/TestCountedLoopCastIV.java @@ -0,0 +1,195 @@ +/* + * Copyright (c) 2025, NVIDIA CORPORATION & 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. + * + * 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 compiler.loopopts; + +import java.util.Arrays; +import java.util.Objects; + +import compiler.lib.generators.*; +import compiler.lib.ir_framework.*; +import jdk.test.lib.Asserts; + + /* + * @test + * @bug 8357726 + * @summary Improve C2 to recognize counted loops with multiple casts in trip counter + * @library /test/lib / + * @run driver compiler.loopopts.TestCountedLoopCastIV DisableUnroll + * @run driver compiler.loopopts.TestCountedLoopCastIV + */ + +public class TestCountedLoopCastIV { + private static final int LEN = 1024; + private static final Generators random = Generators.G; + + private static int[] in; + private static int[] out; + + static { + in = new int[LEN]; + out = new int[LEN]; + random.fill(random.ints(), in); + } + + private static void cleanUp() { + Arrays.fill(out, 0); + } + + private static void verify(int[] ref, int[] res, int start, + int limit, int stride, + int in_offset, int out_offset) { + for (int i = start; i < limit; i += stride) { + Asserts.assertEquals(ref[i + in_offset], res[i + out_offset]); + } + } + + // Test a counted loop with two explicit range checkes + // which will create CastIINodes for loop induction variable. + // In this case, the loop start, limit and stride are + // all constants. + // + // The first IR check with "-XX:LoopUnrollLimit=0" makes sure + // the loop is transformed into exactly one CountedLoopNode, + // verifying the CastII recognition works correctly. + // + // The second IR check ensures the optimization works properly + // with default vm settings. + // + @Test + @IR(counts = {IRNode.COUNTED_LOOP, "1" }, applyIf = {"LoopUnrollLimit", "0"}) + @IR(counts = {IRNode.COUNTED_LOOP, ">0" }) + static void test1() { + for (int i = 0; i < LEN; i += 16) { + Objects.checkIndex(i, LEN - 3); + int a = in[i + 3]; + Objects.checkIndex(i, LEN - 15); + out[i + 15] = a; + } + } + + @Run(test = "test1") + public static void runTest1() { + test1(); + verify(in, out, 0, LEN, 16, 3, 15); + } + + // Similar to test1, but the loop limit is a variable. + @Test + @IR(counts = {IRNode.COUNTED_LOOP, "1" }, applyIf = {"LoopUnrollLimit", "0"}) + @IR(counts = {IRNode.COUNTED_LOOP, ">0" }) + static void test2(int limit) { + for (int i = 0; i < limit; i += 16) { + Objects.checkIndex(i, LEN - 3); + int a = in[i + 3]; + Objects.checkIndex(i, LEN - 15); + out[i + 15] = a; + } + } + + @Run(test = "test2") + private void runTest2() { + cleanUp(); + test2(100); + verify(in, out, 0, 100, 16, 3, 15); + + cleanUp(); + test2(500); + verify(in, out, 0, 500, 16, 3, 15); + + cleanUp(); + test2(LEN); + verify(in, out, 0, LEN, 16, 3, 15); + } + + // Similar to test1 and test2, but the loop is a + // while loop with a variable start and limit. + @Test + @IR(counts = {IRNode.COUNTED_LOOP, "1" }, applyIf = {"LoopUnrollLimit", "0"}) + @IR(counts = {IRNode.COUNTED_LOOP, ">0" }) + static void test3(int start, int limit) { + int i = start; + while (i < limit) { + Objects.checkIndex(i, LEN); + int a = in[i]; + Objects.checkIndex(i, LEN - 3); + out[i + 3] = a; + i++; + } + } + + @Run(test = "test3") + private void runTest3() { + cleanUp(); + test3(0, 100); + verify(in, out, 0, 100, 1, 0, 3); + + cleanUp(); + test3(128, 500); + verify(in, out, 128, 500, 1, 0, 3); + + cleanUp(); + test3(LEN - 128, LEN - 3); + verify(in, out, LEN - 128, LEN - 3, 1, 0, 3); + } + + // Similar to test3, but the type of induction variable + // is long. + @Test + @IR(counts = {IRNode.COUNTED_LOOP, "1" }, applyIf = {"LoopUnrollLimit", "0"}) + @IR(counts = {IRNode.COUNTED_LOOP, ">0" }) + static void test4(long start, long limit) { + for (long i = start; i < limit; i++) { + Objects.checkIndex(i, LEN); + int a = in[(int) i]; + Objects.checkIndex(i, LEN - 3); + out[(int) i + 3] = a; + } + } + + @Run(test = "test4") + private void runTest4() { + cleanUp(); + test3(0, 100); + verify(in, out, 0, 100, 1, 0, 3); + + cleanUp(); + test3(128, 500); + verify(in, out, 128, 500, 1, 0, 3); + + cleanUp(); + test3(LEN - 128, LEN - 3); + verify(in, out, LEN - 128, LEN - 3, 1, 0, 3); + } + + public static void main(String[] args) { + if (args != null && args.length > 0 && args[0].equals("DisableUnroll")) { + TestFramework.runWithFlags("-XX:LoopUnrollLimit=0"); + } else { + if (args != null && args.length != 0) { + throw new RuntimeException("Unexpected args"); + } + TestFramework.run(); + } + } +} diff --git a/test/hotspot/jtreg/compiler/loopstripmining/TestStoresSunkInOuterStripMinedLoop.java b/test/hotspot/jtreg/compiler/loopstripmining/TestStoresSunkInOuterStripMinedLoop.java new file mode 100644 index 00000000000..0868f35bea4 --- /dev/null +++ b/test/hotspot/jtreg/compiler/loopstripmining/TestStoresSunkInOuterStripMinedLoop.java @@ -0,0 +1,134 @@ +/* + * Copyright (c) 2025, Red Hat, Inc. 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. + * + * 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. + */ + +/** + * @test + * @bug 8356708 + * @summary C2: loop strip mining expansion doesn't take sunk stores into account + * + * @run main/othervm -XX:-TieredCompilation -XX:-UseOnStackReplacement -XX:-BackgroundCompilation -XX:LoopMaxUnroll=0 + * -XX:+UnlockDiagnosticVMOptions -XX:+StressGCM -XX:StressSeed=26601954 TestStoresSunkInOuterStripMinedLoop + * @run main/othervm -XX:-TieredCompilation -XX:-UseOnStackReplacement -XX:-BackgroundCompilation -XX:LoopMaxUnroll=0 + * -XX:+UnlockDiagnosticVMOptions -XX:+StressGCM TestStoresSunkInOuterStripMinedLoop + * @run main TestStoresSunkInOuterStripMinedLoop + * + */ + +public class TestStoresSunkInOuterStripMinedLoop { + private static int field; + private static volatile int volatileField; + + public static void main(String[] args) { + A a1 = new A(); + A a2 = new A(); + A a3 = new A(); + for (int i = 0; i < 20_000; i++) { + field = 0; + test1(); + if (field != 1500) { + throw new RuntimeException(field + " != 1500"); + } + a1.field = 0; + test2(a1, a2); + if (a1.field != 1500) { + throw new RuntimeException(a1.field + " != 1500"); + } + a1.field = 0; + test3(a1, a2); + if (a1.field != 1500) { + throw new RuntimeException(a1.field + " != 1500"); + } + a1.field = 0; + test4(a1, a2, a3); + if (a1.field != 1500) { + throw new RuntimeException(a1.field + " != 1500"); + } + } + } + + // Single store sunk in outer loop, no store in inner loop + private static float test1() { + int v = field; + float f = 1; + for (int i = 0; i < 1500; i++) { + f *= 2; + v++; + field = v; + } + return f; + } + + // Multiple stores sunk in outer loop, no store in inner loop + private static float test2(A a1, A a2) { + field = a1.field + a2.field; + volatileField = 42; + int v = a1.field; + float f = 1; + for (int i = 0; i < 1500; i++) { + f *= 2; + v++; + a1.field = v; + a2.field = v; + } + return f; + } + + // Store sunk in outer loop, store in inner loop + private static float test3(A a1, A a2) { + field = a1.field + a2.field; + volatileField = 42; + int v = a1.field; + float f = 1; + A a = a2; + for (int i = 0; i < 1500; i++) { + f *= 2; + v++; + a.field = v; + a = a1; + a2.field = v; + } + return f; + } + + // Multiple stores sunk in outer loop, store in inner loop + private static float test4(A a1, A a2, A a3) { + field = a1.field + a2.field + a3.field; + volatileField = 42; + int v = a1.field; + float f = 1; + A a = a2; + for (int i = 0; i < 1500; i++) { + f *= 2; + v++; + a.field = v; + a = a1; + a2.field = v; + a3.field = v; + } + return f; + } + + static class A { + int field; + } +} diff --git a/test/hotspot/jtreg/compiler/onSpinWait/TestOnSpinWaitAArch64.java b/test/hotspot/jtreg/compiler/onSpinWait/TestOnSpinWaitAArch64.java index 76953bfb124..a4f40ccda92 100644 --- a/test/hotspot/jtreg/compiler/onSpinWait/TestOnSpinWaitAArch64.java +++ b/test/hotspot/jtreg/compiler/onSpinWait/TestOnSpinWaitAArch64.java @@ -33,9 +33,11 @@ * @run driver compiler.onSpinWait.TestOnSpinWaitAArch64 c2 nop 7 * @run driver compiler.onSpinWait.TestOnSpinWaitAArch64 c2 isb 3 * @run driver compiler.onSpinWait.TestOnSpinWaitAArch64 c2 yield 1 + * @run driver compiler.onSpinWait.TestOnSpinWaitAArch64 c2 sb 1 * @run driver compiler.onSpinWait.TestOnSpinWaitAArch64 c1 nop 7 * @run driver compiler.onSpinWait.TestOnSpinWaitAArch64 c1 isb 3 - * @run driver compiler.onSpinWait.TestOnSpinWaitAArch64 c1 yield + * @run driver compiler.onSpinWait.TestOnSpinWaitAArch64 c1 yield 1 + * @run driver compiler.onSpinWait.TestOnSpinWaitAArch64 c1 sb 1 */ package compiler.onSpinWait; @@ -50,13 +52,12 @@ public class TestOnSpinWaitAArch64 { public static void main(String[] args) throws Exception { String compiler = args[0]; String spinWaitInst = args[1]; - String spinWaitInstCount = (args.length == 3) ? args[2] : "1"; + String spinWaitInstCount = args[2]; ArrayList command = new ArrayList(); command.add("-XX:+IgnoreUnrecognizedVMOptions"); command.add("-showversion"); command.add("-XX:-BackgroundCompilation"); command.add("-XX:+UnlockDiagnosticVMOptions"); - command.add("-XX:+PrintAssembly"); if (compiler.equals("c2")) { command.add("-XX:-TieredCompilation"); } else if (compiler.equals("c1")) { @@ -69,12 +70,18 @@ public static void main(String[] args) throws Exception { command.add("-XX:OnSpinWaitInst=" + spinWaitInst); command.add("-XX:OnSpinWaitInstCount=" + spinWaitInstCount); command.add("-XX:CompileCommand=compileonly," + Launcher.class.getName() + "::" + "test"); + command.add("-XX:CompileCommand=print," + Launcher.class.getName() + "::" + "test"); command.add(Launcher.class.getName()); ProcessBuilder pb = ProcessTools.createLimitedTestJavaProcessBuilder(command); OutputAnalyzer analyzer = new OutputAnalyzer(pb.start()); + if ("sb".equals(spinWaitInst) && analyzer.contains("CPU does not support SB")) { + System.out.println("Skipping the test. The current CPU does not support SB instruction."); + return; + } + analyzer.shouldHaveExitValue(0); System.out.println(analyzer.getOutput()); @@ -89,6 +96,8 @@ private static String getSpinWaitInstHex(String spinWaitInst) { return "df3f 03d5"; } else if ("yield".equals(spinWaitInst)) { return "3f20 03d5"; + } else if ("sb".equals(spinWaitInst)) { + return "ff30 03d5"; } else { throw new RuntimeException("Unknown spin wait instruction: " + spinWaitInst); } diff --git a/test/hotspot/jtreg/compiler/startup/StartupOutput.java b/test/hotspot/jtreg/compiler/startup/StartupOutput.java index 883f1a08030..22f2887a266 100644 --- a/test/hotspot/jtreg/compiler/startup/StartupOutput.java +++ b/test/hotspot/jtreg/compiler/startup/StartupOutput.java @@ -60,21 +60,17 @@ public static void main(String[] args) throws Exception { throw new Exception("VM crashed with exit code " + exitCode); } - Process[] pr = new Process[200]; for (int i = 0; i < 200; i++) { int initialCodeCacheSizeInKb = 800 + rand.nextInt(400); int reservedCodeCacheSizeInKb = initialCodeCacheSizeInKb + rand.nextInt(200); pb = ProcessTools.createLimitedTestJavaProcessBuilder("-XX:InitialCodeCacheSize=" + initialCodeCacheSizeInKb + "K", "-XX:ReservedCodeCacheSize=" + reservedCodeCacheSizeInKb + "k", "-version"); - pr[i] = pb.start(); - } - for (int i = 0; i < 200; i++) { - out = new OutputAnalyzer(pr[i]); - // The VM should not crash but will probably fail with a "CodeCache is full. Compiler has been disabled." message - out.stdoutShouldNotContain("# A fatal error"); + out = new OutputAnalyzer(pb.start()); exitCode = out.getExitValue(); if (exitCode != 1 && exitCode != 0) { throw new Exception("VM crashed with exit code " + exitCode); } + // The VM should not crash but will probably fail with a "CodeCache is full. Compiler has been disabled." message + out.stdoutShouldNotContain("# A fatal error"); } } } diff --git a/test/hotspot/jtreg/compiler/vectorization/TestFloat16VectorOperations.java b/test/hotspot/jtreg/compiler/vectorization/TestFloat16VectorOperations.java index a0622d665b8..9c342574632 100644 --- a/test/hotspot/jtreg/compiler/vectorization/TestFloat16VectorOperations.java +++ b/test/hotspot/jtreg/compiler/vectorization/TestFloat16VectorOperations.java @@ -37,6 +37,7 @@ import jdk.incubator.vector.Float16; import static jdk.incubator.vector.Float16.*; import static java.lang.Float.*; +import java.util.Arrays; import jdk.test.lib.*; import compiler.lib.generators.Generator; import static compiler.lib.generators.Generators.G; @@ -46,9 +47,11 @@ public class TestFloat16VectorOperations { private short[] input2; private short[] input3; private short[] output; - private static short SCALAR_FP16 = (short)0x7777; + private static short FP16_SCALAR = (short)0x7777; private static final int LEN = 2048; + private static final Float16 FP16_CONST = Float16.valueOf(1023.0f); + public static void main(String args[]) { // Test with default MaxVectorSize TestFramework.runWithFlags("--add-modules=jdk.incubator.vector"); @@ -60,10 +63,14 @@ public static void main(String args[]) { TestFramework.runWithFlags("--add-modules=jdk.incubator.vector", "-XX:MaxVectorSize=64"); } - public static boolean assertResults(short expected, short actual) { - Float16 expected_fp16 = shortBitsToFloat16(expected); - Float16 actual_fp16 = shortBitsToFloat16(actual); - return !expected_fp16.equals(actual_fp16); + public static void assertResults(int arity, short ... values) { + assert values.length == (arity + 2); + Float16 expected_fp16 = shortBitsToFloat16(values[arity]); + Float16 actual_fp16 = shortBitsToFloat16(values[arity + 1]); + if(!expected_fp16.equals(actual_fp16)) { + String inputs = Arrays.toString(Arrays.copyOfRange(values, 0, arity - 1)); + throw new AssertionError("Result Mismatch!, input = " + inputs + " actual = " + actual_fp16 + " expected = " + expected_fp16); + } } public TestFloat16VectorOperations() { @@ -84,9 +91,9 @@ public TestFloat16VectorOperations() { @Test @Warmup(50) - @IR(counts = {IRNode.ADD_VHF, ">= 1"}, + @IR(counts = {IRNode.ADD_VHF, " >0 "}, applyIfCPUFeatureOr = {"avx512_fp16", "true", "zvfh", "true", "sve", "true"}) - @IR(counts = {IRNode.ADD_VHF, ">= 1"}, + @IR(counts = {IRNode.ADD_VHF, " >0 "}, applyIfCPUFeatureAnd = {"fphp", "true", "asimdhp", "true"}) public void vectorAddFloat16() { for (int i = 0; i < LEN; ++i) { @@ -98,18 +105,16 @@ public void vectorAddFloat16() { public void checkResultAdd() { for (int i = 0; i < LEN; ++i) { short expected = floatToFloat16(float16ToFloat(input1[i]) + float16ToFloat(input2[i])); - if (assertResults(expected, output[i])) { - throw new RuntimeException("Invalid result: [" + i + "] input1 = " + input1[i] + " input2 = " + input2[i] + - " output = " + output[i] + " expected = " + expected); - } + assertResults(2, input1[i], input2[i], expected, output[i]); } } + @Test @Warmup(50) - @IR(counts = {IRNode.SUB_VHF, ">= 1"}, + @IR(counts = {IRNode.SUB_VHF, " >0 "}, applyIfCPUFeatureOr = {"avx512_fp16", "true", "zvfh", "true", "sve", "true"}) - @IR(counts = {IRNode.SUB_VHF, ">= 1"}, + @IR(counts = {IRNode.SUB_VHF, " >0 "}, applyIfCPUFeatureAnd = {"fphp", "true", "asimdhp", "true"}) public void vectorSubFloat16() { for (int i = 0; i < LEN; ++i) { @@ -121,18 +126,16 @@ public void vectorSubFloat16() { public void checkResultSub() { for (int i = 0; i < LEN; ++i) { short expected = floatToFloat16(float16ToFloat(input1[i]) - float16ToFloat(input2[i])); - if (assertResults(expected, output[i])) { - throw new RuntimeException("Invalid result: [" + i + "] input1 = " + input1[i] + " input2 = " + input2[i] + - " output = " + output[i] + " expected = " + expected); - } + assertResults(2, input1[i], input2[i], expected, output[i]); } } + @Test @Warmup(50) - @IR(counts = {IRNode.MUL_VHF, ">= 1"}, + @IR(counts = {IRNode.MUL_VHF, " >0 "}, applyIfCPUFeatureOr = {"avx512_fp16", "true", "zvfh", "true", "sve", "true"}) - @IR(counts = {IRNode.MUL_VHF, ">= 1"}, + @IR(counts = {IRNode.MUL_VHF, " >0 "}, applyIfCPUFeatureAnd = {"fphp", "true", "asimdhp", "true"}) public void vectorMulFloat16() { for (int i = 0; i < LEN; ++i) { @@ -144,18 +147,15 @@ public void vectorMulFloat16() { public void checkResultMul() { for (int i = 0; i < LEN; ++i) { short expected = floatToFloat16(float16ToFloat(input1[i]) * float16ToFloat(input2[i])); - if (assertResults(expected, output[i])) { - throw new RuntimeException("Invalid result: [" + i + "] input1 = " + input1[i] + " input2 = " + input2[i] + - " output = " + output[i] + " expected = " + expected); - } + assertResults(2, input1[i], input2[i], expected, output[i]); } } @Test @Warmup(50) - @IR(counts = {IRNode.DIV_VHF, ">= 1"}, + @IR(counts = {IRNode.DIV_VHF, " >0 "}, applyIfCPUFeatureOr = {"avx512_fp16", "true", "zvfh", "true", "sve", "true"}) - @IR(counts = {IRNode.DIV_VHF, ">= 1"}, + @IR(counts = {IRNode.DIV_VHF, " >0 "}, applyIfCPUFeatureAnd = {"fphp", "true", "asimdhp", "true"}) public void vectorDivFloat16() { for (int i = 0; i < LEN; ++i) { @@ -167,18 +167,15 @@ public void vectorDivFloat16() { public void checkResultDiv() { for (int i = 0; i < LEN; ++i) { short expected = floatToFloat16(float16ToFloat(input1[i]) / float16ToFloat(input2[i])); - if (assertResults(expected, output[i])) { - throw new RuntimeException("Invalid result: [" + i + "] input1 = " + input1[i] + " input2 = " + input2[i] + - " output = " + output[i] + " expected = " + expected); - } + assertResults(2, input1[i], input2[i], expected, output[i]); } } @Test @Warmup(50) - @IR(counts = {IRNode.MIN_VHF, ">= 1"}, + @IR(counts = {IRNode.MIN_VHF, " >0 "}, applyIfCPUFeatureOr = {"avx512_fp16", "true", "zvfh", "true", "sve", "true"}) - @IR(counts = {IRNode.MIN_VHF, ">= 1"}, + @IR(counts = {IRNode.MIN_VHF, " >0 "}, applyIfCPUFeatureAnd = {"fphp", "true", "asimdhp", "true"}) public void vectorMinFloat16() { for (int i = 0; i < LEN; ++i) { @@ -190,18 +187,15 @@ public void vectorMinFloat16() { public void checkResultMin() { for (int i = 0; i < LEN; ++i) { short expected = floatToFloat16(Math.min(float16ToFloat(input1[i]), float16ToFloat(input2[i]))); - if (assertResults(expected, output[i])) { - throw new RuntimeException("Invalid result: [" + i + "] input1 = " + input1[i] + " input2 = " + input2[i] + - " output = " + output[i] + " expected = " + expected); - } + assertResults(2, input1[i], input2[i], expected, output[i]); } } @Test @Warmup(50) - @IR(counts = {IRNode.MAX_VHF, ">= 1"}, + @IR(counts = {IRNode.MAX_VHF, " >0 "}, applyIfCPUFeatureOr = {"avx512_fp16", "true", "zvfh", "true", "sve", "true"}) - @IR(counts = {IRNode.MAX_VHF, ">= 1"}, + @IR(counts = {IRNode.MAX_VHF, " >0 "}, applyIfCPUFeatureAnd = {"fphp", "true", "asimdhp", "true"}) public void vectorMaxFloat16() { for (int i = 0; i < LEN; ++i) { @@ -213,18 +207,15 @@ public void vectorMaxFloat16() { public void checkResultMax() { for (int i = 0; i < LEN; ++i) { short expected = floatToFloat16(Math.max(float16ToFloat(input1[i]), float16ToFloat(input2[i]))); - if (assertResults(expected, output[i])) { - throw new RuntimeException("Invalid result: [" + i + "] input1 = " + input1[i] + " input2 = " + input2[i] + - " output = " + output[i] + " expected = " + expected); - } + assertResults(2, input1[i], input2[i], expected, output[i]); } } @Test @Warmup(50) - @IR(counts = {IRNode.SQRT_VHF, ">= 1"}, + @IR(counts = {IRNode.SQRT_VHF, " >0 "}, applyIfCPUFeatureOr = {"avx512_fp16", "true", "zvfh", "true", "sve", "true"}) - @IR(counts = {IRNode.SQRT_VHF, ">= 1"}, + @IR(counts = {IRNode.SQRT_VHF, " >0 "}, applyIfCPUFeatureAnd = {"fphp", "true", "asimdhp", "true"}) public void vectorSqrtFloat16() { for (int i = 0; i < LEN; ++i) { @@ -236,18 +227,15 @@ public void vectorSqrtFloat16() { public void checkResultSqrt() { for (int i = 0; i < LEN; ++i) { short expected = float16ToRawShortBits(sqrt(shortBitsToFloat16(input1[i]))); - if (assertResults(expected, output[i])) { - throw new RuntimeException("Invalid result: [" + i + "] input = " + input1[i] + - " output = " + output[i] + " expected = " + expected); - } + assertResults(1, input1[i], expected, output[i]); } } @Test @Warmup(50) - @IR(counts = {IRNode.FMA_VHF, ">= 1"}, + @IR(counts = {IRNode.FMA_VHF, " >0 "}, applyIfCPUFeatureOr = {"avx512_fp16", "true", "zvfh", "true", "sve", "true"}) - @IR(counts = {IRNode.FMA_VHF, ">= 1"}, + @IR(counts = {IRNode.FMA_VHF, " >0 "}, applyIfCPUFeatureAnd = {"fphp", "true", "asimdhp", "true"}) public void vectorFmaFloat16() { for (int i = 0; i < LEN; ++i) { @@ -261,22 +249,19 @@ public void checkResultFma() { for (int i = 0; i < LEN; ++i) { short expected = float16ToRawShortBits(fma(shortBitsToFloat16(input1[i]), shortBitsToFloat16(input2[i]), shortBitsToFloat16(input3[i]))); - if (assertResults(expected, output[i])) { - throw new RuntimeException("Invalid result: [" + i + "] input1 = " + input1[i] + " input2 = " + input2[i] + - "input3 = " + input3[i] + " output = " + output[i] + " expected = " + expected); - } + assertResults(3, input1[i], input2[i], input3[i], expected, output[i]); } } @Test @Warmup(50) - @IR(counts = {IRNode.FMA_VHF, " >= 1"}, + @IR(counts = {IRNode.FMA_VHF, " >0 "}, applyIfCPUFeatureOr = {"avx512_fp16", "true", "zvfh", "true", "sve", "true"}) - @IR(counts = {IRNode.FMA_VHF, ">= 1"}, + @IR(counts = {IRNode.FMA_VHF, " >0 "}, applyIfCPUFeatureAnd = {"fphp", "true", "asimdhp", "true"}) public void vectorFmaFloat16ScalarMixedConstants() { for (int i = 0; i < LEN; ++i) { - output[i] = float16ToRawShortBits(fma(shortBitsToFloat16(input1[i]), shortBitsToFloat16(SCALAR_FP16), + output[i] = float16ToRawShortBits(fma(shortBitsToFloat16(input1[i]), shortBitsToFloat16(FP16_SCALAR), shortBitsToFloat16(floatToFloat16(3.0f)))); } } @@ -284,21 +269,18 @@ public void vectorFmaFloat16ScalarMixedConstants() { @Check(test="vectorFmaFloat16ScalarMixedConstants") public void checkResultFmaScalarMixedConstants() { for (int i = 0; i < LEN; ++i) { - short expected = float16ToRawShortBits(fma(shortBitsToFloat16(input1[i]), shortBitsToFloat16(SCALAR_FP16), + short expected = float16ToRawShortBits(fma(shortBitsToFloat16(input1[i]), shortBitsToFloat16(FP16_SCALAR), shortBitsToFloat16(floatToFloat16(3.0f)))); - if (assertResults(expected, output[i])) { - throw new RuntimeException("Invalid result: [" + i + "] input1 = " + input1[i] + " input2 = " + SCALAR_FP16 + - "input3 = 3.0 " + "output = " + output[i] + " expected = " + expected); - } + assertResults(2, input1[i], FP16_SCALAR, expected, output[i]); } } @Test @Warmup(50) - @IR(counts = {IRNode.FMA_VHF, " >= 1"}, + @IR(counts = {IRNode.FMA_VHF, " >0 "}, applyIfCPUFeatureOr = {"avx512_fp16", "true", "zvfh", "true", "sve", "true"}) - @IR(counts = {IRNode.FMA_VHF, ">= 1"}, + @IR(counts = {IRNode.FMA_VHF, " >0 "}, applyIfCPUFeatureAnd = {"fphp", "true", "asimdhp", "true"}) public void vectorFmaFloat16MixedConstants() { short input3 = floatToFloat16(3.0f); @@ -307,15 +289,13 @@ public void vectorFmaFloat16MixedConstants() { } } + @Check(test="vectorFmaFloat16MixedConstants") public void checkResultFmaMixedConstants() { short input3 = floatToFloat16(3.0f); for (int i = 0; i < LEN; ++i) { short expected = float16ToRawShortBits(fma(shortBitsToFloat16(input1[i]), shortBitsToFloat16(input2[i]), shortBitsToFloat16(input3))); - if (assertResults(expected, output[i])) { - throw new RuntimeException("Invalid result: [" + i + "] input1 = " + input1[i] + " input2 = " + input2[i] + - "input3 = " + input3 + " output = " + output[i] + " expected = " + expected); - } + assertResults(3, input1[i], input2[i], input3, expected, output[i]); } } @@ -341,10 +321,118 @@ public void checkResultFmaAllConstants() { short input3 = floatToFloat16(3.0f); for (int i = 0; i < LEN; ++i) { short expected = float16ToRawShortBits(fma(shortBitsToFloat16(input1), shortBitsToFloat16(input2), shortBitsToFloat16(input3))); - if (assertResults(expected, output[i])) { - throw new RuntimeException("Invalid result: [" + i + "] input1 = " + input1 + " input2 = " + input2 + - "input3 = " + input3 + " output = " + output[i] + " expected = " + expected); - } + assertResults(3, input1, input2, input3, expected, output[i]); + } + } + + + @Test + @Warmup(50) + @IR(counts = {IRNode.ADD_VHF, " >0 "}, + applyIfCPUFeatureOr = {"avx512_fp16", "true", "zvfh", "true", "sve", "true"}) + @IR(counts = {IRNode.ADD_VHF, " >0 "}, + applyIfCPUFeatureAnd = {"fphp", "true", "asimdhp", "true"}) + public void vectorAddConstInputFloat16() { + for (int i = 0; i < LEN; ++i) { + output[i] = float16ToRawShortBits(add(shortBitsToFloat16(input1[i]), FP16_CONST)); + } + } + + @Check(test="vectorAddConstInputFloat16") + public void checkResultAddConstantInputFloat16() { + for (int i = 0; i < LEN; ++i) { + short expected = floatToFloat16(float16ToFloat(input1[i]) + FP16_CONST.floatValue()); + assertResults(2, input1[i], float16ToRawShortBits(FP16_CONST), expected, output[i]); + } + } + + @Test + @Warmup(50) + @IR(counts = {IRNode.SUB_VHF, " >0 "}, + applyIfCPUFeature = {"avx512_fp16", "true"}) + public void vectorSubConstInputFloat16() { + for (int i = 0; i < LEN; ++i) { + output[i] = float16ToRawShortBits(subtract(shortBitsToFloat16(input1[i]), FP16_CONST)); + } + } + + @Check(test="vectorSubConstInputFloat16") + public void checkResultSubConstantInputFloat16() { + for (int i = 0; i < LEN; ++i) { + short expected = floatToFloat16(float16ToFloat(input1[i]) - FP16_CONST.floatValue()); + assertResults(2, input1[i], float16ToRawShortBits(FP16_CONST), expected, output[i]); + } + } + + @Test + @Warmup(50) + @IR(counts = {IRNode.MUL_VHF, " >0 "}, + applyIfCPUFeature = {"avx512_fp16", "true"}) + public void vectorMulConstantInputFloat16() { + for (int i = 0; i < LEN; ++i) { + output[i] = float16ToRawShortBits(multiply(FP16_CONST, shortBitsToFloat16(input2[i]))); + } + } + + @Check(test="vectorMulConstantInputFloat16") + public void checkResultMulConstantInputFloat16() { + for (int i = 0; i < LEN; ++i) { + short expected = floatToFloat16(FP16_CONST.floatValue() * float16ToFloat(input2[i])); + assertResults(2, float16ToRawShortBits(FP16_CONST), input2[i], expected, output[i]); + } + } + + @Test + @Warmup(50) + @IR(counts = {IRNode.DIV_VHF, " >0 "}, + applyIfCPUFeature = {"avx512_fp16", "true"}) + public void vectorDivConstantInputFloat16() { + for (int i = 0; i < LEN; ++i) { + output[i] = float16ToRawShortBits(divide(FP16_CONST, shortBitsToFloat16(input2[i]))); + } + } + + @Check(test="vectorDivConstantInputFloat16") + public void checkResultDivConstantInputFloat16() { + for (int i = 0; i < LEN; ++i) { + short expected = floatToFloat16(FP16_CONST.floatValue() / float16ToFloat(input2[i])); + assertResults(2, float16ToRawShortBits(FP16_CONST), input2[i], expected, output[i]); + } + } + + @Test + @Warmup(50) + @IR(counts = {IRNode.MAX_VHF, " >0 "}, + applyIfCPUFeature = {"avx512_fp16", "true"}) + public void vectorMaxConstantInputFloat16() { + for (int i = 0; i < LEN; ++i) { + output[i] = float16ToRawShortBits(max(FP16_CONST, shortBitsToFloat16(input2[i]))); + } + } + + @Check(test="vectorMaxConstantInputFloat16") + public void checkResultMaxConstantInputFloat16() { + for (int i = 0; i < LEN; ++i) { + short expected = floatToFloat16(Math.max(FP16_CONST.floatValue(), float16ToFloat(input2[i]))); + assertResults(2, float16ToRawShortBits(FP16_CONST), input2[i], expected, output[i]); + } + } + + @Test + @Warmup(50) + @IR(counts = {IRNode.MIN_VHF, " >0 "}, + applyIfCPUFeature = {"avx512_fp16", "true"}) + public void vectorMinConstantInputFloat16() { + for (int i = 0; i < LEN; ++i) { + output[i] = float16ToRawShortBits(min(FP16_CONST, shortBitsToFloat16(input2[i]))); + } + } + + @Check(test="vectorMinConstantInputFloat16") + public void checkResultMinConstantInputFloat16() { + for (int i = 0; i < LEN; ++i) { + short expected = floatToFloat16(Math.min(FP16_CONST.floatValue(), float16ToFloat(input2[i]))); + assertResults(2, float16ToRawShortBits(FP16_CONST), input2[i], expected, output[i]); } } } diff --git a/test/hotspot/jtreg/compiler/whitebox/AllocationCodeBlobTest.java b/test/hotspot/jtreg/compiler/whitebox/AllocationCodeBlobTest.java index 29168a1e7e8..e19e91fd8ce 100644 --- a/test/hotspot/jtreg/compiler/whitebox/AllocationCodeBlobTest.java +++ b/test/hotspot/jtreg/compiler/whitebox/AllocationCodeBlobTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2025, 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 @@ -54,7 +54,7 @@ public class AllocationCodeBlobTest { private static final WhiteBox WHITE_BOX = WhiteBox.getWhiteBox(); private static final long CODE_CACHE_SIZE - = WHITE_BOX.getUintxVMFlag("ReservedCodeCacheSize"); + = WHITE_BOX.getSizeTVMFlag("ReservedCodeCacheSize"); private static final int SIZE = 1; public static void main(String[] args) { diff --git a/test/hotspot/jtreg/containers/docker/DockerBasicTest.java b/test/hotspot/jtreg/containers/docker/DockerBasicTest.java index 9233b199532..8e2c0b6a85a 100644 --- a/test/hotspot/jtreg/containers/docker/DockerBasicTest.java +++ b/test/hotspot/jtreg/containers/docker/DockerBasicTest.java @@ -26,6 +26,7 @@ * @test * @summary Basic (sanity) test for JDK-under-test inside a docker image. * @requires container.support + * @requires !vm.asan * @library /test/lib * @modules java.base/jdk.internal.misc * java.management diff --git a/test/hotspot/jtreg/containers/docker/ShareTmpDir.java b/test/hotspot/jtreg/containers/docker/ShareTmpDir.java index 43cd6ec5152..9a4748563bd 100644 --- a/test/hotspot/jtreg/containers/docker/ShareTmpDir.java +++ b/test/hotspot/jtreg/containers/docker/ShareTmpDir.java @@ -28,6 +28,7 @@ * @key cgroups * @summary Test for hsperfdata file name conflict when two containers share the same /tmp directory * @requires container.support + * @requires !vm.asan * @library /test/lib * @build WaitForFlagFile * @run driver ShareTmpDir diff --git a/test/hotspot/jtreg/containers/docker/TestCPUAwareness.java b/test/hotspot/jtreg/containers/docker/TestCPUAwareness.java index c51bfa1abbb..99220201f66 100644 --- a/test/hotspot/jtreg/containers/docker/TestCPUAwareness.java +++ b/test/hotspot/jtreg/containers/docker/TestCPUAwareness.java @@ -27,6 +27,7 @@ * @key cgroups * @summary Test JVM's CPU resource awareness when running inside docker container * @requires container.support + * @requires !vm.asan * @library /test/lib * @modules java.base/jdk.internal.misc * java.base/jdk.internal.platform diff --git a/test/hotspot/jtreg/containers/docker/TestCPUSets.java b/test/hotspot/jtreg/containers/docker/TestCPUSets.java index aabe82e131f..7894172e401 100644 --- a/test/hotspot/jtreg/containers/docker/TestCPUSets.java +++ b/test/hotspot/jtreg/containers/docker/TestCPUSets.java @@ -27,6 +27,7 @@ * @key cgroups * @summary Test JVM's awareness of cpu sets (cpus and mems) * @requires container.support + * @requires !vm.asan * @requires (os.arch != "s390x") * @library /test/lib * @modules java.base/jdk.internal.misc diff --git a/test/hotspot/jtreg/containers/docker/TestContainerInfo.java b/test/hotspot/jtreg/containers/docker/TestContainerInfo.java index 5db3c2af098..b9b6fb65b75 100644 --- a/test/hotspot/jtreg/containers/docker/TestContainerInfo.java +++ b/test/hotspot/jtreg/containers/docker/TestContainerInfo.java @@ -28,6 +28,7 @@ * @summary Test container info for cgroup v2 * @key cgroups * @requires container.support + * @requires !vm.asan * @library /test/lib * @modules java.base/jdk.internal.misc * java.management diff --git a/test/hotspot/jtreg/containers/docker/TestJFREvents.java b/test/hotspot/jtreg/containers/docker/TestJFREvents.java index 77c735cde00..c8905f4e49c 100644 --- a/test/hotspot/jtreg/containers/docker/TestJFREvents.java +++ b/test/hotspot/jtreg/containers/docker/TestJFREvents.java @@ -30,6 +30,7 @@ * Also make sure that PIDs are based on value provided by container, * not by the host system. * @requires (container.support & os.maxMemory >= 2g) + * @requires !vm.asan * @modules java.base/jdk.internal.platform * @library /test/lib * @modules java.base/jdk.internal.misc diff --git a/test/hotspot/jtreg/containers/docker/TestJFRNetworkEvents.java b/test/hotspot/jtreg/containers/docker/TestJFRNetworkEvents.java index 9f9497d9c63..c0dde368d1e 100644 --- a/test/hotspot/jtreg/containers/docker/TestJFRNetworkEvents.java +++ b/test/hotspot/jtreg/containers/docker/TestJFRNetworkEvents.java @@ -28,6 +28,7 @@ * the reported host ip and host name are correctly reported within * the container. * @requires container.support + * @requires !vm.asan * @library /test/lib * @modules java.base/jdk.internal.misc * java.management diff --git a/test/hotspot/jtreg/containers/docker/TestJFRWithJMX.java b/test/hotspot/jtreg/containers/docker/TestJFRWithJMX.java index b7517254281..a9de46e00b0 100644 --- a/test/hotspot/jtreg/containers/docker/TestJFRWithJMX.java +++ b/test/hotspot/jtreg/containers/docker/TestJFRWithJMX.java @@ -26,6 +26,7 @@ * @test * @summary Test JFR recording controlled via JMX across container boundary. * @requires container.support + * @requires !vm.asan * @library /test/lib * @modules java.base/jdk.internal.misc * java.management diff --git a/test/hotspot/jtreg/containers/docker/TestJcmdWithSideCar.java b/test/hotspot/jtreg/containers/docker/TestJcmdWithSideCar.java index 9feeda6f4ad..91a07012f00 100644 --- a/test/hotspot/jtreg/containers/docker/TestJcmdWithSideCar.java +++ b/test/hotspot/jtreg/containers/docker/TestJcmdWithSideCar.java @@ -31,6 +31,7 @@ * namespace such as PID namespace, specific sub-directories, IPC and more. * @requires container.support * @requires vm.flagless + * @requires !vm.asan * @modules java.base/jdk.internal.misc * java.management * jdk.jartool/sun.tools.jar diff --git a/test/hotspot/jtreg/containers/docker/TestLimitsUpdating.java b/test/hotspot/jtreg/containers/docker/TestLimitsUpdating.java index 14227a71068..7b05669085c 100644 --- a/test/hotspot/jtreg/containers/docker/TestLimitsUpdating.java +++ b/test/hotspot/jtreg/containers/docker/TestLimitsUpdating.java @@ -30,6 +30,7 @@ * @key cgroups * @summary Test container limits updating as they get updated at runtime without restart * @requires container.support + * @requires !vm.asan * @library /test/lib * @build jdk.test.whitebox.WhiteBox LimitUpdateChecker * @run driver jdk.test.lib.helpers.ClassFileInstaller -jar whitebox.jar jdk.test.whitebox.WhiteBox diff --git a/test/hotspot/jtreg/containers/docker/TestMemoryWithCgroupV1.java b/test/hotspot/jtreg/containers/docker/TestMemoryWithCgroupV1.java index f8c8b34135d..f80a83842c9 100644 --- a/test/hotspot/jtreg/containers/docker/TestMemoryWithCgroupV1.java +++ b/test/hotspot/jtreg/containers/docker/TestMemoryWithCgroupV1.java @@ -32,6 +32,7 @@ * @test * @key cgroups * @requires os.family == "linux" + * @requires !vm.asan * @modules java.base/jdk.internal.platform * @library /test/lib * @build jdk.test.whitebox.WhiteBox PrintContainerInfo CheckOperatingSystemMXBean diff --git a/test/hotspot/jtreg/containers/docker/TestMemoryWithSubgroups.java b/test/hotspot/jtreg/containers/docker/TestMemoryWithSubgroups.java index a75f314b53d..bd1713e578c 100644 --- a/test/hotspot/jtreg/containers/docker/TestMemoryWithSubgroups.java +++ b/test/hotspot/jtreg/containers/docker/TestMemoryWithSubgroups.java @@ -36,6 +36,7 @@ * @test * @bug 8343191 * @requires os.family == "linux" + * @requires !vm.asan * @modules java.base/jdk.internal.platform * @library /test/lib * @build jdk.test.whitebox.WhiteBox diff --git a/test/hotspot/jtreg/containers/docker/TestMisc.java b/test/hotspot/jtreg/containers/docker/TestMisc.java index a811666999b..a1998cef344 100644 --- a/test/hotspot/jtreg/containers/docker/TestMisc.java +++ b/test/hotspot/jtreg/containers/docker/TestMisc.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2017, 2025, 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 @@ -26,6 +26,7 @@ * @test * @summary Test miscellanous functionality related to JVM running in docker container * @requires container.support + * @requires !vm.asan * @library /test/lib * @modules java.base/jdk.internal.misc * java.management @@ -110,9 +111,11 @@ private static void checkContainerInfo(OutputAnalyzer out) throws Exception { "CPU Shares", "CPU Quota", "CPU Period", + "CPU Usage", "OSContainer::active_processor_count", "Memory Limit", "Memory Soft Limit", + "Memory Throttle Limit", "Memory Usage", "Maximum Memory Usage", "memory_max_usage_in_bytes", diff --git a/test/hotspot/jtreg/containers/docker/TestPids.java b/test/hotspot/jtreg/containers/docker/TestPids.java index 9b65a1b1ee8..2e9c97110b2 100644 --- a/test/hotspot/jtreg/containers/docker/TestPids.java +++ b/test/hotspot/jtreg/containers/docker/TestPids.java @@ -28,6 +28,7 @@ * @key cgroups * @summary Test JVM's awareness of pids controller * @requires container.support + * @requires !vm.asan * @library /test/lib * @modules java.base/jdk.internal.misc * java.management diff --git a/test/hotspot/jtreg/gc/TestNativeReferenceGet.java b/test/hotspot/jtreg/gc/TestNativeReferenceGet.java new file mode 100644 index 00000000000..222d250f79a --- /dev/null +++ b/test/hotspot/jtreg/gc/TestNativeReferenceGet.java @@ -0,0 +1,181 @@ +/* + * Copyright (c) 2025, 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 gc; + +/** + * @test + * @bug 8352565 + * @summary Determine whether the native method implementation of + * Reference.get() works as expected. Disable the intrinsic implementation to + * force use of the native method. + * @library /test/lib + * @modules java.base/java.lang.ref:open + * @build jdk.test.whitebox.WhiteBox + * @run driver jdk.test.lib.helpers.ClassFileInstaller jdk.test.whitebox.WhiteBox + * @run main/othervm + * -Xbootclasspath/a:. + * -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI + * -XX:DisableIntrinsic=_Reference_get0 + * gc.TestNativeReferenceGet + */ + +import java.lang.ref.ReferenceQueue; +import java.lang.ref.WeakReference; +import java.util.ArrayList; +import java.util.List; +import jdk.test.whitebox.WhiteBox; + +public final class TestNativeReferenceGet { + + private static final WhiteBox WB = WhiteBox.getWhiteBox(); + + private static void gcUntilOld(Object o) { + while (!WB.isObjectInOldGen(o)) { + WB.fullGC(); + } + } + + private static final class TestObject { + public final int value; + + public TestObject(int value) { + this.value = value; + } + } + + private static final ReferenceQueue queue = + new ReferenceQueue(); + + private static final class Ref extends WeakReference { + public Ref(TestObject obj) { + super(obj, queue); + } + } + + private static final int NUM_REFS = 100; + + private static List references = null; + private static List referents = null; + + // Create all the objects used by the test, and ensure they are all in the + // old generation. + private static void setup() { + references = new ArrayList(NUM_REFS); + referents = new ArrayList(NUM_REFS); + + for (int i = 0; i < NUM_REFS; ++i) { + TestObject obj = new TestObject(i); + referents.add(obj); + references.add(new Ref(obj)); + } + + gcUntilOld(references); + gcUntilOld(referents); + for (int i = 0; i < NUM_REFS; ++i) { + gcUntilOld(references.get(i)); + gcUntilOld(referents.get(i)); + } + } + + // Discard all the strong references. + private static void dropReferents() { + // Not using List.clear() because it doesn't document null'ing elements. + for (int i = 0; i < NUM_REFS; ++i) { + referents.set(i, null); + } + } + + // Create new strong references from the weak references, by using the + // native method implementation of Reference.get() and recording the value + // in references. + private static void strengthenReferents() { + for (int i = 0; i < NUM_REFS; ++i) { + referents.set(i, references.get(i).get()); + } + } + + private static void check() { + // None of the references should have been cleared and enqueued, + // because we have strong references to all the referents. + try { + while (WB.waitForReferenceProcessing()) {} + } catch (InterruptedException e) { + throw new RuntimeException("Test interrupted"); + } + if (queue.poll() != null) { + throw new RuntimeException("Reference enqueued"); + } + + // Check details of expected state. + for (int i = 0; i < NUM_REFS; ++i) { + Ref reference = (Ref) references.get(i); + TestObject referent = reference.get(); + if (referent == null) { + throw new RuntimeException("Referent not strengthened"); + } else if (referent != referents.get(i)) { + throw new RuntimeException( + "Reference referent differs from saved referent: " + i); + } else if (referent.value != i) { + throw new RuntimeException( + "Referent " + i + " value: " + referent.value); + } + } + } + + private static void testConcurrent() { + System.out.println("Testing concurrent GC"); + try { + WB.concurrentGCAcquireControl(); + dropReferents(); + WB.concurrentGCRunTo(WB.BEFORE_MARKING_COMPLETED); + strengthenReferents(); + WB.concurrentGCRunToIdle(); + check(); + } finally { + WB.concurrentGCReleaseControl(); + } + } + + private static void testNonconcurrent() { + System.out.println("Testing nonconcurrent GC"); + // A GC between clearing and strengthening will result in test failure. + // We try to make that unlikely via this immediately preceeding GC. + WB.fullGC(); + dropReferents(); + strengthenReferents(); + WB.fullGC(); + check(); + } + + public static final void main(String[] args) { + setup(); + if (WB.supportsConcurrentGCBreakpoints()) { + testConcurrent(); + } else { + testNonconcurrent(); + } + } +} diff --git a/test/hotspot/jtreg/gc/arguments/TestUseCompressedOopsFlagsWithUlimit.java b/test/hotspot/jtreg/gc/arguments/TestUseCompressedOopsFlagsWithUlimit.java index 40d83739ef5..40f607bf8a1 100644 --- a/test/hotspot/jtreg/gc/arguments/TestUseCompressedOopsFlagsWithUlimit.java +++ b/test/hotspot/jtreg/gc/arguments/TestUseCompressedOopsFlagsWithUlimit.java @@ -31,6 +31,8 @@ * @library /test/lib * @library / * @requires vm.bits == "64" + * @comment ulimit clashes with the memory requirements of ASAN + * @requires !vm.asan * @requires os.family == "linux" * @requires vm.gc != "Z" * @requires vm.opt.UseCompressedOops == null diff --git a/test/hotspot/jtreg/gc/shenandoah/compiler/TestLostAntiDependencyAtExpansion.java b/test/hotspot/jtreg/gc/shenandoah/compiler/TestLostAntiDependencyAtExpansion.java new file mode 100644 index 00000000000..bcdf964a1fa --- /dev/null +++ b/test/hotspot/jtreg/gc/shenandoah/compiler/TestLostAntiDependencyAtExpansion.java @@ -0,0 +1,67 @@ +/* + * Copyright (c) 2025, Red Hat, Inc. 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. + * + * 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. + */ + +/** + * @test + * @bug 8358334 + * @summary C2/Shenandoah: incorrect execution with Unsafe + * @requires vm.gc.Shenandoah + * @modules java.base/jdk.internal.misc:+open + * + * @run main/othervm -XX:-UseOnStackReplacement -XX:-BackgroundCompilation -XX:-TieredCompilation -XX:+UseShenandoahGC + * TestLostAntiDependencyAtExpansion + * + * + */ + +import jdk.internal.misc.Unsafe; + +public class TestLostAntiDependencyAtExpansion { + static final jdk.internal.misc.Unsafe UNSAFE = Unsafe.getUnsafe(); + + public static void main(String[] args) { + long addr = UNSAFE.allocateMemory(8); + for (int i = 0; i < 20_000; i++) { + UNSAFE.putLong(addr, 42L); + long res = test1(addr); + if (res != 42L) { + throw new RuntimeException("Incorrect result: " + res); + } + } + } + + static class A { + long field; + } + + static A a = new A(); + + private static long test1(long addr) { + long tmp = UNSAFE.getLong(addr); + + UNSAFE.putLong(addr, 0L); + + return tmp + a.field; + } + +} diff --git a/test/hotspot/jtreg/gc/shenandoah/generational/TestOldGrowthTriggers.java b/test/hotspot/jtreg/gc/shenandoah/generational/TestOldGrowthTriggers.java index 840ceffc4fe..b5d191e33ba 100644 --- a/test/hotspot/jtreg/gc/shenandoah/generational/TestOldGrowthTriggers.java +++ b/test/hotspot/jtreg/gc/shenandoah/generational/TestOldGrowthTriggers.java @@ -57,17 +57,17 @@ public static void makeOldAllocations() { for (int i = 0; i < ArraySize; i++) { int replaceIndex = r.nextInt(ArraySize); int deriveIndex = r.nextInt(ArraySize); - switch (i & 0x3) { - case 0: + switch (i & 0x7) { + case 0,1,2: // creates new old BigInteger, releases old BigInteger, // may create ephemeral data while computing gcd array[replaceIndex] = array[replaceIndex].gcd(array[deriveIndex]); break; - case 1: + case 3,4: // creates new old BigInteger, releases old BigInteger array[replaceIndex] = array[replaceIndex].multiply(array[deriveIndex]); break; - case 2,3: + case 5,6,7: // do nothing, let all objects in the array age to increase pressure on old generation break; } diff --git a/test/hotspot/jtreg/gtest/LockStackGtests.java b/test/hotspot/jtreg/gtest/LockStackGtests.java deleted file mode 100644 index e426b2c56f3..00000000000 --- a/test/hotspot/jtreg/gtest/LockStackGtests.java +++ /dev/null @@ -1,32 +0,0 @@ -/* - * Copyright (c) 2023, 2024, 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. - * - * 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. - * - */ - -/* @test - * @summary Run LockStack gtests with LockingMode=2 - * @library /test/lib - * @modules java.base/jdk.internal.misc - * java.xml - * @requires vm.flagless - * @run main/native GTestWrapper --gtest_filter=LockStackTest* -XX:LockingMode=2 - */ diff --git a/test/hotspot/jtreg/runtime/FieldStream/LocalFieldLookupTest.java b/test/hotspot/jtreg/runtime/FieldStream/LocalFieldLookupTest.java new file mode 100644 index 00000000000..bebef5acd0c --- /dev/null +++ b/test/hotspot/jtreg/runtime/FieldStream/LocalFieldLookupTest.java @@ -0,0 +1,140 @@ +/* + * Copyright (c) 2025, 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. + * + * 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. + */ + +import org.objectweb.asm.ClassWriter; +import org.objectweb.asm.MethodVisitor; +import org.objectweb.asm.Opcodes; + +import static org.objectweb.asm.ClassWriter.COMPUTE_FRAMES; +import static org.objectweb.asm.ClassWriter.COMPUTE_MAXS; +import static org.objectweb.asm.Opcodes.*; + +/* + * @test id=defaults + * @bug 8352075 + * @library /test/lib + * @library /testlibrary/asm + * @run main/othervm LocalFieldLookupTest + */ +/* + * @test id=custom-threshold + * @bug 8352075 + * @library /test/lib + * @library /testlibrary/asm + * @requires vm.debug == true + * @run main/othervm LocalFieldLookupTest + * @run main/othervm -XX:BinarySearchThreshold=0 LocalFieldLookupTest + * @run main/othervm -XX:BinarySearchThreshold=1 LocalFieldLookupTest + * @run main/othervm -XX:BinarySearchThreshold=15 LocalFieldLookupTest + * @run main/othervm -XX:BinarySearchThreshold=100000 LocalFieldLookupTest + */ +public class LocalFieldLookupTest { + private static final String TEST_CLASS_NAME = "Test"; + private static final int MAX_FIELDS_IN_METHOD = 10000; + + public static void main(String[] args) throws ClassNotFoundException, InstantiationException, IllegalAccessException { + // Test small classes, covering the tested thresholds + for (int i = 0; i <= 33; ++i) { + makeClass(i).newInstance(); + } + // Test classes around 256 fields (index encoding 1/2 bytes) to check off-by-one errors + for (int i = 254; i <= 259; ++i) { + makeClass(255).newInstance(); + } + // We would like to test #fields that create have the stream about 65536 bytes long; + // this value is not exposed, though, so these are rather experimentally found values, + // hence fragile. Moreover, since the stream length is incremented by about 8 bytes + // for each field we cannot test for off-by-one errors reliably. + for (int i = 8433; i <= 8437; ++i) { + makeClass(i).newInstance(); + } + // The largest class we can create - this one has 65533 entries in the constant pool + makeClass(26205).newInstance(); + } + + public static Class makeClass(int fields) throws ClassNotFoundException { + ClassWriter writer = new ClassWriter(COMPUTE_MAXS | COMPUTE_FRAMES); + writer.visit(49, Opcodes.ACC_PUBLIC + Opcodes.ACC_SUPER, TEST_CLASS_NAME,null, "java/lang/Object", null); + + for (int i = 0; i < fields; i += 2) { + writer.visitField(ACC_PUBLIC, "f" + i, "I", null, null); + // Let's use duplicate names to confirm search takes signatures into account + if (i + 1 < fields) { + writer.visitField(ACC_PUBLIC, "f" + i, "J", null, null); + } + } + // We initialize fields in multiple methods to avoid running into bytecode limit per method + MethodVisitor fi = null; + for (int i = 0; i < fields; i+= 2) { + if (fi == null) { + fi = writer.visitMethod(ACC_PRIVATE, "init" + i, "()V", null, null); + fi.visitCode(); + } + fi.visitVarInsn(Opcodes.ALOAD, 0); + fi.visitInsn(Opcodes.ICONST_2); + fi.visitFieldInsn(PUTFIELD, TEST_CLASS_NAME, "f" + i, "I"); + if (i + 1 < fields) { + fi.visitVarInsn(Opcodes.ALOAD, 0); + fi.visitInsn(Opcodes.LCONST_1); + fi.visitFieldInsn(PUTFIELD, TEST_CLASS_NAME, "f" + i, "J"); + } + if (i % MAX_FIELDS_IN_METHOD == MAX_FIELDS_IN_METHOD - 2) { + fi.visitInsn(Opcodes.RETURN); + fi.visitMaxs(0, 0); + fi.visitEnd(); + fi = null; + } + } + if (fi != null) { + fi.visitInsn(Opcodes.RETURN); + fi.visitMaxs(0, 0); + fi.visitEnd(); + } + { + MethodVisitor mv = writer.visitMethod(ACC_PUBLIC, "", "()V", null, null); + mv.visitCode(); + mv.visitVarInsn(ALOAD, 0); + mv.visitMethodInsn(INVOKESPECIAL, "java/lang/Object", "", "()V", false); + for (int i = 0; i < fields; i += MAX_FIELDS_IN_METHOD) { + mv.visitVarInsn(ALOAD, 0); + mv.visitMethodInsn(INVOKESPECIAL, TEST_CLASS_NAME, "init" + i, "()V", false); + } + mv.visitInsn(RETURN); + mv.visitMaxs(0, 0); + mv.visitEnd(); + } + writer.visitEnd(); + + byte[] bytecode = writer.toByteArray(); + ClassLoader cl = new ClassLoader() { + @Override + protected Class findClass(String name) throws ClassNotFoundException { + if (!TEST_CLASS_NAME.equals(name)) { + throw new ClassNotFoundException(); + } + return defineClass(TEST_CLASS_NAME, bytecode, 0, bytecode.length); + } + }; + return cl.loadClass(TEST_CLASS_NAME); + } +} diff --git a/test/hotspot/jtreg/runtime/Monitor/ConcurrentDeflation.java b/test/hotspot/jtreg/runtime/Monitor/ConcurrentDeflation.java index 9ceec3b9d8d..88dafed4a41 100644 --- a/test/hotspot/jtreg/runtime/Monitor/ConcurrentDeflation.java +++ b/test/hotspot/jtreg/runtime/Monitor/ConcurrentDeflation.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2023, 2025, 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 @@ -24,6 +24,7 @@ import jdk.test.lib.process.OutputAnalyzer; import jdk.test.lib.Platform; import jdk.test.lib.process.ProcessTools; +import jdk.test.whitebox.WhiteBox; import java.lang.management.ManagementFactory; import java.lang.management.ThreadInfo; @@ -34,10 +35,13 @@ * @bug 8318757 * @summary Test concurrent monitor deflation by MonitorDeflationThread and thread dumping * @library /test/lib - * @run main/othervm -XX:+UnlockDiagnosticVMOptions -XX:GuaranteedAsyncDeflationInterval=2000 -XX:LockingMode=0 ConcurrentDeflation + * @build jdk.test.whitebox.WhiteBox + * @run driver jdk.test.lib.helpers.ClassFileInstaller jdk.test.whitebox.WhiteBox + * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions -XX:GuaranteedAsyncDeflationInterval=2000 -XX:+WhiteBoxAPI ConcurrentDeflation */ public class ConcurrentDeflation { + static final WhiteBox WB = WhiteBox.getWhiteBox(); public static final long TOTAL_RUN_TIME_NS = 10_000_000_000L; public static Object[] monitors = new Object[1000]; public static int monitorCount; @@ -73,6 +77,12 @@ static private void createMonitors() { index = index++ % 1000; monitors[index] = new Object(); synchronized (monitors[index]) { + try { + // Force inflation + monitors[index].wait(1); + } catch (InterruptedException e) { + throw new RuntimeException(e); + } monitorCount++; } } diff --git a/test/hotspot/jtreg/runtime/Monitor/StressWrapper_TestRecursiveLocking_36M.java b/test/hotspot/jtreg/runtime/Monitor/StressWrapper_TestRecursiveLocking_36M.java index b12f0f007f8..0eeacabb82f 100644 --- a/test/hotspot/jtreg/runtime/Monitor/StressWrapper_TestRecursiveLocking_36M.java +++ b/test/hotspot/jtreg/runtime/Monitor/StressWrapper_TestRecursiveLocking_36M.java @@ -33,21 +33,6 @@ * @run main/othervm/timeout=240 -Xbootclasspath/a:. * -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI * -Xint - * -XX:LockingMode=0 - * -Xms256m -Xmx256m - * TestRecursiveLocking 120 1 - * - * @run main/othervm/timeout=240 -Xbootclasspath/a:. - * -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI - * -Xint - * -XX:LockingMode=1 - * -Xms256m -Xmx256m - * TestRecursiveLocking 120 1 - * - * @run main/othervm/timeout=240 -Xbootclasspath/a:. - * -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI - * -Xint - * -XX:LockingMode=2 * -Xms256m -Xmx256m * TestRecursiveLocking 120 1 */ @@ -63,21 +48,6 @@ * @run main/othervm/timeout=240 -Xbootclasspath/a:. * -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI * -Xint - * -XX:LockingMode=0 - * -Xms256m -Xmx256m - * TestRecursiveLocking 120 2 - * - * @run main/othervm/timeout=240 -Xbootclasspath/a:. - * -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI - * -Xint - * -XX:LockingMode=1 - * -Xms256m -Xmx256m - * TestRecursiveLocking 120 2 - * - * @run main/othervm/timeout=240 -Xbootclasspath/a:. - * -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI - * -Xint - * -XX:LockingMode=2 * -Xms256m -Xmx256m * TestRecursiveLocking 120 2 */ @@ -94,21 +64,6 @@ * @run main/othervm/timeout=240 -Xbootclasspath/a:. * -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI * -XX:TieredStopAtLevel=1 - * -XX:LockingMode=0 - * -Xms256m -Xmx256m - * TestRecursiveLocking 120 1 - * - * @run main/othervm/timeout=240 -Xbootclasspath/a:. - * -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI - * -XX:TieredStopAtLevel=1 - * -XX:LockingMode=1 - * -Xms256m -Xmx256m - * TestRecursiveLocking 120 1 - * - * @run main/othervm/timeout=240 -Xbootclasspath/a:. - * -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI - * -XX:TieredStopAtLevel=1 - * -XX:LockingMode=2 * -Xms256m -Xmx256m * TestRecursiveLocking 120 1 */ @@ -125,21 +80,6 @@ * @run main/othervm/timeout=240 -Xbootclasspath/a:. * -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI * -XX:TieredStopAtLevel=1 - * -XX:LockingMode=0 - * -Xms256m -Xmx256m - * TestRecursiveLocking 120 2 - * - * @run main/othervm/timeout=240 -Xbootclasspath/a:. - * -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI - * -XX:TieredStopAtLevel=1 - * -XX:LockingMode=1 - * -Xms256m -Xmx256m - * TestRecursiveLocking 120 2 - * - * @run main/othervm/timeout=240 -Xbootclasspath/a:. - * -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI - * -XX:TieredStopAtLevel=1 - * -XX:LockingMode=2 * -Xms256m -Xmx256m * TestRecursiveLocking 120 2 */ @@ -156,21 +96,6 @@ * @run main/othervm/timeout=240 -Xbootclasspath/a:. * -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI * -XX:-EliminateNestedLocks - * -XX:LockingMode=0 - * -Xms256m -Xmx256m - * TestRecursiveLocking 120 1 - * - * @run main/othervm/timeout=240 -Xbootclasspath/a:. - * -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI - * -XX:-EliminateNestedLocks - * -XX:LockingMode=1 - * -Xms256m -Xmx256m - * TestRecursiveLocking 120 1 - * - * @run main/othervm/timeout=240 -Xbootclasspath/a:. - * -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI - * -XX:-EliminateNestedLocks - * -XX:LockingMode=2 * -Xms256m -Xmx256m * TestRecursiveLocking 120 1 */ @@ -182,25 +107,10 @@ * @summary Tests recursive locking in C2 in alternate A and B mode. * @library /testlibrary /test/lib * @build jdk.test.whitebox.WhiteBox - * * @run driver jdk.test.lib.helpers.ClassFileInstaller jdk.test.whitebox.WhiteBox - * @run main/othervm/timeout=240 -Xbootclasspath/a:. - * -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI - * -XX:LockingMode=0 - * -XX:-EliminateNestedLocks - * -Xms256m -Xmx256m - * TestRecursiveLocking 120 2 - * - * @run main/othervm/timeout=240 -Xbootclasspath/a:. - * -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI - * -XX:LockingMode=1 - * -XX:-EliminateNestedLocks - * -Xms256m -Xmx256m - * TestRecursiveLocking 120 2 * * @run main/othervm/timeout=240 -Xbootclasspath/a:. * -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI - * -XX:LockingMode=2 * -XX:-EliminateNestedLocks * -Xms256m -Xmx256m * TestRecursiveLocking 120 2 diff --git a/test/hotspot/jtreg/runtime/Monitor/TestRecursiveLocking.java b/test/hotspot/jtreg/runtime/Monitor/TestRecursiveLocking.java index eae845c48b1..bea7a41ae2b 100644 --- a/test/hotspot/jtreg/runtime/Monitor/TestRecursiveLocking.java +++ b/test/hotspot/jtreg/runtime/Monitor/TestRecursiveLocking.java @@ -33,21 +33,6 @@ * @run main/othervm -Xbootclasspath/a:. * -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI * -Xint - * -XX:LockingMode=0 - * -Xms256m -Xmx256m - * TestRecursiveLocking 5 1 - * - * @run main/othervm -Xbootclasspath/a:. - * -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI - * -Xint - * -XX:LockingMode=1 - * -Xms256m -Xmx256m - * TestRecursiveLocking 5 1 - * - * @run main/othervm -Xbootclasspath/a:. - * -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI - * -Xint - * -XX:LockingMode=2 * -Xms256m -Xmx256m * TestRecursiveLocking 5 1 */ @@ -63,21 +48,6 @@ * @run main/othervm -Xbootclasspath/a:. * -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI * -Xint - * -XX:LockingMode=0 - * -Xms256m -Xmx256m - * TestRecursiveLocking 5 2 - * - * @run main/othervm -Xbootclasspath/a:. - * -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI - * -Xint - * -XX:LockingMode=1 - * -Xms256m -Xmx256m - * TestRecursiveLocking 5 2 - * - * @run main/othervm -Xbootclasspath/a:. - * -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI - * -Xint - * -XX:LockingMode=2 * -Xms256m -Xmx256m * TestRecursiveLocking 5 2 */ @@ -94,21 +64,6 @@ * @run main/othervm -Xbootclasspath/a:. * -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI * -XX:TieredStopAtLevel=1 - * -XX:LockingMode=0 - * -Xms256m -Xmx256m - * TestRecursiveLocking 5 1 - * - * @run main/othervm -Xbootclasspath/a:. - * -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI - * -XX:TieredStopAtLevel=1 - * -XX:LockingMode=1 - * -Xms256m -Xmx256m - * TestRecursiveLocking 5 1 - * - * @run main/othervm -Xbootclasspath/a:. - * -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI - * -XX:TieredStopAtLevel=1 - * -XX:LockingMode=2 * -Xms256m -Xmx256m * TestRecursiveLocking 5 1 */ @@ -125,21 +80,6 @@ * @run main/othervm -Xbootclasspath/a:. * -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI * -XX:TieredStopAtLevel=1 - * -XX:LockingMode=0 - * -Xms256m -Xmx256m - * TestRecursiveLocking 5 2 - * - * @run main/othervm -Xbootclasspath/a:. - * -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI - * -XX:TieredStopAtLevel=1 - * -XX:LockingMode=1 - * -Xms256m -Xmx256m - * TestRecursiveLocking 5 2 - * - * @run main/othervm -Xbootclasspath/a:. - * -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI - * -XX:TieredStopAtLevel=1 - * -XX:LockingMode=2 * -Xms256m -Xmx256m * TestRecursiveLocking 5 2 */ @@ -156,21 +96,6 @@ * @run main/othervm -Xbootclasspath/a:. * -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI * -XX:-EliminateNestedLocks - * -XX:LockingMode=0 - * -Xms256m -Xmx256m - * TestRecursiveLocking 5 1 - * - * @run main/othervm -Xbootclasspath/a:. - * -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI - * -XX:-EliminateNestedLocks - * -XX:LockingMode=1 - * -Xms256m -Xmx256m - * TestRecursiveLocking 5 1 - * - * @run main/othervm -Xbootclasspath/a:. - * -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI - * -XX:-EliminateNestedLocks - * -XX:LockingMode=2 * -Xms256m -Xmx256m * TestRecursiveLocking 5 1 */ @@ -182,25 +107,10 @@ * @summary Tests recursive locking in C2 in alternate A and B mode. * @library /testlibrary /test/lib * @build jdk.test.whitebox.WhiteBox - * * @run driver jdk.test.lib.helpers.ClassFileInstaller jdk.test.whitebox.WhiteBox - * @run main/othervm -Xbootclasspath/a:. - * -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI - * -XX:LockingMode=0 - * -XX:-EliminateNestedLocks - * -Xms256m -Xmx256m - * TestRecursiveLocking 5 2 - * - * @run main/othervm -Xbootclasspath/a:. - * -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI - * -XX:LockingMode=1 - * -XX:-EliminateNestedLocks - * -Xms256m -Xmx256m - * TestRecursiveLocking 5 2 * * @run main/othervm -Xbootclasspath/a:. * -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI - * -XX:LockingMode=2 * -XX:-EliminateNestedLocks * -Xms256m -Xmx256m * TestRecursiveLocking 5 2 @@ -212,11 +122,7 @@ public class TestRecursiveLocking { static final WhiteBox WB = WhiteBox.getWhiteBox(); - static final int flagLockingMode = WB.getIntVMFlag("LockingMode").intValue(); static final int constLockStackCapacity = WB.getLockStackCapacity(); - static final int LM_MONITOR = 0; - static final int LM_LEGACY = 1; - static final int LM_LIGHTWEIGHT = 2; static final int def_mode = 2; static final int def_n_secs = 30; static final SyncThread syncThread = new SyncThread(); @@ -229,44 +135,32 @@ static class SynchronizedObject { synchronized void runInner(int depth, SynchronizedObject outer) { counter++; - // Legacy mode has no lock stack, i.e., there is no limit - // on recursion, so for legacy mode we can't say that - // "outer" must be inflated here, which we can say for all - // the other locking modes. - if (flagLockingMode != LM_LEGACY) { - outer.assertInflated(); - } + // There is limit on recursion, so "outer" must be + // inflated here. + outer.assertInflated(); // We haven't reached the stack lock capacity (recursion // level), so we shouldn't be inflated here. Except for // monitor mode, which is always inflated. - if (flagLockingMode != LM_MONITOR) { - assertNotInflated(); - } + assertNotInflated(); if (depth == 1) { return; } else { runInner(depth - 1, outer); } - if (flagLockingMode != LM_MONITOR) { - assertNotInflated(); - } + assertNotInflated(); } synchronized void runOuter(int depth, SynchronizedObject inner) { counter++; - if (flagLockingMode != LM_MONITOR) { - assertNotInflated(); - } + assertNotInflated(); if (depth == 1) { inner.runInner(constLockStackCapacity, this); } else { runOuter(depth - 1, inner); } - if (flagLockingMode != LM_LEGACY) { - assertInflated(); - } + assertInflated(); } // This test nests x recursive locks of INNER, in x recursive @@ -283,18 +177,11 @@ public void runOuterInnerTest() { synchronized (OUTER) { OUTER.counter++; - if (flagLockingMode != LM_MONITOR) { - OUTER.assertNotInflated(); - } + OUTER.assertNotInflated(); INNER.assertNotInflated(); OUTER.runOuter(constLockStackCapacity - 1, INNER); - - if (flagLockingMode != LM_LEGACY) { - OUTER.assertInflated(); - } - if (flagLockingMode != LM_MONITOR) { - INNER.assertNotInflated(); - } + OUTER.assertInflated(); + INNER.assertNotInflated(); } // Verify that the nested monitors have been properly released: @@ -308,25 +195,23 @@ public void runOuterInnerTest() { synchronized void runA(int depth, SynchronizedObject B) { counter++; - if (flagLockingMode == LM_LIGHTWEIGHT) { - // First time we lock A, A is the only one on the lock - // stack. - if (counter == 1) { - assertNotInflated(); - } else { - // Second time we want to lock A, the lock stack - // looks like this [A, B]. Lightweight locking - // doesn't allow interleaving ([A, B, A]), instead - // it inflates A and removes it from the lock - // stack. Which leaves us with only [B] on the - // lock stack. After more recursions it will grow - // to [B, B ... B]. - assertInflated(); - } - } else if (flagLockingMode == LM_MONITOR) { + + // First time we lock A, A is the only one on the lock + // stack. + if (counter == 1) { + assertNotInflated(); + } else { + // Second time we want to lock A, the lock stack + // looks like this [A, B]. Lightweight locking + // doesn't allow interleaving ([A, B, A]), instead + // it inflates A and removes it from the lock + // stack. Which leaves us with only [B] on the + // lock stack. After more recursions it will grow + // to [B, B ... B]. assertInflated(); } + // Call runB() at the same depth as runA's depth: B.runB(depth, this); } @@ -334,16 +219,13 @@ synchronized void runA(int depth, SynchronizedObject B) { synchronized void runB(int depth, SynchronizedObject A) { counter++; - if (flagLockingMode != LM_MONITOR) { - // Legacy tolerates endless recursions. While testing - // lightweight we don't go deeper than the size of the - // lock stack, which in this test case will be filled - // with a number of B-elements. See comment in runA() - // above for more info. - assertNotInflated(); - } else { - assertInflated(); - } + + // Legacy tolerates endless recursions. While testing + // lightweight we don't go deeper than the size of the + // lock stack, which in this test case will be filled + // with a number of B-elements. See comment in runA() + // above for more info. + assertNotInflated(); if (depth == 1) { // Reached LockStackCapacity in depth so we're done. @@ -370,16 +252,12 @@ public void runAlternateABTest() { Asserts.assertEquals(A.counter, constLockStackCapacity); Asserts.assertEquals(B.counter, constLockStackCapacity); - if (flagLockingMode == LM_LEGACY) { - A.assertNotInflated(); - } - // Implied else: for LM_MONITOR or LM_LIGHTWEIGHT it can be - // either inflated or not because A is not locked anymore - // and subject to deflation. - if (flagLockingMode != LM_MONITOR) { - B.assertNotInflated(); - } + // Here A can be either inflated or not because A is not + // locked anymore and subject to deflation. + + B.assertNotInflated(); + } void assertNotInflated() { @@ -443,7 +321,6 @@ public static void main(String... argv) throws Exception { } } - System.out.println("INFO: LockingMode=" + flagLockingMode); System.out.println("INFO: LockStackCapacity=" + constLockStackCapacity); System.out.println("INFO: n_secs=" + n_secs); System.out.println("INFO: mode=" + mode); diff --git a/test/hotspot/jtreg/runtime/NMT/VirtualAllocTestType.java b/test/hotspot/jtreg/runtime/NMT/VirtualAllocTestType.java index f4321e80b22..0ac7d297e38 100644 --- a/test/hotspot/jtreg/runtime/NMT/VirtualAllocTestType.java +++ b/test/hotspot/jtreg/runtime/NMT/VirtualAllocTestType.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2013, 2025, 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 @@ -61,12 +61,27 @@ public static void main(String args[]) throws Exception { addr2 = wb.NMTReserveMemory(reserveSize); info = "reserve 2: addr2=" + addr2; - // If the second mapping happens to be adjacent to the first mapping, reserve another mapping and release the second mapping; for - // this test, we want to see two disjunct mappings. - if (addr2 == addr1 + reserveSize) { + // For this test, we want to see two disjunct mappings. + if ((addr2 == addr1 + reserveSize) || (addr2 == addr1 - reserveSize)) { + // <---r1---><---r2--->...<---tmp---> + // <---tmp--->...<---r1---><---r2---> + // + // Reserve a new region and find whether r1 or r2 to be released. long tmp = wb.NMTReserveMemory(reserveSize); - wb.NMTReleaseMemory(addr2, reserveSize); - addr2 = tmp; + long r1 = addr1 < addr2 ? addr1 : addr2; + long r2 = addr1 > addr2 ? addr1 : addr2; + long tmp_end = tmp + reserveSize; + long r1_end = r1 + reserveSize; + long r2_end = r2 + reserveSize; + if (tmp >= r2_end) { + wb.NMTReleaseMemory(r2, reserveSize); + addr1 = r1; + addr2 = tmp; + } else if (tmp_end <= r1) { + wb.NMTReleaseMemory(r1, reserveSize); + addr1 = tmp; + addr2 = r2; + } } output = NMTTestUtils.startJcmdVMNativeMemoryDetail(); diff --git a/test/hotspot/jtreg/runtime/Thread/TestAlwaysPreTouchStacks.java b/test/hotspot/jtreg/runtime/Thread/TestAlwaysPreTouchStacks.java index 06ddaadf91c..fe4688330e3 100644 --- a/test/hotspot/jtreg/runtime/Thread/TestAlwaysPreTouchStacks.java +++ b/test/hotspot/jtreg/runtime/Thread/TestAlwaysPreTouchStacks.java @@ -169,14 +169,17 @@ public static void main(String[] args) throws Exception { } long expected_delta = numThreads * (max_stack_usage_with_pretouch - min_stack_usage_with_pretouch); long actual_delta = pretouch_committed - no_pretouch_committed; - if (pretouch_committed <= (no_pretouch_committed + expected_delta)) { - throw new RuntimeException("Expected a higher amount of committed with pretouch stacks" + - "PreTouch amount: " + pretouch_committed + - "NoPreTouch amount: " + (no_pretouch_committed + expected_delta)); - } - if (actual_delta < expected_delta) { - throw new RuntimeException("Expected a higher delta between stack committed of with and without pretouch." + - "Expected: " + expected_delta + " Actual: " + actual_delta); + if (((double)pretouch_committed) / ((double)no_pretouch_committed) < 1.20) { + if (pretouch_committed <= (no_pretouch_committed + expected_delta)) { + throw new RuntimeException("Expected a higher amount of committed with pretouch stacks" + + " PreTouch amount: " + pretouch_committed + + " NoPreTouch amount: " + no_pretouch_committed + + " Expected delta: " + expected_delta); + } + if (actual_delta < expected_delta) { + throw new RuntimeException("Expected a higher delta between stack committed of with and without pretouch." + + " Expected: " + expected_delta + " Actual: " + actual_delta); + } } } } diff --git a/test/hotspot/jtreg/runtime/Thread/TestBreakSignalThreadDump.java b/test/hotspot/jtreg/runtime/Thread/TestBreakSignalThreadDump.java index b985e15bd17..011f6979431 100644 --- a/test/hotspot/jtreg/runtime/Thread/TestBreakSignalThreadDump.java +++ b/test/hotspot/jtreg/runtime/Thread/TestBreakSignalThreadDump.java @@ -38,6 +38,8 @@ * @requires os.family != "windows" & os.family != "aix" * @comment TODO: Decide libjsig support on static JDK with 8351367 * @requires !jdk.static + * @comment loading of the jsig lib does currently not work well with ASAN lib + * @requires !vm.asan * @library /vmTestbase * /test/lib * @run driver TestBreakSignalThreadDump load_libjsig diff --git a/test/hotspot/jtreg/runtime/XCheckJniJsig/XCheckJSig.java b/test/hotspot/jtreg/runtime/XCheckJniJsig/XCheckJSig.java index a8010506d96..6dbe42cebb0 100644 --- a/test/hotspot/jtreg/runtime/XCheckJniJsig/XCheckJSig.java +++ b/test/hotspot/jtreg/runtime/XCheckJniJsig/XCheckJSig.java @@ -29,6 +29,8 @@ * @modules java.base/jdk.internal.misc * java.management * @requires os.family == "linux" | os.family == "mac" + * @comment loading of the jsig lib does currently not work well with ASAN lib + * @requires !vm.asan * @comment TODO: Decide libjsig support on static JDK with 8351367 * @requires !jdk.static * @run driver XCheckJSig diff --git a/test/hotspot/jtreg/runtime/cds/appcds/aotClassLinking/BulkLoaderTest.java b/test/hotspot/jtreg/runtime/cds/appcds/aotClassLinking/BulkLoaderTest.java index 30f7ce12ca0..0f7707edae3 100644 --- a/test/hotspot/jtreg/runtime/cds/appcds/aotClassLinking/BulkLoaderTest.java +++ b/test/hotspot/jtreg/runtime/cds/appcds/aotClassLinking/BulkLoaderTest.java @@ -72,6 +72,7 @@ import java.lang.StackWalker.StackFrame; import java.net.URL; import java.net.URLClassLoader; +import java.util.ArrayList; import java.util.List; import java.util.regex.Matcher; import java.util.regex.Pattern; @@ -312,12 +313,15 @@ static void checkCustomLoader() throws Exception { } } + static ArrayList savedLoaders = new ArrayList<>(); + static Object initFromCustomLoader() throws Exception { String path = "cust.jar"; URL url = new File(path).toURI().toURL(); URL[] urls = new URL[] {url}; URLClassLoader urlClassLoader = new URLClassLoader("MyLoader", urls, null); + savedLoaders.add(urlClassLoader); Class c = Class.forName("SimpleCusty", true, urlClassLoader); return c.newInstance(); } diff --git a/test/hotspot/jtreg/runtime/interpreter/TraceBytecodes.java b/test/hotspot/jtreg/runtime/interpreter/TraceBytecodes.java index b599f6c61ff..417e3a32b4b 100644 --- a/test/hotspot/jtreg/runtime/interpreter/TraceBytecodes.java +++ b/test/hotspot/jtreg/runtime/interpreter/TraceBytecodes.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2023, 2025, 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 @@ -26,13 +26,42 @@ * @bug 8309811 * @requires vm.debug * @summary Test the output of -XX:+TraceBytecodes, -XX:TraceBytecodesAt, and -XX:TraceBytecodesStopAt - * @run main/othervm -XX:+TraceBytecodes -XX:TraceBytecodesAt=2000 -XX:TraceBytecodesStopAt=3000 TraceBytecodes + * @run main/othervm -XX:+TraceBytecodes -XX:TraceBytecodesAt=1000000 -XX:TraceBytecodesStopAt=1001000 TraceBytecodes */ -// This is just a very simple sanity test. Trace about 1000 bytecodes. See the .jtr file for the output. +// CountBytecodes returns 1826384 bytecodes, so trace starting at a million to trace parallel threads. +// This is just a very simple sanity test. See the .jtr file for the output. // Consider it OK if the VM doesn't crash. It should test a fair amount of the code in bytecodeTracer.cpp -public class TraceBytecodes { - public static void main(String args[]) { +public class TraceBytecodes extends Thread { + public void run() { System.out.println("Hello TraceBytecodes"); } + + private static TraceBytecodes[] threads = new TraceBytecodes[2]; + private static boolean success = true; + + private static boolean report_success() { + for (int i = 0; i < 2; i++) { + try { + threads[i].join(); + } catch (InterruptedException e) {} + } + return success; + } + + public static void main(String args[]) { + threads[0] = new TraceBytecodes(); + threads[1] = new TraceBytecodes(); + for (int i = 0; i < 2; i++) { + threads[i].setName("Loading Thread #" + (i + 1)); + threads[i].start(); + System.out.println("Thread " + (i + 1) + " was started..."); + } + + if (report_success()) { + System.out.println("PASSED"); + } else { + throw new RuntimeException("FAILED"); + } + } } diff --git a/test/hotspot/jtreg/runtime/jni/checked/TestLargeUTF8Length.java b/test/hotspot/jtreg/runtime/jni/checked/TestLargeUTF8Length.java index 9186a7ea381..50f8385bb6d 100644 --- a/test/hotspot/jtreg/runtime/jni/checked/TestLargeUTF8Length.java +++ b/test/hotspot/jtreg/runtime/jni/checked/TestLargeUTF8Length.java @@ -44,9 +44,14 @@ public class TestLargeUTF8Length { static native void checkUTF8Length(String s, long utf8Length); static void test() { - int length = Integer.MAX_VALUE/2 + 1; - char character = (char)0XD1; // N with tilde - long utf8Length = 2L * length; + // We want a string whose UTF-8 length is > Integer.MAX_VALUE, but + // whose "natural" length is < Integer.MAX_VALUE/2 so it can be + // created regardless of whether compact-strings are enabled or not. + // So we use a character that encodes as 3-bytes in UTF-8. + // U+08A0 : e0 a2 a0 : ARABIC LETTER BEH WITH SMALL V BELOW + char character = '\u08A0'; + int length = Integer.MAX_VALUE/2 - 1; + long utf8Length = 3L * length; char[] chrs = new char[length]; Arrays.fill(chrs, character); String s = new String(chrs); diff --git a/test/hotspot/jtreg/runtime/lockStack/TestLockStackCapacity.java b/test/hotspot/jtreg/runtime/lockStack/TestLockStackCapacity.java index 01ba1f4f12c..f3f1f9c91a6 100644 --- a/test/hotspot/jtreg/runtime/lockStack/TestLockStackCapacity.java +++ b/test/hotspot/jtreg/runtime/lockStack/TestLockStackCapacity.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2024, 2025, 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 @@ -30,7 +30,7 @@ * @library /testlibrary /test/lib * @build jdk.test.whitebox.WhiteBox * @run driver jdk.test.lib.helpers.ClassFileInstaller jdk.test.whitebox.WhiteBox - * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xint -XX:LockingMode=2 TestLockStackCapacity + * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xint TestLockStackCapacity */ import jdk.test.lib.Asserts; @@ -39,8 +39,6 @@ public class TestLockStackCapacity { static final WhiteBox WB = WhiteBox.getWhiteBox(); - static final int LockingMode = WB.getIntVMFlag("LockingMode").intValue(); - static final int LM_LIGHTWEIGHT = 2; static class SynchronizedObject { static final SynchronizedObject OUTER = new SynchronizedObject(); @@ -95,12 +93,8 @@ void assertInflated() { } public static void main(String... args) throws Exception { - if (LockingMode != LM_LIGHTWEIGHT) { - throw new SkippedException("Test only valid for LM_LIGHTWEIGHT"); - } - if (!WB.supportsRecursiveLightweightLocking()) { - throw new SkippedException("Test only valid if LM_LIGHTWEIGHT supports recursion"); + throw new SkippedException("Test only valid if lightweight locking supports recursion"); } SynchronizedObject.runTest(); diff --git a/test/hotspot/jtreg/runtime/locking/TestRecursiveMonitorChurn.java b/test/hotspot/jtreg/runtime/locking/TestRecursiveMonitorChurn.java index 806f32aad88..e92e947ecfa 100644 --- a/test/hotspot/jtreg/runtime/locking/TestRecursiveMonitorChurn.java +++ b/test/hotspot/jtreg/runtime/locking/TestRecursiveMonitorChurn.java @@ -49,13 +49,12 @@ synchronized void doSomethingElse() { } static final WhiteBox WB = WhiteBox.getWhiteBox(); - static final int LM_MONITOR = 0; static final int COUNT = 100000; public static volatile Monitor monitor; public static void main(String[] args) { - if (WB.getIntVMFlag("LockingMode") == LM_MONITOR) { - throw new SkippedException("LM_MONITOR always inflates. Invalid test."); + if (WB.getBooleanVMFlag("VerifyHeavyMonitors")) { + throw new SkippedException("VerifyHeavyMonitors always inflates. Invalid test."); } final long pre_monitor_count = WB.getInUseMonitorCount(); System.out.println(" Precount = " + pre_monitor_count); diff --git a/test/hotspot/jtreg/runtime/logging/ExceptionsTest.java b/test/hotspot/jtreg/runtime/logging/ExceptionsTest.java index 327b1cc0f24..c2c966cb047 100644 --- a/test/hotspot/jtreg/runtime/logging/ExceptionsTest.java +++ b/test/hotspot/jtreg/runtime/logging/ExceptionsTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2025, 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 @@ -23,7 +23,7 @@ /* * @test - * @bug 8141211 8147477 + * @bug 8141211 8147477 8358080 * @summary exceptions=info output should have an exception message for interpreter methods * @requires vm.flagless * @library /test/lib @@ -34,6 +34,8 @@ import java.io.File; import java.util.Map; +import java.util.regex.Matcher; +import java.util.regex.Pattern; import jdk.test.lib.process.OutputAnalyzer; import jdk.test.lib.process.ProcessTools; @@ -44,10 +46,24 @@ static void updateEnvironment(ProcessBuilder pb, String environmentVariable, Str } static void analyzeOutputOn(ProcessBuilder pb) throws Exception { - OutputAnalyzer output = new OutputAnalyzer(pb.start()); + OutputAnalyzer output = ProcessTools.executeProcess(pb); output.shouldContain(""); output.shouldContain(" thrown in interpreter method "); - output.shouldHaveExitValue(0); + output.shouldMatch("info..exceptions,stacktrace.*at ExceptionsTest[$]InternalClass.bar[(]ExceptionsTest.java:[0-9]+" + + ".*\n.*" + + "info..exceptions,stacktrace.*at ExceptionsTest[$]InternalClass.foo[(]ExceptionsTest.java:[0-9]+" + + ".*\n.*" + + "info..exceptions,stacktrace.*at ExceptionsTest[$]InternalClass.main[(]ExceptionsTest.java:[0-9]+"); + + // Note: "(?s)" means that the "." in the regexp can match the newline character. + // To avoid verbosity, stack trace for bar2()->baz2() should be printed only once: + // - It should be printed when the exception is thrown inside bzz2() + // - It should not be printed when the interpreter is looking for an exception handler inside bar2() + output.shouldMatch("(?s)baz2.*bar2"); + output.shouldNotMatch("(?s)baz2.*bar2,*baz2.*bar2"); + + // Two stack traces should include main()->foo2(), as an exception is thrown at two different BCIs in bar2(). + output.shouldMatch("(?s)foo2.*main.*foo2.*main"); } static void analyzeOutputOff(ProcessBuilder pb) throws Exception { @@ -57,7 +73,7 @@ static void analyzeOutputOff(ProcessBuilder pb) throws Exception { } public static void main(String[] args) throws Exception { - ProcessBuilder pb = ProcessTools.createLimitedTestJavaProcessBuilder("-Xlog:exceptions=info", + ProcessBuilder pb = ProcessTools.createLimitedTestJavaProcessBuilder("-Xlog:exceptions,exceptions+stacktrace", InternalClass.class.getName()); analyzeOutputOn(pb); @@ -66,7 +82,7 @@ public static void main(String[] args) throws Exception { analyzeOutputOff(pb); pb = ProcessTools.createLimitedTestJavaProcessBuilder(InternalClass.class.getName()); - updateEnvironment(pb, "_JAVA_OPTIONS", "-Xlog:exceptions=info"); + updateEnvironment(pb, "_JAVA_OPTIONS", "-Xlog:exceptions,exceptions+stacktrace"); analyzeOutputOn(pb); pb = ProcessTools.createLimitedTestJavaProcessBuilder(InternalClass.class.getName()); @@ -80,12 +96,45 @@ public static void main(String[] args) throws Exception { } public static class InternalClass { - public static void main(String[] args) throws Exception { + public static void main(String[] args) { + foo(); + foo2(); + } + + static void foo() { + bar(); + } + + static void bar() { try { throw new RuntimeException("Test exception 1 for logging"); } catch (Exception e) { System.out.println("Exception 1 caught."); } } + + static void foo2() { + try { + bar2(); + } catch (Exception e) { + System.out.println("Exception 2 caught."); + } + } + + static void bar2() { + try { + baz2(); + } catch (RuntimeException e) { + throw e; // Rethrow -- should print a new callstack. + } + } + + static void baz2() { + bzz2(); + } + + static void bzz2() { + throw new RuntimeException("Test exception 2 for logging"); + } } } diff --git a/test/hotspot/jtreg/runtime/logging/ExceptionsTest_options_file b/test/hotspot/jtreg/runtime/logging/ExceptionsTest_options_file index d3e8be7f857..1b566aaa456 100644 --- a/test/hotspot/jtreg/runtime/logging/ExceptionsTest_options_file +++ b/test/hotspot/jtreg/runtime/logging/ExceptionsTest_options_file @@ -1 +1 @@ --Xlog:exceptions=info +-Xlog:exceptions,exceptions+stacktrace diff --git a/test/hotspot/jtreg/runtime/signal/SigTestDriver.java b/test/hotspot/jtreg/runtime/signal/SigTestDriver.java index 4a62a1e9cca..9a139baf68d 100644 --- a/test/hotspot/jtreg/runtime/signal/SigTestDriver.java +++ b/test/hotspot/jtreg/runtime/signal/SigTestDriver.java @@ -53,15 +53,9 @@ public static void main(String[] args) { switch (signame) { case "SIGWAITING": case "SIGKILL": - case "SIGSTOP": { - throw new SkippedException("signals SIGWAITING, SIGKILL and SIGSTOP can't be tested"); - } + case "SIGSTOP": case "SIGUSR2": { - if (Platform.isLinux()) { - throw new SkippedException("SIGUSR2 can't be tested on Linux"); - } else if (Platform.isOSX()) { - throw new SkippedException("SIGUSR2 can't be tested on OS X"); - } + throw new SkippedException("signals SIGWAITING, SIGKILL, SIGSTOP and SIGUSR2 can't be tested"); } } diff --git a/test/hotspot/jtreg/runtime/vthread/JNIMonitor/JNIMonitor.java b/test/hotspot/jtreg/runtime/vthread/JNIMonitor/JNIMonitor.java deleted file mode 100644 index 56bb705a0b2..00000000000 --- a/test/hotspot/jtreg/runtime/vthread/JNIMonitor/JNIMonitor.java +++ /dev/null @@ -1,303 +0,0 @@ -/* - * Copyright (c) 2021, 2024, 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. - * - * 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. - */ -import jdk.test.lib.Asserts; -import jdk.test.lib.Utils; -import jdk.test.lib.process.ProcessTools; -import jdk.test.lib.process.OutputAnalyzer; - -import java.lang.reflect.Constructor; -import java.lang.reflect.InvocationTargetException; -import java.util.List; -import java.util.concurrent.atomic.AtomicReference; -import java.util.concurrent.ExecutorService; -import java.util.concurrent.Executor; -import java.util.concurrent.Executors; -import java.util.concurrent.ThreadFactory; -import java.util.regex.Matcher; -import java.util.regex.Pattern; - -/* - * Tests that JNI monitors work correctly with virtual threads, - * There are multiple test scenarios that we check using unified logging output - * (both positive and negative tests). Each test case is handled by its own @-test - * definition so that we can run each sub-test independently. - * - * The original bug was only discovered because the ForkJoinPool worker thread terminated - * and trigerred an assertion failure. So we use a custom scheduler to give us control. - */ - -/** - * @test id=normal - * @bug 8327743 - * @summary Normal lock then unlock - * @library /test/lib - * @modules java.base/java.lang:+open - * @requires vm.continuations - * @run driver JNIMonitor Normal - */ - -/** - * @test id=multiNormal - * @bug 8327743 - * @summary Normal lock then unlock by multiple threads - * @library /test/lib - * @modules java.base/java.lang:+open - * @requires vm.continuations - * @run driver JNIMonitor MultiNormal - */ - -/** - * @test id=missingUnlock - * @bug 8327743 - * @summary Don't do the unlock and exit normally - * @library /test/lib - * @modules java.base/java.lang:+open - * @requires vm.continuations - * @run driver JNIMonitor MissingUnlock - */ - -/** - * @test id=multiMissingUnlock - * @bug 8327743 - * @summary Don't do the unlock and exit normally, by multiple threads - * @library /test/lib - * @modules java.base/java.lang:+open - * @requires vm.continuations - * @run driver JNIMonitor MultiMissingUnlock - */ - -/** - * @test id=missingUnlockWithThrow - * @bug 8327743 - * @summary Don't do the unlock and exit by throwing - * @library /test/lib - * @modules java.base/java.lang:+open - * @requires vm.continuations - * @run driver JNIMonitor MissingUnlockWithThrow - */ - -/** - * @test id=multiMissingUnlockWithThrow - * @bug 8327743 - * @summary Don't do the unlock and exit by throwing, by multiple threads - * @library /test/lib - * @modules java.base/java.lang:+open - * @requires vm.continuations - * @run driver JNIMonitor MultiMissingUnlockWithThrow - */ - -public class JNIMonitor { - - public static void main(String[] args) throws Exception { - String test = args[0]; - String[] cmdArgs = new String[] { - "-Djava.library.path=" + Utils.TEST_NATIVE_PATH, - // Grant access to ThreadBuilders$VirtualThreadBuilder - "--add-opens=java.base/java.lang=ALL-UNNAMED", - // Enable the JNI warning - "-Xcheck:jni", - "-Xlog:jni=debug", - // Enable thread termination logging as a visual cross-check - "-Xlog:thread+os=info", - // We only count monitors in LM_LEGACY mode - "-XX:LockingMode=1", - // Disable compact headers since that switches locking mode to LM_LIGHTWEIGHT - "-XX:-UseCompactObjectHeaders", - "JNIMonitor$" + test, - }; - OutputAnalyzer oa = ProcessTools.executeTestJava(cmdArgs); - oa.shouldHaveExitValue(0); - oa.stdoutShouldMatch(terminated); - - switch(test) { - case "Normal": - case "MultiNormal": - oa.stdoutShouldNotMatch(stillLocked); - break; - case "MissingUnlock": - oa.stdoutShouldMatch(stillLocked); - break; - case "MultiMissingUnlock": - parseOutputForPattern(oa.stdoutAsLines(), stillLocked, MULTI_THREAD_COUNT); - break; - case "MissingUnlockWithThrow": - oa.stdoutShouldMatch(stillLocked); - oa.stderrShouldContain(throwMsg); - break; - case "MultiMissingUnlockWithThrow": - parseOutputForPattern(oa.stdoutAsLines(), stillLocked, MULTI_THREAD_COUNT); - parseOutputForPattern(oa.stderrAsLines(), throwMsg, MULTI_THREAD_COUNT); - break; - - default: throw new Error("Unknown arg: " + args[0]); - } - oa.reportDiagnosticSummary(); - } - - // The number of threads for a multi tests. Arbitrarily chosen to be > 1 but small - // enough to not waste too much time. - static final int MULTI_THREAD_COUNT = 5; - - // The logging message for leaving a monitor JNI locked has the form - // [0.187s][debug][jni] VirtualThread (tid: 28, carrier id: 29) exiting with Objects still locked by JNI MonitorEnter. - // but if the test is run with other logging options then whitespace may get introduced in the - // log decorator sections, so ignore those. - static final String stillLocked = "VirtualThread \\(tid:.*exiting with Objects still locked by JNI MonitorEnter"; - // The carrier thread termination logging has the form: - // [1.394s][info][os,thread] JavaThread exiting (name: "pool-1-thread-1", tid: 3090592). - static final String terminated = "JavaThread exiting \\(name: \"pool-1-thread-1\""; - - static final String throwMsg = "Terminating via exception as requested"; - - // Check the process logging output for the given pattern to see if the expected number of - // lines are found. - private static void parseOutputForPattern(List lines, String pattern, int expected) { - Pattern p = Pattern.compile(pattern); - int found = 0; - for (String line : lines) { - Matcher m = p.matcher(line); - if (m.find()) { - found++; - } - } - if (found != expected) { - throw new RuntimeException("Checking for pattern \"" + pattern + "\": expected " - + expected + " but found " + found); - } - } - - - // straight-forward interface to JNI monitor functions - static native int monitorEnter(Object o); - static native int monitorExit(Object o); - - // Isolate the native library loading to the actual test cases, not the class that - // jtreg Driver will load and execute. - static class TestBase { - - static { - System.loadLibrary("JNIMonitor"); - } - - // This gives us a way to control the scheduler used for our virtual threads. The test - // only works as intended when the virtual threads run on the same carrier thread (as - // that carrier maintains ownership of the monitor if the virtual thread fails to unlock it). - // The original issue was also only discovered due to the carrier thread terminating - // unexpectedly, so we can force that condition too by shutting down our custom scheduler. - private static Thread.Builder.OfVirtual virtualThreadBuilder(Executor scheduler) { - Thread.Builder.OfVirtual builder = Thread.ofVirtual(); - try { - Class clazz = Class.forName("java.lang.ThreadBuilders$VirtualThreadBuilder"); - Constructor ctor = clazz.getDeclaredConstructor(Executor.class); - ctor.setAccessible(true); - return (Thread.Builder.OfVirtual) ctor.newInstance(scheduler); - } catch (InvocationTargetException e) { - Throwable cause = e.getCause(); - if (cause instanceof RuntimeException re) { - throw re; - } - throw new RuntimeException(e); - } catch (Exception e) { - throw new RuntimeException(e); - } - } - - static void runTest(int nThreads, boolean skipUnlock, boolean throwOnExit) throws Throwable { - final Object[] monitors = new Object[nThreads]; - for (int i = 0; i < nThreads; i++) { - monitors[i] = new Object(); - } - final AtomicReference exception = new AtomicReference(); - // Ensure all our VT's operate of the same carrier, sequentially. - ExecutorService scheduler = Executors.newSingleThreadExecutor(); - ThreadFactory factory = virtualThreadBuilder(scheduler).factory(); - for (int i = 0 ; i < nThreads; i++) { - Object monitor = skipUnlock ? monitors[i] : monitors[0]; - Thread th = factory.newThread(() -> { - try { - int res = monitorEnter(monitor); - Asserts.assertTrue(res == 0, "monitorEnter should return 0."); - Asserts.assertTrue(Thread.holdsLock(monitor), "monitor should be owned"); - Thread.yield(); - if (!skipUnlock) { - res = monitorExit(monitor); - Asserts.assertTrue(res == 0, "monitorExit should return 0."); - Asserts.assertFalse(Thread.holdsLock(monitor), "monitor should be unowned"); - } - } catch (Throwable t) { - exception.set(t); - } - if (throwOnExit) { - throw new RuntimeException(throwMsg); - } - }); - th.start(); - th.join(); - if (exception.get() != null) { - throw exception.get(); - } - } - // Now force carrier thread to shutdown. - scheduler.shutdown(); - } - } - - // These are the actual test case classes that get exec'd. - - static class Normal extends TestBase { - public static void main(String[] args) throws Throwable { - runTest(1, false, false); - } - } - - static class MultiNormal extends TestBase { - public static void main(String[] args) throws Throwable { - runTest(MULTI_THREAD_COUNT, false, false); - } - } - - static class MissingUnlock extends TestBase { - public static void main(String[] args) throws Throwable { - runTest(1, true, false); - } - } - - static class MultiMissingUnlock extends TestBase { - public static void main(String[] args) throws Throwable { - runTest(MULTI_THREAD_COUNT, true, false); - } - } - - static class MissingUnlockWithThrow extends TestBase { - public static void main(String[] args) throws Throwable { - runTest(1, true, true); - } - } - - static class MultiMissingUnlockWithThrow extends TestBase { - public static void main(String[] args) throws Throwable { - runTest(MULTI_THREAD_COUNT, true, true); - } - } - -} diff --git a/test/hotspot/jtreg/serviceability/dcmd/vm/SystemDumpMapTest.java b/test/hotspot/jtreg/serviceability/dcmd/vm/SystemDumpMapTest.java index 1911862b361..8b8ed0b53ab 100644 --- a/test/hotspot/jtreg/serviceability/dcmd/vm/SystemDumpMapTest.java +++ b/test/hotspot/jtreg/serviceability/dcmd/vm/SystemDumpMapTest.java @@ -36,6 +36,8 @@ * @summary Test of diagnostic command System.map * @library /test/lib * @requires (os.family == "linux" | os.family == "windows" | os.family == "mac") + * @comment ASAN changes the memory map dump slightly, but the test has rather strict requirements + * @requires !vm.asan * @requires os.arch != "riscv64" | !(vm.cpu.features ~= ".*qemu.*") * @modules java.base/jdk.internal.misc * java.compiler diff --git a/test/hotspot/jtreg/serviceability/dcmd/vm/SystemMapTest.java b/test/hotspot/jtreg/serviceability/dcmd/vm/SystemMapTest.java index 283dd4bae72..dcc451d41be 100644 --- a/test/hotspot/jtreg/serviceability/dcmd/vm/SystemMapTest.java +++ b/test/hotspot/jtreg/serviceability/dcmd/vm/SystemMapTest.java @@ -32,6 +32,8 @@ * @summary Test of diagnostic command System.map * @library /test/lib * @requires (vm.gc != "Z") & (os.family == "linux" | os.family == "windows" | os.family == "mac") + * @comment ASAN changes the memory map dump slightly, but the test has rather strict requirements + * @requires !vm.asan * @modules java.base/jdk.internal.misc * java.compiler * java.management @@ -47,6 +49,8 @@ * @summary Test of diagnostic command System.map using ZGC * @library /test/lib * @requires vm.gc.Z & (os.family == "linux" | os.family == "windows" | os.family == "mac") + * @comment ASAN changes the memory map dump slightly, but the test has rather strict requirements + * @requires !vm.asan * @modules java.base/jdk.internal.misc * java.compiler * java.management diff --git a/test/hotspot/jtreg/serviceability/jvmti/ModuleAwareAgents/ThreadStart/libMAAThreadStart.c b/test/hotspot/jtreg/serviceability/jvmti/ModuleAwareAgents/ThreadStart/libMAAThreadStart.c deleted file mode 100644 index ea346536e42..00000000000 --- a/test/hotspot/jtreg/serviceability/jvmti/ModuleAwareAgents/ThreadStart/libMAAThreadStart.c +++ /dev/null @@ -1,177 +0,0 @@ -/* - * Copyright (c) 2016, 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. - * - * 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. - */ - -#include -#include -#include "jvmti.h" - -#ifdef __cplusplus -extern "C" { -#endif - -#ifndef JNI_ENV_ARG - -#ifdef __cplusplus -#define JNI_ENV_ARG(x, y) y -#define JNI_ENV_PTR(x) x -#else -#define JNI_ENV_ARG(x,y) x, y -#define JNI_ENV_PTR(x) (*x) -#endif - -#endif - -#define TranslateError(err) "JVMTI error" - -#define PASSED 0 -#define FAILED 2 - -static const char *EXC_CNAME = "java/lang/Exception"; - -static jvmtiEnv *jvmti = NULL; -static jint result = PASSED; -static jboolean printdump = JNI_FALSE; - -static int thread_start_events_vm_start = 0; - -static jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved); - -JNIEXPORT -jint JNICALL Agent_OnLoad(JavaVM *jvm, char *options, void *reserved) { - return Agent_Initialize(jvm, options, reserved); -} - -JNIEXPORT -jint JNICALL Agent_OnAttach(JavaVM *jvm, char *options, void *reserved) { - return Agent_Initialize(jvm, options, reserved); -} - -JNIEXPORT -jint JNICALL JNI_OnLoad(JavaVM *jvm, void *reserved) { - return JNI_VERSION_9; -} - -static -jint throw_exc(JNIEnv *env, char *msg) { - jclass exc_class = JNI_ENV_PTR(env)->FindClass(JNI_ENV_ARG(env, EXC_CNAME)); - - if (exc_class == NULL) { - printf("throw_exc: Error in FindClass(env, %s)\n", EXC_CNAME); - return -1; - } - return JNI_ENV_PTR(env)->ThrowNew(JNI_ENV_ARG(env, exc_class), msg); -} - - -void JNICALL Callback_ThreadStart(jvmtiEnv *jvmti_env, JNIEnv *env, jthread thread) { - jvmtiError err; - jvmtiPhase phase; - - err = (*jvmti)->GetPhase(jvmti_env,&phase); - if (err != JVMTI_ERROR_NONE) { - printf("ThreadStart event: GetPhase error: %s (%d)\n", TranslateError(err), err); - result = FAILED; - return; - } - - if (phase == JVMTI_PHASE_START) { - thread_start_events_vm_start++; - } - - if (printdump == JNI_TRUE) { - printf(">>> ThreadStart event: phase(%d)\n", phase); - } -} - -static -jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { - jint res, size; - jvmtiCapabilities caps; - jvmtiEventCallbacks callbacks; - jvmtiError err; - - if (options != NULL && strcmp(options, "printdump") == 0) { - printdump = JNI_TRUE; - } - - res = JNI_ENV_PTR(jvm)->GetEnv(JNI_ENV_ARG(jvm, (void **) &jvmti), - JVMTI_VERSION_9); - if (res != JNI_OK || jvmti == NULL) { - printf(" Error: wrong result of a valid call to GetEnv!\n"); - return JNI_ERR; - } - - printf("Enabling following capability: can_generate_early_vmstart\n"); - memset(&caps, 0, sizeof(caps)); - caps.can_generate_early_vmstart = 1; - - err = (*jvmti)->AddCapabilities(jvmti, &caps); - if (err != JVMTI_ERROR_NONE) { - printf(" Error in AddCapabilites: %s (%d)\n", TranslateError(err), err); - return JNI_ERR; - } - - size = (jint)sizeof(callbacks); - - memset(&callbacks, 0, sizeof(callbacks)); - callbacks.ThreadStart = Callback_ThreadStart; - - err = (*jvmti)->SetEventCallbacks(jvmti, &callbacks, size); - if (err != JVMTI_ERROR_NONE) { - printf(" Error in SetEventCallbacks: %s (%d)\n", TranslateError(err), err); - return JNI_ERR; - } - - err = (*jvmti)->SetEventNotificationMode(jvmti, JVMTI_ENABLE, JVMTI_EVENT_THREAD_START, NULL); - if (err != JVMTI_ERROR_NONE) { - printf(" Error in SetEventNotificationMode: %s (%d)\n", TranslateError(err), err); - return JNI_ERR; - } - - return JNI_OK; -} - -JNIEXPORT jint JNICALL -Java_MAAThreadStart_check(JNIEnv *env, jclass cls) { - jobject loader = NULL; - - if (jvmti == NULL) { - throw_exc(env, "JVMTI client was not properly loaded!\n"); - return FAILED; - } - - /* - * Expecting that ThreadStart events are sent during VM Start phase when - * can_generate_early_vmstart capability is enabled. - */ - if (thread_start_events_vm_start == 0) { - throw_exc(env, "Didn't get ThreadStart events in VM early start phase!\n"); - return FAILED; - } - - return result; -} - -#ifdef __cplusplus -} -#endif diff --git a/test/hotspot/jtreg/serviceability/jvmti/vthread/StopThreadTest/StopThreadTest.java b/test/hotspot/jtreg/serviceability/jvmti/vthread/StopThreadTest/StopThreadTest.java index d455a16c998..4693040fa6b 100644 --- a/test/hotspot/jtreg/serviceability/jvmti/vthread/StopThreadTest/StopThreadTest.java +++ b/test/hotspot/jtreg/serviceability/jvmti/vthread/StopThreadTest/StopThreadTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2023, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2023, 2025, 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 @@ -46,9 +46,6 @@ import jdk.test.lib.Platform; import java.lang.AssertionError; -import com.sun.management.HotSpotDiagnosticMXBean; -import java.lang.management.ManagementFactory; - /* * The test exercises the JVMTI function: StopThread(jthread). * The test creates a new virtual or platform thread. @@ -277,8 +274,6 @@ static void C() { } static boolean preemptableVirtualThread() { - boolean legacyLockingMode = ManagementFactory.getPlatformMXBean(HotSpotDiagnosticMXBean.class) - .getVMOption("LockingMode").getValue().equals("1"); - return is_virtual && !isBoundVThread && !legacyLockingMode; + return is_virtual && !isBoundVThread; } } diff --git a/test/hotspot/jtreg/serviceability/sa/ClhsdbJstackWithConcurrentLock.java b/test/hotspot/jtreg/serviceability/sa/ClhsdbJstackWithConcurrentLock.java index 43926941a1a..64080b252c5 100644 --- a/test/hotspot/jtreg/serviceability/sa/ClhsdbJstackWithConcurrentLock.java +++ b/test/hotspot/jtreg/serviceability/sa/ClhsdbJstackWithConcurrentLock.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2024, 2025, 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 @@ -46,7 +46,7 @@ public static void main(String[] args) throws Exception { theApp = new LingeredAppWithConcurrentLock(); // Use a small heap so the scan is quick. - LingeredApp.startApp(theApp, "-Xmx4m"); + LingeredApp.startApp(theApp, "-Xmx8m"); System.out.println("Started LingeredApp with pid " + theApp.getPid()); // Run the 'jstack -l' command to get the stack and have java.util.concurrent diff --git a/test/hotspot/jtreg/sources/TestIncludesAreSorted.java b/test/hotspot/jtreg/sources/TestIncludesAreSorted.java index 34e8d5be5fd..ed3712810cb 100644 --- a/test/hotspot/jtreg/sources/TestIncludesAreSorted.java +++ b/test/hotspot/jtreg/sources/TestIncludesAreSorted.java @@ -47,6 +47,7 @@ public class TestIncludesAreSorted { "share/ci", "share/compiler", "share/jvmci", + "share/opto" }; /** diff --git a/test/hotspot/jtreg/sources/TestNoNULL.java b/test/hotspot/jtreg/sources/TestNoNULL.java index 12fe46a609e..9c993572aea 100644 --- a/test/hotspot/jtreg/sources/TestNoNULL.java +++ b/test/hotspot/jtreg/sources/TestNoNULL.java @@ -33,6 +33,8 @@ import java.nio.charset.StandardCharsets; import java.nio.file.*; import java.nio.file.attribute.BasicFileAttributes; +import java.util.ArrayList; +import java.util.Collection; import java.util.HashSet; import java.util.List; import java.util.Set; @@ -41,11 +43,23 @@ public class TestNoNULL { private static final Set excludedSourceFiles = new HashSet<>(); private static final Set excludedTestFiles = new HashSet<>(); - private static final Set excludedTestExtensions = Set.of(".c", ".java", ".jar", ".class", ".zip"); + private static final Set excludedTestExtensions = extend(new HashSet<>(List.of(".c", ".java", ".jar", ".class", ".zip")), "excludedTestExtensions"); private static final Pattern NULL_PATTERN = Pattern.compile("\\bNULL\\b"); private static Path dir = Paths.get(System.getProperty("test.src")); private static int errorCount = 0; + /** + * Extends {@code toExtend} with the comma separated entries in the value of the + * {@code propertyName} system property. + */ + private static > T extend(T toExtend, String propertyName) { + String extensions = System.getProperty(propertyName); + if (extensions != null) { + toExtend.addAll(List.of(extensions.split(","))); + } + return toExtend; + } + public static void main(String[] args) throws IOException { int maxIter = 20; while (maxIter-- > 0 && dir != null && !Files.exists(dir.resolve("src"))) { @@ -72,15 +86,15 @@ public static void main(String[] args) throws IOException { } private static void initializeExcludedPaths(Path rootDir) { - List sourceExclusions = List.of( + List sourceExclusions = extend(new ArrayList<>(List.of( "src/hotspot/share/prims/jvmti.xml", "src/hotspot/share/prims/jvmti.xsl" - ); + )), "sourceExclusions"); - List testExclusions = List.of( + List testExclusions = extend(new ArrayList<>(List.of( "test/hotspot/jtreg/vmTestbase/nsk/share/jvmti/README", "test/hotspot/jtreg/vmTestbase/nsk/share/jni/README" - ); + )), "testExclusions"); sourceExclusions.forEach(relativePath -> excludedSourceFiles.add(rootDir.resolve(relativePath).normalize().toString())); diff --git a/test/hotspot/jtreg/testlibrary/ctw/src/sun/hotspot/tools/ctw/ClassPathJimageEntry.java b/test/hotspot/jtreg/testlibrary/ctw/src/sun/hotspot/tools/ctw/ClassPathJimageEntry.java index d6af006c138..56d611426ab 100644 --- a/test/hotspot/jtreg/testlibrary/ctw/src/sun/hotspot/tools/ctw/ClassPathJimageEntry.java +++ b/test/hotspot/jtreg/testlibrary/ctw/src/sun/hotspot/tools/ctw/ClassPathJimageEntry.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2016, 2025, 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 @@ -23,13 +23,19 @@ package sun.hotspot.tools.ctw; -import jdk.internal.jimage.ImageLocation; -import jdk.internal.jimage.ImageReader; - import java.io.IOException; +import java.nio.file.DirectoryStream; +import java.nio.file.FileSystem; +import java.nio.file.FileVisitResult; +import java.nio.file.FileVisitor; import java.nio.file.Files; import java.nio.file.Path; -import java.util.Arrays; +import java.nio.file.SimpleFileVisitor; +import java.nio.file.attribute.BasicFileAttributes; +import java.nio.file.spi.FileSystemProvider; +import java.util.ArrayList; +import java.util.List; +import java.util.Map; import java.util.stream.Stream; /** @@ -39,17 +45,21 @@ public class ClassPathJimageEntry extends PathHandler.PathEntry { @Override protected Stream classes() { - return Arrays.stream(reader.getEntryNames()) - .filter(name -> name.endsWith(".class")) - .filter(name -> !name.endsWith("module-info.class")) - .map(ClassPathJimageEntry::toFileName) - .map(Utils::fileNameToClassName); - } - - private static String toFileName(String name) { - final char nameSeparator = '/'; - assert name.charAt(0) == nameSeparator : name; - return name.substring(name.indexOf(nameSeparator, 1) + 1); + Path modulesRoot = jrtFileSystem.getPath("/modules"); + List classNames = new ArrayList<>(); + FileVisitor collectClassNames = new SimpleFileVisitor<>() { + @Override + public FileVisitResult visitFile(Path path, BasicFileAttributes attrs) { + classNames.add(Utils.fileNameToClassName(modulesRoot.relativize(path).toString())); + return FileVisitResult.CONTINUE; + } + }; + try { + Files.walkFileTree(modulesRoot, collectClassNames); + } catch (IOException e) { + throw new Error(e); + } + return classNames.stream(); } @Override @@ -60,7 +70,7 @@ protected String description() { @Override public void close() { try { - reader.close(); + jrtFileSystem.close(); } catch (IOException e) { throw new Error("error on closing reader for " + root + " : " + e.getMessage(), e); @@ -69,7 +79,7 @@ public void close() { } } - private final ImageReader reader; + private final FileSystem jrtFileSystem; public ClassPathJimageEntry(Path root) { super(root); @@ -77,7 +87,11 @@ public ClassPathJimageEntry(Path root) { throw new Error(root + " image file not found"); } try { - reader = ImageReader.open(root); + jrtFileSystem = FileSystemProvider.installedProviders().stream() + .filter(p -> "jrt".equals(p.getScheme())) + .findFirst() + .orElseThrow(() -> new Error("cannot find JRT filesystem for " + root)) + .newFileSystem(root, Map.of()); } catch (IOException e) { throw new Error("can not open " + root + " : " + e.getMessage(), e); } @@ -85,14 +99,19 @@ public ClassPathJimageEntry(Path root) { @Override protected byte[] findByteCode(String name) { - String resource = Utils.classNameToFileName(name); - for (String m : reader.getModuleNames()) { - ImageLocation location = reader.findLocation(m, resource); - if (location != null) { - return reader.getResource(location); + // Relative path to search for inside each /modules/ directory. + Path resourcePath = jrtFileSystem.getPath(Utils.classNameToFileName(name)); + Path modulesRoot = jrtFileSystem.getPath("/modules"); + try (DirectoryStream modules = Files.newDirectoryStream(modulesRoot)) { + for (Path module : modules) { + Path p = module.resolve(resourcePath); + if (Files.isRegularFile(p)) { + return Files.readAllBytes(p); + } } + } catch (IOException e) { + throw new RuntimeException(e); } return null; } - } diff --git a/test/hotspot/jtreg/testlibrary/ctw/src/sun/hotspot/tools/ctw/Utils.java b/test/hotspot/jtreg/testlibrary/ctw/src/sun/hotspot/tools/ctw/Utils.java index 7c4c749ccce..ec24d4f186d 100644 --- a/test/hotspot/jtreg/testlibrary/ctw/src/sun/hotspot/tools/ctw/Utils.java +++ b/test/hotspot/jtreg/testlibrary/ctw/src/sun/hotspot/tools/ctw/Utils.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2013, 2025, 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 @@ -186,10 +186,10 @@ public static boolean isClassFile(String filename) { } /** - * Converts the filename to classname. + * Converts the {@code /}-separated filename to its corresponding class name. * * @param filename filename to convert - * @return corresponding classname + * @return corresponding class name * @throws AssertionError if filename isn't valid filename for class file - * {@link #isClassFile(String)} */ @@ -200,6 +200,12 @@ public static String fileNameToClassName(String filename) { .replace(nameSeparator, '.'); } + /** + * Converts a fully qualified class name to a {@code /}-separated filename. + * + * @param classname fully qualified class name to convert + * @return corresponding filename + */ public static String classNameToFileName(String classname) { return classname.replace('.', '/') .concat(CLASSFILE_EXT); diff --git a/test/hotspot/jtreg/testlibrary_tests/template_framework/examples/TestPrimitiveTypes.java b/test/hotspot/jtreg/testlibrary_tests/template_framework/examples/TestPrimitiveTypes.java new file mode 100644 index 00000000000..5cd3f3c2a22 --- /dev/null +++ b/test/hotspot/jtreg/testlibrary_tests/template_framework/examples/TestPrimitiveTypes.java @@ -0,0 +1,201 @@ +/* + * Copyright (c) 2025, 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. + * + * 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. + */ + +/* + * @test + * @bug 8358772 + * @summary Demonstrate the use of PrimitiveTypes form the Template Library. + * @modules java.base/jdk.internal.misc + * @library /test/lib / + * @compile ../../../compiler/lib/verify/Verify.java + * @run main template_framework.examples.TestPrimitiveTypes + */ + +package template_framework.examples; + +import java.util.List; +import java.util.Map; +import java.util.Collections; +import java.util.HashMap; + +import compiler.lib.compile_framework.*; +import compiler.lib.template_framework.Template; +import compiler.lib.template_framework.TemplateToken; +import static compiler.lib.template_framework.Template.body; +import static compiler.lib.template_framework.Template.dataNames; +import static compiler.lib.template_framework.Template.let; +import static compiler.lib.template_framework.Template.$; +import static compiler.lib.template_framework.Template.addDataName; +import static compiler.lib.template_framework.DataName.Mutability.MUTABLE; + +import compiler.lib.template_framework.library.Hooks; +import compiler.lib.template_framework.library.CodeGenerationDataNameType; +import compiler.lib.template_framework.library.PrimitiveType; + +/** + * This test shows the use of {@link PrimitiveType}. + */ +public class TestPrimitiveTypes { + + public static void main(String[] args) { + // Create a new CompileFramework instance. + CompileFramework comp = new CompileFramework(); + + // Add a java source file. + comp.addJavaSourceCode("p.xyz.InnerTest", generate()); + + // Compile the source file. + comp.compile(); + + // p.xyz.InnerTest.main(); + comp.invoke("p.xyz.InnerTest", "main", new Object[] {}); + } + + // Generate a Java source file as String + public static String generate() { + // Generate a list of test methods. + Map tests = new HashMap<>(); + + // The boxing tests check if we can autobox with "boxedTypeName". + var boxingTemplate = Template.make("name", "type", (String name, PrimitiveType type) -> body( + let("CON1", type.con()), + let("CON2", type.con()), + let("Boxed", type.boxedTypeName()), + """ + public static void #name() { + #type c1 = #CON1; + #type c2 = #CON2; + #Boxed b1 = c1; + #Boxed b2 = c2; + Verify.checkEQ(c1, b1); + Verify.checkEQ(c2, b2); + } + """ + )); + + for (PrimitiveType type : CodeGenerationDataNameType.PRIMITIVE_TYPES) { + String name = "test_boxing_" + type.name(); + tests.put(name, boxingTemplate.asToken(name, type)); + } + + // Integral and Float types have a size. Also test if "isFloating" is correct. + var integralFloatTemplate = Template.make("name", "type", (String name, PrimitiveType type) -> body( + let("size", type.byteSize()), + let("isFloating", type.isFloating()), + """ + public static void #name() { + // Test byteSize via creation of array. + #type[] array = new #type[1]; + MemorySegment ms = MemorySegment.ofArray(array); + if (#size != ms.byteSize()) { + throw new RuntimeException("byteSize mismatch #type"); + } + + // Test isFloating via rounding. + double value = 1.5; + #type rounded = (#type)value; + boolean isFloating = value != rounded; + if (isFloating == #isFloating) { + throw new RuntimeException("isFloating mismatch #type"); + } + } + """ + )); + + for (PrimitiveType type : CodeGenerationDataNameType.INTEGRAL_AND_FLOATING_TYPES) { + String name = "test_integral_floating_" + type.name(); + tests.put(name, integralFloatTemplate.asToken(name, type)); + } + + // Finally, test the type by creating some DataNames (variables), and sampling + // from them. There should be no cross-over between the types. + var variableTemplate = Template.make("type", (PrimitiveType type) -> body( + let("CON", type.con()), + addDataName($("var"), type, MUTABLE), + """ + #type $var = #CON; + """ + )); + + var sampleTemplate = Template.make("type", (PrimitiveType type) -> body( + let("var", dataNames(MUTABLE).exactOf(type).sample().name()), + let("CON", type.con()), + """ + #var = #CON; + """ + )); + + var namesTemplate = Template.make(() -> body( + """ + public static void test_names() { + """, + Hooks.METHOD_HOOK.anchor( + Collections.nCopies(10, + CodeGenerationDataNameType.PRIMITIVE_TYPES.stream().map(type -> + Hooks.METHOD_HOOK.insert(variableTemplate.asToken(type)) + ).toList() + ), + """ + // Now sample: + """, + Collections.nCopies(10, + CodeGenerationDataNameType.PRIMITIVE_TYPES.stream().map(sampleTemplate::asToken).toList() + ) + ), + """ + } + """ + )); + + tests.put("test_names", namesTemplate.asToken()); + + // Finally, put all the tests together in a class, and invoke all + // tests from the main method. + var template = Template.make(() -> body( + """ + package p.xyz; + + import compiler.lib.verify.*; + import java.lang.foreign.MemorySegment; + + public class InnerTest { + public static void main() { + """, + // Call all test methods from main. + tests.keySet().stream().map( + n -> List.of(n, "();\n") + ).toList(), + """ + } + """, + // Now add all the test methods. + tests.values().stream().toList(), + """ + } + """ + )); + + // Render the template to a String. + return template.render(); + } +} diff --git a/test/hotspot/jtreg/testlibrary_tests/template_framework/examples/TestWithTestFrameworkClass.java b/test/hotspot/jtreg/testlibrary_tests/template_framework/examples/TestWithTestFrameworkClass.java new file mode 100644 index 00000000000..813f2976ef2 --- /dev/null +++ b/test/hotspot/jtreg/testlibrary_tests/template_framework/examples/TestWithTestFrameworkClass.java @@ -0,0 +1,163 @@ +/* + * Copyright (c) 2025, 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. + * + * 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. + */ + +/* + * @test + * @summary Test TestFrameworkClass.TEMPLATE which allows generating many tests and running them with the IR TestFramework. + * @modules java.base/jdk.internal.misc + * @library /test/lib / + * @compile ../../../compiler/lib/ir_framework/TestFramework.java + * @compile ../../../compiler/lib/generators/Generators.java + * @compile ../../../compiler/lib/verify/Verify.java + * @run driver template_framework.examples.TestWithTestFrameworkClass + */ + +package template_framework.examples; + +import java.util.List; +import java.util.Set; + +import compiler.lib.compile_framework.CompileFramework; + +import compiler.lib.generators.Generators; + +import compiler.lib.template_framework.Template; +import compiler.lib.template_framework.TemplateToken; +import static compiler.lib.template_framework.Template.body; +import static compiler.lib.template_framework.Template.let; + +import compiler.lib.template_framework.library.Hooks; +import compiler.lib.template_framework.library.TestFrameworkClass; + +/** + * This is a basic IR verification test, in combination with Generators for random input generation + * and Verify for output verification. + *

    + * The "@compile" command for JTREG is required so that the frameworks used in the Template code + * are compiled and available for the Test-VM. + *

    + * Additionally, we must set the classpath for the Test VM, so that it has access to all compiled + * classes (see {@link CompileFramework#getEscapedClassPathOfCompiledClasses}). + */ +public class TestWithTestFrameworkClass { + + public static void main(String[] args) { + // Create a new CompileFramework instance. + CompileFramework comp = new CompileFramework(); + + // Add a java source file. + comp.addJavaSourceCode("p.xyz.InnerTest", generate(comp)); + + // Compile the source file. + comp.compile(); + + // p.xyz.InnterTest.main(new String[] {}); + comp.invoke("p.xyz.InnerTest", "main", new Object[] {new String[] {}}); + + // We can also pass VM flags for the Test VM. + // p.xyz.InnterTest.main(new String[] {"-Xbatch"}); + comp.invoke("p.xyz.InnerTest", "main", new Object[] {new String[] {"-Xbatch"}}); + } + + // Generate a source Java file as String + public static String generate(CompileFramework comp) { + // A simple template that adds a comment. + var commentTemplate = Template.make(() -> body( + """ + // Comment inserted from test method to class hook. + """ + )); + + // We define a Test-Template: + // - static fields for inputs: INPUT_A and INPUT_B + // - Data generated with Generators and hashtag replacement #con1. + // - GOLD value precomputed with dedicated call to test. + // - This ensures that the GOLD value is computed in the interpreter + // most likely, since the test method is not yet compiled. + // This allows us later to compare to the results of the compiled + // code. + // The input data is cloned, so that the original INPUT_A is never + // modified and can serve as identical input in later calls to test. + // - In the Setup method, we clone the input data, since the input data + // could be modified inside the test method. + // - The test method makes use of hashtag replacements (#con2 and #op). + // - The Check method verifies the results of the test method with the + // GOLD value. + var testTemplate = Template.make("op", (String op) -> body( + let("size", Generators.G.safeRestrict(Generators.G.ints(), 10_000, 20_000).next()), + let("con1", Generators.G.ints().next()), + let("con2", Generators.G.safeRestrict(Generators.G.ints(), 1, Integer.MAX_VALUE).next()), + """ + // --- $test start --- + // $test with size=#size and op=#op + private static int[] $INPUT_A = new int[#size]; + static { + Generators.G.fill(Generators.G.ints(), $INPUT_A); + } + private static int $INPUT_B = #con1; + private static Object $GOLD = $test($INPUT_A.clone(), $INPUT_B); + + @Setup + public static Object[] $setup() { + // Must make sure to clone input arrays, if it is mutated in the test. + return new Object[] {$INPUT_A.clone(), $INPUT_B}; + } + + @Test + @Arguments(setup = "$setup") + public static Object $test(int[] a, int b) { + for (int i = 0; i < a.length; i++) { + int con = #con2; + a[i] = (a[i] * con) #op b; + } + return a; + } + + @Check(test = "$test") + public static void $check(Object result) { + Verify.checkEQ(result, $GOLD); + } + // --- $test end --- + """, + // Good to know: we can insert to the class hook, which is set for the + // TestFrameworkClass scope: + Hooks.CLASS_HOOK.insert(commentTemplate.asToken()) + )); + + // Create a test for each operator. + List ops = List.of("+", "-", "*", "&", "|"); + List testTemplateTokens = ops.stream().map(testTemplate::asToken).toList(); + + // Create the test class, which runs all testTemplateTokens. + return TestFrameworkClass.render( + // package and class name. + "p.xyz", "InnerTest", + // Set of imports. + Set.of("compiler.lib.generators.*", + "compiler.lib.verify.*"), + // classpath, so the Test VM has access to the compiled class files. + comp.getEscapedClassPathOfCompiledClasses(), + // The list of tests. + testTemplateTokens); + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/AttachOnDemand/attach010/attach010Agent00.java b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/AttachOnDemand/attach010/attach010Agent00.java index 1e0abf4e11e..877c1e3862e 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/AttachOnDemand/attach010/attach010Agent00.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/AttachOnDemand/attach010/attach010Agent00.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, 2025, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2007, 2018, 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 @@ -60,8 +60,7 @@ protected void agentActions() throws Throwable { FileInputStream newInputStream = new FileInputStream(inStreamFileName); System.setIn(newInputStream); - BufferedReader inputStreamReader = new BufferedReader(new InputStreamReader( - System.in, System.getProperty("stdin.encoding"))); + BufferedReader inputStreamReader = new BufferedReader(new InputStreamReader(System.in)); int readValue = Integer.parseInt(inputStreamReader.readLine()); if (readValue != valueToWrite) { diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/AttachOnDemand/attach045/attach045Agent00.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/AttachOnDemand/attach045/attach045Agent00.cpp index 5a486492799..06ea3a007d1 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/AttachOnDemand/attach045/attach045Agent00.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/AttachOnDemand/attach045/attach045Agent00.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2007, 2025, 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 @@ -51,6 +51,7 @@ void JNICALL classLoadHandler( jclass klass) { char className[MAX_STRING_LENGTH]; int success = 1; + bool finish = false; if (!nsk_jvmti_aod_getClassName(jvmti, klass, className)) { nsk_jvmti_aod_disableEventAndFinish(agentName, JVMTI_EVENT_CLASS_LOAD, 0, jvmti, jni); @@ -65,7 +66,7 @@ void JNICALL classLoadHandler( if (eventsCounter == EXPECTED_EVENTS_NUMBER) { NSK_DISPLAY2("%s: all expected events were received (eventsCounter: %d)\n", agentName, eventsCounter); - nsk_jvmti_aod_disableEventAndFinish(agentName, JVMTI_EVENT_CLASS_LOAD, success, jvmti, jni); + finish = true; } if (!NSK_JVMTI_VERIFY(jvmti->RawMonitorExit(eventsCounterMonitor))) { @@ -75,8 +76,8 @@ void JNICALL classLoadHandler( success = 0; } - if (!success) { - nsk_jvmti_aod_disableEventAndFinish(agentName, JVMTI_EVENT_CLASS_LOAD, 0, jvmti, jni); + if (finish || !success) { + nsk_jvmti_aod_disableEventAndFinish(agentName, JVMTI_EVENT_CLASS_LOAD, success, jvmti, jni); } } diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/AttachOnDemand/attach045/attach045Agent01.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/AttachOnDemand/attach045/attach045Agent01.cpp index 8843c19d338..017d58680e5 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/AttachOnDemand/attach045/attach045Agent01.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/AttachOnDemand/attach045/attach045Agent01.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2007, 2025, 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 @@ -50,6 +50,7 @@ void JNICALL classPrepareHandler( jthread thread, jclass klass) { int success = 1; + bool finish = false; char className[MAX_STRING_LENGTH]; jint loadedClassesCount; jclass *loadedClasses; @@ -75,8 +76,7 @@ void JNICALL classPrepareHandler( if (eventsCounter == EXPECTED_EVENTS_NUMBER) { NSK_DISPLAY2("%s: all expected events were received (eventsCounter: %d)\n", agentName, eventsCounter); - - nsk_jvmti_aod_disableEventAndFinish(agentName, JVMTI_EVENT_CLASS_PREPARE, success, jvmti, jni); + finish = true; } if (!NSK_JVMTI_VERIFY(jvmti->RawMonitorExit(eventsCounterMonitor))) { @@ -86,8 +86,8 @@ void JNICALL classPrepareHandler( success = 0; } - if (!success) { - nsk_jvmti_aod_disableEventAndFinish(agentName, JVMTI_EVENT_CLASS_PREPARE, 0, jvmti, jni); + if (finish || !success) { + nsk_jvmti_aod_disableEventAndFinish(agentName, JVMTI_EVENT_CLASS_PREPARE, success, jvmti, jni); } } diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/AttachOnDemand/attach045/attach045Agent02.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/AttachOnDemand/attach045/attach045Agent02.cpp index f0ce8965cda..ab0d489b770 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/AttachOnDemand/attach045/attach045Agent02.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/AttachOnDemand/attach045/attach045Agent02.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2008, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2008, 2025, 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 @@ -54,6 +54,7 @@ void eventHandler(jvmtiEnv *jvmti, int threadStartEvent) { char threadName[MAX_STRING_LENGTH]; int success = 1; + bool finish = false; jint threadsCount = 0; jthread * threads; @@ -81,8 +82,7 @@ void eventHandler(jvmtiEnv *jvmti, if (eventsCounter == EXPECTED_EVENTS_NUMBER) { NSK_DISPLAY2("%s: all expected events were received (eventsCounter: %d)\n", agentName, eventsCounter); - - nsk_jvmti_aod_disableEventsAndFinish(agentName, testEvents, testEventsNumber, success, jvmti, jni); + finish = true; } if (!NSK_JVMTI_VERIFY(jvmti->RawMonitorExit(eventsCounterMonitor))) { @@ -92,8 +92,8 @@ void eventHandler(jvmtiEnv *jvmti, success = 0; } - if (!success) { - nsk_jvmti_aod_disableEventsAndFinish(agentName, testEvents, testEventsNumber, 0, jvmti, jni); + if (finish || !success) { + nsk_jvmti_aod_disableEventsAndFinish(agentName, testEvents, testEventsNumber, success, jvmti, jni); } } diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/AttachOnDemand/attach045/attach045Agent03.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/AttachOnDemand/attach045/attach045Agent03.cpp index 3834e868a7b..99a657a85b0 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/AttachOnDemand/attach045/attach045Agent03.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/AttachOnDemand/attach045/attach045Agent03.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2008, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2008, 2025, 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 @@ -57,6 +57,7 @@ VMObjectAllocHandler(jvmtiEnv *jvmti, char threadName[MAX_STRING_LENGTH]; char className[MAX_STRING_LENGTH]; int success = 1; + bool finish = false; if (!nsk_jvmti_aod_getClassName(jvmti, object_klass, className)) { nsk_jvmti_aod_disableEventsAndFinish(agentName, testEvents, testEventsNumber, 0, jvmti, jni); @@ -84,8 +85,7 @@ VMObjectAllocHandler(jvmtiEnv *jvmti, if (eventsCounter == EXPECTED_EVENTS_NUMBER) { NSK_DISPLAY2("%s: all expected events were received (eventsCounter: %d)\n", agentName, eventsCounter); - - nsk_jvmti_aod_disableEventsAndFinish(agentName, testEvents, testEventsNumber, success, jvmti, jni); + finish = true; } if (!NSK_JVMTI_VERIFY(jvmti->RawMonitorExit(eventsCounterMonitor))) { @@ -95,8 +95,8 @@ VMObjectAllocHandler(jvmtiEnv *jvmti, success = 0; } - if (!success) { - nsk_jvmti_aod_disableEventsAndFinish(agentName, testEvents, testEventsNumber, 0, jvmti, jni); + if (finish || !success) { + nsk_jvmti_aod_disableEventsAndFinish(agentName, testEvents, testEventsNumber, success, jvmti, jni); } } diff --git a/test/hotspot/jtreg/vmTestbase/nsk/share/jdb/Launcher.java b/test/hotspot/jtreg/vmTestbase/nsk/share/jdb/Launcher.java index 44e476d0be7..1735cc1e18d 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/share/jdb/Launcher.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/share/jdb/Launcher.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2002, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2002, 2025, 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 @@ -32,7 +32,7 @@ /** * This class provides launching of jdb and debuggee in local - * or remote mode according to test command line options. + * mode according to test command line options. */ public class Launcher extends DebugeeBinder { @@ -94,7 +94,7 @@ public Launcher (JdbArgumentHandler argumentHandler, Log log) { } /** - * Defines mode (local or remote) and type of connector (default, launching, + * Defines mode (local) and type of connector (default, launching, * raw launching, attaching or listening) according to options * parsed by JdbArgumentHandler. And then launches jdb * and debuggee in defined mode. diff --git a/test/hotspot/jtreg/vmTestbase/nsk/share/jpda/BindServer.java b/test/hotspot/jtreg/vmTestbase/nsk/share/jpda/BindServer.java deleted file mode 100644 index 58a7ca2a703..00000000000 --- a/test/hotspot/jtreg/vmTestbase/nsk/share/jpda/BindServer.java +++ /dev/null @@ -1,1847 +0,0 @@ -/* - * Copyright (c) 2001, 2025, 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. - * - * 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 nsk.share.jpda; - -import java.io.*; -import java.net.*; -import java.util.*; - -import nsk.share.*; - -/** - * BindServer is an utility to perform JPDA tests - * in remote mode across network. - *

    - * This utility should be started on remote host. It listens for connection - * from JPDA tests and launches debuggee VM on this host. - *

    - * BindServer works together with Binder used in - * the tests to incapsulate actions required for launching debuggee VM. - * See ProcessBinder and DebugeeArgumentHandler - * to know how run tests in local or remote mode across network or - * on an single host. - *

    - * BindServer is started on the debuggee host. - * It recognizes following command line options: - *

    - *

    - * Only required option is -bind.file, which points to the file - * where pairs of particular pathes are presented as they are seen from - * both hosts along with some other BindServer options. - * See execution.html to read more about format of bind-file. - * - * @see DebugeeBinder - * @see DebugeeArgumentHandler - */ -public final class BindServer { - - /** Version of BindServer implementation. */ - public static final long VERSION = 2; - - /** Timeout in milliseconds used for waiting for inner threads. */ - private static long THREAD_TIMEOUT = DebugeeBinder.THREAD_TIMEOUT; // milliseconds - - private static int PASSED = 0; - private static int FAILED = 2; - private static int JCK_BASE = 95; - - private static int TRACE_LEVEL_PACKETS = 10; - private static int TRACE_LEVEL_THREADS = 20; - private static int TRACE_LEVEL_ACTIONS = 30; - private static int TRACE_LEVEL_SOCKETS = 40; - private static int TRACE_LEVEL_IO = 50; - - private static String pathSeparator = System.getProperty("path.separator"); - private static String fileSeparator = System.getProperty("file.separator"); - - private static char pathSeparatorChar = pathSeparator.charAt(0); - private static char fileSeparatorChar = fileSeparator.charAt(0); - - private static Log log = null; - private static Log.Logger logger = null; - private static ArgumentHandler argHandler = null; - - private static String pathConvertions[][] = null; - - - private int totalRequests = 0; - private int acceptedRequests = 0; - private int unauthorizedRequests = 0; - private int busyRequests = 0; - - /** - * Start BindServer utility from command line. - * This method invokes run() and redirects output - * to System.err. - * - * @param argv list of command line arguments - */ - public static void main (String argv[]) { - System.exit(run(argv,System.err) + JCK_BASE); - } - - /** - * Start BindServer utility from JCK-compatible - * environment. - * - * @param argv list of command line arguments - * @param out outpur stream for log messages - * - * @return FAILED if error occured - * PASSED oterwise - */ - public static int run(String argv[], PrintStream out) { - return new BindServer().runIt(argv, out); - } - /** - * Perform execution of BindServer. - * This method handles command line arguments, starts seperate - * thread for listening connection from test on remote host, - * and waits for command "exit" from a user. - * Finally it closes all conections and prints connections - * statiscs. - * - * @param argv list of command line arguments - * @param out outpur stream for log messages - * - * @return FAILED if error occured - * PASSED oterwise - */ - private int runIt(String argv[], PrintStream out) { - try { - argHandler = new ArgumentHandler(argv); - } catch (ArgumentHandler.BadOption e) { - out.println("ERROR: " + e.getMessage()); - return FAILED; - } - - if (argHandler.getArguments().length > 0) { - out.println("ERROR: " + "Too many positional arguments in command line"); - return FAILED; - } - - log = new Log(out, argHandler); - logger = new Log.Logger(log, ""); - - logger.trace(TRACE_LEVEL_THREADS, "BindServer: starting main thread"); - - logger.display("Listening to port: " + argHandler.getBindPortNumber()); - logger.display("Authorizing host: " + argHandler.getDebuggerHost()); - - pathConvertions = new String[][] { - { "TESTED_JAVA_HOME", argHandler.getDebuggerJavaHome(), argHandler.getDebugeeJavaHome() }, - { "TESTBASE", argHandler.getDebuggerTestbase(), argHandler.getDebugeeTestbase() }, - { "WORKDIR", argHandler.getDebuggerWorkDir(), argHandler.getDebugeeWorkDir() } - }; - - logger.display("Translating pathes:"); - for (int i = 0; i < pathConvertions.length; i++) { - logger.display(pathConvertions[i][0] + ":" +"\n" - + " " + pathConvertions[i][1] + "\n" - + " =>" + "\n" - + " " + pathConvertions[i][2]); - } - - String windir = argHandler.getDebugeeWinDir(); - if (!(windir == null || windir.equals(""))) { - logger.display("Using WINDIR: \n" - + " " + argHandler.getDebugeeWinDir()); - } - - BufferedReader stdIn = new BufferedReader( - new InputStreamReader(System.in, System.getProperty("stdin.encoding"))); - try (ListeningThread listeningThread = new ListeningThread(this)) { - listeningThread.bind(); - listeningThread.start(); - - System.out.println("\n" - + "BindServer started" + "\n" - + "Type \"exit\" to shut down BindServer" - + "\n"); - - for (; ; ) { - try { - String userInput = stdIn.readLine(); - if (userInput == null || userInput.equals("exit") - || userInput.equals("quit")) { - logger.display("Shutting down BindServer"); - stdIn.close(); - stdIn = null; - break; - } else if (userInput.trim().equals("")) { - continue; - } else { - System.out.println("ERROR: Unknown command: " + userInput); - } - } catch (IOException e) { - e.printStackTrace(log.getOutStream()); - throw new Failure("Caught exception while reading console command:\n\t" - + e); - } - } - - printSummary(System.out); - - logger.trace(TRACE_LEVEL_THREADS, "BindServer: exiting main thread"); - } - - return PASSED; - } - - /** - * Print usefull summary statistics about connections occured. - * - * @param out output stream for printing statistics - */ - private void printSummary(PrintStream out) { - out.println("\n" - + "Connections summary:" + "\n" - + " Tolal connections: " + totalRequests + "\n" - + " Accepted authorized: " + acceptedRequests + "\n" - + " Rejected unauthorized " + unauthorizedRequests + "\n" - + " Rejected being busy: " + busyRequests + "\n"); - }; - - /** - * Check if given path starts with the specified prefix taking - * into account difference between slashChar used in path - * and fileSeparatorChar used in prefix. - * - * @param path path to check - * @param prefix prefix to compare with - * @param slashChar file separator used in path - */ - private static boolean checkPathPrefix(String path, String prefix, char slashChar) { - int prefixLength = prefix.length(); - if (prefixLength > path.length()) { - return false; - } - for (int i = 0; i < prefixLength; i++) { - char pathChar = path.charAt(i); - char prefixChar = prefix.charAt(i); - - if (pathChar != prefixChar) { - if ((pathChar == slashChar || pathChar == fileSeparatorChar - || pathChar == '\\' || pathChar == '/') - && (prefixChar == slashChar || prefixChar == fileSeparatorChar - || prefixChar == '\\' || prefixChar == '/')) { - // do nothing - } else { - return false; - } - } - } - return true; - } - - /** - * Convert given path according to list of prefixes from - * pathConvertions table. - * - * @param path path for converting - * @param slash file separator used in path - * @param name path identifier used for error messages - * @param strict force throwing Failure if path is not matched - * - * @return string with the converted path - * - * @throws Failure if path does not matched for translation - */ - private static String convertPath(String path, String slash, String name, boolean strict) { - if (path == null) - return null; - - char slashChar = slash.charAt(0); - - for (int i = 0; i < pathConvertions.length; i++) { - String from = pathConvertions[i][1]; - String to = pathConvertions[i][2]; - if (checkPathPrefix(path, from, slashChar)) { - return (to + path.substring(from.length())).replace(slashChar, fileSeparatorChar); - } - } - if (strict) { - throw new Failure("Path not matched for translation " + name + ":\n\t" + path); - } - return path; - } - - /** - * Convert given list of pathes according to list of prefixes from - * pathConvertions table by invoking convertPath() - * for each path from the list. - * - * @param list list of pathes for converting - * @param slash file separator used in pathes - * @param name path identifier used for error messages - * @param strict force throwing Failure if some path is not matched - * - * @return list of strings with converted pathes - * - * @throws Failure if some path does not matched for translation - * - * @see #convertPath() - */ - private static String[] convertPathes(String[] list, String slash, String name, boolean strict) { - String[] converted = new String[list.length]; - for (int i = 0; i < list.length; i++) { - converted[i] = convertPath(list[i], slash, name, strict); - } - return converted; - } - - /** - * Pause current thread for specified amount of time in milliseconds, - * This method uses Object.wait(long) method as a reliable - * method which prevents whole VM from suspending. - * - * @param millisecs - amount of time in milliseconds - */ - private static void sleeping(int millisecs) { - Object obj = new Object(); - - synchronized(obj) { - try { - obj.wait(millisecs); - } catch (InterruptedException e) { - e.printStackTrace(log.getOutStream()); - new Failure("Thread interrupted while sleeping:\n\t" + e); - } - } - } - - /** - * Wait for given thread finished for specified timeout or - * interrupt this thread if not finished. - * - * @param thr thread to wait for - * @param millisecs timeout in milliseconds - */ - private static void waitInterruptThread(Thread thr, long millisecs) { - if (thr != null) { - String name = thr.getName(); - try { - if (thr.isAlive()) { - logger.trace(TRACE_LEVEL_THREADS, "Waiting for thread: " + name); - thr.join(millisecs); - } - } catch (InterruptedException e) { - e.printStackTrace(log.getOutStream()); - throw new Failure ("Thread interrupted while waiting for another thread:\n\t" - + e); - } finally { - if (thr.isAlive()) { - logger.trace(TRACE_LEVEL_THREADS, "Interrupting not finished thread: " + name); - thr.interrupt(); -/* - logger.display("Stopping not finished thread: " + thr); - thr.stop(); - */ - } - } - } - } - - /** - * Wait for given thread finished for default timeout - * THREAD_TIMEOUT and - * interrupt this thread if not finished. - * - * @param thr thread to wait for - */ - private static void waitInterruptThread(Thread thr) { - waitInterruptThread(thr, THREAD_TIMEOUT); - } - -///////// Thread listening a TCP/IP socket ////////// - - /** - * An inner thread used for listening connection from remote test - * and starting separate serving thread for each accepted connection. - * - * @see ServingThread - */ - private static class ListeningThread extends Thread implements AutoCloseable { - private volatile boolean shouldStop = false; - private volatile boolean closed = false; - - private BindServer owner = null; - private volatile ServingThread servingThread = null; - private volatile int taskCount = 0; - - private ObjectOutputStream socOut = null; - private ObjectInputStream socIn = null; - - private String autorizedHostName = argHandler.getDebuggerHost(); - private InetAddress autorizedInetAddresses[] = null; - private int port = argHandler.getBindPortNumber(); - private Socket socket = null; - private ServerSocket serverSocket = null; - private InetAddress clientInetAddr = null; - private String clientHostName = null; - private SocketConnection connection = null; - - /** - * Make listening thread for given BindServer object - * as an owner and bind it to listening port by invoking method - * bind(). - * - * @see bind() - */ - public ListeningThread(BindServer owner) { - super("ListeningThread"); - this.owner = owner; - try { - autorizedInetAddresses = InetAddress.getAllByName(autorizedHostName); - } catch (UnknownHostException e) { - e.printStackTrace(log.getOutStream()); - throw new Failure("Cannot resolve DEBUGGER_HOST value: " + autorizedHostName); - } - } - - /** - * Bind ServerSocket to the specified port. - */ - public void bind() { - for (int i = 0; !shouldStop && i < DebugeeBinder.CONNECT_TRIES; i++) { - try { - logger.trace(TRACE_LEVEL_SOCKETS, "ListeningThread: binding to server socket ..."); - // length of the queue = 2 - serverSocket = new ServerSocket(port, 2); - // timeout for the ServerSocket.accept() - serverSocket.setSoTimeout(DebugeeBinder.CONNECT_TRY_DELAY); - logger.trace(TRACE_LEVEL_SOCKETS, "ListeningThread: socket bound: " + serverSocket); - logger.display("Bound to listening port"); - return; - } catch (BindException e) { - logger.display("Socket binding try #" + i + " failed:\n\t" + e); - sleeping(DebugeeBinder.CONNECT_TRY_DELAY); - } catch (IOException e) { - e.printStackTrace(log.getOutStream()); - throw new Failure("Caught exception while binding to socket:\n\t" - + e); - } - } - throw new Failure("Unable to bind to socket after " - + DebugeeBinder.CONNECT_TRIES + " tries"); - } - - /** - * Accept socket connection from authorized remote host and - * start separate SrvingThread to handle each connection. - * Connection from unauthorized hosts or connections made while - * current connection is alive are rejected. - * - * @see ServingThread - * @see #llowConnection() - * @see allowServing() - */ - public void run() { - String reply = null; - - logger.trace(TRACE_LEVEL_THREADS, "ListeningThread: started"); - logger.display("Listening for connection from remote host"); - while(!(shouldStop || isInterrupted())) { - try { - try { - logger.trace(TRACE_LEVEL_SOCKETS, "ListeningThread: waiting for connection from test"); - socket = serverSocket.accept(); - logger.trace(TRACE_LEVEL_SOCKETS, "ListeningThread: connection accepted"); - } catch(InterruptedIOException e) { -// logger.trace(TRACE_LEVEL_SOCKETS, "ListeningThread: timeout of waiting for connection from test"); - continue; - } - owner.totalRequests++; - logger.display(""); - clientInetAddr = socket.getInetAddress(); - clientHostName = clientInetAddr.getHostName(); - logger.display("Connection #" + owner.totalRequests - + " requested from host: " + clientHostName); - connection = new SocketConnection(logger, "BindServer"); -// connection.setPingTimeout(DebugeeBinder.PING_TIMEOUT); - connection.setSocket(socket); - socket = null; - if (allowConnection()) { - if (allowServing()) { - owner.acceptedRequests++; - reply = "host authorized: " + clientHostName; - logger.display("Accepting connection #" + owner.acceptedRequests - + ": " + reply); - servingThread = new ServingThread(this, connection); - servingThread.start(); - cleanHostConnection(); - } else { - owner.busyRequests++; - reply = "BindServer is busy"; - logger.complain("Rejecting connection #" + owner.busyRequests - + ": " + reply); - connection.writeObject(new RequestFailed(reply)); - closeHostConnection(); - } - } else { - owner.unauthorizedRequests++; - reply = "host unauthorized: " + clientHostName; - logger.complain("Rejecting connection #" + owner.unauthorizedRequests - + ": " + reply); - connection.writeObject(new RequestFailed(reply)); - closeHostConnection(); - } - } catch (Exception e) { - logger.complain("Caught exception while accepting connection:\n" + e); - e.printStackTrace(log.getOutStream()); - } - } - logger.trace(TRACE_LEVEL_THREADS, "ListeningThread: exiting"); - closeConnection(); - } - - /** - * Check if the connection made is from authorized host. - * - * @return true if connection is allowed because host authorized - * false if connection is rejected because host unauthorized - */ - private boolean allowConnection() { - // check if local host from loopback address - if (autorizedHostName.equals("localhost")) - return clientInetAddr.isLoopbackAddress(); - - // check if equal hostname - if (autorizedHostName.equals(clientHostName)) - return true; - - // check if equal host address - for (int i = 0; i < autorizedInetAddresses.length; i++) { - if (clientInetAddr.equals(autorizedInetAddresses[i])) { - return true; - } - } - return false; - } - - /** - * Check if no current connection exists or it is dead. - * If current connection presents it will be tested by pinging - * remote host and aborted if host sends no reply. If an alive - * connection exists, new connection will be rejected. - * - * @return true if no alive connection exists - * false otherwise - */ - private boolean allowServing() { - if (servingThread == null) { - return true; - } - if (servingThread.done) { - return true; - } - if (!servingThread.isConnectionAlive()) { - logger.display("# WARNING: Previous connection from remote host is dead: aborting connection"); - servingThread.close(); - servingThread = null; - return true; - } - -/* - logger.complain("Previous connection from remote host is alive: starting new connection"); - servingThread = null; - return true; - */ - logger.complain("Previous connection from remote host is alive: reject new connection"); - return false; - } - - /** - * Wait for this thread finished - * for specified timeout or interrupt it. - * - * @param millis timeout in milliseconds - */ - public void waitForThread(long millis) { - shouldStop = true; - waitInterruptThread(this, millis); - } - - /** - * Close socket connection from remote host. - */ - private void closeHostConnection() { - if (connection != null) { - connection.close(); - } - if (socket != null) { - try { - socket.close(); - } catch (IOException e) { - logger.complain("Caught IOException while closing socket:\n\t" - + e); - } - socket = null; - } - } - - /** - * Assign to connection and socket objects - * but do not close them. - */ - private void cleanHostConnection() { - connection = null; - socket = null; - } - - /** - * Close all connections and sockets. - */ - private void closeConnection() { - closeHostConnection(); - if (serverSocket != null) { - try { - serverSocket.close(); - } catch (IOException e) { - logger.complain("Caught IOException while closing ServerSocket:\n\t" - + e); - } - serverSocket = null; - } - } - - /** - * Close thread by closing all connections and waiting - * for thread to finish. - * - * @see #closeConnection() - */ - @Override - public synchronized void close() { - if (closed) { - return; - } - try { - closeHostConnection(); - if (servingThread != null) { - servingThread.close(); - servingThread = null; - } - waitForThread(THREAD_TIMEOUT); - closeConnection(); - closed = true; - logger.trace(TRACE_LEVEL_THREADS, "ListeningThread closed"); - } catch (Throwable e) { - e.printStackTrace(log.getOutStream()); - logger.complain("Caught exception while closing ListeningThread:\n\t" + e); - } - } - - } // ListeningThread - -///////// Thread working with a communication channel ////////// - - /** - * An internal thread for handling each connection from a test - * on remote host. It reads requests from test and starts separate - * LaunchingThread to execute each request. - * - * @see LaunchingThread - */ - private static class ServingThread extends Thread { - private volatile boolean shouldStop = false; - private volatile boolean closed = false; - private volatile boolean done = false; - - private ListeningThread owner = null; - private LaunchingThread launchingThread = null; - - private SocketConnection connection = null; - - /** - * Make serving thread with specified input/output connection streams - * and given Listenerthread as an owner. - * - * @param owner owner of this thread - * @param connection established socket connection with test - */ - public ServingThread(ListeningThread owner, SocketConnection connection) { - super("ServingThread"); - this.owner = owner; - this.connection = connection; - } - - /** - * Read requests from socket connection and start LaunchingThread - * to perform each requested action. - */ - public void run() { - logger.trace(TRACE_LEVEL_THREADS, "ServingThread: starting handling requests from debugger"); - try { - // sending OK(version) - logger.trace(TRACE_LEVEL_ACTIONS, "ServingThread: sending initial OK(VERSION) to debugger"); - connection.writeObject(new OK(VERSION)); - - // receiving TaskID(id) - logger.trace(TRACE_LEVEL_IO, "ServingThread: waiting for TaskID from debugger"); - Object taskID = connection.readObject(); - logger.trace(TRACE_LEVEL_IO, "ServingThread: received TaskID from debugger: " + taskID); - if (taskID instanceof TaskID) { - String id = ((TaskID)taskID).id; - owner.taskCount++; - logger.println("[" + owner.taskCount + "/" + owner.owner.totalRequests + "]: " + id); - } else { - throw new Failure("Unexpected TaskID received form debugger: " + taskID); - } - - // starting launching thread - launchingThread = new LaunchingThread(this, connection); - launchingThread.start(); - - // receiving and handling requests - while(!(shouldStop || isInterrupted())) { - logger.trace(TRACE_LEVEL_IO, "ServingThread: waiting for request from debugger"); - Object request = connection.readObject(); - logger.trace(TRACE_LEVEL_IO, "ServingThread: received request from debugger: " + request); - if (request == null) { - logger.display("Connection closed"); - break; - } else if (request instanceof Disconnect) { - logger.display("Closing connection by request"); - request = null; - break; - } else { - boolean success = false; - long timeToFinish = System.currentTimeMillis() + THREAD_TIMEOUT; - while (System.currentTimeMillis() < timeToFinish) { - if (launchingThread.doneRequest()) { - success = true; - logger.trace(TRACE_LEVEL_ACTIONS, "ServingThread: asking launching thread to handle request: " + request); - launchingThread.handleRequest(request); - break; - } - try { - launchingThread.join(DebugeeBinder.TRY_DELAY); - } catch (InterruptedException e) { - throw new Failure("ServingThread interrupted while waiting for LaunchingThread:\n\t" - + e); - } - } - if (!success) { - logger.complain("Rejecting request because of being busy:\n" + request); - connection.writeObject( - new RequestFailed("Busy with handling previous request")); - } - } - } - } catch (Exception e) { - e.printStackTrace(log.getOutStream()); - logger.complain("Caught exception while handling request:\n\t" + e); - } finally { - logger.trace(TRACE_LEVEL_THREADS, "ServingThread: exiting"); - closeConnection(); - done = true; - } - } - - /** - * Check if present socket connection is alive. - */ - private boolean isConnectionAlive() { - return (connection != null && connection.isConnected()); - } - - /** - * Wait for this thread finished - * for specified timeout or interrupt it. - * - * @param millis timeout in milliseconds - */ - public void waitForThread(long millis) { - shouldStop = true; - waitInterruptThread(this, millis); - } - - /** - * Close socket connection from remote host. - */ - private void closeConnection() { - if (connection != null) { - connection.close(); - } - if (launchingThread != null) { - launchingThread.handleRequest(null); - } - } - - /** - * Close thread closing socket connection and - * waiting for thread finished. - */ - public synchronized void close() { - if (closed) { - return; - } - closeConnection(); - if (launchingThread != null) { - launchingThread.close(); - launchingThread = null; - } - waitForThread(THREAD_TIMEOUT); - closed = true; - logger.trace(TRACE_LEVEL_THREADS, "ServingThread closed"); - } - - } // ServingThread - -///////// Thread serving a particular Binder's request ////////// - - /** - * An internal thread to execute each request from a test on remote host. - * Requests are coming from ServingThread by invoking handleRequest(Object) - * method. - */ - private static class LaunchingThread extends Thread { - private volatile boolean shouldStop = false; - private volatile boolean closed = false; - public volatile boolean done = false; - - private ServingThread owner = null; -// private ProcessWaitingThread waitingThread = null; - private Process process = null; - - private StreamRedirectingThread stdoutRedirectingThread = null; - private StreamRedirectingThread stderrRedirectingThread = null; - - /** Notification about request occurence. */ - private volatile Object notification = new Object(); - /** Request to execute. */ - private volatile Object request = null; - /** Socket stream to send replies to. */ - private SocketConnection connection = null; - - /** - * Make thread for executing requests from a test and - * send reply. - * - * @param owner owner of this thread - * @connection socket connection for sending replies - */ - public LaunchingThread(ServingThread owner, SocketConnection connection) { - super("LaunchingThread"); - this.owner = owner; - this.connection = connection; - } - - /** - * Notify this thread that new request has come. - * - * @param request request to execute - */ - public void handleRequest(Object request) { - synchronized (notification) { - this.request = request; - notification.notifyAll(); - } - } - - /** - * Check if request has been executed. - */ - public boolean doneRequest() { - return done; - } - - /** - * Wait for request notification from ServingThread - * and execute an action according to the request. - * Request null means thread should finish. - */ - public void run() { - logger.trace(TRACE_LEVEL_THREADS, "LaunchingThread: started to handle request"); - done = true; - while (!isInterrupted()) { - // wait for new request notification - logger.trace(TRACE_LEVEL_ACTIONS, "LaunchingThread: waiting for request"); - synchronized (notification) { - try { - notification.wait(); - } catch (InterruptedException e) { - logger.complain("LaunchingThread interrupted while waiting for request:\n\t" - + e); - break; - } - } - - // execute the request - try { - logger.trace(TRACE_LEVEL_ACTIONS, "LaunchingThread: handling request: " + request); - if (request == null) { - break; - } else if (request instanceof LaunchDebugee) { - launchDebugee((LaunchDebugee)request); - } else if (request instanceof WaitForDebugee) { - waitForDebugee((WaitForDebugee)request); - } else if (request instanceof DebugeeExitCode) { - debugeeExitCode((DebugeeExitCode)request); - } else if (request instanceof KillDebugee) { - killDebugee((KillDebugee)request); - } else { - String reason = "Unknown request: " + request; - logger.complain(reason); - sendReply(new RequestFailed(reason)); - } - } catch (Exception e) { - e.printStackTrace(log.getOutStream()); - logger.complain("Caught exception while handling request:\n\t" + e); - } - done = true; - } - done = true; - logger.trace(TRACE_LEVEL_THREADS, "LaunchingThread: exiting"); - closeConnection(); - } - - /** - * Send given reply to remote test. - * - * @param reply reply object to send - */ - public void sendReply(Object reply) throws IOException { - connection.writeObject(reply); - } - - /** - * Send given output line to remote test. - * - * @param reply wrapper object for output line to send - */ - public void sendStreamMessage(RedirectedStream wrapper) throws IOException { - logger.trace(TRACE_LEVEL_ACTIONS, "Sending output line wrapper to debugger: " + wrapper); - if (connection.isConnected()) { - sendReply(wrapper); - } else { - logger.complain("NOT redirected: " + wrapper.line); - } - } - - /** - * Launch two StreamRedirectingThread threads to redirect - * stdin/stderr output of debuggee VM process via BindServer - * connection. - * - * @param process debuggee VM process - */ - private void launchStreamRedirectors(Process process) { - stdoutRedirectingThread = - new StdoutRedirectingThread(this, process.getInputStream(), - DebugeeProcess.DEBUGEE_STDOUT_LOG_PREFIX); - stdoutRedirectingThread.start(); - stderrRedirectingThread = - new StderrRedirectingThread(this, process.getErrorStream(), - DebugeeProcess.DEBUGEE_STDERR_LOG_PREFIX); - stderrRedirectingThread.start(); - } - - /** - * Execute request for launching debuggee. - * - * @param request request to execute - */ - private void launchDebugee(LaunchDebugee request) throws IOException { - logger.trace(TRACE_LEVEL_ACTIONS, "LaunchDebugee: handle request: " + request); - - if (process != null) { - logger.complain("Unable to launch debuggee: process already launched"); - sendReply(new RequestFailed("Debuggee process already launched")); - return; - } - - try { - String[] cmd = request.cmd; - cmd[0] = convertPath(cmd[0], request.slash, "TESTED_JAVA_HOME", true); - for (int i = 1; i < cmd.length; i++) { - cmd[i] = convertPath(cmd[i], request.slash, "JAVA_ARGS", false); - } - String workDir = convertPath(request.workDir, request.slash, "WORKDIR", true); - String[] classPathes = convertPathes(request.classPathes, request.slash, "CLASSPATH", true); - String windir = argHandler.getDebugeeWinDir(); - - boolean win = (!(windir == null || windir.equals(""))); - String[] envp = new String[win ? 3 : 1] ; - envp[0] = "CLASSPATH=" + ArgumentParser.joinArguments(classPathes, "", pathSeparator); - if (win) { - envp[1] = "WINDIR=" + windir; - envp[2] = "SystemRoot=" + windir; - } - - logger.display("Setting environment:\n" - + " " + ArgumentHandler.joinArguments(envp, "", "\n ")); - logger.display("Setting work dir:\n" - + " " + workDir); - logger.display("Launching debuggee:\n" - + " " + ArgumentHandler.joinArguments(cmd, "\"")); - - process = Runtime.getRuntime().exec(cmd, envp, new File(workDir)); - logger.display(" debuggee launched successfully"); - - launchStreamRedirectors(process); - } catch (Exception e) { - if (!(e instanceof Failure)) { - e.printStackTrace(log.getOutStream()); - } - logger.complain("Caught exception while launching debuggee:\n\t" + e); - sendReply(new CaughtException(e)); - return; - } - - sendReply(new OK()); - } - - /** - * Execute request for waiting for debuggee exited. - * - * @param request request to execute - */ - private void waitForDebugee(WaitForDebugee request) throws IOException { - logger.trace(TRACE_LEVEL_ACTIONS, "WaitForDebugee: handle request: " + request); - - if (process == null) { - String reply = "No debuggee process to wait for"; - logger.complain(reply); - sendReply(new RequestFailed(reply)); - return; - } - - logger.display("Waiting for debuggee to exit"); -/* - // because timeout is not supported now - // we do not use separate thread for waiting for process - // and so following lines are commented out - - waitingThread = new ProcessWaitingThread(); - logger.trace(TRACE_LEVEL_ACTIONS, "LaunchingThread: starting thread for waiting for debugee process"); - waitingThread.start(); - try { - waitingThread.join(request.timeout); - if (waitingThread.isAlive()) { - String reply = "Timeout exceeded while waiting for debuggee to exit"; - logger.complain(reply); - waitingThread.interrupt(); - sendReply(socOut, new RequestFailed(reply)); - return; - } - } catch (InterruptedException e) { - e.printStackTrace(log.getOutStream()); - logger.complain("Caught exception while waiting for debuggee:\n\t" + e); - sendReply(new CaughtException(e)); - return; - } - int exitStatus = waitingThread.exitStatus; - waitingThread = null; - */ - int exitStatus; - try { - exitStatus = process.waitFor(); - waitForRedirectors(THREAD_TIMEOUT); - process.destroy(); - } catch (InterruptedException e) { - e.printStackTrace(log.getOutStream()); - logger.complain("Caught exception while waiting for debuggee process to exit:\n\t" - + e); - sendReply(new CaughtException(e)); - return; - } - logger.display(" debuggee exited with exit status: " + exitStatus); - sendReply(new OK(exitStatus)); - } - - /** - * Execute request for returning debuggee exit code. - * - * @param request request to execute - */ - private void debugeeExitCode(DebugeeExitCode request) throws IOException { - logger.trace(TRACE_LEVEL_ACTIONS, "DebugeeExitCode: handle request: " + request); - - if (process == null) { - String reply = "No debuggee process to get exit code for"; - logger.complain(reply); - sendReply(new RequestFailed(reply)); - return; - } - - int exitStatus = 0; - try { - exitStatus = process.exitValue(); - } catch (IllegalThreadStateException e) { - logger.display("# WARNING: Caught exception while getting exit status of debuggee:\n\t" - + e); - sendReply(new CaughtException(e)); - return; - } - logger.trace(TRACE_LEVEL_ACTIONS, "DebugeeExitCode: return debuggee exit status: " + exitStatus); - sendReply(new OK(exitStatus)); - } - - /** - * Execute request for unconditional terminating debuggee process. - * - * @param request request to execute - */ - private void killDebugee(KillDebugee request) throws IOException { - logger.trace(TRACE_LEVEL_ACTIONS, "killDebugee: handle request: " + request); - - if (process == null) { - String reply = "No debuggee process to kill"; - logger.complain(reply); - sendReply(new RequestFailed(reply)); - return; - } - - logger.trace(TRACE_LEVEL_ACTIONS, "killDebugee: killing debuggee process"); - process.destroy(); - - logger.trace(TRACE_LEVEL_ACTIONS, "killDebugee: debuggee process killed"); - sendReply(new OK()); - } - - /** - * Terminate debigee VM process if still alive. - */ - private void terminateDebugeeAtExit() { - if (process != null) { - logger.trace(TRACE_LEVEL_ACTIONS, "Checking that debuggee process has exited correctly"); - try { - int value = process.exitValue(); - } catch (IllegalThreadStateException e) { - logger.complain("Debuggee process has not exited correctly: trying to kill it"); - process.destroy(); - try { - int value = process.exitValue(); - } catch (IllegalThreadStateException ie) { - logger.complain("Debuggee process is alive after killing it"); - } - process = null; - return; - } - logger.trace(TRACE_LEVEL_ACTIONS, "Debuggee process has exited correctly"); - } - } - - /** - * Wait for stream redirecting threads finished - * for specified timeout. - * - * @param millis timeout in milliseconds - */ - private void waitForRedirectors(long millis) { - try { - if (stdoutRedirectingThread != null) { - stdoutRedirectingThread.join(millis); - } - if (stderrRedirectingThread != null) { - stderrRedirectingThread.join(millis); - } - } catch (InterruptedException e) { - e.printStackTrace(log.getOutStream()); - logger.complain("Caught exception while waiting for debuggee process exited:\n\t" - + e); - } - } - - /** - * Wait for this thread finished - * for specified timeout or interrupt it. - * - * @param millis timeout in milliseconds - */ - public void waitForThread(long millis) { - shouldStop = true; - handleRequest(null); - waitInterruptThread(this, millis); - } - - /** - * Close connection with debuggee. - */ - public void closeConnection() { - // no connections to close - } - - /** - * Close thread by closing all connections with debuggee, - * finishing all redirectors and wait for thread finished. - */ - public synchronized void close() { - if (closed) { - return; - } - closeConnection(); - terminateDebugeeAtExit(); - if (stdoutRedirectingThread != null) { - stdoutRedirectingThread.close(); - stdoutRedirectingThread = null; - } - if (stderrRedirectingThread != null) { - stderrRedirectingThread.close(); - stderrRedirectingThread = null; - } - waitForThread(THREAD_TIMEOUT); - closed = true; - logger.trace(TRACE_LEVEL_THREADS, "LaunchingThread closed"); - } - - /** - * An inner thread for waiting for debuggee process exited - * and saving its exit status. (currently not used) - */ -/* - private class ProcessWaitingThread extends Thread { - int exitStatus = 0; - - ProcessWaitingThread() { - super("ProcessWaitingThread"); - } - - public void run() { - logger.trace(TRACE_LEVEL_THREADS, "ProcessWaitingThread: starting waiting for process"); - try { - exitStatus = process.waitFor(); - } catch (InterruptedException e) { - e.printStackTrace(log.getOutStream()); - logger.complain("Caught exception while waiting for debuggee process:\n\t" - + e); - } - logger.trace(TRACE_LEVEL_ACTIONS, "ProcessWaitingThread: process finished with status: " + exitStatus); - logger.trace(TRACE_LEVEL_THREADS, "ProcessWaitingThread: exiting"); - } - - public synchronized void close() { - logger.trace(TRACE_LEVEL_THREADS, "ProcessWaitingThread closed"); - } - - } // ProcessWaitingThread - */ - } // LaunchingThread - -///////// Redirecting threads ///////// - - /** - * An abstract base class for internal threads which redirects stderr/stdout - * output from debuggee process via BindServer connection. - *

    - * Two derived classes will redirect stderr or stdout stream - * by enwrapping stream line by DebugeeStderr or - * DebugeeStderr objects. They should implement only one - * abstract method enwrapLine(String) to make the difference. - */ - public static abstract class StreamRedirectingThread extends Thread { - private volatile boolean shouldStop = false; - private volatile boolean closed = false; - - private LaunchingThread owner = null; - - private BufferedReader bin = null; - private String prefix = null; - - /** - * Make a thread to enwrap and redirect lines from specified - * input stream with given prefix. - * - * @param owner owner of this thread - * @param is input stream to redirect lines from - * @param prefix prefix to add to each line - */ - public StreamRedirectingThread(LaunchingThread owner, InputStream is, String prefix) { - super("StreamRedirectingThread"); - this.prefix = prefix; - this.owner = owner; - bin = new BufferedReader(new InputStreamReader(is)); - } - - /** - * Read lines from an input stream, enwrap them, and send to remote - * test via BindServer connection. - */ - public void run() { - logger.trace(TRACE_LEVEL_THREADS, "StreamRedirectingThread: starting redirect output stream"); - try { - String line; - logger.trace(TRACE_LEVEL_IO, "StreamRedirectingThread: waiting for line from debuggee output"); - while(!shouldStop) { - line = bin.readLine(); - if (line == null) - break; - owner.sendStreamMessage(enwrapLine(prefix + line)); - } - } catch (EOFException e) { - logger.display("Debuggee output stream closed by process"); - } catch (IOException e) { - e.printStackTrace(log.getOutStream()); - logger.display("# WARNING: Connection to debuggee output stream aborted:\n\t" + e); - } catch (Exception e) { - e.printStackTrace(log.getOutStream()); - logger.complain("Caught exception while redirecting debuggee output stream:\n\t" - + e); - } - logger.trace(TRACE_LEVEL_THREADS, "StreamRedirectingThread: exiting"); - closeConnection(); - } - - /** - * Envrap output line by the appropriate wrapper. - * @param line line to enwrap - */ - protected abstract RedirectedStream enwrapLine(String line); - - /** - * Wait for this thread finished or interrupt it. - * - * @param millis timeout in milliseconds - */ - public void waitForThread(long millis) { - shouldStop = true; - waitInterruptThread(this, millis); - } - - /** - * Close redirected process output stream. - */ - public void closeConnection() { - if (closed) { - return; - } - if (bin != null) { - try { - bin.close(); - } catch (IOException e) { - e.printStackTrace(log.getOutStream()); - logger.complain("Caught exception while closing debuggee output stream:\n\t" - + e); - } - bin = null; - } - closed = true; - logger.trace(TRACE_LEVEL_THREADS, "StreamRedirectingThread closed"); - } - - /** - * Close thread by waiting redirected stream closed - * and finish the thread. - */ - public synchronized void close() { - if (closed) { - return; - } - waitForThread(THREAD_TIMEOUT); - closeConnection(); - closed = true; - logger.trace(TRACE_LEVEL_THREADS, "StreamRedirectingThread closed"); - } - - } // StreamRedirectingThread - - /** - * Particalar case of StreamRedirectingThread to redirect - * stderr stream by enwrapping lines into DebugeeStderr - * objects. - */ - private static class StderrRedirectingThread extends StreamRedirectingThread { - - /** - * Make a thread to redirect stderr output stream. - */ - StderrRedirectingThread(LaunchingThread owner, InputStream is, String prefix) { - super(owner, is, prefix); - setName("StderrRedirectingThread"); - } - - /** - * Enwrap given line into DebugeeStderr object. - */ - protected RedirectedStream enwrapLine(String line) { - return new DebugeeStderr(line); - } - - } - - /** - * Particalar case of StreamRedirectingThread to redirect - * stdout stream by enwrapping lines into DebugeeStdout - * objects. - */ - private static class StdoutRedirectingThread extends StreamRedirectingThread { - - /** - * Make a thread to redirect stdout output stream. - */ - StdoutRedirectingThread(LaunchingThread owner, InputStream is, String prefix) { - super(owner, is, prefix); - setName("StdoutRedirectingThread"); - } - - /** - * Enwrap given line into DebugeeStdout object. - */ - protected RedirectedStream enwrapLine(String line) { - return new DebugeeStdout(line); - } - - } - -///////// BinderServer's packets ////////// - - /** - * Base serializable object to transmit request or reply - * via BindServer connection. - */ - public static class Packet implements Serializable {} - - ///////// Binder's requests ////////// - - /** - * Base class to represent request to BindServer. - */ - public static abstract class Request extends Packet {} - - /** - * This class implements task identification command. - */ - public static class TaskID extends Request { - public String id; - - public TaskID(String id) { - this.id = id; - } - - public String toString() { - return "TaskID: id=" + id; - } - } - - /** - * This class implements a request for launching a debugee. - */ - public static class LaunchDebugee extends Request { - public String slash; // slash symbol used on debugger host - public String[] cmd; // command line arguments as seen on debugger host - public String workDir; // path to working directory as seen on debugger host - public String[] classPathes; // list of class pathes as seen on debugger host - - public LaunchDebugee(String[] cmd, String slash, String workDir, - String[] pathes, String[] classPathes, - String[] libPathes) { - this.cmd = cmd; - this.slash = slash; - this.workDir = workDir; - this.classPathes = classPathes; - } - - public String toString() { - return "LaunchDebugee:" - + "\n\tcommand=" + ArgumentParser.joinArguments(cmd, "\"") - + "\n\tWORKDIR=" + workDir - + "\n\tCLASSPATH=" + ArgumentParser.joinArguments(classPathes, "", ":") - + "\n\tslash=" + slash; - } - } - - /** - * This class implements a request for waiting for debugee - * termination. - */ - public static class WaitForDebugee extends Request { - public long timeout = 0; // timeout in minutes for waiting - - public WaitForDebugee(long value) { - timeout = value; - } - - public String toString() { - return "WaitForDebugee: timeout=" + timeout; - } - } - - /** - * This class implements a request for exit code of - * debugee process. - */ - public static class DebugeeExitCode extends Request { - public String toString() { - return "SebugeeExitCode"; - } - } - - /** - * This class implements a request for killing debugee process. - */ - public static class KillDebugee extends Request { - public String toString() { - return "KillDebugee"; - } - } - - /** - * This class implements a request to disconnect connection with test. - */ - public static class Disconnect extends Request { - public String toString() { - return "Disconnect"; - } - } - - ///////// BindServer's responses ////////// - - /** - * Base class to represent response from BindServer. - */ - public static abstract class Response extends Packet {} - - /** - * This class implements a response that a previoulsy received - * request has been successfully performed. - */ - public static class OK extends Response { - public long info = BindServer.VERSION; // optional additional info - - public OK() { - } - - public OK(long value) { - info = value; - } - - public String toString() { - return "OK(" + info + ")"; - } - } - - /** - * This class implements a response that the BindServer is - * unable to serve a previoulsy received request. - */ - public static class RequestFailed extends Response { - public String reason; // the short explanation of failure - - public RequestFailed(String reason) { - this.reason = reason; - } - - public String toString() { - return "RequestFailed(" + reason + ")"; - } - } - - /** - * This class implements a response that the BindServer is - * unable to serve a previoulsy received request because of - * caught exception. - */ - public static class CaughtException extends RequestFailed { - public CaughtException(Exception cause) { - super("Caught exception: " + cause); - } - } - - ///////// Wrappers for redirected messages ////////// - - /** - * Base class to represent wrappers for redirected streams. - */ - public static class RedirectedStream extends Packet { - public String line; // line containing line from redirected stream - - public RedirectedStream(String str) { - line = str; - } - - public String toString() { - return "RedirectedStream(" + line + ")"; - } - } - - /** - * This class enwraps redirected line of stdout stream. - */ - public static class DebugeeStdout extends RedirectedStream { - - public DebugeeStdout(String str) { - super(str); - } - - public String toString() { - return "DebugeeStdout(" + line + ")"; - } - } - - /** - * This class enwraps redirected line of stderr stream. - */ - public static class DebugeeStderr extends RedirectedStream { - public DebugeeStderr(String str) { - super(str); - } - - public String toString() { - return "DebugeeStderr(" + line + ")"; - } - } - -/////// ArgumentHandler for BindServer command line ///////// - - /** - * This class is used to parse arguments from command line - * and specified bind-file, - */ - private static class ArgumentHandler extends ArgumentParser { - - protected Properties fileOptions; - - /** - * Make parser object for command line arguments. - * - * @param args list of command line arguments - */ - public ArgumentHandler(String[] args) { - super(args); - } - - /** - * Check if given command line option is aloowed. - * - * @param option option name - * @param value option value - */ - protected boolean checkOption(String option, String value) { - if (option.equals("bind.file")) { - // accept any file name - return true; - } - return super.checkOption(option, value); - } - - /** - * Check if all recignized options are compatible. - */ - protected void checkOptions() { - if (getBindFileName() == null) { - throw new BadOption("Option -bind.file is requred "); - } - super.checkOptions(); - } - - /** - * Check if value of this option points to a existing directory. - * - * @param option option name - * @param dir option value - */ - private void checkDir(String option, String dir) { - File file = new File(dir); - if (!file.exists()) { - throw new BadOption(option + " does not exist: " + dir); - } - if (!file.isAbsolute()) { - throw new BadOption(option + " is not absolute pathname: " + dir); - } - if (!file.isDirectory()) { - throw new BadOption(option + " is not directory: " + dir); - } - } - - /** - * Check if option from bind-file is allowed. - * - * @param option option name - * @param value option value - */ - protected boolean checkAdditionalOption(String option, String value) { - - if (option.equals("DEBUGGER_HOST")) { - // accept any hostname - return true; - } - - if (option.equals("BINDSERVER_PORT")) { - // accept only integer value - try { - int port = Integer.parseInt(value); - } catch (NumberFormatException e) { - throw new Failure("Not integer value of bind-file option " + option - + ": " + value); - } - return true; - } - - if (option.equals("DEBUGGER_TESTED_JAVA_HOME") - || option.equals("DEBUGGER_WORKDIR") - || option.equals("DEBUGGER_TESTBASE")) { - if (value == null || value.equals("")) { - throw new BadOption("Empty value of bind-file option " + option); - } - return true; - } - - if (option.equals("DEBUGGEE_TESTED_JAVA_HOME") - || option.equals("DEBUGGEE_WORKDIR") - || option.equals("DEBUGGEE_TESTBASE")) { - if (value == null || value.equals("")) { - throw new BadOption("Empty value of bind-file option " + option); - } - checkDir(option, value); - return true; - } - - if (option.equals("DEBUGGEE_WINDIR")) { - if (!(value == null || value.equals(""))) { - checkDir(option, value); - } - return true; - } - - return false; - } - - /** - * Check if all recignized options form bind-file are compatible. - */ - protected void checkAdditionalOptions() { - - if (getDebuggerJavaHome() == null) { - throw new BadOption("Option DEBUGGER_JAVA_HOME missed from bind-file"); - } - if (getDebuggerWorkDir() == null) { - throw new BadOption("Option DEBUGGER_WORKDIR missed from bind-file"); - } - if (getDebuggerTestbase() == null) { - throw new BadOption("Option DEBUGGER_TESTBASE missed from bind-file"); - } - - if (getDebugeeJavaHome() == null) { - throw new BadOption("Option DEBUGGEE_JAVA_HOME missed from bind-file"); - } - if (getDebugeeWorkDir() == null) { - throw new BadOption("Option DEBUGGEE_WORKDIR missed from bind-file"); - } - if (getDebugeeTestbase() == null) { - throw new BadOption("Option DEBUGGEE_TESTBASE missed from bind-file"); - } - } - - /** - * Parse options form specified bind-file. - */ - protected void parseAdditionalOptions() { - Enumeration keys = fileOptions.keys(); - while (keys.hasMoreElements()) { - String option = (String)keys.nextElement(); - String value = fileOptions.getProperty(option); - if (! checkAdditionalOption(option, value)) { - throw new BadOption("Unrecognized bind-file option: " + option); - } - } - checkAdditionalOptions(); - } - - /** - * Parse all options from command line and specified bind-file. - */ - protected void parseArguments() { - super.parseArguments(); - String fileName = getBindFileName(); - try { - FileInputStream bindFile = new FileInputStream(fileName); - fileOptions = new Properties(); - fileOptions.load(bindFile); - bindFile.close(); - } catch(FileNotFoundException e) { - throw new BadOption("Unable to open bind-file " + fileName + ": " + e); - } catch(IOException e) { - e.printStackTrace(log.getOutStream()); - throw new Failure("Caught exception while reading bind-file:\n" + e); - } - parseAdditionalOptions(); - } - - /** Return name of specified bind-file. */ - public String getBindFileName() { - return options.getProperty("bind.file"); - } - - /** Return specified debuggee host name . */ - public String getDebuggerHost() { - return fileOptions.getProperty("DEBUGGER_HOST", "localhost"); - } - - /** Return string representation of port number for BindServer connection. */ - public String getBindPort() { - return fileOptions.getProperty("BINDSERVER_PORT", "9000"); - } - - /** Return specified port number for BindServer connection. */ - public int getBindPortNumber() { - try { - return Integer.parseInt(getBindPort()); - } catch (NumberFormatException e) { - throw new Failure("Not integer value of BindServer port"); - } - } - - /** Return specified path to tested JDK used for debuggee VM. */ - public String getDebugeeJavaHome() { - return fileOptions.getProperty("DEBUGGEE_TESTED_JAVA_HOME"); - } - - /** Return specified path to tested JDK used for debugger. */ - public String getDebuggerJavaHome() { - return fileOptions.getProperty("DEBUGGER_TESTED_JAVA_HOME"); - } - - /** Return specified path to working dir from debuggee host. */ - public String getDebugeeWorkDir() { - return fileOptions.getProperty("DEBUGGEE_WORKDIR"); - } - - /** Return specified path to working dir from debugger host. */ - public String getDebuggerWorkDir() { - return fileOptions.getProperty("DEBUGGER_WORKDIR"); - } - - /** Return specified path to testbase dir from debuggee host. */ - public String getDebugeeTestbase() { - return fileOptions.getProperty("DEBUGGEE_TESTBASE"); - } - - /** Return specified path to testbase dir from debugger host. */ - public String getDebuggerTestbase() { - return fileOptions.getProperty("DEBUGGER_TESTBASE"); - } - - /** Return specified path to system directory on Wimdows platform. */ - public String getDebugeeWinDir() { - return fileOptions.getProperty("DEBUGGEE_WINDIR"); - } - - } // ArgumentHandler - -} // BindServer diff --git a/test/hotspot/jtreg/vmTestbase/nsk/share/jpda/DebugeeArgumentHandler.java b/test/hotspot/jtreg/vmTestbase/nsk/share/jpda/DebugeeArgumentHandler.java index 72b8076f927..05d0054928b 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/share/jpda/DebugeeArgumentHandler.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/share/jpda/DebugeeArgumentHandler.java @@ -67,8 +67,6 @@ * using JVMDI strict mode *

  • -pipe.port=<port> - * port number for internal IOPipe connection - *
  • -bind.port=<port> - - * port number for BindServer connection * *

    * See also list of basic options recognized by @@ -421,47 +419,6 @@ public boolean isDefaultDebugeeJavaHome() { return (java_home == null); } - private boolean bindPortInited = false; - /** - * Return string representation of the port number for BindServer connection, - * specified by -bind.port command line option, or - * "DEFAULT_BIND_PORT" string by default. - * - * @see #getBindPortNumber() - * @see #setRawArguments(String[]) - */ - public String getBindPort() { - String port = options.getProperty("bind.port"); - if (port == null) { - if (!bindPortInited) { - port = findFreePort(); - if (port == null) { - port = DEFAULT_BIND_PORT; - } - options.setProperty("bind.port", port); - bindPortInited = true; - } - } - return port; - } - - /** - * Return port number for BindServer connection, - * specified by -bind.port command line option, or - * "DEFAULT_BIND_PORT" port number by default. - * - * @see #getBindPort() - * @see #setRawArguments(String[]) - */ - public int getBindPortNumber() { - String value = getBindPort(); - try { - return Integer.parseInt(value); - } catch (NumberFormatException e) { - throw new TestBug("Not integer value of \"bind.port\" argument: " + value); - } - } - /** * Return JVMDI strict mode for launching debugee VM, specified by. * -jvmdi.strict command line option, or @@ -683,7 +640,6 @@ protected boolean checkOption(String option, String value) { // option with positive integer port value if (option.equals("transport.port") - || option.equals("bind.port") || option.equals("pipe.port")) { try { int number = Integer.parseInt(value); diff --git a/test/hotspot/jtreg/vmTestbase/nsk/share/jpda/DebugeeBinder.java b/test/hotspot/jtreg/vmTestbase/nsk/share/jpda/DebugeeBinder.java index d36c9d9624f..d04fed1bd32 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/share/jpda/DebugeeBinder.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/share/jpda/DebugeeBinder.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2025, 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 @@ -52,8 +52,8 @@ * @see DebugeeArgumentHandler * @see DebugeeProcess * @see IOPipe - * @see BindServer * + * @see nsk.share.jdb.Launcher * @see nsk.share.jdi.Binder * @see nsk.share.jdwp.Binder */ diff --git a/test/hotspot/jtreg/vmTestbase/nsk/share/jpda/DebugeeProcess.java b/test/hotspot/jtreg/vmTestbase/nsk/share/jpda/DebugeeProcess.java index b875911e973..55ee5366582 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/share/jpda/DebugeeProcess.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/share/jpda/DebugeeProcess.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2025, 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 @@ -41,7 +41,7 @@ * This is an abstract class that declares abstract methods to control * debugee VM process. * Derived classes should implement these methods corresponding to the mode - * that the process should be started in (locally, remotely or manually). + * that the process should be started in (locally). *

    * Particular derived classes nsk.share.jdi.Debugee and * nsk.share.jdwp.Debugee provides additional abilities diff --git a/test/hotspot/jtreg/vmTestbase/nsk/share/jpda/IOPipe.java b/test/hotspot/jtreg/vmTestbase/nsk/share/jpda/IOPipe.java index 74e3a7c3a6d..062b8a4ba4d 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/share/jpda/IOPipe.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/share/jpda/IOPipe.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2025, 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 @@ -29,12 +29,10 @@ /** * This class implements communicational channel between * debugger and debugee used for synchronization and data exchange. - * This channel is based on TCP/IP sockets and works in all - * modes (local, remote and manual). In a remote mode - * connection to BindServer is used for redirecting IOPipe messages. - * In all other modes direct TCP/IP coonnection between two VMs is used. + * This channel is based on TCP/IP sockets. * - * @see BindServer + * @see jpda.DebugeeArgumentHandler + * @see jpda.DebugeeProcess */ public class IOPipe extends SocketIOPipe { diff --git a/test/hotspot/jtreg/vmTestbase/vm/gc/compact/Compact_InternedStrings/TestDescription.java b/test/hotspot/jtreg/vmTestbase/vm/gc/compact/Compact_InternedStrings/TestDescription.java index 8d28df3c457..657cb68edc7 100644 --- a/test/hotspot/jtreg/vmTestbase/vm/gc/compact/Compact_InternedStrings/TestDescription.java +++ b/test/hotspot/jtreg/vmTestbase/vm/gc/compact/Compact_InternedStrings/TestDescription.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2017, 2025, 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 @@ -34,9 +34,11 @@ * This testcase uses interned strings for both first and second phases * and multiple threads. * + * @requires os.maxMemory > 3G * @library /vmTestbase * /test/lib * @run main/othervm + * -Xmx2G * -XX:-UseGCOverheadLimit * vm.gc.compact.Compact * -gp interned(randomString) diff --git a/test/hotspot/jtreg/vmTestbase/vm/gc/compact/Compact_InternedStrings_NonbranchyTree/TestDescription.java b/test/hotspot/jtreg/vmTestbase/vm/gc/compact/Compact_InternedStrings_NonbranchyTree/TestDescription.java index 1aaeb2fc84d..b0771871a56 100644 --- a/test/hotspot/jtreg/vmTestbase/vm/gc/compact/Compact_InternedStrings_NonbranchyTree/TestDescription.java +++ b/test/hotspot/jtreg/vmTestbase/vm/gc/compact/Compact_InternedStrings_NonbranchyTree/TestDescription.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2017, 2025, 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 @@ -34,9 +34,11 @@ * This testcase uses interned strings for first phase, * random arrays for second phases and multiple threads. * + * @requires os.maxMemory > 3G * @library /vmTestbase * /test/lib * @run main/othervm + * -Xmx2G * -XX:-UseGCOverheadLimit * vm.gc.compact.Compact * -gp interned(randomString) diff --git a/test/hotspot/jtreg/vmTestbase/vm/gc/compact/Compact_Strings_ArrayOf/TestDescription.java b/test/hotspot/jtreg/vmTestbase/vm/gc/compact/Compact_Strings_ArrayOf/TestDescription.java index f54f006d4aa..ea942c7be07 100644 --- a/test/hotspot/jtreg/vmTestbase/vm/gc/compact/Compact_Strings_ArrayOf/TestDescription.java +++ b/test/hotspot/jtreg/vmTestbase/vm/gc/compact/Compact_Strings_ArrayOf/TestDescription.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2017, 2025, 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 @@ -34,9 +34,11 @@ * This testcase uses random strings for first phase, array of * random strings for second phase and multiple threads. * + * @requires os.maxMemory > 3G * @library /vmTestbase * /test/lib * @run main/othervm + * -Xmx2G * -XX:-UseGCOverheadLimit * vm.gc.compact.Compact * -gp randomString diff --git a/test/hotspot/jtreg/vmTestbase/vm/gc/compact/Humongous_InternedStrings/TestDescription.java b/test/hotspot/jtreg/vmTestbase/vm/gc/compact/Humongous_InternedStrings/TestDescription.java index b155c081eea..41c2b0ae4d0 100644 --- a/test/hotspot/jtreg/vmTestbase/vm/gc/compact/Humongous_InternedStrings/TestDescription.java +++ b/test/hotspot/jtreg/vmTestbase/vm/gc/compact/Humongous_InternedStrings/TestDescription.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2017, 2025, 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 @@ -34,9 +34,11 @@ * This testcase uses interned strings for both first and second phases * and multiple threads. * + * @requires os.maxMemory > 3G * @library /vmTestbase * /test/lib * @run main/othervm + * -Xmx2G * -XX:-UseGCOverheadLimit * vm.gc.compact.Compact * -gp interned(randomString) diff --git a/test/jdk/ProblemList.txt b/test/jdk/ProblemList.txt index 8c0e0bccde0..382ce443813 100644 --- a/test/jdk/ProblemList.txt +++ b/test/jdk/ProblemList.txt @@ -592,8 +592,6 @@ java/net/MulticastSocket/SetLoopbackMode.java 7122846,8308807 java/net/MulticastSocket/SetOutgoingIf.java 8308807 aix-ppc64 java/net/MulticastSocket/Test.java 7145658,8308807 macosx-all,aix-ppc64 -java/net/Socket/asyncClose/Race.java 8317801 aix-ppc64 - ############################################################################ # jdk_nio @@ -834,9 +832,12 @@ java/awt/Checkbox/CheckboxNullLabelTest.java 8340870 windows-all java/awt/dnd/WinMoveFileToShellTest.java 8341665 windows-all java/awt/Menu/MenuVisibilityTest.java 8161110 macosx-all java/awt/Modal/NativeDialogToFrontBackTest.java 7188049 windows-all,linux-all +java/awt/Cursor/CursorDragTest/ListDragCursor.java 7177297 macosx-all ############################################################################ # jdk_since_checks tools/sincechecker/modules/java.base/JavaBaseCheckSince.java 8358627 generic-all +tools/sincechecker/modules/jdk.management.jfr/JdkManagementJfrCheckSince.java 8354921 generic-all + diff --git a/test/jdk/TEST.ROOT b/test/jdk/TEST.ROOT index 97efc340019..0fa78bebc3f 100644 --- a/test/jdk/TEST.ROOT +++ b/test/jdk/TEST.ROOT @@ -102,6 +102,8 @@ requires.properties= \ vm.cds.write.archived.java.heap \ vm.continuations \ vm.musl \ + vm.asan \ + vm.ubsan \ vm.debug \ vm.hasSA \ vm.hasJFR \ diff --git a/test/jdk/build/AbsPathsInImage.java b/test/jdk/build/AbsPathsInImage.java index 7821b60670a..1aa7e59941e 100644 --- a/test/jdk/build/AbsPathsInImage.java +++ b/test/jdk/build/AbsPathsInImage.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2019, 2025, 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 @@ -40,6 +40,8 @@ * @bug 8226346 * @summary Check all output files for absolute path fragments * @requires !vm.debug + * @comment ASAN keeps the 'unwanted' paths in the binaries because of its build options + * @requires !vm.asan * @run main/othervm -Xmx900m AbsPathsInImage */ public class AbsPathsInImage { diff --git a/test/jdk/com/sun/jdi/EATests.java b/test/jdk/com/sun/jdi/EATests.java index b2a2cad49db..321855b4969 100644 --- a/test/jdk/com/sun/jdi/EATests.java +++ b/test/jdk/com/sun/jdi/EATests.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2020, 2024 SAP SE. All rights reserved. + * Copyright (c) 2020, 2025 SAP SE. 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 @@ -34,42 +34,6 @@ * @run build TestScaffold VMConnection TargetListener TargetAdapter jdk.test.whitebox.WhiteBox * @run driver jdk.test.lib.helpers.ClassFileInstaller jdk.test.whitebox.WhiteBox * @run compile -g EATests.java - * @run driver EATests - * -XX:+UnlockDiagnosticVMOptions - * -Xms256m -Xmx256m - * -Xbootclasspath/a:. - * -XX:CompileCommand=dontinline,*::dontinline_* - * -XX:+WhiteBoxAPI - * -Xbatch - * -XX:+DoEscapeAnalysis -XX:+EliminateAllocations -XX:+EliminateLocks -XX:+EliminateNestedLocks - * -XX:LockingMode=1 - * @run driver EATests - * -XX:+UnlockDiagnosticVMOptions - * -Xms256m -Xmx256m - * -Xbootclasspath/a:. - * -XX:CompileCommand=dontinline,*::dontinline_* - * -XX:+WhiteBoxAPI - * -Xbatch - * -XX:+DoEscapeAnalysis -XX:+EliminateAllocations -XX:-EliminateLocks -XX:+EliminateNestedLocks - * -XX:LockingMode=1 - * @run driver EATests - * -XX:+UnlockDiagnosticVMOptions - * -Xms256m -Xmx256m - * -Xbootclasspath/a:. - * -XX:CompileCommand=dontinline,*::dontinline_* - * -XX:+WhiteBoxAPI - * -Xbatch - * -XX:+DoEscapeAnalysis -XX:-EliminateAllocations -XX:+EliminateLocks -XX:+EliminateNestedLocks - * -XX:LockingMode=1 - * @run driver EATests - * -XX:+UnlockDiagnosticVMOptions - * -Xms256m -Xmx256m - * -Xbootclasspath/a:. - * -XX:CompileCommand=dontinline,*::dontinline_* - * -XX:+WhiteBoxAPI - * -Xbatch - * -XX:-DoEscapeAnalysis -XX:-EliminateAllocations -XX:+EliminateLocks -XX:+EliminateNestedLocks - * -XX:LockingMode=1 * * @run driver EATests * -XX:+UnlockDiagnosticVMOptions @@ -79,7 +43,6 @@ * -XX:+WhiteBoxAPI * -Xbatch * -XX:+DoEscapeAnalysis -XX:+EliminateAllocations -XX:+EliminateLocks -XX:+EliminateNestedLocks - * -XX:LockingMode=2 * @run driver EATests * -XX:+UnlockDiagnosticVMOptions * -Xms256m -Xmx256m @@ -88,7 +51,6 @@ * -XX:+WhiteBoxAPI * -Xbatch * -XX:+DoEscapeAnalysis -XX:+EliminateAllocations -XX:-EliminateLocks -XX:+EliminateNestedLocks - * -XX:LockingMode=2 * @run driver EATests * -XX:+UnlockDiagnosticVMOptions * -Xms256m -Xmx256m @@ -97,7 +59,6 @@ * -XX:+WhiteBoxAPI * -Xbatch * -XX:+DoEscapeAnalysis -XX:-EliminateAllocations -XX:+EliminateLocks -XX:+EliminateNestedLocks - * -XX:LockingMode=2 * @run driver EATests * -XX:+UnlockDiagnosticVMOptions * -Xms256m -Xmx256m @@ -106,7 +67,6 @@ * -XX:+WhiteBoxAPI * -Xbatch * -XX:-DoEscapeAnalysis -XX:-EliminateAllocations -XX:+EliminateLocks -XX:+EliminateNestedLocks - * -XX:LockingMode=2 * * @comment Excercise -XX:+DeoptimizeObjectsALot. Mostly to prevent bit-rot because the option is meant to stress object deoptimization * with non-synthetic workloads. @@ -124,16 +84,6 @@ * @comment Regression test for using the wrong thread when logging during re-locking from deoptimization. * * @comment DiagnoseSyncOnValueBasedClasses=2 will cause logging when locking on \@ValueBased objects. - * @run driver EATests - * -XX:+UnlockDiagnosticVMOptions - * -Xms256m -Xmx256m - * -Xbootclasspath/a:. - * -XX:CompileCommand=dontinline,*::dontinline_* - * -XX:+WhiteBoxAPI - * -Xbatch - * -XX:+DoEscapeAnalysis -XX:+EliminateAllocations -XX:+EliminateLocks -XX:+EliminateNestedLocks - * -XX:LockingMode=1 - * -XX:DiagnoseSyncOnValueBasedClasses=2 * * @comment Re-lock may inflate monitors when re-locking, which cause monitorinflation trace logging. * @run driver EATests @@ -144,23 +94,10 @@ * -XX:+WhiteBoxAPI * -Xbatch * -XX:+DoEscapeAnalysis -XX:+EliminateAllocations -XX:+EliminateLocks -XX:+EliminateNestedLocks - * -XX:LockingMode=2 * -Xlog:monitorinflation=trace:file=monitorinflation.log * - * @comment Re-lock may race with deflation. - * @run driver EATests - * -XX:+UnlockDiagnosticVMOptions - * -Xms256m -Xmx256m - * -Xbootclasspath/a:. - * -XX:CompileCommand=dontinline,*::dontinline_* - * -XX:+WhiteBoxAPI - * -Xbatch - * -XX:+DoEscapeAnalysis -XX:+EliminateAllocations -XX:+EliminateLocks -XX:+EliminateNestedLocks - * -XX:LockingMode=0 - * -XX:GuaranteedAsyncDeflationInterval=1000 - * * @bug 8341819 - * @comment Regression test for re-locking racing with deflation with LM_LIGHTWEIGHT. + * @comment Regression test for re-locking racing with deflation with lightweight locking. * @run driver EATests * -XX:+UnlockDiagnosticVMOptions * -Xms256m -Xmx256m @@ -169,7 +106,6 @@ * -XX:+WhiteBoxAPI * -Xbatch * -XX:+DoEscapeAnalysis -XX:+EliminateAllocations -XX:+EliminateLocks -XX:+EliminateNestedLocks - * -XX:LockingMode=2 * -XX:GuaranteedAsyncDeflationInterval=1 */ @@ -1815,8 +1751,8 @@ public void dontinline_testMethod() { /** * Like {@link EARelockingSimple}. The difference is that there are many * lightweight locked objects when the relocking is done. With - * -XX:LockingMode=2 the lock stack of the thread will be full - * because of this. + * lightweight the lock stack of the thread will be full because of + * this. */ class EARelockingWithManyLightweightLocks extends EATestCaseBaseDebugger { diff --git a/test/jdk/com/sun/jdi/MultiBreakpointsTest.java b/test/jdk/com/sun/jdi/MultiBreakpointsTest.java index 6304aef96b9..bdbe36e7860 100644 --- a/test/jdk/com/sun/jdi/MultiBreakpointsTest.java +++ b/test/jdk/com/sun/jdi/MultiBreakpointsTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2025, 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 @@ -50,13 +50,8 @@ import com.sun.jdi.event.*; import com.sun.jdi.request.*; -import java.util.*; - /********** target program **********/ -import java.io.*; -import java.text.*; - class MultiBreakpointsTarg { MultiBreakpointsTarg(int numThreads, int numHits) { @@ -136,66 +131,57 @@ void bkpt28() {} void bkpt29() {} Thread console(final int num, final int nhits) { - final InputStreamReader isr = new InputStreamReader(System.in); - final BufferedReader br = new BufferedReader(isr); - // Create the threads // //final String threadName = "DebuggeeThread: " + num; final String threadName = "" + num; Thread thrd = DebuggeeWrapper.newThread(() -> { - synchronized( isr ) { - boolean done = false; - try { - // For each thread, run until numHits bkpts have been hit - for( int i = 0; i < nhits; i++ ) { - // This is a tendril from the original jdb test. - // It could probably be deleted. - System.out.println("Thread " + threadName + " Enter a string: "); - String s = "test" + num; - switch (num) { - case 0: bkpt0(); break; - case 1: bkpt1(); break; - case 2: bkpt2(); break; - case 3: bkpt3(); break; - case 4: bkpt4(); break; - case 5: bkpt5(); break; - case 6: bkpt6(); break; - case 7: bkpt7(); break; - case 8: bkpt8(); break; - case 9: bkpt9(); break; - case 10: bkpt10(); break; - case 11: bkpt11(); break; - case 12: bkpt12(); break; - case 13: bkpt13(); break; - case 14: bkpt14(); break; - case 15: bkpt15(); break; - case 16: bkpt16(); break; - case 17: bkpt17(); break; - case 18: bkpt18(); break; - case 19: bkpt19(); break; - case 20: bkpt20(); break; - case 21: bkpt21(); break; - case 22: bkpt22(); break; - case 23: bkpt23(); break; - case 24: bkpt24(); break; - case 25: bkpt25(); break; - case 26: bkpt26(); break; - case 27: bkpt27(); break; - case 28: bkpt28(); break; - case 29: bkpt29(); break; - } - System.out.println("Thread " + threadName + " You entered : " + s); - - if( s.compareTo( "quit" ) == 0 ) - done = true; - } - } catch(Exception e) { - System.out.println("WOOPS"); - } + try { + // For each thread, run until numHits bkpts have been hit + for( int i = 0; i < nhits; i++ ) { + // This is a tendril from the original jdb test. + // It could probably be deleted. + System.out.println("Thread " + threadName + " Enter a string: "); + String s = "test" + num; + switch (num) { + case 0: bkpt0(); break; + case 1: bkpt1(); break; + case 2: bkpt2(); break; + case 3: bkpt3(); break; + case 4: bkpt4(); break; + case 5: bkpt5(); break; + case 6: bkpt6(); break; + case 7: bkpt7(); break; + case 8: bkpt8(); break; + case 9: bkpt9(); break; + case 10: bkpt10(); break; + case 11: bkpt11(); break; + case 12: bkpt12(); break; + case 13: bkpt13(); break; + case 14: bkpt14(); break; + case 15: bkpt15(); break; + case 16: bkpt16(); break; + case 17: bkpt17(); break; + case 18: bkpt18(); break; + case 19: bkpt19(); break; + case 20: bkpt20(); break; + case 21: bkpt21(); break; + case 22: bkpt22(); break; + case 23: bkpt23(); break; + case 24: bkpt24(); break; + case 25: bkpt25(); break; + case 26: bkpt26(); break; + case 27: bkpt27(); break; + case 28: bkpt28(); break; + case 29: bkpt29(); break; } + System.out.println("Thread " + threadName + " You entered : " + s); + } - ); + } catch (Exception e) { + System.out.println("WOOPS"); + } + }); thrd.setName(threadName); thrd.setPriority(Thread.MAX_PRIORITY-1); thrd.start(); diff --git a/test/jdk/com/sun/nio/sctp/SctpChannel/CloseDescriptors.java b/test/jdk/com/sun/nio/sctp/SctpChannel/CloseDescriptors.java index c8ed8a881f6..0b3ce6ae039 100644 --- a/test/jdk/com/sun/nio/sctp/SctpChannel/CloseDescriptors.java +++ b/test/jdk/com/sun/nio/sctp/SctpChannel/CloseDescriptors.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2021, 2025, 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 @@ -26,6 +26,8 @@ * @bug 8238274 * @summary Potential leak file descriptor for SCTP * @requires (os.family == "linux") + * @library /test/lib + * @build jtreg.SkippedException * @run main/othervm/timeout=250 CloseDescriptors */ @@ -52,9 +54,7 @@ public class CloseDescriptors { public static void main(String[] args) throws Exception { if (!Util.isSCTPSupported()) { - System.out.println("SCTP protocol is not supported"); - System.out.println("Test cannot be run"); - return; + throw new jtreg.SkippedException("SCTP protocol is not supported"); } List lsofDirs = List.of("/usr/bin", "/usr/sbin"); @@ -63,9 +63,7 @@ public static void main(String[] args) throws Exception { .filter(f -> Files.isExecutable(f)) .findFirst(); if (!lsof.isPresent()) { - System.out.println("Cannot locate lsof in " + lsofDirs); - System.out.println("Test cannot be run"); - return; + throw new jtreg.SkippedException("Cannot locate lsof in " + lsofDirs); } try (ServerSocket ss = new ServerSocket(0)) { diff --git a/test/jdk/com/sun/security/sasl/ClientCallbackHandler.java b/test/jdk/com/sun/security/sasl/ClientCallbackHandler.java index 33a4be4823a..23ee550a2a7 100644 --- a/test/jdk/com/sun/security/sasl/ClientCallbackHandler.java +++ b/test/jdk/com/sun/security/sasl/ClientCallbackHandler.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2025, 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 @@ -130,6 +130,6 @@ public void handle(Callback[] callbacks) throws UnsupportedCallbackException, /* Reads a line of input */ private String readLine() throws IOException { return new BufferedReader - (new InputStreamReader(System.in)).readLine(); + (new InputStreamReader(System.in, System.getProperty("stdin.encoding"))).readLine(); } } diff --git a/test/jdk/com/sun/security/sasl/digest/ClientCallbackHandler.java b/test/jdk/com/sun/security/sasl/digest/ClientCallbackHandler.java index 33a4be4823a..23ee550a2a7 100644 --- a/test/jdk/com/sun/security/sasl/digest/ClientCallbackHandler.java +++ b/test/jdk/com/sun/security/sasl/digest/ClientCallbackHandler.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2025, 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 @@ -130,6 +130,6 @@ public void handle(Callback[] callbacks) throws UnsupportedCallbackException, /* Reads a line of input */ private String readLine() throws IOException { return new BufferedReader - (new InputStreamReader(System.in)).readLine(); + (new InputStreamReader(System.in, System.getProperty("stdin.encoding"))).readLine(); } } diff --git a/test/jdk/java/awt/Cursor/CursorDragTest/ListDragCursor.java b/test/jdk/java/awt/Cursor/CursorDragTest/ListDragCursor.java index 32923f1d78b..da0394a1392 100644 --- a/test/jdk/java/awt/Cursor/CursorDragTest/ListDragCursor.java +++ b/test/jdk/java/awt/Cursor/CursorDragTest/ListDragCursor.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2025, 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 @@ -25,42 +25,60 @@ * @test * @bug 4313052 * @summary Test cursor changes after mouse dragging ends - * @library /java/awt/regtesthelpers - * @build PassFailJFrame * @run main/manual ListDragCursor */ +import java.awt.BorderLayout; +import java.awt.Button; import java.awt.Cursor; +import java.awt.EventQueue; import java.awt.Frame; import java.awt.List; import java.awt.Panel; import java.awt.TextArea; +import java.util.concurrent.CountDownLatch; +import java.util.concurrent.TimeUnit; public class ListDragCursor { - public static void main(String[] args) throws Exception { - String INSTRUCTIONS = """ + private static final String INSTRUCTIONS = """ 1. Move mouse to the TextArea. 2. Press the left mouse button. 3. Drag mouse to the list. 4. Release the left mouse button. - If the mouse cursor starts as a Text Line Cursor and changes - to a regular Pointer Cursor, then Hand Cursor when hovering - the list, pass the test. This test fails if the cursor does - not update at all when pointing over the different components. + The mouse cursor should appear as an I-beam cursor + and should stay the same while dragging across the + components. Once you reach the list, release the + left mouse button. As soon as you release the left + mouse button, the cursor should change to a Hand + cursor. If true, this test passes. + + The test fails if the cursor updates while dragging + over the components before releasing the left + mouse button. """; - PassFailJFrame.builder() - .title("Test Instructions") - .instructions(INSTRUCTIONS) - .rows((int) INSTRUCTIONS.lines().count() + 2) - .columns(35) - .testUI(ListDragCursor::createUI) - .build() - .awaitAndCheck(); + private static Frame testFrame; + private static Frame instructionsFrame; + + private static final CountDownLatch countDownLatch = new CountDownLatch(1); + + public static void main(String[] args) throws Exception { + try { + EventQueue.invokeAndWait(() -> { + instructionsFrame = createInstructionsFrame(); + testFrame = createTestFrame(); + }); + if (!countDownLatch.await(5, TimeUnit.MINUTES)) { + throw new RuntimeException("Test timeout : No action was" + + " taken on the test."); + } + } finally { + EventQueue.invokeAndWait(ListDragCursor::disposeFrames); + } } - public static Frame createUI() { + static Frame createTestFrame() { Frame frame = new Frame("Cursor change after drag"); Panel panel = new Panel(); @@ -78,7 +96,51 @@ public static Frame createUI() { panel.add(list); frame.add(panel); - frame.setBounds(300, 100, 300, 150); + frame.setSize(300, 150); + frame.setLocation(instructionsFrame.getX() + + instructionsFrame.getWidth(), + instructionsFrame.getY()); + frame.setVisible(true); + return frame; + } + + static Frame createInstructionsFrame() { + Frame frame = new Frame("Test Instructions"); + Panel mainPanel = new Panel(new BorderLayout()); + TextArea textArea = new TextArea(INSTRUCTIONS, + 15, 35, TextArea.SCROLLBARS_NONE); + + Panel btnPanel = new Panel(); + Button passBtn = new Button("Pass"); + Button failBtn = new Button("Fail"); + btnPanel.add(passBtn); + btnPanel.add(failBtn); + + passBtn.addActionListener(e -> { + countDownLatch.countDown(); + System.out.println("Test passed."); + }); + failBtn.addActionListener(e -> { + countDownLatch.countDown(); + throw new RuntimeException("Test Failed."); + }); + + mainPanel.add(textArea, BorderLayout.CENTER); + mainPanel.add(btnPanel, BorderLayout.SOUTH); + + frame.add(mainPanel); + frame.pack(); + frame.setLocationRelativeTo(null); + frame.setVisible(true); return frame; } + + static void disposeFrames() { + if (testFrame != null) { + testFrame.dispose(); + } + if (instructionsFrame != null) { + instructionsFrame.dispose(); + } + } } diff --git a/test/jdk/java/awt/Frame/MultiScreenTest.java b/test/jdk/java/awt/Frame/MultiScreenTest.java index 845f601138b..cbd781f94dd 100644 --- a/test/jdk/java/awt/Frame/MultiScreenTest.java +++ b/test/jdk/java/awt/Frame/MultiScreenTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2025, 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 @@ -43,6 +43,7 @@ import java.awt.RenderingHints; import java.awt.TextField; +import java.awt.Window; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; @@ -74,7 +75,7 @@ public static void main(String[] args) throws Exception { ge = GraphicsEnvironment.getLocalGraphicsEnvironment(); gs = ge.getScreenDevices(); if (gs.length < 2) { - throw new SkippedException("You have only one monitor in your system - test passed"); + throw new SkippedException("You have only one monitor in your system"); } MultiScreenTest obj = new MultiScreenTest(); String INSTRUCTIONS = @@ -82,38 +83,42 @@ public static void main(String[] args) throws Exception { "You have " + gs.length + " monitors in your system.\n" + "Actively drag the DitherTest frames on the secondary screen and " + "if you see garbage appearing on your primary screen " + - "test failed otherwise it passed.";; + "test failed otherwise it passed."; PassFailJFrame.builder() - .title("MultiScreenTest Instruction") .instructions(INSTRUCTIONS) - .rows((int) INSTRUCTIONS.lines().count() + 2) .columns(40) .testUI(obj::init) + .positionTestUI(MultiScreenTest::positionTestWindows) .build() .awaitAndCheck(); } + private static void positionTestWindows(List windows, PassFailJFrame.InstructionUI instructionUI) { + // Do nothing - the location of each window is set when they're created + } + public List init() { List list = new ArrayList<>(); for (int j = 0; j < gs.length; j++) { GraphicsConfiguration[] gc = gs[j].getConfigurations(); if (gc.length > 0) { - for (int i = 0; i < gc.length / 2; i++) { - JFrame f = new JFrame(gc[i]); //test JFrame( gc ) - GCCanvas c = new GCCanvas(gc[i]);//test canvas( gc ) - Rectangle gcBounds = gc[i].getBounds(); //test getBounds() + for (int i = 0; i < gc.length && i < 10; i++) { + JFrame f = new JFrame(gc[i]); + GCCanvas c = new GCCanvas(gc[i]); + Rectangle gcBounds = gc[i].getBounds(); int xoffs = gcBounds.x; int yoffs = gcBounds.y; f.getContentPane().add(c); - f.setTitle("Screen# " + Integer.toString(j) + ", GC#" + Integer.toString(i)); + f.setTitle("Screen# " + j + ", GC#" + i); f.setSize(300, 200); - f.setLocation(400 + xoffs, (i * 150) + yoffs);//test displaying in right location + // test displaying in right location + f.setLocation(400 + xoffs, (i * 150) + yoffs); list.add(f); - Frame ditherfs = new Frame("DitherTest GC#" + Integer.toString(i), gc[i]); - ditherfs.setLayout(new BorderLayout()); //showDitherTest + Frame ditherfs = new Frame("DitherTest GC#" + i, gc[i]); + ditherfs.setLayout(new BorderLayout()); DitherTest ditherTest = new DitherTest(gc[i]); ditherfs.add("Center", ditherTest); ditherfs.setBounds(300, 200, 300, 200); @@ -126,360 +131,368 @@ public List init() { } return list; } -} - -class GCCanvas extends Canvas { - - GraphicsConfiguration gc; - Rectangle bounds; - Graphics g = this.getGraphics(); - Dimension size = getSize(); - - public GCCanvas(GraphicsConfiguration gc) { - super(gc); - this.gc = gc; - bounds = gc.getBounds(); - } - - public void paint( Graphics _g ) { - Graphics2D g = (Graphics2D) _g; - g.drawRect(0, 0, size.width-1, size.height-1); - g.setColor(Color.lightGray); - g.draw3DRect(1, 1, size.width-3, size.height-3, true); + static class GCCanvas extends Canvas { - g.setColor(Color.red); - g.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); + GraphicsConfiguration gc; + Rectangle bounds; + Dimension size = getSize(); - g.drawString("HELLO!", 110, 10); + public GCCanvas(GraphicsConfiguration gc) { + super(gc); + this.gc = gc; + bounds = gc.getBounds(); + } - g.setColor(Color.blue); - g.drawString("ScreenSize="+Integer.toString(bounds.width)+"X"+ - Integer.toString(bounds.height), 10, 20); - g.setColor(Color.green); - g.drawString(gc.toString(), 10, 30); - g.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_OFF); + @Override + public void paint( Graphics _g ) { - g.setColor(Color.orange); - g.fillRect(40, 20, 50, 50); + Graphics2D g = (Graphics2D) _g; - g.setColor(Color.red); - g.drawRect(100, 20, 30, 30); + g.drawRect(0, 0, size.width-1, size.height-1); + g.setColor(Color.lightGray); + g.draw3DRect(1, 1, size.width-3, size.height-3, true); - g.setColor(Color.gray); - g.drawLine(220, 20, 280, 40); + g.setColor(Color.red); + g.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); - g.setColor(Color.cyan); - g.fillArc(150, 30, 30, 30, 0, 200); - } + g.drawString("HELLO!", 110, 10); - public Dimension getPreferredSize(){ - return new Dimension(300, 200); - } -} + g.setColor(Color.blue); + g.drawString("ScreenSize="+Integer.toString(bounds.width)+"X"+ + Integer.toString(bounds.height), 10, 20); + g.setColor(Color.green); + g.drawString(gc.toString(), 10, 30); + g.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_OFF); -class DitherCanvas extends Canvas { - Image img; - static String calcString = "Calculating..."; + g.setColor(Color.orange); + g.fillRect(40, 20, 50, 50); - GraphicsConfiguration mGC; + g.setColor(Color.red); + g.drawRect(100, 20, 30, 30); - public DitherCanvas(GraphicsConfiguration gc) { - super(gc); - mGC = gc; - } + g.setColor(Color.gray); + g.drawLine(220, 20, 280, 40); - public GraphicsConfiguration getGraphicsConfig() { - return mGC; - } + g.setColor(Color.cyan); + g.fillArc(150, 30, 30, 30, 0, 200); + } - public void paint(Graphics g) { - int w = getSize().width; - int h = getSize().height; - if (img == null) { - super.paint(g); - g.setColor(Color.black); - FontMetrics fm = g.getFontMetrics(); - int x = (w - fm.stringWidth(calcString)) / 2; - int y = h / 2; - g.drawString(calcString, x, y); - } else { - g.drawImage(img, 0, 0, w, h, this); + @Override + public Dimension getPreferredSize(){ + return new Dimension(300, 200); } } - public void update(Graphics g) { - paint(g); - } + static class DitherCanvas extends Canvas { + Image img; + static String calcString = "Calculating..."; - public Dimension getMinimumSize() { - return new Dimension(20, 20); - } + GraphicsConfiguration mGC; - public Dimension getPreferredSize() { - return new Dimension(200, 200); - } + public DitherCanvas(GraphicsConfiguration gc) { + super(gc); + mGC = gc; + } - public Image getImage() { - return img; - } + public GraphicsConfiguration getGraphicsConfig() { + return mGC; + } - public void setImage(Image img) { - this.img = img; - paint(getGraphics()); - } -} + @Override + public void paint(Graphics g) { + int w = getSize().width; + int h = getSize().height; + if (img == null) { + super.paint(g); + g.setColor(Color.black); + FontMetrics fm = g.getFontMetrics(); + int x = (w - fm.stringWidth(calcString)) / 2; + int y = h / 2; + g.drawString(calcString, x, y); + } else { + g.drawImage(img, 0, 0, w, h, this); + } + } -class DitherTest extends Panel implements Runnable { - final static int NOOP = 0; - final static int RED = 1; - final static int GREEN = 2; - final static int BLUE = 3; - final static int ALPHA = 4; - final static int SATURATION = 5; - - Thread runner; - - DitherControls XControls; - DitherControls YControls; - DitherCanvas canvas; - - public DitherTest(GraphicsConfiguration gc) { - String xspec, yspec; - int xvals[] = new int[2]; - int yvals[] = new int[2]; - - xspec = "red"; - yspec = "blue"; - int xmethod = colormethod(xspec, xvals); - int ymethod = colormethod(yspec, yvals); - - setLayout(new BorderLayout()); - XControls = new DitherControls(this, xvals[0], xvals[1], - xmethod, false); - YControls = new DitherControls(this, yvals[0], yvals[1], - ymethod, true); - YControls.addRenderButton(); - add("North", XControls); - add("South", YControls); - add("Center", canvas = new DitherCanvas(gc)); - } + @Override + public void update(Graphics g) { + paint(g); + } - public void start() { - runner = new Thread(this); - runner.start(); - } + @Override + public Dimension getMinimumSize() { + return new Dimension(20, 20); + } - int colormethod(String s, int vals[]) { - int method = NOOP; + @Override + public Dimension getPreferredSize() { + return new Dimension(200, 200); + } - if (s == null) { - s = ""; + public Image getImage() { + return img; } - String lower = s.toLowerCase(); - int len = 0; - if (lower.startsWith("red")) { - method = RED; - lower = lower.substring(3); - } else if (lower.startsWith("green")) { - method = GREEN; - lower = lower.substring(5); - } else if (lower.startsWith("blue")) { - method = BLUE; - lower = lower.substring(4); - } else if (lower.startsWith("alpha")) { - method = ALPHA; - lower = lower.substring(4); - } else if (lower.startsWith("saturation")) { - method = SATURATION; - lower = lower.substring(10); + public void setImage(Image img) { + this.img = img; + paint(getGraphics()); } + } - if (method == NOOP) { - vals[0] = 0; - vals[1] = 0; - return method; + static class DitherTest extends Panel implements Runnable { + final static int NOOP = 0; + final static int RED = 1; + final static int GREEN = 2; + final static int BLUE = 3; + final static int ALPHA = 4; + final static int SATURATION = 5; + + Thread runner; + + DitherControls XControls; + DitherControls YControls; + DitherCanvas canvas; + + public DitherTest(GraphicsConfiguration gc) { + String xspec, yspec; + int xvals[] = new int[2]; + int yvals[] = new int[2]; + + xspec = "red"; + yspec = "blue"; + int xmethod = colormethod(xspec, xvals); + int ymethod = colormethod(yspec, yvals); + + setLayout(new BorderLayout()); + XControls = new DitherControls(this, xvals[0], xvals[1], + xmethod, false); + YControls = new DitherControls(this, yvals[0], yvals[1], + ymethod, true); + YControls.addRenderButton(); + add("North", XControls); + add("South", YControls); + add("Center", canvas = new DitherCanvas(gc)); } - int begval = 0; - int endval = 255; + public void start() { + runner = new Thread(this); + runner.start(); + } - try { - int dash = lower.indexOf('-'); - if (dash < 0) { - begval = endval = Integer.parseInt(lower); - } else { - begval = Integer.parseInt(lower.substring(0, dash)); - endval = Integer.parseInt(lower.substring(dash + 1)); + int colormethod(String s, int vals[]) { + int method = NOOP; + + if (s == null) { + s = ""; } - } catch (Exception e) { - } - if (begval < 0) { - begval = 0; - } - if (endval < 0) { - endval = 0; - } - if (begval > 255) { - begval = 255; - } - if (endval > 255) { - endval = 255; - } + String lower = s.toLowerCase(); + int len = 0; + if (lower.startsWith("red")) { + method = RED; + lower = lower.substring(3); + } else if (lower.startsWith("green")) { + method = GREEN; + lower = lower.substring(5); + } else if (lower.startsWith("blue")) { + method = BLUE; + lower = lower.substring(4); + } else if (lower.startsWith("alpha")) { + method = ALPHA; + lower = lower.substring(4); + } else if (lower.startsWith("saturation")) { + method = SATURATION; + lower = lower.substring(10); + } - vals[0] = begval; - vals[1] = endval; + if (method == NOOP) { + vals[0] = 0; + vals[1] = 0; + return method; + } - return method; - } + int begval = 0; + int endval = 255; - void applymethod(int c[], int method, int step, int total, int vals[]) { - if (method == NOOP) - return; - int val = ((total < 2) - ? vals[0] - : vals[0] + ((vals[1] - vals[0]) * step / (total - 1))); - switch (method) { - case RED: - c[0] = val; - break; - case GREEN: - c[1] = val; - break; - case BLUE: - c[2] = val; - break; - case ALPHA: - c[3] = val; - break; - case SATURATION: - int max = Math.max(Math.max(c[0], c[1]), c[2]); - int min = max * (255 - val) / 255; - if (c[0] == 0) { - c[0] = min; - } - if (c[1] == 0) { - c[1] = min; - } - if (c[2] == 0) { - c[2] = min; + try { + int dash = lower.indexOf('-'); + if (dash < 0) { + begval = endval = Integer.parseInt(lower); + } else { + begval = Integer.parseInt(lower.substring(0, dash)); + endval = Integer.parseInt(lower.substring(dash + 1)); } - break; + } catch (Exception e) { + } + + if (begval < 0) { + begval = 0; + } + if (endval < 0) { + endval = 0; + } + if (begval > 255) { + begval = 255; + } + if (endval > 255) { + endval = 255; + } + + vals[0] = begval; + vals[1] = endval; + + return method; } - } - public void run() { - canvas.setImage(null); // Wipe previous image - Image img = calculateImage(); - synchronized (this) { - if (img != null && runner == Thread.currentThread()) { - canvas.setImage(img); + void applymethod(int c[], int method, int step, int total, int vals[]) { + if (method == NOOP) + return; + int val = ((total < 2) + ? vals[0] + : vals[0] + ((vals[1] - vals[0]) * step / (total - 1))); + switch (method) { + case RED: + c[0] = val; + break; + case GREEN: + c[1] = val; + break; + case BLUE: + c[2] = val; + break; + case ALPHA: + c[3] = val; + break; + case SATURATION: + int max = Math.max(Math.max(c[0], c[1]), c[2]); + int min = max * (255 - val) / 255; + if (c[0] == 0) { + c[0] = min; + } + if (c[1] == 0) { + c[1] = min; + } + if (c[2] == 0) { + c[2] = min; + } + break; } } - } - /** - * Calculates and returns the image. Halts the calculation and returns - * null if stopped during the calculation. - */ - Image calculateImage() { - Thread me = Thread.currentThread(); - - int width = canvas.getSize().width; - int height = canvas.getSize().height; - int xvals[] = new int[2]; - int yvals[] = new int[2]; - int xmethod = XControls.getParams(xvals); - int ymethod = YControls.getParams(yvals); - int pixels[] = new int[width * height]; - int c[] = new int[4]; - int index = 0; - - for (int j = 0; j < height; j++) { - for (int i = 0; i < width; i++) { - c[0] = c[1] = c[2] = 0; - c[3] = 255; - if (xmethod < ymethod) { - applymethod(c, xmethod, i, width, xvals); - applymethod(c, ymethod, j, height, yvals); - } else { - applymethod(c, ymethod, j, height, yvals); - applymethod(c, xmethod, i, width, xvals); + @Override + public void run() { + canvas.setImage(null); // Wipe previous image + Image img = calculateImage(); + synchronized (this) { + if (img != null && runner == Thread.currentThread()) { + canvas.setImage(img); } - pixels[index++] = ((c[3] << 24) | - (c[0] << 16) | - (c[1] << 8) | - (c[2] << 0)); - - } - // Poll once per row to see if we've been told to stop. - if (runner != me) { - return null; } } - return createImage(new MemoryImageSource(width, height, - ColorModel.getRGBdefault(), pixels, 0, width)); - } + /** + * Calculates and returns the image. Halts the calculation and returns + * null if stopped during the calculation. + */ + Image calculateImage() { + Thread me = Thread.currentThread(); + + int width = canvas.getSize().width; + int height = canvas.getSize().height; + int xvals[] = new int[2]; + int yvals[] = new int[2]; + int xmethod = XControls.getParams(xvals); + int ymethod = YControls.getParams(yvals); + int pixels[] = new int[width * height]; + int c[] = new int[4]; + int index = 0; + + for (int j = 0; j < height; j++) { + for (int i = 0; i < width; i++) { + c[0] = c[1] = c[2] = 0; + c[3] = 255; + if (xmethod < ymethod) { + applymethod(c, xmethod, i, width, xvals); + applymethod(c, ymethod, j, height, yvals); + } else { + applymethod(c, ymethod, j, height, yvals); + applymethod(c, xmethod, i, width, xvals); + } + pixels[index++] = ((c[3] << 24) | + (c[0] << 16) | + (c[1] << 8) | + (c[2] << 0)); - public String getInfo() { - return "An interactive demonstration of dithering."; - } + } + // Poll once per row to see if we've been told to stop. + if (runner != me) { + return null; + } + } - public String[][] getParameterInfo() { - String[][] info = { - {"xaxis", "{RED, GREEN, BLUE, PINK, ORANGE, MAGENTA, CYAN, WHITE, YELLOW, GRAY, DARKGRAY}", - "The color of the Y axis. Default is RED."}, - {"yaxis", "{RED, GREEN, BLUE, PINK, ORANGE, MAGENTA, CYAN, WHITE, YELLOW, GRAY, DARKGRAY}", - "The color of the X axis. Default is BLUE."} - }; - return info; - } -} + return createImage(new MemoryImageSource(width, height, + ColorModel.getRGBdefault(), pixels, 0, width)); + } -class DitherControls extends Panel implements ActionListener { - TextField start; - TextField end; - Button button; - Choice choice; - DitherTest dt; - - static LayoutManager dcLayout = new FlowLayout(FlowLayout.CENTER, 10, 5); - - public DitherControls(DitherTest app, int s, int e, int type, - boolean vertical) { - dt = app; - setLayout(dcLayout); - add(new Label(vertical ? "Vertical" : "Horizontal")); - add(choice = new Choice()); - choice.addItem("Noop"); - choice.addItem("Red"); - choice.addItem("Green"); - choice.addItem("Blue"); - choice.addItem("Alpha"); - choice.addItem("Saturation"); - choice.select(type); - add(start = new TextField(Integer.toString(s), 4)); - add(end = new TextField(Integer.toString(e), 4)); - } + public String getInfo() { + return "An interactive demonstration of dithering."; + } - public void addRenderButton() { - add(button = new Button("New Image")); - button.addActionListener(this); + public String[][] getParameterInfo() { + String[][] info = { + {"xaxis", "{RED, GREEN, BLUE, PINK, ORANGE, MAGENTA, CYAN, WHITE, YELLOW, GRAY, DARKGRAY}", + "The color of the Y axis. Default is RED."}, + {"yaxis", "{RED, GREEN, BLUE, PINK, ORANGE, MAGENTA, CYAN, WHITE, YELLOW, GRAY, DARKGRAY}", + "The color of the X axis. Default is BLUE."} + }; + return info; + } } - public int getParams(int vals[]) { - vals[0] = Integer.parseInt(start.getText()); - vals[1] = Integer.parseInt(end.getText()); - return choice.getSelectedIndex(); - } + static class DitherControls extends Panel implements ActionListener { + TextField start; + TextField end; + Button button; + Choice choice; + DitherTest dt; + + static LayoutManager dcLayout = new FlowLayout(FlowLayout.CENTER, 10, 5); + + public DitherControls(DitherTest app, int s, int e, int type, + boolean vertical) { + dt = app; + setLayout(dcLayout); + add(new Label(vertical ? "Vertical" : "Horizontal")); + add(choice = new Choice()); + choice.addItem("Noop"); + choice.addItem("Red"); + choice.addItem("Green"); + choice.addItem("Blue"); + choice.addItem("Alpha"); + choice.addItem("Saturation"); + choice.select(type); + add(start = new TextField(Integer.toString(s), 4)); + add(end = new TextField(Integer.toString(e), 4)); + } - public void actionPerformed(ActionEvent e) { - if (e.getSource() == button) { - dt.start(); + public void addRenderButton() { + add(button = new Button("New Image")); + button.addActionListener(this); + } + + public int getParams(int vals[]) { + vals[0] = Integer.parseInt(start.getText()); + vals[1] = Integer.parseInt(end.getText()); + return choice.getSelectedIndex(); + } + + @Override + public void actionPerformed(ActionEvent e) { + if (e.getSource() == button) { + dt.start(); + } } } } diff --git a/test/jdk/java/net/MulticastSocket/SetTTLAndGetTTL.java b/test/jdk/java/awt/Headless/HeadlessExceptionTest.java similarity index 52% rename from test/jdk/java/net/MulticastSocket/SetTTLAndGetTTL.java rename to test/jdk/java/awt/Headless/HeadlessExceptionTest.java index ba07dc57dfd..c33f25ed934 100644 --- a/test/jdk/java/net/MulticastSocket/SetTTLAndGetTTL.java +++ b/test/jdk/java/awt/Headless/HeadlessExceptionTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1998, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2025, 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 @@ -21,28 +21,29 @@ * questions. */ -/* @test - * @bug 4189640 - * @summary Make setTTL/getTTL works - * @run main SetTTLAndGetTTL - */ - -import java.net.*; +import java.awt.HeadlessException; -public class SetTTLAndGetTTL { +/* + * @test 8358526 + * @summary Verify behaviour of no-args HeadlessException and getMessage + * @run main/othervm -Djava.awt.headless=true HeadlessExceptionTest + * @run main/othervm HeadlessExceptionTest + */ - public static void main(String args[]) throws Exception { - MulticastSocket soc = null; +public class HeadlessExceptionTest { - try { - soc = new MulticastSocket(); - } catch(Exception e) { - throw new Exception("Unexpected Exception"); + public static void main (String[] args) { + String nullmsg = new HeadlessException().getMessage(); + String emptymsg = new HeadlessException("").getMessage(); + System.out.println("nullmsg=" + nullmsg); + System.out.println("emptymsg=" + emptymsg); + if (nullmsg != null) { + if ("".equals(nullmsg)) { + throw new RuntimeException("empty message instead of null"); + } + if (!nullmsg.equals(emptymsg)) { + throw new RuntimeException("non-null messages differ"); + } } - - soc.setTTL((byte)200); - byte ttlValue = soc.getTTL(); - if (ttlValue != (byte)200) - throw new Exception("setTTL/getTTL is broken"); } } diff --git a/test/jdk/java/awt/MenuItem/SetLabelTest.java b/test/jdk/java/awt/MenuItem/SetLabelTest.java index f8a506ed7e4..154fb0d4987 100644 --- a/test/jdk/java/awt/MenuItem/SetLabelTest.java +++ b/test/jdk/java/awt/MenuItem/SetLabelTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2023, 2025, 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 @@ -120,7 +120,7 @@ private void showPopup(MouseEvent e) { }); frame.setMenuBar(mb); frame.setSize(300, 200); - frame.setLocation(500,500); + frame.setLocationRelativeTo(null); frame.setVisible(true); } diff --git a/test/jdk/java/awt/TextField/SetEchoCharWordOpsTest.java b/test/jdk/java/awt/TextField/SetEchoCharWordOpsTest.java index 825c21fdc96..9116a4dff3b 100644 --- a/test/jdk/java/awt/TextField/SetEchoCharWordOpsTest.java +++ b/test/jdk/java/awt/TextField/SetEchoCharWordOpsTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2005, 2025, 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 @@ -30,7 +30,7 @@ /* * @test - * @bug 6191897 + * @bug 6191897 8354646 * @summary Verifies that ctrl+left/right does not move word-by-word in a TextField * with echo character set * @library /java/awt/regtesthelpers /test/lib diff --git a/test/jdk/java/awt/font/JNICheck/JNICheck.sh b/test/jdk/java/awt/font/JNICheck/JNICheck.sh index cc019e72d56..5464a5e3fc1 100644 --- a/test/jdk/java/awt/font/JNICheck/JNICheck.sh +++ b/test/jdk/java/awt/font/JNICheck/JNICheck.sh @@ -1,6 +1,6 @@ #!/bin/ksh -p # -# Copyright (c) 2015, 2020, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2015, 2025, 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 @@ -49,7 +49,7 @@ else fi $JAVA_HOME/bin/java ${TESTVMOPTS} \ - -cp "${CP}" -Xcheck:jni JNICheck | grep -v SIG | grep -v Signal | grep -v Handler | grep -v jsig | grep -v CallStatic > "${CP}"/log.txt + -cp "${CP}" -Xcheck:jni JNICheck | grep -v SIG | grep -v Signal | grep -v Handler | grep -v jsig > "${CP}"/log.txt # any messages logged may indicate a failure. if [ -s "${CP}"/log.txt ]; then diff --git a/test/jdk/java/awt/font/TextLayout/MyanmarTextTest.java b/test/jdk/java/awt/font/TextLayout/MyanmarTextTest.java index 32c748ce80f..20db89ff0c6 100644 --- a/test/jdk/java/awt/font/TextLayout/MyanmarTextTest.java +++ b/test/jdk/java/awt/font/TextLayout/MyanmarTextTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2019, 2025, 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 @@ -27,12 +27,15 @@ * @key headful * @summary Verifies that Myanmar script is rendered correctly: * two characters combined into one glyph + * @library /test/lib + * @build jtreg.SkippedException * @run main MyanmarTextTest */ import java.awt.Font; import java.awt.GraphicsEnvironment; import java.util.Arrays; +import java.util.List; import javax.swing.BorderFactory; import javax.swing.BoxLayout; import javax.swing.JFrame; @@ -45,12 +48,16 @@ import javax.swing.text.BadLocationException; import javax.swing.text.Position; +import jtreg.SkippedException; + public class MyanmarTextTest { private static final String TEXT = "\u1000\u103C"; - private static final String FONT_WINDOWS = "Myanmar Text"; - private static final String FONT_LINUX = "Padauk"; - private static final String FONT_MACOS = "Myanmar MN"; + private static final List FONT_CANDIDATES = + List.of("Myanmar MN", + "Padauk", + "Myanmar Text", + "Noto Sans Myanmar"); private static final String FONT_NAME = selectFontName(); @@ -61,12 +68,8 @@ public class MyanmarTextTest { public static void main(String[] args) throws Exception { if (FONT_NAME == null) { - System.err.println("Unsupported OS: exiting"); - return; - } - if (!fontExists()) { - System.err.println("Required font is not installed: " + FONT_NAME); - return; + throw new SkippedException("No suitable font found out of the list: " + + String.join(", ", FONT_CANDIDATES)); } try { @@ -130,22 +133,12 @@ private void checkPositions() { } private static String selectFontName() { - String osName = System.getProperty("os.name").toLowerCase(); - if (osName.contains("windows")) { - return FONT_WINDOWS; - } else if (osName.contains("linux")) { - return FONT_LINUX; - } else if (osName.contains("mac")) { - return FONT_MACOS; - } else { - return null; - } + return Arrays.stream(GraphicsEnvironment + .getLocalGraphicsEnvironment() + .getAvailableFontFamilyNames()) + .filter(FONT_CANDIDATES::contains) + .findFirst() + .orElse(null); } - private static boolean fontExists() { - String[] fontFamilyNames = GraphicsEnvironment - .getLocalGraphicsEnvironment() - .getAvailableFontFamilyNames(); - return Arrays.asList(fontFamilyNames).contains(FONT_NAME); - } } diff --git a/test/jdk/java/awt/print/Dialog/DialogType.java b/test/jdk/java/awt/print/Dialog/DialogType.java index 472b89e44f2..b8801583dd0 100644 --- a/test/jdk/java/awt/print/Dialog/DialogType.java +++ b/test/jdk/java/awt/print/Dialog/DialogType.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2007, 2025, 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 @@ -26,49 +26,63 @@ * @bug 6568874 * @key printer * @summary Verify the native dialog works with attribute sets. - * @run main/manual=yesno DialogType + * @library /java/awt/regtesthelpers /test/lib + * @build PassFailJFrame + * @run main/manual DialogType */ -import java.awt.print.*; -import javax.print.attribute.*; -import javax.print.attribute.standard.*; +import java.awt.print.PrinterJob; + +import javax.print.attribute.Attribute; +import javax.print.attribute.HashPrintRequestAttributeSet; +import javax.print.attribute.PrintRequestAttributeSet; +import javax.print.attribute.standard.DialogTypeSelection; + +import jtreg.SkippedException; public class DialogType { + private static PrinterJob job; + + private static final String INSTRUCTIONS = """ + Two print dialogs are shown in succession. + Click Cancel in the dialogs to close them. + + On macOS & on Windows, the first dialog is a native + dialog provided by the OS, the second dialog is + implemented in Swing, the dialogs differ in appearance. - static String[] instructions = { - "This test assumes and requires that you have a printer installed", - "It verifies that the dialogs behave properly when using new API", - "to optionally select a native dialog where one is present.", - "Two dialogs are shown in succession.", - "The test passes as long as no exceptions are thrown, *AND*", - "if running on Windows only, the first dialog is a native windows", - "control which differs in appearance from the second dialog", - "" - }; + The test passes as long as no exceptions are thrown. + (If there's an exception, the test will fail automatically.) - public static void main(String[] args) { + The test verifies that the dialogs behave properly when using new API + to optionally select a native dialog where one is present. + """; - for (int i=0;i IOE = IOException.class; static final Class EE = ExecutionException.class; + static final Class IAE = IllegalArgumentException.class; static final Class ISE = IllegalStateException.class; /** Tests that confined sessions are not supported. */ @@ -79,8 +80,8 @@ public void testWithConfined(Supplier arenaSupplier) var bb = segment.asByteBuffer(); var bba = new ByteBuffer[] { bb }; List> ioOps = List.of( - handler -> handler.propagateHandlerFromFuture(channel.write(bb)), - handler -> handler.propagateHandlerFromFuture(channel.read(bb)), + handler -> channel.write(bb), + handler -> channel.read(bb), handler -> channel.write(bb, null, handler), handler -> channel.read( bb, null, handler), handler -> channel.write(bb , 0L, SECONDS, null, handler), @@ -91,10 +92,7 @@ public void testWithConfined(Supplier arenaSupplier) for (var ioOp : ioOps) { out.println("testAsyncWithConfined - op"); var handler = new TestHandler(); - ioOp.accept(handler); - handler.await() - .assertFailedWith(ISE) - .assertExceptionMessage("Confined session not supported"); + expectThrows(IAE, () -> ioOp.accept(handler)); } } } diff --git a/test/jdk/java/io/File/GetXSpace.java b/test/jdk/java/io/File/GetXSpace.java index 246835d03db..e61880edb2c 100644 --- a/test/jdk/java/io/File/GetXSpace.java +++ b/test/jdk/java/io/File/GetXSpace.java @@ -176,11 +176,11 @@ private static void compare(Space s) { long fs = f.getFreeSpace(); long us = f.getUsableSpace(); - // Verify inequalities us <= fs <= ts (JDK-8349092) + // Verify inequalities us <= ts and fs <= ts (JDK-8349092) if (fs > ts) throw new RuntimeException(f + " free space " + fs + " > total space " + ts); - if (us > fs) - throw new RuntimeException(f + " usable space " + us + " > free space " + fs); + if (us > ts) + throw new RuntimeException(f + " usable space " + us + " > total space " + ts); out.format("%s (%d):%n", s.name(), s.size()); String fmt = " %-4s total = %12d free = %12d usable = %12d%n"; @@ -269,15 +269,9 @@ private static void compare(Space s) { pass(); } - // usable space <= free space - if (us > s.free()) { - // free and usable change dynamically - System.err.println("Warning: us > s.free()"); - if (1.0 - Math.abs((double)s.free()/(double)us) > 0.01) { - fail(s.name() + " usable vs. free space", us, ">", s.free()); - } else { - pass(); - } + // usable space <= total space + if (us > s.total()) { + fail(s.name() + " usable vs. total space", us, ">", s.total()); } else { pass(); } diff --git a/test/jdk/java/io/File/MaxPath.java b/test/jdk/java/io/File/MaxPath.java index 269b291709c..30951ac0d85 100644 --- a/test/jdk/java/io/File/MaxPath.java +++ b/test/jdk/java/io/File/MaxPath.java @@ -24,21 +24,14 @@ /* @test @bug 6481955 @summary Path length less than MAX_PATH (260) works on Windows - @library /test/lib + @requires (os.family == "windows") */ import java.io.File; import java.io.IOException; -import jtreg.SkippedException; - public class MaxPath { public static void main(String[] args) throws Exception { - String osName = System.getProperty("os.name"); - if (!osName.startsWith("Windows")) { - throw new SkippedException("This test is run only on Windows"); - } - int MAX_PATH = 260; String dir = new File(".").getAbsolutePath() + "\\"; String padding = "1234567890123456789012345678901234567890012345678900123456789001234567890012345678900123456789001234567890012345678900123456789001234567890012345678900123456789001234567890012345678900123456789001234567890012345678900123456789001234567890012345678900123456789001234567890012345678900123456789001234567890012345678900123456789001234567890"; diff --git a/test/jdk/java/io/File/SymLinks.java b/test/jdk/java/io/File/SymLinks.java index 967250c8430..40205a41557 100644 --- a/test/jdk/java/io/File/SymLinks.java +++ b/test/jdk/java/io/File/SymLinks.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2009, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2009, 2025, 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 @@ -281,22 +281,7 @@ static void go() throws IOException { assertTrue(link2dir.isDirectory()); assertTrue(link2link2dir.isDirectory()); - // on Windows we test with the DOS hidden attribute set - if (System.getProperty("os.name").startsWith("Windows")) { - DosFileAttributeView view = Files - .getFileAttributeView(file.toPath(), DosFileAttributeView.class); - view.setHidden(true); - try { - assertTrue(file.isHidden()); - assertTrue(link2file.isHidden()); - assertTrue(link2link2file.isHidden()); - } finally { - view.setHidden(false); - } - assertFalse(file.isHidden()); - assertFalse(link2file.isHidden()); - assertFalse(link2link2file.isHidden()); - } + testDOSHiddenAttributes(); header("length"); @@ -362,6 +347,26 @@ static void go() throws IOException { } } + static void testDOSHiddenAttributes() throws IOException { + // on Windows we test with the DOS hidden attribute set + if (System.getProperty("os.name").startsWith("Windows")) { + header("testDOSHiddenAttributes"); + DosFileAttributeView view = Files + .getFileAttributeView(file.toPath(), DosFileAttributeView.class); + view.setHidden(true); + try { + assertTrue(file.isHidden()); + assertTrue(link2file.isHidden()); + assertTrue(link2link2file.isHidden()); + } finally { + view.setHidden(false); + } + assertFalse(file.isHidden()); + assertFalse(link2file.isHidden()); + assertFalse(link2link2file.isHidden()); + } + } + public static void main(String[] args) throws IOException { if (supportsSymLinks(top)) { try { diff --git a/test/jdk/java/lang/ProcessBuilder/Basic.java b/test/jdk/java/lang/ProcessBuilder/Basic.java index ed9a0f9fb70..c06ecbdb871 100644 --- a/test/jdk/java/lang/ProcessBuilder/Basic.java +++ b/test/jdk/java/lang/ProcessBuilder/Basic.java @@ -337,7 +337,7 @@ public static void main(String args[]) throws Throwable { } else if (action.equals("testIO")) { String expected = "standard input"; char[] buf = new char[expected.length()+1]; - int n = new InputStreamReader(System.in).read(buf,0,buf.length); + int n = new InputStreamReader(System.in, System.getProperty("stdin.encoding")).read(buf,0,buf.length); if (n != expected.length()) System.exit(5); if (! new String(buf,0,n).equals(expected)) @@ -696,7 +696,7 @@ private static class TrueExe { public static String path() { return path; } private static final String path = path0(); private static String path0(){ - if (!Platform.isBusybox("/bin/true")) { + if (!Files.isSymbolicLink(Paths.get("/bin/true"))) { return "/bin/true"; } else { File trueExe = new File("true"); @@ -711,7 +711,7 @@ private static class FalseExe { public static String path() { return path; } private static final String path = path0(); private static String path0(){ - if (!Platform.isBusybox("/bin/false")) { + if (!Files.isSymbolicLink(Paths.get("/bin/false"))) { return "/bin/false"; } else { File falseExe = new File("false"); diff --git a/test/jdk/java/lang/ProcessBuilder/FDLeakTest/FDLeakTest.java b/test/jdk/java/lang/ProcessBuilder/FDLeakTest/FDLeakTest.java new file mode 100644 index 00000000000..146c2be563f --- /dev/null +++ b/test/jdk/java/lang/ProcessBuilder/FDLeakTest/FDLeakTest.java @@ -0,0 +1,72 @@ +/* + * Copyright (c) 2025, 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. + * + * 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. + */ + + +/** + * @test id=posix_spawn + * @summary Check that we don't leak FDs + * @requires os.family != "windows" + * @library /test/lib + * @run main/othervm/native -Djdk.lang.Process.launchMechanism=posix_spawn -agentlib:FDLeaker FDLeakTest + */ + +/** + * @test id=fork + * @summary Check that we don't leak FDs + * @requires os.family != "windows" + * @library /test/lib + * @run main/othervm/native -Djdk.lang.Process.launchMechanism=fork -agentlib:FDLeaker FDLeakTest + */ + +/** + * @test id=vfork + * @summary Check that we don't leak FDs + * @requires os.family == "linux" + * @library /test/lib + * @run main/othervm/native -Djdk.lang.Process.launchMechanism=vfork -agentlib:FDLeaker FDLeakTest + */ + +import jdk.test.lib.process.ProcessTools; +public class FDLeakTest { + // This test has two native parts: + // - a library invoked with -agentlib that ensures that, in the parent JVM, we open + // a native fd without setting FD_CLOEXEC (libFDLeaker.c). This is necessary because + // there is no way to do this from Java: if Java functions correctly, all files the + // user could open via its APIs should be marked with FD_CLOEXEC. + // - a small native executable that tests - without using /proc - whether any file + // descriptors other than stdin/out/err are open. + // + // What should happen: In the child process, between the initial fork and the exec of + // the target binary, we should close all filedescriptors that are not stdin/out/err. + // If that works, the child process should not see any other file descriptors save + // those three. + public static void main(String[] args) throws Exception { + ProcessBuilder pb = ProcessTools.createNativeTestProcessBuilder("FDLeakTester"); + pb.inheritIO(); + Process p = pb.start(); + p.waitFor(); + if (p.exitValue() != 0) { + throw new RuntimeException("Failed"); + } + } +} diff --git a/test/jdk/java/lang/ProcessBuilder/FDLeakTest/exeFDLeakTester.c b/test/jdk/java/lang/ProcessBuilder/FDLeakTest/exeFDLeakTester.c new file mode 100644 index 00000000000..b47228ee5de --- /dev/null +++ b/test/jdk/java/lang/ProcessBuilder/FDLeakTest/exeFDLeakTester.c @@ -0,0 +1,56 @@ +/* + * Copyright (c) 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. + * + * 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. + */ + +#include +#include +#include +#include +#include + +/* Check if any fd past stderr is valid; if true, print warning on stderr and return -1 + * + * Note: check without accessing /proc since: + * - non-portable + * - may cause creation of temporary file descriptors + */ +int main(int argc, char** argv) { + int errors = 0; + int rc = 0; + char buf[128]; + int max_fd = (int)sysconf(_SC_OPEN_MAX); + if (max_fd == -1) { + snprintf(buf, sizeof(buf), "*** sysconf(_SC_OPEN_MAX) failed? (%d) ***\n", errno); + rc = write(2, buf, strlen(buf)); + max_fd = 10000; + } + // We start after stderr fd + for (int fd = 3; fd < max_fd; fd++) { + if (fcntl(fd, F_GETFD, 0) >= 0) { + // Error: found valid file descriptor + errors++; + snprintf(buf, sizeof(buf), "*** Parent leaked file descriptor %d ***\n", fd); + rc = write(2, buf, strlen(buf)); + } + } + return errors > 0 ? -1 : 0; +} diff --git a/src/hotspot/os/linux/c2_globals_linux.hpp b/test/jdk/java/lang/ProcessBuilder/FDLeakTest/libFDLeaker.c similarity index 70% rename from src/hotspot/os/linux/c2_globals_linux.hpp rename to test/jdk/java/lang/ProcessBuilder/FDLeakTest/libFDLeaker.c index c6199253f3e..b3fa296cae2 100644 --- a/src/hotspot/os/linux/c2_globals_linux.hpp +++ b/test/jdk/java/lang/ProcessBuilder/FDLeakTest/libFDLeaker.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2019, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2025, 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 @@ -19,18 +19,18 @@ * 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. - * */ -#ifndef OS_LINUX_C2_GLOBALS_LINUX_HPP -#define OS_LINUX_C2_GLOBALS_LINUX_HPP - -#include "utilities/globalDefinitions.hpp" -#include "utilities/macros.hpp" - -// -// Sets the default values for operating system dependent flags used by the -// server compiler. (see c2_globals.hpp) -// +#include +#include "jvmti.h" -#endif // OS_LINUX_C2_GLOBALS_LINUX_HPP +JNIEXPORT jint JNICALL +Agent_OnLoad(JavaVM *jvm, char *options, void *reserved) { + const char* filename = "./testfile_FDLeaker.txt"; + FILE* f = fopen(filename, "w"); + if (f == NULL) { + return JNI_ERR; + } + printf("Opened and leaked %s (%d)", filename, fileno(f)); + return JNI_OK; +} diff --git a/test/jdk/java/lang/ProcessHandle/InfoTest.java b/test/jdk/java/lang/ProcessHandle/InfoTest.java index 66ac2df830b..38c86db3b91 100644 --- a/test/jdk/java/lang/ProcessHandle/InfoTest.java +++ b/test/jdk/java/lang/ProcessHandle/InfoTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2025, 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 @@ -295,10 +295,12 @@ public static void test3() { String expected = "sleep"; if (Platform.isWindows()) { expected = "sleep.exe"; - } else if (Platform.isBusybox("/bin/sleep")) { - // With busybox sleep is just a sym link to busybox. - // The busbox executable is seen as ProcessHandle.Info command. - expected = "busybox"; + } else if (Files.isSymbolicLink(Paths.get("/bin/sleep"))) { + // Busybox sleep is a symbolic link to /bin/busybox. + // Rust coreutils sleep is a symbolic link to coreutils + // The busbox/coreutils executables are seen as ProcessHandle.Info command. + Path executable = Files.readSymbolicLink(Paths.get("/bin/sleep")); + expected = executable.getFileName().toString(); } Assert.assertTrue(command.endsWith(expected), "Command: expected: \'" + expected + "\', actual: " + command); diff --git a/test/jdk/java/lang/System/OsVersionTest.java b/test/jdk/java/lang/System/OsVersionTest.java index d35f71453b1..9a1cb976db8 100644 --- a/test/jdk/java/lang/System/OsVersionTest.java +++ b/test/jdk/java/lang/System/OsVersionTest.java @@ -1,5 +1,6 @@ /* * Copyright (c) 2015, 2021 SAP SE. All rights reserved. + * Copyright (c) 2025, 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 @@ -28,56 +29,65 @@ /* * @test - * @bug 8132374 + * @bug 8132374 8359830 * @summary Check that the value of the os.version property is equal * to the value of the corresponding OS provided tools. * @library /test/lib + * @build jtreg.SkippedException * @run main OsVersionTest * @author Volker Simonis */ public class OsVersionTest { - public static void main(String args[]) throws Throwable { + public static void main(String[] args) throws Throwable { final String osVersion = System.getProperty("os.version"); if (osVersion == null) { - throw new Error("Cant query 'os.version' property!"); + throw new Error("Missing value for os.version system property"); } if (Platform.isLinux()) { OutputAnalyzer output = ProcessTools.executeProcess("uname", "-r"); + output.shouldHaveExitValue(0); if (!osVersion.equals(output.getOutput().trim())) { throw new Error(osVersion + " != " + output.getOutput().trim()); } - } - else if (Platform.isOSX()) { - OutputAnalyzer output = ProcessTools.executeProcess("sw_vers", "-productVersion"); - String swVersOutput = output.getOutput().trim(); - if (!osVersion.equals(swVersOutput)) { - // This section can be removed if minimum build SDK is xcode 12+ - if (swVersOutput.startsWith(osVersion)) { - throw new SkippedException("MacOS version only matches in parts, this is expected when " + - "JDK was built with Xcode < 12 and MacOS version patch is > 0"); - } - throw new Error(osVersion + " != " + swVersOutput); - } - } - else if (Platform.isAix()) { + } else if (Platform.isOSX()) { + testMacOS(osVersion); + } else if (Platform.isAix()) { OutputAnalyzer output1 = ProcessTools.executeProcess("uname", "-v"); + output1.shouldHaveExitValue(0); OutputAnalyzer output2 = ProcessTools.executeProcess("uname", "-r"); + output2.shouldHaveExitValue(0); String version = output1.getOutput().trim() + "." + output2.getOutput().trim(); if (!osVersion.equals(version)) { throw new Error(osVersion + " != " + version); } - } - else if (Platform.isWindows()) { + } else if (Platform.isWindows()) { OutputAnalyzer output = ProcessTools.executeProcess("cmd", "/c", "ver"); + output.shouldHaveExitValue(0); String version = output.firstMatch(".+\\[Version ([0-9.]+)\\]", 1); if (version == null || !version.startsWith(osVersion)) { throw new Error(osVersion + " != " + version); } - } - else { - System.out.println("This test is currently not supported on " + + } else { + throw new jtreg.SkippedException("This test is currently not supported on " + Platform.getOsName()); } } + + private static void testMacOS(final String sysPropOsVersion) throws Exception { + final ProcessBuilder pb = new ProcessBuilder("sw_vers", "-productVersion"); + // if the test was launched with SYSTEM_VERSION_COMPAT environment variable set, + // then propagate that to the sw_vers too + final String versionCompat = System.getenv().get("SYSTEM_VERSION_COMPAT"); + if (versionCompat != null) { + pb.environment().put("SYSTEM_VERSION_COMPAT", versionCompat); + } + final OutputAnalyzer output = ProcessTools.executeCommand(pb); + output.shouldHaveExitValue(0); + final String swVersOutput = output.getOutput().trim(); + if (!sysPropOsVersion.equals(swVersOutput)) { + throw new Error("sw_vers reports macOS version: " + swVersOutput + + " but os.version system property reports version: " + sysPropOsVersion); + } + } } diff --git a/test/jdk/java/lang/Thread/virtual/CarrierThreadInfo.java b/test/jdk/java/lang/Thread/virtual/CarrierThreadInfo.java index 75ef0376a7e..6260c8e9bda 100644 --- a/test/jdk/java/lang/Thread/virtual/CarrierThreadInfo.java +++ b/test/jdk/java/lang/Thread/virtual/CarrierThreadInfo.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2022, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2022, 2025, 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 @@ -31,30 +31,6 @@ * @run junit CarrierThreadInfo */ -/** - * @test id=LM_LIGHTWEIGHT - * @requires vm.continuations - * @modules java.base/java.lang:+open - * @library /test/lib - * @run junit/othervm -XX:LockingMode=2 CarrierThreadInfo - */ - -/** - * @test id=LM_LEGACY - * @requires vm.continuations - * @modules java.base/java.lang:+open - * @library /test/lib - * @run junit/othervm -XX:LockingMode=1 CarrierThreadInfo - */ - -/** - * @test id=LM_MONITOR - * @requires vm.continuations - * @modules java.base/java.lang:+open - * @library /test/lib - * @run junit/othervm -XX:LockingMode=0 CarrierThreadInfo - */ - import java.lang.management.LockInfo; import java.lang.management.ManagementFactory; import java.lang.management.ThreadInfo; diff --git a/test/jdk/java/lang/Thread/virtual/MiscMonitorTests.java b/test/jdk/java/lang/Thread/virtual/MiscMonitorTests.java index 1f909b214c2..b512aa75789 100644 --- a/test/jdk/java/lang/Thread/virtual/MiscMonitorTests.java +++ b/test/jdk/java/lang/Thread/virtual/MiscMonitorTests.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2024, 2025, 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 @@ -25,7 +25,7 @@ * @test id=default * @summary Tests for object monitors that have been useful to find bugs * @library /test/lib - * @requires vm.continuations & vm.opt.LockingMode != 1 + * @requires vm.continuations * @modules java.base/java.lang:+open * @run junit/othervm MiscMonitorTests */ @@ -33,7 +33,7 @@ /* * @test id=Xint * @library /test/lib - * @requires vm.continuations & vm.opt.LockingMode != 1 + * @requires vm.continuations * @modules java.base/java.lang:+open * @run junit/othervm -Xint MiscMonitorTests */ @@ -41,7 +41,7 @@ /* * @test id=Xcomp * @library /test/lib - * @requires vm.continuations & vm.opt.LockingMode != 1 + * @requires vm.continuations * @modules java.base/java.lang:+open * @run junit/othervm -Xcomp MiscMonitorTests */ @@ -49,7 +49,7 @@ /* * @test id=Xcomp-TieredStopAtLevel3 * @library /test/lib - * @requires vm.continuations & vm.opt.LockingMode != 1 + * @requires vm.continuations * @modules java.base/java.lang:+open * @run junit/othervm -Xcomp -XX:TieredStopAtLevel=3 MiscMonitorTests */ @@ -58,14 +58,14 @@ * @test id=Xcomp-noTieredCompilation * @summary Test virtual threads using synchronized * @library /test/lib - * @requires vm.continuations & vm.opt.LockingMode != 1 + * @requires vm.continuations * @modules java.base/java.lang:+open * @run junit/othervm -Xcomp -XX:-TieredCompilation MiscMonitorTests */ /* * @test id=gc - * @requires vm.debug == true & vm.continuations & vm.opt.LockingMode != 1 + * @requires vm.debug == true & vm.continuations * @library /test/lib * @modules java.base/java.lang:+open * @run junit/othervm -XX:+UnlockDiagnosticVMOptions -XX:+FullGCALot -XX:FullGCALotInterval=1000 MiscMonitorTests diff --git a/test/jdk/java/lang/Thread/virtual/MonitorEnterExit.java b/test/jdk/java/lang/Thread/virtual/MonitorEnterExit.java index 858f7625386..3a7eecd054e 100644 --- a/test/jdk/java/lang/Thread/virtual/MonitorEnterExit.java +++ b/test/jdk/java/lang/Thread/virtual/MonitorEnterExit.java @@ -26,88 +26,35 @@ * @summary Test virtual thread with monitor enter/exit * @modules java.base/java.lang:+open jdk.management * @library /test/lib - * @build LockingMode * @run junit/othervm/native --enable-native-access=ALL-UNNAMED MonitorEnterExit */ /* - * @test id=LM_LEGACY + * @test id=Xint * @modules java.base/java.lang:+open jdk.management * @library /test/lib - * @build LockingMode - * @run junit/othervm/native -XX:LockingMode=1 --enable-native-access=ALL-UNNAMED MonitorEnterExit + * @run junit/othervm/native -Xint --enable-native-access=ALL-UNNAMED MonitorEnterExit */ /* - * @test id=LM_LIGHTWEIGHT + * @test id=Xcomp * @modules java.base/java.lang:+open jdk.management * @library /test/lib - * @build LockingMode - * @run junit/othervm/native -XX:LockingMode=2 --enable-native-access=ALL-UNNAMED MonitorEnterExit + * @run junit/othervm/native -Xcomp --enable-native-access=ALL-UNNAMED MonitorEnterExit */ /* - * @test id=Xint-LM_LEGACY + * @test id=Xcomp-TieredStopAtLevel1 * @modules java.base/java.lang:+open jdk.management * @library /test/lib - * @build LockingMode - * @run junit/othervm/native -Xint -XX:LockingMode=1 --enable-native-access=ALL-UNNAMED MonitorEnterExit + * @run junit/othervm/native -Xcomp -XX:TieredStopAtLevel=1 --enable-native-access=ALL-UNNAMED MonitorEnterExit */ /* - * @test id=Xint-LM_LIGHTWEIGHT + * @test id=Xcomp-noTieredCompilation * @modules java.base/java.lang:+open jdk.management * @library /test/lib - * @build LockingMode - * @run junit/othervm/native -Xint -XX:LockingMode=2 --enable-native-access=ALL-UNNAMED MonitorEnterExit - */ - -/* - * @test id=Xcomp-LM_LEGACY - * @modules java.base/java.lang:+open jdk.management - * @library /test/lib - * @build LockingMode - * @run junit/othervm/native -Xcomp -XX:LockingMode=1 --enable-native-access=ALL-UNNAMED MonitorEnterExit - */ - -/* - * @test id=Xcomp-LM_LIGHTWEIGHT - * @modules java.base/java.lang:+open jdk.management - * @library /test/lib - * @build LockingMode - * @run junit/othervm/native -Xcomp -XX:LockingMode=2 --enable-native-access=ALL-UNNAMED MonitorEnterExit - */ - -/* - * @test id=Xcomp-TieredStopAtLevel1-LM_LEGACY - * @modules java.base/java.lang:+open jdk.management - * @library /test/lib - * @build LockingMode - * @run junit/othervm/native -Xcomp -XX:TieredStopAtLevel=1 -XX:LockingMode=1 --enable-native-access=ALL-UNNAMED MonitorEnterExit - */ - -/* - * @test id=Xcomp-TieredStopAtLevel1-LM_LIGHTWEIGHT - * @modules java.base/java.lang:+open jdk.management - * @library /test/lib - * @build LockingMode - * @run junit/othervm/native -Xcomp -XX:TieredStopAtLevel=1 -XX:LockingMode=2 --enable-native-access=ALL-UNNAMED MonitorEnterExit - */ - -/* - * @test id=Xcomp-noTieredCompilation-LM_LEGACY - * @modules java.base/java.lang:+open jdk.management - * @library /test/lib - * @build LockingMode - * @run junit/othervm/native -Xcomp -XX:-TieredCompilation -XX:LockingMode=1 --enable-native-access=ALL-UNNAMED MonitorEnterExit - */ - -/* - * @test id=Xcomp-noTieredCompilation-LM_LIGHTWEIGHT - * @modules java.base/java.lang:+open jdk.management - * @library /test/lib - * @build LockingMode - * @run junit/othervm/native -Xcomp -XX:-TieredCompilation -XX:LockingMode=2 --enable-native-access=ALL-UNNAMED MonitorEnterExit + * @run junit/othervm/native -Xcomp -XX:-TieredCompilation --enable-native-access=ALL-UNNAMED MonitorEnterExit */ import java.time.Duration; @@ -129,7 +76,6 @@ import org.junit.jupiter.api.Test; import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.api.RepeatedTest; -import org.junit.jupiter.api.condition.DisabledIf; import org.junit.jupiter.params.ParameterizedTest; import org.junit.jupiter.params.provider.Arguments; import org.junit.jupiter.params.provider.ValueSource; @@ -234,7 +180,6 @@ private void testReenter(Object lock, int depth) { * Test monitor reenter when there are other threads blocked trying to enter. */ @Test - @DisabledIf("LockingMode#isLegacy") void testReenterWithContention() throws Exception { var lock = new Object(); VThreadRunner.run(() -> { @@ -359,7 +304,6 @@ private void testEnterWithContentionWhenPinned() throws Exception { * Test that blocking waiting to enter a monitor releases the carrier. */ @Test - @DisabledIf("LockingMode#isLegacy") void testReleaseWhenBlocked() throws Exception { assumeTrue(VThreadScheduler.supportsCustomScheduler(), "No support for custom schedulers"); try (ExecutorService scheduler = Executors.newFixedThreadPool(1)) { @@ -403,7 +347,6 @@ void testReleaseWhenBlocked() throws Exception { * carriers aren't released. */ @Test - @DisabledIf("LockingMode#isLegacy") void testManyBlockedThreads() throws Exception { Thread[] vthreads = new Thread[MAX_VTHREAD_COUNT]; var lock = new Object(); diff --git a/test/jdk/java/lang/Thread/virtual/MonitorWaitNotify.java b/test/jdk/java/lang/Thread/virtual/MonitorWaitNotify.java index 0ec0adb0faf..d5df8eb97d0 100644 --- a/test/jdk/java/lang/Thread/virtual/MonitorWaitNotify.java +++ b/test/jdk/java/lang/Thread/virtual/MonitorWaitNotify.java @@ -26,88 +26,35 @@ * @summary Test virtual threads using Object.wait/notifyAll * @modules java.base/java.lang:+open jdk.management * @library /test/lib - * @build LockingMode * @run junit/othervm/native --enable-native-access=ALL-UNNAMED MonitorWaitNotify */ /* - * @test id=LM_LEGACY + * @test id=Xint * @modules java.base/java.lang:+open jdk.management * @library /test/lib - * @build LockingMode - * @run junit/othervm/native -XX:LockingMode=1 --enable-native-access=ALL-UNNAMED MonitorWaitNotify + * @run junit/othervm/native -Xint --enable-native-access=ALL-UNNAMED MonitorWaitNotify */ /* - * @test id=LM_LIGHTWEIGHT + * @test id=Xcomp * @modules java.base/java.lang:+open jdk.management * @library /test/lib - * @build LockingMode - * @run junit/othervm/native -XX:LockingMode=2 --enable-native-access=ALL-UNNAMED MonitorWaitNotify + * @run junit/othervm/native -Xcomp --enable-native-access=ALL-UNNAMED MonitorWaitNotify */ /* - * @test id=Xint-LM_LEGACY + * @test id=Xcomp-TieredStopAtLevel1 * @modules java.base/java.lang:+open jdk.management * @library /test/lib - * @build LockingMode - * @run junit/othervm/native -Xint -XX:LockingMode=1 --enable-native-access=ALL-UNNAMED MonitorWaitNotify + * @run junit/othervm/native -Xcomp -XX:TieredStopAtLevel=1 --enable-native-access=ALL-UNNAMED MonitorWaitNotify */ /* - * @test id=Xint-LM_LIGHTWEIGHT + * @test id=Xcomp-noTieredCompilation * @modules java.base/java.lang:+open jdk.management * @library /test/lib - * @build LockingMode - * @run junit/othervm/native -Xint -XX:LockingMode=2 --enable-native-access=ALL-UNNAMED MonitorWaitNotify - */ - -/* - * @test id=Xcomp-LM_LEGACY - * @modules java.base/java.lang:+open jdk.management - * @library /test/lib - * @build LockingMode - * @run junit/othervm/native -Xcomp -XX:LockingMode=1 --enable-native-access=ALL-UNNAMED MonitorWaitNotify - */ - -/* - * @test id=Xcomp-LM_LIGHTWEIGHT - * @modules java.base/java.lang:+open jdk.management - * @library /test/lib - * @build LockingMode - * @run junit/othervm/native -Xcomp -XX:LockingMode=2 --enable-native-access=ALL-UNNAMED MonitorWaitNotify - */ - -/* - * @test id=Xcomp-TieredStopAtLevel1-LM_LEGACY - * @modules java.base/java.lang:+open jdk.management - * @library /test/lib - * @build LockingMode - * @run junit/othervm/native -Xcomp -XX:TieredStopAtLevel=1 -XX:LockingMode=1 --enable-native-access=ALL-UNNAMED MonitorWaitNotify - */ - -/* - * @test id=Xcomp-TieredStopAtLevel1-LM_LIGHTWEIGHT - * @modules java.base/java.lang:+open jdk.management - * @library /test/lib - * @build LockingMode - * @run junit/othervm/native -Xcomp -XX:TieredStopAtLevel=1 -XX:LockingMode=2 --enable-native-access=ALL-UNNAMED MonitorWaitNotify - */ - -/* - * @test id=Xcomp-noTieredCompilation-LM_LEGACY - * @modules java.base/java.lang:+open jdk.management - * @library /test/lib - * @build LockingMode - * @run junit/othervm/native -Xcomp -XX:-TieredCompilation -XX:LockingMode=1 --enable-native-access=ALL-UNNAMED MonitorWaitNotify - */ - -/* - * @test id=Xcomp-noTieredCompilation-LM_LIGHTWEIGHT - * @modules java.base/java.lang:+open jdk.management - * @library /test/lib - * @build LockingMode - * @run junit/othervm/native -Xcomp -XX:-TieredCompilation -XX:LockingMode=2 --enable-native-access=ALL-UNNAMED MonitorWaitNotify + * @run junit/othervm/native -Xcomp -XX:-TieredCompilation --enable-native-access=ALL-UNNAMED MonitorWaitNotify */ import java.util.ArrayList; @@ -131,7 +78,6 @@ import jdk.test.lib.thread.VThreadPinner; import org.junit.jupiter.api.Test; import org.junit.jupiter.api.BeforeAll; -import org.junit.jupiter.api.condition.DisabledIf; import org.junit.jupiter.params.provider.Arguments; import org.junit.jupiter.params.ParameterizedTest; import org.junit.jupiter.params.provider.MethodSource; @@ -306,7 +252,6 @@ static Stream threadCounts() { */ @ParameterizedTest @MethodSource("threadCounts") - @DisabledIf("LockingMode#isLegacy") void testNotifyOneThread(int nPlatformThreads, int nVirtualThreads) throws Exception { int nThreads = nPlatformThreads + nVirtualThreads; @@ -364,7 +309,6 @@ void testNotifyOneThread(int nPlatformThreads, int nVirtualThreads) throws Excep */ @ParameterizedTest @MethodSource("threadCounts") - @DisabledIf("LockingMode#isLegacy") void testNotifyAllThreads(int nPlatformThreads, int nVirtualThreads) throws Exception { int nThreads = nPlatformThreads + nVirtualThreads; @@ -702,7 +646,6 @@ void testParkingPermitNotOffered() throws Exception { */ @ParameterizedTest @ValueSource(ints = { 0, 30000, Integer.MAX_VALUE }) - @DisabledIf("LockingMode#isLegacy") void testReleaseWhenWaiting1(int timeout) throws Exception { assumeTrue(VThreadScheduler.supportsCustomScheduler(), "No support for custom schedulers"); try (ExecutorService scheduler = Executors.newFixedThreadPool(1)) { @@ -759,7 +702,6 @@ void testReleaseWhenWaiting1(int timeout) throws Exception { */ @ParameterizedTest @ValueSource(ints = { 0, 10, 20, 100, 500, 30000, Integer.MAX_VALUE }) - @DisabledIf("LockingMode#isLegacy") void testReleaseWhenWaiting2(int timeout) throws Exception { int VTHREAD_COUNT = 4 * Runtime.getRuntime().availableProcessors(); CountDownLatch latch = new CountDownLatch(VTHREAD_COUNT); diff --git a/test/jdk/java/lang/Thread/virtual/Parking.java b/test/jdk/java/lang/Thread/virtual/Parking.java index 41f7f283bdd..574707e637c 100644 --- a/test/jdk/java/lang/Thread/virtual/Parking.java +++ b/test/jdk/java/lang/Thread/virtual/Parking.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2019, 2025, 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 @@ -26,7 +26,6 @@ * @summary Test virtual threads using park/unpark * @modules java.base/java.lang:+open jdk.management * @library /test/lib - * @build LockingMode * @run junit Parking */ @@ -34,7 +33,6 @@ * @test id=Xint * @modules java.base/java.lang:+open jdk.management * @library /test/lib - * @build LockingMode * @run junit/othervm -Xint Parking */ @@ -42,7 +40,6 @@ * @test id=Xcomp * @modules java.base/java.lang:+open jdk.management * @library /test/lib - * @build LockingMode * @run junit/othervm -Xcomp Parking */ @@ -50,7 +47,6 @@ * @test id=Xcomp-noTieredCompilation * @modules java.base/java.lang:+open jdk.management * @library /test/lib - * @build LockingMode * @run junit/othervm -Xcomp -XX:-TieredCompilation Parking */ @@ -66,7 +62,6 @@ import jdk.test.lib.thread.VThreadRunner; import jdk.test.lib.thread.VThreadScheduler; import org.junit.jupiter.api.Test; -import org.junit.jupiter.api.condition.DisabledIf; import org.junit.jupiter.params.ParameterizedTest; import org.junit.jupiter.params.provider.ValueSource; import static org.junit.jupiter.api.Assertions.*; @@ -385,7 +380,6 @@ void testParkNanos11() throws Exception { */ @ParameterizedTest @ValueSource(booleans = { true, false }) - @DisabledIf("LockingMode#isLegacy") void testParkWhenHoldingMonitor(boolean reenter) throws Exception { assumeTrue(VThreadScheduler.supportsCustomScheduler(), "No support for custom schedulers"); try (ExecutorService scheduler = Executors.newFixedThreadPool(1)) { @@ -435,7 +429,6 @@ void testParkWhenHoldingMonitor(boolean reenter) throws Exception { * parking doesn't release the carrier. */ @Test - @DisabledIf("LockingMode#isLegacy") void testManyParkedWhenHoldingMonitor() throws Exception { Thread[] vthreads = new Thread[MAX_VTHREAD_COUNT]; var done = new AtomicBoolean(); diff --git a/test/jdk/java/lang/Thread/virtual/RetryMonitorEnterWhenPinned.java b/test/jdk/java/lang/Thread/virtual/RetryMonitorEnterWhenPinned.java index fa754a88b80..1c7177d9f38 100644 --- a/test/jdk/java/lang/Thread/virtual/RetryMonitorEnterWhenPinned.java +++ b/test/jdk/java/lang/Thread/virtual/RetryMonitorEnterWhenPinned.java @@ -29,7 +29,6 @@ * can't continue because there are no carriers available. * @modules java.base/java.lang:+open * @library /test/lib - * @requires vm.opt.LockingMode != 1 * @run main/othervm/native --enable-native-access=ALL-UNNAMED RetryMonitorEnterWhenPinned */ diff --git a/test/jdk/java/lang/Thread/virtual/ThreadAPI.java b/test/jdk/java/lang/Thread/virtual/ThreadAPI.java index a3d85660b99..b7fdeb8ec84 100644 --- a/test/jdk/java/lang/Thread/virtual/ThreadAPI.java +++ b/test/jdk/java/lang/Thread/virtual/ThreadAPI.java @@ -27,7 +27,6 @@ * @summary Test Thread API with virtual threads * @modules java.base/java.lang:+open jdk.management * @library /test/lib - * @build LockingMode * @run junit/othervm/native --enable-native-access=ALL-UNNAMED ThreadAPI */ @@ -36,7 +35,6 @@ * @requires vm.continuations * @modules java.base/java.lang:+open jdk.management * @library /test/lib - * @build LockingMode * @run junit/othervm/native -XX:+UnlockExperimentalVMOptions -XX:-VMContinuations * --enable-native-access=ALL-UNNAMED ThreadAPI */ @@ -70,7 +68,6 @@ import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.api.AfterAll; import org.junit.jupiter.api.Disabled; -import org.junit.jupiter.api.condition.DisabledIf; import org.junit.jupiter.params.ParameterizedTest; import org.junit.jupiter.params.provider.MethodSource; import org.junit.jupiter.params.provider.ValueSource; @@ -1112,7 +1109,6 @@ void testYieldReleasesCarrier() throws Exception { * Test Thread.yield releases carrier thread when virtual thread holds a monitor. */ @Test - @DisabledIf("LockingMode#isLegacy") void testYieldReleasesCarrierWhenHoldingMonitor() throws Exception { assumeTrue(VThreadScheduler.supportsCustomScheduler(), "No support for custom schedulers"); var list = new CopyOnWriteArrayList(); diff --git a/test/jdk/java/lang/Thread/virtual/stress/LotsOfContendedMonitorEnter.java b/test/jdk/java/lang/Thread/virtual/stress/LotsOfContendedMonitorEnter.java index c63a4b0c947..da45c610e82 100644 --- a/test/jdk/java/lang/Thread/virtual/stress/LotsOfContendedMonitorEnter.java +++ b/test/jdk/java/lang/Thread/virtual/stress/LotsOfContendedMonitorEnter.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2024, 2025, 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 @@ -24,18 +24,10 @@ /* * @test id=default * @summary Test virtual threads entering a lot of monitors with contention - * @requires vm.opt.LockingMode != 1 * @library /test/lib * @run main LotsOfContendedMonitorEnter */ -/* - * @test id=LM_LIGHTWEIGHT - * @requires vm.opt.LockingMode != 1 - * @library /test/lib - * @run main/othervm -XX:LockingMode=2 LotsOfContendedMonitorEnter - */ - import java.util.concurrent.CountDownLatch; import jdk.test.lib.thread.VThreadRunner; diff --git a/test/jdk/java/lang/Thread/virtual/stress/LotsOfUncontendedMonitorEnter.java b/test/jdk/java/lang/Thread/virtual/stress/LotsOfUncontendedMonitorEnter.java index da5fdd1161d..e1a8fb82bd6 100644 --- a/test/jdk/java/lang/Thread/virtual/stress/LotsOfUncontendedMonitorEnter.java +++ b/test/jdk/java/lang/Thread/virtual/stress/LotsOfUncontendedMonitorEnter.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2024, 2025, 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 @@ -28,18 +28,6 @@ * @run main LotsOfUncontendedMonitorEnter */ -/* - * @test id=LM_LEGACY - * @library /test/lib - * @run main/othervm -XX:LockingMode=1 LotsOfUncontendedMonitorEnter - */ - -/* - * @test id=LM_LIGHTWEIGHT - * @library /test/lib - * @run main/othervm -XX:LockingMode=2 LotsOfUncontendedMonitorEnter - */ - import java.util.ArrayList; import java.util.List; import java.util.concurrent.ThreadLocalRandom; diff --git a/test/jdk/java/lang/Thread/virtual/stress/Skynet100kWithMonitors.java b/test/jdk/java/lang/Thread/virtual/stress/Skynet100kWithMonitors.java index 9487de6b862..7949529af60 100644 --- a/test/jdk/java/lang/Thread/virtual/stress/Skynet100kWithMonitors.java +++ b/test/jdk/java/lang/Thread/virtual/stress/Skynet100kWithMonitors.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2024, 2025, 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 @@ -26,13 +26,13 @@ * @summary Stress test virtual threads with a variation of the Skynet 1M benchmark that uses * a channel implementation based on object monitors. This variant uses a reduced number of * 100k virtual threads at the final level. - * @requires vm.debug != true & vm.continuations & vm.opt.LockingMode != 1 + * @requires vm.debug != true & vm.continuations * @run main/othervm/timeout=300 Skynet100kWithMonitors 50 */ /* * @test - * @requires vm.debug == true & vm.continuations & vm.opt.LockingMode != 1 + * @requires vm.debug == true & vm.continuations * @run main/othervm/timeout=300 Skynet100kWithMonitors 10 */ diff --git a/test/jdk/java/net/DatagramSocket/AddressNotSet.java b/test/jdk/java/net/DatagramSocket/AddressNotSet.java index 0e7b28aa044..afab2c686d1 100644 --- a/test/jdk/java/net/DatagramSocket/AddressNotSet.java +++ b/test/jdk/java/net/DatagramSocket/AddressNotSet.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2019, 2025, 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 @@ -108,43 +108,5 @@ private void test(DatagramSocket sock) throws Exception { p = new DatagramPacket(buf, buf.length, addr, port); sock.send(p); serversock.receive(p); - - if (sock instanceof MulticastSocket) { - sock.disconnect(); - testTTL((MulticastSocket)sock); - } - } - - private void testTTL(MulticastSocket sock) throws Exception { - out.println("Testing deprecated send TTL with " + sock.getClass()); - final byte ttl = 100; - InetAddress addr = loopbackAddress; - byte[] buf; - DatagramPacket p; - int port = serversock.getLocalPort(); - - out.println("Checking send to non-connected address ..."); - try { - out.println("Checking send with no packet address"); - buf = ("Hello, server"+(++i)).getBytes(); - p = new DatagramPacket(buf, buf.length); - sock.send(p,ttl); - throw new AssertionError("Expected IllegalArgumentException not received"); - } catch (IllegalArgumentException x) { - out.println("Got expected exception: " + x); - } - - out.println("Connecting to connected address: " + sock); - sock.connect(addr, port); - - try { - out.println("Checking send with different address than connected"); - buf = ("Hello, server"+(++i)).getBytes(); - p = new DatagramPacket(buf, buf.length, addr, port+1); - sock.send(p, ttl); - throw new AssertionError("Expected IllegalArgumentException not received"); - } catch (IllegalArgumentException x) { - out.println("Got expected exception: " + x); - } } } diff --git a/test/jdk/java/net/DatagramSocket/DatagramSocketMulticasting.java b/test/jdk/java/net/DatagramSocket/DatagramSocketMulticasting.java index 1758ff2190c..39cdf7210f7 100644 --- a/test/jdk/java/net/DatagramSocket/DatagramSocketMulticasting.java +++ b/test/jdk/java/net/DatagramSocket/DatagramSocketMulticasting.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2021, 2025, 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 @@ -252,7 +252,7 @@ static void testNetworkInterface(DatagramSocket s, } /** - * Test getTimeToLive/setTimeToLive/getTTL/getTTL and IP_MULTICAST_TTL socket + * Test getTimeToLive/setTimeToLive and IP_MULTICAST_TTL socket * option. */ static void testTimeToLive(DatagramSocket s) throws IOException { diff --git a/test/jdk/java/net/DatagramSocket/OldDatagramSocketImplTest.java b/test/jdk/java/net/DatagramSocket/OldDatagramSocketImplTest.java index c1a110c6619..7f8eea874ec 100644 --- a/test/jdk/java/net/DatagramSocket/OldDatagramSocketImplTest.java +++ b/test/jdk/java/net/DatagramSocket/OldDatagramSocketImplTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2021, 2025, 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 @@ -121,14 +121,6 @@ protected int peekData(DatagramPacket p) throws IOException { @Override protected void receive(DatagramPacket p) throws IOException { } - @Override - protected void setTTL(byte ttl) throws IOException { } - - @Override - protected byte getTTL() throws IOException { - return 0; - } - @Override protected void setTimeToLive(int ttl) throws IOException { } diff --git a/test/jdk/java/net/DatagramSocket/SendCheck.java b/test/jdk/java/net/DatagramSocket/SendCheck.java index 8943e8517fa..482eadb3cf9 100644 --- a/test/jdk/java/net/DatagramSocket/SendCheck.java +++ b/test/jdk/java/net/DatagramSocket/SendCheck.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2020, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2020, 2025, 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 @@ -45,7 +45,7 @@ * @bug 8236105 * @summary Check that DatagramSocket, MulticastSocket, * DatagramSocketAdaptor and DatagramChannel all - * throw expected Execption when passed a DatagramPacket + * throw expected Exception when passed a DatagramPacket * with invalid details * @run testng SendCheck */ @@ -126,11 +126,9 @@ Object[][] providerIO() throws IOException { List senders = List.of( Sender.of(new DatagramSocket(null)), - Sender.of(new MulticastSocket(null), (byte) 0), + Sender.of(new MulticastSocket(null)), Sender.of(DatagramChannel.open()), - Sender.of(DatagramChannel.open().socket()), - Sender.of((MulticastSocket) - DatagramChannel.open().socket(), (byte) 0) + Sender.of(DatagramChannel.open().socket()) ); List testcases = new ArrayList<>(); @@ -179,12 +177,6 @@ static Sender of(DatagramSocket socket) { return new SenderImpl<>(socket, socket::send, socket::close, SE); } - static Sender of(MulticastSocket socket, byte ttl) { - SenderImpl.Send send = - (pkt) -> socket.send(pkt, ttl); - return new SenderImpl<>(socket, send, socket::close, SE); - } - static Sender of(DatagramChannel socket) { SenderImpl.Send send = (pkt) -> socket.send(ByteBuffer.wrap(pkt.getData()), diff --git a/test/jdk/java/net/DatagramSocket/SetDatagramSocketImplFactory/java.base/java/net/MyDatagramSocketImplFactory.java b/test/jdk/java/net/DatagramSocket/SetDatagramSocketImplFactory/java.base/java/net/MyDatagramSocketImplFactory.java index 41a209ccf01..41f1a33a817 100644 --- a/test/jdk/java/net/DatagramSocket/SetDatagramSocketImplFactory/java.base/java/net/MyDatagramSocketImplFactory.java +++ b/test/jdk/java/net/DatagramSocket/SetDatagramSocketImplFactory/java.base/java/net/MyDatagramSocketImplFactory.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1999, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1999, 2025, 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 @@ -63,15 +63,6 @@ protected void receive(DatagramPacket p) throws IOException { ds.receive(p); } - @Override - protected void setTTL(byte ttl) throws IOException { - } - - @Override - protected byte getTTL() throws IOException { - return 0; - } - @Override protected void setTimeToLive(int ttl) throws IOException { diff --git a/test/jdk/java/net/DatagramSocketImpl/TestCreate.java b/test/jdk/java/net/DatagramSocketImpl/TestCreate.java index 5a0fdf63283..81772074ae2 100644 --- a/test/jdk/java/net/DatagramSocketImpl/TestCreate.java +++ b/test/jdk/java/net/DatagramSocketImpl/TestCreate.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2020, 2025, 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 @@ -105,8 +105,6 @@ public T getOption(SocketOption name) throws IOException { @Override protected int peek(InetAddress i) { return 0; } @Override protected int peekData(DatagramPacket p) { return 0; } @Override protected void receive(DatagramPacket p) { } - @Override protected void setTTL(byte ttl) { } - @Override protected byte getTTL() { return 0; } @Override protected void setTimeToLive(int ttl) { } @Override protected int getTimeToLive() { return 0; } @Override protected void join(InetAddress inetaddr) { } diff --git a/test/jdk/java/net/DatagramSocketImpl/TestDefaultBehavior.java b/test/jdk/java/net/DatagramSocketImpl/TestDefaultBehavior.java index 760f7586c27..2e223f1820c 100644 --- a/test/jdk/java/net/DatagramSocketImpl/TestDefaultBehavior.java +++ b/test/jdk/java/net/DatagramSocketImpl/TestDefaultBehavior.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2019, 2025, 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 @@ -99,8 +99,6 @@ public T getOption(SocketOption name) throws IOException { @Override protected int peek(InetAddress i) { return 0; } @Override protected int peekData(DatagramPacket p) { return 0; } @Override protected void receive(DatagramPacket p) { } - @Override protected void setTTL(byte ttl) { } - @Override protected byte getTTL() { return 0; } @Override protected void setTimeToLive(int ttl) { } @Override protected int getTimeToLive() { return 0; } @Override protected void join(InetAddress inetaddr) { } diff --git a/src/hotspot/share/c1/c1_globals_pd.hpp b/test/jdk/java/net/HttpCookie/whitebox/MaxAgeExpiresDriver.java similarity index 76% rename from src/hotspot/share/c1/c1_globals_pd.hpp rename to test/jdk/java/net/HttpCookie/whitebox/MaxAgeExpiresDriver.java index fcf78b95272..7f535fa0c23 100644 --- a/src/hotspot/share/c1/c1_globals_pd.hpp +++ b/test/jdk/java/net/HttpCookie/whitebox/MaxAgeExpiresDriver.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2025, 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 @@ -19,16 +19,13 @@ * 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. - * */ -#ifndef SHARE_C1_C1_GLOBALS_PD_HPP -#define SHARE_C1_C1_GLOBALS_PD_HPP - -#include "runtime/globals_shared.hpp" -#include "utilities/macros.hpp" - -#include CPU_HEADER(c1_globals) -#include OS_HEADER(c1_globals) - -#endif // SHARE_C1_C1_GLOBALS_PD_HPP +/* + * @test + * @bug 8351983 + * @summary HttpCookie Parser Incorrectly Handles Cookies with Expires Attribute + * @run testng java.base/java.net.MaxAgeExpires + */ +public class MaxAgeExpiresDriver { +} \ No newline at end of file diff --git a/test/jdk/java/net/HttpCookie/whitebox/java.base/java/net/MaxAgeExpires.java b/test/jdk/java/net/HttpCookie/whitebox/java.base/java/net/MaxAgeExpires.java new file mode 100644 index 00000000000..5c4f8f66b3d --- /dev/null +++ b/test/jdk/java/net/HttpCookie/whitebox/java.base/java/net/MaxAgeExpires.java @@ -0,0 +1,137 @@ +/* + * Copyright (c) 2025, 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. + * + * 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 java.net; + +import java.time.*; +import java.time.format.DateTimeFormatter; +import java.util.*; +import org.testng.Assert; +import org.testng.annotations.Test; +import org.testng.annotations.DataProvider; + +public class MaxAgeExpires { + + static final DateTimeFormatter dtFormatter = + DateTimeFormatter.RFC_1123_DATE_TIME; + + static final String NOW_PLUS_500_SEC = + dtFormatter.format(ZonedDateTime.ofInstant(Instant.now() + .plusSeconds(500), ZoneId.of("UTC"))); + + // Test dates 1 minute apart + static final String DT1 = "Mon, 01 Jan 2024 01:00:00 GMT"; + static final String DT2 = "Mon, 01 Jan 2024 01:01:00 GMT"; + static final String DT3 = "Mon, 01 Jan 2024 01:02:00 GMT"; + + static final String FAR_FUTURE = "Mon, 01 Jan 4024 01:02:00 GMT"; + + static final ZonedDateTime zdt1 = ZonedDateTime.parse(DT1, dtFormatter); + static final ZonedDateTime zdt2 = ZonedDateTime.parse(DT2, dtFormatter); + static final ZonedDateTime zdt3 = ZonedDateTime.parse(DT3, dtFormatter); + + static long zdtToMillis(ZonedDateTime zdt) { + return zdt.toInstant().getEpochSecond() * 1000; // always exact seconds + } + + @DataProvider(name = "testData") + public Object[][] testData() { + return new Object[][] { + // Date string in past. But checking based on current time. + {-1L, -1L, -1L, DT1, 0, true}, + {-1L, -1L, 1000, DT1, 1000, false}, + {-1L, -1L, 0, DT1, 0, true}, + {-1L, -1L, 1000, NOW_PLUS_500_SEC, 1000, false}, + + // Far in the future. Just check hasExpired() not the exact maxAge + {-1L, -1L, -1L, FAR_FUTURE, -1L, false}, + + // Tests using fixed creation and verification dates + // (independent of current time) + // expires= + // maxAge= | + // create time expiry check time | |expected maxAge + // | | | | | hasExpired() + // | | | | | | expected + {zdtToMillis(zdt1), zdtToMillis(zdt3), -1L, DT2, 60, true}, + {zdtToMillis(zdt1), zdtToMillis(zdt3), 20, DT2, 20, true}, + {zdtToMillis(zdt1), zdtToMillis(zdt2), 40, DT3, 40, true}, + {zdtToMillis(zdt1), zdtToMillis(zdt2), -1L, DT3,120, false} + + }; + }; + + + @Test(dataProvider = "testData") + public void test1(long creationInstant, // if -1, then current time is used + long expiryCheckInstant, // if -1 then current time is used + long maxAge, // if -1, then not included in String + String expires, // if null, then not included in String + long expectedAge, // expected return value from getMaxAge() + boolean hasExpired) // expected return value from hasExpired() + throws Exception + { + StringBuilder sb = new StringBuilder(); + sb.append("Set-Cookie: name=value"); + if (expires != null) + sb.append("; expires=" + expires); + if (maxAge != -1) + sb.append("; max-age=" + Long.toString(maxAge)); + + String s = sb.toString(); + System.out.println(s); + HttpCookie cookie; + if (creationInstant == -1) + cookie = HttpCookie.parse(s).get(0); + else + cookie = HttpCookie.parse(s, false, creationInstant).get(0); + + if (expectedAge != -1 && cookie.getMaxAge() != expectedAge) { + System.out.println("getMaxAge returned " + cookie.getMaxAge()); + System.out.println("expectedAge was " + expectedAge); + throw new RuntimeException("Test failed: wrong age"); + } + + boolean expired = expiryCheckInstant == -1 + ? cookie.hasExpired() + : cookie.hasExpired(expiryCheckInstant); + + if (expired != hasExpired) { + System.out.println("cookie.hasExpired() returned " + expired); + System.out.println("hasExpired was " + hasExpired); + System.out.println("getMaxAge() returned " + cookie.getMaxAge()); + throw new RuntimeException("Test failed: wrong hasExpired"); + } + } + + @Test + public void test2() { + // Miscellaneous tests that setMaxAge() overrides whatever was set already + HttpCookie cookie = HttpCookie.parse("Set-Cookie: name=value; max-age=100").get(0); + Assert.assertEquals(cookie.getMaxAge(), 100); + cookie.setMaxAge(200); + Assert.assertEquals(cookie.getMaxAge(), 200); + cookie.setMaxAge(-2); + Assert.assertEquals(cookie.getMaxAge(), -2); + } +} diff --git a/test/jdk/java/net/HttpURLConnection/HostHeaderTest.java b/test/jdk/java/net/HttpURLConnection/HostHeaderTest.java new file mode 100644 index 00000000000..329f0eedaf9 --- /dev/null +++ b/test/jdk/java/net/HttpURLConnection/HostHeaderTest.java @@ -0,0 +1,143 @@ +/* + * Copyright (c) 2025, 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. + * + * 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. + */ + +import java.io.IOException; +import java.io.InputStream; +import java.io.OutputStream; +import java.net.HttpURLConnection; +import java.net.InetAddress; +import java.net.InetSocketAddress; +import java.net.Proxy; +import java.net.URL; +import java.net.URLConnection; +import java.util.List; + +import com.sun.net.httpserver.HttpExchange; +import com.sun.net.httpserver.HttpHandler; +import com.sun.net.httpserver.HttpServer; +import jdk.test.lib.net.URIBuilder; +import org.junit.jupiter.api.AfterAll; +import org.junit.jupiter.api.BeforeAll; +import org.junit.jupiter.api.Test; +import static java.nio.charset.StandardCharsets.US_ASCII; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertInstanceOf; +import static org.junit.jupiter.api.Assertions.assertNull; + +/* + * @test + * @bug 8359709 + * @summary verify that if the Host header is allowed to be set by the application + * then the correct value gets set in a HTTP request issued through + * java.net.HttpURLConnection + * @library /test/lib + * @run junit HostHeaderTest + * @run junit/othervm -Dsun.net.http.allowRestrictedHeaders=true HostHeaderTest + * @run junit/othervm -Dsun.net.http.allowRestrictedHeaders=false HostHeaderTest + */ +class HostHeaderTest { + + private static final String SERVER_CTX_ROOT = "/8359709/"; + private static final boolean allowsHostHeader = Boolean.getBoolean("sun.net.http.allowRestrictedHeaders"); + + private static HttpServer server; + + @BeforeAll + static void beforeAll() throws Exception { + final InetSocketAddress addr = new InetSocketAddress(InetAddress.getLoopbackAddress(), 0); + server = HttpServer.create(addr, 0); + server.createContext(SERVER_CTX_ROOT, new Handler()); + server.start(); + System.err.println("started server at " + server.getAddress()); + } + + @AfterAll + static void afterAll() throws Exception { + if (server != null) { + System.err.println("stopping server " + server.getAddress()); + server.stop(0); + } + } + + @Test + void testHostHeader() throws Exception { + final InetSocketAddress serverAddr = server.getAddress(); + final URL reqURL = URIBuilder.newBuilder() + .scheme("http") + .loopback() + .port(serverAddr.getPort()) + .path(SERVER_CTX_ROOT) + .build().toURL(); + final URLConnection conn = reqURL.openConnection(Proxy.NO_PROXY); + + conn.setRequestProperty("Host", "foobar"); + if (!allowsHostHeader) { + // if restricted headers aren't allowed to be set by the user, then + // we expect the previous call to setRequestProperty to not set the Host + // header + assertNull(conn.getRequestProperty("Host"), "Host header unexpectedly set"); + } + + assertInstanceOf(HttpURLConnection.class, conn); + final HttpURLConnection httpURLConn = (HttpURLConnection) conn; + + // send the HTTP request + System.err.println("sending request " + reqURL); + final int respCode = httpURLConn.getResponseCode(); + assertEquals(200, respCode, "unexpected response code"); + // verify that the server side handler received the expected + // Host header value in the request + try (final InputStream is = httpURLConn.getInputStream()) { + final byte[] resp = is.readAllBytes(); + // if Host header wasn't explicitly set, then we expect it to be + // derived from the request URL + final String expected = allowsHostHeader + ? "foobar" + : reqURL.getHost() + ":" + reqURL.getPort(); + final String actual = new String(resp, US_ASCII); + assertEquals(expected, actual, "unexpected Host header received on server side"); + } + } + + private static final class Handler implements HttpHandler { + private static final int NO_RESPONSE_BODY = -1; + + @Override + public void handle(final HttpExchange exchange) throws IOException { + final List headerVals = exchange.getRequestHeaders().get("Host"); + System.err.println("Host header has value(s): " + headerVals); + // unexpected Host header value, respond with 400 status code + if (headerVals == null || headerVals.size() != 1) { + System.err.println("Unexpected header value(s) for Host header: " + headerVals); + exchange.sendResponseHeaders(400, NO_RESPONSE_BODY); + return; + } + // respond back with the Host header value that we found in the request + final byte[] response = headerVals.getFirst().getBytes(US_ASCII); + exchange.sendResponseHeaders(200, response.length); + try (final OutputStream os = exchange.getResponseBody()) { + os.write(response); + } + } + } +} diff --git a/test/jdk/java/net/MulticastSocket/MulticastTTL.java b/test/jdk/java/net/MulticastSocket/MulticastTTL.java deleted file mode 100644 index 0fcc5a373d4..00000000000 --- a/test/jdk/java/net/MulticastSocket/MulticastTTL.java +++ /dev/null @@ -1,61 +0,0 @@ -/* - * Copyright (c) 1998, 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. - * - * 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. - */ - -/* - * @test - * @bug 4089415 - * @summary Test MulticastSocket send for modification of ttl - * - */ -import java.io.*; -import java.net.*; - -public class MulticastTTL { - - public static void main(String args[]) throws Exception { - MulticastSocket soc = null; - DatagramPacket pac = null; - InetAddress sin = null; - byte [] array = new byte[65537]; - int port = 0; - byte old_ttl = 0; - byte new_ttl = 64; - byte ttl = 0; - - sin = InetAddress.getByName("224.80.80.80"); - soc = new MulticastSocket(); - port = soc.getLocalPort(); - old_ttl = soc.getTTL(); - pac = new DatagramPacket(array, array.length, sin, port); - - try { - soc.send(pac, new_ttl); - } catch(java.io.IOException e) { - ttl = soc.getTTL(); - soc.close(); - if(ttl != old_ttl) - throw new RuntimeException("TTL "); - } - soc.close(); - } -} diff --git a/test/jdk/java/net/MulticastSocket/SendPortZero.java b/test/jdk/java/net/MulticastSocket/SendPortZero.java index 2155cf4149f..0d8acd86c8c 100644 --- a/test/jdk/java/net/MulticastSocket/SendPortZero.java +++ b/test/jdk/java/net/MulticastSocket/SendPortZero.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2020, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2020, 2025, 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 @@ -93,7 +93,6 @@ public Object[][] variants() { @Test(dataProvider = "data") public void testSend(MulticastSocket ms, DatagramPacket pkt) { assertThrows(SE, () -> ms.send(pkt)); - assertThrows(SE, () -> ms.send(pkt, (byte) 0)); } @AfterTest diff --git a/test/jdk/java/net/MulticastSocket/SetLoopbackOption.java b/test/jdk/java/net/MulticastSocket/SetLoopbackOption.java index 7e39e6fc013..ed831cfbdf7 100644 --- a/test/jdk/java/net/MulticastSocket/SetLoopbackOption.java +++ b/test/jdk/java/net/MulticastSocket/SetLoopbackOption.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2019, 2025, 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 @@ -206,16 +206,6 @@ protected void receive(DatagramPacket p) throws IOException { shouldNotComeHere(); } - @Override - protected void setTTL(byte ttl) throws IOException { - shouldNotComeHere(); - } - - @Override - protected byte getTTL() throws IOException { - return shouldNotComeHere(); - } - @Override protected void setTimeToLive(int ttl) throws IOException { shouldNotComeHere(); diff --git a/test/jdk/java/net/MulticastSocket/SetTTLTo0.java b/test/jdk/java/net/MulticastSocket/SetTTLTo0.java index 8bb4184081a..68dc8c43bc9 100644 --- a/test/jdk/java/net/MulticastSocket/SetTTLTo0.java +++ b/test/jdk/java/net/MulticastSocket/SetTTLTo0.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1998, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1998, 2025, 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 @@ -40,7 +40,6 @@ public static void main(String args[]) throws Exception { throw new Exception("Unexpected Exception"); } - soc.setTTL((byte)0); soc.setTimeToLive(0); } diff --git a/test/jdk/java/net/SocketOption/CachedImplOptions.java b/test/jdk/java/net/SocketOption/CachedImplOptions.java index ed2c2a9ebdf..955414559c2 100644 --- a/test/jdk/java/net/SocketOption/CachedImplOptions.java +++ b/test/jdk/java/net/SocketOption/CachedImplOptions.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2020, 2025, 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 @@ -124,8 +124,6 @@ static abstract class AbstractDatagramSocketImpl extends DatagramSocketImpl { @Override protected int peek(InetAddress i) { return 0; } @Override protected int peekData(DatagramPacket p) { return 0; } @Override protected void receive(DatagramPacket p) { } - @Override protected void setTTL(byte ttl) { } - @Override protected byte getTTL() { return 0; } @Override protected void setTimeToLive(int ttl) { } @Override protected int getTimeToLive() { return 0; } @Override protected void join(InetAddress inetaddr) { } diff --git a/test/jdk/java/net/SocketOption/ImmutableOptions.java b/test/jdk/java/net/SocketOption/ImmutableOptions.java index 4a2e4419f9d..f15734edddc 100644 --- a/test/jdk/java/net/SocketOption/ImmutableOptions.java +++ b/test/jdk/java/net/SocketOption/ImmutableOptions.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2016, 2025, 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 @@ -162,10 +162,6 @@ protected void send(DatagramPacket p) throws IOException { } protected void receive(DatagramPacket p) throws IOException { } - protected void setTTL(byte ttl) throws IOException { } - - protected byte getTTL() throws IOException { return 0; } - protected void setTimeToLive(int ttl) throws IOException { } protected int getTimeToLive() throws IOException { return 0; } diff --git a/test/jdk/java/net/URL/EarlyOrDelayedParsing.java b/test/jdk/java/net/URL/EarlyOrDelayedParsing.java index 57fa76c23bb..e286631be6b 100644 --- a/test/jdk/java/net/URL/EarlyOrDelayedParsing.java +++ b/test/jdk/java/net/URL/EarlyOrDelayedParsing.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2022, 2025, 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 @@ -38,6 +38,10 @@ import java.io.IOException; import java.net.ConnectException; import java.net.MalformedURLException; +import java.net.Proxy; +import java.net.ProxySelector; +import java.net.SocketAddress; +import java.net.URI; import java.net.URL; import java.net.UnknownHostException; import java.util.ArrayList; @@ -57,6 +61,19 @@ public class EarlyOrDelayedParsing { { String value = System.getProperty("jdk.net.url.delayParsing", "false"); EARLY_PARSING = !value.isEmpty() && !Boolean.parseBoolean(value); + if (!EARLY_PARSING) { + // we will open the connection in that case. + // make sure no proxy is selected + ProxySelector.setDefault(new ProxySelector() { + @Override + public List select(URI uri) { + return List.of(Proxy.NO_PROXY); + } + @Override + public void connectFailed(URI uri, SocketAddress sa, IOException ioe) { + } + }); + } } // Some characters that when included at the wrong place diff --git a/test/jdk/java/net/httpclient/FilePublisher/FilePublisherPermsTest.java b/test/jdk/java/net/httpclient/FilePublisher/FilePublisherPermsTest.java deleted file mode 100644 index bafe1496a86..00000000000 --- a/test/jdk/java/net/httpclient/FilePublisher/FilePublisherPermsTest.java +++ /dev/null @@ -1,255 +0,0 @@ -/* - * Copyright (c) 2020, 2024, 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. - * - * 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. - */ - -/* - * @test - * @bug 8235459 - * @summary Confirm that HttpRequest.BodyPublishers#ofFile(Path) - * works as expected - * @library /test/lib /test/jdk/java/net/httpclient/lib - * @build jdk.httpclient.test.lib.common.HttpServerAdapters jdk.test.lib.net.SimpleSSLContext - * SecureZipFSProvider - * @run testng/othervm FilePublisherPermsTest - */ - -import jdk.test.lib.net.SimpleSSLContext; -import org.testng.annotations.AfterTest; -import org.testng.annotations.BeforeTest; -import org.testng.annotations.DataProvider; -import org.testng.annotations.Test; - -import javax.net.ssl.SSLContext; -import java.io.FileNotFoundException; -import java.io.IOException; -import java.io.InputStream; -import java.io.OutputStream; -import java.net.URI; -import java.net.http.HttpClient; -import java.net.http.HttpRequest; -import java.net.http.HttpRequest.BodyPublisher; -import java.net.http.HttpRequest.BodyPublishers; -import java.net.http.HttpResponse; -import java.nio.file.FileSystem; -import java.nio.file.FileSystems; -import java.nio.file.Files; -import java.nio.file.Path; -import java.security.*; -import java.util.Map; -import jdk.httpclient.test.lib.common.HttpServerAdapters; - -import static java.lang.System.out; -import static java.net.http.HttpClient.Builder.NO_PROXY; -import static java.net.http.HttpClient.Version.HTTP_1_1; -import static java.net.http.HttpClient.Version.HTTP_2; -import static org.testng.Assert.assertEquals; -import static org.testng.Assert.fail; - -public class FilePublisherPermsTest implements HttpServerAdapters { - - SSLContext sslContext; - HttpServerAdapters.HttpTestServer httpTestServer; // HTTP/1.1 [ 4 servers ] - HttpServerAdapters.HttpTestServer httpsTestServer; // HTTPS/1.1 - HttpServerAdapters.HttpTestServer http2TestServer; // HTTP/2 ( h2c ) - HttpServerAdapters.HttpTestServer https2TestServer; // HTTP/2 ( h2 ) - String httpURI; - String httpsURI; - String http2URI; - String https2URI; - - FileSystem zipFs; - static Path zipFsPath; - static Path defaultFsPath; - - String policyFile; - - // Default file system set up - static final String DEFAULT_FS_MSG = "default fs"; - - private Path defaultFsFile() throws Exception { - var file = Path.of("defaultFile.txt"); - if (Files.notExists(file)) { - Files.createFile(file); - Files.writeString(file, DEFAULT_FS_MSG); - } - assertEquals(Files.readString(file), DEFAULT_FS_MSG); - return file; - } - - @DataProvider(name = "defaultFsData") - public Object[][] defaultFsData() { - return new Object[][]{ - { httpURI, defaultFsPath }, - { httpsURI, defaultFsPath }, - { http2URI, defaultFsPath }, - { https2URI, defaultFsPath }, - { httpURI, defaultFsPath }, - { httpsURI, defaultFsPath }, - { http2URI, defaultFsPath }, - { https2URI, defaultFsPath }, - }; - } - - @Test(dataProvider = "defaultFsData") - public void testDefaultFs(String uriString, Path path) - throws Exception { - out.printf("\n\n--- testDefaultFs(%s, %s): starting\n", - uriString, path); - BodyPublisher bodyPublisher = BodyPublishers.ofFile(path); - send(uriString, bodyPublisher); - } - - // Zip File system set up - static final String ZIP_FS_MSG = "zip fs"; - - static FileSystem newZipFs(Path zipFile) throws Exception { - return FileSystems.newFileSystem(zipFile, Map.of("create", "true")); - } - - static FileSystem newSecureZipFs(Path zipFile) throws Exception { - FileSystem fs = newZipFs(zipFile); - return new SecureZipFSProvider(fs.provider()).newFileSystem(fs); - } - - static Path zipFsFile(FileSystem fs) throws Exception { - var file = fs.getPath("fileInZip.txt"); - if (Files.notExists(file)) { - Files.createFile(file); - Files.writeString(file, ZIP_FS_MSG); - } - assertEquals(Files.readString(file), ZIP_FS_MSG); - return file; - } - - @DataProvider(name = "zipFsData") - public Object[][] zipFsData() { - return new Object[][]{ - { httpURI, zipFsPath }, - { httpsURI, zipFsPath }, - { http2URI, zipFsPath }, - { https2URI, zipFsPath }, - { httpURI, zipFsPath }, - { httpsURI, zipFsPath }, - { http2URI, zipFsPath }, - { https2URI, zipFsPath }, - }; - } - - @Test(dataProvider = "zipFsData") - public void testZipFs(String uriString, Path path) throws Exception { - out.printf("\n\n--- testZipFsCustomPerm(%s, %s): starting\n", uriString, path); - BodyPublisher bodyPublisher = BodyPublishers.ofFile(path); - send(uriString, bodyPublisher); - } - - @Test - public void testFileNotFound() throws Exception { - out.printf("\n\n--- testFileNotFound(): starting\n"); - var zipPath = Path.of("fileNotFound.zip"); - try (FileSystem fs = newZipFs(zipPath)) { - Path fileInZip = zipFsFile(fs); - Files.deleteIfExists(fileInZip); - BodyPublishers.ofFile(fileInZip); - fail(); - } catch (FileNotFoundException e) { - out.println("Caught expected: " + e); - } - var path = Path.of("fileNotFound.txt"); - try { - Files.deleteIfExists(path); - BodyPublishers.ofFile(path); - fail(); - } catch (FileNotFoundException e) { - out.println("Caught expected: " + e); - } - } - - private void send(String uriString, BodyPublisher bodyPublisher) - throws Exception { - HttpClient client = HttpClient.newBuilder() - .proxy(NO_PROXY) - .sslContext(sslContext) - .build(); - var req = HttpRequest.newBuilder(URI.create(uriString)) - .POST(bodyPublisher) - .build(); - client.send(req, HttpResponse.BodyHandlers.discarding()); - } - - - static class HttpEchoHandler implements HttpServerAdapters.HttpTestHandler { - @Override - public void handle(HttpServerAdapters.HttpTestExchange t) throws IOException { - try (InputStream is = t.getRequestBody(); - OutputStream os = t.getResponseBody()) { - byte[] bytes = is.readAllBytes(); - t.sendResponseHeaders(200, bytes.length); - os.write(bytes); - } - } - } - - @BeforeTest - public void setup() throws Exception { - sslContext = new SimpleSSLContext().get(); - if (sslContext == null) - throw new AssertionError("Unexpected null sslContext"); - - zipFs = newSecureZipFs(Path.of("file.zip")); - zipFsPath = zipFsFile(zipFs); - defaultFsPath = defaultFsFile(); - - httpTestServer = HttpServerAdapters.HttpTestServer.create(HTTP_1_1); - httpTestServer.addHandler( - new FilePublisherPermsTest.HttpEchoHandler(), "/http1/echo"); - httpURI = "http://" + httpTestServer.serverAuthority() + "/http1/echo"; - - httpsTestServer = HttpServerAdapters.HttpTestServer.create(HTTP_1_1, sslContext); - httpsTestServer.addHandler( - new FilePublisherPermsTest.HttpEchoHandler(), "/https1/echo"); - httpsURI = "https://" + httpsTestServer.serverAuthority() + "/https1/echo"; - - http2TestServer = HttpServerAdapters.HttpTestServer.create(HTTP_2); - http2TestServer.addHandler( - new FilePublisherPermsTest.HttpEchoHandler(), "/http2/echo"); - http2URI = "http://" + http2TestServer.serverAuthority() + "/http2/echo"; - - https2TestServer = HttpServerAdapters.HttpTestServer.create(HTTP_2, sslContext); - https2TestServer.addHandler( - new FilePublisherPermsTest.HttpEchoHandler(), "/https2/echo"); - https2URI = "https://" + https2TestServer.serverAuthority() + "/https2/echo"; - - httpTestServer.start(); - httpsTestServer.start(); - http2TestServer.start(); - https2TestServer.start(); - } - - @AfterTest - public void teardown() throws Exception { - httpTestServer.stop(); - httpsTestServer.stop(); - http2TestServer.stop(); - https2TestServer.stop(); - zipFs.close(); - } -} diff --git a/test/jdk/java/net/httpclient/FilePublisher/SecureZipFSProvider.java b/test/jdk/java/net/httpclient/FilePublisher/SecureZipFSProvider.java deleted file mode 100644 index 00f532ba47c..00000000000 --- a/test/jdk/java/net/httpclient/FilePublisher/SecureZipFSProvider.java +++ /dev/null @@ -1,446 +0,0 @@ -/* - * Copyright (c) 2020, 2024, 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. - * - * 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. - */ - -import java.io.IOException; -import java.io.InputStream; -import java.net.URI; -import java.nio.channels.FileChannel; -import java.nio.channels.SeekableByteChannel; -import java.nio.file.AccessMode; -import java.nio.file.CopyOption; -import java.nio.file.DirectoryStream; -import java.nio.file.FileStore; -import java.nio.file.FileSystem; -import java.nio.file.LinkOption; -import java.nio.file.OpenOption; -import java.nio.file.Path; -import java.nio.file.PathMatcher; -import java.nio.file.ProviderMismatchException; -import java.nio.file.WatchEvent; -import java.nio.file.WatchKey; -import java.nio.file.WatchService; -import java.nio.file.attribute.BasicFileAttributes; -import java.nio.file.attribute.FileAttribute; -import java.nio.file.attribute.FileAttributeView; -import java.nio.file.attribute.UserPrincipalLookupService; -import java.nio.file.spi.FileSystemProvider; -import java.util.Iterator; -import java.util.Map; -import java.util.Set; -import java.util.concurrent.ConcurrentHashMap; - -public class SecureZipFSProvider extends FileSystemProvider { - private final ConcurrentHashMap map = - new ConcurrentHashMap<>(); - private final FileSystemProvider defaultProvider; - - public SecureZipFSProvider(FileSystemProvider provider) { - defaultProvider = provider; - } - - @Override - public String getScheme() { - return "jar"; - } - - public FileSystem newFileSystem(FileSystem fs) { - return map.computeIfAbsent(fs, (sfs) -> - new SecureZipFS(this, fs)); - } - - @Override - public FileSystem newFileSystem(URI uri, Map env) - throws IOException { - FileSystem fs = defaultProvider.newFileSystem(uri, env); - return map.computeIfAbsent(fs, (sfs) -> - new SecureZipFS(this, fs) - ); - } - - @Override - public FileSystem getFileSystem(URI uri) { - return map.get(defaultProvider.getFileSystem(uri)); - } - - @Override - public Path getPath(URI uri) { - Path p = defaultProvider.getPath(uri); - return map.get(defaultProvider.getFileSystem(uri)).wrap(p); - } - - @Override - public InputStream newInputStream(Path path, OpenOption... options) - throws IOException { - Path p = toTestPath(path).unwrap(); - return defaultProvider.newInputStream(p, options); - } - - @Override - public SeekableByteChannel newByteChannel(Path path, - Set options, - FileAttribute... attrs) - throws IOException { - Path p = toTestPath(path).unwrap(); - return defaultProvider.newByteChannel(p, options, attrs); - } - - @Override - public FileChannel newFileChannel(Path path, - Set options, - FileAttribute... attrs) - throws IOException { - Path p = toTestPath(path).unwrap(); - return defaultProvider.newFileChannel(p, options, attrs); - } - - - @Override - public DirectoryStream newDirectoryStream(Path dir, - DirectoryStream.Filter filter) { - throw new RuntimeException("not implemented"); - } - - @Override - public void createDirectory(Path dir, FileAttribute... attrs) - throws IOException { - Path p = toTestPath(dir).unwrap(); - defaultProvider.createDirectory(p, attrs); - } - - @Override - public void delete(Path path) throws IOException { - Path p = toTestPath(path).unwrap(); - defaultProvider.delete(p); - } - - @Override - public void copy(Path source, Path target, CopyOption... options) - throws IOException { - Path sp = toTestPath(source).unwrap(); - Path tp = toTestPath(target).unwrap(); - defaultProvider.copy(sp, tp, options); - } - - @Override - public void move(Path source, Path target, CopyOption... options) - throws IOException { - Path sp = toTestPath(source).unwrap(); - Path tp = toTestPath(target).unwrap(); - defaultProvider.move(sp, tp, options); - } - - @Override - public boolean isSameFile(Path path, Path path2) - throws IOException { - Path p = toTestPath(path).unwrap(); - Path p2 = toTestPath(path2).unwrap(); - return defaultProvider.isSameFile(p, p2); - } - - @Override - public boolean isHidden(Path path) throws IOException { - Path p = toTestPath(path).unwrap(); - return defaultProvider.isHidden(p); - } - - @Override - public FileStore getFileStore(Path path) throws IOException { - Path p = toTestPath(path).unwrap(); - return defaultProvider.getFileStore(p); - } - - @Override - public void checkAccess(Path path, AccessMode... modes) throws IOException { - Path p = toTestPath(path).unwrap(); - defaultProvider.checkAccess(p, modes); - } - - @Override - public V getFileAttributeView(Path path, - Class type, - LinkOption... options) { - Path p = toTestPath(path).unwrap(); - return defaultProvider.getFileAttributeView(p, type, options); - } - - @Override - public A readAttributes(Path path, - Class type, - LinkOption... options) - throws IOException { - Path p = toTestPath(path).unwrap(); - return defaultProvider.readAttributes(p, type, options); - } - - @Override - public Map readAttributes(Path path, - String attributes, - LinkOption... options) - throws IOException { - Path p = toTestPath(path).unwrap(); - return defaultProvider.readAttributes(p, attributes, options); - } - - @Override - public void setAttribute(Path path, String attribute, - Object value, LinkOption... options) - throws IOException { - Path p = toTestPath(path).unwrap(); - defaultProvider.setAttribute(p, attribute, options); - } - - // Checks that the given file is a TestPath - static TestPath toTestPath(Path obj) { - if (obj == null) - throw new NullPointerException(); - if (!(obj instanceof TestPath)) - throw new ProviderMismatchException(); - return (TestPath) obj; - } - - static class SecureZipFS extends FileSystem { - private final SecureZipFSProvider provider; - private final FileSystem delegate; - - public SecureZipFS(SecureZipFSProvider provider, FileSystem delegate) { - this.provider = provider; - this.delegate = delegate; - } - - Path wrap(Path path) { - return (path != null) ? new TestPath(this, path) : null; - } - - Path unwrap(Path wrapper) { - if (wrapper == null) - throw new NullPointerException(); - if (!(wrapper instanceof TestPath)) - throw new ProviderMismatchException(); - return ((TestPath) wrapper).unwrap(); - } - - @Override - public FileSystemProvider provider() { - return provider; - } - - @Override - public void close() throws IOException { - delegate.close(); - } - - @Override - public boolean isOpen() { - return delegate.isOpen(); - } - - @Override - public boolean isReadOnly() { - return delegate.isReadOnly(); - } - - @Override - public String getSeparator() { - return delegate.getSeparator(); - } - - @Override - public Iterable getRootDirectories() { - return delegate.getRootDirectories(); - } - - @Override - public Iterable getFileStores() { - return delegate.getFileStores(); - } - - @Override - public Set supportedFileAttributeViews() { - return delegate.supportedFileAttributeViews(); - } - - @Override - public Path getPath(String first, String... more) { - return wrap(delegate.getPath(first, more)); - } - - @Override - public PathMatcher getPathMatcher(String syntaxAndPattern) { - return delegate.getPathMatcher(syntaxAndPattern); - } - - @Override - public UserPrincipalLookupService getUserPrincipalLookupService() { - return delegate.getUserPrincipalLookupService(); - } - - @Override - public WatchService newWatchService() throws IOException { - return delegate.newWatchService(); - } - } - - static class TestPath implements Path { - private final SecureZipFS fs; - private final Path delegate; - - TestPath(SecureZipFS fs, Path delegate) { - this.fs = fs; - this.delegate = delegate; - } - - Path unwrap() { - return delegate; - } - - @Override - public SecureZipFS getFileSystem() { - return fs; - } - - @Override - public boolean isAbsolute() { - return delegate.isAbsolute(); - } - - @Override - public Path getRoot() { - return fs.wrap(delegate.getRoot()); - } - - @Override - public Path getFileName() { - return fs.wrap(delegate.getFileName()); - } - - @Override - public Path getParent() { - return fs.wrap(delegate.getParent()); - } - - @Override - public int getNameCount() { - return delegate.getNameCount(); - } - - @Override - public Path getName(int index) { - return fs.wrap(delegate.getName(index)); - } - - @Override - public Path subpath(int beginIndex, int endIndex) { - return fs.wrap(delegate.subpath(beginIndex, endIndex)); - } - - @Override - public boolean startsWith(Path other) { - return delegate.startsWith(other); - } - - @Override - public boolean endsWith(Path other) { - return delegate.endsWith(other); - } - - @Override - public Path normalize() { - return fs.wrap(delegate.normalize()); - } - - @Override - public Path resolve(Path other) { - return fs.wrap(delegate.resolve(fs.wrap(other))); - } - - @Override - public Path relativize(Path other) { - return fs.wrap(delegate.relativize(fs.wrap(other))); - } - - @Override - public URI toUri() { - String ssp = delegate.toUri().getSchemeSpecificPart(); - return URI.create(fs.provider().getScheme() + ":" + ssp); - } - - @Override - public Path toAbsolutePath() { - return fs.wrap(delegate.toAbsolutePath()); - } - - @Override - public Path toRealPath(LinkOption... options) throws IOException { - return fs.wrap(delegate.toRealPath(options)); - } - - @Override - public WatchKey register(WatchService watcher, - WatchEvent.Kind[] events, - WatchEvent.Modifier... modifiers) - throws IOException { - return delegate.register(watcher, events, modifiers); - } - - @Override - public Iterator iterator() { - final Iterator itr = delegate.iterator(); - return new Iterator<>() { - @Override - public boolean hasNext() { - return itr.hasNext(); - } - - @Override - public Path next() { - return fs.wrap(itr.next()); - } - - @Override - public void remove() { - itr.remove(); - } - }; - } - - @Override - public int compareTo(Path other) { - return delegate.compareTo(fs.unwrap(other)); - } - - @Override - public int hashCode() { - return delegate.hashCode(); - } - - @Override - public boolean equals(Object other) { - return other instanceof TestPath && delegate.equals(fs.unwrap((TestPath) other)); - } - - @Override - public String toString() { - return delegate.toString(); - } - } -} diff --git a/test/jdk/java/net/httpclient/FilePublisher/FilePublisherTest.java b/test/jdk/java/net/httpclient/FilePublisherTest.java similarity index 90% rename from test/jdk/java/net/httpclient/FilePublisher/FilePublisherTest.java rename to test/jdk/java/net/httpclient/FilePublisherTest.java index 8bb679a2e74..174afaf3f65 100644 --- a/test/jdk/java/net/httpclient/FilePublisher/FilePublisherTest.java +++ b/test/jdk/java/net/httpclient/FilePublisherTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2020, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2020, 2025, 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 @@ -23,9 +23,9 @@ /* * @test - * @bug 8235459 - * @summary Confirm that HttpRequest.BodyPublishers#ofFile(Path) - * assumes the default file system + * @bug 8235459 8358688 + * @summary Verifies `HttpRequest.BodyPublishers#ofFile(Path)` against file + * systems that support `Path#toFile()` and also those that don't * @library /test/lib /test/jdk/java/net/httpclient/lib * @build jdk.httpclient.test.lib.common.HttpServerAdapters * jdk.test.lib.net.SimpleSSLContext @@ -39,11 +39,10 @@ import org.testng.annotations.Test; import javax.net.ssl.SSLContext; +import java.io.FileNotFoundException; import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; -import java.net.InetAddress; -import java.net.InetSocketAddress; import java.net.URI; import java.net.http.HttpClient; import java.net.http.HttpRequest; @@ -61,6 +60,7 @@ import static java.net.http.HttpClient.Version.HTTP_1_1; import static java.net.http.HttpClient.Version.HTTP_2; import static org.testng.Assert.assertEquals; +import static org.testng.Assert.fail; public class FilePublisherTest implements HttpServerAdapters { SSLContext sslContext; @@ -156,6 +156,26 @@ public void testZipFs(String uriString, send(uriString, path, expectedMsg, sameClient); } + @Test + public void testFileNotFound() throws Exception { + out.printf("\n\n--- testFileNotFound(): starting\n"); + try (FileSystem fs = newZipFs()) { + Path fileInZip = fs.getPath("non-existent.txt"); + BodyPublishers.ofFile(fileInZip); + fail(); + } catch (FileNotFoundException e) { + out.println("Caught expected: " + e); + } + var path = Path.of("fileNotFound.txt"); + try { + Files.deleteIfExists(path); + BodyPublishers.ofFile(path); + fail(); + } catch (FileNotFoundException e) { + out.println("Caught expected: " + e); + } + } + private static final int ITERATION_COUNT = 3; private void send(String uriString, @@ -193,9 +213,6 @@ public void setup() throws Exception { zipFs = newZipFs(); zipFsPath = zipFsFile(zipFs); - InetSocketAddress sa = - new InetSocketAddress(InetAddress.getLoopbackAddress(), 0); - httpTestServer = HttpServerAdapters.HttpTestServer.create(HTTP_1_1); httpTestServer.addHandler(new HttpEchoHandler(), "/http1/echo"); httpURI = "http://" + httpTestServer.serverAuthority() + "/http1/echo"; diff --git a/test/jdk/java/net/httpclient/HttpClientAuthRetryLimitTest.java b/test/jdk/java/net/httpclient/HttpClientAuthRetryLimitTest.java new file mode 100644 index 00000000000..818fd8c7a01 --- /dev/null +++ b/test/jdk/java/net/httpclient/HttpClientAuthRetryLimitTest.java @@ -0,0 +1,134 @@ +/* + * Copyright (c) 2025, 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. + * + * 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. + */ + + +/* + * @test + * @bug 8340182 + * @summary Auth retry limit system property + * @library /test/lib /test/jdk/java/net/httpclient/lib + * @build jdk.httpclient.test.lib.http2.Http2TestServer + * @run junit HttpClientAuthRetryLimitTest + * @run junit/othervm -Djdk.httpclient.auth.retrylimit=1 HttpClientAuthRetryLimitTest + * @run junit/othervm -Djdk.httpclient.auth.retrylimit=0 HttpClientAuthRetryLimitTest + * @run junit/othervm -Djdk.httpclient.auth.retrylimit=-1 HttpClientAuthRetryLimitTest + */ + +import jdk.httpclient.test.lib.common.HttpServerAdapters; +import jdk.test.lib.net.SimpleSSLContext; +import org.junit.jupiter.params.ParameterizedTest; +import org.junit.jupiter.params.provider.Arguments; +import org.junit.jupiter.params.provider.MethodSource; + +import javax.net.ssl.SSLContext; +import java.io.IOException; +import java.net.Authenticator; +import java.net.PasswordAuthentication; +import java.net.URI; +import java.net.http.HttpClient; +import java.net.http.HttpRequest; +import java.net.http.HttpResponse; +import java.util.concurrent.atomic.AtomicInteger; +import java.util.stream.Stream; + +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertThrows; + +class HttpClientAuthRetryLimitTest implements HttpServerAdapters { + + private static final SSLContext SSL_CONTEXT = createSslContext(); + + private static SSLContext createSslContext() { + try { + return new SimpleSSLContext().get(); + } catch (IOException exception) { + throw new RuntimeException(exception); + } + } + + // This is the system default value for jdk.httpclient.auth.retrylimit + private static final int DEFAULT_RETRY_LIMIT = 3; + private static final int RETRY_LIMIT = Integer.getInteger( + "jdk.httpclient.auth.retrylimit", DEFAULT_RETRY_LIMIT); + + private static Stream args() { + return Stream.of( + HttpClient.Version.HTTP_1_1, + HttpClient.Version.HTTP_2) + .flatMap(version -> Stream + .of(false, true) + .map(secure -> Arguments.of(version, secure))); + } + + private static HttpClient.Builder createClient(boolean secure) { + HttpClient.Builder builder = HttpClient.newBuilder(); + if (secure) { + builder.sslContext(SSL_CONTEXT); + } + return builder; + } + + @ParameterizedTest + @MethodSource("args") + void testDefaultSystemProperty(HttpClient.Version version, boolean secure) throws Exception { + + AtomicInteger requestCount = new AtomicInteger(0); + + try (HttpTestServer httpTestServer = ((secure)? HttpTestServer.create( + version, SSL_CONTEXT): HttpTestServer.create(version))) { + final String requestUriScheme = secure ? "https" : "http"; + final String requestPath = "/" + this.getClass().getSimpleName() + "/"; + final String uriString = "://" + httpTestServer.serverAuthority() + requestPath; + final URI requestUri = URI.create(requestUriScheme + uriString); + + HttpTestHandler httpTestHandler = t -> { + t.getResponseHeaders() + .addHeader("WWW-Authenticate", "Basic realm=\"Test\""); + t.sendResponseHeaders(401,0); + }; + + httpTestServer.addHandler(httpTestHandler, requestPath); + httpTestServer.start(); + try ( + HttpClient client = createClient(secure) + .authenticator(new Authenticator() { + @Override + protected PasswordAuthentication getPasswordAuthentication() { + requestCount.incrementAndGet(); + return new PasswordAuthentication("username", "password".toCharArray()); + } + }) + .build()) { + HttpRequest request = HttpRequest.newBuilder().version(version) + .GET() + .uri(requestUri) + .build(); + IOException exception = assertThrows(IOException.class, () -> client.send( + request, HttpResponse.BodyHandlers.discarding())); + assertEquals("too many authentication attempts. Limit: " + RETRY_LIMIT, exception.getMessage()); + int totalRequestCount = requestCount.get(); + assertEquals(totalRequestCount, Math.max(RETRY_LIMIT, 0) + 1); + } + } + } +} diff --git a/test/jdk/java/net/httpclient/RelayingPublishers.java b/test/jdk/java/net/httpclient/RelayingPublishers.java index c97d09df352..83d74cd13ae 100644 --- a/test/jdk/java/net/httpclient/RelayingPublishers.java +++ b/test/jdk/java/net/httpclient/RelayingPublishers.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2019, 2025, 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 @@ -42,7 +42,7 @@ * @test * @summary Verifies that some of the standard BodyPublishers relay exception * rather than throw it - * @bug 8226303 + * @bug 8226303 8358688 * @library /test/lib * @run testng/othervm RelayingPublishers */ diff --git a/test/jdk/java/nio/Buffer/AllocateDirectInit.java b/test/jdk/java/nio/Buffer/AllocateDirectInit.java index c54536df8ba..472187fdcda 100644 --- a/test/jdk/java/nio/Buffer/AllocateDirectInit.java +++ b/test/jdk/java/nio/Buffer/AllocateDirectInit.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2007, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2025, 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 @@ -23,29 +23,60 @@ /** * @test - * @bug 4490253 6535542 + * @bug 4490253 6535542 8357959 + * @key randomness + * @library /test/lib + * @build jdk.test.lib.RandomFactory * @summary Verify that newly allocated direct buffers are initialized. + * @run main/othervm AllocateDirectInit */ import java.nio.ByteBuffer; +import java.util.Random; + +import jdk.test.lib.RandomFactory; public class AllocateDirectInit { + private static final int MAX_BIN_LIMIT = 16 * 1024 * 1024; + private static final int MAX_DEC_LIMIT = 10 * 1000 * 1000; + private static final int TRIES_PER_LIMIT = 1024; + + private static final Random RND = RandomFactory.getRandom(); + public static void main(String [] args){ - for (int i = 0; i < 1024; i++) { - ByteBuffer bb = ByteBuffer.allocateDirect(1024); -// printByteBuffer(bb); - for (bb.position(0); bb.position() < bb.limit(); ) { - if ((bb.get() & 0xff) != 0) - throw new RuntimeException("uninitialized buffer, position = " - + bb.position()); + // Try power of two limits + for (int limit = 1; limit < MAX_BIN_LIMIT; limit *= 2) { + check(ByteBuffer.allocateDirect(limit - 1)); + check(ByteBuffer.allocateDirect(limit)); + check(ByteBuffer.allocateDirect(limit + 1)); + } + + // Try power of ten limits + for (int limit = 1; limit < MAX_DEC_LIMIT; limit *= 10) { + check(ByteBuffer.allocateDirect(limit - 1)); + check(ByteBuffer.allocateDirect(limit)); + check(ByteBuffer.allocateDirect(limit + 1)); + } + + // Try random sizes within power of two limits + for (int limit = 1; limit < MAX_BIN_LIMIT; limit *= 2) { + for (int t = 0; t < TRIES_PER_LIMIT; t++) { + check(ByteBuffer.allocateDirect(RND.nextInt(limit))); } } } - private static void printByteBuffer(ByteBuffer bb) { - System.out.print("byte ["); - for (bb.position(0); bb.position() < bb.limit(); ) - System.out.print(" " + Integer.toHexString(bb.get() & 0xff)); - System.out.println(" ]"); + private static void check(ByteBuffer bb) { + while (bb.hasRemaining()) { + if (bb.get() != 0) { + int mismatchPos = bb.position(); + System.out.print("byte ["); + for (bb.position(0); bb.position() < bb.limit(); ) { + System.out.print(" " + Integer.toHexString(bb.get() & 0xff)); + } + System.out.println(" ]"); + throw new RuntimeException("uninitialized buffer, position = " + mismatchPos); + } + } } } diff --git a/test/jdk/java/nio/channels/AsynchronousFileChannel/Basic.java b/test/jdk/java/nio/channels/AsynchronousFileChannel/Basic.java index bb3cf92ac01..ddd4eeddbc6 100644 --- a/test/jdk/java/nio/channels/AsynchronousFileChannel/Basic.java +++ b/test/jdk/java/nio/channels/AsynchronousFileChannel/Basic.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2008, 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2008, 2025, 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 @@ -25,6 +25,7 @@ * @bug 4607272 5041655 6822643 6830721 6842687 * @summary Unit test for AsynchronousFileChannel * @key randomness + * @run main/othervm Basic */ import java.io.File; @@ -565,12 +566,19 @@ static void testTruncate(Path file) throws IOException { static ByteBuffer genBuffer() { int size = 1024 + rand.nextInt(16000); byte[] buf = new byte[size]; - return switch (rand.nextInt(3)) { + rand.nextBytes(buf); + return switch (rand.nextInt(5)) { case 0 -> ByteBuffer.allocateDirect(buf.length) .put(buf) .flip(); case 1 -> ByteBuffer.wrap(buf); - case 2 -> Arena.ofAuto().allocate(buf.length).asByteBuffer() + case 2 -> Arena.global().allocate(buf.length).asByteBuffer() + .put(buf) + .flip(); + case 3 -> Arena.ofAuto().allocate(buf.length).asByteBuffer() + .put(buf) + .flip(); + case 4 -> Arena.ofShared().allocate(buf.length).asByteBuffer() .put(buf) .flip(); default -> throw new InternalError("Should not reach here"); @@ -606,7 +614,7 @@ public void failed(Throwable exc, Long position) { static void readAll(final AsynchronousFileChannel ch, final ByteBuffer dst, - long position) + long position) { final CountDownLatch latch = new CountDownLatch(1); diff --git a/test/jdk/java/nio/channels/DatagramChannel/AdaptorMulticasting.java b/test/jdk/java/nio/channels/DatagramChannel/AdaptorMulticasting.java index cab2bc76285..4cb9be7efe9 100644 --- a/test/jdk/java/nio/channels/DatagramChannel/AdaptorMulticasting.java +++ b/test/jdk/java/nio/channels/DatagramChannel/AdaptorMulticasting.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2020, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2020, 2025, 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 @@ -327,39 +327,27 @@ static void testNetworkInterface(MulticastSocket s, } /** - * Test getTimeToLive/setTimeToLive/getTTL/getTTL and IP_MULTICAST_TTL socket + * Test getTimeToLive/setTimeToLive and IP_MULTICAST_TTL socket * option. */ static void testTimeToLive(MulticastSocket s) throws IOException { // should be 1 by default assertTrue(s.getTimeToLive() == 1); - assertTrue(s.getTTL() == 1); assertTrue(s.getOption(IP_MULTICAST_TTL) == 1); // setTimeToLive for (int ttl = 0; ttl <= 2; ttl++) { s.setTimeToLive(ttl); assertTrue(s.getTimeToLive() == ttl); - assertTrue(s.getTTL() == ttl); assertTrue(s.getOption(IP_MULTICAST_TTL) == ttl); } assertThrows(IllegalArgumentException.class, () -> s.setTimeToLive(-1)); - // setTTL - for (byte ttl = (byte) -2; ttl <= 2; ttl++) { - s.setTTL(ttl); - assertTrue(s.getTTL() == ttl); - int intValue = Byte.toUnsignedInt(ttl); - assertTrue(s.getTimeToLive() == intValue); - assertTrue(s.getOption(IP_MULTICAST_TTL) == intValue); - } - // setOption(IP_MULTICAST_TTL) for (int ttl = 0; ttl <= 2; ttl++) { s.setOption(IP_MULTICAST_TTL, ttl); assertTrue(s.getOption(IP_MULTICAST_TTL) == ttl); assertTrue(s.getTimeToLive() == ttl); - assertTrue(s.getTTL() == ttl); } // bad values for IP_MULTICAST_TTL @@ -419,7 +407,7 @@ static void testSendReceive(MulticastSocket s, InetAddress group) throws IOExcep // send message to multicast group DatagramPacket p = new DatagramPacket(message, message.length); p.setSocketAddress(target); - s.send(p, (byte) 1); + s.send(p); // receive message s.setSoTimeout(0); @@ -463,7 +451,7 @@ static void testSendNoReceive(MulticastSocket s, InetAddress group) throws IOExc // send datagram to multicast group DatagramPacket p = new DatagramPacket(message, message.length); p.setSocketAddress(target); - s.send(p, (byte) 1); + s.send(p); // datagram should not be received s.setSoTimeout(500); diff --git a/test/jdk/java/nio/channels/DatagramChannel/PromiscuousIPv6.java b/test/jdk/java/nio/channels/DatagramChannel/PromiscuousIPv6.java index b7bbba8e16b..6915ee247d1 100644 --- a/test/jdk/java/nio/channels/DatagramChannel/PromiscuousIPv6.java +++ b/test/jdk/java/nio/channels/DatagramChannel/PromiscuousIPv6.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018, 2025, 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 @@ -30,6 +30,7 @@ * PromiscuousIPv6 * @run main PromiscuousIPv6 * @key randomness + * @requires (os.family == "linux") | (os.family == "mac") */ import java.nio.ByteBuffer; @@ -201,26 +202,15 @@ static void test(ProtocolFamily family, } } - /* - * returns true if platform allows an IPv6 socket join an IPv4 multicast group - */ - private static boolean supportedByPlatform() { - return Platform.isOSX() || Platform.isLinux(); - } - public static void main(String[] args) throws IOException { boolean hasIPV6MulticastAll; - if (!supportedByPlatform()) { - throw new SkippedException("This test should not be run on this platform"); - } else { - int major = Platform.getOsVersionMajor(); - int minor = Platform.getOsVersionMinor(); - hasIPV6MulticastAll = - Platform.isOSX() || - (Platform.isLinux() && ((major > 4) || ((major == 4 && minor >= 20)))); - } + int major = Platform.getOsVersionMajor(); + int minor = Platform.getOsVersionMinor(); + hasIPV6MulticastAll = + Platform.isOSX() || + (Platform.isLinux() && ((major > 4) || ((major == 4 && minor >= 20)))); NetworkConfiguration.printSystemConfiguration(System.out); List nifs = NetworkConfiguration.probe() diff --git a/test/jdk/java/nio/channels/SocketChannel/PeerReadsAfterAsyncClose.java b/test/jdk/java/nio/channels/SocketChannel/PeerReadsAfterAsyncClose.java new file mode 100644 index 00000000000..2b6a6edf1d4 --- /dev/null +++ b/test/jdk/java/nio/channels/SocketChannel/PeerReadsAfterAsyncClose.java @@ -0,0 +1,195 @@ +/* + * Copyright (c) 2025, 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. + * + * 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. + */ + +/* + * @test + * @bug 8358764 + * @summary Test closing a socket while a thread is blocked in read. The connection + * should be closed gracefuly so that the peer reads EOF. + * @run junit PeerReadsAfterAsyncClose + */ + +import java.io.IOException; +import java.net.InetAddress; +import java.net.InetSocketAddress; +import java.net.ServerSocket; +import java.net.Socket; +import java.net.SocketException; +import java.nio.ByteBuffer; +import java.nio.channels.ClosedChannelException; +import java.nio.channels.SocketChannel; +import java.util.Arrays; +import java.util.Objects; +import java.util.concurrent.ThreadFactory; +import java.util.concurrent.atomic.AtomicBoolean; +import java.util.stream.Stream; + +import org.junit.jupiter.params.ParameterizedTest; +import org.junit.jupiter.params.provider.MethodSource; +import static org.junit.jupiter.api.Assertions.*; + +class PeerReadsAfterAsyncClose { + + static Stream factories() { + return Stream.of(Thread.ofPlatform().factory(), Thread.ofVirtual().factory()); + } + + /** + * Close SocketChannel while a thread is blocked reading from the channel's socket. + */ + @ParameterizedTest + @MethodSource("factories") + void testCloseDuringSocketChannelRead(ThreadFactory factory) throws Exception { + var loopback = InetAddress.getLoopbackAddress(); + try (var listener = new ServerSocket()) { + listener.bind(new InetSocketAddress(loopback, 0)); + + try (SocketChannel sc = SocketChannel.open(listener.getLocalSocketAddress()); + Socket peer = listener.accept()) { + + // start thread to read from channel + var cceThrown = new AtomicBoolean(); + Thread thread = factory.newThread(() -> { + try { + sc.read(ByteBuffer.allocate(1)); + fail(); + } catch (ClosedChannelException e) { + cceThrown.set(true); + } catch (Throwable e) { + e.printStackTrace(); + } + }); + thread.start(); + try { + // close SocketChannel when thread sampled in implRead + onReach(thread, "sun.nio.ch.SocketChannelImpl.implRead", () -> { + try { + sc.close(); + } catch (IOException ignore) { } + }); + + // peer should read EOF + int n = peer.getInputStream().read(); + assertEquals(-1, n); + } finally { + thread.join(); + } + assertEquals(true, cceThrown.get(), "ClosedChannelException not thrown"); + } + } + } + + /** + * Close Socket while a thread is blocked reading from the socket. + */ + @ParameterizedTest + @MethodSource("factories") + void testCloseDuringSocketUntimedRead(ThreadFactory factory) throws Exception { + testCloseDuringSocketRead(factory, 0); + } + + /** + * Close Socket while a thread is blocked reading from the socket with a timeout. + */ + @ParameterizedTest + @MethodSource("factories") + void testCloseDuringSockeTimedRead(ThreadFactory factory) throws Exception { + testCloseDuringSocketRead(factory, 60_000); + } + + private void testCloseDuringSocketRead(ThreadFactory factory, int timeout) throws Exception { + var loopback = InetAddress.getLoopbackAddress(); + try (var listener = new ServerSocket()) { + listener.bind(new InetSocketAddress(loopback, 0)); + + try (Socket s = new Socket(loopback, listener.getLocalPort()); + Socket peer = listener.accept()) { + + // start thread to read from socket + var seThrown = new AtomicBoolean(); + Thread thread = factory.newThread(() -> { + try { + s.setSoTimeout(timeout); + s.getInputStream().read(); + fail(); + } catch (SocketException e) { + seThrown.set(true); + } catch (Throwable e) { + e.printStackTrace(); + } + }); + thread.start(); + try { + // close Socket when thread sampled in implRead + onReach(thread, "sun.nio.ch.NioSocketImpl.implRead", () -> { + try { + s.close(); + } catch (IOException ignore) { } + }); + + // peer should read EOF + int n = peer.getInputStream().read(); + assertEquals(-1, n); + } finally { + thread.join(); + } + assertEquals(true, seThrown.get(), "SocketException not thrown"); + } + } + } + + /** + * Runs the given action when the given target thread is sampled at the given + * location. The location takes the form "{@code c.m}" where + * {@code c} is the fully qualified class name and {@code m} is the method name. + */ + private void onReach(Thread target, String location, Runnable action) { + int index = location.lastIndexOf('.'); + String className = location.substring(0, index); + String methodName = location.substring(index + 1); + Thread.ofPlatform().daemon(true).start(() -> { + try { + boolean found = false; + while (!found) { + found = contains(target.getStackTrace(), className, methodName); + if (!found) { + Thread.sleep(20); + } + } + action.run(); + } catch (Exception e) { + e.printStackTrace(); + } + }); + } + + /** + * Returns true if the given stack trace contains an element for the given class + * and method name. + */ + private boolean contains(StackTraceElement[] stack, String className, String methodName) { + return Arrays.stream(stack) + .anyMatch(e -> className.equals(e.getClassName()) + && methodName.equals(e.getMethodName())); + } +} \ No newline at end of file diff --git a/test/jdk/java/nio/channels/etc/MemorySegments.java b/test/jdk/java/nio/channels/etc/MemorySegments.java index 77da11759c7..5f6b0114d50 100644 --- a/test/jdk/java/nio/channels/etc/MemorySegments.java +++ b/test/jdk/java/nio/channels/etc/MemorySegments.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2024, 2025, 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 @@ -23,10 +23,10 @@ /* * @test - * @bug 8333849 - * @summary Test ByteChannel implementations of read and write with ByteBuffers that are - * backed by MemorySegments allocated from an Arena - * @run junit MemorySegments + * @bug 8333849 8358958 + * @summary Test ByteChannel and AsycnhronousByteChannel implementations with ByteBuffers + * that are views of a MemorySegment + * @run junit/othervm MemorySegments */ import java.io.IOException; @@ -35,6 +35,10 @@ import java.net.InetSocketAddress; import java.net.SocketAddress; import java.nio.ByteBuffer; +import java.nio.channels.AsynchronousFileChannel; +import java.nio.channels.AsynchronousServerSocketChannel; +import java.nio.channels.AsynchronousSocketChannel; +import java.nio.channels.CompletionHandler; import java.nio.channels.DatagramChannel; import java.nio.channels.FileChannel; import java.nio.channels.ServerSocketChannel; @@ -42,10 +46,15 @@ import java.nio.file.Files; import java.nio.file.Path; import java.util.Random; +import java.util.concurrent.CountDownLatch; +import java.util.concurrent.ExecutionException; +import java.util.concurrent.Future; +import java.util.concurrent.TimeUnit; import java.util.function.Supplier; import java.util.stream.Stream; import static java.nio.file.StandardOpenOption.*; +import org.junit.jupiter.api.RepeatedTest; import org.junit.jupiter.params.ParameterizedTest; import org.junit.jupiter.params.provider.MethodSource; import static org.junit.jupiter.api.Assertions.*; @@ -325,6 +334,177 @@ void testDatagramChannelScatteringRead(Supplier arenaSupplier) throws IOE } } + /** + * AsynchronousSocketChannel read/write(ByteBuffer). + */ + @ParameterizedTest + @MethodSource("arenaSuppliers") + void testAsyncSocketChannelReadWrite(Supplier arenaSupplier) throws Exception { + boolean shared = isShared(arenaSupplier); + boolean confined = isConfined(arenaSupplier); + Arena arena = arenaSupplier.get(); + + try (var listener = AsynchronousServerSocketChannel.open(); + AsynchronousSocketChannel ch1 = AsynchronousSocketChannel.open()) { + listener.bind(new InetSocketAddress(InetAddress.getLoopbackAddress(), 0)); + + ch1.connect(listener.getLocalAddress()).get(); + try (AsynchronousSocketChannel ch2 = listener.accept().get()) { + ByteBuffer dst = arena.allocate(SIZE + 100).asByteBuffer(); + ByteBuffer src = arena.allocate(SIZE).asByteBuffer(); + fillRandom(src); + + if (confined) { + // read and write should fail with IAE + assertThrows(IllegalArgumentException.class, () -> ch1.read(dst)); + assertThrows(IllegalArgumentException.class, () -> ch2.write(src)); + } else { + // async read + Future readTask = ch1.read(dst); + + // shared arena cannot be closed while read in progress + if (shared) { + assertThrows(IllegalStateException.class, arena::close); + } + + // async write + Future writeTask = ch2.write(src); + + // finish write + int nwritten = writeTask.get(); + assertTrue(nwritten > 0); + assertTrue(nwritten <= SIZE); + assertEquals(nwritten, src.position()); + + // finish read + int nread = readTask.get(); + assertTrue(nread > 0); + assertTrue(nread <= nwritten); + assertEquals(nread, dst.position()); + + // check contents + dst.flip(); + assertEquals(src.slice(0, nread), dst); + } + } + } finally { + tryClose(arena); + } + } + + /** + * AsynchronousSocketChannel write(ByteBuffer[]). + */ + @ParameterizedTest + @MethodSource("arenaSuppliers") + void testAsyncSocketChannelGatheringWrite(Supplier arenaSupplier) throws Throwable { + boolean confined = isConfined(arenaSupplier); + Arena arena = arenaSupplier.get(); + + try (var listener = AsynchronousServerSocketChannel.open(); + AsynchronousSocketChannel ch1 = AsynchronousSocketChannel.open()) { + listener.bind(new InetSocketAddress(InetAddress.getLoopbackAddress(), 0)); + + ch1.connect(listener.getLocalAddress()).get(); + try (AsynchronousSocketChannel ch2 = listener.accept().get()) { + + ByteBuffer src = arena.allocate(SIZE * 2).asByteBuffer(); + fillRandom(src); + ByteBuffer src1 = src.slice(0, SIZE); + ByteBuffer src2 = src.slice(SIZE, SIZE); + var srcs = new ByteBuffer[] { src1, src2 }; + + var writeHandler = new Handler(); + if (confined) { + assertThrows(IllegalArgumentException.class, + () -> ch1.write(srcs, 0, 2, 0, TimeUnit.SECONDS, null, writeHandler)); + } else { + // async gathering write + ch1.write(srcs, 0, 2, 0, TimeUnit.SECONDS, null, writeHandler); + + // finish gathering write + int nwritten = (int) (long) writeHandler.join(); + assertTrue(nwritten > 0); + assertEquals(Math.min(nwritten, SIZE), src1.position()); + assertEquals(nwritten, src1.position() + src2.position()); + + // async read + finish read + ByteBuffer dst = arena.allocate(SIZE * 2 + 50).asByteBuffer(); + int nread = ch2.read(dst).get(); + assertTrue(nread > 0); + assertTrue(nread <= nwritten); + assertEquals(nread, dst.position()); + + // check contents + dst.flip(); + assertEquals(src.slice(0, nread), dst); + } + } + } finally { + tryClose(arena); + } + } + + /** + * AsynchronousSocketChannel read(ByteBuffer[]). + */ + @ParameterizedTest + @MethodSource("arenaSuppliers") + void testAsyncSocketChannelScatteringRead(Supplier arenaSupplier) throws Throwable { + boolean shared = isShared(arenaSupplier); + boolean confined = isConfined(arenaSupplier); + Arena arena = arenaSupplier.get(); + + try (var listener = AsynchronousServerSocketChannel.open(); + AsynchronousSocketChannel ch1 = AsynchronousSocketChannel.open()) { + listener.bind(new InetSocketAddress(InetAddress.getLoopbackAddress(), 0)); + + ch1.connect(listener.getLocalAddress()).get(); + try (AsynchronousSocketChannel ch2 = listener.accept().get()) { + + ByteBuffer dst = arena.allocate(SIZE + 50).asByteBuffer(); + ByteBuffer dst1 = dst.slice(0, 50); + ByteBuffer dst2 = dst.slice(50, dst.capacity() - 50); + var dsts = new ByteBuffer[]{dst1, dst2}; + var readHandler = new Handler(); + + if (confined) { + assertThrows(IllegalArgumentException.class, + () -> ch1.read(dsts, 0, 2, 0, TimeUnit.SECONDS, null, readHandler)); + } else { + // async scattering read + ch1.read(dsts, 0, 2, 0, TimeUnit.SECONDS, null, readHandler); + + // shared arena cannot be closed while read in progress + if (shared) { + assertThrows(IllegalStateException.class, arena::close); + } + + // async write + finish write + ByteBuffer src = arena.allocate(SIZE).asByteBuffer(); + fillRandom(src); + int nwritten = ch2.write(src).get(); + assertTrue(nwritten > 0); + assertTrue(nwritten <= SIZE); + assertEquals(nwritten, src.position()); + + // finish scattering read + int nread = (int) (long) readHandler.join(); + assertTrue(nread > 0); + assertTrue(nread <= nwritten); + assertTrue(dst1.position() > 0); + assertEquals(nread, dst1.position() + dst2.position()); + + // check contents + src.flip(); + assertEquals(src, dst.slice(0, nread)); + } + } + } finally { + tryClose(arena); + } + } + /** * FileChannel read/write(ByteBuffer). */ @@ -467,6 +647,127 @@ void testFileChannelScatteringRead(Supplier arenaSupplier) throws IOExcep } } + /** + * AsynchronousFileChannel read/write(ByteBuffer). + */ + @ParameterizedTest + @MethodSource("arenaSuppliers") + void testAsyncFileChannelReadWrite(Supplier arenaSupplier) throws Throwable { + boolean confined = isConfined(arenaSupplier); + Arena arena = arenaSupplier.get(); + + Path file = Files.createTempFile(Path.of(""), "foo", ".dat"); + try (AsynchronousFileChannel ch = AsynchronousFileChannel.open(file, READ, WRITE)) { + ByteBuffer dst = arena.allocate(SIZE + 100).asByteBuffer(); + ByteBuffer src = arena.allocate(SIZE).asByteBuffer(); + fillRandom(src); + + if (confined) { + // read and write should fail with IAE + assertThrows(IllegalArgumentException.class, () -> ch.read(dst, 0L)); + assertThrows(IllegalArgumentException.class, () -> ch.write(src, 0L)); + } else { + // async write + Future writeTask = ch.write(src, 0L); + + // finish write + int nwritten = writeTask.get(); + assertTrue(nwritten > 0); + assertTrue(nwritten <= SIZE); + assertEquals(nwritten, src.position()); + + // async read + Future readTask = ch.read(dst, 0L); + + // finish read + int nread = readTask.get(); + assertTrue(nread > 0); + assertTrue(nread <= nwritten); + assertEquals(nread, dst.position()); + + // check contents + dst.flip(); + assertEquals(src.slice(0, nread), dst); + } + } finally { + tryClose(arena); + } + } + + /** + * Test closing a shared arena while AsynchronousFileChannel.write in progress. + */ + @RepeatedTest(20) + void testAsyncFileChannelWriteRacingArenaClose() throws Exception { + Path file = Files.createTempFile(Path.of(""), "foo", ".dat"); + + // use SYNC option to cause write operation to be slow + try (AsynchronousFileChannel ch = AsynchronousFileChannel.open(file, READ, WRITE, SYNC)) { + Arena arena = Arena.ofShared(); + boolean closed = false; + try { + ByteBuffer src = arena.allocate(SIZE).asByteBuffer(); + fillRandom(src); + + // need copy of source buffer so that writing can be tested after arena is closed + ByteBuffer srcCopy = copyOf(src); + + // async write + Future writeTask = ch.write(src, 0L); + + // attempt to close arena, races with write operation + try { + arena.close(); + closed = true; + } catch (IllegalStateException e) { + // in use + } + + // finish write + int nwritten = writeTask.get(); + assertTrue(nwritten > 0); + assertTrue(nwritten <= SIZE); + + // read and check contents + ByteBuffer dst = ByteBuffer.allocate(SIZE + 100); + int nread = ch.read(dst, 0L).get(); + dst.flip(); + assertEquals(srcCopy.slice(0, nread), dst); + } finally { + if (!closed) { + arena.close(); + } + } + } + } + + /** + * CompletionHandler with a join method to wait for operation to complete. + */ + private static class Handler implements CompletionHandler { + volatile V result; + volatile Throwable ex; + final CountDownLatch latch = new CountDownLatch(1); + @Override + public void completed(V result, Void att) { + this.result = result; + latch.countDown(); + } + @Override + public void failed(Throwable ex, Void att) { + this.ex = ex; + latch.countDown(); + } + V join() throws ExecutionException, InterruptedException { + latch.await(); + Throwable ex = this.ex; + if (ex != null) { + throw new ExecutionException(ex); + } + return result; + } + } + /** * Fill the buffer with random bytes. */ @@ -479,6 +780,42 @@ private void fillRandom(ByteBuffer bb) { bb.position(pos); } + /** + * Return a copy of a buffer. + */ + private ByteBuffer copyOf(ByteBuffer buf) { + ByteBuffer copy = ByteBuffer.allocate(buf.capacity()); + buf.put(copy); + buf.flip(); + copy.flip(); + assertEquals(buf, copy); + return copy; + } + + /** + * Returns true if the supplier produces shared arenas. + */ + private boolean isShared(Supplier arenaSupplier) { + if (!isConfined(arenaSupplier)) { + try { + arenaSupplier.get().close(); + return true; + } catch (UnsupportedOperationException e) { } + } + // confined or non-closeable + return false; + } + + /** + * Returns true if the supplier produces thread-confined arenas. + */ + private boolean isConfined(Supplier arenaSupplier) { + Arena arena = arenaSupplier.get(); + boolean confined = !arena.allocate(0).isAccessibleBy(new Thread()); + tryClose(arena); + return confined; + } + /** * Attempt to close the given Arena. */ @@ -490,5 +827,4 @@ private boolean tryClose(Arena arena) { return false; } } - } diff --git a/test/jdk/java/nio/charset/spi/CharsetTest.java b/test/jdk/java/nio/charset/spi/CharsetTest.java index 4ac3d14b1d3..c6932d36bd7 100644 --- a/test/jdk/java/nio/charset/spi/CharsetTest.java +++ b/test/jdk/java/nio/charset/spi/CharsetTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2010, 2017, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2010, 2025, 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 @@ -21,6 +21,7 @@ * questions. */ +import java.io.ByteArrayInputStream; import java.io.InputStreamReader; import java.io.PrintStream; import java.nio.charset.Charset; @@ -72,8 +73,10 @@ private static void testNegative(String csn) { public static void main(String [] args) { - out.println("Default: " - + new InputStreamReader(System.in).getEncoding()); + for (String property : new String[]{"stdin.encoding", "stdout.encoding", "stderr.encoding"}) { + String name = System.getProperty(property); + out.printf("%s: %s (%s)%n", property, name, Charset.forName(name)); + } out.print("Available:"); for (Iterator i = available.keySet().iterator(); i.hasNext();) diff --git a/test/jdk/java/util/Calendar/JapaneseCalendarNameTest.java b/test/jdk/java/util/Calendar/JapaneseCalendarNameTest.java new file mode 100644 index 00000000000..6c8597c9404 --- /dev/null +++ b/test/jdk/java/util/Calendar/JapaneseCalendarNameTest.java @@ -0,0 +1,108 @@ +/* + * Copyright (c) 2018, 2025, 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. + * + * 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. + */ + +/* + * @test + * @bug 8202088 8207152 8217609 8219890 8358819 + * @summary Test the localized Japanese calendar names, such as + * the Reiwa Era names (May 1st. 2019-), or the Gan-nen text + * @modules jdk.localedata + * @run junit JapaneseCalendarNameTest + */ + +import static java.util.Calendar.*; +import static java.util.Locale.*; + +import java.text.DateFormat; +import java.text.ParseException; +import java.util.Calendar; +import java.util.Locale; +import java.util.stream.Stream; + +import org.junit.jupiter.params.ParameterizedTest; +import org.junit.jupiter.params.provider.Arguments; +import org.junit.jupiter.params.provider.MethodSource; + +import static org.junit.jupiter.api.Assertions.assertEquals; + +public class JapaneseCalendarNameTest { + private static final Calendar c = new Calendar.Builder() + .setCalendarType("japanese") + .setFields(ERA, 5, YEAR, 1, MONTH, MAY, DAY_OF_MONTH, 1) + .build(); + private static final Locale JAJPJP = Locale.of("ja", "JP", "JP"); + private static final Locale JCAL = Locale.forLanguageTag("ja-u-ca-japanese"); + + private static Stream reiwaEraNames() { + return Stream.of( + // type, locale, name + Arguments.of(LONG, JAPAN, "令和"), + Arguments.of(LONG, US, "Reiwa"), + Arguments.of(LONG, CHINA, "令和"), + Arguments.of(SHORT, JAPAN, "令和"), + Arguments.of(SHORT, US, "Reiwa"), + Arguments.of(SHORT, CHINA, "令和") + ); + } + + @ParameterizedTest + @MethodSource("reiwaEraNames") + void testReiwaEraName(int type, Locale locale, String expected) { + assertEquals(expected, c.getDisplayName(ERA, type, locale)); + } + + private static Stream gannen() { + return Stream.of( + // format, + // formatted text + Arguments.of(DateFormat.getDateInstance(DateFormat.FULL, JAJPJP), + "令和元年5月1日水曜日"), + Arguments.of(DateFormat.getDateInstance(DateFormat.FULL, JCAL), + "令和元年5月1日水曜日"), + Arguments.of(DateFormat.getDateInstance(DateFormat.LONG, JAJPJP), + "令和元年5月1日"), + Arguments.of(DateFormat.getDateInstance(DateFormat.LONG, JCAL), + "令和元年5月1日"), + Arguments.of(DateFormat.getDateInstance(DateFormat.MEDIUM, JAJPJP), + "令和1年5月1日"), + Arguments.of(DateFormat.getDateInstance(DateFormat.MEDIUM, JCAL), + "令和1年5月1日"), + Arguments.of(DateFormat.getDateInstance(DateFormat.SHORT, JAJPJP), + "令和1/5/1"), + Arguments.of(DateFormat.getDateInstance(DateFormat.SHORT, JCAL), + "令和1/5/1") + ); + } + + @ParameterizedTest + @MethodSource("gannen") + void testGannenFormat(DateFormat df, String expected) { + assertEquals(expected, df.format(c.getTime())); + } + + @ParameterizedTest + @MethodSource("gannen") + void testGannenParse(DateFormat df, String formatted) throws ParseException { + assertEquals(c.getTime(), df.parse(formatted)); + } +} diff --git a/test/jdk/java/util/Calendar/JapaneseEraNameTest.java b/test/jdk/java/util/Calendar/JapaneseEraNameTest.java deleted file mode 100644 index 11e35927adf..00000000000 --- a/test/jdk/java/util/Calendar/JapaneseEraNameTest.java +++ /dev/null @@ -1,66 +0,0 @@ -/* - * Copyright (c) 2018, 2025, 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. - * - * 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. - */ - -/* - * @test - * @bug 8202088 8207152 8217609 8219890 - * @summary Test the localized Japanese new era name (May 1st. 2019-) - * is retrieved no matter CLDR provider contains the name or not. - * @modules jdk.localedata - * @run testng JapaneseEraNameTest - */ - -import static java.util.Calendar.*; -import static java.util.Locale.*; -import java.util.Calendar; -import java.util.Locale; - -import org.testng.annotations.DataProvider; -import org.testng.annotations.Test; -import static org.testng.Assert.assertEquals; - -@Test -public class JapaneseEraNameTest { - static final Calendar c = new Calendar.Builder() - .setCalendarType("japanese") - .setFields(ERA, 5, YEAR, 1, MONTH, MAY, DAY_OF_MONTH, 1) - .build(); - - @DataProvider(name="names") - Object[][] names() { - return new Object[][] { - // type, locale, name - { LONG, JAPAN, "\u4ee4\u548c" }, - { LONG, US, "Reiwa" }, - { LONG, CHINA, "\u4ee4\u548c" }, - { SHORT, JAPAN, "\u4ee4\u548c" }, - { SHORT, US, "Reiwa" }, - { SHORT, CHINA, "\u4ee4\u548c" }, - }; - } - - @Test(dataProvider="names") - public void testJapaneseNewEraName(int type, Locale locale, String expected) { - assertEquals(c.getDisplayName(ERA, type, locale), expected); - } -} diff --git a/test/hotspot/jtreg/runtime/signal/TestSigusr2.java b/test/jdk/java/util/StringTokenizer/NextTokenWithNullDelimTest.java similarity index 58% rename from test/hotspot/jtreg/runtime/signal/TestSigusr2.java rename to test/jdk/java/util/StringTokenizer/NextTokenWithNullDelimTest.java index fc5bff9d67d..9fad96b76e0 100644 --- a/test/hotspot/jtreg/runtime/signal/TestSigusr2.java +++ b/test/jdk/java/util/StringTokenizer/NextTokenWithNullDelimTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2025, 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 @@ -21,15 +21,25 @@ * questions. */ - /* * @test - * @requires os.family != "windows" & os.family != "aix" - * - * @summary converted from VM testbase runtime/signal/sigusr201. - * VM testbase keywords: [signal, runtime, linux, macosx] - * - * @library /test/lib - * @run main/native SigTestDriver SIGUSR2 + * @bug 8360045 + * @summary Verify StringTokenizer.nextToken(null) does not alter the + * existing delimiter + * @run junit NextTokenWithNullDelimTest */ +import java.util.StringTokenizer; +import org.junit.jupiter.api.Test; + +import static org.junit.jupiter.api.Assertions.assertDoesNotThrow; +import static org.junit.jupiter.api.Assertions.assertThrows; + +public class NextTokenWithNullDelimTest { + @Test + void testNextTokenWithNullDelim() { + StringTokenizer st = new StringTokenizer("test"); + assertThrows(NullPointerException.class, () -> st.nextToken(null)); + assertDoesNotThrow(st::hasMoreTokens); + } +} diff --git a/test/jdk/java/util/concurrent/ConcurrentHashMap/MapLoops.java b/test/jdk/java/util/concurrent/ConcurrentHashMap/MapLoops.java index b8e9a1736c4..0f52bc67f08 100644 --- a/test/jdk/java/util/concurrent/ConcurrentHashMap/MapLoops.java +++ b/test/jdk/java/util/concurrent/ConcurrentHashMap/MapLoops.java @@ -45,15 +45,6 @@ * @run main/timeout=1600 MapLoops */ -/* - * @test - * @summary Exercise multithreaded maps, using only heavy monitors. - * @requires os.arch=="x86" | os.arch=="i386" | os.arch=="amd64" | os.arch=="x86_64" | os.arch=="aarch64" | os.arch == "ppc64" | os.arch == "ppc64le" | os.arch == "riscv64" | os.arch == "s390x" - * @requires vm.debug - * @library /test/lib - * @run main/othervm/timeout=1600 -XX:LockingMode=0 -XX:+VerifyHeavyMonitors MapLoops - */ - import static java.util.concurrent.TimeUnit.MILLISECONDS; import java.util.List; diff --git a/test/jdk/java/util/concurrent/tck/LinkedBlockingDequeTest.java b/test/jdk/java/util/concurrent/tck/LinkedBlockingDequeTest.java index 02b1b67d643..e8775b868f2 100644 --- a/test/jdk/java/util/concurrent/tck/LinkedBlockingDequeTest.java +++ b/test/jdk/java/util/concurrent/tck/LinkedBlockingDequeTest.java @@ -43,8 +43,10 @@ import java.util.concurrent.BlockingDeque; import java.util.concurrent.BlockingQueue; import java.util.concurrent.CountDownLatch; +import java.util.concurrent.ExecutionException; import java.util.concurrent.Executors; import java.util.concurrent.ExecutorService; +import java.util.concurrent.Future; import java.util.concurrent.LinkedBlockingDeque; import junit.framework.Test; @@ -1886,4 +1888,112 @@ public void testNeverContainsNull() { } } + public void testInterruptedExceptionThrownInBlockingMethods() throws InterruptedException { + // Ensure that putFirst(), putLast(), takeFirst(), and takeLast() + // immediately throw an InterruptedException if the thread is + // interrupted, to be consistent with other blocking queues such as + // ArrayBlockingQueue and LinkedBlockingQueue + try (var pool = Executors.newSingleThreadExecutor()) { + Future success = pool.submit(() -> { + var queue = new LinkedBlockingDeque<>(); + Thread.currentThread().interrupt(); + try { + queue.putFirst(42); + fail("Expected InterruptedException in putFirst()"); + } catch (InterruptedException expected) { + // good that's what we want + assertFalse(Thread.currentThread().isInterrupted()); + } + + Thread.currentThread().interrupt(); + try { + queue.putLast(42); + fail("Expected InterruptedException in putLast()"); + } catch (InterruptedException expected) { + // good that's what we want + assertFalse(Thread.currentThread().isInterrupted()); + } + + queue.add(42); + Thread.currentThread().interrupt(); + try { + queue.takeFirst(); + fail("Expected InterruptedException in takeFirst()"); + } catch (InterruptedException expected) { + // good that's what we want + assertFalse(Thread.currentThread().isInterrupted()); + } + + queue.add(42); + Thread.currentThread().interrupt(); + try { + queue.takeLast(); + fail("Expected InterruptedException in takeLast()"); + } catch (InterruptedException expected) { + // good that's what we want + assertFalse(Thread.currentThread().isInterrupted()); + } + return null; + }); + try { + success.get(); + } catch (ExecutionException e) { + try { + throw e.getCause(); + } catch (Error | RuntimeException unchecked) { + throw unchecked; + } catch (Throwable cause) { + throw new AssertionError(cause); + } + } + } + } + + public void testWeaklyConsistentIterationWithClear() { + final LinkedBlockingDeque q = new LinkedBlockingDeque<>(); + q.add(one); + q.add(two); + q.add(three); + final Iterator it = q.iterator(); + mustEqual(one, it.next()); + q.clear(); + q.add(four); + q.add(five); + q.add(six); + mustEqual(two, it.next()); + mustEqual(four, it.next()); + mustEqual(five, it.next()); + mustEqual(six, it.next()); + mustEqual(3, q.size()); + } + + public void testWeaklyConsistentIterationWithIteratorRemove() { + final LinkedBlockingDeque q = new LinkedBlockingDeque<>(); + q.add(one); + q.add(two); + q.add(three); + q.add(four); + q.add(five); + final Iterator it1 = q.iterator(); + final Iterator it2 = q.iterator(); + final Iterator it3 = q.iterator(); + mustEqual(one, it1.next()); + mustEqual(two, it1.next()); + it1.remove(); // removing "two" + mustEqual(one, it2.next()); + it2.remove(); // removing "one" + mustEqual(three, it2.next()); + mustEqual(four, it2.next()); + it2.remove(); // removing "four" + mustEqual(one, it3.next()); + mustEqual(three, it3.next()); + mustEqual(five, it3.next()); + assertFalse(it3.hasNext()); + mustEqual(three, it1.next()); + mustEqual(five, it1.next()); + assertFalse(it1.hasNext()); + mustEqual(five, it2.next()); + assertFalse(it2.hasNext()); + mustEqual(2, q.size()); + } } diff --git a/test/jdk/javax/management/descriptor/ImmutableDescriptorSerialHashCodeTest.java b/test/jdk/javax/management/descriptor/ImmutableDescriptorSerialHashCodeTest.java new file mode 100644 index 00000000000..2fe8bf8034b --- /dev/null +++ b/test/jdk/javax/management/descriptor/ImmutableDescriptorSerialHashCodeTest.java @@ -0,0 +1,76 @@ +/* + * Copyright (c) 2025, 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. + * + * 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. + */ + +/* + * @test + * @bug 8358624 + * @summary Test ImmutableDescriptor hashcode and serialization + * + * @run main ImmutableDescriptorSerialHashCodeTest + */ + +import java.io.ByteArrayInputStream; +import java.io.ByteArrayOutputStream; +import java.io.ObjectInputStream; +import java.io.ObjectOutputStream; +import javax.management.Descriptor; +import javax.management.ImmutableDescriptor; + +public class ImmutableDescriptorSerialHashCodeTest { + public static void main(String[] args) throws Exception { + + Descriptor d1 = new ImmutableDescriptor("a=aval", "B=Bval", "cC=cCval"); + Descriptor d2 = new ImmutableDescriptor("a=aval", "B=Bval", "cC=cCval"); + + test (d1, d2, "Objects created from same String"); // Sanity check + Descriptor dSer = serialize(d1); + test(d1, dSer, "After serialization"); // Actual test + System.out.println("PASSED"); + } + + /** + * Test that two Descriptor objects are both equal, and have equal hashcodes. + */ + private static void test(Descriptor d1, Descriptor d2, String msg) throws Exception { + if (!d1.equals(d2)) { + throw new RuntimeException(msg + ": Descriptors not equal: " + + "\nd1: " + d1 + + "\nd2: " + d2); + } + if (d1.hashCode() != d2.hashCode()) { + throw new RuntimeException(msg + ": Hash code mismatch. hash1: " + d1.hashCode() + + ", hash2: " + d2.hashCode()); + } + } + + private static T serialize(T x) throws Exception { + ByteArrayOutputStream bout = new ByteArrayOutputStream(); + ObjectOutputStream oout = new ObjectOutputStream(bout); + oout.writeObject(x); + oout.close(); + byte[] bytes = bout.toByteArray(); + ByteArrayInputStream bin = new ByteArrayInputStream(bytes); + ObjectInputStream oin = new ObjectInputStream(bin); + return (T) oin.readObject(); + } +} diff --git a/test/jdk/javax/management/remote/mandatory/connection/JMXServiceURLProtocol.java b/test/jdk/javax/management/remote/mandatory/connection/JMXServiceURLProtocol.java new file mode 100644 index 00000000000..2db6be4efe4 --- /dev/null +++ b/test/jdk/javax/management/remote/mandatory/connection/JMXServiceURLProtocol.java @@ -0,0 +1,58 @@ +/* + * Copyright (c) 2025, 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. + * + * 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. + */ + +/* + * @test + * @bug 8347114 + * @summary Test JMXServiceURL does not accept a null protocol + * + * @run main JMXServiceURLProtocol + */ + +import java.net.MalformedURLException; +import javax.management.remote.JMXServiceURL; + +public class JMXServiceURLProtocol { + + public static void main(String[] args) throws Exception { + + try { + JMXServiceURL u = new JMXServiceURL("service:jmx:://"); + String proto = u.getProtocol(); + System.out.println("JMXServiceURL(String) with null protocol gets: " + u + " protocol: " + proto); + throw new RuntimeException("JMXServiceURL created using null protocol: " + u); + } catch (MalformedURLException e) { + System.out.println("JMXServiceURL with null protocol causes expected: " + e); + } + + try { + JMXServiceURL u = new JMXServiceURL(null, "localhost", 1234); + String proto = u.getProtocol(); + System.out.println("JMXServiceURL(params) with null protocol gets: " + u + " protocol: " + proto); + throw new RuntimeException("JMXServiceURL created using null protocol: " + u); + } catch (MalformedURLException e) { + System.out.println("JMXServiceURL with null protocol causes expected: " + e); + } + + } +} diff --git a/test/jdk/javax/script/MyContext.java b/test/jdk/javax/script/MyContext.java deleted file mode 100644 index c0014460b69..00000000000 --- a/test/jdk/javax/script/MyContext.java +++ /dev/null @@ -1,222 +0,0 @@ -/* - * Copyright (c) 2006, 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. - * - * 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. - */ - -/* - * This is pluggable context used by test for 6398614 - */ - -import javax.script.*; -import java.util.*; -import java.io.*; - -public class MyContext implements ScriptContext { - - public static final int APP_SCOPE = 125; - - protected Writer writer; - - protected Writer errorWriter; - - protected Reader reader; - - - protected Bindings appScope; - protected Bindings engineScope; - protected Bindings globalScope; - - - public MyContext() { - appScope = new SimpleBindings(); - engineScope = new SimpleBindings(); - globalScope = null; - reader = new InputStreamReader(System.in); - writer = new PrintWriter(System.out , true); - errorWriter = new PrintWriter(System.err, true); - } - - public void setBindings(Bindings bindings, int scope) { - - switch (scope) { - case APP_SCOPE: - if (bindings == null) { - throw new NullPointerException("App scope cannot be null."); - } - appScope = bindings; - break; - - case ENGINE_SCOPE: - if (bindings == null) { - throw new NullPointerException("Engine scope cannot be null."); - } - engineScope = bindings; - break; - case GLOBAL_SCOPE: - globalScope = bindings; - break; - default: - throw new IllegalArgumentException("Invalid scope value."); - } - } - - public Object getAttribute(String name) { - if (engineScope.containsKey(name)) { - return getAttribute(name, ENGINE_SCOPE); - } else if (appScope.containsKey(name)) { - return getAttribute(name, APP_SCOPE); - } else if (globalScope != null && globalScope.containsKey(name)) { - return getAttribute(name, GLOBAL_SCOPE); - } - - return null; - } - - public Object getAttribute(String name, int scope) { - - switch (scope) { - case APP_SCOPE: - return appScope.get(name); - - case ENGINE_SCOPE: - return engineScope.get(name); - - case GLOBAL_SCOPE: - if (globalScope != null) { - return globalScope.get(name); - } - return null; - - default: - throw new IllegalArgumentException("Illegal scope value."); - } - } - - public Object removeAttribute(String name, int scope) { - - switch (scope) { - case APP_SCOPE: - if (getBindings(APP_SCOPE) != null) { - return getBindings(APP_SCOPE).remove(name); - } - return null; - - - case ENGINE_SCOPE: - if (getBindings(ENGINE_SCOPE) != null) { - return getBindings(ENGINE_SCOPE).remove(name); - } - return null; - - case GLOBAL_SCOPE: - if (getBindings(GLOBAL_SCOPE) != null) { - return getBindings(GLOBAL_SCOPE).remove(name); - } - return null; - - default: - throw new IllegalArgumentException("Illegal scope value."); - } - } - - public void setAttribute(String name, Object value, int scope) { - - switch (scope) { - case APP_SCOPE: - appScope.put(name, value); - return; - - case ENGINE_SCOPE: - engineScope.put(name, value); - return; - - case GLOBAL_SCOPE: - if (globalScope != null) { - globalScope.put(name, value); - } - return; - - default: - throw new IllegalArgumentException("Illegal scope value."); - } - } - - public Writer getWriter() { - return writer; - } - - public Reader getReader() { - return reader; - } - - public void setReader(Reader reader) { - this.reader = reader; - } - - public void setWriter(Writer writer) { - this.writer = writer; - } - - public Writer getErrorWriter() { - return errorWriter; - } - - public void setErrorWriter(Writer writer) { - this.errorWriter = writer; - } - - public int getAttributesScope(String name) { - if (engineScope.containsKey(name)) { - return ENGINE_SCOPE; - } else if (appScope.containsKey(name)) { - return APP_SCOPE; - } else if (globalScope != null && globalScope.containsKey(name)) { - return GLOBAL_SCOPE; - } else { - return -1; - } - } - - public Bindings getBindings(int scope) { - if (scope == ENGINE_SCOPE) { - return engineScope; - } else if (scope == APP_SCOPE) { - return appScope; - } else if (scope == GLOBAL_SCOPE) { - return globalScope; - } else { - throw new IllegalArgumentException("Illegal scope value."); - } - } - - public List getScopes() { - return scopes; - } - - private static List scopes; - static { - scopes = new ArrayList(3); - scopes.add(ENGINE_SCOPE); - scopes.add(APP_SCOPE); - scopes.add(GLOBAL_SCOPE); - scopes = Collections.unmodifiableList(scopes); - } -} diff --git a/test/jdk/javax/swing/JCheckBox/4449413/bug4449413.java b/test/jdk/javax/swing/JCheckBox/4449413/bug4449413.java index 1efcfe58a31..d854961ea06 100644 --- a/test/jdk/javax/swing/JCheckBox/4449413/bug4449413.java +++ b/test/jdk/javax/swing/JCheckBox/4449413/bug4449413.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2012, 2025, 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 @@ -24,7 +24,6 @@ /* @test * @bug 4449413 * @summary Tests that checkbox and radiobuttons' check marks are visible when background is black - * @author Ilya Boyandin * @run main/manual bug4449413 */ @@ -56,8 +55,16 @@ public class bug4449413 extends JFrame { + private static boolean isWindowsLF; + + private static String INSTRUCTIONS_WINDOWSLF = + "There are eight controls, JCheckBox/JRadioButton with black background\n" + + "and JRadioButtonMenuItem/JCheckboxMenuItem with gray background\n"; + private static final String INSTRUCTIONS = - "There are eight controls with black backgrounds.\n" + + "There are eight controls with black backgrounds.\n"; + + private static final String INSTRUCTIONS_COMMON = "Four enabled (on the left side) and four disabled (on the right side)\n" + "checkboxes and radiobuttons.\n\n" + "1. If at least one of the controls' check marks is not visible:\n" + @@ -82,6 +89,8 @@ boolean isMetalLookAndFeel() { } public static void main(String[] args) throws Exception { + isWindowsLF = "Windows".equals(UIManager.getLookAndFeel().getID()); + SwingUtilities.invokeLater(() -> { instance = new bug4449413(); instance.createAndShowGUI(); @@ -150,8 +159,10 @@ public void addComponentsToPane() { JTextArea instructionArea = new JTextArea( isMetalLookAndFeel() - ? INSTRUCTIONS + INSTRUCTIONS_ADDITIONS_METAL - : INSTRUCTIONS + ? INSTRUCTIONS + INSTRUCTIONS_COMMON + INSTRUCTIONS_ADDITIONS_METAL + : isWindowsLF + ? (INSTRUCTIONS_WINDOWSLF + INSTRUCTIONS_COMMON) + : (INSTRUCTIONS + INSTRUCTIONS_COMMON) ); instructionArea.setEditable(false); @@ -189,7 +200,13 @@ static AbstractButton createButton(int enabled, int type) { }; b.setOpaque(true); - b.setBackground(Color.black); + if (isWindowsLF + && ((b instanceof JRadioButtonMenuItem) + || (b instanceof JCheckBoxMenuItem))) { + b.setBackground(Color.lightGray); + } else { + b.setBackground(Color.black); + } b.setForeground(Color.white); b.setEnabled(enabled == 1); b.setSelected(true); diff --git a/test/jdk/javax/swing/JFileChooser/HTMLFileName.java b/test/jdk/javax/swing/JFileChooser/HTMLFileName.java index 8783c388985..a8bc9525cca 100644 --- a/test/jdk/javax/swing/JFileChooser/HTMLFileName.java +++ b/test/jdk/javax/swing/JFileChooser/HTMLFileName.java @@ -41,7 +41,7 @@ /* * @test id=system - * @bug 8139228 + * @bug 8139228 8358532 * @summary JFileChooser should not render Directory names in HTML format * @library /java/awt/regtesthelpers * @build PassFailJFrame @@ -52,24 +52,35 @@ public class HTMLFileName { private static final String INSTRUCTIONS = """
      -
    1. FileChooser shows up a virtual directory and file with name -

      Swing Rocks!. -
    2. On "HTML disabled" frame : +
    3. JFileChooser shows a virtual directory. + The first file in the list has the following name: + <html><h1 color=#ff00ff><font + face="Serif">Swing Rocks! +
      +
      +
    4. In HTML disabled frame:
        -
      1. Verify that the folder and file name must be plain text. -
      2. If the name in file pane window and also in directory - ComboBox remains in plain text, then press Pass. - If it appears to be in HTML format with Pink color as - shown, then press Fail. +
      3. Verify that the first file name displays + as plain text, + that is you see the HTML tags in the file name. +
      4. If the file name in the file pane and + in the navigation combo box above is displayed + as HTML, that is in large font and magenta color, + then press Fail.
      -
    5. On "HTML enabled" frame : +
    6. In HTML enabled frame:
        -
      1. Verify that the folder and file name remains in HTML - format with name "Swing Rocks!" pink in color as shown. -
      2. If the name in file pane window and also in directory - ComboBox remains in HTML format string, then press Pass. - If it appears to be in plain text, then press Fail. +
      3. Verify that the first file name displays as HTML, + that is Swing Rocks! in large font + and magenta color.
        + Note: On macOS in Aqua L&F, the file name with + HTML displays as an empty file name. It is not an error. +
      4. If the file name in the file pane and + in the navigation combo box above is displayed + as HTML, then press Pass.
        + If it is in plain text, then press Fail.
    @@ -99,6 +110,7 @@ public static void main(String[] args) throws Exception { PassFailJFrame.builder() .instructions(INSTRUCTIONS) .columns(45) + .rows(20) .testUI(HTMLFileName::initialize) .positionTestUIBottomRowCentered() .build() @@ -110,18 +122,25 @@ private static List initialize() { return List.of(createFileChooser(true), createFileChooser(false)); } - private static JFrame createFileChooser(boolean htmlEnabled) { + private static JFrame createFileChooser(boolean htmlDisabled) { JFileChooser jfc = new JFileChooser(new VirtualFileSystemView()); - jfc.putClientProperty("html.disable", htmlEnabled); + jfc.putClientProperty("html.disable", htmlDisabled); jfc.setControlButtonsAreShown(false); - JFrame frame = new JFrame((htmlEnabled) ? "HTML enabled" : "HTML disabled"); + JFrame frame = new JFrame(htmlDisabled ? "HTML disabled" : "HTML enabled"); frame.add(jfc); frame.pack(); return frame; } private static class VirtualFileSystemView extends FileSystemView { + private final File[] files = { + new File("/", "

    Swing Rocks!"), + new File("/", "virtualFile1.txt"), + new File("/", "virtualFile2.log") + }; + @Override public File createNewFolder(File containingDir) { return null; @@ -129,12 +148,7 @@ public File createNewFolder(File containingDir) { @Override public File[] getRoots() { - return new File[]{ - new File("/", "

    Swing Rocks!"), - new File("/", "virtualFile2.txt"), - new File("/", "virtualFolder") - }; + return files; } @Override @@ -150,12 +164,7 @@ public File getDefaultDirectory() { @Override public File[] getFiles(File dir, boolean useFileHiding) { // Simulate a virtual folder structure - return new File[]{ - new File("/", "

    Swing Rocks!"), - new File(dir, "virtualFile2.txt"), - new File(dir, "virtualFolder") - }; + return files; } @Override diff --git a/test/jdk/javax/swing/JTabbedPane/bug4499556.java b/test/jdk/javax/swing/JTabbedPane/bug4499556.java index fe9d7dbbfde..f9150b339e2 100644 --- a/test/jdk/javax/swing/JTabbedPane/bug4499556.java +++ b/test/jdk/javax/swing/JTabbedPane/bug4499556.java @@ -89,9 +89,10 @@ public static void main(String[] args) throws Exception { } static volatile JTabbedPane pane; + static volatile JFrame frame; static JFrame createUI() { - JFrame frame = new JFrame("bug4499556"); + frame = new JFrame("bug4499556"); pane = getTabbedPane(); frame.add(pane); frame.add(getRightPanel(), BorderLayout.EAST); @@ -262,7 +263,7 @@ static boolean setLAF(String laf) { e.printStackTrace(); return false; } - SwingUtilities.updateComponentTreeUI(pane); + SwingUtilities.updateComponentTreeUI(frame); return true; } diff --git a/test/jdk/javax/swing/plaf/basic/BasicTextUI/PasswordSelectionWordTest.java b/test/jdk/javax/swing/plaf/basic/BasicTextUI/PasswordSelectionWordTest.java new file mode 100644 index 00000000000..695d8a83c70 --- /dev/null +++ b/test/jdk/javax/swing/plaf/basic/BasicTextUI/PasswordSelectionWordTest.java @@ -0,0 +1,94 @@ +/* + * Copyright (c) 2025, 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. + * + * 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. + */ + +/** + * @test + * @key headful + * @bug 4231444 8354646 + * @summary Password fields' ActionMap needs to replace + * DefaultEditorKit.selectWordAction with + * DefaultEditorKit.selectLineAction. + * + * @run main PasswordSelectionWordTest + */ + +import javax.swing.Action; +import javax.swing.JPasswordField; +import javax.swing.SwingUtilities; +import javax.swing.UIManager; +import javax.swing.UnsupportedLookAndFeelException; +import javax.swing.plaf.basic.BasicTextUI; +import javax.swing.text.DefaultEditorKit; +import java.awt.event.ActionEvent; + +public class PasswordSelectionWordTest { + public static void main(String[] args) throws Exception { + for (UIManager.LookAndFeelInfo laf : + UIManager.getInstalledLookAndFeels()) { + System.out.println("Testing LAF: " + laf.getClassName()); + SwingUtilities.invokeAndWait(() -> { + if (setLookAndFeel(laf)) { + runTest(); + } + }); + } + } + + private static boolean setLookAndFeel(UIManager.LookAndFeelInfo laf) { + try { + UIManager.setLookAndFeel(laf.getClassName()); + return true; + } catch (UnsupportedLookAndFeelException e) { + System.err.println("Skipping unsupported look and feel:"); + e.printStackTrace(); + return false; + } catch (Exception e) { + throw new RuntimeException(e); + } + } + + private static void runTest() { + String str = "one two three"; + JPasswordField field = new JPasswordField(str); + if (!(field.getUI() instanceof BasicTextUI)) { + throw new RuntimeException("Unexpected condition: JPasswordField UI was " + field.getUI()); + } + System.out.println("Testing " + field.getUI()); + + // do something (anything) to initialize the Views: + field.setSize(100, 100); + field.addNotify(); + + Action action = field.getActionMap().get( + DefaultEditorKit.selectWordAction); + action.actionPerformed(new ActionEvent(field, 0, "")); + int selectionStart = field.getSelectionStart(); + int selectionEnd = field.getSelectionEnd(); + System.out.println("selectionStart = " + selectionStart); + System.out.println("selectionEnd = " + selectionEnd); + if (selectionStart != 0 || selectionEnd != str.length()) { + throw new RuntimeException("selectionStart = " + selectionStart + + " and selectionEnd = " + selectionEnd); + } + } +} diff --git a/test/jdk/javax/swing/text/GlyphView/bug4188841.java b/test/jdk/javax/swing/text/GlyphView/bug4188841.java index 1b3cc0bcdd4..9935712bd49 100644 --- a/test/jdk/javax/swing/text/GlyphView/bug4188841.java +++ b/test/jdk/javax/swing/text/GlyphView/bug4188841.java @@ -69,7 +69,7 @@ static JFrame createUI() { JFrame frame = new JFrame("bug4188841"); NoWrapTextPane nwp = new NoWrapTextPane(); - nwp.setText("the\tslow\tbrown\tfox\tjumps\tover\tthe\tlazy\tdog!"); + nwp.setText("the\tquick\tbrown\tfox\tjumps\tover\tthe\tlazy\tdog!"); nwp.setCaretPosition(nwp.getText().length()); JScrollPane scrollPane = new JScrollPane(nwp, diff --git a/test/jdk/javax/xml/crypto/dsig/GenerationTests.java b/test/jdk/javax/xml/crypto/dsig/GenerationTests.java index 668a5a50a0a..ac24ceb476c 100644 --- a/test/jdk/javax/xml/crypto/dsig/GenerationTests.java +++ b/test/jdk/javax/xml/crypto/dsig/GenerationTests.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2005, 2025, 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 @@ -286,8 +286,8 @@ private static enum KeyInfoType { private static boolean result = true; public static void main(String args[]) throws Exception { - // Re-enable sha1 algs - SecurityUtils.removeAlgsFromDSigPolicy("sha1"); + // Re-enable sha1 and xpath algs + SecurityUtils.removeAlgsFromDSigPolicy("sha1", "xpath"); setup(); test_context_iterator(); diff --git a/test/jdk/javax/xml/crypto/dsig/HereFunction.java b/test/jdk/javax/xml/crypto/dsig/HereFunction.java index 4910d0e6a89..100c89ea142 100644 --- a/test/jdk/javax/xml/crypto/dsig/HereFunction.java +++ b/test/jdk/javax/xml/crypto/dsig/HereFunction.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2023, 2025, 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 @@ -85,8 +85,8 @@ public static void main(String args[]) throws Throwable { if (!args[0].equals("default")) { Security.setProperty("jdk.xml.dsig.hereFunctionSupported", args[0]); } - // Re-enable sha1 algs - SecurityUtils.removeAlgsFromDSigPolicy("sha1"); + // Re-enable sha1 and xpath algs + SecurityUtils.removeAlgsFromDSigPolicy("sha1", "xpath"); boolean expected = Boolean.parseBoolean(args[1]); diff --git a/test/jdk/javax/xml/crypto/dsig/SecureValidationPolicy.java b/test/jdk/javax/xml/crypto/dsig/SecureValidationPolicy.java index e55d1460ce7..15f8fcf6dac 100644 --- a/test/jdk/javax/xml/crypto/dsig/SecureValidationPolicy.java +++ b/test/jdk/javax/xml/crypto/dsig/SecureValidationPolicy.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2016, 2025, 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 @@ -23,7 +23,7 @@ /** * @test - * @bug 8151893 8259709 + * @bug 8151893 8259709 8314180 * @summary Tests for the jdk.xml.dsig.secureValidationPolicy security property * @modules java.xml.crypto/org.jcp.xml.dsig.internal.dom */ @@ -47,7 +47,8 @@ public static void main(String[] args) throws Exception { "http://www.w3.org/2000/09/xmldsig#dsa-sha1", "http://www.w3.org/2000/09/xmldsig#rsa-sha1", "http://www.w3.org/2007/05/xmldsig-more#sha1-rsa-MGF1", - "http://www.w3.org/2001/04/xmldsig-more#ecdsa-sha1"); + "http://www.w3.org/2001/04/xmldsig-more#ecdsa-sha1", + "http://www.w3.org/TR/1999/REC-xpath-19991116"); // Test expected defaults System.out.println("Testing defaults"); diff --git a/test/jdk/javax/xml/crypto/dsig/ValidationTests.java b/test/jdk/javax/xml/crypto/dsig/ValidationTests.java index b5e093a44d8..49a19824162 100644 --- a/test/jdk/javax/xml/crypto/dsig/ValidationTests.java +++ b/test/jdk/javax/xml/crypto/dsig/ValidationTests.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2005, 2025, 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 @@ -141,8 +141,8 @@ static class Test { }; public static void main(String args[]) throws Exception { - // Re-enable sha1 algs - SecurityUtils.removeAlgsFromDSigPolicy("sha1"); + // Re-enable sha1 and xpath algs + SecurityUtils.removeAlgsFromDSigPolicy("sha1", "xpath"); httpUd = new HttpURIDereferencer(); diff --git a/test/jdk/jdk/internal/loader/URLClassPath/ClassnameCharTest.java b/test/jdk/jdk/internal/loader/URLClassPath/ClassnameCharTest.java index 85987ef6f5e..8208e8d9cba 100644 --- a/test/jdk/jdk/internal/loader/URLClassPath/ClassnameCharTest.java +++ b/test/jdk/jdk/internal/loader/URLClassPath/ClassnameCharTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2012, 2025, 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 @@ -22,62 +22,43 @@ */ /* @test - * @bug 4957669 5017871 + * @bug 4957669 5017871 8358729 * @summary cannot load class names containing some JSR 202 characters; * plugin does not escape unicode character in http request * @modules java.base/sun.net.www * jdk.httpserver - * @compile -XDignore.symbol.file=true ClassnameCharTest.java - * @run main ClassnameCharTest + * @run junit ClassnameCharTest */ import java.io.*; +import java.lang.classfile.ClassFile; +import java.lang.constant.ClassDesc; import java.net.*; -import java.security.AccessControlContext; -import java.security.AccessController; import java.security.CodeSource; -import java.security.PrivilegedActionException; -import java.security.PrivilegedExceptionAction; -import java.util.jar.*; import com.sun.net.httpserver.*; import sun.net.www.ParseUtil; +import org.junit.jupiter.api.Test; + public class ClassnameCharTest { - static String FNPrefix = System.getProperty("test.src", ".") + File.separator; - static File classesJar = new File(FNPrefix + "testclasses.jar"); - static HttpServer server; - public static void realMain(String[] args) throws Exception { + private static HttpServer server; + private static final byte[] bytes = + ClassFile.of().build(ClassDesc.of("fo o"), _ -> {}); + + @Test + void testClassName() throws IOException { + // Build the server and set the context server = HttpServer.create(new InetSocketAddress(0), 0); - server.createContext("/", new HttpHandler() { - @Override - public void handle(HttpExchange exchange) { - try { - String filename = exchange.getRequestURI().getPath(); - System.out.println("getRequestURI = " + exchange.getRequestURI()); - System.out.println("filename = " + filename); - try (FileInputStream fis = new FileInputStream(classesJar); - JarInputStream jis = new JarInputStream(fis)) { - JarEntry entry; - while ((entry = jis.getNextJarEntry()) != null) { - if (filename.endsWith(entry.getName())) { - ByteArrayOutputStream baos = new ByteArrayOutputStream(); - byte[] buf = new byte[8092]; - int count = 0; - while ((count = jis.read(buf)) != -1) - baos.write(buf, 0, count); - exchange.sendResponseHeaders(200, baos.size()); - try (OutputStream os = exchange.getResponseBody()) { - baos.writeTo(os); - } - return; - } - } - fail("Failed to find " + filename); - } - } catch (IOException e) { - unexpected(e); - } + server.createContext("/", exchange -> { + String filename = exchange.getRequestURI().getPath(); + System.out.println("getRequestURI = " + exchange.getRequestURI()); + System.out.println("filename = " + filename); + ByteArrayOutputStream baos = new ByteArrayOutputStream(); + baos.write(bytes, 0, bytes.length); + exchange.sendResponseHeaders(200, baos.size()); + try (OutputStream os = exchange.getResponseBody()) { + baos.writeTo(os); } }); server.start(); @@ -87,7 +68,6 @@ public void handle(HttpExchange exchange) { MyURLClassLoader acl = new MyURLClassLoader(base); Class class1 = acl.findClass("fo o"); System.out.println("class1 = " + class1); - pass(); // can't test the following class unless platform in unicode locale // Class class2 = acl.findClass("\u624b\u518c"); // System.out.println("class2 = "+class2); @@ -99,17 +79,15 @@ public void handle(HttpExchange exchange) { static class MyURLClassLoader extends URLClassLoader { private URL base; /* code base URL */ private CodeSource codesource; /* codesource for the base URL */ - private AccessControlContext acc; MyURLClassLoader(URL base) { super(new URL[0]); this.base = base; this.codesource = new CodeSource(base, (java.security.cert.Certificate[]) null); - acc = AccessController.getContext(); } @Override - public Class findClass(String name) throws ClassNotFoundException { + public Class findClass(String name) { int index = name.indexOf(';'); String cookie = ""; if(index != -1) { @@ -117,46 +95,29 @@ public Class findClass(String name) throws ClassNotFoundException { name = name.substring(0, index); } - // check loaded JAR files - try { - return super.findClass(name); - } catch (ClassNotFoundException e) { - } - // Otherwise, try loading the class from the code base URL // final String path = name.replace('.', '/').concat(".class").concat(cookie); String encodedName = ParseUtil.encodePath(name.replace('.', '/'), false); - final String path = (new StringBuffer(encodedName)).append(".class").append(cookie).toString(); + final String path = encodedName + ".class" + cookie; + Exception exc = null; + // try block used for checked exceptions as well as ClassFormatError + // from defineClass call try { - byte[] b = AccessController.doPrivileged( - new PrivilegedExceptionAction() { - public byte[] run() throws IOException { - try { - URL finalURL = new URL(base, path); - - // Make sure the codebase won't be modified - if (base.getProtocol().equals(finalURL.getProtocol()) && - base.getHost().equals(finalURL.getHost()) && - base.getPort() == finalURL.getPort()) { - return getBytes(finalURL); - } - else { - return null; - } - } catch (Exception e) { - return null; - } - } - }, acc); - - if (b != null) { + URL finalURL = new URL(base, path); + // Make sure the codebase won't be modified + if (base.getProtocol().equals(finalURL.getProtocol()) && + base.getHost().equals(finalURL.getHost()) && + base.getPort() == finalURL.getPort()) { + byte[] b = getBytes(finalURL); return defineClass(name, b, 0, b.length, codesource); - } else { - throw new ClassNotFoundException(name); } - } catch (PrivilegedActionException e) { - throw new ClassNotFoundException(name, e.getException()); + // protocol/host/port mismatch, fail with RuntimeException + } catch (Exception underlyingE) { + exc = underlyingE; // Most likely CFE from defineClass } + // Fail if there was either a protocol/host/port mismatch + // or an exception was thrown (which is propagated) + throw new RuntimeException(name, exc); } /* @@ -186,63 +147,4 @@ private static byte[] getBytes(URL url) throws IOException { return b; } } - - //--------------------- Infrastructure --------------------------- - static volatile int passed = 0, failed = 0; - - static boolean pass() { - passed++; - return true; - } - - static boolean fail() { - failed++; - if (server != null) { - server.stop(0); - } - Thread.dumpStack(); - return false; - } - - static boolean fail(String msg) { - System.out.println(msg); - return fail(); - } - - static void unexpected(Throwable t) { - failed++; - if (server != null) { - server.stop(0); - } - t.printStackTrace(); - } - - static boolean check(boolean cond) { - if (cond) { - pass(); - } else { - fail(); - } - return cond; - } - - static boolean equal(Object x, Object y) { - if (x == null ? y == null : x.equals(y)) { - return pass(); - } else { - return fail(x + " not equal to " + y); - } - } - - public static void main(String[] args) throws Throwable { - try { - realMain(args); - } catch (Throwable t) { - unexpected(t); - } - System.out.println("\nPassed = " + passed + " failed = " + failed); - if (failed > 0) { - throw new AssertionError("Some tests failed"); - } - } } diff --git a/test/jdk/jdk/internal/loader/URLClassPath/testclasses.jar b/test/jdk/jdk/internal/loader/URLClassPath/testclasses.jar deleted file mode 100644 index 0069eee84a0..00000000000 Binary files a/test/jdk/jdk/internal/loader/URLClassPath/testclasses.jar and /dev/null differ diff --git a/test/jdk/jdk/internal/platform/docker/TestDockerBasic.java b/test/jdk/jdk/internal/platform/docker/TestDockerBasic.java index e236292de98..9a531d692ed 100644 --- a/test/jdk/jdk/internal/platform/docker/TestDockerBasic.java +++ b/test/jdk/jdk/internal/platform/docker/TestDockerBasic.java @@ -28,6 +28,7 @@ * @summary Verify that -XshowSettings:system works * @key cgroups * @requires container.support + * @requires !vm.asan * @library /test/lib * @run main/timeout=360 TestDockerBasic */ diff --git a/test/jdk/jdk/internal/platform/docker/TestDockerCpuMetrics.java b/test/jdk/jdk/internal/platform/docker/TestDockerCpuMetrics.java index 4d452f20eef..ff039913b8f 100644 --- a/test/jdk/jdk/internal/platform/docker/TestDockerCpuMetrics.java +++ b/test/jdk/jdk/internal/platform/docker/TestDockerCpuMetrics.java @@ -35,6 +35,7 @@ * @key cgroups * @summary Test JDK Metrics class when running inside docker container * @requires container.support + * @requires !vm.asan * @library /test/lib * @modules java.base/jdk.internal.platform * @build MetricsCpuTester diff --git a/test/jdk/jdk/internal/platform/docker/TestDockerMemoryMetrics.java b/test/jdk/jdk/internal/platform/docker/TestDockerMemoryMetrics.java index e8dc616b5e7..7cbab5c3b86 100644 --- a/test/jdk/jdk/internal/platform/docker/TestDockerMemoryMetrics.java +++ b/test/jdk/jdk/internal/platform/docker/TestDockerMemoryMetrics.java @@ -33,6 +33,7 @@ * @key cgroups * @summary Test JDK Metrics class when running inside docker container * @requires container.support + * @requires !vm.asan * @library /test/lib * @modules java.base/jdk.internal.platform * @build MetricsMemoryTester diff --git a/test/jdk/jdk/internal/platform/docker/TestDockerMemoryMetricsSubgroup.java b/test/jdk/jdk/internal/platform/docker/TestDockerMemoryMetricsSubgroup.java index c6b94370807..0587d5a6bfb 100644 --- a/test/jdk/jdk/internal/platform/docker/TestDockerMemoryMetricsSubgroup.java +++ b/test/jdk/jdk/internal/platform/docker/TestDockerMemoryMetricsSubgroup.java @@ -40,6 +40,7 @@ * @key cgroups * @summary Cgroup v1 subsystem fails to set subsystem path * @requires container.support + * @requires !vm.asan * @library /test/lib * @modules java.base/jdk.internal.platform * @build MetricsMemoryTester diff --git a/test/jdk/jdk/internal/platform/docker/TestGetFreeSwapSpaceSize.java b/test/jdk/jdk/internal/platform/docker/TestGetFreeSwapSpaceSize.java index 204d7a215d8..8e3d0cacd57 100644 --- a/test/jdk/jdk/internal/platform/docker/TestGetFreeSwapSpaceSize.java +++ b/test/jdk/jdk/internal/platform/docker/TestGetFreeSwapSpaceSize.java @@ -27,6 +27,7 @@ * @key cgroups * @bug 8242480 * @requires container.support + * @requires !vm.asan * @library /test/lib * @build GetFreeSwapSpaceSize * @run driver TestGetFreeSwapSpaceSize diff --git a/test/jdk/jdk/internal/platform/docker/TestLimitsUpdating.java b/test/jdk/jdk/internal/platform/docker/TestLimitsUpdating.java index 1544088f688..31e90e8802a 100644 --- a/test/jdk/jdk/internal/platform/docker/TestLimitsUpdating.java +++ b/test/jdk/jdk/internal/platform/docker/TestLimitsUpdating.java @@ -30,6 +30,7 @@ * @key cgroups * @summary Test container limits updating as they get updated at runtime without restart * @requires container.support + * @requires !vm.asan * @library /test/lib * @modules java.base/jdk.internal.platform * @build LimitUpdateChecker diff --git a/test/jdk/jdk/internal/platform/docker/TestPidsLimit.java b/test/jdk/jdk/internal/platform/docker/TestPidsLimit.java index 9fedeb55234..6b19bb475f1 100644 --- a/test/jdk/jdk/internal/platform/docker/TestPidsLimit.java +++ b/test/jdk/jdk/internal/platform/docker/TestPidsLimit.java @@ -28,6 +28,7 @@ * @summary Test JDK Metrics class when running inside a docker container with limited pids * @bug 8266490 * @requires container.support + * @requires !vm.asan * @library /test/lib * @build TestPidsLimit * @run driver TestPidsLimit diff --git a/test/jdk/jdk/internal/platform/docker/TestSystemMetrics.java b/test/jdk/jdk/internal/platform/docker/TestSystemMetrics.java index 93efff64cc4..49ec5663478 100644 --- a/test/jdk/jdk/internal/platform/docker/TestSystemMetrics.java +++ b/test/jdk/jdk/internal/platform/docker/TestSystemMetrics.java @@ -26,6 +26,7 @@ * @key cgroups * @summary Test JDK Metrics class when running inside docker container * @requires container.support + * @requires !vm.asan * @library /test/lib * @modules java.base/jdk.internal.platform * @run main TestSystemMetrics diff --git a/test/jdk/jdk/internal/platform/docker/TestUseContainerSupport.java b/test/jdk/jdk/internal/platform/docker/TestUseContainerSupport.java index 6a96514771c..d8d300401a0 100644 --- a/test/jdk/jdk/internal/platform/docker/TestUseContainerSupport.java +++ b/test/jdk/jdk/internal/platform/docker/TestUseContainerSupport.java @@ -26,6 +26,7 @@ * @test * @summary UseContainerSupport flag should reflect Metrics being available * @requires container.support + * @requires !vm.asan * @library /test/lib * @modules java.base/jdk.internal.platform * @build CheckUseContainerSupport diff --git a/test/jdk/jdk/internal/vm/Continuation/Basic.java b/test/jdk/jdk/internal/vm/Continuation/Basic.java index e13fa175ad5..393c30a3cc9 100644 --- a/test/jdk/jdk/internal/vm/Continuation/Basic.java +++ b/test/jdk/jdk/internal/vm/Continuation/Basic.java @@ -1,5 +1,5 @@ /* -* Copyright (c) 2018, 2024, Oracle and/or its affiliates. All rights reserved. +* Copyright (c) 2018, 2025, 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 @@ -64,9 +64,6 @@ import java.util.stream.Collectors; import java.util.stream.IntStream; -import com.sun.management.HotSpotDiagnosticMXBean; -import java.lang.management.ManagementFactory; - import org.testng.annotations.Test; import org.testng.annotations.DataProvider; import static org.testng.Assert.*; @@ -281,39 +278,6 @@ static String barMany(long b, return "" + r; } - @Test - public void testPinnedMonitor() { - if (!legacyLockingMode()) return; - - // Test pinning due to held monitor - final AtomicReference res = new AtomicReference<>(); - - Continuation cont = new Continuation(FOO, ()-> { - syncFoo(1); - }) { - @Override - protected void onPinned(Continuation.Pinned reason) { - assert Continuation.isPinned(FOO); - res.set(reason); - } - }; - - cont.run(); - assertEquals(res.get(), Continuation.Pinned.MONITOR); - boolean isDone = cont.isDone(); - assertEquals(isDone, true); - } - - static double syncFoo(int a) { - long x = 8; - String s = "yyy"; - String r; - synchronized(FOO) { - r = bar2(a + 1); - } - return Integer.parseInt(r)+1; - } - @Test public void testNotPinnedMonitor() { final AtomicReference res = new AtomicReference<>(); @@ -419,9 +383,4 @@ static int nativeBaz(int b) { static { System.loadLibrary("BasicJNI"); } - - static boolean legacyLockingMode() { - return ManagementFactory.getPlatformMXBean(HotSpotDiagnosticMXBean.class) - .getVMOption("LockingMode").getValue().equals("1"); - } } diff --git a/test/jdk/jdk/internal/vm/Continuation/Fuzz.java b/test/jdk/jdk/internal/vm/Continuation/Fuzz.java index 52730c9523b..5f4f8c85f61 100644 --- a/test/jdk/jdk/internal/vm/Continuation/Fuzz.java +++ b/test/jdk/jdk/internal/vm/Continuation/Fuzz.java @@ -1,5 +1,5 @@ /* -* Copyright (c) 2018, 2024, Oracle and/or its affiliates. All rights reserved. +* Copyright (c) 2018, 2025, 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 @@ -473,7 +473,8 @@ void verifyResult(int result) { } boolean shouldPin() { - return traceHas(Op.PIN::contains) && legacyLockingMode(); + // Returns false since we never pin after we removed legacy locking. + return traceHas(Op.PIN::contains) && false; } void verifyPin(boolean yieldResult) { @@ -1032,9 +1033,4 @@ int com_mny(int depth, return log((int)res); } - - static boolean legacyLockingMode() { - return ManagementFactory.getPlatformMXBean(HotSpotDiagnosticMXBean.class) - .getVMOption("LockingMode").getValue().equals("1"); - } } diff --git a/test/jdk/jdk/jfr/event/compiler/TestCodeCacheConfig.java b/test/jdk/jdk/jfr/event/compiler/TestCodeCacheConfig.java index defc9cba1be..1eb402f08ae 100644 --- a/test/jdk/jdk/jfr/event/compiler/TestCodeCacheConfig.java +++ b/test/jdk/jdk/jfr/event/compiler/TestCodeCacheConfig.java @@ -50,7 +50,7 @@ public class TestCodeCacheConfig { private final static String EVENT_NAME = EventNames.CodeCacheConfiguration; - private static final long CodeCacheExpectedSize = WhiteBox.getWhiteBox().getUintxVMFlag("ReservedCodeCacheSize"); + private static final long CodeCacheExpectedSize = WhiteBox.getWhiteBox().getSizeTVMFlag("ReservedCodeCacheSize"); public static void main(String[] args) throws Exception { Recording recording = new Recording(); diff --git a/test/jdk/jdk/jfr/event/compiler/TestCodeSweeper.java b/test/jdk/jdk/jfr/event/compiler/TestCodeSweeper.java index dd227489a0c..a4fc50b764d 100644 --- a/test/jdk/jdk/jfr/event/compiler/TestCodeSweeper.java +++ b/test/jdk/jdk/jfr/event/compiler/TestCodeSweeper.java @@ -65,8 +65,8 @@ public class TestCodeSweeper { private static final String METHOD_NAME = "verifyFullEvent"; private static final String pathFull = EventNames.CodeCacheFull; private static final String pathFailure = EventNames.CompilationFailure; - public static final long SEGMENT_SIZE = WhiteBox.getWhiteBox().getUintxVMFlag("CodeCacheSegmentSize"); - public static final long MIN_BLOCK_LENGTH = WhiteBox.getWhiteBox().getUintxVMFlag("CodeCacheMinBlockLength"); + public static final long SEGMENT_SIZE = WhiteBox.getWhiteBox().getSizeTVMFlag("CodeCacheSegmentSize"); + public static final long MIN_BLOCK_LENGTH = WhiteBox.getWhiteBox().getSizeTVMFlag("CodeCacheMinBlockLength"); public static final long MIN_ALLOCATION = SEGMENT_SIZE * MIN_BLOCK_LENGTH; private static final double CACHE_USAGE_COEF = 0.95d; diff --git a/test/jdk/jdk/jfr/event/profiling/TestCPUTimeSampleThrottling.java b/test/jdk/jdk/jfr/event/profiling/TestCPUTimeSampleThrottling.java index 55b350ad096..b0b9d6d2be7 100644 --- a/test/jdk/jdk/jfr/event/profiling/TestCPUTimeSampleThrottling.java +++ b/test/jdk/jdk/jfr/event/profiling/TestCPUTimeSampleThrottling.java @@ -61,19 +61,27 @@ private static void testThrottleSettings() throws Exception { private static void testThrottleSettingsPeriod() throws Exception { float rate = countEvents(1000, "10ms").rate(); - Asserts.assertTrue(rate > 90 && rate < 110, "Expected around 100 events per second, got " + rate); + Asserts.assertTrue(rate > 75 && rate < 110, "Expected around 100 events per second, got " + rate); } - private record EventCount(long count, float time) { + private record EventCount(long count, float cpuTime) { float rate() { - return count / time; + return count / cpuTime; } } - private static EventCount countEvents(int timeMs, String rate) throws Exception { - try(Recording recording = new Recording()) { + /** + * Counting the events that are emitted for a given throttle in a given time. + *

    + * The result is wall-clock independent; it only records the CPU-time and the number of + * emitted events. The result, therefore, does not depend on the load of the machine. + * And because failed events are counted too, the result is not affected by the thread + * doing other in-JVM work (like garbage collection). + */ + private static EventCount countEvents(int timeMs, String throttle) throws Exception { + try (Recording recording = new Recording()) { recording.enable(EventNames.CPUTimeSample) - .with("throttle", rate); + .with("throttle", throttle); var bean = ManagementFactory.getThreadMXBean(); @@ -92,8 +100,6 @@ private static EventCount countEvents(int timeMs, String rate) throws Exception .equals(Thread.currentThread().getName())) .count(); - System.out.println("Event count: " + eventCount + ", CPU time: " + spendCPUTime / 1_000_000_000f + "s"); - return new EventCount(eventCount, spendCPUTime / 1_000_000_000f); } } diff --git a/test/jdk/java/lang/Thread/virtual/LockingMode.java b/test/jdk/jdk/jfr/event/tracing/TestLazyPlatformTracer.java similarity index 50% rename from test/jdk/java/lang/Thread/virtual/LockingMode.java rename to test/jdk/jdk/jfr/event/tracing/TestLazyPlatformTracer.java index 59fde4a5f49..d3e6146bc74 100644 --- a/test/jdk/java/lang/Thread/virtual/LockingMode.java +++ b/test/jdk/jdk/jfr/event/tracing/TestLazyPlatformTracer.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2025, 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 @@ -20,20 +20,27 @@ * or visit www.oracle.com if you need additional information or have any * questions. */ +package jdk.jfr.event.tracing; -import java.lang.management.ManagementFactory; -import com.sun.management.HotSpotDiagnosticMXBean; +import jdk.internal.misc.Unsafe; +import jdk.jfr.FlightRecorder; +import jdk.jfr.Recording; +/** +* @test +* @summary Tests that PlatformTracer is not initialized if a method filter has not been set. +* @requires vm.flagless +* @requires vm.hasJFR +* @modules java.base/jdk.internal.misc jdk.jfr/jdk.jfr.internal.tracing +* @library /test/lib +* @run main/othervm -XX:StartFlightRecording jdk.jfr.event.tracing.TestLazyPlatformTracer +*/ +public class TestLazyPlatformTracer { -class LockingMode { - private LockingMode() { } - - /** - * Returns true if using legacy locking mode. - */ - static boolean isLegacy() { - return ManagementFactory.getPlatformMXBean(HotSpotDiagnosticMXBean.class) - .getVMOption("LockingMode") - .getValue() - .equals("1"); + public static void main(String... args) throws Exception { + // Stop recording so end chunk events are emitted + FlightRecorder.getFlightRecorder().getRecordings().getFirst().stop(); + if (!Unsafe.getUnsafe().shouldBeInitialized(jdk.jfr.internal.tracing.PlatformTracer.class)) { + throw new AssertionError("PlatformTracer should not have been initialized"); + } } -} \ No newline at end of file +} diff --git a/test/jdk/jdk/jfr/event/tracing/TestTracedString.java b/test/jdk/jdk/jfr/event/tracing/TestTracedString.java new file mode 100644 index 00000000000..d4bf84010eb --- /dev/null +++ b/test/jdk/jdk/jfr/event/tracing/TestTracedString.java @@ -0,0 +1,97 @@ +/* + * Copyright (c) 2025, 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. + * + * 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 jdk.jfr.event.tracing; + +import java.nio.file.Path; + +import jdk.jfr.Configuration; +import jdk.jfr.Name; +import jdk.jfr.Recording; +import jdk.jfr.consumer.RecordedEvent; +import jdk.jfr.consumer.RecordingFile; + +/** + * @test + * @summary Tests that java.lang.String can be traced. + * @requires vm.flagless + * @requires vm.hasJFR + * @library /test/lib + * @run main/othervm jdk.jfr.event.tracing.TestTracedString + **/ +public class TestTracedString { + private static long SEED = System.currentTimeMillis(); + + @Name("Message") + static class MessageEvent extends jdk.jfr.Event { + String message; + long checkSum; + } + + public static void main(String[] args) throws Exception { + Configuration c = Configuration.getConfiguration("default"); + Path file = Path.of("recording.jfr"); + try (Recording r = new Recording(c)) { + r.enable("jdk.MethodTrace").with("filter", "java.lang.String"); + r.start(); + emit(100, ""); + emit(100, "short"); + emit(100, "medium medium medium medium medium medium 1"); + emit(100, "medium medium medium medium medium medium 2"); + emit(100, "long".repeat(100)); + r.stop(); + r.dump(file); + int count = 0; + for (RecordedEvent e : RecordingFile.readAllEvents(file)) { + if (e.getEventType().getName().equals("Message")) { + String text = e.getString("message"); + long checkSum = e.getLong("checkSum"); + if (checkSum(text) != checkSum) { + throw new Exception("Incorrect checksum for text " + text); + } + count++; + } + } + if (count != 500) { + throw new Exception("Expected 500 Message events. Got " + count); + } + } + } + + private static void emit(int count, String text) { + long checkSum = checkSum(text); + for (int i = 0; i < count; i++) { + MessageEvent m = new MessageEvent(); + m.message = text; + m.checkSum = checkSum; + m.commit(); + } + } + + private static long checkSum(String text) { + long checkSum = SEED; + for (int i = 0; i < text.length(); i++) { + checkSum += 17 * text.charAt(i); + } + return checkSum; + } +} diff --git a/test/jdk/sun/net/www/protocol/jrt/Basic.java b/test/jdk/sun/net/www/protocol/jrt/Basic.java index 0f0492c9b39..785920b4a4d 100644 --- a/test/jdk/sun/net/www/protocol/jrt/Basic.java +++ b/test/jdk/sun/net/www/protocol/jrt/Basic.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2025, 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 @@ -28,7 +28,6 @@ */ import java.io.IOException; -import java.io.InputStream; import java.net.URL; import java.net.URLConnection; @@ -41,8 +40,29 @@ public class Basic { @DataProvider(name = "urls") public Object[][] urls() { Object[][] data = { - { "jrt:/java.base/java/lang/Object.class", true }, - { "jrt:/java.desktop/java/lang/Object.class", false }, + {"jrt:/java.base/java/lang/Object.class", true}, + // Valid resource with and without percent-encoding. + {"jrt:/java.base/java/lang/Runtime$Version.class", true}, + {"jrt:/java.base/java%2Flang%2FRuntime%24Version.class", true}, + // Unnecessary percent encoding (just Object again). + {"jrt:/java.base/%6a%61%76%61%2f%6c%61%6e%67%2f%4f%62%6a%65%63%74%2e%63%6c%61%73%73", true}, + // Query parameters and fragments are silently ignored. + {"jrt:/java.base/java/lang/Object.class?yes=no", true}, + {"jrt:/java.base/java/lang/Object.class#anchor", true}, + + // Missing resource (no such class). + {"jrt:/java.base/java/lang/NoSuchClass.class", false}, + // Missing resource (wrong module). + {"jrt:/java.desktop/java/lang/Object.class", false}, + // Entries in jimage which don't reference resources. + {"jrt:/modules/java.base/java/lang", false}, + {"jrt:/packages/java.lang", false}, + // Invalid (incomplete/corrupt) URIs. + {"jrt:/", false}, + {"jrt:/java.base", false}, + {"jrt:/java.base/", false}, + // Cannot escape anything in the module name. + {"jrt:/java%2Ebase/java/lang/Object.class", false}, }; return data; } diff --git a/test/jdk/sun/security/pkcs11/PKCS11Test.java b/test/jdk/sun/security/pkcs11/PKCS11Test.java index efae619314d..0f1da62efcc 100644 --- a/test/jdk/sun/security/pkcs11/PKCS11Test.java +++ b/test/jdk/sun/security/pkcs11/PKCS11Test.java @@ -80,7 +80,7 @@ public abstract class PKCS11Test { // Version of the NSS artifact. This coincides with the version of // the NSS version - private static final String NSS_BUNDLE_VERSION = "3.107"; + private static final String NSS_BUNDLE_VERSION = "3.111"; private static final String NSSLIB = "jpg.tests.jdk.nsslib"; static double nss_version = -1; diff --git a/test/jdk/sun/tools/jstat/jstatGcCapacityOutput1.sh b/test/jdk/sun/tools/jstat/jstatGcCapacityOutput1.sh index ccc95be281f..c1908855ea7 100644 --- a/test/jdk/sun/tools/jstat/jstatGcCapacityOutput1.sh +++ b/test/jdk/sun/tools/jstat/jstatGcCapacityOutput1.sh @@ -1,5 +1,5 @@ # -# Copyright (c) 2004, 2020, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2004, 2025, 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 @@ -34,4 +34,9 @@ verify_os JSTAT="${TESTJAVA}/bin/jstat" ${JSTAT} ${COMMON_JSTAT_FLAGS} -gccapacity 0 2>&1 | awk -f ${TESTSRC}/gcCapacityOutput1.awk +RC=$? +if [ $RC -ne 0 ]; then + exit $RC +fi + ${JSTAT} ${COMMON_JSTAT_FLAGS} -J-XX:+UseParallelGC -gccapacity 0 2>&1 | awk -f ${TESTSRC}/gcCapacityOutput1.awk diff --git a/test/jdk/sun/tools/jstat/jstatGcCauseOutput1.sh b/test/jdk/sun/tools/jstat/jstatGcCauseOutput1.sh index c34a1881673..8652a25fdb7 100644 --- a/test/jdk/sun/tools/jstat/jstatGcCauseOutput1.sh +++ b/test/jdk/sun/tools/jstat/jstatGcCauseOutput1.sh @@ -1,5 +1,5 @@ # -# Copyright (c) 2004, 2020, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2004, 2025, 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 @@ -38,4 +38,9 @@ JSTAT="${TESTJAVA}/bin/jstat" # The UseParallelGC collector does not currently update the gc cause counters. ${JSTAT} ${COMMON_JSTAT_FLAGS} -gccause 0 2>&1 | awk -f ${TESTSRC}/gcCauseOutput1.awk +RC=$? +if [ $RC -ne 0 ]; then + exit $RC +fi + ${JSTAT} ${COMMON_JSTAT_FLAGS} -J-XX:+UseSerialGC -gccause 0 2>&1 | awk -f ${TESTSRC}/gcCauseOutput1.awk diff --git a/test/jdk/sun/tools/jstat/jstatGcMetaCapacityOutput1.sh b/test/jdk/sun/tools/jstat/jstatGcMetaCapacityOutput1.sh index 66446517c50..b16d0e38d02 100644 --- a/test/jdk/sun/tools/jstat/jstatGcMetaCapacityOutput1.sh +++ b/test/jdk/sun/tools/jstat/jstatGcMetaCapacityOutput1.sh @@ -1,5 +1,5 @@ # -# Copyright (c) 2013, 2020, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2013, 2025, 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 @@ -34,4 +34,9 @@ verify_os JSTAT="${TESTJAVA}/bin/jstat" ${JSTAT} ${COMMON_JSTAT_FLAGS} -gcmetacapacity 0 2>&1 | awk -f ${TESTSRC}/gcMetaCapacityOutput1.awk +RC=$? +if [ $RC -ne 0 ]; then + exit $RC +fi + ${JSTAT} ${COMMON_JSTAT_FLAGS} -J-XX:+UseParallelGC -gcmetacapacity 0 2>&1 | awk -f ${TESTSRC}/gcMetaCapacityOutput1.awk diff --git a/test/jdk/sun/tools/jstat/jstatGcNewCapacityOutput1.sh b/test/jdk/sun/tools/jstat/jstatGcNewCapacityOutput1.sh index 44aa864b475..64ce2efd455 100644 --- a/test/jdk/sun/tools/jstat/jstatGcNewCapacityOutput1.sh +++ b/test/jdk/sun/tools/jstat/jstatGcNewCapacityOutput1.sh @@ -1,5 +1,5 @@ # -# Copyright (c) 2004, 2020, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2004, 2025, 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 @@ -34,4 +34,9 @@ verify_os JSTAT="${TESTJAVA}/bin/jstat" ${JSTAT} ${COMMON_JSTAT_FLAGS} -gcnewcapacity 0 2>&1 | awk -f ${TESTSRC}/gcNewCapacityOutput1.awk +RC=$? +if [ $RC -ne 0 ]; then + exit $RC +fi + ${JSTAT} ${COMMON_JSTAT_FLAGS} -J-XX:+UseParallelGC -gcnewcapacity 0 2>&1 | awk -f ${TESTSRC}/gcNewCapacityOutput1.awk diff --git a/test/jdk/sun/tools/jstat/jstatGcNewOutput1.sh b/test/jdk/sun/tools/jstat/jstatGcNewOutput1.sh index 0f909f18a9e..b15ec02d2b0 100644 --- a/test/jdk/sun/tools/jstat/jstatGcNewOutput1.sh +++ b/test/jdk/sun/tools/jstat/jstatGcNewOutput1.sh @@ -1,5 +1,5 @@ # -# Copyright (c) 2004, 2020, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2004, 2025, 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 @@ -34,4 +34,9 @@ verify_os JSTAT="${TESTJAVA}/bin/jstat" ${JSTAT} ${COMMON_JSTAT_FLAGS} -gcnew 0 2>&1 | awk -f ${TESTSRC}/gcNewOutput1.awk +RC=$? +if [ $RC -ne 0 ]; then + exit $RC +fi + ${JSTAT} ${COMMON_JSTAT_FLAGS} -J-XX:+UseParallelGC -gcnew 0 2>&1 | awk -f ${TESTSRC}/gcNewOutput1.awk diff --git a/test/jdk/sun/tools/jstat/jstatGcOldCapacityOutput1.sh b/test/jdk/sun/tools/jstat/jstatGcOldCapacityOutput1.sh index 433072fddfa..1c13d6f916d 100644 --- a/test/jdk/sun/tools/jstat/jstatGcOldCapacityOutput1.sh +++ b/test/jdk/sun/tools/jstat/jstatGcOldCapacityOutput1.sh @@ -1,5 +1,5 @@ # -# Copyright (c) 2004, 2020, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2004, 2025, 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 @@ -34,4 +34,9 @@ verify_os JSTAT="${TESTJAVA}/bin/jstat" ${JSTAT} ${COMMON_JSTAT_FLAGS} -gcoldcapacity 0 2>&1 | awk -f ${TESTSRC}/gcOldCapacityOutput1.awk +RC=$? +if [ $RC -ne 0 ]; then + exit $RC +fi + ${JSTAT} ${COMMON_JSTAT_FLAGS} -J-XX:+UseParallelGC -gcoldcapacity 0 2>&1 | awk -f ${TESTSRC}/gcOldCapacityOutput1.awk diff --git a/test/jdk/sun/tools/jstat/jstatGcOldOutput1.sh b/test/jdk/sun/tools/jstat/jstatGcOldOutput1.sh index ee9e30296e0..7f505228b12 100644 --- a/test/jdk/sun/tools/jstat/jstatGcOldOutput1.sh +++ b/test/jdk/sun/tools/jstat/jstatGcOldOutput1.sh @@ -1,5 +1,5 @@ # -# Copyright (c) 2004, 2020, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2004, 2025, 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 @@ -34,4 +34,9 @@ verify_os JSTAT="${TESTJAVA}/bin/jstat" ${JSTAT} ${COMMON_JSTAT_FLAGS} -gcold 0 2>&1 | awk -f ${TESTSRC}/gcOldOutput1.awk +RC=$? +if [ $RC -ne 0 ]; then + exit $RC +fi + ${JSTAT} ${COMMON_JSTAT_FLAGS} -J-XX:+UseParallelGC -gcold 0 2>&1 | awk -f ${TESTSRC}/gcOldOutput1.awk diff --git a/test/jdk/sun/tools/jstat/jstatGcOutput1.sh b/test/jdk/sun/tools/jstat/jstatGcOutput1.sh index 167c53606ad..dfffa2d1a55 100644 --- a/test/jdk/sun/tools/jstat/jstatGcOutput1.sh +++ b/test/jdk/sun/tools/jstat/jstatGcOutput1.sh @@ -1,5 +1,5 @@ # -# Copyright (c) 2004, 2020, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2004, 2025, 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 @@ -34,4 +34,9 @@ verify_os JSTAT="${TESTJAVA}/bin/jstat" ${JSTAT} ${COMMON_JSTAT_FLAGS} -gc 0 2>&1 | awk -f ${TESTSRC}/gcOutput1.awk +RC=$? +if [ $RC -ne 0 ]; then + exit $RC +fi + ${JSTAT} ${COMMON_JSTAT_FLAGS} -J-XX:+UseParallelGC -gc 0 2>&1 | awk -f ${TESTSRC}/gcOutput1.awk diff --git a/test/jdk/sun/tools/jstat/jstatLineCounts1.sh b/test/jdk/sun/tools/jstat/jstatLineCounts1.sh index 75cb051cccf..97338b8e793 100644 --- a/test/jdk/sun/tools/jstat/jstatLineCounts1.sh +++ b/test/jdk/sun/tools/jstat/jstatLineCounts1.sh @@ -1,5 +1,5 @@ # -# Copyright (c) 2004, 2020, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2004, 2025, 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 @@ -34,4 +34,9 @@ verify_os JSTAT="${TESTJAVA}/bin/jstat" ${JSTAT} ${COMMON_JSTAT_FLAGS} -gcutil 0 250 5 2>&1 | awk -f ${TESTSRC}/lineCounts1.awk +RC=$? +if [ $RC -ne 0 ]; then + exit $RC +fi + ${JSTAT} ${COMMON_JSTAT_FLAGS} -J-XX:+UseParallelGC -gcutil 0 250 5 2>&1 | awk -f ${TESTSRC}/lineCounts1.awk diff --git a/test/jdk/sun/tools/jstat/jstatLineCounts2.sh b/test/jdk/sun/tools/jstat/jstatLineCounts2.sh index 5e0cbafe08d..eab19f3931e 100644 --- a/test/jdk/sun/tools/jstat/jstatLineCounts2.sh +++ b/test/jdk/sun/tools/jstat/jstatLineCounts2.sh @@ -1,5 +1,5 @@ # -# Copyright (c) 2004, 2020, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2004, 2025, 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 @@ -34,4 +34,9 @@ verify_os JSTAT="${TESTJAVA}/bin/jstat" ${JSTAT} ${COMMON_JSTAT_FLAGS} -gcutil 0 2>&1 | awk -f ${TESTSRC}/lineCounts2.awk +RC=$? +if [ $RC -ne 0 ]; then + exit $RC +fi + ${JSTAT} ${COMMON_JSTAT_FLAGS} -J-XX:+UseParallelGC -gcutil 0 2>&1 | awk -f ${TESTSRC}/lineCounts2.awk diff --git a/test/jdk/sun/tools/jstat/jstatLineCounts3.sh b/test/jdk/sun/tools/jstat/jstatLineCounts3.sh index ef8bbc8ad75..9a769a92464 100644 --- a/test/jdk/sun/tools/jstat/jstatLineCounts3.sh +++ b/test/jdk/sun/tools/jstat/jstatLineCounts3.sh @@ -1,5 +1,5 @@ # -# Copyright (c) 2004, 2020, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2004, 2025, 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 @@ -34,4 +34,9 @@ verify_os JSTAT="${TESTJAVA}/bin/jstat" ${JSTAT} ${COMMON_JSTAT_FLAGS} -gcutil -h 10 0 250 10 2>&1 | awk -f ${TESTSRC}/lineCounts3.awk +RC=$? +if [ $RC -ne 0 ]; then + exit $RC +fi + ${JSTAT} ${COMMON_JSTAT_FLAGS} -J-XX:+UseParallelGC -gcutil -h 10 0 250 10 2>&1 | awk -f ${TESTSRC}/lineCounts3.awk diff --git a/test/jdk/sun/tools/jstat/jstatLineCounts4.sh b/test/jdk/sun/tools/jstat/jstatLineCounts4.sh index 537172c75e3..817c3b14f62 100644 --- a/test/jdk/sun/tools/jstat/jstatLineCounts4.sh +++ b/test/jdk/sun/tools/jstat/jstatLineCounts4.sh @@ -1,5 +1,5 @@ # -# Copyright (c) 2004, 2020, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2004, 2025, 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 @@ -34,4 +34,9 @@ verify_os JSTAT="${TESTJAVA}/bin/jstat" ${JSTAT} ${COMMON_JSTAT_FLAGS} -gcutil -h 10 0 250 11 2>&1 | awk -f ${TESTSRC}/lineCounts4.awk +RC=$? +if [ $RC -ne 0 ]; then + exit $RC +fi + ${JSTAT} ${COMMON_JSTAT_FLAGS} -J-XX:+UseParallelGC -gcutil -h 10 0 250 11 2>&1 | awk -f ${TESTSRC}/lineCounts4.awk diff --git a/test/jdk/sun/tools/jstat/lineCounts1.awk b/test/jdk/sun/tools/jstat/lineCounts1.awk index d7a7c1d9fb7..1e05506100b 100644 --- a/test/jdk/sun/tools/jstat/lineCounts1.awk +++ b/test/jdk/sun/tools/jstat/lineCounts1.awk @@ -29,7 +29,7 @@ BEGIN { headerlines++; } -/^[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*([0-9]+|-)[ ]*([0-9]+\.[0-9]+|-)[ ]*[0-9]+\.[0-9]+$/ { +/^[ ]*([0-9]+\.[0-9]+|-)[ ]*([0-9]+\.[0-9]+|-)[ ]*([0-9]+\.[0-9]+|-)[ ]*([0-9]+\.[0-9]+|-)[ ]*([0-9]+\.[0-9]+|-)[ ]*([0-9]+\.[0-9]+|-)[ ]*[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*([0-9]+|-)[ ]*([0-9]+\.[0-9]+|-)[ ]*[0-9]+\.[0-9]+$/ { datalines++; } diff --git a/test/jdk/sun/tools/jstat/lineCounts2.awk b/test/jdk/sun/tools/jstat/lineCounts2.awk index 201457a3833..4d838c2103e 100644 --- a/test/jdk/sun/tools/jstat/lineCounts2.awk +++ b/test/jdk/sun/tools/jstat/lineCounts2.awk @@ -21,7 +21,7 @@ BEGIN { headerlines++; } -/^[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*([0-9]+|-)[ ]*([0-9]+\.[0-9]+|-)[ ]*[0-9]+\.[0-9]+$/ { +/^[ ]*([0-9]+\.[0-9]+|-)[ ]*([0-9]+\.[0-9]+|-)[ ]*([0-9]+\.[0-9]+|-)[ ]*([0-9]+\.[0-9]+|-)[ ]*([0-9]+\.[0-9]+|-)[ ]*([0-9]+\.[0-9]+|-)[ ]*[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*([0-9]+|-)[ ]*([0-9]+\.[0-9]+|-)[ ]*[0-9]+\.[0-9]+$/ { datalines++; } diff --git a/test/jdk/sun/tools/jstat/lineCounts3.awk b/test/jdk/sun/tools/jstat/lineCounts3.awk index 1f155a99ed5..79ae969a47d 100644 --- a/test/jdk/sun/tools/jstat/lineCounts3.awk +++ b/test/jdk/sun/tools/jstat/lineCounts3.awk @@ -39,7 +39,7 @@ BEGIN { headerlines++; } -/^[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*([0-9]+|-)[ ]*([0-9]+\.[0-9]+|-)[ ]*[0-9]+\.[0-9]+$/ { +/^[ ]*([0-9]+\.[0-9]+|-)[ ]*([0-9]+\.[0-9]+|-)[ ]*([0-9]+\.[0-9]+|-)[ ]*([0-9]+\.[0-9]+|-)[ ]*([0-9]+\.[0-9]+|-)[ ]*([0-9]+\.[0-9]+|-)[ ]*[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*([0-9]+|-)[ ]*([0-9]+\.[0-9]+|-)[ ]*[0-9]+\.[0-9]+$/ { datalines++; } diff --git a/test/jdk/sun/tools/jstat/lineCounts4.awk b/test/jdk/sun/tools/jstat/lineCounts4.awk index 62aea881e71..7ceb56b9f27 100644 --- a/test/jdk/sun/tools/jstat/lineCounts4.awk +++ b/test/jdk/sun/tools/jstat/lineCounts4.awk @@ -44,7 +44,7 @@ BEGIN { headerlines++; } -/^[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*([0-9]+|-)[ ]*([0-9]+\.[0-9]+|-)[ ]*[0-9]+\.[0-9]+$/ { +/^[ ]*([0-9]+\.[0-9]+|-)[ ]*([0-9]+\.[0-9]+|-)[ ]*([0-9]+\.[0-9]+|-)[ ]*([0-9]+\.[0-9]+|-)[ ]*([0-9]+\.[0-9]+|-)[ ]*([0-9]+\.[0-9]+|-)[ ]*[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*([0-9]+|-)[ ]*([0-9]+\.[0-9]+|-)[ ]*[0-9]+\.[0-9]+$/ { if (headerlines == 2) { datalines2++; } diff --git a/test/jdk/tools/launcher/ArgFileSyntax.java b/test/jdk/tools/launcher/ArgFileSyntax.java index bedb0d36fc5..5145c205166 100644 --- a/test/jdk/tools/launcher/ArgFileSyntax.java +++ b/test/jdk/tools/launcher/ArgFileSyntax.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2025, 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 @@ -21,9 +21,9 @@ * questions. */ -/** +/* * @test - * @bug 8027634 8210810 8240629 + * @bug 8027634 8210810 8240629 8357862 * @summary Verify syntax of argument file * @build TestHelper * @run main ArgFileSyntax @@ -172,6 +172,15 @@ private void verifyOutput(List args, TestResult tr) { "-version", "-Dcontinue.with.leadingws=Line1continue with \f and \t" } + }, + { // multiple args in one line and comments without preceding whitespace + { "-Xmx32m -XshowSettings#COMMENT 1", + "-version#COMMENT 2" + }, + { "-Xmx32m", + "-XshowSettings", + "-version" + } } }; diff --git a/src/hotspot/share/opto/c2_globals_pd.hpp b/test/jdk/tools/sincechecker/modules/jdk.management.jfr/JdkManagementJfrCheckSince.java similarity index 75% rename from src/hotspot/share/opto/c2_globals_pd.hpp rename to test/jdk/tools/sincechecker/modules/jdk.management.jfr/JdkManagementJfrCheckSince.java index c2ab269cebf..37dd6f29db1 100644 --- a/src/hotspot/share/opto/c2_globals_pd.hpp +++ b/test/jdk/tools/sincechecker/modules/jdk.management.jfr/JdkManagementJfrCheckSince.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2025, 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 @@ -19,16 +19,12 @@ * 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. - * */ -#ifndef SHARE_OPTO_C2_GLOBALS_PD_HPP -#define SHARE_OPTO_C2_GLOBALS_PD_HPP - -#include "runtime/globals_shared.hpp" -#include "utilities/macros.hpp" - -#include CPU_HEADER(c2_globals) -#include OS_HEADER(c2_globals) - -#endif // SHARE_OPTO_C2_GLOBALS_PD_HPP +/* + * @test + * @bug 8346886 + * @summary Test for `@since` in jdk.management.jfr module + * @library /test/lib /test/jdk/tools/sincechecker + * @run main SinceChecker jdk.management.jfr + */ diff --git a/test/jtreg-ext/requires/VMProps.java b/test/jtreg-ext/requires/VMProps.java index 360c96c74ef..681c88654c0 100644 --- a/test/jtreg-ext/requires/VMProps.java +++ b/test/jtreg-ext/requires/VMProps.java @@ -118,8 +118,6 @@ public Map call() { map.put("vm.jvmti", this::vmHasJVMTI); map.put("vm.cpu.features", this::cpuFeatures); map.put("vm.pageSize", this::vmPageSize); - map.put("vm.rtm.cpu", this::vmRTMCPU); - map.put("vm.rtm.compiler", this::vmRTMCompiler); // vm.cds is true if the VM is compiled with cds support. map.put("vm.cds", this::vmCDS); map.put("vm.cds.custom.loaders", this::vmCDSForCustomLoaders); @@ -138,6 +136,8 @@ public Map call() { map.put("container.support", this::containerSupport); map.put("systemd.support", this::systemdSupport); map.put("vm.musl", this::isMusl); + map.put("vm.asan", this::isAsanEnabled); + map.put("vm.ubsan", this::isUbsanEnabled); map.put("release.implementor", this::implementor); map.put("jdk.containerized", this::jdkContainerized); map.put("vm.flagless", this::isFlagless); @@ -415,28 +415,6 @@ protected String vmHasDTrace() { return "" + WB.isDTraceIncluded(); } - /** - * @return "true" if compiler in use supports RTM and "false" otherwise. - * Note: Lightweight locking does not support RTM (for now). - */ - protected String vmRTMCompiler() { - boolean isRTMCompiler = false; - - if (Compiler.isC2Enabled() && - (Platform.isX86() || Platform.isX64() || Platform.isPPC()) && - is_LM_LIGHTWEIGHT().equals("false")) { - isRTMCompiler = true; - } - return "" + isRTMCompiler; - } - - /** - * @return true if VM runs RTM supported CPU and false otherwise. - */ - protected String vmRTMCPU() { - return "" + CPUInfo.hasFeature("rtm"); - } - /** * Check for CDS support. * @@ -530,34 +508,6 @@ protected String vmPageSize() { return "" + WB.getVMPageSize(); } - /** - * @return LockingMode. - */ - protected String vmLockingMode() { - return "" + WB.getIntVMFlag("LockingMode"); - } - - /** - * @return "true" if LockingMode == 0 (LM_MONITOR) - */ - protected String is_LM_MONITOR() { - return "" + vmLockingMode().equals("0"); - } - - /** - * @return "true" if LockingMode == 1 (LM_LEGACY) - */ - protected String is_LM_LEGACY() { - return "" + vmLockingMode().equals("1"); - } - - /** - * @return "true" if LockingMode == 2 (LM_LIGHTWEIGHT) - */ - protected String is_LM_LIGHTWEIGHT() { - return "" + vmLockingMode().equals("2"); - } - /** * Check if Graal is used as JIT compiler. * @@ -728,6 +678,15 @@ protected String isMusl() { return Boolean.toString(WB.getLibcName().contains("musl")); } + // Sanitizer support + protected String isAsanEnabled() { + return "" + WB.isAsanEnabled(); + } + + protected String isUbsanEnabled() { + return "" + WB.isUbsanEnabled(); + } + private String implementor() { try (InputStream in = new BufferedInputStream(new FileInputStream( System.getProperty("java.home") + "/release"))) { diff --git a/test/langtools/jdk/javadoc/doclet/testNewApiList/TestNewApiList.java b/test/langtools/jdk/javadoc/doclet/testNewApiList/TestNewApiList.java index 1d3dda52fc4..956bae37435 100644 --- a/test/langtools/jdk/javadoc/doclet/testNewApiList/TestNewApiList.java +++ b/test/langtools/jdk/javadoc/doclet/testNewApiList/TestNewApiList.java @@ -23,7 +23,7 @@ /* * @test - * @bug 8263468 8269401 8268422 8287524 8325874 8331873 8345555 + * @bug 8263468 8269401 8268422 8287524 8325874 8331873 8345555 8359024 * @summary New page for "recent" new API * @library ../../lib * @modules jdk.javadoc/jdk.javadoc.internal.tool @@ -126,7 +126,7 @@ private void checkMultiReleaseNewElements() { checkOutput("new-list.html", true, """

    -
    +
    New Modules
    @@ -142,7 +142,7 @@ private void checkMultiReleaseNewElements() {
    """, """
    -
    +
    New Packages
    @@ -158,7 +158,7 @@ private void checkMultiReleaseNewElements() {
    """, """
    -
    +
    New Interfaces
    @@ -174,7 +174,7 @@ private void checkMultiReleaseNewElements() {
    """, """
    -
    +
    New Classes
    @@ -190,7 +190,7 @@ private void checkMultiReleaseNewElements() {
    """, """
    -
    +
    New Enum Classes
    @@ -206,7 +206,7 @@ private void checkMultiReleaseNewElements() {
    """, """
    -
    +
    New Exception Classes
    @@ -228,7 +228,7 @@ private void checkMultiReleaseNewElements() {
    """, """
    -
    +
    New Record Classes
    @@ -244,7 +244,7 @@ private void checkMultiReleaseNewElements() {
    """, """
    -
    +
    New Annotation Interfaces
    @@ -259,7 +259,7 @@ private void checkMultiReleaseNewElements() {
    """, """
    -
    +
    New Fields
    @@ -293,7 +293,7 @@ private void checkMultiReleaseNewElements() {
    """, """
    -
    +
    New Methods
    @@ -359,7 +359,7 @@ private void checkMultiReleaseNewElements() {
    """, """
    -
    +
    New Constructors
    @@ -394,7 +394,7 @@ private void checkMultiReleaseNewElements() {
    """, """
    -
    +
    New Enum Constants
    @@ -428,7 +428,7 @@ private void checkMultiReleaseNewElements() {
    """, """
    -
    +
    New Annotation Interface Elements
    @@ -456,7 +456,7 @@ private void checkMultiReleaseDeprecatedElements() { checkOutput("deprecated-list.html", true, """
    -
    +
    Terminally Deprecated Elements
    @@ -471,7 +471,7 @@ private void checkMultiReleaseDeprecatedElements() {
    """, """
    -
    +
    Deprecated Methods
    @@ -486,7 +486,7 @@ private void checkMultiReleaseDeprecatedElements() {
    """, """
    -
    +
    Deprecated Constructors
    @@ -501,7 +501,7 @@ private void checkMultiReleaseDeprecatedElements() {
    """, """
    -
    +
    Deprecated Enum Constants
    @@ -516,7 +516,7 @@ private void checkMultiReleaseDeprecatedElements() {
    """, """
    -
    +
    Deprecated Annotation Interface Elements
    @@ -606,7 +606,7 @@ private void checkSingleReleaseDeprecatedElements() { """, """
    -
    +
    Terminally Deprecated Elements
    @@ -621,7 +621,7 @@ private void checkSingleReleaseDeprecatedElements() {
    """, """
    -
    +
    Deprecated Methods
    @@ -636,7 +636,7 @@ private void checkSingleReleaseDeprecatedElements() {
    """, """
    -
    +
    Deprecated Constructors
    @@ -680,7 +680,7 @@ private void checkPackageNewElements() { checkOutput("new-list.html", true, """
    -
    +
    New Classes
    @@ -696,7 +696,7 @@ private void checkPackageNewElements() {
    """, """
    -
    +
    New Fields
    @@ -712,7 +712,7 @@ private void checkPackageNewElements() {
    """, """
    -
    +
    New Methods
    @@ -741,7 +741,7 @@ private void checkPackageNewElements() {
    """, """
    -
    +
    New Constructors
    diff --git a/test/langtools/jdk/javadoc/doclet/testPreview/TestPreview.java b/test/langtools/jdk/javadoc/doclet/testPreview/TestPreview.java index 07e5b69c463..b883de1920b 100644 --- a/test/langtools/jdk/javadoc/doclet/testPreview/TestPreview.java +++ b/test/langtools/jdk/javadoc/doclet/testPreview/TestPreview.java @@ -24,7 +24,7 @@ /* * @test * @bug 8250768 8261976 8277300 8282452 8287597 8325325 8325874 8297879 - * 8331947 8281533 8343239 8318416 8346109 + * 8331947 8281533 8343239 8318416 8346109 8359024 * @summary test generated docs for items declared using preview * @library /tools/lib ../../lib * @modules jdk.javadoc/jdk.javadoc.internal.tool @@ -104,7 +104,7 @@ public void testPreviewAPIJavadoc() { """, """
    -
    +
    Packages
    @@ -122,7 +122,7 @@ public void testPreviewAPIJavadoc() { """, """
    -
    +
    Record Classes
    @@ -139,7 +139,7 @@ public void testPreviewAPIJavadoc() { """, """
    -
    +
    Methods
    diff --git a/test/langtools/tools/javac/danglingDocComments/DanglingDocCommentsClass.java b/test/langtools/tools/javac/danglingDocComments/DanglingDocCommentsClass.java index 3f6553d191f..9d2adbc656f 100644 --- a/test/langtools/tools/javac/danglingDocComments/DanglingDocCommentsClass.java +++ b/test/langtools/tools/javac/danglingDocComments/DanglingDocCommentsClass.java @@ -45,4 +45,13 @@ public void m4b() { } /** Good comment. */ int i = 0; } -} \ No newline at end of file + + /** Dangling comment X */ + + /** + * The {@code @SuppressWarnings} annotation below retroactively + * silences the warning about "Dangling comment X". + */ + @SuppressWarnings("dangling-doc-comments") + public void m5() { } +} diff --git a/src/java.base/share/classes/sun/text/resources/JavaTimeSupplementaryProvider.java b/test/langtools/tools/javac/lint/LintOptions.java similarity index 53% rename from src/java.base/share/classes/sun/text/resources/JavaTimeSupplementaryProvider.java rename to test/langtools/tools/javac/lint/LintOptions.java index 261e9803015..10def72a31a 100644 --- a/src/java.base/share/classes/sun/text/resources/JavaTimeSupplementaryProvider.java +++ b/test/langtools/tools/javac/lint/LintOptions.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2025, 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 @@ -23,13 +23,16 @@ * questions. */ -package sun.text.resources; - -import java.util.spi.ResourceBundleProvider; - -/** - * An interface for the internal locale data provider for which {@code ResourceBundle} - * searches. +/* + * @test + * @bug 8359596 + * @summary Verify behavior when both "-Xlint:options" and "-Xlint:-options" are given + * @compile/fail/ref=LintOptions.out -Werror -XDrawDiagnostics -source 21 -target 21 LintOptions.java + * @compile/fail/ref=LintOptions.out -Werror -XDrawDiagnostics -source 21 -target 21 -Xlint:options LintOptions.java + * @compile -Werror -XDrawDiagnostics -source 21 -target 21 -Xlint:-options LintOptions.java + * @compile -Werror -XDrawDiagnostics -source 21 -target 21 -Xlint:options -Xlint:-options LintOptions.java + * @compile -Werror -XDrawDiagnostics -source 21 -target 21 -Xlint:none LintOptions.java + * @compile -Werror -XDrawDiagnostics -source 21 -target 21 -Xlint:options -Xlint:none LintOptions.java */ -public interface JavaTimeSupplementaryProvider extends ResourceBundleProvider { +class LintOptions { } diff --git a/test/langtools/tools/javac/lint/LintOptions.out b/test/langtools/tools/javac/lint/LintOptions.out new file mode 100644 index 00000000000..020c626ee5c --- /dev/null +++ b/test/langtools/tools/javac/lint/LintOptions.out @@ -0,0 +1,4 @@ +- compiler.warn.source.no.system.modules.path: 21, (compiler.misc.source.no.system.modules.path.with.target: 21, 21) +- compiler.err.warnings.and.werror +1 error +1 warning diff --git a/test/lib-test/jdk/test/whitebox/vm_flags/UintxTest.java b/test/lib-test/jdk/test/whitebox/vm_flags/UintxTest.java index 0996350adff..79f8678a1e2 100644 --- a/test/lib-test/jdk/test/whitebox/vm_flags/UintxTest.java +++ b/test/lib-test/jdk/test/whitebox/vm_flags/UintxTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2025, 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 @@ -37,7 +37,7 @@ public class UintxTest { private static final String FLAG_NAME = "VerifyGCStartAt"; - private static final String FLAG_DEBUG_NAME = "CodeCacheMinimumUseSpace"; + private static final String FLAG_DEBUG_NAME = "StopInterpreterAt"; private static final Long[] TESTS = {0L, 100L, (long) Integer.MAX_VALUE, (1L << 32L) - 1L, 1L << 32L}; private static final Long[] EXPECTED_64 = TESTS; diff --git a/test/lib/jdk/test/lib/containers/docker/ContainerRuntimeVersionTestUtils.java b/test/lib/jdk/test/lib/containers/docker/ContainerRuntimeVersionTestUtils.java index 88538e7e780..0d1c3a358ab 100644 --- a/test/lib/jdk/test/lib/containers/docker/ContainerRuntimeVersionTestUtils.java +++ b/test/lib/jdk/test/lib/containers/docker/ContainerRuntimeVersionTestUtils.java @@ -79,12 +79,21 @@ public static ContainerRuntimeVersionTestUtils fromVersionString(String version) try { // Example 'docker version 20.10.0 or podman version 4.9.4-rhel' String versNums = version.split("\\s+", 3)[2]; + // On some docker implementations e.g. RHEL8 ppc64le we have the following version output: + // Docker version v25.0.3, build 4debf41 + // Trim potentially leading 'v' and trailing ',' + if (versNums.startsWith("v")) { + versNums = versNums.substring(1); + } + int cidx = versNums.indexOf(','); + versNums = (cidx != -1) ? versNums.substring(0, cidx) : versNums; + String[] numbers = versNums.split("-")[0].split("\\.", 3); return new ContainerRuntimeVersionTestUtils(Integer.parseInt(numbers[0]), Integer.parseInt(numbers[1]), Integer.parseInt(numbers[2])); } catch (Exception e) { - throw new RuntimeException("Failed to parse container runtime version: " + version); + throw new RuntimeException("Failed to parse container runtime version: " + version, e); } } @@ -104,4 +113,4 @@ public static String getContainerRuntimeVersionStr() { public static ContainerRuntimeVersionTestUtils getContainerRuntimeVersion() { return ContainerRuntimeVersionTestUtils.fromVersionString(getContainerRuntimeVersionStr()); } -} \ No newline at end of file +} diff --git a/test/lib/jdk/test/whitebox/WhiteBox.java b/test/lib/jdk/test/whitebox/WhiteBox.java index d1f2c5822af..f3d9ba7b6e9 100644 --- a/test/lib/jdk/test/whitebox/WhiteBox.java +++ b/test/lib/jdk/test/whitebox/WhiteBox.java @@ -322,6 +322,10 @@ public Object[] parseCommandLine(String commandline, char delim, Dia public native void NMTFreeArena(long arena); public native void NMTArenaMalloc(long arena, long size); + // Sanitizers + public native boolean isAsanEnabled(); + public native boolean isUbsanEnabled(); + // Compiler // Determines if the libgraal shared library file is present. diff --git a/test/lib/jdk/test/whitebox/code/BlobType.java b/test/lib/jdk/test/whitebox/code/BlobType.java index 24ce9d96a41..a2290acc7b6 100644 --- a/test/lib/jdk/test/whitebox/code/BlobType.java +++ b/test/lib/jdk/test/whitebox/code/BlobType.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2025, 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 @@ -103,6 +103,6 @@ public static EnumSet getAvailable() { } public long getSize() { - return WhiteBox.getWhiteBox().getUintxVMFlag(sizeOptionName); + return WhiteBox.getWhiteBox().getSizeTVMFlag(sizeOptionName); } } diff --git a/test/micro/org/openjdk/bench/java/nio/DirectByteBufferAlloc.java b/test/micro/org/openjdk/bench/java/nio/DirectByteBufferAlloc.java new file mode 100644 index 00000000000..8e82b9a4487 --- /dev/null +++ b/test/micro/org/openjdk/bench/java/nio/DirectByteBufferAlloc.java @@ -0,0 +1,60 @@ +/* + * Copyright Amazon.com Inc. 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. + * + * 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 org.openjdk.bench.java.nio; + + +import java.nio.ByteBuffer; +import java.util.concurrent.TimeUnit; +import org.openjdk.jmh.annotations.Benchmark; +import org.openjdk.jmh.annotations.BenchmarkMode; +import org.openjdk.jmh.annotations.Fork; +import org.openjdk.jmh.annotations.Measurement; +import org.openjdk.jmh.annotations.Mode; +import org.openjdk.jmh.annotations.OutputTimeUnit; +import org.openjdk.jmh.annotations.Param; +import org.openjdk.jmh.annotations.Scope; +import org.openjdk.jmh.annotations.State; +import org.openjdk.jmh.annotations.Warmup; + +@BenchmarkMode(Mode.AverageTime) +@OutputTimeUnit(TimeUnit.NANOSECONDS) +@State(Scope.Thread) +@Warmup(iterations = 3, time = 1, timeUnit = TimeUnit.SECONDS) +@Measurement(iterations = 3, time = 1, timeUnit = TimeUnit.SECONDS) +@Fork(3) +public class DirectByteBufferAlloc { + + @Param({ + "128", // 128 bytes + "1024", // 1KB + "1048576", // 1 MB + "16777216" // 16MB + }) + public int bytes; + + @Benchmark + public ByteBuffer allocateDirectBuffer() { + return ByteBuffer.allocateDirect(bytes); + } +} diff --git a/test/micro/org/openjdk/bench/vm/compiler/CountedLoopCastIV.java b/test/micro/org/openjdk/bench/vm/compiler/CountedLoopCastIV.java new file mode 100644 index 00000000000..75e33161dcb --- /dev/null +++ b/test/micro/org/openjdk/bench/vm/compiler/CountedLoopCastIV.java @@ -0,0 +1,77 @@ +/* + * Copyright (c) 2025, NVIDIA CORPORATION & 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. + * + * 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 org.openjdk.bench.vm.compiler; + +import org.openjdk.jmh.annotations.*; + +import java.util.Objects; +import java.util.concurrent.TimeUnit; + +@Warmup(iterations = 3, time = 1) +@Measurement(iterations = 5, time = 1) +@BenchmarkMode(Mode.Throughput) +@OutputTimeUnit(TimeUnit.SECONDS) +@State(Scope.Thread) +@Fork(value=3) +public class CountedLoopCastIV { + @Param({"1024", "1536", "2048"}) + private int limit; + + private static final int LEN = 2048; + private int start; + private int[] arr; + + @Setup + public void init() { + arr = new int[LEN]; + for (int i = 0; i < LEN; i++) { + arr[i] = i; + } + + start = 0; + limit = Math.min(limit, LEN - 4); + } + + @Benchmark + public void loop_iv_int() { + int i = start; + while (i < limit) { + Objects.checkIndex(i, LEN - 1); + int a = arr[i + 1]; + Objects.checkIndex(i, LEN - 3); + arr[i + 3] = a; + i++; + } + } + + @Benchmark + public void loop_iv_long() { + for (long i = start; i < limit; i++) { + Objects.checkIndex(i, LEN - 1); + int a = arr[(int)i + 1]; + Objects.checkIndex(i, LEN - 3); + arr[(int)i + 3] = a; + } + } +} diff --git a/test/micro/org/openjdk/bench/vm/compiler/x86/RedundantLeaPeephole.java b/test/micro/org/openjdk/bench/vm/compiler/x86/RedundantLeaPeephole.java new file mode 100644 index 00000000000..00a33a47617 --- /dev/null +++ b/test/micro/org/openjdk/bench/vm/compiler/x86/RedundantLeaPeephole.java @@ -0,0 +1,112 @@ +/* + * Copyright (c) 2025, 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. + * + * 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 org.openjdk.bench.vm.compiler.x86; + +import org.openjdk.jmh.annotations.*; + +import java.util.concurrent.TimeUnit; + +@BenchmarkMode(Mode.AverageTime) +@OutputTimeUnit(TimeUnit.NANOSECONDS) +@Warmup(iterations = 10, time = 1, timeUnit = TimeUnit.SECONDS) +@Measurement(iterations = 10, time = 1, timeUnit = TimeUnit.SECONDS) +// Fix heap size since the StoreN benchmarks are allocating a lot and dependent on GC selection and compressed oop mode. +@Fork(value = 3, jvmArgsAppend = {"-Xms1g", "-Xmx1g"}) +@State(Scope.Thread) +public class RedundantLeaPeephole { + @State(Scope.Thread) + public class StoreNHelper { + Object o1; + Object o2; + + public StoreNHelper(Object o1, Object o2) { + this.o1 = o1; + this.o2 = o2; + } + } + + @State(Scope.Thread) + public class StringEqualsHelper { + private String str; + + public StringEqualsHelper(String str) { + this.str = str; + } + + @CompilerControl(CompilerControl.Mode.INLINE) + public boolean doEquals(String other) { + return this.str.equals(other); + } + } + + private static final int SIZE = 42; + private static final int SMALL_IDX = 3; + private static final int BIG_IDX = 33; + + private static final Object O1 = new Object(); + private static final Object O2 = new Object(); + + private Object[] arr1 = new Object[SIZE]; + private Object[] arr2 = new Object[SIZE]; + private StoreNHelper[] arrH1 = new StoreNHelper[SIZE]; + private StoreNHelper[] arrH2 = new StoreNHelper[SIZE]; + + private StringEqualsHelper strEqHelper = new StringEqualsHelper("foo"); + + @Benchmark + @Fork(jvmArgsAppend = {"-XX:+UseSerialGC"}) + public void benchStoreNRemoveSpillSerial() { + this.arrH1[SMALL_IDX] = new StoreNHelper(O1, O2); + this.arrH2[BIG_IDX] = new StoreNHelper(O2, O1); + } + + @Benchmark + @Fork(jvmArgsAppend = {"-XX:+UseParallelGC"}) + public void benchStoreNRemoveSpillParallel() { + this.arrH1[SMALL_IDX] = new StoreNHelper(O1, O2); + this.arrH2[BIG_IDX] = new StoreNHelper(O2, O1); + } + + @Benchmark + @Fork(jvmArgsAppend = {"-XX:+UseSerialGC"}) + public void benchStoreNNoAllocSerial() { + this.arr1[SMALL_IDX] = O1; + this.arr1[BIG_IDX] = O2; + this.arr2[SMALL_IDX] = O1; + this.arr2[BIG_IDX] = O2; + } + + @Benchmark + @Fork(jvmArgsAppend = {"-XX:+UseParallelGC"}) + public void benchStoreNNoAllocParallel() { + this.arr1[SMALL_IDX] = O1; + this.arr1[BIG_IDX] = O2; + this.arr2[SMALL_IDX] = O1; + this.arr2[BIG_IDX] = O2; + } + + @Benchmark + public boolean benchStringEquals() { + return this.strEqHelper.doEquals("bar"); + } +}