A @Stable field does not need to be volatile.
Avoiding volatile is one of the uses for @Stable.
That said, @Stable is not as foolproof as volatile.
It’s more dangerous, and cheaper.
You have to do a release store to a stable variable.
That’s what the VM does for you automatically for
a final, an
On 13 Mar 2025, at 4:20, Per Minborg wrote:
> …
>> Reentrancy into here seems really buggy, I would endorse disallowing it >>
>> instead. In that case, a `ReentrantLock` seems better than the native
>> monitor as we can cheaply check `lock.isHeldByCurrentThread()`
>
> StableValueImpl was careful
> Are deeper cycles of concern? I was thinking of this:
There are a couple of ways existing java.util code handles
self-cycles. The deepToString method handles them at all
levels, so it is robust. But it is tricky and expensive.
(Look at the variable named “dejaVu”.)
If you grep for /"(this / i
On 13 Dec 2024, at 5:22, Raffaello Giulietti wrote:
> For your specific multiplication use case you might try with
>
> long high = Math.multiplyHigh(a, b);
> long low = a * b;
> if (high == 0) return low;
> return "the big integer consisting of high and low";
>
> It might be possible that the mult
On 15 Oct 2024, at 12:35, Ioi Lam wrote:
> On Tue, 15 Oct 2024 19:08:20 GMT, Dan Heidinga wrote:
>
>>> 597:
>>> 598: /** Number of CPUS, to place bounds on some sizings */
>>> 599: static @Stable int NCPU;
>>
>> I would prefer to not mark this `@Stable` at this time as it would have
>> d
On 8 Oct 2024, at 14:47, Ioi Lam wrote:
> On Wed, 25 Sep 2024 17:14:54 GMT, Chen Liang wrote:
>
>>> 402: MethodType primordialMT = new MethodType(rtype, ptypes);
>>> 403: if (AOTHolder.archivedMethodTypes != null) {
>>> 404: MethodType mt =
>>> AOTHolder.archivedMetho
On 23 Aug 2024, at 15:33, Paul Sandoz wrote:
> The float/double conversion bothers me, not suggesting we do something about
> it here, noting down for any future conversation on shuffles.
Yes, it’s a pain which is noticeable in the vector/shuffle conversions.
In the worst case it adds dynamic re
On 21 Aug 2024, at 11:30, Paul Sandoz wrote:
> Is it possible for the intrinsic to be responsible for wrapping, if needed?
> If was looking at
> [`vpermi2b`](https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=vpermi2b&ig_expand=4917,4982,5004,5010,5014&techs=AVX_512)
>
On 21 Aug 2024, at 10:51, Sandhya Viswanathan wrote:
> @jatin-bhateja Thanks, the PR ((https://github.com/openjdk/jdk/pull/20634) is
> still work in progress and can be simplified much further. The changes I am
> currently working on are do wrap by default for rearrange and selectFrom as
> sugg
(Better late than never, although I wish I’d been more explicit
about this on panama-dev.)
I think we should be moving away from throwing exceptions on all
reorder/shuffle/permute vector ops, and moving toward wrapping.
These ops all operate on vectors (small arrays) of vector lane
indexes (small
P.S. I didn’t directly address David’s request for that magic number N.
I would just assume 32 bits as the conservative element size (for oops)
and work from there. If the cache line size is 64 bytes, then N=16.
These are robust assumptions, even if they waste a little space
when N could be 8 (bec
Some of these sorts of use cases could be covered by somehow discovering
a platform-specific parameter N such that a[I] and a[I+N] are not likely
to have false sharing in a data cache, for any I. (Or a series of N0,
N1, … that prevent a[N0], a[N1]… from being falsely shared.) David is
right that
On Apr 17, 2024, at 7:14 AM, David Lloyd wrote:
>
> 2. Add .MIN_VALUE, min/max with a value or vector also offset by
> .MIN_VALUE, and then subtract the offset again
I think that’s the path of least resistance. It’s just a vxor on each operand,
with a constant mask. That can be done in Java co
On 1 Sep 2023, at 2:38, Maurizio Cimadamore wrote:
> On Fri, 1 Sep 2023 09:07:34 GMT, Per Minborg wrote:
>
>>> Maybe it would make sense to start with a JDK-internal variant before
>>> exploring potential public API?
>>
>> This is certainly one alternative.
>
> When looking at this I thought abo
On 17 Jul 2023, at 2:08, Alan Bateman wrote:
On 15/07/2023 17:53, Daohan Qu wrote:
You will find places in the JDK code, esp. in performance critical
code, where assertions are commented out. The reason is that asserts,
even if disabled, increase the method size and can impact inlining by
th
Thanks for the good response Remi.
This is part of a larger FAQ, “why are MHs hard to use?”
Part of the answer is “they model bytecode behavior”.
(Perhaps they should have been called BytecodeBehaviorHandles.)
Lifting such raw VM-level behaviors up into Java source code is
necessary, but it will
On 15 Feb 2023, at 10:34, Mandy Chung wrote:
On Wed, 15 Feb 2023 17:32:38 GMT, David M. Lloyd
wrote:
The class generated for lambda proxies is now defined as a hidden
class. This means that the counter, which was used to ensure a unique
class name and avoid clashes, is now redundant. In add
> On Jan 27, 2023, at 2:46 AM, Tagir Valeev wrote:
>
> …
>>
>>
>> public static int clamp(long value, int min, int max)
>> public static long clamp(long value, long min, long max)
>> public static double clamp(double value, double min, double max)
>> public static float clamp(double value, fl
P.S Sorry, I botched a use case, saying x where I meant y:
```
long x = …, y = a*x*x + b*x + c;
double xf = x, yf = a*xf*xf + b*xf + c;
double yc = clamp(yf, Long.MIN_VALUE, Long.MAX_VALUE);
boolean saturated = false;
if (yc != yf) { // error processing
saturated = true; /
Dealing with numeric ranges is error-prone, so I welcome these.
Another operation on ranges is membership. This is easy to derive
from the clamp methods, I think:
```
checkRange(x,min,max) := clamp(x,min,max) == x
```
That idiom works even for NaNs, which are never in any range.
I wonder abo
On 16 Nov 2022, at 11:10, Alex Buckley wrote:
…
For example, the following code contains a template expression that
uses the template processor `RAW`, which simply yields the
`StringTemplate` passed to it:
int x = 10;
int y = 20;
StringTemplate st = RAW."\{x} + \{y} = \{x + y}";
List fragmen
On 3 Oct 2022, at 14:32, Stuart Marks wrote:
> …
> The Arrays class does need some attention and probably should be considered
> separately. It's lacking some other things too, like reverse(). One issue
> with modifying the Arrays class is providing overloads for some or all of the
> primitives
22 matches
Mail list logo