Re: RFR: JDK-8239139 testmake fail with warning about strncpy using gcc version 8

2020-02-16 Thread Magnus Ihse Bursie

On 2020-02-17 08:48, linzang(臧琳) wrote:

Hi,
  May I ask help to review one tiny fix of build failure described at 
https://bugs.openjdk.java.net/browse/JDK-8239139
  Root cause is gcc version 8 prints warning for strncpy.
  The fix simply replace strncpy with snprintf.
  Thanks!
  Bug: https://bugs.openjdk.java.net/browse/JDK-8239139
  webrev: http://cr.openjdk.java.net/~lzang/8239139/webrev/

BRs,
Lin


Hi Lin,

This is not a build issue. I'm redirecting this to core-libs.

/Magnus


Re: JEP 370 - text example leads to exception

2020-02-16 Thread Chris T
Maurizio, thanks for pointing the bug out - however I don't think I was
impacted by it.

I agree with you that a more complex examples might distract the audience
from the main presentation points.

As mentioned in one of my previous email, I finalized some examples myself:
1. One example for memory layouts creates a structure where we associate
the SSN (social security number) to a credit score. The main point here is
to make a mix between char arrays and integers.
Code is here:
https://github.com/knowledge-base-and-tutorials/java14-features/blob/master/src/main/java/com/github/kbnt/java14/fma/ForeignMemoryAccessExamples.java
(method called example03SSNToCreditScore)
Presentation of the case is here:
https://www.youtube.com/watch?v=NwXzT8T6mb8&list=PLGDP1Irs2PmWNwAwMPdyOxCqkFqB6gtp9&index=7&t=1287s
2. A more complex example (in memory off-heap analytics and memory mapped
files) is the sleep analytics:
Code is here:
https://github.com/knowledge-base-and-tutorials/java14-features/blob/master/src/main/java/com/github/kbnt/java14/fma/SleepAnalytics.java
(the class' javadoc should describe it)
Presentation of the case is here:
https://www.youtube.com/watch?v=NwXzT8T6mb8&list=PLGDP1Irs2PmWNwAwMPdyOxCqkFqB6gtp9&index=7&t=1734s

If you find anything useful in those and want to use but the license
(Apache 2.0 for the code and CC-BY-SA for the videos) is in the way, let me
know and I can change them to something friendlier (where e.g. no
attribution is needed).

Cheers!
  Chris T


On Fri, Feb 14, 2020 at 6:26 PM Maurizio Cimadamore <
maurizio.cimadam...@oracle.com> wrote:

>
> On 13/02/2020 03:39, Chris T wrote:
>
> No problem! Nice talk at FOSDEM, Maurizio ;-)!
>
> One suggestion, for future talks - when it comes to memory layouts please
> construct an example that is a little bit more complex (by end of the
> upcoming weekend I will publish one that can be used). I had trouble with
> bit alignment when working on mine, but I will come back with the details
> (no bug or anything but more clarity would be beneficial in the docs). In
> your example (the Point one) the alignment is 32 but that is now always the
> case... The reason I mention this as an issue is that the Java development
> community is more "high-level". Believe it or not, bit alignment is not
> anymore "a thing" with most of us ;-)...
>
> Hey Chris - on alignment there was an issue that was uncovered on
> panama-dev - I think this fix should probably be ported to mainline:
>
> https://bugs.openjdk.java.net/browse/JDK-8238320
>
> This might make working with layout with padding a bit more tedious than
> intended, although this is probably not what you ran into.
>
> Re: talk suggestion - yes, more realistic examples would probably be
> better - but it's always hard to strike the right balance; if the example
> is more realistic it can be harder to follow, which might not be good when
> you are showing new concepts. But I'll keep that in mind for the future -
> after all this is a new API, and, as it's always the case, the more you
> think about how to explain these concepts and the more you do it, the more
> ways you find to get the message across in an optimal way.
>
> Thanks!
> Maurizio
>
>
>
> I will also think about some API enhancements I would like to see as a
> developer...
>
> Thanks!
>   Chris T
>
> On Tue, Feb 11, 2020 at 4:07 AM Maurizio Cimadamore <
> maurizio.cimadam...@oracle.com> wrote:
>
>> Thanks Paul!
>>
>> Maurizio
>>
>> On 10/02/2020 17:58, Paul Sandoz wrote:
>> > I modified the JEP with updated code snippets that compile against the
>> latest API in JDK 14 [*].
>>
>


Re: JDK-8237818: Typo in Unsafe: resposibility

2020-02-16 Thread Aya Ebata
Hi,

Thanks for pushing changes!

regards,
Aya Ebata



2020年2月17日(月) 11:37 Yasumasa Suenaga :

> On 2020/02/17 11:21, David Holmes wrote:
> > Hi Yasumasa,
> >
> > On 17/02/2020 11:38 am, Yasumasa Suenaga wrote:
> >> Hi David,
> >>
> >> On 2020/02/17 8:10, David Holmes wrote:
> >>> On 17/02/2020 12:40 am, Aya Ebata wrote:
>  Hi,
> 
>  I sent OCA today. So it hasn't been approved yet. I'm waiting for
> approval.
> >>>
> >>> For this trivial contribution an OCA is a not required, so this can be
> sponsored before the OCA goes through processing.
> >>
> >> I didn't know that!
> >> I hope it is described in "How to contribute" page [1].
> >
> > Unfortunately no, it is covered in the by-laws [1], when distinguishing
> a Participant from a Contributor:
> >
> > "A Participant may post messages to a list, submit simple patches, and
> make other kinds of small contributions."
> >
> > "A Contributor is a Participant who has signed the Oracle Contributor
> Agreement (OCA),  ..."
>
> Thanks for your information!
>
>
> Cheers,
>
> Yasumasa
>
>
> > Cheers,
> > David
> >
> > [1] https://openjdk.java.net/bylaws
> >
> >
> >
> >> Anyway, I will push Aya's change to jdk/jdk.
> >>
> >>
> >> Thanks,
> >>
> >> Yasumasa
> >>
> >>
> >> [1] https://openjdk.java.net/contribute/
> >>
> >>
> >>> Cheers,
> >>> David
> >>>
>  regards,
>  Aya Ebata
> 
> 
>  2020年2月16日(日) 16:49 Yasumasa Suenaga :
> 
> > Hi Aya,
> >
> > It looks good to me.
> > BTW, have you signed to OCA? If so, I will sponsor you.
> >
> >
> > Thanks,
> >
> > Yasumasa
> >
> >
> > On 2020/02/16 16:42, 江畑 彩 wrote:
> >> Hi,
> >>
> >> I fixed typo in s.m.Unsafe and j.i.Unsafe. The changes are below.
> >> Could you sponsor this, please.
> >> https://bugs.openjdk.java.net/browse/JDK-8237818
> >>
> >> regards,
> >> Aya Ebata
> >>
> >>
> >>
> >> diff --git
> a/src/java.base/share/classes/jdk/internal/misc/Unsafe.java
> >> b/src/java.base/share/classes/jdk/internal/misc/Unsafe.java
> >> --- a/src/java.base/share/classes/jdk/internal/misc/Unsafe.java
> >> +++ b/src/java.base/share/classes/jdk/internal/misc/Unsafe.java
> >> @@ -40,7 +40,7 @@
> >> * Although the class and all methods are public, use of this
> class is
> >> * limited because only trusted code can obtain instances of it.
> >> *
> >> - * Note: It is the resposibility of the caller to make
> sure
> >> + * Note: It is the responsibility of the caller to make
> sure
> >> * arguments are checked before methods of this class are
> >> * called. While some rudimentary checks are performed on the
> input,
> >> * the checks are best effort and when performance is an
> overriding
> >> @@ -425,7 +425,7 @@
> >>/**
> >> * Create an exception reflecting that some of the input was
> > invalid
> >> *
> >> - * Note: It is the resposibility of the caller to make
> >> + * Note: It is the responsibility of the caller to
> make
> >> * sure arguments are checked before the methods are called.
> While
> >> * some rudimentary checks are performed on the input, the
> checks
> >> * are best effort and when performance is an overriding
> priority,
> >> @@ -601,7 +601,7 @@
> >> * aligned for all value types.  Dispose of this memory by
> calling
> >> {@link
> >> * #freeMemory}, or resize it with {@link #reallocateMemory}.
> >> *
> >> - * Note: It is the resposibility of the caller to make
> >> + * Note: It is the responsibility of the caller to
> make
> >> * sure arguments are checked before the methods are called.
> While
> >> * some rudimentary checks are performed on the input, the
> checks
> >> * are best effort and when performance is an overriding
> priority,
> >> @@ -657,7 +657,7 @@
> >> * #reallocateMemory}.  The address passed to this method
> may be
> > null,
> >> in
> >> * which case an allocation will be performed.
> >> *
> >> - * Note: It is the resposibility of the caller to make
> >> + * Note: It is the responsibility of the caller to
> make
> >> * sure arguments are checked before the methods are called.
> While
> >> * some rudimentary checks are performed on the input, the
> checks
> >> * are best effort and when performance is an overriding
> priority,
> >> @@ -719,7 +719,7 @@
> >> * If the effective address and length are (resp.) even
> modulo 4
> > or 2,
> >> * the stores take place in units of 'int' or 'short'.
> >> *
> >> - * Note: It is the resposibility of the caller to make
> >> + * Note: It is the responsibility of the caller to
> make
> >> * sure arguments are che

Re: RFR: 8211917: (zipfs) Creating or updating a JAR file system should put the MANIFEST.MF at the start

2020-02-16 Thread Jaikiran Pai
Hello Lance,

On 15/02/20 2:27 am, Lance Andersen wrote:
> Hi Jaikiran,
>
> I think the changes to ZipFileSystem are OK.
>
> The test overall is good.  I am going to streamline it a bit and
> remove the long lines (we try to keep lines to around 80 characters).
>
I'll keep that in mind for future changes. Thank you for taking care of
this.

-Jaikiran



Re: JDK-8237818: Typo in Unsafe: resposibility

2020-02-16 Thread Yasumasa Suenaga

On 2020/02/17 11:21, David Holmes wrote:

Hi Yasumasa,

On 17/02/2020 11:38 am, Yasumasa Suenaga wrote:

Hi David,

On 2020/02/17 8:10, David Holmes wrote:

On 17/02/2020 12:40 am, Aya Ebata wrote:

Hi,

I sent OCA today. So it hasn't been approved yet. I'm waiting for approval.


For this trivial contribution an OCA is a not required, so this can be 
sponsored before the OCA goes through processing.


I didn't know that!
I hope it is described in "How to contribute" page [1].


Unfortunately no, it is covered in the by-laws [1], when distinguishing a 
Participant from a Contributor:

"A Participant may post messages to a list, submit simple patches, and make other 
kinds of small contributions."

"A Contributor is a Participant who has signed the Oracle Contributor Agreement 
(OCA),  ..."


Thanks for your information!


Cheers,

Yasumasa



Cheers,
David

[1] https://openjdk.java.net/bylaws




Anyway, I will push Aya's change to jdk/jdk.


Thanks,

Yasumasa


[1] https://openjdk.java.net/contribute/



Cheers,
David


regards,
Aya Ebata


2020年2月16日(日) 16:49 Yasumasa Suenaga :


Hi Aya,

It looks good to me.
BTW, have you signed to OCA? If so, I will sponsor you.


Thanks,

Yasumasa


On 2020/02/16 16:42, 江畑 彩 wrote:

Hi,

I fixed typo in s.m.Unsafe and j.i.Unsafe. The changes are below.
Could you sponsor this, please.
https://bugs.openjdk.java.net/browse/JDK-8237818

regards,
Aya Ebata



diff --git a/src/java.base/share/classes/jdk/internal/misc/Unsafe.java
b/src/java.base/share/classes/jdk/internal/misc/Unsafe.java
--- a/src/java.base/share/classes/jdk/internal/misc/Unsafe.java
+++ b/src/java.base/share/classes/jdk/internal/misc/Unsafe.java
@@ -40,7 +40,7 @@
    * Although the class and all methods are public, use of this class is
    * limited because only trusted code can obtain instances of it.
    *
- * Note: It is the resposibility of the caller to make sure
+ * Note: It is the responsibility of the caller to make sure
    * arguments are checked before methods of this class are
    * called. While some rudimentary checks are performed on the input,
    * the checks are best effort and when performance is an overriding
@@ -425,7 +425,7 @@
   /**
    * Create an exception reflecting that some of the input was

invalid

    *
- * Note: It is the resposibility of the caller to make
+ * Note: It is the responsibility of the caller to make
    * sure arguments are checked before the methods are called. While
    * some rudimentary checks are performed on the input, the checks
    * are best effort and when performance is an overriding priority,
@@ -601,7 +601,7 @@
    * aligned for all value types.  Dispose of this memory by calling
{@link
    * #freeMemory}, or resize it with {@link #reallocateMemory}.
    *
- * Note: It is the resposibility of the caller to make
+ * Note: It is the responsibility of the caller to make
    * sure arguments are checked before the methods are called. While
    * some rudimentary checks are performed on the input, the checks
    * are best effort and when performance is an overriding priority,
@@ -657,7 +657,7 @@
    * #reallocateMemory}.  The address passed to this method may be

null,

in
    * which case an allocation will be performed.
    *
- * Note: It is the resposibility of the caller to make
+ * Note: It is the responsibility of the caller to make
    * sure arguments are checked before the methods are called. While
    * some rudimentary checks are performed on the input, the checks
    * are best effort and when performance is an overriding priority,
@@ -719,7 +719,7 @@
    * If the effective address and length are (resp.) even modulo 4

or 2,

    * the stores take place in units of 'int' or 'short'.
    *
- * Note: It is the resposibility of the caller to make
+ * Note: It is the responsibility of the caller to make
    * sure arguments are checked before the methods are called. While
    * some rudimentary checks are performed on the input, the checks
    * are best effort and when performance is an overriding priority,
@@ -781,7 +781,7 @@
    * If the effective addresses and length are (resp.) even modulo 4

or

2,
    * the transfer takes place in units of 'int' or 'short'.
    *
- * Note: It is the resposibility of the caller to make
+ * Note: It is the responsibility of the caller to make
    * sure arguments are checked before the methods are called. While
    * some rudimentary checks are performed on the input, the checks
    * are best effort and when performance is an overriding priority,
@@ -842,7 +842,7 @@
    * as discussed in {@link #getInt(Object,long)}.  When the object
reference is null,
    * the offset supplies an absolute base address.
    *
- * Note: It is the resposibility of the caller to make
+ * Note: It is the responsibility of the caller to make
  

Re: JDK-8237818: Typo in Unsafe: resposibility

2020-02-16 Thread David Holmes

Hi Yasumasa,

On 17/02/2020 11:38 am, Yasumasa Suenaga wrote:

Hi David,

On 2020/02/17 8:10, David Holmes wrote:

On 17/02/2020 12:40 am, Aya Ebata wrote:

Hi,

I sent OCA today. So it hasn't been approved yet. I'm waiting for 
approval.


For this trivial contribution an OCA is a not required, so this can be 
sponsored before the OCA goes through processing.


I didn't know that!
I hope it is described in "How to contribute" page [1].


Unfortunately no, it is covered in the by-laws [1], when distinguishing 
a Participant from a Contributor:


"A Participant may post messages to a list, submit simple patches, and 
make other kinds of small contributions."


"A Contributor is a Participant who has signed the Oracle Contributor 
Agreement (OCA),  ..."


Cheers,
David

[1] https://openjdk.java.net/bylaws




Anyway, I will push Aya's change to jdk/jdk.


Thanks,

Yasumasa


[1] https://openjdk.java.net/contribute/



Cheers,
David


regards,
Aya Ebata


2020年2月16日(日) 16:49 Yasumasa Suenaga :


Hi Aya,

It looks good to me.
BTW, have you signed to OCA? If so, I will sponsor you.


Thanks,

Yasumasa


On 2020/02/16 16:42, 江畑 彩 wrote:

Hi,

I fixed typo in s.m.Unsafe and j.i.Unsafe. The changes are below.
Could you sponsor this, please.
https://bugs.openjdk.java.net/browse/JDK-8237818

regards,
Aya Ebata



diff --git a/src/java.base/share/classes/jdk/internal/misc/Unsafe.java
b/src/java.base/share/classes/jdk/internal/misc/Unsafe.java
--- a/src/java.base/share/classes/jdk/internal/misc/Unsafe.java
+++ b/src/java.base/share/classes/jdk/internal/misc/Unsafe.java
@@ -40,7 +40,7 @@
    * Although the class and all methods are public, use of this 
class is

    * limited because only trusted code can obtain instances of it.
    *
- * Note: It is the resposibility of the caller to make sure
+ * Note: It is the responsibility of the caller to make sure
    * arguments are checked before methods of this class are
    * called. While some rudimentary checks are performed on the 
input,

    * the checks are best effort and when performance is an overriding
@@ -425,7 +425,7 @@
   /**
    * Create an exception reflecting that some of the input was

invalid

    *
- * Note: It is the resposibility of the caller to make
+ * Note: It is the responsibility of the caller to make
    * sure arguments are checked before the methods are called. 
While
    * some rudimentary checks are performed on the input, the 
checks
    * are best effort and when performance is an overriding 
priority,

@@ -601,7 +601,7 @@
    * aligned for all value types.  Dispose of this memory by 
calling

{@link
    * #freeMemory}, or resize it with {@link #reallocateMemory}.
    *
- * Note: It is the resposibility of the caller to make
+ * Note: It is the responsibility of the caller to make
    * sure arguments are checked before the methods are called. 
While
    * some rudimentary checks are performed on the input, the 
checks
    * are best effort and when performance is an overriding 
priority,

@@ -657,7 +657,7 @@
    * #reallocateMemory}.  The address passed to this method 
may be

null,

in
    * which case an allocation will be performed.
    *
- * Note: It is the resposibility of the caller to make
+ * Note: It is the responsibility of the caller to make
    * sure arguments are checked before the methods are called. 
While
    * some rudimentary checks are performed on the input, the 
checks
    * are best effort and when performance is an overriding 
priority,

@@ -719,7 +719,7 @@
    * If the effective address and length are (resp.) even 
modulo 4

or 2,

    * the stores take place in units of 'int' or 'short'.
    *
- * Note: It is the resposibility of the caller to make
+ * Note: It is the responsibility of the caller to make
    * sure arguments are checked before the methods are called. 
While
    * some rudimentary checks are performed on the input, the 
checks
    * are best effort and when performance is an overriding 
priority,

@@ -781,7 +781,7 @@
    * If the effective addresses and length are (resp.) even 
modulo 4

or

2,
    * the transfer takes place in units of 'int' or 'short'.
    *
- * Note: It is the resposibility of the caller to make
+ * Note: It is the responsibility of the caller to make
    * sure arguments are checked before the methods are called. 
While
    * some rudimentary checks are performed on the input, the 
checks
    * are best effort and when performance is an overriding 
priority,

@@ -842,7 +842,7 @@
    * as discussed in {@link #getInt(Object,long)}.  When the 
object

reference is null,
    * the offset supplies an absolute base address.
    *
- * Note: It is the resposibility of the caller to make
+ * Note: It is the responsibility of the caller to make
    * sure arguments are checked before the methods are called

Re: JDK-8237818: Typo in Unsafe: resposibility

2020-02-16 Thread Yasumasa Suenaga

Pushed: http://hg.openjdk.java.net/jdk/jdk/rev/f3f66f9e98ee

Yasumasa


On 2020/02/17 10:38, Yasumasa Suenaga wrote:

Hi David,

On 2020/02/17 8:10, David Holmes wrote:

On 17/02/2020 12:40 am, Aya Ebata wrote:

Hi,

I sent OCA today. So it hasn't been approved yet. I'm waiting for approval.


For this trivial contribution an OCA is a not required, so this can be 
sponsored before the OCA goes through processing.


I didn't know that!
I hope it is described in "How to contribute" page [1].

Anyway, I will push Aya's change to jdk/jdk.


Thanks,

Yasumasa


[1] https://openjdk.java.net/contribute/



Cheers,
David


regards,
Aya Ebata


2020年2月16日(日) 16:49 Yasumasa Suenaga :


Hi Aya,

It looks good to me.
BTW, have you signed to OCA? If so, I will sponsor you.


Thanks,

Yasumasa


On 2020/02/16 16:42, 江畑 彩 wrote:

Hi,

I fixed typo in s.m.Unsafe and j.i.Unsafe. The changes are below.
Could you sponsor this, please.
https://bugs.openjdk.java.net/browse/JDK-8237818

regards,
Aya Ebata



diff --git a/src/java.base/share/classes/jdk/internal/misc/Unsafe.java
b/src/java.base/share/classes/jdk/internal/misc/Unsafe.java
--- a/src/java.base/share/classes/jdk/internal/misc/Unsafe.java
+++ b/src/java.base/share/classes/jdk/internal/misc/Unsafe.java
@@ -40,7 +40,7 @@
    * Although the class and all methods are public, use of this class is
    * limited because only trusted code can obtain instances of it.
    *
- * Note: It is the resposibility of the caller to make sure
+ * Note: It is the responsibility of the caller to make sure
    * arguments are checked before methods of this class are
    * called. While some rudimentary checks are performed on the input,
    * the checks are best effort and when performance is an overriding
@@ -425,7 +425,7 @@
   /**
    * Create an exception reflecting that some of the input was

invalid

    *
- * Note: It is the resposibility of the caller to make
+ * Note: It is the responsibility of the caller to make
    * sure arguments are checked before the methods are called. While
    * some rudimentary checks are performed on the input, the checks
    * are best effort and when performance is an overriding priority,
@@ -601,7 +601,7 @@
    * aligned for all value types.  Dispose of this memory by calling
{@link
    * #freeMemory}, or resize it with {@link #reallocateMemory}.
    *
- * Note: It is the resposibility of the caller to make
+ * Note: It is the responsibility of the caller to make
    * sure arguments are checked before the methods are called. While
    * some rudimentary checks are performed on the input, the checks
    * are best effort and when performance is an overriding priority,
@@ -657,7 +657,7 @@
    * #reallocateMemory}.  The address passed to this method may be

null,

in
    * which case an allocation will be performed.
    *
- * Note: It is the resposibility of the caller to make
+ * Note: It is the responsibility of the caller to make
    * sure arguments are checked before the methods are called. While
    * some rudimentary checks are performed on the input, the checks
    * are best effort and when performance is an overriding priority,
@@ -719,7 +719,7 @@
    * If the effective address and length are (resp.) even modulo 4

or 2,

    * the stores take place in units of 'int' or 'short'.
    *
- * Note: It is the resposibility of the caller to make
+ * Note: It is the responsibility of the caller to make
    * sure arguments are checked before the methods are called. While
    * some rudimentary checks are performed on the input, the checks
    * are best effort and when performance is an overriding priority,
@@ -781,7 +781,7 @@
    * If the effective addresses and length are (resp.) even modulo 4

or

2,
    * the transfer takes place in units of 'int' or 'short'.
    *
- * Note: It is the resposibility of the caller to make
+ * Note: It is the responsibility of the caller to make
    * sure arguments are checked before the methods are called. While
    * some rudimentary checks are performed on the input, the checks
    * are best effort and when performance is an overriding priority,
@@ -842,7 +842,7 @@
    * as discussed in {@link #getInt(Object,long)}.  When the object
reference is null,
    * the offset supplies an absolute base address.
    *
- * Note: It is the resposibility of the caller to make
+ * Note: It is the responsibility of the caller to make
    * sure arguments are checked before the methods are called. While
    * some rudimentary checks are performed on the input, the checks
    * are best effort and when performance is an overriding priority,
@@ -901,7 +901,7 @@
    * #allocateMemory} or {@link #reallocateMemory}.  The address

passed

to
    * this method may be null, in which case no action is taken.
    *
- * Note: It i

Re: JDK-8237818: Typo in Unsafe: resposibility

2020-02-16 Thread Yasumasa Suenaga

Hi David,

On 2020/02/17 8:10, David Holmes wrote:

On 17/02/2020 12:40 am, Aya Ebata wrote:

Hi,

I sent OCA today. So it hasn't been approved yet. I'm waiting for approval.


For this trivial contribution an OCA is a not required, so this can be 
sponsored before the OCA goes through processing.


I didn't know that!
I hope it is described in "How to contribute" page [1].

Anyway, I will push Aya's change to jdk/jdk.


Thanks,

Yasumasa


[1] https://openjdk.java.net/contribute/



Cheers,
David


regards,
Aya Ebata


2020年2月16日(日) 16:49 Yasumasa Suenaga :


Hi Aya,

It looks good to me.
BTW, have you signed to OCA? If so, I will sponsor you.


Thanks,

Yasumasa


On 2020/02/16 16:42, 江畑 彩 wrote:

Hi,

I fixed typo in s.m.Unsafe and j.i.Unsafe. The changes are below.
Could you sponsor this, please.
https://bugs.openjdk.java.net/browse/JDK-8237818

regards,
Aya Ebata



diff --git a/src/java.base/share/classes/jdk/internal/misc/Unsafe.java
b/src/java.base/share/classes/jdk/internal/misc/Unsafe.java
--- a/src/java.base/share/classes/jdk/internal/misc/Unsafe.java
+++ b/src/java.base/share/classes/jdk/internal/misc/Unsafe.java
@@ -40,7 +40,7 @@
    * Although the class and all methods are public, use of this class is
    * limited because only trusted code can obtain instances of it.
    *
- * Note: It is the resposibility of the caller to make sure
+ * Note: It is the responsibility of the caller to make sure
    * arguments are checked before methods of this class are
    * called. While some rudimentary checks are performed on the input,
    * the checks are best effort and when performance is an overriding
@@ -425,7 +425,7 @@
   /**
    * Create an exception reflecting that some of the input was

invalid

    *
- * Note: It is the resposibility of the caller to make
+ * Note: It is the responsibility of the caller to make
    * sure arguments are checked before the methods are called. While
    * some rudimentary checks are performed on the input, the checks
    * are best effort and when performance is an overriding priority,
@@ -601,7 +601,7 @@
    * aligned for all value types.  Dispose of this memory by calling
{@link
    * #freeMemory}, or resize it with {@link #reallocateMemory}.
    *
- * Note: It is the resposibility of the caller to make
+ * Note: It is the responsibility of the caller to make
    * sure arguments are checked before the methods are called. While
    * some rudimentary checks are performed on the input, the checks
    * are best effort and when performance is an overriding priority,
@@ -657,7 +657,7 @@
    * #reallocateMemory}.  The address passed to this method may be

null,

in
    * which case an allocation will be performed.
    *
- * Note: It is the resposibility of the caller to make
+ * Note: It is the responsibility of the caller to make
    * sure arguments are checked before the methods are called. While
    * some rudimentary checks are performed on the input, the checks
    * are best effort and when performance is an overriding priority,
@@ -719,7 +719,7 @@
    * If the effective address and length are (resp.) even modulo 4

or 2,

    * the stores take place in units of 'int' or 'short'.
    *
- * Note: It is the resposibility of the caller to make
+ * Note: It is the responsibility of the caller to make
    * sure arguments are checked before the methods are called. While
    * some rudimentary checks are performed on the input, the checks
    * are best effort and when performance is an overriding priority,
@@ -781,7 +781,7 @@
    * If the effective addresses and length are (resp.) even modulo 4

or

2,
    * the transfer takes place in units of 'int' or 'short'.
    *
- * Note: It is the resposibility of the caller to make
+ * Note: It is the responsibility of the caller to make
    * sure arguments are checked before the methods are called. While
    * some rudimentary checks are performed on the input, the checks
    * are best effort and when performance is an overriding priority,
@@ -842,7 +842,7 @@
    * as discussed in {@link #getInt(Object,long)}.  When the object
reference is null,
    * the offset supplies an absolute base address.
    *
- * Note: It is the resposibility of the caller to make
+ * Note: It is the responsibility of the caller to make
    * sure arguments are checked before the methods are called. While
    * some rudimentary checks are performed on the input, the checks
    * are best effort and when performance is an overriding priority,
@@ -901,7 +901,7 @@
    * #allocateMemory} or {@link #reallocateMemory}.  The address

passed

to
    * this method may be null, in which case no action is taken.
    *
- * Note: It is the resposibility of the caller to make
+ * Note: It is the responsibility of the caller to make
    * sure 

Re: JDK-8237818: Typo in Unsafe: resposibility

2020-02-16 Thread David Holmes

On 17/02/2020 12:40 am, Aya Ebata wrote:

Hi,

I sent OCA today. So it hasn't been approved yet. I'm waiting for approval.


For this trivial contribution an OCA is a not required, so this can be 
sponsored before the OCA goes through processing.


Cheers,
David


regards,
Aya Ebata


2020年2月16日(日) 16:49 Yasumasa Suenaga :


Hi Aya,

It looks good to me.
BTW, have you signed to OCA? If so, I will sponsor you.


Thanks,

Yasumasa


On 2020/02/16 16:42, 江畑 彩 wrote:

Hi,

I fixed typo in s.m.Unsafe and j.i.Unsafe. The changes are below.
Could you sponsor this, please.
https://bugs.openjdk.java.net/browse/JDK-8237818

regards,
Aya Ebata



diff --git a/src/java.base/share/classes/jdk/internal/misc/Unsafe.java
b/src/java.base/share/classes/jdk/internal/misc/Unsafe.java
--- a/src/java.base/share/classes/jdk/internal/misc/Unsafe.java
+++ b/src/java.base/share/classes/jdk/internal/misc/Unsafe.java
@@ -40,7 +40,7 @@
* Although the class and all methods are public, use of this class is
* limited because only trusted code can obtain instances of it.
*
- * Note: It is the resposibility of the caller to make sure
+ * Note: It is the responsibility of the caller to make sure
* arguments are checked before methods of this class are
* called. While some rudimentary checks are performed on the input,
* the checks are best effort and when performance is an overriding
@@ -425,7 +425,7 @@
   /**
* Create an exception reflecting that some of the input was

invalid

*
- * Note: It is the resposibility of the caller to make
+ * Note: It is the responsibility of the caller to make
* sure arguments are checked before the methods are called. While
* some rudimentary checks are performed on the input, the checks
* are best effort and when performance is an overriding priority,
@@ -601,7 +601,7 @@
* aligned for all value types.  Dispose of this memory by calling
{@link
* #freeMemory}, or resize it with {@link #reallocateMemory}.
*
- * Note: It is the resposibility of the caller to make
+ * Note: It is the responsibility of the caller to make
* sure arguments are checked before the methods are called. While
* some rudimentary checks are performed on the input, the checks
* are best effort and when performance is an overriding priority,
@@ -657,7 +657,7 @@
* #reallocateMemory}.  The address passed to this method may be

null,

in
* which case an allocation will be performed.
*
- * Note: It is the resposibility of the caller to make
+ * Note: It is the responsibility of the caller to make
* sure arguments are checked before the methods are called. While
* some rudimentary checks are performed on the input, the checks
* are best effort and when performance is an overriding priority,
@@ -719,7 +719,7 @@
* If the effective address and length are (resp.) even modulo 4

or 2,

* the stores take place in units of 'int' or 'short'.
*
- * Note: It is the resposibility of the caller to make
+ * Note: It is the responsibility of the caller to make
* sure arguments are checked before the methods are called. While
* some rudimentary checks are performed on the input, the checks
* are best effort and when performance is an overriding priority,
@@ -781,7 +781,7 @@
* If the effective addresses and length are (resp.) even modulo 4

or

2,
* the transfer takes place in units of 'int' or 'short'.
*
- * Note: It is the resposibility of the caller to make
+ * Note: It is the responsibility of the caller to make
* sure arguments are checked before the methods are called. While
* some rudimentary checks are performed on the input, the checks
* are best effort and when performance is an overriding priority,
@@ -842,7 +842,7 @@
* as discussed in {@link #getInt(Object,long)}.  When the object
reference is null,
* the offset supplies an absolute base address.
*
- * Note: It is the resposibility of the caller to make
+ * Note: It is the responsibility of the caller to make
* sure arguments are checked before the methods are called. While
* some rudimentary checks are performed on the input, the checks
* are best effort and when performance is an overriding priority,
@@ -901,7 +901,7 @@
* #allocateMemory} or {@link #reallocateMemory}.  The address

passed

to
* this method may be null, in which case no action is taken.
*
- * Note: It is the resposibility of the caller to make
+ * Note: It is the responsibility of the caller to make
* sure arguments are checked before the methods are called. While
* some rudimentary checks are performed on the input, the checks
* are best effort and when performance is an overriding priority,
diff --git a/src/jdk.unsupported/s

Re: [PATCH] Enhancement proposal for java.util.StringJoiner

2020-02-16 Thread Сергей Цыпанов
Hello,

I've complitely reworked the patch according to investigation in [1].

1) usage of JavaLangAccess allows to rid reflection completely and access 
package-private String.isLatin1 via SharedSecrets only,
so no black wizardry any more

2) now we have only a few cases with noticeable regeression (in statistics I've 
marked corresponding rows with exclamation marks)

3) usage of non-copying constructor of String in StringLatin1.newString(byte[]) 
allows to reduce memory consumption significantly

4) there still could be a patological case when we join an array or collection 
with lots of latin Strings and 1 non-latin String as the last element.
In this case we fall back to char[] but waste some time to latiness check.

5) current implementataion is almost regresion-free for non-latin Strings both 
in terms of time and memory

6) in general proposed changes are trivial

The benchmarking results can be found below, I've used benchmark [2]

P. S. I've added Martin as according to the first comment [1] he is responsible 
for this optimization

With best regards,
Sergey Tsypanov

1. https://bugs.openjdk.java.net/browse/JDK-8148937
2. 
https://github.com/stsypanov/strings/blob/master/src/jmh/java/tsypanov/strings/join/StringJoinerBenchmark.java

https://github.com/stsypanov/strings/blob/master/src/main/java/tsypanov/strings/source/string/Joiner.java


Benchmark  (count)  (latin)  (length)   Original   
Error Patched   Error  Units

stringJoiner 1 true 1   27.7 ±   
1.222.1 ±   0.2  ns/op
stringJoiner 1 true 5   27.7 ±   
0.122.3 ±   0.0  ns/op
stringJoiner 1 true10   29.0 ±   
0.623.2 ±   0.0  ns/op
stringJoiner 1 true   100   51.4 ±   
0.131.4 ±   0.1  ns/op
stringJoiner 5 true 1   71.1 ±   
0.464.9 ±   0.3  ns/op
stringJoiner 5 true 5   79.5 ±   
0.365.5 ±   0.3  ns/op
stringJoiner 5 true10   81.2 ±   
0.367.7 ±   0.2  ns/op
stringJoiner 5 true   100  150.0 ±   
0.486.5 ±   0.5  ns/op
stringJoiner10 true 1  145.5 ±   
0.7   142.5 ±   0.4  ns/op
stringJoiner10 true 5  160.0 ±   
0.8   145.6 ±   0.2  ns/op
stringJoiner10 true10  165.6 ±   
0.4   150.8 ±   0.3  ns/op
stringJoiner10 true   100  340.2 ±   
1.2   189.3 ±   0.4  ns/op
stringJoiner   100 true 1 1114.3 ±  
15.9  1372.7 ±  53.0  ns/op   !
stringJoiner   100 true 5 1184.2 ±  
18.5  1385.9 ±  56.0  ns/op   !
stringJoiner   100 true10 1345.8 ±  
13.9  1369.0 ±   2.7  ns/op   !
stringJoiner   100 true   100 3156.1 ±  
19.1  1844.1 ±   4.1  ns/op

stringJoiner 1false 1   33.5 ±   
0.434.9 ±   0.1  ns/op
stringJoiner 1false 5   33.3 ±   
0.335.9 ±   0.1  ns/op
stringJoiner 1false10   33.8 ±   
0.135.9 ±   0.1  ns/op
stringJoiner 1false   100   57.5 ±   
0.258.3 ±   0.1  ns/op
stringJoiner 5false 1   82.9 ±   
0.582.0 ±   0.8  ns/op
stringJoiner 5false 5   86.0 ±   
0.584.8 ±   0.9  ns/op
stringJoiner 5false10   96.9 ±   
0.592.5 ±   0.6  ns/op
stringJoiner 5false   100  224.2 ±   
0.6   226.7 ±   0.7  ns/op
stringJoiner10false 1  165.7 ±   
0.9   167.6 ±   3.2  ns/op
stringJoiner10false 5  178.4 ±   
0.7   179.6 ±   2.1  ns/op
stringJoiner10false10  191.7 ±   
0.9   195.9 ±   2.2  ns/op
stringJoiner10false   100  534.4 ±   
1.4   534.5 ±   1.3  ns/op
stringJoiner   100false 1 1435.9 ±   
9.5  1428.2 ±   3.2  ns/op
stringJoiner   100false 5 1618.5 ±  
14.3  1595.2 ±   3.7  ns/op
stringJoiner   100false10 1898.1 ±   
9.4  1860.8 ±   4.7  ns/op
stringJoiner   100false   100 4247.4 ±  
60.7  4150.1 ±   9.1  ns/op

stringJoiner

Re: JDK-8237818: Typo in Unsafe: resposibility

2020-02-16 Thread Aya Ebata
Hi,

I sent OCA today. So it hasn't been approved yet. I'm waiting for approval.

regards,
Aya Ebata


2020年2月16日(日) 16:49 Yasumasa Suenaga :

> Hi Aya,
>
> It looks good to me.
> BTW, have you signed to OCA? If so, I will sponsor you.
>
>
> Thanks,
>
> Yasumasa
>
>
> On 2020/02/16 16:42, 江畑 彩 wrote:
> > Hi,
> >
> > I fixed typo in s.m.Unsafe and j.i.Unsafe. The changes are below.
> > Could you sponsor this, please.
> > https://bugs.openjdk.java.net/browse/JDK-8237818
> >
> > regards,
> > Aya Ebata
> >
> >
> >
> > diff --git a/src/java.base/share/classes/jdk/internal/misc/Unsafe.java
> > b/src/java.base/share/classes/jdk/internal/misc/Unsafe.java
> > --- a/src/java.base/share/classes/jdk/internal/misc/Unsafe.java
> > +++ b/src/java.base/share/classes/jdk/internal/misc/Unsafe.java
> > @@ -40,7 +40,7 @@
> >* Although the class and all methods are public, use of this class is
> >* limited because only trusted code can obtain instances of it.
> >*
> > - * Note: It is the resposibility of the caller to make sure
> > + * Note: It is the responsibility of the caller to make sure
> >* arguments are checked before methods of this class are
> >* called. While some rudimentary checks are performed on the input,
> >* the checks are best effort and when performance is an overriding
> > @@ -425,7 +425,7 @@
> >   /**
> >* Create an exception reflecting that some of the input was
> invalid
> >*
> > - * Note: It is the resposibility of the caller to make
> > + * Note: It is the responsibility of the caller to make
> >* sure arguments are checked before the methods are called. While
> >* some rudimentary checks are performed on the input, the checks
> >* are best effort and when performance is an overriding priority,
> > @@ -601,7 +601,7 @@
> >* aligned for all value types.  Dispose of this memory by calling
> > {@link
> >* #freeMemory}, or resize it with {@link #reallocateMemory}.
> >*
> > - * Note: It is the resposibility of the caller to make
> > + * Note: It is the responsibility of the caller to make
> >* sure arguments are checked before the methods are called. While
> >* some rudimentary checks are performed on the input, the checks
> >* are best effort and when performance is an overriding priority,
> > @@ -657,7 +657,7 @@
> >* #reallocateMemory}.  The address passed to this method may be
> null,
> > in
> >* which case an allocation will be performed.
> >*
> > - * Note: It is the resposibility of the caller to make
> > + * Note: It is the responsibility of the caller to make
> >* sure arguments are checked before the methods are called. While
> >* some rudimentary checks are performed on the input, the checks
> >* are best effort and when performance is an overriding priority,
> > @@ -719,7 +719,7 @@
> >* If the effective address and length are (resp.) even modulo 4
> or 2,
> >* the stores take place in units of 'int' or 'short'.
> >*
> > - * Note: It is the resposibility of the caller to make
> > + * Note: It is the responsibility of the caller to make
> >* sure arguments are checked before the methods are called. While
> >* some rudimentary checks are performed on the input, the checks
> >* are best effort and when performance is an overriding priority,
> > @@ -781,7 +781,7 @@
> >* If the effective addresses and length are (resp.) even modulo 4
> or
> > 2,
> >* the transfer takes place in units of 'int' or 'short'.
> >*
> > - * Note: It is the resposibility of the caller to make
> > + * Note: It is the responsibility of the caller to make
> >* sure arguments are checked before the methods are called. While
> >* some rudimentary checks are performed on the input, the checks
> >* are best effort and when performance is an overriding priority,
> > @@ -842,7 +842,7 @@
> >* as discussed in {@link #getInt(Object,long)}.  When the object
> > reference is null,
> >* the offset supplies an absolute base address.
> >*
> > - * Note: It is the resposibility of the caller to make
> > + * Note: It is the responsibility of the caller to make
> >* sure arguments are checked before the methods are called. While
> >* some rudimentary checks are performed on the input, the checks
> >* are best effort and when performance is an overriding priority,
> > @@ -901,7 +901,7 @@
> >* #allocateMemory} or {@link #reallocateMemory}.  The address
> passed
> > to
> >* this method may be null, in which case no action is taken.
> >*
> > - * Note: It is the resposibility of the caller to make
> > + * Note: It is the responsibility of the caller to make
> >* sure arguments are checked before the methods are called. While
> >* some rudimentary checks are

Re: 8202469 / 8202473: Correct type annotation resolution for class type variables

2020-02-16 Thread Joel Borggrén-Franck
Hi Rafael,

Thanks for reaching out and reminding me of this!

I managed to find some time to look into 8202469 during the weekend. By
swapping place of  the TVars in the test I managed to isolate this without
depending on 8202473, take a look at my hacky copy-paste update to your
test at http://cr.openjdk.java.net/~jfranck/8202469/ .

The comment on lines 269-276 needs to be updated. Perhaps include a table
with the start index depending of the type? Also referencing JVMLS 4.4 for
the structure of the bound might be instructive for future readers.

My current understanding is that there are two problems with the code on
(the original) lines 277-287:
1) Type Variables should have index 0 while getting index 1 due to lines
279-280.
2) Bounds that are instances of ParameterizedType always gets index 1 but
if the first bound represents a Class type the index should be 0.

Does this make sense?

Can you make the if-switches positive? I find my original code with the
negative tests hard to read and the update doesn't help.

Also can you expand the test to cover the different kinds of bounds
mentioned in 4.4 and also test Type Variables on methods, I suspect javac
treats method (and constructor) tvars similarly but there have been bugs ...

TL;DR please update the webrev with:

- Split out test and fix for 8202469
- More test coverage of different kinds of bounds
- Test for method tvars
- See if you can rework the logic to have (mostly) positive tests in if
switch

Thanks again for looking into this, I'll start looking into 8202473, I
think the fix for that one opens up a bigger rework of the code which is
why I want to separate the two.

cheers
/Joel

On Sun, Aug 4, 2019 at 10:12 PM Rafael Winterhalter 
wrote:

> Hi,
>
> appologies for the delay, I only managed to get my patched up to webrev
> today (http://cr.openjdk.java.net/~winterhalter/). It's three patches in
> total now, for the third one I could not add a test case, it would require
> to compile an annotation property against an enumeration type and load it
> against another class where the enumeration was turned into an annotation.
> I struggled a bit with jtreg to make it work but I cannot see myself
> complete this in a meaningful amount of time. However, I hope that the
> patch and the error it solves are straightforward to see.
>
> I only submitted a patch for 8202469. 8202473 is solved by it. It's two
> bugs but they are a symptom of the same oversight.
>
> I hope this helps you to review it but let me know if you have any
> questions or if I should further adjust my patch.
>
> Best regards, Rafael
>
> Am Fr., 2. Aug. 2019 um 12:18 Uhr schrieb Rafael Winterhalter <
> rafael@gmail.com>:
>
>> Thanks Daniel,
>> I did some work on Glassfish a bunch of years ago, I had no idea.
>> I will try to split up the changes (I fixed another bug in annotation
>> processing yesterday) and upload everything there.
>> Best regards, Rafael
>>
>> Am Fr., 2. Aug. 2019 um 11:59 Uhr schrieb Daniel Fuchs <
>> daniel.fu...@oracle.com>:
>>
>>> Hi Rafael,
>>>
>>> On 02/08/2019 09:00, Joel Borggrén-Franck wrote:
>>> > I can host webrevs for you on cr to make it easier for other
>>> reviewers, if
>>> > you also send me the patches or webrefs off-list to get around the
>>> > attachment stripping I can upload them to cr.
>>>
>>> I see that you are a JDK project author, so you already own a page
>>> on cr (http://cr.openjdk.java.net/~winterhalter/) where you can
>>> upload webrevs (e.g. using `scp` as in:
>>> $ scp -r webrev-N.01 winterhal...@cr.openjdk.java.net: )
>>>
>>> best regards and welcome!
>>>
>>> -- daniel
>>>
>>