Re: RFR: 8282701: Use Class.getInterfaces(false) where possible to reduce allocation pressure [v2]

2022-05-10 Thread Mandy Chung
On Wed, 4 May 2022 09:46:00 GMT, Сергей Цыпанов  wrote:

>> `Class.getInterfaces(false)` does not clone underlying array and can be used 
>> in cases when the returned array is only read from.
>
> Сергей Цыпанов has updated the pull request incrementally with one additional 
> commit since the last revision:
> 
>   8282701: Revert some irrelevant changes

Marked as reviewed by mchung (Reviewer).

-

PR: https://git.openjdk.java.net/jdk/pull/7714


Re: RFR: 8282701: Use Class.getInterfaces(false) where possible to reduce allocation pressure [v2]

2022-05-10 Thread Claes Redestad
On Wed, 4 May 2022 09:46:00 GMT, Сергей Цыпанов  wrote:

>> `Class.getInterfaces(false)` does not clone underlying array and can be used 
>> in cases when the returned array is only read from.
>
> Сергей Цыпанов has updated the pull request incrementally with one additional 
> commit since the last revision:
> 
>   8282701: Revert some irrelevant changes

Marked as reviewed by redestad (Reviewer).

-

PR: https://git.openjdk.java.net/jdk/pull/7714


Re: RFR: 8282701: Use Class.getInterfaces(false) where possible to reduce allocation pressure [v2]

2022-05-04 Thread Сергей Цыпанов
On Wed, 4 May 2022 09:46:00 GMT, Сергей Цыпанов  wrote:

>> `Class.getInterfaces(false)` does not clone underlying array and can be used 
>> in cases when the returned array is only read from.
>
> Сергей Цыпанов has updated the pull request incrementally with one additional 
> commit since the last revision:
> 
>   8282701: Revert some irrelevant changes

I've reverted changes to `getInterface(boolean)`

-

PR: https://git.openjdk.java.net/jdk/pull/7714


Re: RFR: 8282701: Use Class.getInterfaces(false) where possible to reduce allocation pressure [v2]

2022-05-04 Thread Сергей Цыпанов
> `Class.getInterfaces(false)` does not clone underlying array and can be used 
> in cases when the returned array is only read from.

Сергей Цыпанов has updated the pull request incrementally with one additional 
commit since the last revision:

  8282701: Revert some irrelevant changes

-

Changes:
  - all: https://git.openjdk.java.net/jdk/pull/7714/files
  - new: https://git.openjdk.java.net/jdk/pull/7714/files/f13239c3..b79f1ddb

Webrevs:
 - full: https://webrevs.openjdk.java.net/?repo=jdk=7714=01
 - incr: https://webrevs.openjdk.java.net/?repo=jdk=7714=00-01

  Stats: 2 lines in 2 files changed: 0 ins; 0 del; 2 mod
  Patch: https://git.openjdk.java.net/jdk/pull/7714.diff
  Fetch: git fetch https://git.openjdk.java.net/jdk pull/7714/head:pull/7714

PR: https://git.openjdk.java.net/jdk/pull/7714


Re: RFR: 8282701: Use Class.getInterfaces(false) where possible to reduce allocation pressure

2022-05-02 Thread Claes Redestad
On Mon, 2 May 2022 16:19:07 GMT, Mandy Chung  wrote:

>> `Class.getInterfaces(false)` does not clone underlying array and can be used 
>> in cases when the returned array is only read from.
>
> For the `checkPackageAccess` case, I don't think it worths fixing; not only 
> that security manager is deprecated for removal but also when security 
> manager is enabled, there are lots of allocations for other security checks.
> 
> So the `getInterface(boolean)` method can be kept private.

I agree with @mlchung that the call site in `ClassLoader` is not particularly 
interesting and doesn't motivate a non-cloning, trusted method. There are a few 
other places in java.base where it's used and a trusted method could help, but 
not sure any of those are performance critical.

-

PR: https://git.openjdk.java.net/jdk/pull/7714


Re: RFR: 8282701: Use Class.getInterfaces(false) where possible to reduce allocation pressure

2022-05-02 Thread Mandy Chung
On Sat, 5 Mar 2022 13:07:56 GMT, Сергей Цыпанов  wrote:

> `Class.getInterfaces(false)` does not clone underlying array and can be used 
> in cases when the returned array is only read from.

For the `checkPackageAccess` case, I don't think it worths fixing; not only 
that security manager is deprecated for removal but also when security manager 
is enabled, there are lots of allocations for other security checks.

So the `getInterface(boolean)` method can be kept private.

-

PR: https://git.openjdk.java.net/jdk/pull/7714


Re: RFR: 8282701: Use Class.getInterfaces(false) where possible to reduce allocation pressure

2022-05-02 Thread Claes Redestad
On Sat, 5 Mar 2022 13:07:56 GMT, Сергей Цыпанов  wrote:

> `Class.getInterfaces(false)` does not clone underlying array and can be used 
> in cases when the returned array is only read from.

I think this ok in general, but for consistency and to better call out that 
we're dealing with a trusted shared array I would prefer if 
`getInterfaces(boolean)` remains private and instead we add a 
`getInterfacesShared()` (which simply call `getInterfaces(false)`).

-

Changes requested by redestad (Reviewer).

PR: https://git.openjdk.java.net/jdk/pull/7714


Re: RFR: 8282701: Use Class.getInterfaces(false) where possible to reduce allocation pressure

2022-05-02 Thread Сергей Цыпанов
On Sat, 5 Mar 2022 13:07:56 GMT, Сергей Цыпанов  wrote:

> `Class.getInterfaces(false)` does not clone underlying array and can be used 
> in cases when the returned array is only read from.

Let's wait a bit

-

PR: https://git.openjdk.java.net/jdk/pull/7714


Re: RFR: 8282701: Use Class.getInterfaces(false) where possible to reduce allocation pressure

2022-03-05 Thread -
This method is now called in java.lang.ClassLoader, which can only call
package-private java.lang.Class methods. This is a safe change as this
won't expose the raw array to any untrusted code.

On Sat, Mar 5, 2022 at 10:22 AM Bernd Eckenfels 
wrote:

> Should probably explain why it removes the private modifier?
>
> Gruss
> Bernd
> --
> http://bernd.eckenfels.net
> 
> Von: core-libs-dev  im Auftrag von
> Сергей Цыпанов 
> Gesendet: Saturday, March 5, 2022 2:14:20 PM
> An: core-libs-dev@openjdk.java.net 
> Betreff: RFR: 8282701: Use Class.getInterfaces(false) where possible to
> reduce allocation pressure
>
> `Class.getInterfaces(false)` does not clone underlying array and can be
> used in cases when the returned array is only read from.
>
> -
>
> Commit messages:
>  - 8282701: Use Class.getInterfaces(false) where possible to reduce
> allocation pressure
>
> Changes: https://git.openjdk.java.net/jdk/pull/7714/files
>  Webrev: https://webrevs.openjdk.java.net/?repo=jdk=7714=00
>   Issue: https://bugs.openjdk.java.net/browse/JDK-8282701
>   Stats: 4 lines in 2 files changed: 0 ins; 0 del; 4 mod
>   Patch: https://git.openjdk.java.net/jdk/pull/7714.diff
>   Fetch: git fetch https://git.openjdk.java.net/jdk
> pull/7714/head:pull/7714
>
> PR: https://git.openjdk.java.net/jdk/pull/7714
>


Re: RFR: 8282701: Use Class.getInterfaces(false) where possible to reduce allocation pressure

2022-03-05 Thread Bernd Eckenfels
Should probably explain why it removes the private modifier?

Gruss
Bernd
--
http://bernd.eckenfels.net

Von: core-libs-dev  im Auftrag von Сергей 
Цыпанов 
Gesendet: Saturday, March 5, 2022 2:14:20 PM
An: core-libs-dev@openjdk.java.net 
Betreff: RFR: 8282701: Use Class.getInterfaces(false) where possible to reduce 
allocation pressure

`Class.getInterfaces(false)` does not clone underlying array and can be used in 
cases when the returned array is only read from.

-

Commit messages:
 - 8282701: Use Class.getInterfaces(false) where possible to reduce allocation 
pressure

Changes: https://git.openjdk.java.net/jdk/pull/7714/files
 Webrev: https://webrevs.openjdk.java.net/?repo=jdk=7714=00
  Issue: https://bugs.openjdk.java.net/browse/JDK-8282701
  Stats: 4 lines in 2 files changed: 0 ins; 0 del; 4 mod
  Patch: https://git.openjdk.java.net/jdk/pull/7714.diff
  Fetch: git fetch https://git.openjdk.java.net/jdk pull/7714/head:pull/7714

PR: https://git.openjdk.java.net/jdk/pull/7714