Re: Code Review Request: 7152007: Fix warnings in sun/rmi/rmic

2012-03-15 Thread Chris Hegarty
The changes look fine, assuming it now passes a non-SKIP_BOOT_CYCLE 
build ;-)


-Chris.

On 15/03/12 01:31, Kurchi Hazra wrote:

Hi,

The warning fixes in sun/rmi/rmic originally pushed as a part of CR
7146763, were undone by 7151348
due to build breakage when SKIP_BOOT_CYCLE is set to false.
This CR attempts to incorporate these warning fixes into jdk8. Most of
the changes have already been code-reviewed [1],
but one line is changed in accordance to Stuart Mark's suggestion[2], so
that the build doesn't break.


Bug: http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=7152007
Webrev: http://cr.openjdk.java.net/~khazra/7152007/webrev.00/


Thanks,
Kurchi

[1]
http://mail.openjdk.java.net/pipermail/core-libs-dev/2012-February/009315.html

[2]
http://mail.openjdk.java.net/pipermail/core-libs-dev/2012-March/009481.html


Re: Request for review : 7121314 : Behavior mismatch between AbstractCollection.toArray(T[] ) and its spec

2012-03-15 Thread Ulf Zibis

Thanks for your comments too.

Am 14.03.2012 05:23, schrieb Sean Chou:

Thanks for your comments, I have different opinions.

About performance, I would like to say this part of code is not in a path which causes 
performance problem. In fact it should rarely execute, so there is no need to catch this little 
optimization, and readability is more important.
Yes, I agree, but my 2nd motivation was to reduce the bytecode footprint a little, especially for 
such rarely executed code.


With the if statement, it reads put a null after the elements if there are more space, while 
with your code, it reads copy all the elements from r or copy all elements and 1 more from r if 
there are more space and we have to think what's the next element in r ? . In fact, we need 
look back to find how r is defined T[] r = a.length = size ? a 
: (T[])java.lang.reflect.Array.newInstance(a.getClass().getComponentType(), size); and go through 
the code once more to realize there is a null at that position.

Yes, a better comment would be necessary.



And with JIT, will a.length and i be dereference/push/pop so many times or is it kept in cache or 
in a register ? I believe it is better to forget the little possible enhancement here, which is 
also encouraged by java. I'm sorry the page of bug 7153238 
http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=7153238  says not available to me.
Please wait 1 more day, then the content should become publicly visible. I'm waiting too, as I have 
an additional comment in queue to correct a little error.



About the testcase, variable map and map2 are of different types, can not be 
reused.

Oops, yes.
But you could reuse it (like Object[] res) with:
MapString,Object map = new TConcurrentHashMap(); // better: TCHM1
...
map = new TConcurrentHashMap2();
I agree, a little nit, but I had the other missing test cases in mind, where the numbering then 
could become confusing.


I would not like to add // inherits from AbstractCollection.toArray() , it is obvious and listed 
in java doc.

In ConcurrentHashMap.values:
Overrides: values in class AbstractMapK,V
In AbstractMap.values:
This implementation returns a collection that subclasses AbstractCollection.
But there is no guarantee, that the returned collection overrides or just delegates to 
AbstractCollection.toArray().

In worst case, t.j.u.AC.ToArray doesn't test j.u. AbstractCollection.toArray() 
at all.

About // simulate concurrent decrease of map's elements, it is not enough to describe clearly 
why it can do that. People have to refer to the bug for more knowledge. So in my opinion, it 
changes nothing. However, I can add it if you have a strong request.

IMO would be a help for people, later reviewing the test case.


And about the cases the testcase doesn't cover.
 if (a == r)
   if (a.length  i)
   it.hasNext() ? finishToArray(r, it) : r  (neither yes nor no)

This testcase is designed to check if the returned array is the given array. In the above 2 cases, 
there is no need to do the check.
if (a == r), of cause it is;  if (a.length  i), of cause it is not. This 2 cases will fail due to 
more serious bug, not 7121314 .
My complain was in assumption, that a test, named t.j.u.AC.ToArray, should test the whole complexity 
of method toArray(), not just concerning a single bug.


-Ulf





On Wed, Mar 14, 2012 at 7:36 AM, Ulf Zibis ulf.zi...@gmx.de 
mailto:ulf.zi...@gmx.de wrote:

Am 13.03.2012 07:58, schrieb Sean Chou:

Hi Ulf and David,

   I modified the patch and added the testcase, it's now :
http://cr.openjdk.java.net/~zhouyx/7121314/webrev.02/
http://cr.openjdk.java.net/%7Ezhouyx/7121314/webrev.02/
http://cr.openjdk.java.net/%7Ezhouyx/7121314/webrev.02/.


   Ulf's compact version is used, it looks beautiful;

Thanks!


however I replaced the Math.min part with if statement because if 
statement is more
intuitive and I don't think there is any performance concern. But it is 
not so compact now...

My performance thoughts:
Your version:
   } else if (a.length  i) {   // dereferences a.length
   ...
   } else {
   // push original i to stack
   System.arraycopy(r, 0, a, 0, i);   // references array elements, 
uses some CPU registers
   if (a.length  i) {   // dereferences a.length again, pop i from 
stack
   a[i] = null;   // null-termination  // references array elements 
again

better:
   } else if (a.length  i) {   // dereferences a.length
   ...
   } else {
   if (a.length  i) {   // reuses a.length result + i from above
   i++;   // ensure null-termination  // cheap operation
   System.arraycopy(r, 0, a, 0, i);   // references array elements, 
original i must not be
remembered

compact:
   } else if (a.length  i) {
   ...
   } else {
   System.arraycopy(r, 0, a, 0, a.length  i ? ++i : i); // ensure 

hg: jdk8/tl/jdk: 2 new changesets

2012-03-15 Thread michael . x . mcmahon
Changeset: ac5024504439
Author:michaelm
Date:  2012-03-15 16:45 +
URL:   http://hg.openjdk.java.net/jdk8/tl/jdk/rev/ac5024504439

7151898: Check for LANG in Mac OS X jdk build sanity check [macosx]
Reviewed-by: ohair, smarks

! make/common/shared/Sanity.gmk

Changeset: cfe2328912b3
Author:michaelm
Date:  2012-03-15 16:46 +
URL:   http://hg.openjdk.java.net/jdk8/tl/jdk/rev/cfe2328912b3

Merge

- test/java/io/File/isDirectory/Applet.html
- test/sun/nio/cs/OLD/TestX11CS.java



hg: jdk8/tl/jdk: 7045655: An empty InMemoryCookieStore should not return true for removeAll

2012-03-15 Thread kurchi . subhra . hazra
Changeset: 3bfebedb549f
Author:khazra
Date:  2012-03-15 13:21 -0700
URL:   http://hg.openjdk.java.net/jdk8/tl/jdk/rev/3bfebedb549f

7045655: An empty InMemoryCookieStore should not return true for removeAll
Summary: CookieStore.removeAll() should return false for an empty CookieStore
Reviewed-by: chegar

! src/share/classes/java/net/InMemoryCookieStore.java
! test/java/net/CookieHandler/NullUriCookieTest.java



hg: jdk8/tl/jdk: 2 new changesets

2012-03-15 Thread valerie . peng
Changeset: bdbc32b2f920
Author:valeriep
Date:  2012-03-15 14:28 -0700
URL:   http://hg.openjdk.java.net/jdk8/tl/jdk/rev/bdbc32b2f920

7130959: Tweak 7058133 fix for JDK 8 (javah makefile changes)
Summary: Fixed JAVAHFLAGS setting to use -bootclasspath.
Reviewed-by: wetmore

! make/sun/security/ec/Makefile
! make/sun/security/mscapi/Makefile
! make/sun/security/pkcs11/Makefile

Changeset: e48136bb8fdd
Author:valeriep
Date:  2012-03-15 14:40 -0700
URL:   http://hg.openjdk.java.net/jdk8/tl/jdk/rev/e48136bb8fdd

Merge




Re: Code Review Request: 7152007: Fix warnings in sun/rmi/rmic

2012-03-15 Thread Stuart Marks
Changes look good. I'm told that the build indeed doesn't break, so that's good 
too!


s'marks

On 3/15/12 3:02 AM, Chris Hegarty wrote:

The changes look fine, assuming it now passes a non-SKIP_BOOT_CYCLE build ;-)

-Chris.

On 15/03/12 01:31, Kurchi Hazra wrote:

Hi,

The warning fixes in sun/rmi/rmic originally pushed as a part of CR
7146763, were undone by 7151348
due to build breakage when SKIP_BOOT_CYCLE is set to false.
This CR attempts to incorporate these warning fixes into jdk8. Most of
the changes have already been code-reviewed [1],
but one line is changed in accordance to Stuart Mark's suggestion[2], so
that the build doesn't break.


Bug: http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=7152007
Webrev: http://cr.openjdk.java.net/~khazra/7152007/webrev.00/


Thanks,
Kurchi

[1]
http://mail.openjdk.java.net/pipermail/core-libs-dev/2012-February/009315.html

[2]
http://mail.openjdk.java.net/pipermail/core-libs-dev/2012-March/009481.html


hg: jdk8/tl/jdk: 7153343: Dependency on non-POSIX header file link.h causes portability problem

2012-03-15 Thread littlee
Changeset: c4e66dc3222d
Author:littlee
Date:  2012-03-16 10:47 +0800
URL:   http://hg.openjdk.java.net/jdk8/tl/jdk/rev/c4e66dc3222d

7153343: Dependency on non-POSIX header file link.h causes portability problem
Summary: Remove the unneccessary link.h
Reviewed-by: alanb, chegar
Contributed-by: Jonathan Lu luc...@linux.vnet.ibm.com

! src/solaris/native/sun/nio/fs/GnomeFileTypeDetector.c
! src/solaris/native/sun/security/jgss/wrapper/NativeFunc.c
! src/solaris/native/sun/security/pkcs11/j2secmod_md.c
! src/solaris/native/sun/security/pkcs11/wrapper/p11_md.c
! src/solaris/native/sun/security/smartcardio/pcsc_md.c
! src/solaris/npt/npt_md.h