diff --git a/.github/workflows/build-cross-compile.yml b/.github/workflows/build-cross-compile.yml index 168c5924d8610..6398489c842c7 100644 --- a/.github/workflows/build-cross-compile.yml +++ b/.github/workflows/build-cross-compile.yml @@ -29,17 +29,14 @@ on: workflow_call: inputs: gcc-major-version: - required: false + required: true type: string - default: '10' apt-gcc-version: - required: false + required: true type: string - default: '10.3.0-1ubuntu1~20.04' - apt-gcc-cross-suffix: - required: false + apt-gcc-cross-version: + required: true type: string - default: 'cross1' jobs: build-cross-compile: @@ -95,8 +92,8 @@ jobs: sudo apt-get install \ gcc-${{ inputs.gcc-major-version }}=${{ inputs.apt-gcc-version }} \ g++-${{ inputs.gcc-major-version }}=${{ inputs.apt-gcc-version }} \ - gcc-${{ inputs.gcc-major-version }}-${{ matrix.gnu-arch }}-linux-gnu${{ matrix.gnu-abi}}=${{ inputs.apt-gcc-version }}${{ inputs.apt-gcc-cross-suffix }} \ - g++-${{ inputs.gcc-major-version }}-${{ matrix.gnu-arch }}-linux-gnu${{ matrix.gnu-abi}}=${{ inputs.apt-gcc-version }}${{ inputs.apt-gcc-cross-suffix }} \ + gcc-${{ inputs.gcc-major-version }}-${{ matrix.gnu-arch }}-linux-gnu${{ matrix.gnu-abi}}=${{ inputs.apt-gcc-cross-version }} \ + g++-${{ inputs.gcc-major-version }}-${{ matrix.gnu-arch }}-linux-gnu${{ matrix.gnu-abi}}=${{ inputs.apt-gcc-cross-version }} \ libxrandr-dev libxtst-dev libcups2-dev libasound2-dev sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-${{ inputs.gcc-major-version }} 100 --slave /usr/bin/g++ g++ /usr/bin/g++-${{ inputs.gcc-major-version }} @@ -143,8 +140,8 @@ jobs: --openjdk-target=${{ matrix.gnu-arch }}-linux-gnu${{ matrix.gnu-abi}} --with-sysroot=sysroot --with-build-jdk=${{ steps.buildjdk.outputs.jdk-path }} - CC=${{ matrix.gnu-arch }}-linux-gnu${{ matrix.gnu-abi}}-gcc-10 - CXX=${{ matrix.gnu-arch }}-linux-gnu${{ matrix.gnu-abi}}-g++-10 + CC=${{ matrix.gnu-arch }}-linux-gnu${{ matrix.gnu-abi}}-gcc-${{ inputs.gcc-major-version }} + CXX=${{ matrix.gnu-arch }}-linux-gnu${{ matrix.gnu-abi}}-g++-${{ inputs.gcc-major-version }} - name: 'Build' id: build diff --git a/.github/workflows/build-linux.yml b/.github/workflows/build-linux.yml index b509ea6e7fed3..992807f2d8bd1 100644 --- a/.github/workflows/build-linux.yml +++ b/.github/workflows/build-linux.yml @@ -42,6 +42,13 @@ on: required: false type: string default: '[ "debug", "release" ]' + gcc-major-version: + required: true + type: string + gcc-package-suffix: + required: false + type: string + default: '' apt-gcc-version: required: true type: string @@ -101,8 +108,8 @@ jobs: fi sudo apt-get update sudo apt-get install --only-upgrade apt - sudo apt-get install gcc-${{ inputs.apt-gcc-version }} g++-${{ inputs.apt-gcc-version }} libxrandr-dev${{ steps.arch.outputs.suffix }} libxtst-dev${{ steps.arch.outputs.suffix }} libcups2-dev${{ steps.arch.outputs.suffix }} libasound2-dev${{ steps.arch.outputs.suffix }} ${{ inputs.apt-extra-packages }} - sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-10 100 --slave /usr/bin/g++ g++ /usr/bin/g++-10 + sudo apt-get install gcc-${{ inputs.gcc-major-version }}${{ inputs.gcc-package-suffix }}=${{ inputs.apt-gcc-version }} g++-${{ inputs.gcc-major-version }}${{ inputs.gcc-package-suffix }}=${{ inputs.apt-gcc-version }} libxrandr-dev${{ steps.arch.outputs.suffix }} libxtst-dev${{ steps.arch.outputs.suffix }} libcups2-dev${{ steps.arch.outputs.suffix }} libasound2-dev${{ steps.arch.outputs.suffix }} ${{ inputs.apt-extra-packages }} + sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-${{ inputs.gcc-major-version }} 100 --slave /usr/bin/g++ g++ /usr/bin/g++-${{ inputs.gcc-major-version }} - name: 'Configure' run: > diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index ec7e3c9957b2c..f4af7dce0df43 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -123,7 +123,8 @@ jobs: uses: ./.github/workflows/build-linux.yml with: platform: linux-x64 - apt-gcc-version: '10=10.3.0-1ubuntu1~20.04' + gcc-major-version: '10' + apt-gcc-version: '10.3.0-1ubuntu1~20.04' # The linux-x64 jdk bundle is used as buildjdk for the cross-compile job if: needs.select.outputs.linux-x64 == 'true' || needs.select.outputs.linux-cross-compile == 'true' @@ -133,7 +134,9 @@ jobs: uses: ./.github/workflows/build-linux.yml with: platform: linux-x86 - apt-gcc-version: '10-multilib' + gcc-major-version: '10' + gcc-package-suffix: '-multilib' + apt-gcc-version: '10.3.0-1ubuntu1~20.04' apt-architecture: 'i386' # Some multilib libraries do not have proper inter-dependencies, so we have to # install their dependencies manually. @@ -149,7 +152,8 @@ jobs: platform: linux-x64 make-target: 'hotspot' debug-levels: '[ "debug" ]' - apt-gcc-version: '10=10.3.0-1ubuntu1~20.04' + gcc-major-version: '10' + apt-gcc-version: '10.3.0-1ubuntu1~20.04' extra-conf-options: '--disable-precompiled-headers' if: needs.select.outputs.linux-x64-variants == 'true' @@ -161,7 +165,8 @@ jobs: platform: linux-x64 make-target: 'hotspot' debug-levels: '[ "debug" ]' - apt-gcc-version: '10=10.3.0-1ubuntu1~20.04' + gcc-major-version: '10' + apt-gcc-version: '10.3.0-1ubuntu1~20.04' extra-conf-options: '--with-jvm-variants=zero --disable-precompiled-headers' if: needs.select.outputs.linux-x64-variants == 'true' @@ -173,7 +178,8 @@ jobs: platform: linux-x64 make-target: 'hotspot' debug-levels: '[ "debug" ]' - apt-gcc-version: '10=10.3.0-1ubuntu1~20.04' + gcc-major-version: '10' + apt-gcc-version: '10.3.0-1ubuntu1~20.04' extra-conf-options: '--with-jvm-variants=minimal --disable-precompiled-headers' if: needs.select.outputs.linux-x64-variants == 'true' @@ -186,7 +192,8 @@ jobs: make-target: 'hotspot' # Technically this is not the "debug" level, but we can't inject a new matrix state for just this job debug-levels: '[ "debug" ]' - apt-gcc-version: '10=10.3.0-1ubuntu1~20.04' + gcc-major-version: '10' + apt-gcc-version: '10.3.0-1ubuntu1~20.04' extra-conf-options: '--with-debug-level=optimized --disable-precompiled-headers' if: needs.select.outputs.linux-x64-variants == 'true' @@ -196,6 +203,10 @@ jobs: - select - build-linux-x64 uses: ./.github/workflows/build-cross-compile.yml + with: + gcc-major-version: '10' + apt-gcc-version: '10.3.0-1ubuntu1~20.04' + apt-gcc-cross-version: '10.3.0-1ubuntu1~20.04cross1' if: needs.select.outputs.linux-cross-compile == 'true' build-macos-x64: diff --git a/doc/testing.html b/doc/testing.html index 213e23664c37c..32edbe2331c03 100644 --- a/doc/testing.html +++ b/doc/testing.html @@ -64,6 +64,9 @@
To be able to run JTReg tests, configure
needs to know where to find the JTReg test framework. If it is not picked up automatically by configure, use the --with-jtreg=<path to jtreg home>
option to point to the JTReg framework. Note that this option should point to the JTReg home, i.e. the top directory, containing lib/jtreg.jar
etc. (An alternative is to set the JT_HOME
environment variable to point to the JTReg home before running configure
.)
To be able to run microbenchmarks, configure
needs to know where to find the JMH dependency. Use --with-jmh=<path to JMH jars>
to point to a directory containing the core JMH and transitive dependencies. The recommended dependencies can be retrieved by running sh make/devkit/createJMHBundle.sh
, after which --with-jmh=build/jmh/jars
should work.
When tests fail or timeout, jtreg runs its failure handler to capture necessary data from the system where the test was run. This data can then be used to analyze the test failures. Collecting this data involves running various commands (which are listed in files residing in test/failure_handler/src/share/conf
) and some of these commands use sudo
. If the system's sudoers
file isn't configured to allow running these commands, then it can result in password being prompted during the failure handler execution. Typically, when running locally, collecting this additional data isn't always necessary. To disable running the failure handler, use --enable-jtreg-failure-handler=no
when running configure
. If, however, you want to let the failure handler to run and don't want to be prompted for sudo password, then you can configure your sudoers
file appropriately. Please read the necessary documentation of your operating system to see how to do that; here we only show one possible way of doing that - edit the /etc/sudoers.d/sudoers
file to include the following line:
johndoe ALL=(ALL) NOPASSWD: /sbin/dmesg
+This line configures sudo
to not prompt for password for the /sbin/dmesg
command (this is one of the commands that is listed in the files at test/failure_handler/src/share/conf
), for the user johndoe
. Here johndoe
is the user account under which the jtreg tests are run. Replace the username with a relevant user account of your system.
All functionality is available using the test
make target. In this use case, the test or tests to be executed is controlled using the TEST
variable. To speed up subsequent test runs with no source code changes, test-only
can be used instead, which do not depend on the source and test image build.
For some common top-level tests, direct make targets have been generated. This includes all JTReg test groups, the hotspot gtest, and custom tests (if present). This means that make test-tier1
is equivalent to make test TEST="tier1"
, but the latter is more tab-completion friendly. For more complex test runs, the test TEST="x"
solution needs to be used.
* {package-prefix}.{major}.{minor} diff --git a/src/java.base/share/classes/java/text/DateFormatSymbols.java b/src/java.base/share/classes/java/text/DateFormatSymbols.java index a76c7cb44f4c0..f621b1d115c8d 100644 --- a/src/java.base/share/classes/java/text/DateFormatSymbols.java +++ b/src/java.base/share/classes/java/text/DateFormatSymbols.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1996, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1996, 2022, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -697,11 +697,6 @@ public boolean equals(Object obj) // =======================privates=============================== - /** - * Useful constant for defining time zone offsets. - */ - static final int millisPerHour = 60*60*1000; - /** * Cache to hold DateFormatSymbols instances per Locale. */ diff --git a/src/java.base/share/classes/java/text/MergeCollation.java b/src/java.base/share/classes/java/text/MergeCollation.java index 1b092ed207ac1..41c4bef71cf2f 100644 --- a/src/java.base/share/classes/java/text/MergeCollation.java +++ b/src/java.base/share/classes/java/text/MergeCollation.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1996, 2019, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1996, 2022, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -86,7 +86,7 @@ public String getPattern() { * before & and < */ public String getPattern(boolean withWhiteSpace) { - StringBuffer result = new StringBuffer(); + StringBuilder result = new StringBuilder(); PatternEntry tmp = null; ArrayListextList = null; int i; @@ -146,7 +146,7 @@ public String emitPattern() { * builder. */ public String emitPattern(boolean withWhiteSpace) { - StringBuffer result = new StringBuffer(); + StringBuilder result = new StringBuilder(); for (int i = 0; i < patterns.size(); ++i) { PatternEntry entry = patterns.get(i); diff --git a/src/java.base/share/classes/java/text/PatternEntry.java b/src/java.base/share/classes/java/text/PatternEntry.java index 858c3152cb711..53229f294e564 100644 --- a/src/java.base/share/classes/java/text/PatternEntry.java +++ b/src/java.base/share/classes/java/text/PatternEntry.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1996, 2000, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1996, 2022, Oracle and/or its affiliates. All rights reserved. * 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,14 +52,14 @@ class PatternEntry { /** * Gets the current extension, quoted */ - public void appendQuotedExtension(StringBuffer toAddTo) { + private void appendQuotedExtension(StringBuilder toAddTo) { appendQuoted(extension,toAddTo); } /** * Gets the current chars, quoted */ - public void appendQuotedChars(StringBuffer toAddTo) { + private void appendQuotedChars(StringBuilder toAddTo) { appendQuoted(chars,toAddTo); } @@ -83,7 +83,7 @@ public int hashCode() { * For debugging. */ public String toString() { - StringBuffer result = new StringBuffer(); + StringBuilder result = new StringBuilder(); addToBuffer(result, true, false, null); return result.toString(); } @@ -111,7 +111,7 @@ final String getChars() { // ===== privates ===== - void addToBuffer(StringBuffer toAddTo, + void addToBuffer(StringBuilder toAddTo, boolean showExtension, boolean showWhiteSpace, PatternEntry lastEntry) @@ -151,7 +151,7 @@ void addToBuffer(StringBuffer toAddTo, } } - static void appendQuoted(String chars, StringBuffer toAddTo) { + private static void appendQuoted(String chars, StringBuilder toAddTo) { boolean inQuote = false; char ch = chars.charAt(0); if (Character.isSpaceChar(ch)) { diff --git a/src/java.base/share/classes/javax/crypto/Cipher.java b/src/java.base/share/classes/javax/crypto/Cipher.java index 5d2f37d631276..2eb2ffe14a4aa 100644 --- a/src/java.base/share/classes/javax/crypto/Cipher.java +++ b/src/java.base/share/classes/javax/crypto/Cipher.java @@ -1239,6 +1239,8 @@ private static void checkOpmode(int opmode) { * @throws UnsupportedOperationException if {@code opmode} is * {@code WRAP_MODE} or {@code UNWRAP_MODE} but the mode is not implemented * by the underlying {@code CipherSpi} + * @throws InvalidParameterException if {@code opmode} is not one of the + * recognized values */ public final void init(int opmode, Key key) throws InvalidKeyException { init(opmode, key, JCAUtil.getDefSecureRandom()); @@ -1294,6 +1296,8 @@ public final void init(int opmode, Key key) throws InvalidKeyException { * @throws UnsupportedOperationException if {@code opmode} is * {@code WRAP_MODE} or {@code UNWRAP_MODE} but the mode is not implemented * by the underlying {@code CipherSpi} + * @throws InvalidParameterException if {@code opmode} is not one of the + * recognized values */ public final void init(int opmode, Key key, SecureRandom random) throws InvalidKeyException @@ -1379,6 +1383,9 @@ public final void init(int opmode, Key key, SecureRandom random) * @throws UnsupportedOperationException if {@code opmode} is * {@code WRAP_MODE} or {@code UNWRAP_MODE} but the mode is not implemented * by the underlying {@code CipherSpi} + * @throws InvalidParameterException if {@code opmode} is not one of the + * recognized values + * */ public final void init(int opmode, Key key, AlgorithmParameterSpec params) throws InvalidKeyException, InvalidAlgorithmParameterException @@ -1441,6 +1448,9 @@ public final void init(int opmode, Key key, AlgorithmParameterSpec params) * @throws UnsupportedOperationException if {@code opmode} is * {@code WRAP_MODE} or {@code UNWRAP_MODE} but the mode is not implemented * by the underlying {@code CipherSpi} + * @throws InvalidParameterException if {@code opmode} is not one of the + * recognized values + * */ public final void init(int opmode, Key key, AlgorithmParameterSpec params, SecureRandom random) @@ -1522,6 +1532,8 @@ public final void init(int opmode, Key key, AlgorithmParameterSpec params, * @throws UnsupportedOperationException if {@code opmode} is * {@code WRAP_MODE} or {@code UNWRAP_MODE} but the mode is not implemented * by the underlying {@code CipherSpi} + * @throws InvalidParameterException if {@code opmode} is not one of the + * recognized values */ public final void init(int opmode, Key key, AlgorithmParameters params) throws InvalidKeyException, InvalidAlgorithmParameterException @@ -1584,6 +1596,8 @@ public final void init(int opmode, Key key, AlgorithmParameters params) * @throws UnsupportedOperationException if {@code opmode} is * {@code WRAP_MODE} or {@code UNWRAP_MODE} but the mode is not implemented * by the underlying {@code CipherSpi} + * @throws InvalidParameterException if {@code opmode} is not one of the + * recognized values */ public final void init(int opmode, Key key, AlgorithmParameters params, SecureRandom random) @@ -1671,6 +1685,8 @@ public final void init(int opmode, Key key, AlgorithmParameters params, * @throws UnsupportedOperationException if {@code opmode} is * {@code WRAP_MODE} or {@code UNWRAP_MODE} but the mode is not implemented * by the underlying {@code CipherSpi} + * @throws InvalidParameterException if {@code opmode} is not one of the + * recognized values */ public final void init(int opmode, Certificate certificate) throws InvalidKeyException @@ -1740,6 +1756,8 @@ public final void init(int opmode, Certificate certificate) * @throws UnsupportedOperationException if {@code opmode} is * {@code WRAP_MODE} or {@code UNWRAP_MODE} but the mode is not implemented * by the underlying {@code CipherSpi} + * @throws InvalidParameterException if {@code opmode} is not one of the + * recognized values */ public final void init(int opmode, Certificate certificate, SecureRandom random) diff --git a/src/java.base/share/classes/javax/crypto/Mac.java b/src/java.base/share/classes/javax/crypto/Mac.java index 8d4217ab0c3a5..a8ab43177c11d 100644 --- a/src/java.base/share/classes/javax/crypto/Mac.java +++ b/src/java.base/share/classes/javax/crypto/Mac.java @@ -423,7 +423,7 @@ private String getProviderName() { * * @param key the key. * - * @exception InvalidKeyException if the given key is inappropriate for + * @throws InvalidKeyException if the given key is inappropriate for * initializing this MAC. */ public final void init(Key key) throws InvalidKeyException { @@ -451,9 +451,9 @@ public final void init(Key key) throws InvalidKeyException { * @param key the key. * @param params the algorithm parameters. * - * @exception InvalidKeyException if the given key is inappropriate for + * @throws InvalidKeyException if the given key is inappropriate for * initializing this MAC. - * @exception InvalidAlgorithmParameterException if the given algorithm + * @throws InvalidAlgorithmParameterException if the given algorithm * parameters are inappropriate for this MAC. */ public final void init(Key key, AlgorithmParameterSpec params) @@ -476,7 +476,7 @@ public final void init(Key key, AlgorithmParameterSpec params) * * @param input the input byte to be processed. * - * @exception IllegalStateException if this {@code Mac} has not been + * @throws IllegalStateException if this {@code Mac} has not been * initialized. */ public final void update(byte input) throws IllegalStateException { @@ -492,7 +492,7 @@ public final void update(byte input) throws IllegalStateException { * * @param input the array of bytes to be processed. * - * @exception IllegalStateException if this {@code Mac} has not been + * @throws IllegalStateException if this {@code Mac} has not been * initialized. */ public final void update(byte[] input) throws IllegalStateException { @@ -513,7 +513,7 @@ public final void update(byte[] input) throws IllegalStateException { * @param offset the offset in {@code input} where the input starts. * @param len the number of bytes to process. * - * @exception IllegalStateException if this {@code Mac} has not been + * @throws IllegalStateException if this {@code Mac} has not been * initialized. */ public final void update(byte[] input, int offset, int len) @@ -538,8 +538,9 @@ public final void update(byte[] input, int offset, int len) * * @param input the ByteBuffer * - * @exception IllegalStateException if this {@code Mac} has not been + * @throws IllegalStateException if this {@code Mac} has not been * initialized. + * @throws IllegalArgumentException if {@code input} is null * @since 1.5 */ public final void update(ByteBuffer input) { @@ -569,7 +570,7 @@ public final void update(ByteBuffer input) { * * @return the MAC result. * - * @exception IllegalStateException if this {@code Mac} has not been + * @throws IllegalStateException if this {@code Mac} has not been * initialized. */ public final byte[] doFinal() throws IllegalStateException { @@ -603,9 +604,9 @@ public final byte[] doFinal() throws IllegalStateException { * @param outOffset the offset in {@code output} where the MAC is * stored * - * @exception ShortBufferException if the given output buffer is too small + * @throws ShortBufferException if the given output buffer is too small * to hold the result - * @exception IllegalStateException if this {@code Mac} has not been + * @throws IllegalStateException if this {@code Mac} has not been * initialized. */ public final void doFinal(byte[] output, int outOffset) @@ -641,7 +642,7 @@ public final void doFinal(byte[] output, int outOffset) * @param input data in bytes * @return the MAC result. * - * @exception IllegalStateException if this {@code Mac} has not been + * @throws IllegalStateException if this {@code Mac} has not been * initialized. */ public final byte[] doFinal(byte[] input) throws IllegalStateException @@ -678,7 +679,7 @@ public final void reset() { * * @return a clone if the provider implementation is cloneable. * - * @exception CloneNotSupportedException if this is called on a + * @throws CloneNotSupportedException if this is called on a * delegate that does not support {@code Cloneable}. */ public final Object clone() throws CloneNotSupportedException { diff --git a/src/java.base/share/classes/javax/crypto/MacSpi.java b/src/java.base/share/classes/javax/crypto/MacSpi.java index d8fdeda6ee2f2..dbed0fa9877a3 100644 --- a/src/java.base/share/classes/javax/crypto/MacSpi.java +++ b/src/java.base/share/classes/javax/crypto/MacSpi.java @@ -65,9 +65,9 @@ public MacSpi() {} * @param key the (secret) key. * @param params the algorithm parameters. * - * @exception InvalidKeyException if the given key is inappropriate for + * @throws InvalidKeyException if the given key is inappropriate for * initializing this MAC. - * @exception InvalidAlgorithmParameterException if the given algorithm + * @throws InvalidAlgorithmParameterException if the given algorithm * parameters are inappropriate for this MAC. */ protected abstract void engineInit(Key key, @@ -101,6 +101,9 @@ protected abstract void engineInit(Key key, * process ByteBuffers more efficiently than byte arrays. * * @param input the ByteBuffer + * + * @throws NullPointerException if {@code input} is null + * * @since 1.5 */ protected void engineUpdate(ByteBuffer input) { @@ -145,7 +148,7 @@ protected void engineUpdate(ByteBuffer input) { * * @return a clone if the implementation is cloneable. * - * @exception CloneNotSupportedException if this is called + * @throws CloneNotSupportedException if this is called * on an implementation that does not support {@code Cloneable}. */ public Object clone() throws CloneNotSupportedException { diff --git a/src/java.base/share/classes/jdk/internal/module/ModuleReferenceImpl.java b/src/java.base/share/classes/jdk/internal/module/ModuleReferenceImpl.java index 209131c95c381..e460b0fc47eb6 100644 --- a/src/java.base/share/classes/jdk/internal/module/ModuleReferenceImpl.java +++ b/src/java.base/share/classes/jdk/internal/module/ModuleReferenceImpl.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2016, 2022, Oracle and/or its affiliates. All rights reserved. * 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,8 +62,11 @@ public class ModuleReferenceImpl extends ModuleReference { // ModuleResolution flags private final ModuleResolution moduleResolution; - // cached hash of this module to avoid needing to compute it many times - private byte[] cachedHash; + // Single-slot cache of this module's hash to avoid needing to compute + // it many times. For correctness under concurrent updates, we need to + // wrap the fields updated at the same time with a record. + private record CachedHash(byte[] hash, String algorithm) {} + private CachedHash cachedHash; /** * Constructs a new instance of this class. @@ -139,13 +142,17 @@ public ModuleResolution moduleResolution() { * @throws java.io.UncheckedIOException if an I/O error occurs */ public byte[] computeHash(String algorithm) { - byte[] result = cachedHash; - if (result != null) - return result; - if (hasher == null) + CachedHash ch = cachedHash; + if (ch != null && ch.algorithm().equals(algorithm)) { + return ch.hash(); + } + + if (hasher == null) { return null; - cachedHash = result = hasher.generate(algorithm); - return result; + } + byte[] hash = hasher.generate(algorithm); + cachedHash = new CachedHash(hash, algorithm); + return hash; } @Override diff --git a/src/java.base/share/classes/sun/nio/ch/FileChannelImpl.java b/src/java.base/share/classes/sun/nio/ch/FileChannelImpl.java index 17bd3333db192..697bb5d640662 100644 --- a/src/java.base/share/classes/sun/nio/ch/FileChannelImpl.java +++ b/src/java.base/share/classes/sun/nio/ch/FileChannelImpl.java @@ -570,10 +570,11 @@ private long transferToDirectlyInternal(long position, int icount, ti = threads.add(); if (!isOpen()) return -1; + boolean append = fdAccess.getAppend(targetFD); do { long comp = Blocker.begin(); try { - n = transferTo0(fd, position, icount, targetFD); + n = transferTo0(fd, position, icount, targetFD, append); } finally { Blocker.end(comp); } @@ -801,7 +802,8 @@ private long transferFromDirectlyInternal(FileDescriptor srcFD, do { long comp = Blocker.begin(); try { - n = transferFrom0(srcFD, fd, position, count); + boolean append = fdAccess.getAppend(fd); + n = transferFrom0(srcFD, fd, position, count, append); } finally { Blocker.end(comp); } @@ -1573,11 +1575,13 @@ private native long map0(FileDescriptor fd, int prot, long position, // Transfers from src to dst, or returns IOStatus.UNSUPPORTED (-4) or // IOStatus.UNSUPPORTED_CASE (-6) if the kernel does not support it private static native long transferTo0(FileDescriptor src, long position, - long count, FileDescriptor dst); + long count, FileDescriptor dst, + boolean append); private static native long transferFrom0(FileDescriptor src, FileDescriptor dst, - long position, long count); + long position, long count, + boolean append); // Retrieves the maximum size of a transfer private static native int maxDirectTransferSize0(); diff --git a/src/java.base/unix/native/libnio/ch/FileChannelImpl.c b/src/java.base/unix/native/libnio/ch/FileChannelImpl.c index 0511183ced6d4..c14e0611f5d0b 100644 --- a/src/java.base/unix/native/libnio/ch/FileChannelImpl.c +++ b/src/java.base/unix/native/libnio/ch/FileChannelImpl.c @@ -169,14 +169,41 @@ JNIEXPORT jlong JNICALL Java_sun_nio_ch_FileChannelImpl_transferTo0(JNIEnv *env, jobject this, jobject srcFDO, jlong position, jlong count, - jobject dstFDO) + jobject dstFDO, jboolean append) { jint srcFD = fdval(env, srcFDO); jint dstFD = fdval(env, dstFDO); #if defined(__linux__) + // copy_file_range fails with EBADF when appending, and sendfile + // fails with EINVAL + if (append == JNI_TRUE) + return IOS_UNSUPPORTED_CASE; + off64_t offset = (off64_t)position; - jlong n = sendfile64(dstFD, srcFD, &offset, (size_t)count); + jlong n; + if (my_copy_file_range_func != NULL) { + size_t len = (size_t)count; + n = my_copy_file_range_func(srcFD, &offset, dstFD, NULL, len, 0); + if (n < 0) { + switch (errno) { + case EINTR: + return IOS_INTERRUPTED; + case EINVAL: + case ENOSYS: + case EXDEV: + // ignore and try sendfile() + break; + default: + JNU_ThrowIOExceptionWithLastError(env, "Copy failed"); + return IOS_THROWN; + } + } + if (n >= 0) + return n; + } + + n = sendfile64(dstFD, srcFD, &offset, (size_t)count); if (n < 0) { if (errno == EAGAIN) return IOS_UNAVAILABLE; @@ -262,20 +289,27 @@ Java_sun_nio_ch_FileChannelImpl_transferTo0(JNIEnv *env, jobject this, JNIEXPORT jlong JNICALL Java_sun_nio_ch_FileChannelImpl_transferFrom0(JNIEnv *env, jobject this, jobject srcFDO, jobject dstFDO, - jlong position, jlong count) + jlong position, jlong count, + jboolean append) { #if defined(__linux__) if (my_copy_file_range_func == NULL) return IOS_UNSUPPORTED; + // copy_file_range fails with EBADF when appending + if (append == JNI_TRUE) + return IOS_UNSUPPORTED_CASE; jint srcFD = fdval(env, srcFDO); jint dstFD = fdval(env, dstFDO); off64_t offset = (off64_t)position; - jlong n = my_copy_file_range_func(srcFD, NULL, dstFD, &offset, count, 0); + size_t len = (size_t)count; + jlong n = my_copy_file_range_func(srcFD, NULL, dstFD, &offset, len, 0); if (n < 0) { if (errno == EAGAIN) return IOS_UNAVAILABLE; + if (errno == ENOSYS) + return IOS_UNSUPPORTED_CASE; if ((errno == EBADF || errno == EINVAL || errno == EXDEV) && ((ssize_t)count >= 0)) return IOS_UNSUPPORTED_CASE; diff --git a/src/java.base/windows/native/libnio/ch/FileChannelImpl.c b/src/java.base/windows/native/libnio/ch/FileChannelImpl.c index 554bc864b8bf9..ce257658d7398 100644 --- a/src/java.base/windows/native/libnio/ch/FileChannelImpl.c +++ b/src/java.base/windows/native/libnio/ch/FileChannelImpl.c @@ -147,7 +147,7 @@ JNIEXPORT jlong JNICALL Java_sun_nio_ch_FileChannelImpl_transferTo0(JNIEnv *env, jobject this, jobject srcFD, jlong position, jlong count, - jobject dstFD) + jobject dstFD, jboolean append) { const int PACKET_SIZE = 524288; @@ -191,7 +191,8 @@ Java_sun_nio_ch_FileChannelImpl_transferTo0(JNIEnv *env, jobject this, JNIEXPORT jlong JNICALL Java_sun_nio_ch_FileChannelImpl_transferFrom0(JNIEnv *env, jobject this, jobject srcFDO, jobject dstFDO, - jlong position, jlong count) + jlong position, jlong count, + jboolean append) { return IOS_UNSUPPORTED; } diff --git a/src/java.desktop/macosx/classes/com/apple/laf/AquaMenuPainter.java b/src/java.desktop/macosx/classes/com/apple/laf/AquaMenuPainter.java index be700927aa12e..5a13822fd5acd 100644 --- a/src/java.desktop/macosx/classes/com/apple/laf/AquaMenuPainter.java +++ b/src/java.desktop/macosx/classes/com/apple/laf/AquaMenuPainter.java @@ -494,13 +494,15 @@ private String layoutMenuItem(final JMenuItem menuItem, final FontMetrics fm, fi if (!isTopLevelMenu) { // if ( GetSysDirection() < 0 ) hierRect.right = hierRect.left + w + 4; // else hierRect.left = hierRect.right - w - 4; - arrowIconR.x = (viewR.width - arrowIconR.width) + 1; - arrowIconR.y = viewR.y + (labelR.height / 2) - (arrowIconR.height / 2) + 1; - checkIconR.y = viewR.y + (labelR.height / 2) - (checkIconR.height / 2); + arrowIconR.x = Math.abs((viewR.width - arrowIconR.width) + 1); + arrowIconR.y = Math.abs(viewR.y + (labelR.height / 2) - (arrowIconR.height / 2) + 1); + + checkIconR.y = Math.abs(viewR.y + (labelR.height / 2) - (checkIconR.height / 2)); checkIconR.x = 5; textR.width += 8; + } /*System.out.println("Layout: " +horizontalAlignment+ " v=" +viewR+" c="+checkIconR+" i="+ diff --git a/src/java.desktop/macosx/native/libawt_lwawt/java2d/metal/MTLLayer.h b/src/java.desktop/macosx/native/libawt_lwawt/java2d/metal/MTLLayer.h index dceac2ad433da..83e868b37b711 100644 --- a/src/java.desktop/macosx/native/libawt_lwawt/java2d/metal/MTLLayer.h +++ b/src/java.desktop/macosx/native/libawt_lwawt/java2d/metal/MTLLayer.h @@ -55,6 +55,7 @@ @property (readwrite, assign) int topInset; @property (readwrite, assign) int leftInset; @property (readwrite, assign) CVDisplayLinkRef displayLink; +@property (readwrite, atomic) int displayLinkCount; - (id) initWithJavaLayer:(jobject)layer; 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 1d30f7eb51df1..8967cca2e35c8 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 @@ -29,6 +29,7 @@ #import "LWCToolkit.h" #import "MTLSurfaceData.h" #import "JNIUtilities.h" +#define KEEP_ALIVE_INC 4 @implementation MTLLayer @@ -42,6 +43,7 @@ @implementation MTLLayer @synthesize leftInset; @synthesize nextDrawableCount; @synthesize displayLink; +@synthesize displayLinkCount; - (id) initWithJavaLayer:(jobject)layer { @@ -74,12 +76,15 @@ - (id) initWithJavaLayer:(jobject)layer self.opaque = YES; CVDisplayLinkCreateWithActiveCGDisplays(&displayLink); CVDisplayLinkSetOutputCallback(displayLink, &displayLinkCallback, (__bridge void*)self); + self.displayLinkCount = 0; return self; } - (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, devide=%p)", self.ctx, self.javaLayer, self.buffer, ctx.device); + J2dTraceLn4(J2D_TRACE_VERBOSE, + "MTLLayer.blitTexture: uninitialized (mtlc=%p, javaLayer=%p, buffer=%p, devide=%p)", self.ctx, + self.javaLayer, self.buffer, ctx.device); [self stopDisplayLink]; return; } @@ -100,9 +105,9 @@ - (void) blitTexture { NSUInteger src_h = self.buffer.height - src_y; if (src_h <= 0 || src_w <= 0) { - J2dTraceLn(J2D_TRACE_VERBOSE, "MTLLayer.blitTexture: Invalid src width or height."); - [self stopDisplayLink]; - return; + J2dTraceLn(J2D_TRACE_VERBOSE, "MTLLayer.blitTexture: Invalid src width or height."); + [self stopDisplayLink]; + return; } id commandBuf = [self.ctx createBlitCommandBuffer]; @@ -134,7 +139,11 @@ - (void) blitTexture { }]; [commandBuf commit]; - [self stopDisplayLink]; + + if (--self.displayLinkCount <= 0) { + self.displayLinkCount = 0; + [self stopDisplayLink]; + } } } @@ -177,13 +186,18 @@ - (void) redraw { } - (void) startDisplayLink { - if (!CVDisplayLinkIsRunning(self.displayLink)) + if (!CVDisplayLinkIsRunning(self.displayLink)) { CVDisplayLinkStart(self.displayLink); + J2dTraceLn(J2D_TRACE_VERBOSE, "MTLLayer_startDisplayLink"); + } + displayLinkCount += KEEP_ALIVE_INC; // Keep alive displaylink counter } - (void) stopDisplayLink { - if (CVDisplayLinkIsRunning(self.displayLink)) + if (CVDisplayLinkIsRunning(self.displayLink)) { CVDisplayLinkStop(self.displayLink); + J2dTraceLn(J2D_TRACE_VERBOSE, "MTLLayer_stopDisplayLink"); + } } CVReturn displayLinkCallback(CVDisplayLinkRef displayLink, const CVTimeStamp* now, const CVTimeStamp* outputTime, CVOptionFlags flagsIn, CVOptionFlags* flagsOut, void* displayLinkContext) diff --git a/src/java.desktop/share/classes/javax/swing/TimerQueue.java b/src/java.desktop/share/classes/javax/swing/TimerQueue.java index 6d067de2e979d..e1de594084f95 100644 --- a/src/java.desktop/share/classes/javax/swing/TimerQueue.java +++ b/src/java.desktop/share/classes/javax/swing/TimerQueue.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2022, Oracle and/or its affiliates. All rights reserved. * 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,15 +23,10 @@ * questions. */ - - package javax.swing; - - import java.security.AccessController; import java.security.PrivilegedAction; -import java.util.*; import java.util.concurrent.*; import java.util.concurrent.locks.*; import java.util.concurrent.atomic.AtomicLong; @@ -49,8 +44,6 @@ class TimerQueue implements Runnable { private static final Object sharedInstanceKey = new StringBuffer("TimerQueue.sharedInstanceKey"); - private static final Object expiredTimersKey = - new StringBuffer("TimerQueue.expiredTimersKey"); private final DelayQueue queue; private volatile boolean running; @@ -268,7 +261,7 @@ static class DelayedTimer implements Delayed { public final long getDelay(TimeUnit unit) { - return unit.convert(time - now(), TimeUnit.NANOSECONDS); + return unit.convert(time - now(), TimeUnit.NANOSECONDS); } final void setTime(long nanos) { diff --git a/src/java.desktop/share/classes/javax/swing/text/DefaultStyledDocument.java b/src/java.desktop/share/classes/javax/swing/text/DefaultStyledDocument.java index 5d373177eaf0b..ded8cd945941e 100644 --- a/src/java.desktop/share/classes/javax/swing/text/DefaultStyledDocument.java +++ b/src/java.desktop/share/classes/javax/swing/text/DefaultStyledDocument.java @@ -484,6 +484,18 @@ public Style getLogicalStyle(int p) { * A write lock is held by this operation while changes * are being made, and a DocumentEvent is sent to the listeners * after the change has been successfully completed. + * + * + * {@code offset} and {@code length} define the range of the text + * over which the attributes are set. + * If the length is <= 0, then no action is taken and the method + * just returns. + * If the offset is <=0 or > the length of the text then no + * action is taken, and the method just returns. + * Otherwise if {@code offset + length} will exceed the length of + * the text then the affected range is truncated. + *
+ * ** This method is thread safe, although most Swing methods * are not. Please see @@ -491,13 +503,13 @@ public Style getLogicalStyle(int p) { * in Swing for more information. * * @param offset the offset in the document >= 0 - * @param length the length >= 0 + * @param length the length > 0 * @param s the attributes * @param replace true if the previous attributes should be replaced * before setting the new attributes */ public void setCharacterAttributes(int offset, int length, AttributeSet s, boolean replace) { - if (length == 0) { + if (length <= 0) { return; } try { diff --git a/src/java.desktop/share/classes/sun/java2d/Disposer.java b/src/java.desktop/share/classes/sun/java2d/Disposer.java index e57483e66aefb..b64f77fe8a028 100644 --- a/src/java.desktop/share/classes/sun/java2d/Disposer.java +++ b/src/java.desktop/share/classes/sun/java2d/Disposer.java @@ -33,8 +33,8 @@ import java.lang.ref.WeakReference; import java.security.AccessController; import java.security.PrivilegedAction; -import java.util.ArrayList; import java.util.Hashtable; +import java.util.concurrent.ConcurrentLinkedDeque; /** * This class is used for registering and disposing the native @@ -145,7 +145,7 @@ public void run() { Reference> obj = queue.remove(); obj.clear(); DisposerRecord rec = records.remove(obj); - rec.dispose(); + safeDispose(rec); obj = null; rec = null; clearDeferredRecords(); @@ -164,21 +164,23 @@ public void run() { public static interface PollDisposable { }; - private static ArrayList
deferredRecords = null; + private static ConcurrentLinkedDeque deferredRecords = new ConcurrentLinkedDeque<>(); - private static void clearDeferredRecords() { - if (deferredRecords == null || deferredRecords.isEmpty()) { - return; + private static void safeDispose(DisposerRecord rec) { + try { + rec.dispose(); + } catch (final Exception e) { + System.out.println("Exception while disposing deferred rec."); } - for (int i=0;i (5); - } - deferredRecords.add(rec); + deferredRecords.offerLast(rec); } } } catch (Exception e) { diff --git a/src/java.desktop/windows/native/libsplashscreen/splashscreen_sys.c b/src/java.desktop/windows/native/libsplashscreen/splashscreen_sys.c index 7725d1467e99c..37444a78a3400 100644 --- a/src/java.desktop/windows/native/libsplashscreen/splashscreen_sys.c +++ b/src/java.desktop/windows/native/libsplashscreen/splashscreen_sys.c @@ -442,7 +442,7 @@ SplashInitPlatform(Splash * splash) splash->isLayered = FALSE; hdc = GetDC(NULL); paletteMode = (GetDeviceCaps(hdc, RASTERCAPS) & RC_PALETTE) != 0; - if (UpdateLayeredWindow && !paletteMode) { + if (!paletteMode) { splash->isLayered = TRUE; } splash->byteAlignment = 4; diff --git a/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/code/CodeBlob.java b/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/code/CodeBlob.java index d2f8db5efb98c..976af5bac20b8 100644 --- a/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/code/CodeBlob.java +++ b/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/code/CodeBlob.java @@ -183,12 +183,6 @@ public NMethod asNMethodOrNull() { public boolean isFrameCompleteAt(Address a) { return codeContains(a) && a.minus(codeBegin()) >= getFrameCompleteOffset(); } - // Reclamation support (really only used by the nmethods, but in order to get asserts to work - // in the CodeCache they are defined virtual here) - public boolean isZombie() { return false; } - - public boolean isLockedByVM() { return false; } - public ImmutableOopMap getOopMapForReturnAddress(Address returnAddress, boolean debugging) { Address pc = returnAddress; if (Assert.ASSERTS_ENABLED) { diff --git a/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/code/CodeCache.java b/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/code/CodeCache.java index 1b95286395119..a87a500dc2f06 100644 --- a/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/code/CodeCache.java +++ b/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/code/CodeCache.java @@ -92,9 +92,6 @@ public CodeBlob findBlob(Address start) { } // We could potientially look up non_entrant methods // NOTE: this is effectively a "guarantee", and is slightly different from the one in the VM - if (Assert.ASSERTS_ENABLED) { - Assert.that(!(result.isZombie() || result.isLockedByVM()), "unsafe access to zombie method"); - } return result; } diff --git a/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/code/NMethod.java b/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/code/NMethod.java index 02f49ae50f707..fd26185b99fe9 100644 --- a/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/code/NMethod.java +++ b/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/code/NMethod.java @@ -63,16 +63,6 @@ public class NMethod extends CompiledMethod { // FIXME: add access to flags (how?) - /** NMethod Flushing lock (if non-zero, then the nmethod is not removed) */ - private static JIntField lockCountField; - - /** not_entrant method removal. Each mark_sweep pass will update - this mark to current sweep invocation count if it is seen on the - stack. An not_entrant method can be removed when there is no - more activations, i.e., when the _stack_traversal_mark is less than - current sweep traversal index. */ - private static CIntegerField stackTraversalMarkField; - private static CIntegerField compLevelField; static { @@ -102,8 +92,6 @@ private static void initialize(TypeDataBase db) { entryPointField = type.getAddressField("_entry_point"); verifiedEntryPointField = type.getAddressField("_verified_entry_point"); osrEntryPointField = type.getAddressField("_osr_entry_point"); - lockCountField = type.getJIntField("_lock_count"); - stackTraversalMarkField = type.getCIntegerField("_stack_traversal_mark"); compLevelField = type.getCIntegerField("_comp_level"); pcDescSize = db.lookupType("PcDesc").getSize(); } @@ -215,16 +203,11 @@ public Method getMethodAt(int index) { // * FIXME: * ADD ACCESS TO FLAGS!!!! // ********** // public boolean isInUse(); - // public boolean isAlive(); // public boolean isNotEntrant(); - // public boolean isZombie(); // ******************************** // * MAJOR FIXME: MAJOR HACK HERE * // ******************************** - public boolean isZombie() { return false; } - - // public boolean isUnloaded(); // public boolean isYoung(); // public boolean isOld(); // public int age(); @@ -273,8 +256,6 @@ public boolean isMethodHandleReturn(Address returnPc) { // FIXME: add inline cache support // FIXME: add flush() - public boolean isLockedByVM() { return lockCountField.getValue(addr) > 0; } - // FIXME: add mark_as_seen_on_stack // FIXME: add can_not_entrant_be_converted diff --git a/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/debugger/Debugger.java b/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/debugger/Debugger.java index 72d4ce8c20dea..36b73d66a0559 100644 --- a/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/debugger/Debugger.java +++ b/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/debugger/Debugger.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2022, Oracle and/or its affiliates. All rights reserved. * 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,7 +132,4 @@ which this debugger is running (to be able to properly configure public ReadResult readBytesFromProcess(long address, long numBytes) throws DebuggerException; - - public void writeBytesToProcess(long address, long numBytes, byte[] data) - throws UnmappedAddressException, DebuggerException; } diff --git a/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/debugger/DebuggerBase.java b/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/debugger/DebuggerBase.java index ca5548ea18711..a013a6c99f5a0 100644 --- a/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/debugger/DebuggerBase.java +++ b/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/debugger/DebuggerBase.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2022, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -232,15 +232,6 @@ protected final byte[] readBytes(long address, long numBytes) } } - /** May be called by subclasses directly but may not be overridden */ - protected final void writeBytes(long address, long numBytes, byte[] data) - throws UnmappedAddressException, DebuggerException { - if (cache != null) { - cache.clear(address, numBytes); - } - writeBytesToProcess(address, numBytes, data); - } - public boolean readJBoolean(long address) throws UnmappedAddressException, UnalignedAddressException { checkJavaConfigured(); @@ -385,78 +376,6 @@ public long readCInteger(long address, long numBytes, boolean isUnsigned) } } - public void writeJBoolean(long address, boolean value) - throws UnmappedAddressException, UnalignedAddressException { - checkJavaConfigured(); - utils.checkAlignment(address, jbooleanSize); - byte[] data = utils.jbooleanToData(value); - writeBytes(address, jbooleanSize, data); - } - - public void writeJByte(long address, byte value) - throws UnmappedAddressException, UnalignedAddressException { - checkJavaConfigured(); - utils.checkAlignment(address, jbyteSize); - byte[] data = utils.jbyteToData(value); - writeBytes(address, jbyteSize, data); - } - - public void writeJChar(long address, char value) - throws UnmappedAddressException, UnalignedAddressException { - checkJavaConfigured(); - utils.checkAlignment(address, jcharSize); - byte[] data = utils.jcharToData(value); - writeBytes(address, jcharSize, data); - } - - public void writeJDouble(long address, double value) - throws UnmappedAddressException, UnalignedAddressException { - checkJavaConfigured(); - utils.checkAlignment(address, jdoubleSize); - byte[] data = utils.jdoubleToData(value); - writeBytes(address, jdoubleSize, data); - } - - public void writeJFloat(long address, float value) - throws UnmappedAddressException, UnalignedAddressException { - checkJavaConfigured(); - utils.checkAlignment(address, jfloatSize); - byte[] data = utils.jfloatToData(value); - writeBytes(address, jfloatSize, data); - } - - public void writeJInt(long address, int value) - throws UnmappedAddressException, UnalignedAddressException { - checkJavaConfigured(); - utils.checkAlignment(address, jintSize); - byte[] data = utils.jintToData(value); - writeBytes(address, jintSize, data); - } - - public void writeJLong(long address, long value) - throws UnmappedAddressException, UnalignedAddressException { - checkJavaConfigured(); - utils.checkAlignment(address, jlongSize); - byte[] data = utils.jlongToData(value); - writeBytes(address, jlongSize, data); - } - - public void writeJShort(long address, short value) - throws UnmappedAddressException, UnalignedAddressException { - checkJavaConfigured(); - utils.checkAlignment(address, jshortSize); - byte[] data = utils.jshortToData(value); - writeBytes(address, jshortSize, data); - } - - public void writeCInteger(long address, long numBytes, long value) - throws UnmappedAddressException, UnalignedAddressException { - checkConfigured(); - utils.checkAlignment(address, numBytes); - byte[] data = utils.cIntegerToData(numBytes, value); - writeBytes(address, numBytes, data); - } - protected long readAddressValue(long address) throws UnmappedAddressException, UnalignedAddressException { return readCInteger(address, machDesc.getAddressSize(), true); @@ -481,11 +400,6 @@ protected long readCompKlassAddressValue(long address) return value; } - protected void writeAddressValue(long address, long value) - throws UnmappedAddressException, UnalignedAddressException { - writeCInteger(address, machDesc.getAddressSize(), value); - } - /** Can be called by subclasses but can not be overridden */ protected final void checkConfigured() { if (machDesc == null) { diff --git a/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/debugger/bsd/BsdDebuggerLocal.java b/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/debugger/bsd/BsdDebuggerLocal.java index 1d1196b409c23..e46a27c144b99 100644 --- a/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/debugger/bsd/BsdDebuggerLocal.java +++ b/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/debugger/bsd/BsdDebuggerLocal.java @@ -204,18 +204,8 @@ public void checkAlignment(long address, long alignment) { }; if (useCache) { - // FIXME: re-test necessity of cache on Bsd, where data - // fetching is faster - // Cache portion of the remote process's address space. - // Fetching data over the socket connection to dbx is slow. - // Might be faster if we were using a binary protocol to talk to - // dbx, but would have to test. For now, this cache works best - // if it covers the entire heap of the remote process. FIXME: at - // least should make this tunable from the outside, i.e., via - // the UI. This is a cache of 4096 4K pages, or 16 MB. The page - // size must be adjusted to be the hardware's page size. - // (FIXME: should pick this up from the debugger.) - initCache(4096, parseCacheNumPagesProperty(4096)); + // This is a cache of 64k of 4K pages, or 256 MB. + initCache(4096, parseCacheNumPagesProperty(1024 * 64)); } isDarwin = getOS().equals("darwin"); @@ -603,12 +593,6 @@ public void doit(BsdDebuggerLocal debugger) { } } - public void writeBytesToProcess(long address, long numBytes, byte[] data) - throws UnmappedAddressException, DebuggerException { - // FIXME - throw new DebuggerException("Unimplemented"); - } - /** this functions used for core file reading and called from native attach0, it returns an array of long integers as [thread_id, stack_start, stack_end, thread_id, stack_start, stack_end, ....] for diff --git a/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/debugger/dummy/DummyDebugger.java b/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/debugger/dummy/DummyDebugger.java index c9100efd4b167..6a24466e406b8 100644 --- a/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/debugger/dummy/DummyDebugger.java +++ b/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/debugger/dummy/DummyDebugger.java @@ -126,11 +126,6 @@ public ReadResult readBytesFromProcess(long address, long numBytes) throw new DebuggerException("Unimplemented"); } - public void writeBytesToProcess(long a, long b, byte[] buf) - throws DebuggerException { - throw new DebuggerException("Unimplemented"); - } - //---------------------------------------------------------------------- // Package-internal routines // diff --git a/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/debugger/linux/LinuxDebuggerLocal.java b/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/debugger/linux/LinuxDebuggerLocal.java index ebf8960b6906f..b22d0afb37d9f 100644 --- a/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/debugger/linux/LinuxDebuggerLocal.java +++ b/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/debugger/linux/LinuxDebuggerLocal.java @@ -223,18 +223,8 @@ public void checkAlignment(long address, long alignment) { }; if (useCache) { - // FIXME: re-test necessity of cache on Linux, where data - // fetching is faster - // Cache portion of the remote process's address space. - // Fetching data over the socket connection to dbx is slow. - // Might be faster if we were using a binary protocol to talk to - // dbx, but would have to test. For now, this cache works best - // if it covers the entire heap of the remote process. FIXME: at - // least should make this tunable from the outside, i.e., via - // the UI. This is a cache of 4096 4K pages, or 16 MB. The page - // size must be adjusted to be the hardware's page size. - // (FIXME: should pick this up from the debugger.) - initCache(4096, parseCacheNumPagesProperty(4096)); + // This is a cache of 64k of 4K pages, or 256 MB. + initCache(4096, parseCacheNumPagesProperty(1024 * 64)); } workerThread = new LinuxDebuggerLocalWorkerThread(this); @@ -660,12 +650,6 @@ public void doit(LinuxDebuggerLocal debugger) { } } - public void writeBytesToProcess(long address, long numBytes, byte[] data) - throws UnmappedAddressException, DebuggerException { - // FIXME - throw new DebuggerException("Unimplemented"); - } - static { System.loadLibrary("saproc"); init0(); diff --git a/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/debugger/proc/ProcAddress.java b/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/debugger/proc/ProcAddress.java deleted file mode 100644 index ab6028c651e7f..0000000000000 --- a/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/debugger/proc/ProcAddress.java +++ /dev/null @@ -1,393 +0,0 @@ -/* - * Copyright (c) 2002, 2022, Oracle and/or its affiliates. All rights reserved. - * 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 sun.jvm.hotspot.debugger.proc; - -import sun.jvm.hotspot.debugger.*; - -class ProcAddress implements Address { - protected ProcDebugger debugger; - protected long addr; - - ProcAddress(ProcDebugger debugger, long addr) { - this.debugger = debugger; - this.addr = addr; - } - - // - // Basic Java routines - // - - public boolean equals(Object arg) { - if (arg == null) { - return false; - } - - if (!(arg instanceof ProcAddress)) { - return false; - } - - return (addr == ((ProcAddress) arg).addr); - } - - public int hashCode() { - return Long.hashCode(addr); - } - - public String toString() { - return debugger.addressValueToString(addr); - } - - // - // C/C++-related routines - // - - public long getCIntegerAt(long offset, long numBytes, boolean isUnsigned) throws UnalignedAddressException, UnmappedAddressException { - return debugger.readCInteger(addr + offset, numBytes, isUnsigned); - } - - public Address getAddressAt(long offset) throws UnalignedAddressException, UnmappedAddressException { - return debugger.readAddress(addr + offset); - } - - public Address getCompOopAddressAt(long offset) throws UnalignedAddressException, UnmappedAddressException { - return debugger.readCompOopAddress(addr + offset); - } - - public Address getCompKlassAddressAt(long offset) throws UnalignedAddressException, UnmappedAddressException { - return debugger.readCompKlassAddress(addr + offset); - } - - // - // Java-related routines - // - - public boolean getJBooleanAt(long offset) throws UnalignedAddressException, UnmappedAddressException { - return debugger.readJBoolean(addr + offset); - } - - public byte getJByteAt(long offset) throws UnalignedAddressException, UnmappedAddressException { - return debugger.readJByte(addr + offset); - } - - public char getJCharAt(long offset) throws UnalignedAddressException, UnmappedAddressException { - return debugger.readJChar(addr + offset); - } - - public double getJDoubleAt(long offset) throws UnalignedAddressException, UnmappedAddressException { - return debugger.readJDouble(addr + offset); - } - - public float getJFloatAt(long offset) throws UnalignedAddressException, UnmappedAddressException { - return debugger.readJFloat(addr + offset); - } - - public int getJIntAt(long offset) throws UnalignedAddressException, UnmappedAddressException { - return debugger.readJInt(addr + offset); - } - - public long getJLongAt(long offset) throws UnalignedAddressException, UnmappedAddressException { - return debugger.readJLong(addr + offset); - } - - public short getJShortAt(long offset) throws UnalignedAddressException, UnmappedAddressException { - return debugger.readJShort(addr + offset); - } - - public OopHandle getOopHandleAt(long offset) - throws UnalignedAddressException, UnmappedAddressException, NotInHeapException { - return debugger.readOopHandle(addr + offset); - } - public OopHandle getCompOopHandleAt(long offset) - throws UnalignedAddressException, UnmappedAddressException, NotInHeapException { - return debugger.readCompOopHandle(addr + offset); - } - - // Mutators -- not implemented for now (FIXME) - public void setCIntegerAt(long offset, long numBytes, long value) { - throw new DebuggerException("Unimplemented"); - } - public void setAddressAt(long offset, Address value) { - throw new DebuggerException("Unimplemented"); - } - public void setJBooleanAt (long offset, boolean value) - throws UnmappedAddressException, UnalignedAddressException { - throw new DebuggerException("Unimplemented"); - } - public void setJByteAt (long offset, byte value) - throws UnmappedAddressException, UnalignedAddressException { - throw new DebuggerException("Unimplemented"); - } - public void setJCharAt (long offset, char value) - throws UnmappedAddressException, UnalignedAddressException { - throw new DebuggerException("Unimplemented"); - } - public void setJDoubleAt (long offset, double value) - throws UnmappedAddressException, UnalignedAddressException { - throw new DebuggerException("Unimplemented"); - } - public void setJFloatAt (long offset, float value) - throws UnmappedAddressException, UnalignedAddressException { - throw new DebuggerException("Unimplemented"); - } - public void setJIntAt (long offset, int value) - throws UnmappedAddressException, UnalignedAddressException { - throw new DebuggerException("Unimplemented"); - } - public void setJLongAt (long offset, long value) - throws UnmappedAddressException, UnalignedAddressException { - throw new DebuggerException("Unimplemented"); - } - public void setJShortAt (long offset, short value) - throws UnmappedAddressException, UnalignedAddressException { - throw new DebuggerException("Unimplemented"); - } - public void setOopHandleAt (long offset, OopHandle value) - throws UnmappedAddressException, UnalignedAddressException { - throw new DebuggerException("Unimplemented"); - } - - // - // Arithmetic operations -- necessary evil. - // - - public Address addOffsetTo (long offset) throws UnsupportedOperationException { - long value = addr + offset; - if (value == 0) { - return null; - } - return new ProcAddress(debugger, value); - } - - public OopHandle addOffsetToAsOopHandle(long offset) throws UnsupportedOperationException { - long value = addr + offset; - if (value == 0) { - return null; - } - return new ProcOopHandle(debugger, value); - } - - /** (FIXME: any signed/unsigned issues? Should this work for - OopHandles?) */ - public long minus(Address arg) { - if (arg == null) { - return addr; - } - return addr - ((ProcAddress) arg).addr; - } - - // Two's complement representation. - // All negative numbers are larger than positive numbers. - // Numbers with the same sign can be compared normally. - // Test harness is below in main(). - - public boolean lessThan (Address arg) { - if (arg == null) { - return false; - } - ProcAddress dbxArg = (ProcAddress) arg; - if ((addr >= 0) && (dbxArg.addr < 0)) { - return true; - } - if ((addr < 0) && (dbxArg.addr >= 0)) { - return false; - } - return (addr < dbxArg.addr); - } - - public boolean lessThanOrEqual (Address arg) { - if (arg == null) { - return false; - } - ProcAddress dbxArg = (ProcAddress) arg; - if ((addr >= 0) && (dbxArg.addr < 0)) { - return true; - } - if ((addr < 0) && (dbxArg.addr >= 0)) { - return false; - } - return (addr <= dbxArg.addr); - } - - public boolean greaterThan (Address arg) { - if (arg == null) { - return true; - } - ProcAddress dbxArg = (ProcAddress) arg; - if ((addr >= 0) && (dbxArg.addr < 0)) { - return false; - } - if ((addr < 0) && (dbxArg.addr >= 0)) { - return true; - } - return (addr > dbxArg.addr); - } - - public boolean greaterThanOrEqual(Address arg) { - if (arg == null) { - return true; - } - ProcAddress dbxArg = (ProcAddress) arg; - if ((addr >= 0) && (dbxArg.addr < 0)) { - return false; - } - if ((addr < 0) && (dbxArg.addr >= 0)) { - return true; - } - return (addr >= dbxArg.addr); - } - - public Address andWithMask(long mask) throws UnsupportedOperationException { - long value = addr & mask; - if (value == 0) { - return null; - } - return new ProcAddress(debugger, value); - } - - public Address orWithMask(long mask) throws UnsupportedOperationException { - long value = addr | mask; - if (value == 0) { - return null; - } - return new ProcAddress(debugger, value); - } - - public Address xorWithMask(long mask) throws UnsupportedOperationException { - long value = addr ^ mask; - if (value == 0) { - return null; - } - return new ProcAddress(debugger, value); - } - - public long asLongValue() { return addr; } - //-------------------------------------------------------------------------------- - // Internals only below this point - // - - private static void check(boolean arg, String failMessage) { - if (!arg) { - System.err.println(failMessage + ": FAILED"); - System.exit(1); - } - } - - // Test harness - public static void main(String[] args) { - // p/n indicates whether the interior address is really positive - // or negative. In unsigned terms, p1 < p2 < n1 < n2. - - ProcAddress p1 = new ProcAddress(null, 0x7FFFFFFFFFFFFFF0L); - ProcAddress p2 = (ProcAddress) p1.addOffsetTo(10); - ProcAddress n1 = (ProcAddress) p2.addOffsetTo(10); - ProcAddress n2 = (ProcAddress) n1.addOffsetTo(10); - - // lessThan positive tests - check(p1.lessThan(p2), "lessThan 1"); - check(p1.lessThan(n1), "lessThan 2"); - check(p1.lessThan(n2), "lessThan 3"); - check(p2.lessThan(n1), "lessThan 4"); - check(p2.lessThan(n2), "lessThan 5"); - check(n1.lessThan(n2), "lessThan 6"); - - // lessThan negative tests - check(!p1.lessThan(p1), "lessThan 7"); - check(!p2.lessThan(p2), "lessThan 8"); - check(!n1.lessThan(n1), "lessThan 9"); - check(!n2.lessThan(n2), "lessThan 10"); - - check(!p2.lessThan(p1), "lessThan 11"); - check(!n1.lessThan(p1), "lessThan 12"); - check(!n2.lessThan(p1), "lessThan 13"); - check(!n1.lessThan(p2), "lessThan 14"); - check(!n2.lessThan(p2), "lessThan 15"); - check(!n2.lessThan(n1), "lessThan 16"); - - // lessThanOrEqual positive tests - check(p1.lessThanOrEqual(p1), "lessThanOrEqual 1"); - check(p2.lessThanOrEqual(p2), "lessThanOrEqual 2"); - check(n1.lessThanOrEqual(n1), "lessThanOrEqual 3"); - check(n2.lessThanOrEqual(n2), "lessThanOrEqual 4"); - - check(p1.lessThanOrEqual(p2), "lessThanOrEqual 5"); - check(p1.lessThanOrEqual(n1), "lessThanOrEqual 6"); - check(p1.lessThanOrEqual(n2), "lessThanOrEqual 7"); - check(p2.lessThanOrEqual(n1), "lessThanOrEqual 8"); - check(p2.lessThanOrEqual(n2), "lessThanOrEqual 9"); - check(n1.lessThanOrEqual(n2), "lessThanOrEqual 10"); - - // lessThanOrEqual negative tests - check(!p2.lessThanOrEqual(p1), "lessThanOrEqual 11"); - check(!n1.lessThanOrEqual(p1), "lessThanOrEqual 12"); - check(!n2.lessThanOrEqual(p1), "lessThanOrEqual 13"); - check(!n1.lessThanOrEqual(p2), "lessThanOrEqual 14"); - check(!n2.lessThanOrEqual(p2), "lessThanOrEqual 15"); - check(!n2.lessThanOrEqual(n1), "lessThanOrEqual 16"); - - // greaterThan positive tests - check(n2.greaterThan(p1), "greaterThan 1"); - check(n2.greaterThan(p2), "greaterThan 2"); - check(n2.greaterThan(n1), "greaterThan 3"); - check(n1.greaterThan(p1), "greaterThan 4"); - check(n1.greaterThan(p2), "greaterThan 5"); - check(p2.greaterThan(p1), "greaterThan 6"); - - // greaterThan negative tests - check(!p1.greaterThan(p1), "greaterThan 7"); - check(!p2.greaterThan(p2), "greaterThan 8"); - check(!n1.greaterThan(n1), "greaterThan 9"); - check(!n2.greaterThan(n2), "greaterThan 10"); - - check(!p1.greaterThan(n2), "greaterThan 11"); - check(!p2.greaterThan(n2), "greaterThan 12"); - check(!n1.greaterThan(n2), "greaterThan 13"); - check(!p1.greaterThan(n1), "greaterThan 14"); - check(!p2.greaterThan(n1), "greaterThan 15"); - check(!p1.greaterThan(p2), "greaterThan 16"); - - // greaterThanOrEqual positive tests - check(p1.greaterThanOrEqual(p1), "greaterThanOrEqual 1"); - check(p2.greaterThanOrEqual(p2), "greaterThanOrEqual 2"); - check(n1.greaterThanOrEqual(n1), "greaterThanOrEqual 3"); - check(n2.greaterThanOrEqual(n2), "greaterThanOrEqual 4"); - - check(n2.greaterThanOrEqual(p1), "greaterThanOrEqual 5"); - check(n2.greaterThanOrEqual(p2), "greaterThanOrEqual 6"); - check(n2.greaterThanOrEqual(n1), "greaterThanOrEqual 7"); - check(n1.greaterThanOrEqual(p1), "greaterThanOrEqual 8"); - check(n1.greaterThanOrEqual(p2), "greaterThanOrEqual 9"); - check(p2.greaterThanOrEqual(p1), "greaterThanOrEqual 10"); - - // greaterThanOrEqual negative tests - check(!p1.greaterThanOrEqual(n2), "greaterThanOrEqual 11"); - check(!p2.greaterThanOrEqual(n2), "greaterThanOrEqual 12"); - check(!n1.greaterThanOrEqual(n2), "greaterThanOrEqual 13"); - check(!p1.greaterThanOrEqual(n1), "greaterThanOrEqual 14"); - check(!p2.greaterThanOrEqual(n1), "greaterThanOrEqual 15"); - check(!p1.greaterThanOrEqual(p2), "greaterThanOrEqual 16"); - - System.err.println("ProcAddress: all tests passed successfully."); - } -} diff --git a/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/debugger/proc/ProcCDebugger.java b/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/debugger/proc/ProcCDebugger.java deleted file mode 100644 index 9a6d2dd1aea24..0000000000000 --- a/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/debugger/proc/ProcCDebugger.java +++ /dev/null @@ -1,101 +0,0 @@ -/* - * Copyright (c) 2003, 2020, Oracle and/or its affiliates. All rights reserved. - * 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 sun.jvm.hotspot.debugger.proc; - -import java.io.*; -import java.util.*; -import sun.jvm.hotspot.debugger.*; -import sun.jvm.hotspot.debugger.cdbg.*; -import sun.jvm.hotspot.utilities.*; - -class ProcCDebugger implements CDebugger { - private ProcDebugger dbg; - - ProcCDebugger(ProcDebugger dbg) { - this.dbg = dbg; - } - - public List getThreadList() throws DebuggerException { - return dbg.getThreadList(); - } - - public List getLoadObjectList() throws DebuggerException { - return dbg.getLoadObjectList(); - } - - public LoadObject loadObjectContainingPC(Address pc) throws DebuggerException { - if (pc == null) { - return null; - } - List objs = getLoadObjectList(); - Object[] arr = objs.toArray(); - // load objects are sorted by base address, do binary search - int mid = -1; - int low = 0; - int high = arr.length - 1; - - while (low <= high) { - mid = (low + high) >> 1; - LoadObject midVal = (LoadObject) arr[mid]; - long cmp = pc.minus(midVal.getBase()); - if (cmp < 0) { - high = mid - 1; - } else if (cmp > 0) { - long size = midVal.getSize(); - if (cmp >= size) { - low = mid + 1; - } else { - return (LoadObject) arr[mid]; - } - } else { // match found - return (LoadObject) arr[mid]; - } - } - // no match found. - return null; - } - - public CFrame topFrameForThread(ThreadProxy thread) throws DebuggerException { - return dbg.topFrameForThread(thread); - } - - public String getNameOfFile(String fileName) { - return new File(fileName).getName(); - } - - public ProcessControl getProcessControl() throws DebuggerException { - // FIXME: after stabs parser - return null; - } - - // C++ name demangling - public boolean canDemangle() { - return true; - } - - public String demangle(String sym) { - return dbg.demangle(sym); - } -} diff --git a/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/debugger/proc/ProcCFrame.java b/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/debugger/proc/ProcCFrame.java deleted file mode 100644 index 83d5f677a6e19..0000000000000 --- a/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/debugger/proc/ProcCFrame.java +++ /dev/null @@ -1,67 +0,0 @@ -/* - * Copyright (c) 2003, 2012, Oracle and/or its affiliates. All rights reserved. - * 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 sun.jvm.hotspot.debugger.proc; - -import sun.jvm.hotspot.debugger.*; -import sun.jvm.hotspot.debugger.cdbg.*; -import sun.jvm.hotspot.debugger.cdbg.basic.*; - -final class ProcCFrame extends BasicCFrame { - public Address pc() { - return pc; - } - - public Address localVariableBase() { - return fp; - } - - public CFrame sender(ThreadProxy t) { - return sender; - } - - public ClosestSymbol closestSymbolToPC() { - // we don't use base class ELF parsing based - // symbol lookup for pc for performance reasons. - return procDbg.lookup(procDbg.getAddressValue(pc)); - } - - // package/class internals only - - ProcCFrame(ProcDebugger dbg, Address pc, Address fp) { - super(dbg.getCDebugger()); - this.pc = pc; - this.fp = fp; - this.procDbg = dbg; - } - - void setSender(ProcCFrame sender) { - this.sender = sender; - } - - private Address pc; - private Address fp; - private ProcCFrame sender; - private ProcDebugger procDbg; -} diff --git a/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/debugger/proc/ProcDebugger.java b/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/debugger/proc/ProcDebugger.java deleted file mode 100644 index bb7b3046f88f6..0000000000000 --- a/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/debugger/proc/ProcDebugger.java +++ /dev/null @@ -1,62 +0,0 @@ -/* - * Copyright (c) 2002, 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. - * - */ - -package sun.jvm.hotspot.debugger.proc; - -import java.util.List; -import sun.jvm.hotspot.debugger.*; -import sun.jvm.hotspot.debugger.cdbg.*; - -/** An extension of the JVMDebugger interface with a few additions to - support 32-bit vs. 64-bit debugging as well as features required - by the architecture-specific subpackages. */ - -public interface ProcDebugger extends JVMDebugger { - public MachineDescription getMachineDescription() throws DebuggerException; - public String addressValueToString(long address) throws DebuggerException; - public boolean readJBoolean(long address) throws DebuggerException; - public byte readJByte(long address) throws DebuggerException; - public char readJChar(long address) throws DebuggerException; - public double readJDouble(long address) throws DebuggerException; - public float readJFloat(long address) throws DebuggerException; - public int readJInt(long address) throws DebuggerException; - public long readJLong(long address) throws DebuggerException; - public short readJShort(long address) throws DebuggerException; - public long readCInteger(long address, long numBytes, boolean isUnsigned) - throws DebuggerException; - public ProcAddress readAddress(long address) throws DebuggerException; - public ProcAddress readCompOopAddress(long address) throws DebuggerException; - public ProcAddress readCompKlassAddress(long address) throws DebuggerException; - public ProcOopHandle readOopHandle(long address) throws DebuggerException; - public ProcOopHandle readCompOopHandle(long address) throws DebuggerException; - public long[] getThreadIntegerRegisterSet(int tid) throws DebuggerException; - public long getAddressValue(Address addr) throws DebuggerException; - - // for ProcCDebugger, ProcCFrame and SharedObject - public List getThreadList() throws DebuggerException; - public List getLoadObjectList() throws DebuggerException; - public CFrame topFrameForThread(ThreadProxy thread) throws DebuggerException; - public ClosestSymbol lookup(long address) throws DebuggerException; - public String demangle(String name); -} diff --git a/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/debugger/proc/ProcOopHandle.java b/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/debugger/proc/ProcOopHandle.java deleted file mode 100644 index 485bcf701a132..0000000000000 --- a/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/debugger/proc/ProcOopHandle.java +++ /dev/null @@ -1,49 +0,0 @@ -/* - * Copyright (c) 2002, Oracle and/or its affiliates. All rights reserved. - * 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 sun.jvm.hotspot.debugger.proc; - -import sun.jvm.hotspot.debugger.*; - -class ProcOopHandle extends ProcAddress implements OopHandle { - ProcOopHandle(ProcDebugger debugger, long addr) { - super(debugger, addr); - } - - public Address addOffsetTo (long offset) throws UnsupportedOperationException { - throw new UnsupportedOperationException("addOffsetTo not applicable to OopHandles (interior object pointers not allowed)"); - } - - public Address andWithMask(long mask) throws UnsupportedOperationException { - throw new UnsupportedOperationException("andWithMask not applicable to OopHandles (i.e., anything but C addresses)"); - } - - public Address orWithMask(long mask) throws UnsupportedOperationException { - throw new UnsupportedOperationException("orWithMask not applicable to OopHandles (i.e., anything but C addresses)"); - } - - public Address xorWithMask(long mask) throws UnsupportedOperationException { - throw new UnsupportedOperationException("xorWithMask not applicable to OopHandles (i.e., anything but C addresses)"); - } -} diff --git a/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/debugger/proc/ProcThreadFactory.java b/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/debugger/proc/ProcThreadFactory.java deleted file mode 100644 index c27631d4bc20c..0000000000000 --- a/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/debugger/proc/ProcThreadFactory.java +++ /dev/null @@ -1,35 +0,0 @@ -/* - * Copyright (c) 2002, Oracle and/or its affiliates. All rights reserved. - * 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 sun.jvm.hotspot.debugger.proc; - -import sun.jvm.hotspot.debugger.*; - -/** An interface used only internally by the ProcDebugger to be able to - create platform-specific Thread objects */ - -public interface ProcThreadFactory { - public ThreadProxy createThreadWrapper(Address threadIdentifierAddr); - public ThreadProxy createThreadWrapper(long id); -} diff --git a/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/debugger/proc/SharedObject.java b/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/debugger/proc/SharedObject.java deleted file mode 100644 index 480b33a9768c0..0000000000000 --- a/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/debugger/proc/SharedObject.java +++ /dev/null @@ -1,52 +0,0 @@ -/* - * Copyright (c) 2003, 2022, Oracle and/or its affiliates. All rights reserved. - * 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 sun.jvm.hotspot.debugger.proc; - -import sun.jvm.hotspot.debugger.*; -import sun.jvm.hotspot.debugger.cdbg.*; -import sun.jvm.hotspot.debugger.posix.*; - -/** An Object can represent either a .so or an a.out file. */ - -class SharedObject extends DSO { - SharedObject(ProcDebugger dbg, String filename, long size, Address relocation) { - super(filename, size, relocation); - this.dbg = dbg; - } - - protected Address newAddress(long address) { - return dbg.newAddress(address); - } - - protected long getAddressValue(Address addr) { - return dbg.getAddressValue(addr); - } - - public ClosestSymbol closestSymbolToPC(Address pcAsAddr) throws DebuggerException { - return dbg.lookup(dbg.getAddressValue(pcAsAddr)); - } - - private ProcDebugger dbg; -} diff --git a/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/debugger/proc/aarch64/ProcAARCH64Thread.java b/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/debugger/proc/aarch64/ProcAARCH64Thread.java deleted file mode 100644 index 04f97bea1939a..0000000000000 --- a/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/debugger/proc/aarch64/ProcAARCH64Thread.java +++ /dev/null @@ -1,87 +0,0 @@ -/* - * Copyright (c) 2004, 2022, Oracle and/or its affiliates. All rights reserved. - * Copyright (c) 2015, Red Hat Inc. - * 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 sun.jvm.hotspot.debugger.proc.aarch64; - -import sun.jvm.hotspot.debugger.*; -import sun.jvm.hotspot.debugger.aarch64.*; -import sun.jvm.hotspot.debugger.proc.*; -import sun.jvm.hotspot.utilities.*; - -public class ProcAARCH64Thread implements ThreadProxy { - private ProcDebugger debugger; - private int id; - - public ProcAARCH64Thread(ProcDebugger debugger, Address addr) { - this.debugger = debugger; - - // FIXME: the size here should be configurable. However, making it - // so would produce a dependency on the "types" package from the - // debugger package, which is not desired. - this.id = (int) addr.getCIntegerAt(0, 4, true); - } - - public ProcAARCH64Thread(ProcDebugger debugger, long id) { - this.debugger = debugger; - this.id = (int) id; - } - - public ThreadContext getContext() throws IllegalThreadStateException { - ProcAARCH64ThreadContext context = new ProcAARCH64ThreadContext(debugger); - long[] regs = debugger.getThreadIntegerRegisterSet(id); - if (Assert.ASSERTS_ENABLED) { - Assert.that(regs.length == AARCH64ThreadContext.NPRGREG, "size mismatch"); - } - for (int i = 0; i < regs.length; i++) { - context.setRegister(i, regs[i]); - } - return context; - } - - public boolean canSetContext() throws DebuggerException { - return false; - } - - public void setContext(ThreadContext context) - throws IllegalThreadStateException, DebuggerException { - throw new DebuggerException("Unimplemented"); - } - - public String toString() { - return "t@" + id; - } - - public boolean equals(Object obj) { - if (!(obj instanceof ProcAARCH64Thread other)) { - return false; - } - - return (other.id == id); - } - - public int hashCode() { - return id; - } -} diff --git a/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/debugger/proc/aarch64/ProcAARCH64ThreadContext.java b/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/debugger/proc/aarch64/ProcAARCH64ThreadContext.java deleted file mode 100644 index 9d3cbc53d5de3..0000000000000 --- a/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/debugger/proc/aarch64/ProcAARCH64ThreadContext.java +++ /dev/null @@ -1,47 +0,0 @@ -/* - * Copyright (c) 2004, Oracle and/or its affiliates. All rights reserved. - * Copyright (c) 2015, Red Hat Inc. - * 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 sun.jvm.hotspot.debugger.proc.aarch64; - -import sun.jvm.hotspot.debugger.*; -import sun.jvm.hotspot.debugger.aarch64.*; -import sun.jvm.hotspot.debugger.proc.*; - -public class ProcAARCH64ThreadContext extends AARCH64ThreadContext { - private ProcDebugger debugger; - - public ProcAARCH64ThreadContext(ProcDebugger debugger) { - super(); - this.debugger = debugger; - } - - public void setRegisterAsAddress(int index, Address value) { - setRegister(index, debugger.getAddressValue(value)); - } - - public Address getRegisterAsAddress(int index) { - return debugger.newAddress(getRegister(index)); - } -} diff --git a/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/debugger/proc/aarch64/ProcAARCH64ThreadFactory.java b/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/debugger/proc/aarch64/ProcAARCH64ThreadFactory.java deleted file mode 100644 index 392ed8b0b1635..0000000000000 --- a/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/debugger/proc/aarch64/ProcAARCH64ThreadFactory.java +++ /dev/null @@ -1,45 +0,0 @@ -/* - * Copyright (c) 2004, Oracle and/or its affiliates. All rights reserved. - * Copyright (c) 2015, Red Hat Inc. - * 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 sun.jvm.hotspot.debugger.proc.aarch64; - -import sun.jvm.hotspot.debugger.*; -import sun.jvm.hotspot.debugger.proc.*; - -public class ProcAARCH64ThreadFactory implements ProcThreadFactory { - private ProcDebugger debugger; - - public ProcAARCH64ThreadFactory(ProcDebugger debugger) { - this.debugger = debugger; - } - - public ThreadProxy createThreadWrapper(Address threadIdentifierAddr) { - return new ProcAARCH64Thread(debugger, threadIdentifierAddr); - } - - public ThreadProxy createThreadWrapper(long id) { - return new ProcAARCH64Thread(debugger, id); - } -} diff --git a/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/debugger/proc/amd64/ProcAMD64Thread.java b/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/debugger/proc/amd64/ProcAMD64Thread.java deleted file mode 100644 index 0abf453a0d8e2..0000000000000 --- a/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/debugger/proc/amd64/ProcAMD64Thread.java +++ /dev/null @@ -1,86 +0,0 @@ -/* - * Copyright (c) 2004, 2022, Oracle and/or its affiliates. All rights reserved. - * 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 sun.jvm.hotspot.debugger.proc.amd64; - -import sun.jvm.hotspot.debugger.*; -import sun.jvm.hotspot.debugger.amd64.*; -import sun.jvm.hotspot.debugger.proc.*; -import sun.jvm.hotspot.utilities.*; - -public class ProcAMD64Thread implements ThreadProxy { - private ProcDebugger debugger; - private int id; - - public ProcAMD64Thread(ProcDebugger debugger, Address addr) { - this.debugger = debugger; - - // FIXME: the size here should be configurable. However, making it - // so would produce a dependency on the "types" package from the - // debugger package, which is not desired. - this.id = (int) addr.getCIntegerAt(0, 4, true); - } - - public ProcAMD64Thread(ProcDebugger debugger, long id) { - this.debugger = debugger; - this.id = (int) id; - } - - public ThreadContext getContext() throws IllegalThreadStateException { - ProcAMD64ThreadContext context = new ProcAMD64ThreadContext(debugger); - long[] regs = debugger.getThreadIntegerRegisterSet(id); - if (Assert.ASSERTS_ENABLED) { - Assert.that(regs.length == AMD64ThreadContext.NPRGREG, "size mismatch"); - } - for (int i = 0; i < regs.length; i++) { - context.setRegister(i, regs[i]); - } - return context; - } - - public boolean canSetContext() throws DebuggerException { - return false; - } - - public void setContext(ThreadContext context) - throws IllegalThreadStateException, DebuggerException { - throw new DebuggerException("Unimplemented"); - } - - public String toString() { - return "t@" + id; - } - - public boolean equals(Object obj) { - if (!(obj instanceof ProcAMD64Thread other)) { - return false; - } - - return (other.id == id); - } - - public int hashCode() { - return id; - } -} diff --git a/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/debugger/proc/amd64/ProcAMD64ThreadFactory.java b/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/debugger/proc/amd64/ProcAMD64ThreadFactory.java deleted file mode 100644 index 26b5647a857a1..0000000000000 --- a/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/debugger/proc/amd64/ProcAMD64ThreadFactory.java +++ /dev/null @@ -1,44 +0,0 @@ -/* - * Copyright (c) 2004, Oracle and/or its affiliates. All rights reserved. - * 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 sun.jvm.hotspot.debugger.proc.amd64; - -import sun.jvm.hotspot.debugger.*; -import sun.jvm.hotspot.debugger.proc.*; - -public class ProcAMD64ThreadFactory implements ProcThreadFactory { - private ProcDebugger debugger; - - public ProcAMD64ThreadFactory(ProcDebugger debugger) { - this.debugger = debugger; - } - - public ThreadProxy createThreadWrapper(Address threadIdentifierAddr) { - return new ProcAMD64Thread(debugger, threadIdentifierAddr); - } - - public ThreadProxy createThreadWrapper(long id) { - return new ProcAMD64Thread(debugger, id); - } -} diff --git a/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/debugger/proc/ppc64/ProcPPC64Thread.java b/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/debugger/proc/ppc64/ProcPPC64Thread.java deleted file mode 100644 index 4b9aff204d531..0000000000000 --- a/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/debugger/proc/ppc64/ProcPPC64Thread.java +++ /dev/null @@ -1,86 +0,0 @@ -/* - * Copyright (c) 2014, 2022, Oracle and/or its affiliates. All rights reserved. - * 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 sun.jvm.hotspot.debugger.proc.ppc64; - -import sun.jvm.hotspot.debugger.*; -import sun.jvm.hotspot.debugger.ppc64.*; -import sun.jvm.hotspot.debugger.proc.*; -import sun.jvm.hotspot.utilities.*; - -public class ProcPPC64Thread implements ThreadProxy { - private ProcDebugger debugger; - private int id; - - public ProcPPC64Thread(ProcDebugger debugger, Address addr) { - this.debugger = debugger; - - // FIXME: the size here should be configurable. However, making it - // so would produce a dependency on the "types" package from the - // debugger package, which is not desired. - this.id = (int) addr.getCIntegerAt(0, 4, true); - } - - public ProcPPC64Thread(ProcDebugger debugger, long id) { - this.debugger = debugger; - this.id = (int) id; - } - - public ThreadContext getContext() throws IllegalThreadStateException { - ProcPPC64ThreadContext context = new ProcPPC64ThreadContext(debugger); - long[] regs = debugger.getThreadIntegerRegisterSet(id); - if (Assert.ASSERTS_ENABLED) { - Assert.that(regs.length <= PPC64ThreadContext.NPRGREG, "size of register set is greater than " + PPC64ThreadContext.NPRGREG); - } - for (int i = 0; i < regs.length; i++) { - context.setRegister(i, regs[i]); - } - return context; - } - - public boolean canSetContext() throws DebuggerException { - return false; - } - - public void setContext(ThreadContext context) - throws IllegalThreadStateException, DebuggerException { - throw new DebuggerException("Unimplemented"); - } - - public String toString() { - return "t@" + id; - } - - public boolean equals(Object obj) { - if (!(obj instanceof ProcPPC64Thread other)) { - return false; - } - - return (other.id == id); - } - - public int hashCode() { - return id; - } -} diff --git a/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/debugger/proc/ppc64/ProcPPC64ThreadFactory.java b/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/debugger/proc/ppc64/ProcPPC64ThreadFactory.java deleted file mode 100644 index 115b0fd3074a8..0000000000000 --- a/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/debugger/proc/ppc64/ProcPPC64ThreadFactory.java +++ /dev/null @@ -1,44 +0,0 @@ -/* - * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. - * 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 sun.jvm.hotspot.debugger.proc.ppc64; - -import sun.jvm.hotspot.debugger.*; -import sun.jvm.hotspot.debugger.proc.*; - -public class ProcPPC64ThreadFactory implements ProcThreadFactory { - private ProcDebugger debugger; - - public ProcPPC64ThreadFactory(ProcDebugger debugger) { - this.debugger = debugger; - } - - public ThreadProxy createThreadWrapper(Address threadIdentifierAddr) { - return new ProcPPC64Thread(debugger, threadIdentifierAddr); - } - - public ThreadProxy createThreadWrapper(long id) { - return new ProcPPC64Thread(debugger, id); - } -} diff --git a/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/debugger/proc/riscv64/ProcRISCV64Thread.java b/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/debugger/proc/riscv64/ProcRISCV64Thread.java deleted file mode 100644 index db89bc10ed665..0000000000000 --- a/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/debugger/proc/riscv64/ProcRISCV64Thread.java +++ /dev/null @@ -1,88 +0,0 @@ -/* - * Copyright (c) 2004, 2022, Oracle and/or its affiliates. All rights reserved. - * Copyright (c) 2015, Red Hat Inc. - * Copyright (c) 2021, Huawei Technologies Co., Ltd. All rights reserved. - * 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 sun.jvm.hotspot.debugger.proc.riscv64; - -import sun.jvm.hotspot.debugger.*; -import sun.jvm.hotspot.debugger.riscv64.*; -import sun.jvm.hotspot.debugger.proc.*; -import sun.jvm.hotspot.utilities.*; - -public class ProcRISCV64Thread implements ThreadProxy { - private ProcDebugger debugger; - private int id; - - public ProcRISCV64Thread(ProcDebugger debugger, Address addr) { - this.debugger = debugger; - - // FIXME: the size here should be configurable. However, making it - // so would produce a dependency on the "types" package from the - // debugger package, which is not desired. - this.id = (int) addr.getCIntegerAt(0, 4, true); - } - - public ProcRISCV64Thread(ProcDebugger debugger, long id) { - this.debugger = debugger; - this.id = (int) id; - } - - public ThreadContext getContext() throws IllegalThreadStateException { - ProcRISCV64ThreadContext context = new ProcRISCV64ThreadContext(debugger); - long[] regs = debugger.getThreadIntegerRegisterSet(id); - if (Assert.ASSERTS_ENABLED) { - Assert.that(regs.length == RISCV64ThreadContext.NPRGREG, "size mismatch"); - } - for (int i = 0; i < regs.length; i++) { - context.setRegister(i, regs[i]); - } - return context; - } - - public boolean canSetContext() throws DebuggerException { - return false; - } - - public void setContext(ThreadContext context) - throws IllegalThreadStateException, DebuggerException { - throw new DebuggerException("Unimplemented"); - } - - public String toString() { - return "t@" + id; - } - - public boolean equals(Object obj) { - if (!(obj instanceof ProcRISCV64Thread other)) { - return false; - } - - return (other.id == id); - } - - public int hashCode() { - return id; - } -} diff --git a/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/debugger/proc/riscv64/ProcRISCV64ThreadContext.java b/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/debugger/proc/riscv64/ProcRISCV64ThreadContext.java deleted file mode 100644 index f2aa845e665c8..0000000000000 --- a/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/debugger/proc/riscv64/ProcRISCV64ThreadContext.java +++ /dev/null @@ -1,48 +0,0 @@ -/* - * Copyright (c) 2004, Oracle and/or its affiliates. All rights reserved. - * Copyright (c) 2015, Red Hat Inc. - * Copyright (c) 2021, Huawei Technologies Co., Ltd. All rights reserved. - * 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 sun.jvm.hotspot.debugger.proc.riscv64; - -import sun.jvm.hotspot.debugger.*; -import sun.jvm.hotspot.debugger.riscv64.*; -import sun.jvm.hotspot.debugger.proc.*; - -public class ProcRISCV64ThreadContext extends RISCV64ThreadContext { - private ProcDebugger debugger; - - public ProcRISCV64ThreadContext(ProcDebugger debugger) { - super(); - this.debugger = debugger; - } - - public void setRegisterAsAddress(int index, Address value) { - setRegister(index, debugger.getAddressValue(value)); - } - - public Address getRegisterAsAddress(int index) { - return debugger.newAddress(getRegister(index)); - } -} diff --git a/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/debugger/proc/riscv64/ProcRISCV64ThreadFactory.java b/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/debugger/proc/riscv64/ProcRISCV64ThreadFactory.java deleted file mode 100644 index 19f64b8ce2dc8..0000000000000 --- a/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/debugger/proc/riscv64/ProcRISCV64ThreadFactory.java +++ /dev/null @@ -1,46 +0,0 @@ -/* - * Copyright (c) 2004, Oracle and/or its affiliates. All rights reserved. - * Copyright (c) 2015, Red Hat Inc. - * Copyright (c) 2021, Huawei Technologies Co., Ltd. All rights reserved. - * 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 sun.jvm.hotspot.debugger.proc.riscv64; - -import sun.jvm.hotspot.debugger.*; -import sun.jvm.hotspot.debugger.proc.*; - -public class ProcRISCV64ThreadFactory implements ProcThreadFactory { - private ProcDebugger debugger; - - public ProcRISCV64ThreadFactory(ProcDebugger debugger) { - this.debugger = debugger; - } - - public ThreadProxy createThreadWrapper(Address threadIdentifierAddr) { - return new ProcRISCV64Thread(debugger, threadIdentifierAddr); - } - - public ThreadProxy createThreadWrapper(long id) { - return new ProcRISCV64Thread(debugger, id); - } -} diff --git a/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/debugger/proc/x86/ProcX86Thread.java b/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/debugger/proc/x86/ProcX86Thread.java deleted file mode 100644 index 65f126259a104..0000000000000 --- a/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/debugger/proc/x86/ProcX86Thread.java +++ /dev/null @@ -1,91 +0,0 @@ -/* - * Copyright (c) 2002, 2022, Oracle and/or its affiliates. All rights reserved. - * 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 sun.jvm.hotspot.debugger.proc.x86; - -import sun.jvm.hotspot.debugger.*; -import sun.jvm.hotspot.debugger.x86.*; -import sun.jvm.hotspot.debugger.proc.*; -import sun.jvm.hotspot.utilities.*; - -public class ProcX86Thread implements ThreadProxy { - private ProcDebugger debugger; - private int id; - - public ProcX86Thread(ProcDebugger debugger, Address addr) { - this.debugger = debugger; - - // FIXME: the size here should be configurable. However, making it - // so would produce a dependency on the "types" package from the - // debugger package, which is not desired. - this.id = (int) addr.getCIntegerAt(0, 4, true); - } - - public ProcX86Thread(ProcDebugger debugger, long id) { - this.debugger = debugger; - this.id = (int) id; - } - - public ThreadContext getContext() throws IllegalThreadStateException { - ProcX86ThreadContext context = new ProcX86ThreadContext(debugger); - long[] regs = debugger.getThreadIntegerRegisterSet(id); - /* - _NGREG in reg.h is defined to be 19. Because we have included - debug registers X86ThreadContext.NPRGREG is 25. - */ - - if (Assert.ASSERTS_ENABLED) { - Assert.that(regs.length <= X86ThreadContext.NPRGREG, "size of register set is greater than " + X86ThreadContext.NPRGREG); - } - for (int i = 0; i < regs.length; i++) { - context.setRegister(i, regs[i]); - } - return context; - } - - public boolean canSetContext() throws DebuggerException { - return false; - } - - public void setContext(ThreadContext context) - throws IllegalThreadStateException, DebuggerException { - throw new DebuggerException("Unimplemented"); - } - - public String toString() { - return "t@" + id; - } - - public boolean equals(Object obj) { - if (!(obj instanceof ProcX86Thread other)) { - return false; - } - - return (other.id == id); - } - - public int hashCode() { - return id; - } -} diff --git a/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/debugger/proc/x86/ProcX86ThreadContext.java b/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/debugger/proc/x86/ProcX86ThreadContext.java deleted file mode 100644 index 744b154d32f20..0000000000000 --- a/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/debugger/proc/x86/ProcX86ThreadContext.java +++ /dev/null @@ -1,46 +0,0 @@ -/* - * Copyright (c) 2002, 2003, Oracle and/or its affiliates. All rights reserved. - * 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 sun.jvm.hotspot.debugger.proc.x86; - -import sun.jvm.hotspot.debugger.*; -import sun.jvm.hotspot.debugger.x86.*; -import sun.jvm.hotspot.debugger.proc.*; - -public class ProcX86ThreadContext extends X86ThreadContext { - private ProcDebugger debugger; - - public ProcX86ThreadContext(ProcDebugger debugger) { - super(); - this.debugger = debugger; - } - - public void setRegisterAsAddress(int index, Address value) { - setRegister(index, debugger.getAddressValue(value)); - } - - public Address getRegisterAsAddress(int index) { - return debugger.newAddress(getRegister(index)); - } -} diff --git a/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/debugger/remote/RemoteDebuggerClient.java b/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/debugger/remote/RemoteDebuggerClient.java index ef7f7f730c47f..57770f3167c34 100644 --- a/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/debugger/remote/RemoteDebuggerClient.java +++ b/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/debugger/remote/RemoteDebuggerClient.java @@ -51,7 +51,7 @@ public class RemoteDebuggerClient extends DebuggerBase implements JVMDebugger { private RemoteDebugger remoteDebugger; private RemoteThreadFactory threadFactory; private boolean unalignedAccessesOkay = false; - private static final int cacheSize = 16 * 1024 * 1024; // 16 MB + private static final int cacheSize = 256 * 1024 * 1024; // 256 MB public RemoteDebuggerClient(RemoteDebugger remoteDebugger) throws DebuggerException { super(); @@ -59,24 +59,17 @@ public RemoteDebuggerClient(RemoteDebugger remoteDebugger) throws DebuggerExcept this.remoteDebugger = remoteDebugger; machDesc = remoteDebugger.getMachineDescription(); utils = new DebuggerUtilities(machDesc.getAddressSize(), machDesc.isBigEndian()); - int cacheNumPages; - int cachePageSize; + int cachePageSize = 4096; + int cacheNumPages = parseCacheNumPagesProperty(cacheSize / cachePageSize); String cpu = remoteDebugger.getCPU(); - // page size. (FIXME: should pick this up from the remoteDebugger.) if (cpu.equals("x86")) { threadFactory = new RemoteX86ThreadFactory(this); - cachePageSize = 4096; - cacheNumPages = parseCacheNumPagesProperty(cacheSize / cachePageSize); unalignedAccessesOkay = true; } else if (cpu.equals("amd64") || cpu.equals("x86_64")) { threadFactory = new RemoteAMD64ThreadFactory(this); - cachePageSize = 4096; - cacheNumPages = parseCacheNumPagesProperty(cacheSize / cachePageSize); unalignedAccessesOkay = true; } else if (cpu.equals("ppc64")) { threadFactory = new RemotePPC64ThreadFactory(this); - cachePageSize = 4096; - cacheNumPages = parseCacheNumPagesProperty(cacheSize / cachePageSize); unalignedAccessesOkay = true; } else if (cpu.equals("loongarch64")) { threadFactory = new RemoteLOONGARCH64ThreadFactory(this); @@ -93,8 +86,6 @@ public RemoteDebuggerClient(RemoteDebugger remoteDebugger) throws DebuggerExcept } catch (Exception e) { throw new DebuggerException("Thread access for CPU architecture " + cpu + " not yet supported"); } - cachePageSize = 4096; - cacheNumPages = parseCacheNumPagesProperty(cacheSize / cachePageSize); unalignedAccessesOkay = false; } @@ -424,10 +415,6 @@ public ReadResult readBytesFromProcess(long address, long numBytes) { } } - public void writeBytesToProcess(long a, long b, byte[] c) { - throw new DebuggerException("Unimplemented!"); - } - public String execCommandOnServer(String command, Map options) { try { return remoteDebugger.execCommandOnServer(command, options); diff --git a/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/debugger/remote/RemoteThreadFactory.java b/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/debugger/remote/RemoteThreadFactory.java index 72303bd285446..b4e65c806f3db 100644 --- a/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/debugger/remote/RemoteThreadFactory.java +++ b/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/debugger/remote/RemoteThreadFactory.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2002, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2022, Oracle and/or its affiliates. All rights reserved. * 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,7 @@ import sun.jvm.hotspot.debugger.*; -/** An interface used only internally by the ProcDebugger to be able to +/** An interface used only internally by the RemoteDebuggerClient to be able to create platform-specific Thread objects */ public interface RemoteThreadFactory { diff --git a/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/debugger/windbg/WindbgDebuggerLocal.java b/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/debugger/windbg/WindbgDebuggerLocal.java index 95825606cc913..1639988e1a503 100644 --- a/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/debugger/windbg/WindbgDebuggerLocal.java +++ b/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/debugger/windbg/WindbgDebuggerLocal.java @@ -120,19 +120,8 @@ public void checkAlignment(long address, long alignment) { } if (useCache) { - // Cache portion of the remote process's address space. - // Fetching data over the socket connection to dbx is slow. - // Might be faster if we were using a binary protocol to talk to - // dbx, but would have to test. For now, this cache works best - // if it covers the entire heap of the remote process. FIXME: at - // least should make this tunable from the outside, i.e., via - // the UI. This is a cache of 4096 4K pages, or 16 MB. The page - // size must be adjusted to be the hardware's page size. - // (FIXME: should pick this up from the debugger.) - initCache(4096, 4096); + initCache(4096, parseCacheNumPagesProperty(1024 * 64)); } - // FIXME: add instantiation of thread factory - } /** From the Debugger interface via JVMDebugger */ @@ -501,12 +490,6 @@ private DLL findDLLByName(String fullPathName) { return null; } - public void writeBytesToProcess(long address, long numBytes, byte[] data) - throws UnmappedAddressException, DebuggerException { - // FIXME - throw new DebuggerException("Unimplemented"); - } - private static String imagePath; private static String symbolPath; private static boolean useNativeLookup; diff --git a/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/runtime/CodeCacheSweeperThread.java b/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/runtime/CodeCacheSweeperThread.java deleted file mode 100644 index 72877516b658a..0000000000000 --- a/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/runtime/CodeCacheSweeperThread.java +++ /dev/null @@ -1,41 +0,0 @@ -/* - * Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved. - * 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 sun.jvm.hotspot.runtime; - -import java.io.*; -import java.util.*; -import sun.jvm.hotspot.debugger.*; -import sun.jvm.hotspot.types.*; - -public class CodeCacheSweeperThread extends JavaThread { - public CodeCacheSweeperThread(Address addr) { - super(addr); - } - - public boolean isJavaThread() { return false; } - public boolean isHiddenFromExternalView() { return true; } - public boolean isCodeCacheSweeperThread() { return true; } - -} diff --git a/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/runtime/JavaThread.java b/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/runtime/JavaThread.java index 00adf9c285b6e..84a7d520bcb58 100644 --- a/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/runtime/JavaThread.java +++ b/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/runtime/JavaThread.java @@ -124,7 +124,7 @@ void setThreadPDAccess(JavaThreadPDAccess access) { } /** NOTE: for convenience, this differs in definition from the underlying VM. - Only "pure" JavaThreads return true; CompilerThreads, the CodeCacheSweeperThread, + Only "pure" JavaThreads return true; CompilerThreads, JVMDIDebuggerThreads return false. FIXME: consider encapsulating platform-specific functionality in an 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 3590b9ad94ffa..89b86a1f15767 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 @@ -160,7 +160,6 @@ private static synchronized void initialize(TypeDataBase db) { virtualConstructor.addMapping("JavaThread", JavaThread.class); if (!VM.getVM().isCore()) { virtualConstructor.addMapping("CompilerThread", CompilerThread.class); - virtualConstructor.addMapping("CodeCacheSweeperThread", CodeCacheSweeperThread.class); } virtualConstructor.addMapping("JvmtiAgentThread", JvmtiAgentThread.class); virtualConstructor.addMapping("ServiceThread", ServiceThread.class); @@ -204,7 +203,7 @@ public JavaThread createJavaThreadWrapper(Address threadAddr) { return thread; } catch (Exception e) { throw new RuntimeException("Unable to deduce type of thread from address " + threadAddr + - " (expected type JavaThread, CompilerThread, MonitorDeflationThread, ServiceThread, JvmtiAgentThread or CodeCacheSweeperThread)", e); + " (expected type JavaThread, CompilerThread, MonitorDeflationThread, ServiceThread or JvmtiAgentThread)", e); } } diff --git a/src/jdk.internal.vm.ci/share/classes/jdk.vm.ci.code/src/jdk/vm/ci/code/InstalledCode.java b/src/jdk.internal.vm.ci/share/classes/jdk.vm.ci.code/src/jdk/vm/ci/code/InstalledCode.java index cf42ac7ed6494..489cca81c7bff 100644 --- a/src/jdk.internal.vm.ci/share/classes/jdk.vm.ci.code/src/jdk/vm/ci/code/InstalledCode.java +++ b/src/jdk.internal.vm.ci/share/classes/jdk.vm.ci.code/src/jdk/vm/ci/code/InstalledCode.java @@ -29,12 +29,13 @@ public class InstalledCode { /** - * Raw address address of entity representing this installed code. + * Address of the entity (e.g., HotSpot {@code nmethod} or {@code RuntimeStub}) representing + * this installed code. */ protected long address; /** - * Raw address of entryPoint of this installed code. + * Address of the entryPoint of this installed code. */ protected long entryPoint; @@ -50,7 +51,8 @@ public InstalledCode(String name) { } /** - * @return the address of entity representing this installed code. + * @return the address of entity (e.g., HotSpot {@code nmethod} or {@code RuntimeStub}) + * representing this installed code */ public long getAddress() { return address; @@ -94,8 +96,7 @@ public boolean isValid() { } /** - * @return true if the code represented by this object still exists and might have live - * activations, false otherwise (may happen due to deopt, etc.) + * @return true if this object still points to installed code */ public boolean isAlive() { return address != 0; @@ -108,12 +109,28 @@ public byte[] getCode() { return null; } + /** + * Equivalent to calling {@link #invalidate(boolean)} with a {@code true} argument. + */ + public void invalidate() { + invalidate(true); + } + /** * Invalidates this installed code such that any subsequent * {@linkplain #executeVarargs(Object...) invocation} will throw an - * {@link InvalidInstalledCodeException} and all existing invocations will be deoptimized. + * {@link InvalidInstalledCodeException}. + * + * If this installed code is already {@linkplain #isValid() invalid}, this method has no effect. + * A subsequent call to {@link #isAlive()} or {@link #isValid()} on this object will return + * {@code false}. + * + * @param deoptimize if {@code true}, all existing invocations will be immediately deoptimized. + * If {@code false}, any existing invocation will continue until it completes or + * there is a subsequent call to this method with {@code deoptimize == true} before + * the invocation completes. */ - public void invalidate() { + public void invalidate(boolean deoptimize) { throw new UnsupportedOperationException(); } diff --git a/src/jdk.internal.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/CompilerToVM.java b/src/jdk.internal.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/CompilerToVM.java index 506b9183648e6..e3d311e547c8e 100644 --- a/src/jdk.internal.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/CompilerToVM.java +++ b/src/jdk.internal.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/CompilerToVM.java @@ -715,12 +715,12 @@ void reprofile(HotSpotResolvedJavaMethodImpl method) { private native void reprofile(HotSpotResolvedJavaMethodImpl method, long methodPointer); /** - * Invalidates {@code nmethodMirror} such that {@link InvalidInstalledCodeException} will be - * raised the next time {@code nmethodMirror} is {@linkplain #executeHotSpotNmethod executed}. - * The {@code nmethod} associated with {@code nmethodMirror} is also made non-entrant and any - * current activations of the {@code nmethod} are deoptimized. + * Updates {@code nmethodMirror} such that {@link InvalidInstalledCodeException} will be raised + * the next time {@code nmethodMirror} is {@linkplain #executeHotSpotNmethod executed}. The + * {@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); + native void invalidateHotSpotNmethod(HotSpotNmethod nmethodMirror, boolean deoptimize); /** * 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/src/jdk/vm/ci/hotspot/HotSpotCodeCacheProvider.java b/src/jdk.internal.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotCodeCacheProvider.java index 42a5b2a5c94b1..a0130d1bda9e9 100644 --- a/src/jdk.internal.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotCodeCacheProvider.java +++ b/src/jdk.internal.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotCodeCacheProvider.java @@ -157,7 +157,8 @@ public InstalledCode installCode(ResolvedJavaMethod method, CompiledCode compile @Override public void invalidateInstalledCode(InstalledCode installedCode) { if (installedCode instanceof HotSpotNmethod) { - runtime.getCompilerToVM().invalidateHotSpotNmethod((HotSpotNmethod) installedCode); + HotSpotNmethod nmethod = (HotSpotNmethod) installedCode; + nmethod.invalidate(true); } else { throw new IllegalArgumentException("Cannot invalidate a " + Objects.requireNonNull(installedCode).getClass().getName()); } diff --git a/src/jdk.internal.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotNmethod.java b/src/jdk.internal.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotNmethod.java index a18f7b556fafa..9ed03f9749e3a 100644 --- a/src/jdk.internal.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotNmethod.java +++ b/src/jdk.internal.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotNmethod.java @@ -123,8 +123,8 @@ public ResolvedJavaMethod getMethod() { } @Override - public void invalidate() { - compilerToVM().invalidateHotSpotNmethod(this); + public void invalidate(boolean deoptimize) { + compilerToVM().invalidateHotSpotNmethod(this, deoptimize); } @Override diff --git a/src/jdk.jfr/share/conf/jfr/default.jfc b/src/jdk.jfr/share/conf/jfr/default.jfc index 71b09bd6fac9b..1c7b55dbf55d9 100644 --- a/src/jdk.jfr/share/conf/jfr/default.jfc +++ b/src/jdk.jfr/share/conf/jfr/default.jfc @@ -540,21 +540,6 @@ true