From 05ffd97b08d99ab516321cfc20e7e69e667e5e7d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Forax?= Date: Wed, 2 May 2012 20:01:59 +0100 Subject: [PATCH 001/128] 7165102: Only run assertion on Integer autoboxing cache size once Reviewed-by: darcy, alanb --- jdk/src/share/classes/java/lang/Integer.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/jdk/src/share/classes/java/lang/Integer.java b/jdk/src/share/classes/java/lang/Integer.java index 88acdfa11da..c33e90a5e49 100644 --- a/jdk/src/share/classes/java/lang/Integer.java +++ b/jdk/src/share/classes/java/lang/Integer.java @@ -780,6 +780,9 @@ public final class Integer extends Number implements Comparable { int j = low; for(int k = 0; k < cache.length; k++) cache[k] = new Integer(j++); + + // range [-128, 127] must be interned (JLS7 5.1.7) + assert IntegerCache.high >= 127; } private IntegerCache() {} @@ -801,7 +804,6 @@ public final class Integer extends Number implements Comparable { * @since 1.5 */ public static Integer valueOf(int i) { - assert IntegerCache.high >= 127; if (i >= IntegerCache.low && i <= IntegerCache.high) return IntegerCache.cache[i + (-IntegerCache.low)]; return new Integer(i); From b4c2c567d6c0a6e6cd02a03ea6c16cd7f148dc21 Mon Sep 17 00:00:00 2001 From: Jim Gish Date: Wed, 2 May 2012 21:46:31 +0100 Subject: [PATCH 002/128] 7160714: Strange or obsolete @see tags in some exception java.util javadoc Reviewed-by: mduigou, dholmes, alanb --- .../share/classes/java/util/NoSuchElementException.java | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/jdk/src/share/classes/java/util/NoSuchElementException.java b/jdk/src/share/classes/java/util/NoSuchElementException.java index 88ff2c079a4..15e1aad98c2 100644 --- a/jdk/src/share/classes/java/util/NoSuchElementException.java +++ b/jdk/src/share/classes/java/util/NoSuchElementException.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1994, 2008, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1994, 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 @@ -26,13 +26,12 @@ package java.util; /** - * Thrown by the nextElement method of an - * Enumeration to indicate that there are no more - * elements in the enumeration. + * Thrown by various accessor methods to indicate that the element being requested + * does not exist. * * @author unascribed - * @see java.util.Enumeration * @see java.util.Enumeration#nextElement() + * @see java.util.Iterator#next() * @since JDK1.0 */ public From 0705c620501d77c799d85433fdfd46719fa96f63 Mon Sep 17 00:00:00 2001 From: Sergey Bylokhov Date: Thu, 3 May 2012 18:29:00 +0400 Subject: [PATCH 003/128] 7160623: [macosx] Editable TextArea/TextField are blocking GUI applications from exit Reviewed-by: anthony, art --- .../macosx/classes/sun/lwawt/LWComponentPeer.java | 2 +- .../classes/sun/lwawt/LWTextComponentPeer.java | 12 ++++++++++++ 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/jdk/src/macosx/classes/sun/lwawt/LWComponentPeer.java b/jdk/src/macosx/classes/sun/lwawt/LWComponentPeer.java index a7b15e07c96..0b8b290f082 100644 --- a/jdk/src/macosx/classes/sun/lwawt/LWComponentPeer.java +++ b/jdk/src/macosx/classes/sun/lwawt/LWComponentPeer.java @@ -372,7 +372,7 @@ public abstract class LWComponentPeer } @Override - public void dispose() { + public final void dispose() { if (disposed.compareAndSet(false, true)) { disposeImpl(); } diff --git a/jdk/src/macosx/classes/sun/lwawt/LWTextComponentPeer.java b/jdk/src/macosx/classes/sun/lwawt/LWTextComponentPeer.java index 5884b119261..01de62b6c96 100644 --- a/jdk/src/macosx/classes/sun/lwawt/LWTextComponentPeer.java +++ b/jdk/src/macosx/classes/sun/lwawt/LWTextComponentPeer.java @@ -81,6 +81,18 @@ abstract class LWTextComponentPeer Date: Thu, 3 May 2012 19:22:38 +0400 Subject: [PATCH 004/128] 7124376: [macosx] Modal dialog lost focus Reviewed-by: anthony --- .../classes/sun/lwawt/LWWindowPeer.java | 2 + .../classes/sun/lwawt/PlatformWindow.java | 2 + .../lwawt/macosx/CPlatformEmbeddedFrame.java | 3 + .../sun/lwawt/macosx/CPlatformWindow.java | 10 +++ jdk/src/macosx/native/sun/awt/AWTView.m | 19 ++-- jdk/src/macosx/native/sun/awt/AWTWindow.h | 2 + jdk/src/macosx/native/sun/awt/AWTWindow.m | 86 +++++++++++++------ 7 files changed, 94 insertions(+), 30 deletions(-) diff --git a/jdk/src/macosx/classes/sun/lwawt/LWWindowPeer.java b/jdk/src/macosx/classes/sun/lwawt/LWWindowPeer.java index 9e3796c7083..82d97c01aaa 100644 --- a/jdk/src/macosx/classes/sun/lwawt/LWWindowPeer.java +++ b/jdk/src/macosx/classes/sun/lwawt/LWWindowPeer.java @@ -409,6 +409,8 @@ public class LWWindowPeer synchronized (getPeerTreeLock()) { this.blocker = blocked ? (LWWindowPeer)blocker.getPeer() : null; } + + platformWindow.setModalBlocked(blocked); } @Override diff --git a/jdk/src/macosx/classes/sun/lwawt/PlatformWindow.java b/jdk/src/macosx/classes/sun/lwawt/PlatformWindow.java index 0d2a8083752..378dcab0329 100644 --- a/jdk/src/macosx/classes/sun/lwawt/PlatformWindow.java +++ b/jdk/src/macosx/classes/sun/lwawt/PlatformWindow.java @@ -108,6 +108,8 @@ public interface PlatformWindow { public void flip(int x1, int y1, int x2, int y2, BufferCapabilities.FlipContents flipAction); + public void setModalBlocked(boolean blocked); + public void toFront(); public void toBack(); diff --git a/jdk/src/macosx/classes/sun/lwawt/macosx/CPlatformEmbeddedFrame.java b/jdk/src/macosx/classes/sun/lwawt/macosx/CPlatformEmbeddedFrame.java index c355445ac83..cf9c455aba8 100644 --- a/jdk/src/macosx/classes/sun/lwawt/macosx/CPlatformEmbeddedFrame.java +++ b/jdk/src/macosx/classes/sun/lwawt/macosx/CPlatformEmbeddedFrame.java @@ -205,4 +205,7 @@ public class CPlatformEmbeddedFrame implements PlatformWindow { @Override public void setWindowState(int windowState) {} + + @Override + public void setModalBlocked(boolean blocked) {} } diff --git a/jdk/src/macosx/classes/sun/lwawt/macosx/CPlatformWindow.java b/jdk/src/macosx/classes/sun/lwawt/macosx/CPlatformWindow.java index 9f8c8f545d0..bfaab65d196 100644 --- a/jdk/src/macosx/classes/sun/lwawt/macosx/CPlatformWindow.java +++ b/jdk/src/macosx/classes/sun/lwawt/macosx/CPlatformWindow.java @@ -61,6 +61,7 @@ public class CPlatformWindow extends CFRetainedResource implements PlatformWindo private static native void nativeSetNSWindowMinimizedIcon(long nsWindowPtr, long nsImage); private static native void nativeSetNSWindowRepresentedFilename(long nsWindowPtr, String representedFilename); private static native void nativeSetNSWindowSecurityWarningPositioning(long nsWindowPtr, double x, double y, float biasX, float biasY); + private static native void nativeSetEnabled(long nsWindowPtr, boolean isEnabled); private static native void nativeSynthesizeMouseEnteredExitedEvents(long nsWindowPtr); private static native int nativeGetScreenNSWindowIsOn_AppKitThread(long nsWindowPtr); @@ -800,6 +801,15 @@ public class CPlatformWindow extends CFRetainedResource implements PlatformWindo // value when the native notification comes to us } + @Override + public void setModalBlocked(boolean blocked) { + if (target.getModalExclusionType() == Dialog.ModalExclusionType.APPLICATION_EXCLUDE) { + return; + } + + nativeSetEnabled(getNSWindowPtr(), !blocked); + } + // ---------------------------------------------------------------------- // UTILITY METHODS // ---------------------------------------------------------------------- diff --git a/jdk/src/macosx/native/sun/awt/AWTView.m b/jdk/src/macosx/native/sun/awt/AWTView.m index 896d05c4c72..4f3bae7933a 100644 --- a/jdk/src/macosx/native/sun/awt/AWTView.m +++ b/jdk/src/macosx/native/sun/awt/AWTView.m @@ -81,7 +81,7 @@ AWT_ASSERT_APPKIT_THREAD; fEnablePressAndHold = shouldUsePressAndHold(); fInPressAndHold = NO; fPAHNeedsToSelect = NO; - + mouseIsOver = NO; if (windowLayer != nil) { @@ -302,16 +302,25 @@ AWT_ASSERT_APPKIT_THREAD; */ -(void) deliverJavaMouseEvent: (NSEvent *) event { - - NSEventType type = [event type]; - + BOOL isEnabled = YES; + NSWindow* window = [self window]; + if ([window isKindOfClass: [AWTWindow class]]) { + isEnabled = [(AWTWindow*)window isEnabled]; + } + + if (!isEnabled) { + return; + } + + NSEventType type = [event type]; + // check synthesized mouse entered/exited events if ((type == NSMouseEntered && mouseIsOver) || (type == NSMouseExited && !mouseIsOver)) { return; }else if ((type == NSMouseEntered && !mouseIsOver) || (type == NSMouseExited && mouseIsOver)) { mouseIsOver = !mouseIsOver; } - + [AWTToolkit eventCountPlusPlus]; JNIEnv *env = [ThreadUtilities getJNIEnv]; diff --git a/jdk/src/macosx/native/sun/awt/AWTWindow.h b/jdk/src/macosx/native/sun/awt/AWTWindow.h index 58280927fbf..39863eef09e 100644 --- a/jdk/src/macosx/native/sun/awt/AWTWindow.h +++ b/jdk/src/macosx/native/sun/awt/AWTWindow.h @@ -42,6 +42,7 @@ NSSize javaMinSize; NSSize javaMaxSize; jint styleBits; + BOOL isEnabled; } @property (nonatomic, retain) JNFWeakJObjectWrapper *javaPlatformWindow; @@ -49,6 +50,7 @@ @property (nonatomic) NSSize javaMinSize; @property (nonatomic) NSSize javaMaxSize; @property (nonatomic) jint styleBits; +@property (nonatomic) BOOL isEnabled; - (id) initWithPlatformWindow:(JNFWeakJObjectWrapper *)javaPlatformWindow styleBits:(jint)styleBits diff --git a/jdk/src/macosx/native/sun/awt/AWTWindow.m b/jdk/src/macosx/native/sun/awt/AWTWindow.m index 7add839f8e6..3fcf9f0cd65 100644 --- a/jdk/src/macosx/native/sun/awt/AWTWindow.m +++ b/jdk/src/macosx/native/sun/awt/AWTWindow.m @@ -58,6 +58,7 @@ static JNF_CLASS_CACHE(jc_CPlatformWindow, "sun/lwawt/macosx/CPlatformWindow"); @synthesize javaMinSize; @synthesize javaMaxSize; @synthesize styleBits; +@synthesize isEnabled; - (void) updateMinMaxSize:(BOOL)resizable { if (resizable) { @@ -157,6 +158,7 @@ AWT_ASSERT_APPKIT_THREAD; if (self == nil) return nil; // no hope + self.isEnabled = YES; self.javaPlatformWindow = platformWindow; self.styleBits = bits; [self setPropertiesForStyleBits:styleBits mask:MASK(_METHOD_PROP_BITMASK)]; @@ -170,22 +172,22 @@ AWT_ASSERT_APPKIT_THREAD; return self; } -// checks that this window is under the mouse cursor and this point is not overlapped by others windows +// checks that this window is under the mouse cursor and this point is not overlapped by others windows - (BOOL) isTopmostWindowUnderMouse { - - int currentWinID = [self windowNumber]; - - NSRect screenRect = [[NSScreen mainScreen] frame]; + + int currentWinID = [self windowNumber]; + + NSRect screenRect = [[NSScreen mainScreen] frame]; NSPoint nsMouseLocation = [NSEvent mouseLocation]; - CGPoint cgMouseLocation = CGPointMake(nsMouseLocation.x, screenRect.size.height - nsMouseLocation.y); - + CGPoint cgMouseLocation = CGPointMake(nsMouseLocation.x, screenRect.size.height - nsMouseLocation.y); + NSMutableArray *windows = (NSMutableArray *)CGWindowListCopyWindowInfo(kCGWindowListOptionOnScreenOnly | kCGWindowListExcludeDesktopElements, kCGNullWindowID); - - + + for (NSDictionary *window in windows) { int layer = [[window objectForKey:(id)kCGWindowLayer] intValue]; if (layer == 0) { - int winID = [[window objectForKey:(id)kCGWindowNumber] intValue]; + int winID = [[window objectForKey:(id)kCGWindowNumber] intValue]; CGRect rect; CGRectMakeWithDictionaryRepresentation((CFDictionaryRef)[window objectForKey:(id)kCGWindowBounds], &rect); if (CGRectContainsPoint(rect, cgMouseLocation)) { @@ -199,23 +201,23 @@ AWT_ASSERT_APPKIT_THREAD; } - (void) synthesizeMouseEnteredExitedEvents { - + int eventType = 0; BOOL isUnderMouse = [self isTopmostWindowUnderMouse]; BOOL mouseIsOver = [[self contentView] mouseIsOver]; - + if (isUnderMouse && !mouseIsOver) { eventType = NSMouseEntered; } else if (!isUnderMouse && mouseIsOver) { - eventType = NSMouseExited; + eventType = NSMouseExited; } else { return; } - - NSPoint screenLocation = [NSEvent mouseLocation]; - NSPoint windowLocation = [self convertScreenToBase: screenLocation]; + + NSPoint screenLocation = [NSEvent mouseLocation]; + NSPoint windowLocation = [self convertScreenToBase: screenLocation]; int modifierFlags = (eventType == NSMouseEntered) ? NSMouseEnteredMask : NSMouseExitedMask; - + NSEvent *mouseEvent = [NSEvent enterExitEventWithType: eventType location: windowLocation modifierFlags: modifierFlags @@ -226,7 +228,7 @@ AWT_ASSERT_APPKIT_THREAD; trackingNumber: 0 userData: nil ]; - + [[self contentView] deliverJavaMouseEvent: mouseEvent]; } @@ -239,16 +241,15 @@ AWT_ASSERT_APPKIT_THREAD; [super dealloc]; } - // NSWindow overrides - (BOOL) canBecomeKeyWindow { AWT_ASSERT_APPKIT_THREAD; - return IS(self.styleBits, SHOULD_BECOME_KEY); + return self.isEnabled && IS(self.styleBits, SHOULD_BECOME_KEY); } - (BOOL) canBecomeMainWindow { AWT_ASSERT_APPKIT_THREAD; - return IS(self.styleBits, SHOULD_BECOME_MAIN); + return self.isEnabled && IS(self.styleBits, SHOULD_BECOME_MAIN); } - (BOOL) worksWhenModal { @@ -562,6 +563,27 @@ AWT_ASSERT_APPKIT_THREAD; size->height = MAX(size->height, minHeight); } +- (void) setEnabled: (BOOL)flag { + self.isEnabled = flag; + + if (IS(self.styleBits, CLOSEABLE)) { + [[self standardWindowButton:NSWindowCloseButton] setEnabled: flag]; + } + + if (IS(self.styleBits, MINIMIZABLE)) { + [[self standardWindowButton:NSWindowMiniaturizeButton] setEnabled: flag]; + } + + if (IS(self.styleBits, ZOOMABLE)) { + [[self standardWindowButton:NSWindowZoomButton] setEnabled: flag]; + } + + if (IS(self.styleBits, RESIZABLE)) { + [self updateMinMaxSize:flag]; + [self setShowsResizeIndicator:flag]; + } +} + @end // AWTWindow @@ -729,7 +751,7 @@ AWT_ASSERT_NOT_APPKIT_THREAD; // ensure we repaint the whole window after the resize operation // (this will also re-enable screen updates, which were disabled above) // TODO: send PaintEvent - + [window synthesizeMouseEnteredExitedEvents]; }]; @@ -969,14 +991,14 @@ JNIEXPORT void JNICALL Java_sun_lwawt_macosx_CPlatformWindow_nativeSynthesizeMou { JNF_COCOA_ENTER(env); AWT_ASSERT_NOT_APPKIT_THREAD; - + AWTWindow *window = OBJC(windowPtr); [JNFRunLoop performOnMainThreadWaiting:NO withBlock:^(){ AWT_ASSERT_APPKIT_THREAD; - + [window synthesizeMouseEnteredExitedEvents]; }]; - + JNF_COCOA_EXIT(env); } @@ -1056,3 +1078,17 @@ JNF_COCOA_EXIT(env); return underMouse; } + +JNIEXPORT void JNICALL Java_sun_lwawt_macosx_CPlatformWindow_nativeSetEnabled +(JNIEnv *env, jclass clazz, jlong windowPtr, jboolean isEnabled) +{ +JNF_COCOA_ENTER(env); + + AWTWindow *window = OBJC(windowPtr); + [JNFRunLoop performOnMainThreadWaiting:NO withBlock:^(){ + [window setEnabled: isEnabled]; + }]; + +JNF_COCOA_EXIT(env); +} + From e3ab8ba856ce51b61f34e8cd8d892061a8d2f2c3 Mon Sep 17 00:00:00 2001 From: Alexander Zuev Date: Thu, 3 May 2012 21:54:29 +0400 Subject: [PATCH 005/128] 7148289: [macosx] Deadlock in sun.lwawt.macosx.CWrapper$NSScreen.visibleFrame Reviewed-by: leonidr --- .../macosx/CToolkitThreadBlockedHandler.java | 7 ++-- .../classes/sun/lwawt/macosx/LWCToolkit.java | 4 +++ jdk/src/macosx/native/sun/awt/LWCToolkit.m | 34 +++++++++++++++++++ 3 files changed, 42 insertions(+), 3 deletions(-) diff --git a/jdk/src/macosx/classes/sun/lwawt/macosx/CToolkitThreadBlockedHandler.java b/jdk/src/macosx/classes/sun/lwawt/macosx/CToolkitThreadBlockedHandler.java index 2d36a914122..95d15a8feaa 100644 --- a/jdk/src/macosx/classes/sun/lwawt/macosx/CToolkitThreadBlockedHandler.java +++ b/jdk/src/macosx/classes/sun/lwawt/macosx/CToolkitThreadBlockedHandler.java @@ -27,9 +27,9 @@ package sun.lwawt.macosx; import sun.awt.datatransfer.ToolkitThreadBlockedHandler; -// TODO:BG this class is really a NOOP right now, but should be filled in if needed. - final class CToolkitThreadBlockedHandler implements ToolkitThreadBlockedHandler { + private final LWCToolkit toolkit = (LWCToolkit)java.awt.Toolkit.getDefaultToolkit(); + public void lock() { } @@ -41,9 +41,10 @@ final class CToolkitThreadBlockedHandler implements ToolkitThreadBlockedHandler } public void enter() { + toolkit.startNativeNestedEventLoop(); } public void exit() { + toolkit.stopNativeNestedEventLoop(); } - } diff --git a/jdk/src/macosx/classes/sun/lwawt/macosx/LWCToolkit.java b/jdk/src/macosx/classes/sun/lwawt/macosx/LWCToolkit.java index 05c4ceeaec8..fa13d0ef675 100644 --- a/jdk/src/macosx/classes/sun/lwawt/macosx/LWCToolkit.java +++ b/jdk/src/macosx/classes/sun/lwawt/macosx/LWCToolkit.java @@ -63,6 +63,10 @@ public class LWCToolkit extends LWToolkit { private static native void initIDs(); + static native void startNativeNestedEventLoop(); + + static native void stopNativeNestedEventLoop(); + private static CInputMethodDescriptor sInputMethodDescriptor; static { diff --git a/jdk/src/macosx/native/sun/awt/LWCToolkit.m b/jdk/src/macosx/native/sun/awt/LWCToolkit.m index 8a95cd38d3d..173154a151c 100644 --- a/jdk/src/macosx/native/sun/awt/LWCToolkit.m +++ b/jdk/src/macosx/native/sun/awt/LWCToolkit.m @@ -42,6 +42,7 @@ jint* gButtonDownMasks; @implementation AWTToolkit static long eventCount; +static bool shouldKeepRunningNestedLoop = NO; + (long) getEventCount{ return eventCount; @@ -456,3 +457,36 @@ Java_sun_font_FontManager_populateFontFileNameMap { } + +/* + * Class: sun_lwawt_macosx_LWCToolkit + * Method: startNativeNestedEventLoop + * Signature: ()V + */ +JNIEXPORT void JNICALL Java_sun_lwawt_macosx_LWCToolkit_startNativeNestedEventLoop +(JNIEnv *env, jclass cls) +{ + if(!shouldKeepRunningNestedLoop) { + NSRunLoop *theRL = [NSRunLoop currentRunLoop]; + NSApplication * app = [NSApplication sharedApplication]; + shouldKeepRunningNestedLoop = YES; + while (shouldKeepRunningNestedLoop && [theRL runMode:NSDefaultRunLoopMode beforeDate:[NSDate distantFuture]]) + { + NSEvent * event = [app nextEventMatchingMask: 0xFFFFFFFF untilDate:nil inMode:NSDefaultRunLoopMode dequeue:YES]; + if (event != nil) { + [app sendEvent: event]; + } + } + } +} + +/* + * Class: sun_lwawt_macosx_LWCToolkit + * Method: stopNativeNestedEventLoop + * Signature: ()V + */ +JNIEXPORT void JNICALL Java_sun_lwawt_macosx_LWCToolkit_stopNativeNestedEventLoop +(JNIEnv *env, jclass cls) +{ + shouldKeepRunningNestedLoop = NO; +} From 045ba7db6b247b4e9e639709851a3ca121c294a9 Mon Sep 17 00:00:00 2001 From: Alexander Scherbatiy Date: Fri, 4 May 2012 13:15:49 +0400 Subject: [PATCH 006/128] 7024963: Notepad demo: remove non-translatable resources from Notepad.properties file Reviewed-by: rupashka --- jdk/src/share/demo/jfc/Notepad/Notepad.java | 250 ++++++------------ .../jfc/Notepad/resources/Notepad.properties | 30 --- .../jfc/Notepad/resources/system.properties | 12 + 3 files changed, 92 insertions(+), 200 deletions(-) create mode 100644 jdk/src/share/demo/jfc/Notepad/resources/system.properties diff --git a/jdk/src/share/demo/jfc/Notepad/Notepad.java b/jdk/src/share/demo/jfc/Notepad/Notepad.java index c80966920fb..d023dee7990 100644 --- a/jdk/src/share/demo/jfc/Notepad/Notepad.java +++ b/jdk/src/share/demo/jfc/Notepad/Notepad.java @@ -39,71 +39,18 @@ -import java.awt.BorderLayout; -import java.awt.Color; -import java.awt.Component; -import java.awt.Container; -import java.awt.FileDialog; -import java.awt.Font; -import java.awt.Frame; -import java.awt.Graphics; -import java.awt.Insets; -import java.awt.event.ActionEvent; -import java.awt.event.WindowAdapter; -import java.awt.event.WindowEvent; -import java.beans.PropertyChangeEvent; -import java.beans.PropertyChangeListener; -import java.io.File; -import java.io.FileReader; -import java.io.FileWriter; -import java.io.IOException; -import java.io.Reader; -import java.io.Writer; -import java.net.URL; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Locale; -import java.util.Map; -import java.util.MissingResourceException; -import java.util.ResourceBundle; -import java.util.StringTokenizer; -import java.util.logging.Level; -import java.util.logging.Logger; -import javax.swing.AbstractAction; -import javax.swing.Action; -import javax.swing.BorderFactory; -import javax.swing.Box; -import javax.swing.BoxLayout; -import javax.swing.ImageIcon; -import javax.swing.JButton; -import javax.swing.JComponent; -import javax.swing.JFileChooser; -import javax.swing.JFrame; -import javax.swing.JMenu; -import javax.swing.JMenuBar; -import javax.swing.JMenuItem; -import javax.swing.JOptionPane; -import javax.swing.JPanel; -import javax.swing.JProgressBar; -import javax.swing.JScrollPane; -import javax.swing.JTextArea; -import javax.swing.JToolBar; -import javax.swing.JViewport; -import javax.swing.SwingUtilities; -import javax.swing.UIManager; +import java.awt.*; +import java.awt.event.*; +import java.beans.*; +import java.io.*; +import java.net.*; +import java.util.*; +import java.util.logging.*; +import javax.swing.*; +import javax.swing.undo.*; +import javax.swing.text.*; +import javax.swing.event.*; import javax.swing.UIManager.LookAndFeelInfo; -import javax.swing.event.UndoableEditEvent; -import javax.swing.event.UndoableEditListener; -import javax.swing.text.BadLocationException; -import javax.swing.text.Document; -import javax.swing.text.JTextComponent; -import javax.swing.text.PlainDocument; -import javax.swing.text.Segment; -import javax.swing.text.TextAction; -import javax.swing.undo.CannotRedoException; -import javax.swing.undo.CannotUndoException; -import javax.swing.undo.UndoManager; /** @@ -115,16 +62,27 @@ import javax.swing.undo.UndoManager; @SuppressWarnings("serial") class Notepad extends JPanel { + private static Properties properties; private static ResourceBundle resources; private final static String EXIT_AFTER_PAINT = "-exit"; private static boolean exitAfterFirstPaint; + private static final String[] MENUBAR_KEYS = {"file", "edit", "debug"}; + private static final String[] TOOLBAR_KEYS = {"new", "open", "save", "-", "cut", "copy", "paste"}; + private static final String[] FILE_KEYS = {"new", "open", "save", "-", "exit"}; + private static final String[] EDIT_KEYS = {"cut", "copy", "paste", "-", "undo", "redo"}; + private static final String[] DEBUG_KEYS = {"dump", "showElementTree"}; + static { try { + properties = new Properties(); + properties.load(Notepad.class.getResourceAsStream( + "resources/system.properties")); resources = ResourceBundle.getBundle("resources.Notepad", Locale.getDefault()); - } catch (MissingResourceException mre) { - System.err.println("resources/Notepad.properties not found"); + } catch (MissingResourceException | IOException e) { + System.err.println("resources/Notepad.properties " + + "or resources/system.properties not found"); System.exit(1); } } @@ -163,26 +121,22 @@ class Notepad extends JPanel { // install the command table commands = new HashMap(); Action[] actions = getActions(); - for (int i = 0; i < actions.length; i++) { - Action a = actions[i]; - //commands.put(a.getText(Action.NAME), a); + for (Action a : actions) { commands.put(a.getValue(Action.NAME), a); } JScrollPane scroller = new JScrollPane(); JViewport port = scroller.getViewport(); port.add(editor); - try { - String vpFlag = resources.getString("ViewportBackingStore"); + + String vpFlag = getProperty("ViewportBackingStore"); + if (vpFlag != null) { Boolean bs = Boolean.valueOf(vpFlag); - port.setScrollMode(bs.booleanValue() + port.setScrollMode(bs ? JViewport.BACKINGSTORE_SCROLL_MODE : JViewport.BLIT_SCROLL_MODE); - } catch (MissingResourceException ignored) { - // just use the viewport default } - menuItems = new HashMap(); JPanel panel = new JPanel(); panel.setLayout(new BorderLayout()); panel.add("North", createToolbar()); @@ -191,31 +145,26 @@ class Notepad extends JPanel { add("South", createStatusbar()); } - public static void main(String[] args) { - try { - if (args.length > 0 && args[0].equals(EXIT_AFTER_PAINT)) { - exitAfterFirstPaint = true; - } - SwingUtilities.invokeAndWait(new Runnable() { - - public void run() { - JFrame frame = new JFrame(); - frame.setTitle(resources.getString("Title")); - frame.setBackground(Color.lightGray); - frame.getContentPane().setLayout(new BorderLayout()); - Notepad notepad = new Notepad(); - frame.getContentPane().add("Center", notepad); - frame.setJMenuBar(notepad.createMenubar()); - frame.addWindowListener(new AppCloser()); - frame.pack(); - frame.setSize(500, 600); - frame.setVisible(true); - } - }); - } catch (Throwable t) { - Logger.getLogger(Notepad.class.getName()).log(Level.SEVERE, - "uncaught exception", t); + public static void main(String[] args) throws Exception { + if (args.length > 0 && args[0].equals(EXIT_AFTER_PAINT)) { + exitAfterFirstPaint = true; } + SwingUtilities.invokeAndWait(new Runnable() { + + public void run() { + JFrame frame = new JFrame(); + frame.setTitle(resources.getString("Title")); + frame.setBackground(Color.lightGray); + frame.getContentPane().setLayout(new BorderLayout()); + Notepad notepad = new Notepad(); + frame.getContentPane().add("Center", notepad); + frame.setJMenuBar(notepad.createMenubar()); + frame.addWindowListener(new AppCloser()); + frame.pack(); + frame.setSize(500, 600); + frame.setVisible(true); + } + }); } /** @@ -274,9 +223,7 @@ class Notepad extends JPanel { /** * This is the hook through which all menu items are - * created. It registers the result with the menuitem - * hashtable so that it can be fetched with getMenuItem(). - * @see #getMenuItem + * created. */ protected JMenuItem createMenuItem(String cmd) { JMenuItem mi = new JMenuItem(getResourceString(cmd + labelSuffix)); @@ -285,7 +232,7 @@ class Notepad extends JPanel { mi.setHorizontalTextPosition(JButton.RIGHT); mi.setIcon(new ImageIcon(url)); } - String astr = getResourceString(cmd + actionSuffix); + String astr = getProperty(cmd + actionSuffix); if (astr == null) { astr = cmd; } @@ -298,25 +245,17 @@ class Notepad extends JPanel { } else { mi.setEnabled(false); } - menuItems.put(cmd, mi); return mi; } - /** - * Fetch the menu item that was created for the given - * command. - * @param cmd Name of the action. - * @returns item created for the given command or null - * if one wasn't created. - */ - protected JMenuItem getMenuItem(String cmd) { - return menuItems.get(cmd); - } - protected Action getAction(String cmd) { return commands.get(cmd); } + protected String getProperty(String key) { + return properties.getProperty(key); + } + protected String getResourceString(String nm) { String str; try { @@ -330,20 +269,11 @@ class Notepad extends JPanel { protected URL getResource(String key) { String name = getResourceString(key); if (name != null) { - URL url = this.getClass().getResource(name); - return url; + return this.getClass().getResource(name); } return null; } - protected Container getToolbar() { - return toolbar; - } - - protected JMenuBar getMenubar() { - return menubar; - } - /** * Create a status bar */ @@ -368,12 +298,11 @@ class Notepad extends JPanel { */ private Component createToolbar() { toolbar = new JToolBar(); - String[] toolKeys = tokenize(getResourceString("toolbar")); - for (int i = 0; i < toolKeys.length; i++) { - if (toolKeys[i].equals("-")) { + for (String toolKey: TOOLBAR_KEYS) { + if (toolKey.equals("-")) { toolbar.add(Box.createHorizontalStrut(5)); } else { - toolbar.add(createTool(toolKeys[i])); + toolbar.add(createTool(toolKey)); } } toolbar.add(Box.createHorizontalGlue()); @@ -408,7 +337,7 @@ class Notepad extends JPanel { b.setRequestFocusEnabled(false); b.setMargin(new Insets(1, 1, 1, 1)); - String astr = getResourceString(key + actionSuffix); + String astr = getProperty(key + actionSuffix); if (astr == null) { astr = key; } @@ -428,44 +357,18 @@ class Notepad extends JPanel { return b; } - /** - * Take the given string and chop it up into a series - * of strings on whitespace boundaries. This is useful - * for trying to get an array of strings out of the - * resource file. - */ - protected String[] tokenize(String input) { - List v = new ArrayList(); - StringTokenizer t = new StringTokenizer(input); - String cmd[]; - - while (t.hasMoreTokens()) { - v.add(t.nextToken()); - } - cmd = new String[v.size()]; - for (int i = 0; i < cmd.length; i++) { - cmd[i] = v.get(i); - } - - return cmd; - } - /** * Create the menubar for the app. By default this pulls the * definition of the menu from the associated resource file. */ protected JMenuBar createMenubar() { - JMenuItem mi; JMenuBar mb = new JMenuBar(); - - String[] menuKeys = tokenize(getResourceString("menubar")); - for (int i = 0; i < menuKeys.length; i++) { - JMenu m = createMenu(menuKeys[i]); + for(String menuKey: MENUBAR_KEYS){ + JMenu m = createMenu(menuKey); if (m != null) { mb.add(m); } } - this.menubar = mb; return mb; } @@ -474,19 +377,32 @@ class Notepad extends JPanel { * definition of the menu from the associated resource file. */ protected JMenu createMenu(String key) { - String[] itemKeys = tokenize(getResourceString(key)); - JMenu menu = new JMenu(getResourceString(key + "Label")); - for (int i = 0; i < itemKeys.length; i++) { - if (itemKeys[i].equals("-")) { + JMenu menu = new JMenu(getResourceString(key + labelSuffix)); + for (String itemKey: getItemKeys(key)) { + if (itemKey.equals("-")) { menu.addSeparator(); } else { - JMenuItem mi = createMenuItem(itemKeys[i]); + JMenuItem mi = createMenuItem(itemKey); menu.add(mi); } } return menu; } + // get keys for menus + private String[] getItemKeys(String key) { + switch (key) { + case "file": + return FILE_KEYS; + case "edit": + return EDIT_KEYS; + case "debug": + return DEBUG_KEYS; + default: + return null; + } + } + // Yarked from JMenu, ideally this would be public. protected PropertyChangeListener createActionChangeListener(JMenuItem b) { return new ActionChangedListener(b); @@ -516,13 +432,11 @@ class Notepad extends JPanel { } private JTextComponent editor; private Map commands; - private Map menuItems; - private JMenuBar menubar; private JToolBar toolbar; private JComponent status; private JFrame elementTreeFrame; protected ElementTreePanel elementTreePanel; - protected FileDialog fileDialog; + /** * Listener for the edits on the current document. */ @@ -773,10 +687,6 @@ class Notepad extends JPanel { super(showElementTreeAction); } - ShowElementTreeAction(String nm) { - super(nm); - } - public void actionPerformed(ActionEvent e) { if (elementTreeFrame == null) { // Create a frame containing an instance of diff --git a/jdk/src/share/demo/jfc/Notepad/resources/Notepad.properties b/jdk/src/share/demo/jfc/Notepad/resources/Notepad.properties index ef61d6fd3c4..d43e350942c 100644 --- a/jdk/src/share/demo/jfc/Notepad/resources/Notepad.properties +++ b/jdk/src/share/demo/jfc/Notepad/resources/Notepad.properties @@ -3,16 +3,6 @@ Title=Notepad ElementTreeFrameTitle=Elements -# The following string should NOT be translated: ViewportBackingStore -ViewportBackingStore=false - -# menubar definition -# -# Each of the strings that follow form a key to be -# used to the actual menu definition. - -# The following string should NOT be translated: menubar -menubar=file edit debug # file Menu definition # @@ -24,8 +14,6 @@ menubar=file edit debug # save -> Notepad.saveAction # exit -> Notepad.exitAction -# The following string should NOT be translated: file -file=new open save - exit fileLabel=File openLabel=Open openImage=resources/open.gif @@ -42,38 +30,22 @@ exitLabel=Exit # copy -> JTextComponent.copyAction # paste -> JTextComponent.pasteAction -# The following string should NOT be translated: edit -edit=cut copy paste - undo redo editLabel=Edit cutLabel=Cut -# The following string should NOT be translated: cutAction -cutAction=cut-to-clipboard cutImage=resources/cut.gif copyLabel=Copy -# The following string should NOT be translated: copyAction -copyAction=copy-to-clipboard copyImage=resources/copy.gif pasteLabel=Paste -# The following string should NOT be translated: pasteAction -pasteAction=paste-from-clipboard pasteImage=resources/paste.gif undoLabel=Undo -# The following string should NOT be translated: undoAction -undoAction=Undo redoLabel=Redo -# The following string should NOT be translated: redoAction -redoAction=Redo # # debug Menu definition # -# The following string should NOT be translated: debug -debug=dump showElementTree debugLabel=Debug dumpLabel=Dump model to System.err -# The following string should NOT be translated: dumpAction -dumpAction=dump-model showElementTreeLabel=Show Elements # toolbar definition @@ -83,8 +55,6 @@ showElementTreeLabel=Show Elements # are of course sharable, and in this case are shared # with the menu items. -# The following string should NOT be translated: toolbar -toolbar=new open save - cut copy paste newTooltip=Create a new file openTooltip=Open a file saveTooltip=Save to a file diff --git a/jdk/src/share/demo/jfc/Notepad/resources/system.properties b/jdk/src/share/demo/jfc/Notepad/resources/system.properties new file mode 100644 index 00000000000..a6f8786d099 --- /dev/null +++ b/jdk/src/share/demo/jfc/Notepad/resources/system.properties @@ -0,0 +1,12 @@ +# +# Non-translatable properties for Notepad example + +ViewportBackingStore=false + +cutAction=cut-to-clipboard +copyAction=copy-to-clipboard +pasteAction=paste-from-clipboard +undoAction=Undo +redoAction=Redo +dumpAction=dump-model + From b963b0bcc405ec5ed27a99a454249535ce3421d0 Mon Sep 17 00:00:00 2001 From: Oleg Pekhovskiy Date: Fri, 4 May 2012 18:42:08 +0400 Subject: [PATCH 007/128] 7146237: closed/java/awt/Focus/SetFocusTraversalKeysTest/SetFocusTraversalTest.html failed since 1.8.0b19 Reviewed-by: art, anthony --- jdk/src/share/classes/java/awt/Component.java | 6 +- jdk/src/share/classes/java/awt/Container.java | 6 +- .../java/awt/KeyboardFocusManager.java | 89 +++++++++---------- .../share/classes/javax/swing/JComponent.java | 6 +- 4 files changed, 53 insertions(+), 54 deletions(-) diff --git a/jdk/src/share/classes/java/awt/Component.java b/jdk/src/share/classes/java/awt/Component.java index 63fe2a80be9..00d363c1162 100644 --- a/jdk/src/share/classes/java/awt/Component.java +++ b/jdk/src/share/classes/java/awt/Component.java @@ -7169,6 +7169,9 @@ public abstract class Component implements ImageObserver, MenuContainer, * Set from its parent. If all ancestors of this Component have null * specified for the Set, then the current KeyboardFocusManager's default * Set is used. + *

+ * This method may throw a {@code ClassCastException} if any {@code Object} + * in {@code keystrokes} is not an {@code AWTKeyStroke}. * * @param id one of KeyboardFocusManager.FORWARD_TRAVERSAL_KEYS, * KeyboardFocusManager.BACKWARD_TRAVERSAL_KEYS, or @@ -7182,8 +7185,7 @@ public abstract class Component implements ImageObserver, MenuContainer, * KeyboardFocusManager.FORWARD_TRAVERSAL_KEYS, * KeyboardFocusManager.BACKWARD_TRAVERSAL_KEYS, or * KeyboardFocusManager.UP_CYCLE_TRAVERSAL_KEYS, or if keystrokes - * contains null, or if any Object in keystrokes is not an - * AWTKeyStroke, or if any keystroke represents a KEY_TYPED event, + * contains null, or if any keystroke represents a KEY_TYPED event, * or if any keystroke already maps to another focus traversal * operation for this Component * @since 1.4 diff --git a/jdk/src/share/classes/java/awt/Container.java b/jdk/src/share/classes/java/awt/Container.java index 03b0f7faa04..99cbdaff124 100644 --- a/jdk/src/share/classes/java/awt/Container.java +++ b/jdk/src/share/classes/java/awt/Container.java @@ -3093,6 +3093,9 @@ public class Container extends Component { * Set from its parent. If all ancestors of this Container have null * specified for the Set, then the current KeyboardFocusManager's default * Set is used. + *

+ * This method may throw a {@code ClassCastException} if any {@code Object} + * in {@code keystrokes} is not an {@code AWTKeyStroke}. * * @param id one of KeyboardFocusManager.FORWARD_TRAVERSAL_KEYS, * KeyboardFocusManager.BACKWARD_TRAVERSAL_KEYS, @@ -3109,8 +3112,7 @@ public class Container extends Component { * KeyboardFocusManager.BACKWARD_TRAVERSAL_KEYS, * KeyboardFocusManager.UP_CYCLE_TRAVERSAL_KEYS, or * KeyboardFocusManager.DOWN_CYCLE_TRAVERSAL_KEYS, or if keystrokes - * contains null, or if any Object in keystrokes is not an - * AWTKeyStroke, or if any keystroke represents a KEY_TYPED event, + * contains null, or if any keystroke represents a KEY_TYPED event, * or if any keystroke already maps to another focus traversal * operation for this Container * @since 1.4 diff --git a/jdk/src/share/classes/java/awt/KeyboardFocusManager.java b/jdk/src/share/classes/java/awt/KeyboardFocusManager.java index 3ccf5b70d36..7b8b9f41e25 100644 --- a/jdk/src/share/classes/java/awt/KeyboardFocusManager.java +++ b/jdk/src/share/classes/java/awt/KeyboardFocusManager.java @@ -991,12 +991,12 @@ public abstract class KeyboardFocusManager /** * Sets the default focus traversal keys for a given traversal operation. - * This traversal key Set will be in effect on all - * Windows that have no such Set of - * their own explicitly defined. This Set will also be - * inherited, recursively, by any child Component of - * those Windows that has - * no such Set of its own explicitly defined. + * This traversal key {@code Set} will be in effect on all + * {@code Window}s that have no such {@code Set} of + * their own explicitly defined. This {@code Set} will also be + * inherited, recursively, by any child {@code Component} of + * those {@code Windows} that has + * no such {@code Set} of its own explicitly defined. *

* The default values for the default focus traversal keys are * implementation-dependent. Sun recommends that all implementations for a @@ -1011,66 +1011,67 @@ public abstract class KeyboardFocusManager * Default * * - * KeyboardFocusManager.FORWARD_TRAVERSAL_KEYS + * {@code KeyboardFocusManager.FORWARD_TRAVERSAL_KEYS} * Normal forward keyboard traversal - * TAB on KEY_PRESSED, - * CTRL-TAB on KEY_PRESSED + * {@code TAB} on {@code KEY_PRESSED}, + * {@code CTRL-TAB} on {@code KEY_PRESSED} * * - * KeyboardFocusManager.BACKWARD_TRAVERSAL_KEYS + * {@code KeyboardFocusManager.BACKWARD_TRAVERSAL_KEYS} * Normal reverse keyboard traversal - * SHIFT-TAB on KEY_PRESSED, - * CTRL-SHIFT-TAB on KEY_PRESSED + * {@code SHIFT-TAB} on {@code KEY_PRESSED}, + * {@code CTRL-SHIFT-TAB} on {@code KEY_PRESSED} * * - * KeyboardFocusManager.UP_CYCLE_TRAVERSAL_KEYS + * {@code KeyboardFocusManager.UP_CYCLE_TRAVERSAL_KEYS} * Go up one focus traversal cycle * none * * - * KeyboardFocusManager.DOWN_CYCLE_TRAVERSAL_KEYS + * {@code KeyboardFocusManager.DOWN_CYCLE_TRAVERSAL_KEYS} * Go down one focus traversal cycle * none * * * - * To disable a traversal key, use an empty Set; - * Collections.EMPTY_SET is recommended. + * To disable a traversal key, use an empty {@code Set}; + * {@code Collections.EMPTY_SET} is recommended. *

- * Using the AWTKeyStroke API, client code can + * Using the {@code AWTKeyStroke} API, client code can * specify on which of two - * specific KeyEvents, KEY_PRESSED or - * KEY_RELEASED, the focus traversal operation will - * occur. Regardless of which KeyEvent is specified, - * however, all KeyEvents related to the focus - * traversal key, including the associated KEY_TYPED + * specific {@code KeyEvent}s, {@code KEY_PRESSED} or + * {@code KEY_RELEASED}, the focus traversal operation will + * occur. Regardless of which {@code KeyEvent} is specified, + * however, all {@code KeyEvent}s related to the focus + * traversal key, including the associated {@code KEY_TYPED} * event, will be consumed, and will not be dispatched - * to any Component. It is a runtime error to - * specify a KEY_TYPED event as + * to any {@code Component}. It is a runtime error to + * specify a {@code KEY_TYPED} event as * mapping to a focus traversal operation, or to map the same event to * multiple default focus traversal operations. + *

+ * This method may throw a {@code ClassCastException} if any {@code Object} + * in {@code keystrokes} is not an {@code AWTKeyStroke}. * * @param id one of - * KeyboardFocusManager.FORWARD_TRAVERSAL_KEYS, - * KeyboardFocusManager.BACKWARD_TRAVERSAL_KEYS, - * KeyboardFocusManager.UP_CYCLE_TRAVERSAL_KEYS, or - * KeyboardFocusManager.DOWN_CYCLE_TRAVERSAL_KEYS - * @param keystrokes the Set of AWTKeyStrokes for the + * {@code KeyboardFocusManager.FORWARD_TRAVERSAL_KEYS}, + * {@code KeyboardFocusManager.BACKWARD_TRAVERSAL_KEYS}, + * {@code KeyboardFocusManager.UP_CYCLE_TRAVERSAL_KEYS}, or + * {@code KeyboardFocusManager.DOWN_CYCLE_TRAVERSAL_KEYS} + * @param keystrokes the Set of {@code AWTKeyStroke}s for the * specified operation * @see #getDefaultFocusTraversalKeys * @see Component#setFocusTraversalKeys * @see Component#getFocusTraversalKeys * @throws IllegalArgumentException if id is not one of - * KeyboardFocusManager.FORWARD_TRAVERSAL_KEYS, - * KeyboardFocusManager.BACKWARD_TRAVERSAL_KEYS, - * KeyboardFocusManager.UP_CYCLE_TRAVERSAL_KEYS, or - * KeyboardFocusManager.DOWN_CYCLE_TRAVERSAL_KEYS, - * or if keystrokes is null, - * or if keystrokes contains null, - * or if any Object in - * keystrokes is not an AWTKeyStroke, + * {@code KeyboardFocusManager.FORWARD_TRAVERSAL_KEYS}, + * {@code KeyboardFocusManager.BACKWARD_TRAVERSAL_KEYS}, + * {@code KeyboardFocusManager.UP_CYCLE_TRAVERSAL_KEYS}, or + * {@code KeyboardFocusManager.DOWN_CYCLE_TRAVERSAL_KEYS}, + * or if keystrokes is {@code null}, + * or if keystrokes contains {@code null}, * or if any keystroke - * represents a KEY_TYPED event, + * represents a {@code KEY_TYPED} event, * or if any keystroke already maps * to another default focus traversal operation * @beaninfo @@ -1090,20 +1091,12 @@ public abstract class KeyboardFocusManager Set oldKeys; synchronized (this) { - for (Iterator iter = keystrokes.iterator(); iter.hasNext(); ) { - Object obj = iter.next(); + for (AWTKeyStroke keystroke : keystrokes) { - if (obj == null) { + if (keystroke == null) { throw new IllegalArgumentException("cannot set null focus traversal key"); } - // Fix for 6195831: - //According to javadoc this method should throw IAE instead of ClassCastException - if (!(obj instanceof AWTKeyStroke)) { - throw new IllegalArgumentException("object is expected to be AWTKeyStroke"); - } - AWTKeyStroke keystroke = (AWTKeyStroke)obj; - if (keystroke.getKeyChar() != KeyEvent.CHAR_UNDEFINED) { throw new IllegalArgumentException("focus traversal keys cannot map to KEY_TYPED events"); } diff --git a/jdk/src/share/classes/javax/swing/JComponent.java b/jdk/src/share/classes/javax/swing/JComponent.java index 78bc5c4f648..83f88bfbfdc 100644 --- a/jdk/src/share/classes/javax/swing/JComponent.java +++ b/jdk/src/share/classes/javax/swing/JComponent.java @@ -4148,6 +4148,9 @@ public abstract class JComponent extends Container implements Serializable, * Refer to * {@link java.awt.Component#setFocusTraversalKeys} * for a complete description of this method. + *

+ * This method may throw a {@code ClassCastException} if any {@code Object} + * in {@code keystrokes} is not an {@code AWTKeyStroke}. * * @param id one of KeyboardFocusManager.FORWARD_TRAVERSAL_KEYS, * KeyboardFocusManager.BACKWARD_TRAVERSAL_KEYS, or @@ -4160,8 +4163,7 @@ public abstract class JComponent extends Container implements Serializable, * KeyboardFocusManager.FORWARD_TRAVERSAL_KEYS, * KeyboardFocusManager.BACKWARD_TRAVERSAL_KEYS, or * KeyboardFocusManager.UP_CYCLE_TRAVERSAL_KEYS, or if keystrokes - * contains null, or if any Object in keystrokes is not an - * AWTKeyStroke, or if any keystroke represents a KEY_TYPED event, + * contains null, or if any keystroke represents a KEY_TYPED event, * or if any keystroke already maps to another focus traversal * operation for this Component * @since 1.5 From 324e987e82197c1043b57846e0a7c4f122e1a82d Mon Sep 17 00:00:00 2001 From: Jan Lahoda Date: Fri, 4 May 2012 07:55:51 -0700 Subject: [PATCH 008/128] 7166010: (javac) JavacMessager incorrectly restores log source file Reviewed-by: jjg --- .../tools/javac/processing/JavacMessager.java | 6 +- .../processing/messager/MessagerDiags.java | 131 ++++++++++++++++++ 2 files changed, 135 insertions(+), 2 deletions(-) create mode 100644 langtools/test/tools/javac/processing/messager/MessagerDiags.java diff --git a/langtools/src/share/classes/com/sun/tools/javac/processing/JavacMessager.java b/langtools/src/share/classes/com/sun/tools/javac/processing/JavacMessager.java index eeeb0953609..bc6acc1a096 100644 --- a/langtools/src/share/classes/com/sun/tools/javac/processing/JavacMessager.java +++ b/langtools/src/share/classes/com/sun/tools/javac/processing/JavacMessager.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2005, 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 @@ -99,6 +99,7 @@ public class JavacMessager implements Messager { if (treeTop != null) { newSource = treeTop.snd.sourcefile; if (newSource != null) { + // save the old version and reinstate it later oldSource = log.useSource(newSource); pos = treeTop.fst.pos(); } @@ -131,7 +132,8 @@ public class JavacMessager implements Messager { break; } } finally { - if (oldSource != null) + // reinstate the saved version, only if it was saved earlier + if (newSource != null) log.useSource(oldSource); } } diff --git a/langtools/test/tools/javac/processing/messager/MessagerDiags.java b/langtools/test/tools/javac/processing/messager/MessagerDiags.java new file mode 100644 index 00000000000..6f333a36090 --- /dev/null +++ b/langtools/test/tools/javac/processing/messager/MessagerDiags.java @@ -0,0 +1,131 @@ +/* + * Copyright (c) 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. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. + * + * 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. + */ + +/* + * @test + * @bug 7166010 + * @summary warnings printed by annotation processors uses incorrect source + */ +import com.sun.source.util.JavacTask; +import java.io.IOException; +import java.net.URI; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.LinkedList; +import java.util.List; +import java.util.Set; +import javax.annotation.processing.AbstractProcessor; +import javax.annotation.processing.Messager; +import javax.annotation.processing.RoundEnvironment; +import javax.annotation.processing.SupportedAnnotationTypes; +import javax.annotation.processing.SupportedSourceVersion; +import javax.lang.model.SourceVersion; +import javax.lang.model.element.Element; +import javax.lang.model.element.TypeElement; +import javax.tools.Diagnostic; +import javax.tools.DiagnosticCollector; +import javax.tools.JavaCompiler; +import javax.tools.JavaFileObject; +import javax.tools.SimpleJavaFileObject; +import javax.tools.ToolProvider; + +import static javax.tools.Diagnostic.Kind.*; +import static javax.tools.JavaFileObject.Kind.*; + +@SupportedSourceVersion(SourceVersion.RELEASE_6) +@SupportedAnnotationTypes("*") +public class MessagerDiags extends AbstractProcessor { + static final String CNAME = "Test"; + static final String TEST_JAVA = CNAME + ".java"; + static final String TEST_JAVA_URI_NAME = "myfo:/" + TEST_JAVA; + static final String WRN_NO_SOURCE = "warning without source"; + static final String WRN_WITH_SOURCE = "warning with source"; + static final String NONE = ""; + static final String[] EXPECTED = { NONE + ":-1--1:" + WRN_NO_SOURCE, + TEST_JAVA + ":0-13:" + WRN_WITH_SOURCE, + NONE + ":-1--1:" + WRN_NO_SOURCE + }; + + @Override + public boolean process(Set annotations, + RoundEnvironment roundEnv) { + Messager messager = processingEnv.getMessager(); + for (Element e : roundEnv.getRootElements()) { + messager.printMessage(WARNING, WRN_NO_SOURCE); + messager.printMessage(WARNING, WRN_WITH_SOURCE, e); + messager.printMessage(WARNING, WRN_NO_SOURCE); + } + return false; + } + + public static void main(String... args) throws IOException { + final String bootPath = System.getProperty("sun.boot.class.path"); + final JavaCompiler tool = ToolProvider.getSystemJavaCompiler(); + assert tool != null; + + DiagnosticCollector dc = new DiagnosticCollector<>(); + List options = new LinkedList<>(); + options.addAll(Arrays.asList("-bootclasspath", bootPath, + "-source", "1.6", "-classpath", + System.getProperty("java.class.path"))); + options.addAll(Arrays.asList("-processor", + MessagerDiags.class.getName())); + JavacTask ct = (JavacTask)tool.getTask(null, null, dc, options, null, + Arrays.asList(new MyFileObject("class " + CNAME + " {}"))); + ct.analyze(); + + List obtainedErrors = new ArrayList<>(); + + for (Diagnostic d : dc.getDiagnostics()) { + String dSource; + if (d.getSource() != null) { + dSource = d.getSource().toUri().getPath(); + dSource = dSource.substring(dSource.lastIndexOf('/') + 1); + } else { + dSource = NONE; + } + obtainedErrors.add(dSource + ":" + d.getStartPosition() + "-" + + d.getEndPosition() + ":" + d.getMessage(null)); + } + List expectedErrors = Arrays.asList(EXPECTED); + if (!expectedErrors.equals(obtainedErrors)) { + System.err.println("Expected: " + expectedErrors); + System.err.println("Obtained: " + obtainedErrors); + throw new AssertionError("Messages don't match"); + } + } + + static class MyFileObject extends SimpleJavaFileObject { + private String text; + public MyFileObject(String text) { + super(URI.create(TEST_JAVA_URI_NAME), SOURCE); + this.text = text; + } + @Override + public CharSequence getCharContent(boolean ignoreEncodingErrors) { + return text; + } + } +} From bf549e93b93b1c0e0af3cf9e6517c7eb0b89aabb Mon Sep 17 00:00:00 2001 From: Sergey Bylokhov Date: Fri, 4 May 2012 21:25:08 +0400 Subject: [PATCH 009/128] 7147055: [macosx] Cursors are changing over a blocked window; also blinking Reviewed-by: art, kizune --- jdk/src/macosx/classes/sun/lwawt/LWCursorManager.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/jdk/src/macosx/classes/sun/lwawt/LWCursorManager.java b/jdk/src/macosx/classes/sun/lwawt/LWCursorManager.java index 1c34353c7b9..de1b537856a 100644 --- a/jdk/src/macosx/classes/sun/lwawt/LWCursorManager.java +++ b/jdk/src/macosx/classes/sun/lwawt/LWCursorManager.java @@ -88,20 +88,20 @@ public abstract class LWCursorManager { } else { cursor = (c != null) ? c.getCursor() : null; } - // TODO: default cursor for modal blocked windows setCursor(cursor); } /** * Returns the first visible, enabled and showing component under cursor. + * Returns null for modal blocked windows. * * @param cursorPos Current cursor position. - * @return Component + * @return Component or null. */ private static final Component findComponent(final Point cursorPos) { final LWComponentPeer peer = LWWindowPeer.getPeerUnderCursor(); Component c = null; - if (peer != null) { + if (peer != null && peer.getWindowPeerOrSelf().getBlocker() == null) { c = peer.getTarget(); if (c instanceof Container) { final Point p = peer.getLocationOnScreen(); From 2f8d099c20523e53c8435fdb43f9e3de6d3d1d92 Mon Sep 17 00:00:00 2001 From: Knut Anders Hatlen Date: Fri, 4 May 2012 16:00:47 -0400 Subject: [PATCH 010/128] 7166598: FilteredRowSetImpl can result in Invalid Cursor Position Reviewed-by: lancea --- jdk/src/share/classes/com/sun/rowset/FilteredRowSetImpl.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/jdk/src/share/classes/com/sun/rowset/FilteredRowSetImpl.java b/jdk/src/share/classes/com/sun/rowset/FilteredRowSetImpl.java index a18c0ac10bd..20c2743ee4b 100644 --- a/jdk/src/share/classes/com/sun/rowset/FilteredRowSetImpl.java +++ b/jdk/src/share/classes/com/sun/rowset/FilteredRowSetImpl.java @@ -128,7 +128,7 @@ public class FilteredRowSetImpl extends WebRowSetImpl implements Serializable, C for(int rows=this.getRow(); rows<=this.size();rows++) { bool = super.internalNext(); - if( p == null) { + if( !bool || p == null) { return bool; } if(p.evaluate(this)){ From 7ae15519b1b4b8cbae6deec1da5d6ffb5717ee01 Mon Sep 17 00:00:00 2001 From: Xue-Lei Andrew Fan Date: Fri, 4 May 2012 17:28:27 -0700 Subject: [PATCH 011/128] 7153184: NullPointerException when calling SSLEngineImpl.getSupportedCipherSuites Reviewed-by: weijun --- .../sun/security/ssl/SSLContextImpl.java | 41 +++++++++++++------ 1 file changed, 28 insertions(+), 13 deletions(-) diff --git a/jdk/src/share/classes/sun/security/ssl/SSLContextImpl.java b/jdk/src/share/classes/sun/security/ssl/SSLContextImpl.java index 9814f9f5010..bb57a61f828 100644 --- a/jdk/src/share/classes/sun/security/ssl/SSLContextImpl.java +++ b/jdk/src/share/classes/sun/security/ssl/SSLContextImpl.java @@ -267,12 +267,15 @@ public abstract class SSLContextImpl extends SSLContextSpi { // Get suported CipherSuiteList. CipherSuiteList getSuportedCipherSuiteList() { - // Clear cache of available ciphersuites. - clearAvailableCache(); + // The maintenance of cipher suites needs to be synchronized. + synchronized (this) { + // Clear cache of available ciphersuites. + clearAvailableCache(); - if (supportedCipherSuiteList == null) { - supportedCipherSuiteList = - getApplicableCipherSuiteList(getSuportedProtocolList(), false); + if (supportedCipherSuiteList == null) { + supportedCipherSuiteList = getApplicableCipherSuiteList( + getSuportedProtocolList(), false); + } } return supportedCipherSuiteList; @@ -280,20 +283,29 @@ public abstract class SSLContextImpl extends SSLContextSpi { // Get default CipherSuiteList. CipherSuiteList getDefaultCipherSuiteList(boolean roleIsServer) { - // Clear cache of available ciphersuites. - clearAvailableCache(); - if (roleIsServer) { - if (defaultServerCipherSuiteList == null) { - defaultServerCipherSuiteList = getApplicableCipherSuiteList( + // The maintenance of cipher suites needs to be synchronized. + synchronized (this) { + // Clear cache of available ciphersuites. + clearAvailableCache(); + + if (defaultServerCipherSuiteList == null) { + defaultServerCipherSuiteList = getApplicableCipherSuiteList( getDefaultProtocolList(true), true); + } } return defaultServerCipherSuiteList; } else { - if (defaultClientCipherSuiteList == null) { - defaultClientCipherSuiteList = getApplicableCipherSuiteList( + // The maintenance of cipher suites needs to be synchronized + synchronized (this) { + // Clear cache of available ciphersuites. + clearAvailableCache(); + + if (defaultClientCipherSuiteList == null) { + defaultClientCipherSuiteList = getApplicableCipherSuiteList( getDefaultProtocolList(false), true); + } } return defaultClientCipherSuiteList; @@ -364,8 +376,11 @@ public abstract class SSLContextImpl extends SSLContextSpi { * Clear cache of available ciphersuites. If we support all ciphers * internally, there is no need to clear the cache and calling this * method has no effect. + * + * Note that every call to clearAvailableCache() and the maintenance of + * cipher suites need to be synchronized with this instance. */ - synchronized void clearAvailableCache() { + private void clearAvailableCache() { if (CipherSuite.DYNAMIC_AVAILABILITY) { supportedCipherSuiteList = null; defaultServerCipherSuiteList = null; From 703f08dfe8d36de946101e69a53858a08b3acf8a Mon Sep 17 00:00:00 2001 From: Sean Chou Date: Mon, 7 May 2012 16:43:16 +0800 Subject: [PATCH 012/128] 7166048: Remove the embeded epoll data structure Reviewed-by: alanb --- .../native/sun/nio/ch/EPollArrayWrapper.c | 60 ++----------------- 1 file changed, 5 insertions(+), 55 deletions(-) diff --git a/jdk/src/solaris/native/sun/nio/ch/EPollArrayWrapper.c b/jdk/src/solaris/native/sun/nio/ch/EPollArrayWrapper.c index 3d4f05100d1..7f7a3e82690 100644 --- a/jdk/src/solaris/native/sun/nio/ch/EPollArrayWrapper.c +++ b/jdk/src/solaris/native/sun/nio/ch/EPollArrayWrapper.c @@ -30,40 +30,10 @@ #include "sun_nio_ch_EPollArrayWrapper.h" -#include #include #include #include - -#ifdef __cplusplus -extern "C" { -#endif - -/* epoll_wait(2) man page */ - -typedef union epoll_data { - void *ptr; - int fd; - __uint32_t u32; - __uint64_t u64; -} epoll_data_t; - - -/* x86-64 has same alignment as 32-bit */ -#ifdef __x86_64__ -#define EPOLL_PACKED __attribute__((packed)) -#else -#define EPOLL_PACKED -#endif - -struct epoll_event { - __uint32_t events; /* Epoll events */ - epoll_data_t data; /* User data variable */ -} EPOLL_PACKED; - -#ifdef __cplusplus -} -#endif +#include #define RESTARTABLE(_cmd, _result) do { \ do { \ @@ -71,18 +41,6 @@ struct epoll_event { } while((_result == -1) && (errno == EINTR)); \ } while(0) -/* - * epoll event notification is new in 2.6 kernel. As the offical build - * platform for the JDK is on a 2.4-based distribution then we must - * obtain the addresses of the epoll functions dynamically. - */ -typedef int (*epoll_create_t)(int size); -typedef int (*epoll_ctl_t) (int epfd, int op, int fd, struct epoll_event *event); -typedef int (*epoll_wait_t) (int epfd, struct epoll_event *events, int maxevents, int timeout); - -static epoll_create_t epoll_create_func; -static epoll_ctl_t epoll_ctl_func; -static epoll_wait_t epoll_wait_func; static int iepoll(int epfd, struct epoll_event *events, int numfds, jlong timeout) @@ -96,7 +54,7 @@ iepoll(int epfd, struct epoll_event *events, int numfds, jlong timeout) start = t.tv_sec * 1000 + t.tv_usec / 1000; for (;;) { - int res = (*epoll_wait_func)(epfd, events, numfds, timeout); + int res = epoll_wait(epfd, events, numfds, timeout); if (res < 0 && errno == EINTR) { if (remaining >= 0) { gettimeofday(&t, NULL); @@ -117,14 +75,6 @@ iepoll(int epfd, struct epoll_event *events, int numfds, jlong timeout) JNIEXPORT void JNICALL Java_sun_nio_ch_EPollArrayWrapper_init(JNIEnv *env, jclass this) { - epoll_create_func = (epoll_create_t) dlsym(RTLD_DEFAULT, "epoll_create"); - epoll_ctl_func = (epoll_ctl_t) dlsym(RTLD_DEFAULT, "epoll_ctl"); - epoll_wait_func = (epoll_wait_t) dlsym(RTLD_DEFAULT, "epoll_wait"); - - if ((epoll_create_func == NULL) || (epoll_ctl_func == NULL) || - (epoll_wait_func == NULL)) { - JNU_ThrowInternalError(env, "unable to get address of epoll functions, pre-2.6 kernel?"); - } } JNIEXPORT jint JNICALL @@ -134,7 +84,7 @@ Java_sun_nio_ch_EPollArrayWrapper_epollCreate(JNIEnv *env, jobject this) * epoll_create expects a size as a hint to the kernel about how to * dimension internal structures. We can't predict the size in advance. */ - int epfd = (*epoll_create_func)(256); + int epfd = epoll_create(256); if (epfd < 0) { JNU_ThrowIOExceptionWithLastError(env, "epoll_create failed"); } @@ -173,7 +123,7 @@ Java_sun_nio_ch_EPollArrayWrapper_epollCtl(JNIEnv *env, jobject this, jint epfd, event.events = events; event.data.fd = fd; - RESTARTABLE((*epoll_ctl_func)(epfd, (int)opcode, (int)fd, &event), res); + RESTARTABLE(epoll_ctl(epfd, (int)opcode, (int)fd, &event), res); /* * A channel may be registered with several Selectors. When each Selector @@ -199,7 +149,7 @@ Java_sun_nio_ch_EPollArrayWrapper_epollWait(JNIEnv *env, jobject this, int res; if (timeout <= 0) { /* Indefinite or no wait */ - RESTARTABLE((*epoll_wait_func)(epfd, events, numfds, timeout), res); + RESTARTABLE(epoll_wait(epfd, events, numfds, timeout), res); } else { /* Bounded wait; bounded restarts */ res = iepoll(epfd, events, numfds, timeout); } From fd928bc1ef63ffc6288f83e520ab794814093d4a Mon Sep 17 00:00:00 2001 From: Rob McKenna Date: Mon, 7 May 2012 13:34:19 +0100 Subject: [PATCH 013/128] 7166687: InetAddress.getLocalHost().getHostName() returns FQDN Reviewed-by: chegar --- jdk/src/solaris/native/java/net/Inet6AddressImpl.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/jdk/src/solaris/native/java/net/Inet6AddressImpl.c b/jdk/src/solaris/native/java/net/Inet6AddressImpl.c index e612131b95c..608f3c595d2 100644 --- a/jdk/src/solaris/native/java/net/Inet6AddressImpl.c +++ b/jdk/src/solaris/native/java/net/Inet6AddressImpl.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 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 @@ -73,7 +73,7 @@ Java_java_net_Inet6AddressImpl_getLocalHostName(JNIEnv *env, jobject this) { } else { // ensure null-terminated hostname[NI_MAXHOST] = '\0'; -#if defined(__linux__) && defined(_ALLBSD_SOURCE) +#if defined(__linux__) || defined(_ALLBSD_SOURCE) /* On Linux/FreeBSD gethostname() says "host.domain.sun.com". On * Solaris gethostname() says "host", so extra work is needed. */ From 828158fb8d9d71c96a40b66d5d80cfb6d1b35aee Mon Sep 17 00:00:00 2001 From: David Holmes Date: Tue, 8 May 2012 02:59:10 -0400 Subject: [PATCH 014/128] 7103570: AtomicIntegerFieldUpdater does not work when SecurityManager is installed Perform class.getField inside a doPrivileged block Reviewed-by: chegar, psandoz --- .../atomic/AtomicIntegerFieldUpdater.java | 44 +++- .../atomic/AtomicLongFieldUpdater.java | 62 +++++- .../atomic/AtomicReferenceFieldUpdater.java | 66 ++++-- .../concurrent/atomic/AtomicUpdaters.java | 189 ++++++++++++++++++ 4 files changed, 332 insertions(+), 29 deletions(-) create mode 100644 jdk/test/java/util/concurrent/atomic/AtomicUpdaters.java diff --git a/jdk/src/share/classes/java/util/concurrent/atomic/AtomicIntegerFieldUpdater.java b/jdk/src/share/classes/java/util/concurrent/atomic/AtomicIntegerFieldUpdater.java index 9f4fee4aa84..dc26f4c0ba7 100644 --- a/jdk/src/share/classes/java/util/concurrent/atomic/AtomicIntegerFieldUpdater.java +++ b/jdk/src/share/classes/java/util/concurrent/atomic/AtomicIntegerFieldUpdater.java @@ -35,7 +35,11 @@ package java.util.concurrent.atomic; import sun.misc.Unsafe; -import java.lang.reflect.*; +import java.lang.reflect.Field; +import java.lang.reflect.Modifier; +import java.security.AccessController; +import java.security.PrivilegedExceptionAction; +import java.security.PrivilegedActionException; /** * A reflection-based utility that enables atomic updates to @@ -67,7 +71,9 @@ public abstract class AtomicIntegerFieldUpdater { * @throws IllegalArgumentException if the field is not a * volatile integer type * @throws RuntimeException with a nested reflection-based - * exception if the class does not hold field or is the wrong type + * exception if the class does not hold field or is the wrong type, + * or the field is inaccessible to the caller according to Java language + * access control */ public static AtomicIntegerFieldUpdater newUpdater(Class tclass, String fieldName) { return new AtomicIntegerFieldUpdaterImpl(tclass, fieldName); @@ -267,17 +273,29 @@ public abstract class AtomicIntegerFieldUpdater { private final Class tclass; private final Class cclass; - AtomicIntegerFieldUpdaterImpl(Class tclass, String fieldName) { + AtomicIntegerFieldUpdaterImpl(final Class tclass, final String fieldName) { Field field = null; Class caller = null; int modifiers = 0; try { - field = tclass.getDeclaredField(fieldName); + field = AccessController.doPrivileged( + new PrivilegedExceptionAction() { + public Field run() throws NoSuchFieldException { + return tclass.getDeclaredField(fieldName); + } + }); caller = sun.reflect.Reflection.getCallerClass(3); modifiers = field.getModifiers(); sun.reflect.misc.ReflectUtil.ensureMemberAccess( caller, tclass, null, modifiers); - sun.reflect.misc.ReflectUtil.checkPackageAccess(tclass); + ClassLoader cl = tclass.getClassLoader(); + ClassLoader ccl = caller.getClassLoader(); + if ((ccl != null) && (ccl != cl) && + ((cl == null) || !isAncestor(cl, ccl))) { + sun.reflect.misc.ReflectUtil.checkPackageAccess(tclass); + } + } catch (PrivilegedActionException pae) { + throw new RuntimeException(pae.getException()); } catch (Exception ex) { throw new RuntimeException(ex); } @@ -295,6 +313,22 @@ public abstract class AtomicIntegerFieldUpdater { offset = unsafe.objectFieldOffset(field); } + /** + * Returns true if the second classloader can be found in the first + * classloader's delegation chain. + * Equivalent to the inaccessible: first.isAncestor(second). + */ + private static boolean isAncestor(ClassLoader first, ClassLoader second) { + ClassLoader acl = first; + do { + acl = acl.getParent(); + if (second == acl) { + return true; + } + } while (acl != null); + return false; + } + private void fullCheck(T obj) { if (!tclass.isInstance(obj)) throw new ClassCastException(); diff --git a/jdk/src/share/classes/java/util/concurrent/atomic/AtomicLongFieldUpdater.java b/jdk/src/share/classes/java/util/concurrent/atomic/AtomicLongFieldUpdater.java index ccc5acbfe21..3311aecdbfb 100644 --- a/jdk/src/share/classes/java/util/concurrent/atomic/AtomicLongFieldUpdater.java +++ b/jdk/src/share/classes/java/util/concurrent/atomic/AtomicLongFieldUpdater.java @@ -35,7 +35,11 @@ package java.util.concurrent.atomic; import sun.misc.Unsafe; -import java.lang.reflect.*; +import java.lang.reflect.Field; +import java.lang.reflect.Modifier; +import java.security.AccessController; +import java.security.PrivilegedExceptionAction; +import java.security.PrivilegedActionException; /** * A reflection-based utility that enables atomic updates to @@ -67,7 +71,9 @@ public abstract class AtomicLongFieldUpdater { * @throws IllegalArgumentException if the field is not a * volatile long type. * @throws RuntimeException with a nested reflection-based - * exception if the class does not hold field or is the wrong type. + * exception if the class does not hold field or is the wrong type, + * or the field is inaccessible to the caller according to Java language + * access control */ public static AtomicLongFieldUpdater newUpdater(Class tclass, String fieldName) { if (AtomicLong.VM_SUPPORTS_LONG_CAS) @@ -267,17 +273,29 @@ public abstract class AtomicLongFieldUpdater { private final Class tclass; private final Class cclass; - CASUpdater(Class tclass, String fieldName) { + CASUpdater(final Class tclass, final String fieldName) { Field field = null; Class caller = null; int modifiers = 0; try { - field = tclass.getDeclaredField(fieldName); + field = AccessController.doPrivileged( + new PrivilegedExceptionAction() { + public Field run() throws NoSuchFieldException { + return tclass.getDeclaredField(fieldName); + } + }); caller = sun.reflect.Reflection.getCallerClass(3); modifiers = field.getModifiers(); sun.reflect.misc.ReflectUtil.ensureMemberAccess( caller, tclass, null, modifiers); - sun.reflect.misc.ReflectUtil.checkPackageAccess(tclass); + ClassLoader cl = tclass.getClassLoader(); + ClassLoader ccl = caller.getClassLoader(); + if ((ccl != null) && (ccl != cl) && + ((cl == null) || !isAncestor(cl, ccl))) { + sun.reflect.misc.ReflectUtil.checkPackageAccess(tclass); + } + } catch (PrivilegedActionException pae) { + throw new RuntimeException(pae.getException()); } catch (Exception ex) { throw new RuntimeException(ex); } @@ -350,17 +368,29 @@ public abstract class AtomicLongFieldUpdater { private final Class tclass; private final Class cclass; - LockedUpdater(Class tclass, String fieldName) { + LockedUpdater(final Class tclass, final String fieldName) { Field field = null; Class caller = null; int modifiers = 0; try { - field = tclass.getDeclaredField(fieldName); + field = AccessController.doPrivileged( + new PrivilegedExceptionAction() { + public Field run() throws NoSuchFieldException { + return tclass.getDeclaredField(fieldName); + } + }); caller = sun.reflect.Reflection.getCallerClass(3); modifiers = field.getModifiers(); sun.reflect.misc.ReflectUtil.ensureMemberAccess( caller, tclass, null, modifiers); - sun.reflect.misc.ReflectUtil.checkPackageAccess(tclass); + ClassLoader cl = tclass.getClassLoader(); + ClassLoader ccl = caller.getClassLoader(); + if ((ccl != null) && (ccl != cl) && + ((cl == null) || !isAncestor(cl, ccl))) { + sun.reflect.misc.ReflectUtil.checkPackageAccess(tclass); + } + } catch (PrivilegedActionException pae) { + throw new RuntimeException(pae.getException()); } catch (Exception ex) { throw new RuntimeException(ex); } @@ -433,4 +463,20 @@ public abstract class AtomicLongFieldUpdater { ); } } + + /** + * Returns true if the second classloader can be found in the first + * classloader's delegation chain. + * Equivalent to the inaccessible: first.isAncestor(second). + */ + private static boolean isAncestor(ClassLoader first, ClassLoader second) { + ClassLoader acl = first; + do { + acl = acl.getParent(); + if (second == acl) { + return true; + } + } while (acl != null); + return false; + } } diff --git a/jdk/src/share/classes/java/util/concurrent/atomic/AtomicReferenceFieldUpdater.java b/jdk/src/share/classes/java/util/concurrent/atomic/AtomicReferenceFieldUpdater.java index f2e0118aae7..bba703e67ec 100644 --- a/jdk/src/share/classes/java/util/concurrent/atomic/AtomicReferenceFieldUpdater.java +++ b/jdk/src/share/classes/java/util/concurrent/atomic/AtomicReferenceFieldUpdater.java @@ -35,7 +35,11 @@ package java.util.concurrent.atomic; import sun.misc.Unsafe; -import java.lang.reflect.*; +import java.lang.reflect.Field; +import java.lang.reflect.Modifier; +import java.security.AccessController; +import java.security.PrivilegedExceptionAction; +import java.security.PrivilegedActionException; /** * A reflection-based utility that enables atomic updates to @@ -86,7 +90,9 @@ public abstract class AtomicReferenceFieldUpdater { * @return the updater * @throws IllegalArgumentException if the field is not a volatile reference type. * @throws RuntimeException with a nested reflection-based - * exception if the class does not hold field or is the wrong type. + * exception if the class does not hold field or is the wrong type, + * or the field is inaccessible to the caller according to Java language + * access control */ public static AtomicReferenceFieldUpdater newUpdater(Class tclass, Class vclass, String fieldName) { return new AtomicReferenceFieldUpdaterImpl(tclass, @@ -197,21 +203,33 @@ public abstract class AtomicReferenceFieldUpdater { * screenings fail. */ - AtomicReferenceFieldUpdaterImpl(Class tclass, + AtomicReferenceFieldUpdaterImpl(final Class tclass, Class vclass, - String fieldName) { + final String fieldName) { Field field = null; Class fieldClass = null; Class caller = null; int modifiers = 0; try { - field = tclass.getDeclaredField(fieldName); + field = AccessController.doPrivileged( + new PrivilegedExceptionAction() { + public Field run() throws NoSuchFieldException { + return tclass.getDeclaredField(fieldName); + } + }); caller = sun.reflect.Reflection.getCallerClass(3); modifiers = field.getModifiers(); sun.reflect.misc.ReflectUtil.ensureMemberAccess( - caller, tclass, null, modifiers); - sun.reflect.misc.ReflectUtil.checkPackageAccess(tclass); + caller, tclass, null, modifiers); + ClassLoader cl = tclass.getClassLoader(); + ClassLoader ccl = caller.getClassLoader(); + if ((ccl != null) && (ccl != cl) && + ((cl == null) || !isAncestor(cl, ccl))) { + sun.reflect.misc.ReflectUtil.checkPackageAccess(tclass); + } fieldClass = field.getType(); + } catch (PrivilegedActionException pae) { + throw new RuntimeException(pae.getException()); } catch (Exception ex) { throw new RuntimeException(ex); } @@ -232,6 +250,22 @@ public abstract class AtomicReferenceFieldUpdater { offset = unsafe.objectFieldOffset(field); } + /** + * Returns true if the second classloader can be found in the first + * classloader's delegation chain. + * Equivalent to the inaccessible: first.isAncestor(second). + */ + private static boolean isAncestor(ClassLoader first, ClassLoader second) { + ClassLoader acl = first; + do { + acl = acl.getParent(); + if (second == acl) { + return true; + } + } while (acl != null); + return false; + } + void targetCheck(T obj) { if (!tclass.isInstance(obj)) throw new ClassCastException(); @@ -281,7 +315,7 @@ public abstract class AtomicReferenceFieldUpdater { } @SuppressWarnings("unchecked") - public V get(T obj) { + public V get(T obj) { if (obj == null || obj.getClass() != tclass || cclass != null) targetCheck(obj); return (V)unsafe.getObjectVolatile(obj, offset); @@ -292,14 +326,14 @@ public abstract class AtomicReferenceFieldUpdater { return; } throw new RuntimeException( - new IllegalAccessException("Class " + - cclass.getName() + - " can not access a protected member of class " + - tclass.getName() + - " using an instance of " + - obj.getClass().getName() - ) - ); + new IllegalAccessException("Class " + + cclass.getName() + + " can not access a protected member of class " + + tclass.getName() + + " using an instance of " + + obj.getClass().getName() + ) + ); } } } diff --git a/jdk/test/java/util/concurrent/atomic/AtomicUpdaters.java b/jdk/test/java/util/concurrent/atomic/AtomicUpdaters.java new file mode 100644 index 00000000000..62d066914d2 --- /dev/null +++ b/jdk/test/java/util/concurrent/atomic/AtomicUpdaters.java @@ -0,0 +1,189 @@ +/* + * Copyright (c) 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. + */ + +/* + * @test + * @bug 7103570 + * @author David Holmes + * @run main/othervm AtomicUpdaters + * @run main/othervm AtomicUpdaters UseSM + * @summary Checks the (in)ability to create field updaters for differently + * accessible fields in different locations with/without a security + * manager + */ +import java.util.concurrent.atomic.*; +import java.lang.reflect.*; +import java.security.AccessControlException; + +public class AtomicUpdaters { + enum TYPE { INT, LONG, REF } + + static class Config { + final Class clazz; + final String field; + final String access; + final boolean reflectOk; + final boolean updaterOk; + final String desc; + final TYPE type; + + Config(Class clazz, String field, String access, + boolean reflectOk, boolean updaterOk, String desc, TYPE type) { + this.clazz = clazz; + this.field = field; + this.access = access; + this.reflectOk = reflectOk; + this.updaterOk = updaterOk; + this.desc = desc; + this.type =type; + } + + public String toString() { + return desc + ": " + access + " " + clazz.getName() + "." + field; + } + } + + static Config[] tests; + + static void initTests(boolean hasSM) { + tests = new Config[] { + new Config(AtomicUpdaters.class, "pub_int", "public", true, true, "public int field of current class", TYPE.INT), + new Config(AtomicUpdaters.class, "priv_int", "private", true, true, "private int field of current class", TYPE.INT), + new Config(AtomicUpdaters.class, "pub_long", "public", true, true, "public long field of current class", TYPE.LONG), + new Config(AtomicUpdaters.class, "priv_long", "private", true, true, "private long field of current class", TYPE.LONG), + new Config(AtomicUpdaters.class, "pub_ref", "public", true, true, "public ref field of current class", TYPE.REF), + new Config(AtomicUpdaters.class, "priv_ref", "private", true, true, "private ref field of current class", TYPE.REF), + + // Would like to test a public volatile in a class in another + // package - but of course there aren't any + new Config(java.util.concurrent.atomic.AtomicInteger.class, "value", "private", hasSM ? false : true, false, "private int field of class in different package", TYPE.INT), + new Config(java.util.concurrent.atomic.AtomicLong.class, "value", "private", hasSM ? false : true, false, "private long field of class in different package", TYPE.LONG), + new Config(java.util.concurrent.atomic.AtomicReference.class, "value", "private", hasSM ? false : true, false, "private reference field of class in different package", TYPE.REF), + }; + } + + public volatile int pub_int; + private volatile int priv_int; + public volatile long pub_long; + private volatile long priv_long; + public volatile Object pub_ref; + private volatile Object priv_ref; + + + // This should be set dynamically at runtime using a System property, but + // ironically we get a SecurityException if we try to do that with a + // SecurityManager installed + static boolean verbose; + + public static void main(String[] args) throws Throwable { + boolean hasSM = false; + for (String arg : args) { + if ("-v".equals(arg)) { + verbose = true; + } + else if ("UseSM".equals(arg)) { + SecurityManager m = System.getSecurityManager(); + if (m != null) + throw new RuntimeException("No security manager should initially be installed"); + System.setSecurityManager(new java.lang.SecurityManager()); + hasSM = true; + } + else { + throw new IllegalArgumentException("Unexpected option: " + arg); + } + } + initTests(hasSM); + + int failures = 0; + + System.out.printf("Testing with%s a SecurityManager present\n", hasSM ? "" : "out"); + for (Config c : tests) { + System.out.println("Testing: " + c); + Error reflectionFailure = null; + Error updaterFailure = null; + Class clazz = c.clazz; + // See if we can reflectively access the field + System.out.println(" - testing getDeclaredField"); + try { + Field f = clazz.getDeclaredField(c.field); + if (!c.reflectOk) + reflectionFailure = new Error("Unexpected reflective access: " + c); + } + catch (AccessControlException e) { + if (c.reflectOk) + reflectionFailure = new Error("Unexpected reflective access failure: " + c, e); + else if (verbose) { + System.out.println("Got expected reflection exception: " + e); + e.printStackTrace(System.out); + } + } + + if (reflectionFailure != null) { + reflectionFailure.printStackTrace(System.out); + } + + // see if we can create an atomic updater for the field + Object u = null; + try { + switch (c.type) { + case INT: + System.out.println(" - testing AtomicIntegerFieldUpdater"); + u = AtomicIntegerFieldUpdater.newUpdater(clazz, c.field); + break; + case LONG: + System.out.println(" - testing AtomicLongFieldUpdater"); + u = AtomicLongFieldUpdater.newUpdater(clazz, c.field); + break; + case REF: + System.out.println(" - testing AtomicReferenceFieldUpdater"); + u = AtomicReferenceFieldUpdater.newUpdater(clazz, Object.class, c.field); + break; + } + + if (!c.updaterOk) + updaterFailure = new Error("Unexpected updater access: " + c); + } + catch (Exception e) { + if (c.updaterOk) + updaterFailure = new Error("Unexpected updater access failure: " + c, e); + else if (verbose) { + System.out.println("Got expected updater exception: " + e); + e.printStackTrace(System.out); + } + } + + if (updaterFailure != null) { + updaterFailure.printStackTrace(System.out); + } + + if (updaterFailure != null || reflectionFailure != null) { + failures++; + + } + } + + if (failures > 0) { + throw new Error("Some tests failed - see previous stacktraces"); + } + } +} From c8da8f2595f948524a869ff5928303a029ad9e98 Mon Sep 17 00:00:00 2001 From: Xueming Shen Date: Tue, 8 May 2012 10:57:13 -0700 Subject: [PATCH 015/128] 7014640: To add a metachar \R for line ending and character classes for vertical/horizontal ws \v \V \h \H Added propsoed constructs Reviewed-by: alanb --- .../classes/java/util/regex/Pattern.java | 140 +++++++++++++----- jdk/test/java/util/regex/RegExTest.java | 84 ++++++++++- 2 files changed, 189 insertions(+), 35 deletions(-) diff --git a/jdk/src/share/classes/java/util/regex/Pattern.java b/jdk/src/share/classes/java/util/regex/Pattern.java index 626d5b08657..6c32f6a30bb 100644 --- a/jdk/src/share/classes/java/util/regex/Pattern.java +++ b/jdk/src/share/classes/java/util/regex/Pattern.java @@ -152,15 +152,24 @@ import java.util.Arrays; * A digit: [0-9] * \D * A non-digit: [^0-9] + * \h + * A horizontal whitespace character: + * [ \t\xA0\u1680\u180e\u2000-\u200a\u202f\u205f\u3000] + * \H + * A non-horizontal whitespace character: [^\h] * \s * A whitespace character: [ \t\n\x0B\f\r] * \S * A non-whitespace character: [^\s] + * \v + * A vertical whitespace character: [\n\x0B\f\r\x85\u2028\u2029] + * + * \V + * A non-vertical whitespace character: [^\v] * \w * A word character: [a-zA-Z_0-9] * \W * A non-word character: [^\w] - * *   * POSIX character classes (US-ASCII only) * @@ -244,6 +253,13 @@ import java.util.Arrays; * The end of the input * *   + * Linebreak matcher + * \R + * Any Unicode linebreak sequence, is equivalent to + * \u000D\u000A|[\u000A\u000B\u000C\u000D\u0085\u2028\u2029] + * + * + *   * Greedy quantifiers * * X? @@ -599,11 +615,9 @@ import java.util.Arrays; *

  • Noncharacter_Code_Point *
  • Assigned * - - *

    - * Predefined Character classes and POSIX character classes are in - * conformance with the recommendation of Annex C: Compatibility Properties + * The following Predefined Character classes and POSIX character classes + * are in conformance with the recommendation of Annex C: Compatibility Properties * of Unicode Regular Expression * , when {@link #UNICODE_CHARACTER_CLASS} flag is specified. *

    @@ -668,12 +682,6 @@ import java.util.Arrays; * *

      *
    • Predefined character classes (Unicode character) - *

      \h    A horizontal whitespace - *

      \H    A non horizontal whitespace - *

      \v    A vertical whitespace - *

      \V    A non vertical whitespace - *

      \R    Any Unicode linebreak sequence - * \u005cu000D\u005cu000A|[\u005cu000A\u005cu000B\u005cu000C\u005cu000D\u005cu0085\u005cu2028\u005cu2029] *

      \X    Match Unicode * * extended grapheme cluster @@ -2178,7 +2186,7 @@ loop: for(int x=0, offset=0; x= 0) { append(ch, first); first++; @@ -2276,7 +2284,7 @@ loop: for(int x=0, offset=0; x= 0) { if (peek() == '-') { @@ -2606,9 +2636,15 @@ loop: for(int x=0, offset=0; x= 0x0A && cp <= 0x0D) || + cp == 0x85 || cp == 0x2028 || cp == 0x2029; + } + } + + /** + * Node class that matches a Perl horizontal whitespace + */ + static final class HorizWS extends BmpCharProperty { + boolean isSatisfiedBy(int cp) { + return cp == 0x09 || cp == 0x20 || cp == 0xa0 || + cp == 0x1680 || cp == 0x180e || + cp >= 0x2000 && cp <= 0x200a || + cp == 0x202f || cp == 0x205f || cp == 0x3000; + } + } + /** * Base class for all Slice nodes */ diff --git a/jdk/test/java/util/regex/RegExTest.java b/jdk/test/java/util/regex/RegExTest.java index f583769ecb2..7846f5c05e3 100644 --- a/jdk/test/java/util/regex/RegExTest.java +++ b/jdk/test/java/util/regex/RegExTest.java @@ -33,7 +33,7 @@ * 5013885 5003322 4988891 5098443 5110268 6173522 4829857 5027748 6376940 * 6358731 6178785 6284152 6231989 6497148 6486934 6233084 6504326 6635133 * 6350801 6676425 6878475 6919132 6931676 6948903 6990617 7014645 7039066 - * 7067045 + * 7067045 7014640 */ import java.util.regex.*; @@ -141,6 +141,8 @@ public class RegExTest { unicodePropertiesTest(); unicodeHexNotationTest(); unicodeClassesTest(); + horizontalAndVerticalWSTest(); + linebreakTest(); if (failure) { throw new RuntimeException("RegExTest failed, 1st failure: " + @@ -857,13 +859,18 @@ public class RegExTest { // in replacement string try { "\uac00".replaceAll("\uac00", "$"); + failCount++; + } catch (IllegalArgumentException iie) { + } catch (Exception e) { + failCount++; + } + try { "\uac00".replaceAll("\uac00", "\\"); failCount++; } catch (IllegalArgumentException iie) { } catch (Exception e) { failCount++; } - report("Literal replacement"); } @@ -3838,4 +3845,77 @@ public class RegExTest { failCount++; report("unicodePredefinedClasses"); } + + private static void horizontalAndVerticalWSTest() throws Exception { + String hws = new String (new char[] { + 0x09, 0x20, 0xa0, 0x1680, 0x180e, + 0x2000, 0x2001, 0x2002, 0x2003, 0x2004, 0x2005, + 0x2006, 0x2007, 0x2008, 0x2009, 0x200a, + 0x202f, 0x205f, 0x3000 }); + String vws = new String (new char[] { + 0x0a, 0x0b, 0x0c, 0x0d, 0x85, 0x2028, 0x2029 }); + if (!Pattern.compile("\\h+").matcher(hws).matches() || + !Pattern.compile("[\\h]+").matcher(hws).matches()) + failCount++; + if (Pattern.compile("\\H").matcher(hws).find() || + Pattern.compile("[\\H]").matcher(hws).find()) + failCount++; + if (!Pattern.compile("\\v+").matcher(vws).matches() || + !Pattern.compile("[\\v]+").matcher(vws).matches()) + failCount++; + if (Pattern.compile("\\V").matcher(vws).find() || + Pattern.compile("[\\V]").matcher(vws).find()) + failCount++; + String prefix = "abcd"; + String suffix = "efgh"; + String ng = "A"; + for (int i = 0; i < hws.length(); i++) { + String c = String.valueOf(hws.charAt(i)); + Matcher m = Pattern.compile("\\h").matcher(prefix + c + suffix); + if (!m.find() || !c.equals(m.group())) + failCount++; + m = Pattern.compile("[\\h]").matcher(prefix + c + suffix); + if (!m.find() || !c.equals(m.group())) + failCount++; + + m = Pattern.compile("\\H").matcher(hws.substring(0, i) + ng + hws.substring(i)); + if (!m.find() || !ng.equals(m.group())) + failCount++; + m = Pattern.compile("[\\H]").matcher(hws.substring(0, i) + ng + hws.substring(i)); + if (!m.find() || !ng.equals(m.group())) + failCount++; + } + for (int i = 0; i < vws.length(); i++) { + String c = String.valueOf(vws.charAt(i)); + Matcher m = Pattern.compile("\\v").matcher(prefix + c + suffix); + if (!m.find() || !c.equals(m.group())) + failCount++; + m = Pattern.compile("[\\v]").matcher(prefix + c + suffix); + if (!m.find() || !c.equals(m.group())) + failCount++; + + m = Pattern.compile("\\V").matcher(vws.substring(0, i) + ng + vws.substring(i)); + if (!m.find() || !ng.equals(m.group())) + failCount++; + m = Pattern.compile("[\\V]").matcher(vws.substring(0, i) + ng + vws.substring(i)); + if (!m.find() || !ng.equals(m.group())) + failCount++; + } + // \v in range is interpreted as 0x0B. This is the undocumented behavior + if (!Pattern.compile("[\\v-\\v]").matcher(String.valueOf((char)0x0B)).matches()) + failCount++; + report("horizontalAndVerticalWSTest"); + } + + private static void linebreakTest() throws Exception { + String linebreaks = new String (new char[] { + 0x0A, 0x0B, 0x0C, 0x0D, 0x85, 0x2028, 0x2029 }); + String crnl = "\r\n"; + if (!Pattern.compile("\\R+").matcher(linebreaks).matches() || + !Pattern.compile("\\R").matcher(crnl).matches() || + Pattern.compile("\\R\\R").matcher(crnl).matches()) + failCount++; + report("linebreakTest"); + } + } From 30fb5c814637dacb4d0d581ddb9736cb89492931 Mon Sep 17 00:00:00 2001 From: Paul Sandoz Date: Tue, 8 May 2012 11:16:36 -0700 Subject: [PATCH 016/128] 7157656: (zipfs) SeekableByteChannel to entry in zip file always reports its position as 0 Updated SeekableByteChannel.read() to count the bytes read correctly Reviewed-by: sherman --- .../src/com/sun/nio/zipfs/ZipFileSystem.java | 6 ++- jdk/test/demo/zipfs/ZipFSTester.java | 41 +++++++++++++++++++ jdk/test/demo/zipfs/basic.sh | 1 + 3 files changed, 47 insertions(+), 1 deletion(-) diff --git a/jdk/src/share/demo/nio/zipfs/src/com/sun/nio/zipfs/ZipFileSystem.java b/jdk/src/share/demo/nio/zipfs/src/com/sun/nio/zipfs/ZipFileSystem.java index d68388a97f3..44d3e809993 100644 --- a/jdk/src/share/demo/nio/zipfs/src/com/sun/nio/zipfs/ZipFileSystem.java +++ b/jdk/src/share/demo/nio/zipfs/src/com/sun/nio/zipfs/ZipFileSystem.java @@ -651,7 +651,11 @@ public class ZipFileSystem extends FileSystem { } public int read(ByteBuffer dst) throws IOException { - return rbc.read(dst); + int n = rbc.read(dst); + if (n > 0) { + read += n; + } + return n; } public SeekableByteChannel truncate(long size) diff --git a/jdk/test/demo/zipfs/ZipFSTester.java b/jdk/test/demo/zipfs/ZipFSTester.java index 4969c21f361..0d512cc1f98 100644 --- a/jdk/test/demo/zipfs/ZipFSTester.java +++ b/jdk/test/demo/zipfs/ZipFSTester.java @@ -540,6 +540,20 @@ public class ZipFSTester { bbSrc.flip(); bbDst.flip(); } + + // Check if source read position is at the end + if (chSrc.position() != chSrc.size()) { + System.out.printf("src[%s]: size=%d, position=%d%n", + chSrc.toString(), chSrc.size(), chSrc.position()); + throw new RuntimeException("CHECK FAILED!"); + } + + // Check if destination read position is at the end + if (chDst.position() != chDst.size()) { + System.out.printf("dst[%s]: size=%d, position=%d%n", + chDst.toString(), chDst.size(), chDst.position()); + throw new RuntimeException("CHECK FAILED!"); + } } catch (IOException x) { x.printStackTrace(); } @@ -587,6 +601,20 @@ public class ZipFSTester { dstCh.write(bb); bb.clear(); } + + // Check if source read position is at the end + if (srcCh.position() != srcCh.size()) { + System.out.printf("src[%s]: size=%d, position=%d%n", + srcCh.toString(), srcCh.size(), srcCh.position()); + throw new RuntimeException("CHECK FAILED!"); + } + + // Check if destination write position is at the end + if (dstCh.position() != dstCh.size()) { + System.out.printf("dst[%s]: size=%d, position=%d%n", + dstCh.toString(), dstCh.size(), dstCh.position()); + throw new RuntimeException("CHECK FAILED!"); + } } } @@ -616,10 +644,17 @@ public class ZipFSTester { try (SeekableByteChannel sbc = Files.newByteChannel(path)) { System.out.printf(" sbc[0]: pos=%d, size=%d%n", sbc.position(), sbc.size()); + if (sbc.position() != 0) { + throw new RuntimeException("CHECK FAILED!"); + } + bb = ByteBuffer.allocate((int)sbc.size()); n = sbc.read(bb); System.out.printf(" sbc[1]: read=%d, pos=%d, size=%d%n", n, sbc.position(), sbc.size()); + if (sbc.position() != sbc.size()) { + throw new RuntimeException("CHECK FAILED!"); + } bb2 = ByteBuffer.allocate((int)sbc.size()); } @@ -629,10 +664,16 @@ public class ZipFSTester { sbc.position(N); System.out.printf(" sbc[2]: pos=%d, size=%d%n", sbc.position(), sbc.size()); + if (sbc.position() != N) { + throw new RuntimeException("CHECK FAILED!"); + } bb2.limit(100); n = sbc.read(bb2); System.out.printf(" sbc[3]: read=%d, pos=%d, size=%d%n", n, sbc.position(), sbc.size()); + if (n < 0 || sbc.position() != (N + n)) { + throw new RuntimeException("CHECK FAILED!"); + } System.out.printf(" sbc[4]: bb[%d]=%d, bb1[0]=%d%n", N, bb.get(N) & 0xff, bb2.get(0) & 0xff); } diff --git a/jdk/test/demo/zipfs/basic.sh b/jdk/test/demo/zipfs/basic.sh index 40dc0c0a19d..7188c181ed8 100644 --- a/jdk/test/demo/zipfs/basic.sh +++ b/jdk/test/demo/zipfs/basic.sh @@ -22,6 +22,7 @@ # # @test # @bug 6990846 7009092 7009085 7015391 7014948 7005986 7017840 7007596 +# 7157656 # @summary Test ZipFileSystem demo # @build Basic PathOps ZipFSTester # @run shell basic.sh From 833a064cfe6b37d21be7f3fae6345c60f6730e58 Mon Sep 17 00:00:00 2001 From: Krystal Mok Date: Tue, 8 May 2012 20:28:35 +0200 Subject: [PATCH 017/128] 7162726: Wrong filter predicate of visible locals in SA JSJavaFrame Reviewed-by: sla, dcubed --- .../classes/sun/jvm/hotspot/utilities/soql/JSJavaFrame.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/hotspot/agent/src/share/classes/sun/jvm/hotspot/utilities/soql/JSJavaFrame.java b/hotspot/agent/src/share/classes/sun/jvm/hotspot/utilities/soql/JSJavaFrame.java index 0efd2443bf8..cc3f216479f 100644 --- a/hotspot/agent/src/share/classes/sun/jvm/hotspot/utilities/soql/JSJavaFrame.java +++ b/hotspot/agent/src/share/classes/sun/jvm/hotspot/utilities/soql/JSJavaFrame.java @@ -153,7 +153,8 @@ public class JSJavaFrame extends DefaultScriptObject { List visibleVars = new ArrayList(0); for (int i = 0; i < localVars.length; i++) { LocalVariableTableElement cur = localVars[i]; - if (cur.getStartBCI() >= bci && cur.getLength() > 0) { + int startBCI = cur.getStartBCI(); + if (startBCI <= bci && bci < startBCI + cur.getLength()) { visibleVars.add(cur); } } From f44a8ebe074d55d5bf68a6e72a8e578fcb13a4f5 Mon Sep 17 00:00:00 2001 From: Xue-Lei Andrew Fan Date: Tue, 8 May 2012 17:56:18 -0700 Subject: [PATCH 018/128] 7167092: Need to put the return clause in the synchronized block A regression fix for bug 7153184 Reviewed-by: wetmore --- .../sun/security/ssl/SSLContextImpl.java | 28 ++++++++----------- 1 file changed, 11 insertions(+), 17 deletions(-) diff --git a/jdk/src/share/classes/sun/security/ssl/SSLContextImpl.java b/jdk/src/share/classes/sun/security/ssl/SSLContextImpl.java index bb57a61f828..1a5a8cf78ef 100644 --- a/jdk/src/share/classes/sun/security/ssl/SSLContextImpl.java +++ b/jdk/src/share/classes/sun/security/ssl/SSLContextImpl.java @@ -276,39 +276,33 @@ public abstract class SSLContextImpl extends SSLContextSpi { supportedCipherSuiteList = getApplicableCipherSuiteList( getSuportedProtocolList(), false); } - } - return supportedCipherSuiteList; + return supportedCipherSuiteList; + } } // Get default CipherSuiteList. CipherSuiteList getDefaultCipherSuiteList(boolean roleIsServer) { - if (roleIsServer) { - // The maintenance of cipher suites needs to be synchronized. - synchronized (this) { - // Clear cache of available ciphersuites. - clearAvailableCache(); + // The maintenance of cipher suites needs to be synchronized. + synchronized (this) { + // Clear cache of available ciphersuites. + clearAvailableCache(); + if (roleIsServer) { if (defaultServerCipherSuiteList == null) { defaultServerCipherSuiteList = getApplicableCipherSuiteList( getDefaultProtocolList(true), true); } - } - - return defaultServerCipherSuiteList; - } else { - // The maintenance of cipher suites needs to be synchronized - synchronized (this) { - // Clear cache of available ciphersuites. - clearAvailableCache(); + return defaultServerCipherSuiteList; + } else { if (defaultClientCipherSuiteList == null) { defaultClientCipherSuiteList = getApplicableCipherSuiteList( getDefaultProtocolList(false), true); } - } - return defaultClientCipherSuiteList; + return defaultClientCipherSuiteList; + } } } From 879e30901ed676e0ff1c2c52b4bee3dde167dacd Mon Sep 17 00:00:00 2001 From: Valerie Peng Date: Tue, 8 May 2012 17:57:48 -0700 Subject: [PATCH 019/128] 4963723: Implement SHA-224 Add support for SHA-224, SHA224withRSA, SHA224withECDSA, HmacSHA224 and OAEPwithSHA-224AndMGF1Padding. Reviewed-by: vinnie --- .../com/sun/crypto/provider/HmacCore.java | 159 +++++------------- .../com/sun/crypto/provider/HmacMD5.java | 92 +--------- .../crypto/provider/HmacPKCS12PBESHA1.java | 81 +-------- .../com/sun/crypto/provider/HmacSHA1.java | 92 +--------- .../sun/crypto/provider/KeyGeneratorCore.java | 63 +++---- .../sun/crypto/provider/OAEPParameters.java | 6 +- .../com/sun/crypto/provider/SunJCE.java | 36 +++- .../java/security/spec/MGF1ParameterSpec.java | 8 +- .../java/security/spec/PSSParameterSpec.java | 3 +- .../sun/security/ec/ECDSASignature.java | 10 +- .../classes/sun/security/ec/SunECEntries.java | 17 +- .../sun/security/pkcs11/P11Digest.java | 5 +- .../classes/sun/security/pkcs11/P11Mac.java | 9 +- .../sun/security/pkcs11/P11Signature.java | 10 ++ .../sun/security/pkcs11/SunPKCS11.java | 28 ++- .../security/pkcs11/wrapper/Functions.java | 7 +- .../sun/security/provider/DigestBase.java | 27 +-- .../classes/sun/security/provider/MD2.java | 21 +-- .../classes/sun/security/provider/MD4.java | 18 +- .../classes/sun/security/provider/MD5.java | 18 +- .../classes/sun/security/provider/SHA.java | 19 +-- .../classes/sun/security/provider/SHA2.java | 72 +++++--- .../classes/sun/security/provider/SHA5.java | 38 +---- .../sun/security/provider/SunEntries.java | 18 +- .../sun/security/rsa/RSASignature.java | 13 +- .../sun/security/rsa/SunRsaSignEntries.java | 8 +- .../sun/security/x509/AlgorithmId.java | 30 +++- .../sun/security/mscapi/RSASignature.java | 13 +- .../sun/security/mscapi/SunMSCAPI.java | 20 ++- .../crypto/provider/Cipher/RSA/TestOAEP.java | 16 +- .../Cipher/RSA/TestOAEPParameterSpec.java | 3 +- .../Cipher/RSA/TestOAEPWithParams.java | 6 +- .../provider/KeyGenerator/Test4628062.java | 68 +++++--- .../com/sun/crypto/provider/Mac/MacClone.java | 46 ++++- .../com/sun/crypto/provider/Mac/MacKAT.java | 29 +++- .../security/mscapi/SignUsingNONEwithRSA.java | 8 +- .../security/mscapi/SignUsingSHA2withRSA.java | 6 +- .../pkcs11/MessageDigest/DigestKAT.java | 8 +- .../pkcs11/MessageDigest/TestCloning.java | 2 +- .../pkcs11/Signature/TestRSAKeyLength.java | 4 +- .../sun/security/pkcs11/ec/TestCurves.java | 3 +- .../pkcs11/rsa/TestKeyPairGenerator.java | 3 +- .../security/pkcs11/rsa/TestSignatures.java | 3 +- .../provider/MessageDigest/DigestKAT.java | 10 +- .../provider/MessageDigest/Offsets.java | 3 +- .../provider/MessageDigest/TestSHAClone.java | 6 +- .../security/rsa/TestKeyPairGenerator.java | 5 +- jdk/test/sun/security/rsa/TestSignatures.java | 5 +- 48 files changed, 542 insertions(+), 633 deletions(-) diff --git a/jdk/src/share/classes/com/sun/crypto/provider/HmacCore.java b/jdk/src/share/classes/com/sun/crypto/provider/HmacCore.java index 57aed3d0b0c..bc865c63f47 100644 --- a/jdk/src/share/classes/com/sun/crypto/provider/HmacCore.java +++ b/jdk/src/share/classes/com/sun/crypto/provider/HmacCore.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2002, 2011, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2002, 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 @@ -38,16 +38,16 @@ import java.security.spec.*; * This class constitutes the core of HMAC- algorithms, where * can be SHA1 or MD5, etc. See RFC 2104 for spec. * - * It also contains the implementation classes for the SHA-256, + * It also contains the implementation classes for SHA-224, SHA-256, * SHA-384, and SHA-512 HMACs. * * @author Jan Luehe */ -final class HmacCore implements Cloneable { +abstract class HmacCore extends MacSpi implements Cloneable { - private final MessageDigest md; - private final byte[] k_ipad; // inner padding - key XORd with ipad - private final byte[] k_opad; // outer padding - key XORd with opad + private MessageDigest md; + private byte[] k_ipad; // inner padding - key XORd with ipad + private byte[] k_opad; // outer padding - key XORd with opad private boolean first; // Is this the first data to be processed? private final int blockLen; @@ -72,23 +72,12 @@ final class HmacCore implements Cloneable { this(MessageDigest.getInstance(digestAlgorithm), bl); } - /** - * Constructor used for cloning. - */ - private HmacCore(HmacCore other) throws CloneNotSupportedException { - this.md = (MessageDigest)other.md.clone(); - this.blockLen = other.blockLen; - this.k_ipad = other.k_ipad.clone(); - this.k_opad = other.k_opad.clone(); - this.first = other.first; - } - /** * Returns the length of the HMAC in bytes. * * @return the HMAC length in bytes. */ - int getDigestLength() { + protected int engineGetMacLength() { return this.md.getDigestLength(); } @@ -103,9 +92,8 @@ final class HmacCore implements Cloneable { * @exception InvalidAlgorithmParameterException if the given algorithm * parameters are inappropriate for this MAC. */ - void init(Key key, AlgorithmParameterSpec params) + protected void engineInit(Key key, AlgorithmParameterSpec params) throws InvalidKeyException, InvalidAlgorithmParameterException { - if (params != null) { throw new InvalidAlgorithmParameterException ("HMAC does not use parameters"); @@ -140,7 +128,7 @@ final class HmacCore implements Cloneable { Arrays.fill(secret, (byte)0); secret = null; - reset(); + engineReset(); } /** @@ -148,7 +136,7 @@ final class HmacCore implements Cloneable { * * @param input the input byte to be processed. */ - void update(byte input) { + protected void engineUpdate(byte input) { if (first == true) { // compute digest for 1st pass; start with inner pad md.update(k_ipad); @@ -167,7 +155,7 @@ final class HmacCore implements Cloneable { * @param offset the offset in input where the input starts. * @param len the number of bytes to process. */ - void update(byte input[], int offset, int len) { + protected void engineUpdate(byte input[], int offset, int len) { if (first == true) { // compute digest for 1st pass; start with inner pad md.update(k_ipad); @@ -178,7 +166,13 @@ final class HmacCore implements Cloneable { md.update(input, offset, len); } - void update(ByteBuffer input) { + /** + * Processes the input.remaining() bytes in the ByteBuffer + * input. + * + * @param input the input byte buffer. + */ + protected void engineUpdate(ByteBuffer input) { if (first == true) { // compute digest for 1st pass; start with inner pad md.update(k_ipad); @@ -194,7 +188,7 @@ final class HmacCore implements Cloneable { * * @return the HMAC result. */ - byte[] doFinal() { + protected byte[] engineDoFinal() { if (first == true) { // compute digest for 1st pass; start with inner pad md.update(k_ipad); @@ -223,7 +217,7 @@ final class HmacCore implements Cloneable { * Resets the HMAC for further use, maintaining the secret key that the * HMAC was initialized with. */ - void reset() { + protected void engineReset() { if (first == false) { md.reset(); first = true; @@ -234,115 +228,38 @@ final class HmacCore implements Cloneable { * Clones this object. */ public Object clone() throws CloneNotSupportedException { - return new HmacCore(this); + HmacCore copy = (HmacCore) super.clone(); + copy.md = (MessageDigest) md.clone(); + copy.k_ipad = k_ipad.clone(); + copy.k_opad = k_opad.clone(); + return copy; + } + + // nested static class for the HmacSHA224 implementation + public static final class HmacSHA224 extends HmacCore { + public HmacSHA224() throws NoSuchAlgorithmException { + super("SHA-224", 64); + } } // nested static class for the HmacSHA256 implementation - public static final class HmacSHA256 extends MacSpi implements Cloneable { - private final HmacCore core; + public static final class HmacSHA256 extends HmacCore { public HmacSHA256() throws NoSuchAlgorithmException { - core = new HmacCore("SHA-256", 64); - } - private HmacSHA256(HmacSHA256 base) throws CloneNotSupportedException { - core = (HmacCore)base.core.clone(); - } - protected int engineGetMacLength() { - return core.getDigestLength(); - } - protected void engineInit(Key key, AlgorithmParameterSpec params) - throws InvalidKeyException, InvalidAlgorithmParameterException { - core.init(key, params); - } - protected void engineUpdate(byte input) { - core.update(input); - } - protected void engineUpdate(byte input[], int offset, int len) { - core.update(input, offset, len); - } - protected void engineUpdate(ByteBuffer input) { - core.update(input); - } - protected byte[] engineDoFinal() { - return core.doFinal(); - } - protected void engineReset() { - core.reset(); - } - public Object clone() throws CloneNotSupportedException { - return new HmacSHA256(this); + super("SHA-256", 64); } } // nested static class for the HmacSHA384 implementation - public static final class HmacSHA384 extends MacSpi implements Cloneable { - private final HmacCore core; + public static final class HmacSHA384 extends HmacCore { public HmacSHA384() throws NoSuchAlgorithmException { - core = new HmacCore("SHA-384", 128); - } - private HmacSHA384(HmacSHA384 base) throws CloneNotSupportedException { - core = (HmacCore)base.core.clone(); - } - protected int engineGetMacLength() { - return core.getDigestLength(); - } - protected void engineInit(Key key, AlgorithmParameterSpec params) - throws InvalidKeyException, InvalidAlgorithmParameterException { - core.init(key, params); - } - protected void engineUpdate(byte input) { - core.update(input); - } - protected void engineUpdate(byte input[], int offset, int len) { - core.update(input, offset, len); - } - protected void engineUpdate(ByteBuffer input) { - core.update(input); - } - protected byte[] engineDoFinal() { - return core.doFinal(); - } - protected void engineReset() { - core.reset(); - } - public Object clone() throws CloneNotSupportedException { - return new HmacSHA384(this); + super("SHA-384", 128); } } // nested static class for the HmacSHA512 implementation - public static final class HmacSHA512 extends MacSpi implements Cloneable { - private final HmacCore core; + public static final class HmacSHA512 extends HmacCore { public HmacSHA512() throws NoSuchAlgorithmException { - core = new HmacCore("SHA-512", 128); - } - private HmacSHA512(HmacSHA512 base) throws CloneNotSupportedException { - core = (HmacCore)base.core.clone(); - } - protected int engineGetMacLength() { - return core.getDigestLength(); - } - protected void engineInit(Key key, AlgorithmParameterSpec params) - throws InvalidKeyException, InvalidAlgorithmParameterException { - core.init(key, params); - } - protected void engineUpdate(byte input) { - core.update(input); - } - protected void engineUpdate(byte input[], int offset, int len) { - core.update(input, offset, len); - } - protected void engineUpdate(ByteBuffer input) { - core.update(input); - } - protected byte[] engineDoFinal() { - return core.doFinal(); - } - protected void engineReset() { - core.reset(); - } - public Object clone() throws CloneNotSupportedException { - return new HmacSHA512(this); + super("SHA-512", 128); } } - } diff --git a/jdk/src/share/classes/com/sun/crypto/provider/HmacMD5.java b/jdk/src/share/classes/com/sun/crypto/provider/HmacMD5.java index a4d9f4d46f4..ccf85561db9 100644 --- a/jdk/src/share/classes/com/sun/crypto/provider/HmacMD5.java +++ b/jdk/src/share/classes/com/sun/crypto/provider/HmacMD5.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1998, 2009, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1998, 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 @@ -37,97 +37,11 @@ import java.security.spec.*; * * @author Jan Luehe */ -public final class HmacMD5 extends MacSpi implements Cloneable { - - private HmacCore hmac; - private static final int MD5_BLOCK_LENGTH = 64; - +public final class HmacMD5 extends HmacCore { /** * Standard constructor, creates a new HmacMD5 instance. */ public HmacMD5() throws NoSuchAlgorithmException { - hmac = new HmacCore(MessageDigest.getInstance("MD5"), - MD5_BLOCK_LENGTH); - } - - /** - * Returns the length of the HMAC in bytes. - * - * @return the HMAC length in bytes. - */ - protected int engineGetMacLength() { - return hmac.getDigestLength(); - } - - /** - * Initializes the HMAC with the given secret key and algorithm parameters. - * - * @param key the secret key. - * @param params the algorithm parameters. - * - * @exception InvalidKeyException if the given key is inappropriate for - * initializing this MAC. - * @exception InvalidAlgorithmParameterException if the given algorithm - * parameters are inappropriate for this MAC. - */ - protected void engineInit(Key key, AlgorithmParameterSpec params) - throws InvalidKeyException, InvalidAlgorithmParameterException { - hmac.init(key, params); - } - - /** - * Processes the given byte. - * - * @param input the input byte to be processed. - */ - protected void engineUpdate(byte input) { - hmac.update(input); - } - - /** - * Processes the first len bytes in input, - * starting at offset. - * - * @param input the input buffer. - * @param offset the offset in input where the input starts. - * @param len the number of bytes to process. - */ - protected void engineUpdate(byte input[], int offset, int len) { - hmac.update(input, offset, len); - } - - protected void engineUpdate(ByteBuffer input) { - hmac.update(input); - } - - /** - * Completes the HMAC computation and resets the HMAC for further use, - * maintaining the secret key that the HMAC was initialized with. - * - * @return the HMAC result. - */ - protected byte[] engineDoFinal() { - return hmac.doFinal(); - } - - /** - * Resets the HMAC for further use, maintaining the secret key that the - * HMAC was initialized with. - */ - protected void engineReset() { - hmac.reset(); - } - - /* - * Clones this object. - */ - public Object clone() { - HmacMD5 that = null; - try { - that = (HmacMD5) super.clone(); - that.hmac = (HmacCore) this.hmac.clone(); - } catch (CloneNotSupportedException e) { - } - return that; + super("MD5", 64); } } diff --git a/jdk/src/share/classes/com/sun/crypto/provider/HmacPKCS12PBESHA1.java b/jdk/src/share/classes/com/sun/crypto/provider/HmacPKCS12PBESHA1.java index 9b3413c2416..ef0ef58ee45 100644 --- a/jdk/src/share/classes/com/sun/crypto/provider/HmacPKCS12PBESHA1.java +++ b/jdk/src/share/classes/com/sun/crypto/provider/HmacPKCS12PBESHA1.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2009, Oracle and/or its affiliates. All rights reserved. + * 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 @@ -41,26 +41,13 @@ import java.security.spec.*; * * @author Valerie Peng */ -public final class HmacPKCS12PBESHA1 extends MacSpi implements Cloneable { - - private HmacCore hmac = null; - private static final int SHA1_BLOCK_LENGTH = 64; +public final class HmacPKCS12PBESHA1 extends HmacCore { /** * Standard constructor, creates a new HmacSHA1 instance. */ public HmacPKCS12PBESHA1() throws NoSuchAlgorithmException { - this.hmac = new HmacCore(MessageDigest.getInstance("SHA1"), - SHA1_BLOCK_LENGTH); - } - - /** - * Returns the length of the HMAC in bytes. - * - * @return the HMAC length in bytes. - */ - protected int engineGetMacLength() { - return hmac.getDigestLength(); + super("SHA1", 64); } /** @@ -71,7 +58,7 @@ public final class HmacPKCS12PBESHA1 extends MacSpi implements Cloneable { * * @exception InvalidKeyException if the given key is inappropriate for * initializing this MAC. - u* @exception InvalidAlgorithmParameterException if the given algorithm + * @exception InvalidAlgorithmParameterException if the given algorithm * parameters are inappropriate for this MAC. */ protected void engineInit(Key key, AlgorithmParameterSpec params) @@ -140,64 +127,8 @@ public final class HmacPKCS12PBESHA1 extends MacSpi implements Cloneable { ("IterationCount must be a positive number"); } byte[] derivedKey = PKCS12PBECipherCore.derive(passwdChars, salt, - iCount, hmac.getDigestLength(), PKCS12PBECipherCore.MAC_KEY); + iCount, engineGetMacLength(), PKCS12PBECipherCore.MAC_KEY); SecretKey cipherKey = new SecretKeySpec(derivedKey, "HmacSHA1"); - hmac.init(cipherKey, null); - } - - /** - * Processes the given byte. - * - * @param input the input byte to be processed. - */ - protected void engineUpdate(byte input) { - hmac.update(input); - } - - /** - * Processes the first len bytes in input, - * starting at offset. - * - * @param input the input buffer. - * @param offset the offset in input where the input starts. - * @param len the number of bytes to process. - */ - protected void engineUpdate(byte input[], int offset, int len) { - hmac.update(input, offset, len); - } - - protected void engineUpdate(ByteBuffer input) { - hmac.update(input); - } - - /** - * Completes the HMAC computation and resets the HMAC for further use, - * maintaining the secret key that the HMAC was initialized with. - * - * @return the HMAC result. - */ - protected byte[] engineDoFinal() { - return hmac.doFinal(); - } - - /** - * Resets the HMAC for further use, maintaining the secret key that the - * HMAC was initialized with. - */ - protected void engineReset() { - hmac.reset(); - } - - /* - * Clones this object. - */ - public Object clone() { - HmacPKCS12PBESHA1 that = null; - try { - that = (HmacPKCS12PBESHA1)super.clone(); - that.hmac = (HmacCore)this.hmac.clone(); - } catch (CloneNotSupportedException e) { - } - return that; + super.engineInit(cipherKey, null); } } diff --git a/jdk/src/share/classes/com/sun/crypto/provider/HmacSHA1.java b/jdk/src/share/classes/com/sun/crypto/provider/HmacSHA1.java index a9a9f6c423d..b79dc9d9658 100644 --- a/jdk/src/share/classes/com/sun/crypto/provider/HmacSHA1.java +++ b/jdk/src/share/classes/com/sun/crypto/provider/HmacSHA1.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1998, 2009, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1998, 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 @@ -37,97 +37,11 @@ import java.security.spec.*; * * @author Jan Luehe */ -public final class HmacSHA1 extends MacSpi implements Cloneable { - - private HmacCore hmac = null; - private static final int SHA1_BLOCK_LENGTH = 64; - +public final class HmacSHA1 extends HmacCore { /** * Standard constructor, creates a new HmacSHA1 instance. */ public HmacSHA1() throws NoSuchAlgorithmException { - this.hmac = new HmacCore(MessageDigest.getInstance("SHA1"), - SHA1_BLOCK_LENGTH); - } - - /** - * Returns the length of the HMAC in bytes. - * - * @return the HMAC length in bytes. - */ - protected int engineGetMacLength() { - return hmac.getDigestLength(); - } - - /** - * Initializes the HMAC with the given secret key and algorithm parameters. - * - * @param key the secret key. - * @param params the algorithm parameters. - * - * @exception InvalidKeyException if the given key is inappropriate for - * initializing this MAC. - * @exception InvalidAlgorithmParameterException if the given algorithm - * parameters are inappropriate for this MAC. - */ - protected void engineInit(Key key, AlgorithmParameterSpec params) - throws InvalidKeyException, InvalidAlgorithmParameterException { - hmac.init(key, params); - } - - /** - * Processes the given byte. - * - * @param input the input byte to be processed. - */ - protected void engineUpdate(byte input) { - hmac.update(input); - } - - /** - * Processes the first len bytes in input, - * starting at offset. - * - * @param input the input buffer. - * @param offset the offset in input where the input starts. - * @param len the number of bytes to process. - */ - protected void engineUpdate(byte input[], int offset, int len) { - hmac.update(input, offset, len); - } - - protected void engineUpdate(ByteBuffer input) { - hmac.update(input); - } - - /** - * Completes the HMAC computation and resets the HMAC for further use, - * maintaining the secret key that the HMAC was initialized with. - * - * @return the HMAC result. - */ - protected byte[] engineDoFinal() { - return hmac.doFinal(); - } - - /** - * Resets the HMAC for further use, maintaining the secret key that the - * HMAC was initialized with. - */ - protected void engineReset() { - hmac.reset(); - } - - /* - * Clones this object. - */ - public Object clone() { - HmacSHA1 that = null; - try { - that = (HmacSHA1)super.clone(); - that.hmac = (HmacCore)this.hmac.clone(); - } catch (CloneNotSupportedException e) { - } - return that; + super("SHA1", 64); } } diff --git a/jdk/src/share/classes/com/sun/crypto/provider/KeyGeneratorCore.java b/jdk/src/share/classes/com/sun/crypto/provider/KeyGeneratorCore.java index 708d80ba7db..9593bbfe0b0 100644 --- a/jdk/src/share/classes/com/sun/crypto/provider/KeyGeneratorCore.java +++ b/jdk/src/share/classes/com/sun/crypto/provider/KeyGeneratorCore.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2009, Oracle and/or its affiliates. All rights reserved. + * 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 @@ -105,11 +105,11 @@ final class KeyGeneratorCore { return new SecretKeySpec(b, name); } - // nested static class for the HmacSHA256 key generator - public static final class HmacSHA256KG extends KeyGeneratorSpi { + // nested static classes for the HmacSHA-2 family of key generator + abstract static class HmacSHA2KG extends KeyGeneratorSpi { private final KeyGeneratorCore core; - public HmacSHA256KG() { - core = new KeyGeneratorCore("HmacSHA256", 256); + protected HmacSHA2KG(String algoName, int len) { + core = new KeyGeneratorCore(algoName, len); } protected void engineInit(SecureRandom random) { core.implInit(random); @@ -124,47 +124,26 @@ final class KeyGeneratorCore { protected SecretKey engineGenerateKey() { return core.implGenerateKey(); } - } - // nested static class for the HmacSHA384 key generator - public static final class HmacSHA384KG extends KeyGeneratorSpi { - private final KeyGeneratorCore core; - public HmacSHA384KG() { - core = new KeyGeneratorCore("HmacSHA384", 384); + public static final class SHA224 extends HmacSHA2KG { + public SHA224() { + super("HmacSHA224", 224); + } } - protected void engineInit(SecureRandom random) { - core.implInit(random); + public static final class SHA256 extends HmacSHA2KG { + public SHA256() { + super("HmacSHA256", 256); + } } - protected void engineInit(AlgorithmParameterSpec params, - SecureRandom random) throws InvalidAlgorithmParameterException { - core.implInit(params, random); + public static final class SHA384 extends HmacSHA2KG { + public SHA384() { + super("HmacSHA384", 384); + } } - protected void engineInit(int keySize, SecureRandom random) { - core.implInit(keySize, random); - } - protected SecretKey engineGenerateKey() { - return core.implGenerateKey(); - } - } - - // nested static class for the HmacSHA384 key generator - public static final class HmacSHA512KG extends KeyGeneratorSpi { - private final KeyGeneratorCore core; - public HmacSHA512KG() { - core = new KeyGeneratorCore("HmacSHA512", 512); - } - protected void engineInit(SecureRandom random) { - core.implInit(random); - } - protected void engineInit(AlgorithmParameterSpec params, - SecureRandom random) throws InvalidAlgorithmParameterException { - core.implInit(params, random); - } - protected void engineInit(int keySize, SecureRandom random) { - core.implInit(keySize, random); - } - protected SecretKey engineGenerateKey() { - return core.implGenerateKey(); + public static final class SHA512 extends HmacSHA2KG { + public SHA512() { + super("HmacSHA512", 512); + } } } diff --git a/jdk/src/share/classes/com/sun/crypto/provider/OAEPParameters.java b/jdk/src/share/classes/com/sun/crypto/provider/OAEPParameters.java index 61423f0d4e6..9b3cbc27449 100644 --- a/jdk/src/share/classes/com/sun/crypto/provider/OAEPParameters.java +++ b/jdk/src/share/classes/com/sun/crypto/provider/OAEPParameters.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2011, Oracle and/or its affiliates. All rights reserved. + * 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 @@ -108,6 +108,8 @@ public final class OAEPParameters extends AlgorithmParametersSpi { private static String convertToStandardName(String internalName) { if (internalName.equals("SHA")) { return "SHA-1"; + } else if (internalName.equals("SHA224")) { + return "SHA-224"; } else if (internalName.equals("SHA256")) { return "SHA-256"; } else if (internalName.equals("SHA384")) { @@ -143,6 +145,8 @@ public final class OAEPParameters extends AlgorithmParametersSpi { String mgfDigestName = convertToStandardName(params.getName()); if (mgfDigestName.equals("SHA-1")) { mgfSpec = MGF1ParameterSpec.SHA1; + } else if (mgfDigestName.equals("SHA-224")) { + mgfSpec = MGF1ParameterSpec.SHA224; } else if (mgfDigestName.equals("SHA-256")) { mgfSpec = MGF1ParameterSpec.SHA256; } else if (mgfDigestName.equals("SHA-384")) { diff --git a/jdk/src/share/classes/com/sun/crypto/provider/SunJCE.java b/jdk/src/share/classes/com/sun/crypto/provider/SunJCE.java index c58236ba3e6..e7a815283b5 100644 --- a/jdk/src/share/classes/com/sun/crypto/provider/SunJCE.java +++ b/jdk/src/share/classes/com/sun/crypto/provider/SunJCE.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 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 @@ -65,7 +65,7 @@ import java.security.SecureRandom; * * - Diffie-Hellman Key Agreement * - * - HMAC-MD5, HMAC-SHA1, HMAC-SHA-256, HMAC-SHA-384, HMAC-SHA-512 + * - HMAC-MD5, HMAC-SHA1, HMAC-SHA-224, HMAC-SHA-256, HMAC-SHA-384, HMAC-SHA-512 * */ @@ -113,6 +113,7 @@ public final class SunJCE extends Provider { "NOPADDING|PKCS1PADDING|OAEPWITHMD5ANDMGF1PADDING" + "|OAEPWITHSHA1ANDMGF1PADDING" + "|OAEPWITHSHA-1ANDMGF1PADDING" + + "|OAEPWITHSHA-224ANDMGF1PADDING" + "|OAEPWITHSHA-256ANDMGF1PADDING" + "|OAEPWITHSHA-384ANDMGF1PADDING" + "|OAEPWITHSHA-512ANDMGF1PADDING"); @@ -221,12 +222,25 @@ public final class SunJCE extends Provider { put("KeyGenerator.HmacSHA1", "com.sun.crypto.provider.HmacSHA1KeyGenerator"); + put("KeyGenerator.HmacSHA224", + "com.sun.crypto.provider.KeyGeneratorCore$HmacSHA2KG$SHA224"); + put("Alg.Alias.KeyGenerator.OID.1.2.840.113549.2.8", "HmacSHA224"); + put("Alg.Alias.KeyGenerator.1.2.840.113549.2.8", "HmacSHA224"); + put("KeyGenerator.HmacSHA256", - "com.sun.crypto.provider.KeyGeneratorCore$HmacSHA256KG"); + "com.sun.crypto.provider.KeyGeneratorCore$HmacSHA2KG$SHA256"); + put("Alg.Alias.KeyGenerator.OID.1.2.840.113549.2.9", "HmacSHA256"); + put("Alg.Alias.KeyGenerator.1.2.840.113549.2.9", "HmacSHA256"); + put("KeyGenerator.HmacSHA384", - "com.sun.crypto.provider.KeyGeneratorCore$HmacSHA384KG"); + "com.sun.crypto.provider.KeyGeneratorCore$HmacSHA2KG$SHA384"); + put("Alg.Alias.KeyGenerator.OID.1.2.840.113549.2.10", "HmacSHA384"); + put("Alg.Alias.KeyGenerator.1.2.840.113549.2.10", "HmacSHA384"); + put("KeyGenerator.HmacSHA512", - "com.sun.crypto.provider.KeyGeneratorCore$HmacSHA512KG"); + "com.sun.crypto.provider.KeyGeneratorCore$HmacSHA2KG$SHA512"); + put("Alg.Alias.KeyGenerator.OID.1.2.840.113549.2.11", "HmacSHA512"); + put("Alg.Alias.KeyGenerator.1.2.840.113549.2.11", "HmacSHA512"); put("KeyPairGenerator.DiffieHellman", "com.sun.crypto.provider.DHKeyPairGenerator"); @@ -389,12 +403,23 @@ public final class SunJCE extends Provider { */ put("Mac.HmacMD5", "com.sun.crypto.provider.HmacMD5"); put("Mac.HmacSHA1", "com.sun.crypto.provider.HmacSHA1"); + put("Mac.HmacSHA224", + "com.sun.crypto.provider.HmacCore$HmacSHA224"); + put("Alg.Alias.Mac.OID.1.2.840.113549.2.8", "HmacSHA224"); + put("Alg.Alias.Mac.1.2.840.113549.2.8", "HmacSHA224"); put("Mac.HmacSHA256", "com.sun.crypto.provider.HmacCore$HmacSHA256"); + put("Alg.Alias.Mac.OID.1.2.840.113549.2.9", "HmacSHA256"); + put("Alg.Alias.Mac.1.2.840.113549.2.9", "HmacSHA256"); put("Mac.HmacSHA384", "com.sun.crypto.provider.HmacCore$HmacSHA384"); + put("Alg.Alias.Mac.OID.1.2.840.113549.2.10", "HmacSHA384"); + put("Alg.Alias.Mac.1.2.840.113549.2.10", "HmacSHA384"); put("Mac.HmacSHA512", "com.sun.crypto.provider.HmacCore$HmacSHA512"); + put("Alg.Alias.Mac.OID.1.2.840.113549.2.11", "HmacSHA512"); + put("Alg.Alias.Mac.1.2.840.113549.2.11", "HmacSHA512"); + put("Mac.HmacPBESHA1", "com.sun.crypto.provider.HmacPKCS12PBESHA1"); @@ -405,6 +430,7 @@ public final class SunJCE extends Provider { put("Mac.HmacMD5 SupportedKeyFormats", "RAW"); put("Mac.HmacSHA1 SupportedKeyFormats", "RAW"); + put("Mac.HmacSHA224 SupportedKeyFormats", "RAW"); put("Mac.HmacSHA256 SupportedKeyFormats", "RAW"); put("Mac.HmacSHA384 SupportedKeyFormats", "RAW"); put("Mac.HmacSHA512 SupportedKeyFormats", "RAW"); diff --git a/jdk/src/share/classes/java/security/spec/MGF1ParameterSpec.java b/jdk/src/share/classes/java/security/spec/MGF1ParameterSpec.java index a9c68b83c00..c1f1de37130 100644 --- a/jdk/src/share/classes/java/security/spec/MGF1ParameterSpec.java +++ b/jdk/src/share/classes/java/security/spec/MGF1ParameterSpec.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2006, Oracle and/or its affiliates. All rights reserved. + * 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 @@ -42,6 +42,7 @@ import java.security.spec.AlgorithmParameterSpec; *

        * OAEP-PSSDigestAlgorithms    ALGORITHM-IDENTIFIER ::= {
        *   { OID id-sha1 PARAMETERS NULL   }|
      + *   { OID id-sha224 PARAMETERS NULL   }|
        *   { OID id-sha256 PARAMETERS NULL }|
        *   { OID id-sha384 PARAMETERS NULL }|
        *   { OID id-sha512 PARAMETERS NULL },
      @@ -62,6 +63,11 @@ public class MGF1ParameterSpec implements AlgorithmParameterSpec {
            */
           public static final MGF1ParameterSpec SHA1 =
               new MGF1ParameterSpec("SHA-1");
      +    /**
      +     * The MGF1ParameterSpec which uses "SHA-224" message digest.
      +     */
      +    public static final MGF1ParameterSpec SHA224 =
      +        new MGF1ParameterSpec("SHA-224");
           /**
            * The MGF1ParameterSpec which uses "SHA-256" message digest.
            */
      diff --git a/jdk/src/share/classes/java/security/spec/PSSParameterSpec.java b/jdk/src/share/classes/java/security/spec/PSSParameterSpec.java
      index e9f29b553a6..37a2eeb2625 100644
      --- a/jdk/src/share/classes/java/security/spec/PSSParameterSpec.java
      +++ b/jdk/src/share/classes/java/security/spec/PSSParameterSpec.java
      @@ -1,5 +1,5 @@
       /*
      - * Copyright (c) 2001, 2006, Oracle and/or its affiliates. All rights reserved.
      + * Copyright (c) 2001, 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
      @@ -47,6 +47,7 @@ import java.security.spec.MGF1ParameterSpec;
        * 
        * OAEP-PSSDigestAlgorithms    ALGORITHM-IDENTIFIER ::= {
        *   { OID id-sha1 PARAMETERS NULL   }|
      + *   { OID id-sha224 PARAMETERS NULL   }|
        *   { OID id-sha256 PARAMETERS NULL }|
        *   { OID id-sha384 PARAMETERS NULL }|
        *   { OID id-sha512 PARAMETERS NULL },
      diff --git a/jdk/src/share/classes/sun/security/ec/ECDSASignature.java b/jdk/src/share/classes/sun/security/ec/ECDSASignature.java
      index 0d68225c9b0..64a36b1c894 100644
      --- a/jdk/src/share/classes/sun/security/ec/ECDSASignature.java
      +++ b/jdk/src/share/classes/sun/security/ec/ECDSASignature.java
      @@ -1,5 +1,5 @@
       /*
      - * Copyright (c) 2009, 2011, Oracle and/or its affiliates. All rights reserved.
      + * Copyright (c) 2009, 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
      @@ -41,6 +41,7 @@ import sun.security.util.*;
        *
        *   . "NONEwithECDSA"
        *   . "SHA1withECDSA"
      + *   . "SHA224withECDSA"
        *   . "SHA256withECDSA"
        *   . "SHA384withECDSA"
        *   . "SHA512withECDSA"
      @@ -162,6 +163,13 @@ abstract class ECDSASignature extends SignatureSpi {
               }
           }
       
      +    // Nested class for SHA224withECDSA signatures
      +    public static final class SHA224 extends ECDSASignature {
      +        public SHA224() {
      +           super("SHA-224");
      +        }
      +    }
      +
           // Nested class for SHA256withECDSA signatures
           public static final class SHA256 extends ECDSASignature {
               public SHA256() {
      diff --git a/jdk/src/share/classes/sun/security/ec/SunECEntries.java b/jdk/src/share/classes/sun/security/ec/SunECEntries.java
      index 91c56697339..6d2cb65a77a 100644
      --- a/jdk/src/share/classes/sun/security/ec/SunECEntries.java
      +++ b/jdk/src/share/classes/sun/security/ec/SunECEntries.java
      @@ -1,5 +1,5 @@
       /*
      - * Copyright (c) 2009, Oracle and/or its affiliates. All rights reserved.
      + * Copyright (c) 2009, 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
      @@ -133,17 +133,31 @@ final class SunECEntries {
                   "sun.security.ec.ECDSASignature$Raw");
               map.put("Signature.SHA1withECDSA",
                   "sun.security.ec.ECDSASignature$SHA1");
      +        map.put("Signature.SHA224withECDSA",
      +            "sun.security.ec.ECDSASignature$SHA224");
      +        map.put("Alg.Alias.Signature.OID.1.2.840.10045.4.3.1", "SHA224withECDSA");
      +        map.put("Alg.Alias.Signature.1.2.840.10045.4.3.1", "SHA224withECDSA");
      +
               map.put("Signature.SHA256withECDSA",
                   "sun.security.ec.ECDSASignature$SHA256");
      +        map.put("Alg.Alias.Signature.OID.1.2.840.10045.4.3.2", "SHA256withECDSA");
      +        map.put("Alg.Alias.Signature.1.2.840.10045.4.3.2", "SHA256withECDSA");
      +
               map.put("Signature.SHA384withECDSA",
                   "sun.security.ec.ECDSASignature$SHA384");
      +        map.put("Alg.Alias.Signature.OID.1.2.840.10045.4.3.3", "SHA384withECDSA");
      +        map.put("Alg.Alias.Signature.1.2.840.10045.4.3.3", "SHA384withECDSA");
      +
               map.put("Signature.SHA512withECDSA",
                   "sun.security.ec.ECDSASignature$SHA512");
      +        map.put("Alg.Alias.Signature.OID.1.2.840.10045.4.3.4", "SHA512withECDSA");
      +        map.put("Alg.Alias.Signature.1.2.840.10045.4.3.4", "SHA512withECDSA");
       
               String ecKeyClasses = "java.security.interfaces.ECPublicKey" +
                       "|java.security.interfaces.ECPrivateKey";
               map.put("Signature.NONEwithECDSA SupportedKeyClasses", ecKeyClasses);
               map.put("Signature.SHA1withECDSA SupportedKeyClasses", ecKeyClasses);
      +        map.put("Signature.SHA224withECDSA SupportedKeyClasses", ecKeyClasses);
               map.put("Signature.SHA256withECDSA SupportedKeyClasses", ecKeyClasses);
               map.put("Signature.SHA384withECDSA SupportedKeyClasses", ecKeyClasses);
               map.put("Signature.SHA512withECDSA SupportedKeyClasses", ecKeyClasses);
      @@ -152,6 +166,7 @@ final class SunECEntries {
       
               map.put("Signature.NONEwithECDSA ImplementedIn", "Software");
               map.put("Signature.SHA1withECDSA ImplementedIn", "Software");
      +        map.put("Signature.SHA224withECDSA ImplementedIn", "Software");
               map.put("Signature.SHA256withECDSA ImplementedIn", "Software");
               map.put("Signature.SHA384withECDSA ImplementedIn", "Software");
               map.put("Signature.SHA512withECDSA ImplementedIn", "Software");
      diff --git a/jdk/src/share/classes/sun/security/pkcs11/P11Digest.java b/jdk/src/share/classes/sun/security/pkcs11/P11Digest.java
      index 08f22fffc11..2dc66d2368b 100644
      --- a/jdk/src/share/classes/sun/security/pkcs11/P11Digest.java
      +++ b/jdk/src/share/classes/sun/security/pkcs11/P11Digest.java
      @@ -39,7 +39,7 @@ import static sun.security.pkcs11.wrapper.PKCS11Constants.*;
       
       /**
        * MessageDigest implementation class. This class currently supports
      - * MD2, MD5, SHA-1, SHA-256, SHA-384, and SHA-512.
      + * MD2, MD5, SHA-1, SHA-224, SHA-256, SHA-384, and SHA-512.
        *
        * Note that many digest operations are on fairly small amounts of data
        * (less than 100 bytes total). For example, the 2nd hashing in HMAC or
      @@ -99,6 +99,9 @@ final class P11Digest extends MessageDigestSpi implements Cloneable {
               case (int)CKM_SHA_1:
                   digestLength = 20;
                   break;
      +        case (int)CKM_SHA224:
      +            digestLength = 28;
      +            break;
               case (int)CKM_SHA256:
                   digestLength = 32;
                   break;
      diff --git a/jdk/src/share/classes/sun/security/pkcs11/P11Mac.java b/jdk/src/share/classes/sun/security/pkcs11/P11Mac.java
      index b32ee7affeb..2b0cbbcdf50 100644
      --- a/jdk/src/share/classes/sun/security/pkcs11/P11Mac.java
      +++ b/jdk/src/share/classes/sun/security/pkcs11/P11Mac.java
      @@ -1,5 +1,5 @@
       /*
      - * Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved.
      + * 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
      @@ -40,8 +40,8 @@ import static sun.security.pkcs11.wrapper.PKCS11Constants.*;
       
       /**
        * MAC implementation class. This class currently supports HMAC using
      - * MD5, SHA-1, SHA-256, SHA-384, and SHA-512 and the SSL3 MAC using MD5
      - * and SHA-1.
      + * MD5, SHA-1, SHA-224, SHA-256, SHA-384, and SHA-512 and the SSL3 MAC
      + * using MD5 and SHA-1.
        *
        * Note that unlike other classes (e.g. Signature), this does not
        * composite various operations if the token only supports part of the
      @@ -107,6 +107,9 @@ final class P11Mac extends MacSpi {
               case (int)CKM_SHA_1_HMAC:
                   macLength = 20;
                   break;
      +        case (int)CKM_SHA224_HMAC:
      +            macLength = 28;
      +            break;
               case (int)CKM_SHA256_HMAC:
                   macLength = 32;
                   break;
      diff --git a/jdk/src/share/classes/sun/security/pkcs11/P11Signature.java b/jdk/src/share/classes/sun/security/pkcs11/P11Signature.java
      index 70a79e46bdf..3c94ad6d3ab 100644
      --- a/jdk/src/share/classes/sun/security/pkcs11/P11Signature.java
      +++ b/jdk/src/share/classes/sun/security/pkcs11/P11Signature.java
      @@ -53,12 +53,14 @@ import static sun.security.pkcs11.wrapper.PKCS11Constants.*;
        *   . MD2withRSA
        *   . MD5withRSA
        *   . SHA1withRSA
      + *   . SHA224withRSA
        *   . SHA256withRSA
        *   . SHA384withRSA
        *   . SHA512withRSA
        * . ECDSA
        *   . NONEwithECDSA
        *   . SHA1withECDSA
      + *   . SHA224withECDSA
        *   . SHA256withECDSA
        *   . SHA384withECDSA
        *   . SHA512withECDSA
      @@ -143,6 +145,7 @@ final class P11Signature extends SignatureSpi {
               case (int)CKM_MD2_RSA_PKCS:
               case (int)CKM_MD5_RSA_PKCS:
               case (int)CKM_SHA1_RSA_PKCS:
      +        case (int)CKM_SHA224_RSA_PKCS:
               case (int)CKM_SHA256_RSA_PKCS:
               case (int)CKM_SHA384_RSA_PKCS:
               case (int)CKM_SHA512_RSA_PKCS:
      @@ -181,6 +184,8 @@ final class P11Signature extends SignatureSpi {
                       String digestAlg;
                       if (algorithm.equals("SHA1withECDSA")) {
                           digestAlg = "SHA-1";
      +                } else if (algorithm.equals("SHA224withECDSA")) {
      +                    digestAlg = "SHA-224";
                       } else if (algorithm.equals("SHA256withECDSA")) {
                           digestAlg = "SHA-256";
                       } else if (algorithm.equals("SHA384withECDSA")) {
      @@ -207,6 +212,9 @@ final class P11Signature extends SignatureSpi {
                   } else if (algorithm.equals("MD2withRSA")) {
                       md = MessageDigest.getInstance("MD2");
                       digestOID = AlgorithmId.MD2_oid;
      +            } else if (algorithm.equals("SHA224withRSA")) {
      +                md = MessageDigest.getInstance("SHA-224");
      +                digestOID = AlgorithmId.SHA224_oid;
                   } else if (algorithm.equals("SHA256withRSA")) {
                       md = MessageDigest.getInstance("SHA-256");
                       digestOID = AlgorithmId.SHA256_oid;
      @@ -332,6 +340,8 @@ final class P11Signature extends SignatureSpi {
                   encodedLength = 34;
               } else if (algorithm.equals("SHA1withRSA")) {
                   encodedLength = 35;
      +        } else if (algorithm.equals("SHA224withRSA")) {
      +            encodedLength = 47;
               } else if (algorithm.equals("SHA256withRSA")) {
                   encodedLength = 51;
               } else if (algorithm.equals("SHA384withRSA")) {
      diff --git a/jdk/src/share/classes/sun/security/pkcs11/SunPKCS11.java b/jdk/src/share/classes/sun/security/pkcs11/SunPKCS11.java
      index 8c432571e3a..bac38137f16 100644
      --- a/jdk/src/share/classes/sun/security/pkcs11/SunPKCS11.java
      +++ b/jdk/src/share/classes/sun/security/pkcs11/SunPKCS11.java
      @@ -342,6 +342,7 @@ public final class SunPKCS11 extends AuthProvider {
                       System.out.println("Library info:");
                       System.out.println(p11Info);
                   }
      +
                   if ((slotID < 0) || showInfo) {
                       long[] slots = p11.C_GetSlotList(false);
                       if (showInfo) {
      @@ -520,24 +521,37 @@ public final class SunPKCS11 extends AuthProvider {
                       m(CKM_MD2));
               d(MD, "MD5",            P11Digest,
                       m(CKM_MD5));
      -        d(MD, "SHA1",           P11Digest,              s("SHA", "SHA-1"),
      +        d(MD, "SHA1",           P11Digest, s("SHA", "SHA-1"),
                       m(CKM_SHA_1));
      +
      +        d(MD, "SHA-224",        P11Digest,
      +                s("2.16.840.1.101.3.4.2.4", "OID.2.16.840.1.101.3.4.2.4"),
      +                m(CKM_SHA224));
               d(MD, "SHA-256",        P11Digest,
      +                s("2.16.840.1.101.3.4.2.1", "OID.2.16.840.1.101.3.4.2.1"),
                       m(CKM_SHA256));
               d(MD, "SHA-384",        P11Digest,
      +                s("2.16.840.1.101.3.4.2.2", "OID.2.16.840.1.101.3.4.2.2"),
                       m(CKM_SHA384));
               d(MD, "SHA-512",        P11Digest,
      +                s("2.16.840.1.101.3.4.2.3", "OID.2.16.840.1.101.3.4.2.3"),
                       m(CKM_SHA512));
       
               d(MAC, "HmacMD5",       P11MAC,
                       m(CKM_MD5_HMAC));
               d(MAC, "HmacSHA1",      P11MAC,
                       m(CKM_SHA_1_HMAC));
      +        d(MAC, "HmacSHA224",    P11MAC,
      +                s("1.2.840.113549.2.8", "OID.1.2.840.113549.2.8"),
      +                m(CKM_SHA224_HMAC));
               d(MAC, "HmacSHA256",    P11MAC,
      +                s("1.2.840.113549.2.9", "OID.1.2.840.113549.2.9"),
                       m(CKM_SHA256_HMAC));
               d(MAC, "HmacSHA384",    P11MAC,
      +                s("1.2.840.113549.2.10", "OID.1.2.840.113549.2.10"),
                       m(CKM_SHA384_HMAC));
               d(MAC, "HmacSHA512",    P11MAC,
      +                s("1.2.840.113549.2.11", "OID.1.2.840.113549.2.11"),
                       m(CKM_SHA512_HMAC));
               d(MAC, "SslMacMD5",     P11MAC,
                       m(CKM_SSL3_MD5_MAC));
      @@ -648,11 +662,17 @@ public final class SunPKCS11 extends AuthProvider {
                       m(CKM_ECDSA));
               d(SIG, "SHA1withECDSA", P11Signature,           s("ECDSA"),
                       m(CKM_ECDSA_SHA1, CKM_ECDSA));
      +        d(SIG, "SHA224withECDSA",       P11Signature,
      +                s("1.2.840.10045.4.3.1", "OID.1.2.840.10045.4.3.1"),
      +                m(CKM_ECDSA));
               d(SIG, "SHA256withECDSA",       P11Signature,
      +                s("1.2.840.10045.4.3.2", "OID.1.2.840.10045.4.3.2"),
                       m(CKM_ECDSA));
               d(SIG, "SHA384withECDSA",       P11Signature,
      +                s("1.2.840.10045.4.3.3", "OID.1.2.840.10045.4.3.3"),
                       m(CKM_ECDSA));
               d(SIG, "SHA512withECDSA",       P11Signature,
      +                s("1.2.840.10045.4.3.4", "OID.1.2.840.10045.4.3.4"),
                       m(CKM_ECDSA));
               d(SIG, "MD2withRSA",    P11Signature,
                       m(CKM_MD2_RSA_PKCS, CKM_RSA_PKCS, CKM_RSA_X_509));
      @@ -660,11 +680,17 @@ public final class SunPKCS11 extends AuthProvider {
                       m(CKM_MD5_RSA_PKCS, CKM_RSA_PKCS, CKM_RSA_X_509));
               d(SIG, "SHA1withRSA",   P11Signature,
                       m(CKM_SHA1_RSA_PKCS, CKM_RSA_PKCS, CKM_RSA_X_509));
      +        d(SIG, "SHA224withRSA", P11Signature,
      +                s("1.2.840.113549.1.1.14", "OID.1.2.840.113549.1.1.14"),
      +                m(CKM_SHA224_RSA_PKCS, CKM_RSA_PKCS, CKM_RSA_X_509));
               d(SIG, "SHA256withRSA", P11Signature,
      +                s("1.2.840.113549.1.1.11", "OID.1.2.840.113549.1.1.11"),
                       m(CKM_SHA256_RSA_PKCS, CKM_RSA_PKCS, CKM_RSA_X_509));
               d(SIG, "SHA384withRSA", P11Signature,
      +                s("1.2.840.113549.1.1.12", "OID.1.2.840.113549.1.1.12"),
                       m(CKM_SHA384_RSA_PKCS, CKM_RSA_PKCS, CKM_RSA_X_509));
               d(SIG, "SHA512withRSA", P11Signature,
      +                s("1.2.840.113549.1.1.13", "OID.1.2.840.113549.1.1.13"),
                       m(CKM_SHA512_RSA_PKCS, CKM_RSA_PKCS, CKM_RSA_X_509));
       
               /*
      diff --git a/jdk/src/share/classes/sun/security/pkcs11/wrapper/Functions.java b/jdk/src/share/classes/sun/security/pkcs11/wrapper/Functions.java
      index fa7ad073598..58f778ebbe2 100644
      --- a/jdk/src/share/classes/sun/security/pkcs11/wrapper/Functions.java
      +++ b/jdk/src/share/classes/sun/security/pkcs11/wrapper/Functions.java
      @@ -1,5 +1,5 @@
       /*
      - * Copyright (c) 2003, 2011, Oracle and/or its affiliates. All rights reserved.
      + * Copyright (c) 2003, 2012, Oracle and/or its affiliates. All rights reserved.
        */
       
       /* Copyright  (c) 2002 Graz University of Technology. All rights reserved.
      @@ -630,6 +630,7 @@ public class Functions {
               addMech(CKM_X9_42_DH_DERIVE,            "CKM_X9_42_DH_DERIVE");
               addMech(CKM_X9_42_DH_HYBRID_DERIVE,     "CKM_X9_42_DH_HYBRID_DERIVE");
               addMech(CKM_X9_42_MQV_DERIVE,           "CKM_X9_42_MQV_DERIVE");
      +        addMech(CKM_SHA224_RSA_PKCS,            "CKM_SHA224_RSA_PKCS");
               addMech(CKM_SHA256_RSA_PKCS,            "CKM_SHA256_RSA_PKCS");
               addMech(CKM_SHA384_RSA_PKCS,            "CKM_SHA384_RSA_PKCS");
               addMech(CKM_SHA512_RSA_PKCS,            "CKM_SHA512_RSA_PKCS");
      @@ -675,6 +676,9 @@ public class Functions {
               addMech(CKM_RIPEMD160,                  "CKM_RIPEMD160");
               addMech(CKM_RIPEMD160_HMAC,             "CKM_RIPEMD160_HMAC");
               addMech(CKM_RIPEMD160_HMAC_GENERAL,     "CKM_RIPEMD160_HMAC_GENERAL");
      +        addMech(CKM_SHA224,                     "CKM_SHA224");
      +        addMech(CKM_SHA224_HMAC,                "CKM_SHA224_HMAC");
      +        addMech(CKM_SHA224_HMAC_GENERAL,        "CKM_SHA224_HMAC_GENERAL");
               addMech(CKM_SHA256,                     "CKM_SHA256");
               addMech(CKM_SHA256_HMAC,                "CKM_SHA256_HMAC");
               addMech(CKM_SHA256_HMAC_GENERAL,        "CKM_SHA256_HMAC_GENERAL");
      @@ -734,6 +738,7 @@ public class Functions {
               addMech(CKM_MD5_KEY_DERIVATION,         "CKM_MD5_KEY_DERIVATION");
               addMech(CKM_MD2_KEY_DERIVATION,         "CKM_MD2_KEY_DERIVATION");
               addMech(CKM_SHA1_KEY_DERIVATION,        "CKM_SHA1_KEY_DERIVATION");
      +        addMech(CKM_SHA224_KEY_DERIVATION,      "CKM_SHA224_KEY_DERIVATION");
               addMech(CKM_SHA256_KEY_DERIVATION,      "CKM_SHA256_KEY_DERIVATION");
               addMech(CKM_SHA384_KEY_DERIVATION,      "CKM_SHA384_KEY_DERIVATION");
               addMech(CKM_SHA512_KEY_DERIVATION,      "CKM_SHA512_KEY_DERIVATION");
      diff --git a/jdk/src/share/classes/sun/security/provider/DigestBase.java b/jdk/src/share/classes/sun/security/provider/DigestBase.java
      index 2c7b719b0bc..cbca1235fe6 100644
      --- a/jdk/src/share/classes/sun/security/provider/DigestBase.java
      +++ b/jdk/src/share/classes/sun/security/provider/DigestBase.java
      @@ -39,7 +39,6 @@ import java.security.ProviderException;
        *  . abstract void implCompress(byte[] b, int ofs);
        *  . abstract void implDigest(byte[] out, int ofs);
        *  . abstract void implReset();
      - *  . public abstract Object clone();
        *
        * See the inline documentation for details.
        *
      @@ -61,7 +60,7 @@ abstract class DigestBase extends MessageDigestSpi implements Cloneable {
           // buffer to store partial blocks, blockSize bytes large
           // Subclasses should not access this array directly except possibly in their
           // implDigest() method. See MD5.java as an example.
      -    final byte[] buffer;
      +    byte[] buffer;
           // offset into buffer
           private int bufOfs;
       
      @@ -83,18 +82,6 @@ abstract class DigestBase extends MessageDigestSpi implements Cloneable {
               buffer = new byte[blockSize];
           }
       
      -    /**
      -     * Constructor for cloning. Replicates common data.
      -     */
      -    DigestBase(DigestBase base) {
      -        this.algorithm = base.algorithm;
      -        this.digestLength = base.digestLength;
      -        this.blockSize = base.blockSize;
      -        this.buffer = base.buffer.clone();
      -        this.bufOfs = base.bufOfs;
      -        this.bytesProcessed = base.bytesProcessed;
      -    }
      -
           // return digest length. See JCA doc.
           protected final int engineGetDigestLength() {
               return digestLength;
      @@ -206,12 +193,11 @@ abstract class DigestBase extends MessageDigestSpi implements Cloneable {
            */
           abstract void implReset();
       
      -    /**
      -     * Clone this digest. Should be implemented as "return new MyDigest(this)".
      -     * That constructor should first call "super(baseDigest)" and then copy
      -     * subclass specific data.
      -     */
      -    public abstract Object clone();
      +    public Object clone() throws CloneNotSupportedException {
      +        DigestBase copy = (DigestBase) super.clone();
      +        copy.buffer = copy.buffer.clone();
      +        return copy;
      +    }
       
           // padding used for the MD5, and SHA-* message digests
           static final byte[] padding;
      @@ -223,5 +209,4 @@ abstract class DigestBase extends MessageDigestSpi implements Cloneable {
               padding = new byte[136];
               padding[0] = (byte)0x80;
           }
      -
       }
      diff --git a/jdk/src/share/classes/sun/security/provider/MD2.java b/jdk/src/share/classes/sun/security/provider/MD2.java
      index c0c116ae84a..5d0a3e3e827 100644
      --- a/jdk/src/share/classes/sun/security/provider/MD2.java
      +++ b/jdk/src/share/classes/sun/security/provider/MD2.java
      @@ -39,14 +39,14 @@ import java.util.Arrays;
       public final class MD2 extends DigestBase {
       
           // state, 48 ints
      -    private final int[] X;
      +    private int[] X;
       
           // checksum, 16 ints. they are really bytes, but byte arithmetic in
           // the JVM is much slower that int arithmetic.
      -    private final int[] C;
      +    private int[] C;
       
           // temporary store for checksum C during final digest
      -    private final byte[] cBytes;
      +    private byte[] cBytes;
       
           /**
            * Create a new MD2 digest. Called by the JCA framework
      @@ -58,15 +58,12 @@ public final class MD2 extends DigestBase {
               cBytes = new byte[16];
           }
       
      -    private MD2(MD2 base) {
      -        super(base);
      -        this.X = base.X.clone();
      -        this.C = base.C.clone();
      -        cBytes = new byte[16];
      -    }
      -
      -    public Object clone() {
      -        return new MD2(this);
      +    public Object clone() throws CloneNotSupportedException {
      +        MD2 copy = (MD2) super.clone();
      +        copy.X = copy.X.clone();
      +        copy.C = copy.C.clone();
      +        copy.cBytes = new byte[16];
      +        return copy;
           }
       
           // reset state and checksum
      diff --git a/jdk/src/share/classes/sun/security/provider/MD4.java b/jdk/src/share/classes/sun/security/provider/MD4.java
      index 56ff5a06ae3..e51b2485499 100644
      --- a/jdk/src/share/classes/sun/security/provider/MD4.java
      +++ b/jdk/src/share/classes/sun/security/provider/MD4.java
      @@ -44,9 +44,9 @@ import static sun.security.provider.ByteArrayAccess.*;
       public final class MD4 extends DigestBase {
       
           // state of this object
      -    private final int[] state;
      +    private int[] state;
           // temporary buffer, used by implCompress()
      -    private final int[] x;
      +    private int[] x;
       
           // rotation constants
           private static final int S11 = 3;
      @@ -93,16 +93,12 @@ public final class MD4 extends DigestBase {
               implReset();
           }
       
      -    // Cloning constructor
      -    private MD4(MD4 base) {
      -        super(base);
      -        this.state = base.state.clone();
      -        this.x = new int[16];
      -    }
      -
           // clone this object
      -    public Object clone() {
      -        return new MD4(this);
      +    public Object clone() throws CloneNotSupportedException {
      +        MD4 copy = (MD4) super.clone();
      +        copy.state = copy.state.clone();
      +        copy.x = new int[16];
      +        return copy;
           }
       
           /**
      diff --git a/jdk/src/share/classes/sun/security/provider/MD5.java b/jdk/src/share/classes/sun/security/provider/MD5.java
      index 85830e55010..32e42e5ecd7 100644
      --- a/jdk/src/share/classes/sun/security/provider/MD5.java
      +++ b/jdk/src/share/classes/sun/security/provider/MD5.java
      @@ -39,9 +39,9 @@ import static sun.security.provider.ByteArrayAccess.*;
       public final class MD5 extends DigestBase {
       
           // state of this object
      -    private final int[] state;
      +    private int[] state;
           // temporary buffer, used by implCompress()
      -    private final int[] x;
      +    private int[] x;
       
           // rotation constants
           private static final int S11 = 7;
      @@ -69,16 +69,12 @@ public final class MD5 extends DigestBase {
               implReset();
           }
       
      -    // Cloning constructor
      -    private MD5(MD5 base) {
      -        super(base);
      -        this.state = base.state.clone();
      -        this.x = new int[16];
      -    }
      -
           // clone this object
      -    public Object clone() {
      -        return new MD5(this);
      +    public Object clone() throws CloneNotSupportedException {
      +        MD5 copy = (MD5) super.clone();
      +        copy.state = copy.state.clone();
      +        copy.x = new int[16];
      +        return copy;
           }
       
           /**
      diff --git a/jdk/src/share/classes/sun/security/provider/SHA.java b/jdk/src/share/classes/sun/security/provider/SHA.java
      index 723c64a2b5b..0f13f41b25c 100644
      --- a/jdk/src/share/classes/sun/security/provider/SHA.java
      +++ b/jdk/src/share/classes/sun/security/provider/SHA.java
      @@ -47,10 +47,10 @@ public final class SHA extends DigestBase {
           // 64 bytes are included in each hash block so the low order
           // bits of count are used to know how to pack the bytes into ints
           // and to know when to compute the block and start the next one.
      -    private final int[] W;
      +    private int[] W;
       
           // state of this
      -    private final int[] state;
      +    private int[] state;
       
           /**
            * Creates a new SHA object.
      @@ -62,19 +62,14 @@ public final class SHA extends DigestBase {
               implReset();
           }
       
      -    /**
      -     * Creates a SHA object.with state (for cloning) */
      -    private SHA(SHA base) {
      -        super(base);
      -        this.state = base.state.clone();
      -        this.W = new int[80];
      -    }
      -
           /*
            * Clones this object.
            */
      -    public Object clone() {
      -        return new SHA(this);
      +    public Object clone() throws CloneNotSupportedException {
      +        SHA copy = (SHA) super.clone();
      +        copy.state = copy.state.clone();
      +        copy.W = new int[80];
      +        return copy;
           }
       
           /**
      diff --git a/jdk/src/share/classes/sun/security/provider/SHA2.java b/jdk/src/share/classes/sun/security/provider/SHA2.java
      index a04ada05a34..54f34545918 100644
      --- a/jdk/src/share/classes/sun/security/provider/SHA2.java
      +++ b/jdk/src/share/classes/sun/security/provider/SHA2.java
      @@ -1,5 +1,5 @@
       /*
      - * Copyright (c) 2002, 2006, Oracle and/or its affiliates. All rights reserved.
      + * Copyright (c) 2002, 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
      @@ -40,7 +40,7 @@ import static sun.security.provider.ByteArrayAccess.*;
        * @author      Valerie Peng
        * @author      Andreas Sterbenz
        */
      -public final class SHA2 extends DigestBase {
      +abstract class SHA2 extends DigestBase {
       
           private static final int ITERATION = 64;
           // Constants for each round
      @@ -64,46 +64,30 @@ public final class SHA2 extends DigestBase {
           };
       
           // buffer used by implCompress()
      -    private final int[] W;
      +    private int[] W;
       
           // state of this object
      -    private final int[] state;
      +    private int[] state;
      +
      +    // initial state value. different between SHA-224 and SHA-256
      +    private final int[] initialHashes;
       
           /**
            * Creates a new SHA object.
            */
      -    public SHA2() {
      -        super("SHA-256", 32, 64);
      +    SHA2(String name, int digestLength, int[] initialHashes) {
      +        super(name, digestLength, 64);
      +        this.initialHashes = initialHashes;
               state = new int[8];
               W = new int[64];
               implReset();
           }
       
      -    /**
      -     * Creates a SHA2 object.with state (for cloning)
      -     */
      -    private SHA2(SHA2 base) {
      -        super(base);
      -        this.state = base.state.clone();
      -        this.W = new int[64];
      -    }
      -
      -    public Object clone() {
      -        return new SHA2(this);
      -    }
      -
           /**
            * Resets the buffers and hash value to start a new hash.
            */
           void implReset() {
      -        state[0] = 0x6a09e667;
      -        state[1] = 0xbb67ae85;
      -        state[2] = 0x3c6ef372;
      -        state[3] = 0xa54ff53a;
      -        state[4] = 0x510e527f;
      -        state[5] = 0x9b05688c;
      -        state[6] = 0x1f83d9ab;
      -        state[7] = 0x5be0cd19;
      +        System.arraycopy(initialHashes, 0, state, 0, state.length);
           }
       
           void implDigest(byte[] out, int ofs) {
      @@ -242,4 +226,38 @@ public final class SHA2 extends DigestBase {
               state[7] += h;
           }
       
      +    public Object clone() throws CloneNotSupportedException {
      +        SHA2 copy = (SHA2) super.clone();
      +        copy.state = copy.state.clone();
      +        copy.W = new int[64];
      +        return copy;
      +    }
      +
      +    /**
      +     * SHA-224 implementation class.
      +     */
      +    public static final class SHA224 extends SHA2 {
      +        private static final int[] INITIAL_HASHES = {
      +            0xc1059ed8, 0x367cd507, 0x3070dd17, 0xf70e5939,
      +            0xffc00b31, 0x68581511, 0x64f98fa7, 0xbefa4fa4
      +        };
      +
      +        public SHA224() {
      +            super("SHA-224", 28, INITIAL_HASHES);
      +        }
      +    }
      +
      +    /**
      +     * SHA-256 implementation class.
      +     */
      +    public static final class SHA256 extends SHA2 {
      +        private static final int[] INITIAL_HASHES = {
      +            0x6a09e667, 0xbb67ae85, 0x3c6ef372, 0xa54ff53a,
      +            0x510e527f, 0x9b05688c, 0x1f83d9ab, 0x5be0cd19
      +        };
      +
      +        public SHA256() {
      +            super("SHA-256", 32, INITIAL_HASHES);
      +        }
      +    }
       }
      diff --git a/jdk/src/share/classes/sun/security/provider/SHA5.java b/jdk/src/share/classes/sun/security/provider/SHA5.java
      index 413770cc542..851c0706b1c 100644
      --- a/jdk/src/share/classes/sun/security/provider/SHA5.java
      +++ b/jdk/src/share/classes/sun/security/provider/SHA5.java
      @@ -82,10 +82,10 @@ abstract class SHA5 extends DigestBase {
           };
       
           // buffer used by implCompress()
      -    private final long[] W;
      +    private long[] W;
       
           // state of this object
      -    private final long[] state;
      +    private long[] state;
       
           // initial state value. different between SHA-384 and SHA-512
           private final long[] initialHashes;
      @@ -101,16 +101,6 @@ abstract class SHA5 extends DigestBase {
               implReset();
           }
       
      -    /**
      -     * Creates a SHA object with state (for cloning)
      -     */
      -    SHA5(SHA5 base) {
      -        super(base);
      -        this.initialHashes = base.initialHashes;
      -        this.state = base.state.clone();
      -        this.W = new long[80];
      -    }
      -
           final void implReset() {
               System.arraycopy(initialHashes, 0, state, 0, state.length);
           }
      @@ -255,6 +245,13 @@ abstract class SHA5 extends DigestBase {
               state[7] += h;
           }
       
      +    public Object clone() throws CloneNotSupportedException {
      +        SHA5 copy = (SHA5) super.clone();
      +        copy.state = copy.state.clone();
      +        copy.W = new long[80];
      +        return copy;
      +    }
      +
           /**
            * SHA-512 implementation class.
            */
      @@ -270,14 +267,6 @@ abstract class SHA5 extends DigestBase {
               public SHA512() {
                   super("SHA-512", 64, INITIAL_HASHES);
               }
      -
      -        private SHA512(SHA512 base) {
      -            super(base);
      -        }
      -
      -        public Object clone() {
      -            return new SHA512(this);
      -        }
           }
       
           /**
      @@ -295,14 +284,5 @@ abstract class SHA5 extends DigestBase {
               public SHA384() {
                   super("SHA-384", 48, INITIAL_HASHES);
               }
      -
      -        private SHA384(SHA384 base) {
      -            super(base);
      -        }
      -
      -        public Object clone() {
      -            return new SHA384(this);
      -        }
           }
      -
       }
      diff --git a/jdk/src/share/classes/sun/security/provider/SunEntries.java b/jdk/src/share/classes/sun/security/provider/SunEntries.java
      index 6421afd0fb3..3f0ef1084ce 100644
      --- a/jdk/src/share/classes/sun/security/provider/SunEntries.java
      +++ b/jdk/src/share/classes/sun/security/provider/SunEntries.java
      @@ -1,5 +1,5 @@
       /*
      - * Copyright (c) 1996, 2006, Oracle and/or its affiliates. All rights reserved.
      + * Copyright (c) 1996, 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
      @@ -43,6 +43,10 @@ import java.security.*;
        *   identifier strings "OID.1.3.14.3.2.13", "OID.1.3.14.3.2.27" and
        *   "OID.1.2.840.10040.4.3".
        *
      + * - SHA-2 is a set of message digest schemes described in FIPS 180-2.
      + *   SHA-2 family of hash functions includes SHA-224, SHA-256, SHA-384,
      + *   and SHA-512.
      + *
        * - DSA is the key generation scheme as described in FIPS 186.
        *   Aliases for DSA include the OID strings "OID.1.3.14.3.2.12"
        *   and "OID.1.2.840.10040.4.1".
      @@ -140,9 +144,19 @@ final class SunEntries {
               map.put("Alg.Alias.MessageDigest.SHA-1", "SHA");
               map.put("Alg.Alias.MessageDigest.SHA1", "SHA");
       
      -        map.put("MessageDigest.SHA-256", "sun.security.provider.SHA2");
      +        map.put("MessageDigest.SHA-224", "sun.security.provider.SHA2$SHA224");
      +        map.put("Alg.Alias.MessageDigest.2.16.840.1.101.3.4.2.4", "SHA-224");
      +        map.put("Alg.Alias.MessageDigest.OID.2.16.840.1.101.3.4.2.4", "SHA-224");
      +
      +        map.put("MessageDigest.SHA-256", "sun.security.provider.SHA2$SHA256");
      +        map.put("Alg.Alias.MessageDigest.2.16.840.1.101.3.4.2.1", "SHA-256");
      +        map.put("Alg.Alias.MessageDigest.OID.2.16.840.1.101.3.4.2.1", "SHA-256");
               map.put("MessageDigest.SHA-384", "sun.security.provider.SHA5$SHA384");
      +        map.put("Alg.Alias.MessageDigest.2.16.840.1.101.3.4.2.2", "SHA-384");
      +        map.put("Alg.Alias.MessageDigest.OID.2.16.840.1.101.3.4.2.2", "SHA-384");
               map.put("MessageDigest.SHA-512", "sun.security.provider.SHA5$SHA512");
      +        map.put("Alg.Alias.MessageDigest.2.16.840.1.101.3.4.2.3", "SHA-512");
      +        map.put("Alg.Alias.MessageDigest.OID.2.16.840.1.101.3.4.2.3", "SHA-512");
       
               /*
                * Algorithm Parameter Generator engines
      diff --git a/jdk/src/share/classes/sun/security/rsa/RSASignature.java b/jdk/src/share/classes/sun/security/rsa/RSASignature.java
      index a98ed881d1c..435e283ad23 100644
      --- a/jdk/src/share/classes/sun/security/rsa/RSASignature.java
      +++ b/jdk/src/share/classes/sun/security/rsa/RSASignature.java
      @@ -1,5 +1,5 @@
       /*
      - * Copyright (c) 2003, 2011, Oracle and/or its affiliates. All rights reserved.
      + * 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
      @@ -39,8 +39,8 @@ import sun.security.x509.AlgorithmId;
        * PKCS#1 RSA signatures with the various message digest algorithms.
        * This file contains an abstract base class with all the logic plus
        * a nested static class for each of the message digest algorithms
      - * (see end of the file). We support MD2, MD5, SHA-1, SHA-256, SHA-384,
      - * and SHA-512.
      + * (see end of the file). We support MD2, MD5, SHA-1, SHA-224, SHA-256,
      + * SHA-384, and SHA-512.
        *
        * @since   1.5
        * @author  Andreas Sterbenz
      @@ -276,6 +276,13 @@ public abstract class RSASignature extends SignatureSpi {
               }
           }
       
      +    // Nested class for SHA224withRSA signatures
      +    public static final class SHA224withRSA extends RSASignature {
      +        public SHA224withRSA() {
      +            super("SHA-224", AlgorithmId.SHA224_oid, 11);
      +        }
      +    }
      +
           // Nested class for SHA256withRSA signatures
           public static final class SHA256withRSA extends RSASignature {
               public SHA256withRSA() {
      diff --git a/jdk/src/share/classes/sun/security/rsa/SunRsaSignEntries.java b/jdk/src/share/classes/sun/security/rsa/SunRsaSignEntries.java
      index fc8f5576339..836fc5f201c 100644
      --- a/jdk/src/share/classes/sun/security/rsa/SunRsaSignEntries.java
      +++ b/jdk/src/share/classes/sun/security/rsa/SunRsaSignEntries.java
      @@ -1,5 +1,5 @@
       /*
      - * Copyright (c) 2003, 2006, Oracle and/or its affiliates. All rights reserved.
      + * 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
      @@ -52,6 +52,8 @@ public final class SunRsaSignEntries {
                       "sun.security.rsa.RSASignature$MD5withRSA");
               map.put("Signature.SHA1withRSA",
                       "sun.security.rsa.RSASignature$SHA1withRSA");
      +        map.put("Signature.SHA224withRSA",
      +                "sun.security.rsa.RSASignature$SHA224withRSA");
               map.put("Signature.SHA256withRSA",
                       "sun.security.rsa.RSASignature$SHA256withRSA");
               map.put("Signature.SHA384withRSA",
      @@ -66,6 +68,7 @@ public final class SunRsaSignEntries {
               map.put("Signature.MD2withRSA SupportedKeyClasses", rsaKeyClasses);
               map.put("Signature.MD5withRSA SupportedKeyClasses", rsaKeyClasses);
               map.put("Signature.SHA1withRSA SupportedKeyClasses", rsaKeyClasses);
      +        map.put("Signature.SHA224withRSA SupportedKeyClasses", rsaKeyClasses);
               map.put("Signature.SHA256withRSA SupportedKeyClasses", rsaKeyClasses);
               map.put("Signature.SHA384withRSA SupportedKeyClasses", rsaKeyClasses);
               map.put("Signature.SHA512withRSA SupportedKeyClasses", rsaKeyClasses);
      @@ -88,6 +91,9 @@ public final class SunRsaSignEntries {
               map.put("Alg.Alias.Signature.OID.1.2.840.113549.1.1.5", "SHA1withRSA");
               map.put("Alg.Alias.Signature.1.3.14.3.2.29",            "SHA1withRSA");
       
      +        map.put("Alg.Alias.Signature.1.2.840.113549.1.1.14",     "SHA224withRSA");
      +        map.put("Alg.Alias.Signature.OID.1.2.840.113549.1.1.14", "SHA224withRSA");
      +
               map.put("Alg.Alias.Signature.1.2.840.113549.1.1.11",     "SHA256withRSA");
               map.put("Alg.Alias.Signature.OID.1.2.840.113549.1.1.11", "SHA256withRSA");
       
      diff --git a/jdk/src/share/classes/sun/security/x509/AlgorithmId.java b/jdk/src/share/classes/sun/security/x509/AlgorithmId.java
      index 4602248c1f3..0504707fa8a 100644
      --- a/jdk/src/share/classes/sun/security/x509/AlgorithmId.java
      +++ b/jdk/src/share/classes/sun/security/x509/AlgorithmId.java
      @@ -1,5 +1,5 @@
       /*
      - * Copyright (c) 1996, 2011, Oracle and/or its affiliates. All rights reserved.
      + * Copyright (c) 1996, 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
      @@ -175,9 +175,9 @@ public class AlgorithmId implements Serializable, DerEncoder {
                   // it's NULL. They are ---
                   // rfc3370 2.1: Implementations SHOULD generate SHA-1
                   // AlgorithmIdentifiers with absent parameters.
      -            // rfc3447 C1: When id-sha1, id-sha256, id-sha384 and id-sha512
      -            // are used in an AlgorithmIdentifier the parameters (which are
      -            // optional) SHOULD be omitted.
      +            // rfc3447 C1: When id-sha1, id-sha224, id-sha256, id-sha384 and
      +            // id-sha512 are used in an AlgorithmIdentifier the parameters
      +            // (which are optional) SHOULD be omitted.
                   // rfc3279 2.3.2: The id-dsa algorithm syntax includes optional
                   // domain parameters... When omitted, the parameters component
                   // MUST be omitted entirely
      @@ -185,6 +185,7 @@ public class AlgorithmId implements Serializable, DerEncoder {
                   // is used, the AlgorithmIdentifier parameters field MUST be absent.
                   /*if (
                       algid.equals((Object)SHA_oid) ||
      +                algid.equals((Object)SHA224_oid) ||
                       algid.equals((Object)SHA256_oid) ||
                       algid.equals((Object)SHA384_oid) ||
                       algid.equals((Object)SHA512_oid) ||
      @@ -488,7 +489,10 @@ public class AlgorithmId implements Serializable, DerEncoder {
                   name.equalsIgnoreCase("SHA512")) {
                   return AlgorithmId.SHA512_oid;
               }
      -
      +        if (name.equalsIgnoreCase("SHA-224") ||
      +            name.equalsIgnoreCase("SHA224")) {
      +            return AlgorithmId.SHA224_oid;
      +        }
       
               // Various public key algorithms
               if (name.equalsIgnoreCase("RSA")) {
      @@ -625,6 +629,9 @@ public class AlgorithmId implements Serializable, DerEncoder {
           public static final ObjectIdentifier SHA_oid =
           ObjectIdentifier.newInternal(new int[] {1, 3, 14, 3, 2, 26});
       
      +    public static final ObjectIdentifier SHA224_oid =
      +    ObjectIdentifier.newInternal(new int[] {2, 16, 840, 1, 101, 3, 4, 2, 4});
      +
           public static final ObjectIdentifier SHA256_oid =
           ObjectIdentifier.newInternal(new int[] {2, 16, 840, 1, 101, 3, 4, 2, 1});
       
      @@ -664,6 +671,8 @@ public class AlgorithmId implements Serializable, DerEncoder {
                                              { 1, 2, 840, 113549, 1, 1, 5 };
           private static final int sha1WithRSAEncryption_OIW_data[] =
                                              { 1, 3, 14, 3, 2, 29 };
      +    private static final int sha224WithRSAEncryption_data[] =
      +                                       { 1, 2, 840, 113549, 1, 1, 14 };
           private static final int sha256WithRSAEncryption_data[] =
                                              { 1, 2, 840, 113549, 1, 1, 11 };
           private static final int sha384WithRSAEncryption_data[] =
      @@ -681,6 +690,7 @@ public class AlgorithmId implements Serializable, DerEncoder {
           public static final ObjectIdentifier md5WithRSAEncryption_oid;
           public static final ObjectIdentifier sha1WithRSAEncryption_oid;
           public static final ObjectIdentifier sha1WithRSAEncryption_OIW_oid;
      +    public static final ObjectIdentifier sha224WithRSAEncryption_oid;
           public static final ObjectIdentifier sha256WithRSAEncryption_oid;
           public static final ObjectIdentifier sha384WithRSAEncryption_oid;
           public static final ObjectIdentifier sha512WithRSAEncryption_oid;
      @@ -809,6 +819,14 @@ public class AlgorithmId implements Serializable, DerEncoder {
               sha1WithRSAEncryption_OIW_oid =
                   ObjectIdentifier.newInternal(sha1WithRSAEncryption_OIW_data);
       
      +    /**
      +     * Identifies a signing algorithm where a SHA224 digest is
      +     * encrypted using an RSA private key; defined by PKCS #1.
      +     * OID = 1.2.840.113549.1.1.14
      +     */
      +        sha224WithRSAEncryption_oid =
      +            ObjectIdentifier.newInternal(sha224WithRSAEncryption_data);
      +
           /**
            * Identifies a signing algorithm where a SHA256 digest is
            * encrypted using an RSA private key; defined by PKCS #1.
      @@ -859,6 +877,7 @@ public class AlgorithmId implements Serializable, DerEncoder {
               nameTable.put(MD5_oid, "MD5");
               nameTable.put(MD2_oid, "MD2");
               nameTable.put(SHA_oid, "SHA");
      +        nameTable.put(SHA224_oid, "SHA224");
               nameTable.put(SHA256_oid, "SHA256");
               nameTable.put(SHA384_oid, "SHA384");
               nameTable.put(SHA512_oid, "SHA512");
      @@ -881,6 +900,7 @@ public class AlgorithmId implements Serializable, DerEncoder {
               nameTable.put(shaWithDSA_OIW_oid, "SHA1withDSA");
               nameTable.put(sha1WithRSAEncryption_oid, "SHA1withRSA");
               nameTable.put(sha1WithRSAEncryption_OIW_oid, "SHA1withRSA");
      +        nameTable.put(sha224WithRSAEncryption_oid, "SHA224withRSA");
               nameTable.put(sha256WithRSAEncryption_oid, "SHA256withRSA");
               nameTable.put(sha384WithRSAEncryption_oid, "SHA384withRSA");
               nameTable.put(sha512WithRSAEncryption_oid, "SHA512withRSA");
      diff --git a/jdk/src/windows/classes/sun/security/mscapi/RSASignature.java b/jdk/src/windows/classes/sun/security/mscapi/RSASignature.java
      index 488c2365b00..f29a62af583 100644
      --- a/jdk/src/windows/classes/sun/security/mscapi/RSASignature.java
      +++ b/jdk/src/windows/classes/sun/security/mscapi/RSASignature.java
      @@ -47,6 +47,7 @@ import sun.security.rsa.RSAKeyFactory;
        *
        *  . "NONEwithRSA"
        *  . "SHA1withRSA"
      + *  . "SHA224withRSA"
        *  . "SHA256withRSA"
        *  . "SHA384withRSA"
        *  . "SHA512withRSA"
      @@ -57,8 +58,8 @@ import sun.security.rsa.RSAKeyFactory;
        *
        * NOTE: NONEwithRSA must be supplied with a pre-computed message digest.
        *       Only the following digest algorithms are supported: MD5, SHA-1,
      - *       SHA-256, SHA-384, SHA-512 and a special-purpose digest algorithm
      - *       which is a concatenation of SHA-1 and MD5 digests.
      + *       SHA-224, SHA-256, SHA-384, SHA-512 and a special-purpose digest
      + *       algorithm which is a concatenation of SHA-1 and MD5 digests.
        *
        * @since   1.6
        * @author  Stanley Man-Kit Ho
      @@ -180,6 +181,8 @@ abstract class RSASignature extends java.security.SignatureSpi
                       setDigestName("SHA-512");
                   } else if (offset == 16) {
                       setDigestName("MD5");
      +            } else if (offset == 28) {
      +                setDigestName("SHA-224");
                   } else {
                       throw new SignatureException(
                           "Message digest length is not supported");
      @@ -199,6 +202,12 @@ abstract class RSASignature extends java.security.SignatureSpi
               }
           }
       
      +    public static final class SHA224 extends RSASignature {
      +        public SHA224() {
      +            super("SHA-224");
      +        }
      +    }
      +
           public static final class SHA256 extends RSASignature {
               public SHA256() {
                   super("SHA-256");
      diff --git a/jdk/src/windows/classes/sun/security/mscapi/SunMSCAPI.java b/jdk/src/windows/classes/sun/security/mscapi/SunMSCAPI.java
      index f7df7ce4a8f..bcba08c739a 100644
      --- a/jdk/src/windows/classes/sun/security/mscapi/SunMSCAPI.java
      +++ b/jdk/src/windows/classes/sun/security/mscapi/SunMSCAPI.java
      @@ -1,5 +1,5 @@
       /*
      - * Copyright (c) 2005, 2011, Oracle and/or its affiliates. All rights reserved.
      + * Copyright (c) 2005, 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
      @@ -81,18 +81,30 @@ public final class SunMSCAPI extends Provider {
                */
               // NONEwithRSA must be supplied with a pre-computed message digest.
               // Only the following digest algorithms are supported: MD5, SHA-1,
      -        // SHA-256, SHA-384, SHA-512 and a special-purpose digest algorithm
      -        // which is a concatenation of SHA-1 and MD5 digests.
      +        // SHA-224, SHA-256, SHA-384, SHA-512 and a special-purpose digest
      +        // algorithm which is a concatenation of SHA-1 and MD5 digests.
               map.put("Signature.NONEwithRSA",
                   "sun.security.mscapi.RSASignature$Raw");
               map.put("Signature.SHA1withRSA",
                   "sun.security.mscapi.RSASignature$SHA1");
      +        map.put("Signature.SHA224withRSA",
      +            "sun.security.mscapi.RSASignature$SHA224");
      +        map.put("Alg.Alias.Signature.1.2.840.113549.1.1.14",     "SHA224withRSA");
      +        map.put("Alg.Alias.Signature.OID.1.2.840.113549.1.1.14", "SHA224withRSA");
               map.put("Signature.SHA256withRSA",
                   "sun.security.mscapi.RSASignature$SHA256");
      +        map.put("Alg.Alias.Signature.1.2.840.113549.1.1.11",     "SHA256withRSA");
      +        map.put("Alg.Alias.Signature.OID.1.2.840.113549.1.1.11", "SHA256withRSA");
               map.put("Signature.SHA384withRSA",
                   "sun.security.mscapi.RSASignature$SHA384");
      +        map.put("Alg.Alias.Signature.1.2.840.113549.1.1.12",     "SHA384withRSA");
      +        map.put("Alg.Alias.Signature.OID.1.2.840.113549.1.1.12", "SHA384withRSA");
      +
               map.put("Signature.SHA512withRSA",
                   "sun.security.mscapi.RSASignature$SHA512");
      +        map.put("Alg.Alias.Signature.1.2.840.113549.1.1.13",     "SHA512withRSA");
      +        map.put("Alg.Alias.Signature.OID.1.2.840.113549.1.1.13", "SHA512withRSA");
      +
               map.put("Signature.MD5withRSA",
                   "sun.security.mscapi.RSASignature$MD5");
               map.put("Signature.MD2withRSA",
      @@ -103,6 +115,8 @@ public final class SunMSCAPI extends Provider {
                   "sun.security.mscapi.Key");
               map.put("Signature.SHA1withRSA SupportedKeyClasses",
                   "sun.security.mscapi.Key");
      +        map.put("Signature.SHA224withRSA SupportedKeyClasses",
      +            "sun.security.mscapi.Key");
               map.put("Signature.SHA256withRSA SupportedKeyClasses",
                   "sun.security.mscapi.Key");
               map.put("Signature.SHA384withRSA SupportedKeyClasses",
      diff --git a/jdk/test/com/sun/crypto/provider/Cipher/RSA/TestOAEP.java b/jdk/test/com/sun/crypto/provider/Cipher/RSA/TestOAEP.java
      index 2d7d8863b08..55b501ebf36 100644
      --- a/jdk/test/com/sun/crypto/provider/Cipher/RSA/TestOAEP.java
      +++ b/jdk/test/com/sun/crypto/provider/Cipher/RSA/TestOAEP.java
      @@ -1,5 +1,5 @@
       /*
      - * Copyright (c) 2003, 2007, Oracle and/or its affiliates. All rights reserved.
      + * 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
      @@ -58,6 +58,7 @@ public class TestOAEP {
               Cipher.getInstance("RSA/ECB/OAEPwithMD5andMGF1Padding");
               Cipher.getInstance("RSA/ECB/OAEPwithSHA1andMGF1Padding");
               Cipher.getInstance("RSA/ECB/OAEPwithSHA-1andMGF1Padding");
      +        Cipher.getInstance("RSA/ECB/OAEPwithSHA-224andMGF1Padding");
               Cipher.getInstance("RSA/ECB/OAEPwithSHA-256andMGF1Padding");
               Cipher.getInstance("RSA/ECB/OAEPwithSHA-384andMGF1Padding");
               Cipher.getInstance("RSA/ECB/OAEPwithSHA-512andMGF1Padding");
      @@ -88,6 +89,18 @@ public class TestOAEP {
               // tests alias works
               testEncryptDecrypt("SHA-1", 16);
       
      +        // basic test using SHA-224
      +        testEncryptDecrypt("SHA-224", 0);
      +        testEncryptDecrypt("SHA-224", 16);
      +        testEncryptDecrypt("SHA-224", 38);
      +        try {
      +            testEncryptDecrypt("SHA-224", 39);
      +            throw new Exception("Unexpectedly completed call");
      +        } catch (IllegalBlockSizeException e) {
      +            // ok
      +            System.out.println(e);
      +        }
      +
               // basic test using SHA-256
               testEncryptDecrypt("SHA-256", 0);
               testEncryptDecrypt("SHA-256", 16);
      @@ -195,6 +208,7 @@ public class TestOAEP {
               System.out.println("Done (" + (stop - start) + " ms).");
           }
       
      +    // NOTE: OAEP can process up to (modLen - 2*digestLen - 2) bytes of data
           private static void testEncryptDecrypt(String hashAlg, int dataLength) throws Exception {
               System.out.println("Testing OAEP with hash " + hashAlg + ", " + dataLength + " bytes");
               Cipher c = Cipher.getInstance("RSA/ECB/OAEPwith" + hashAlg + "andMGF1Padding", cp);
      diff --git a/jdk/test/com/sun/crypto/provider/Cipher/RSA/TestOAEPParameterSpec.java b/jdk/test/com/sun/crypto/provider/Cipher/RSA/TestOAEPParameterSpec.java
      index 366467b2bf6..1a152859f35 100644
      --- a/jdk/test/com/sun/crypto/provider/Cipher/RSA/TestOAEPParameterSpec.java
      +++ b/jdk/test/com/sun/crypto/provider/Cipher/RSA/TestOAEPParameterSpec.java
      @@ -1,5 +1,5 @@
       /*
      - * Copyright (c) 2003, 2007, Oracle and/or its affiliates. All rights reserved.
      + * 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
      @@ -121,6 +121,7 @@ public class TestOAEPParameterSpec {
           public static void main(String[] argv) throws Exception {
               boolean status = true;
               byte[] p = { (byte) 0x01, (byte) 0x02, (byte) 0x03, (byte) 0x04 };
      +        status &= runTest("SHA-224", MGF1ParameterSpec.SHA224, p);
               status &= runTest("SHA-256", MGF1ParameterSpec.SHA256, p);
               status &= runTest("SHA-384", MGF1ParameterSpec.SHA384, p);
               status &= runTest("SHA-512", MGF1ParameterSpec.SHA512, p);
      diff --git a/jdk/test/com/sun/crypto/provider/Cipher/RSA/TestOAEPWithParams.java b/jdk/test/com/sun/crypto/provider/Cipher/RSA/TestOAEPWithParams.java
      index 97ee3a82ead..13bdfe1a31b 100644
      --- a/jdk/test/com/sun/crypto/provider/Cipher/RSA/TestOAEPWithParams.java
      +++ b/jdk/test/com/sun/crypto/provider/Cipher/RSA/TestOAEPWithParams.java
      @@ -1,5 +1,5 @@
       /*
      - * Copyright (c) 2003, 2007, Oracle and/or its affiliates. All rights reserved.
      + * 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
      @@ -47,10 +47,10 @@ public class TestOAEPWithParams {
           private static Random random = new Random();
       
           private static String MD[] = {
      -        "MD5", "SHA1", "SHA-256"
      +        "MD5", "SHA1", "SHA-224", "SHA-256"
           };
           private static int DATA_LENGTH[] = {
      -        62, 54, 30
      +        62, 54, 34, 30
           };
           public static void main(String[] args) throws Exception {
               long start = System.currentTimeMillis();
      diff --git a/jdk/test/com/sun/crypto/provider/KeyGenerator/Test4628062.java b/jdk/test/com/sun/crypto/provider/KeyGenerator/Test4628062.java
      index d037c2290ef..3fc55b7f8c3 100644
      --- a/jdk/test/com/sun/crypto/provider/KeyGenerator/Test4628062.java
      +++ b/jdk/test/com/sun/crypto/provider/KeyGenerator/Test4628062.java
      @@ -23,7 +23,7 @@
       
       /*
        * @test
      - * @bug 4628062
      + * @bug 4628062 4963723
        * @summary Verify that AES KeyGenerator supports default initialization
        *      when init is not called
        * @author Valerie Peng
      @@ -34,39 +34,45 @@ import java.util.*;
       
       public class Test4628062 {
       
      -    private static final String ALGO = "AES";
      -    private static final int[] KEYSIZES =
      -        { 16, 24, 32 }; // in bytes
      +    private static final int[] AES_SIZES = { 16, 24, 32 }; // in bytes
      +    private static final int[] HMACSHA224_SIZES = { 28 };
      +    private static final int[] HMACSHA256_SIZES = { 32 };
      +    private static final int[] HMACSHA384_SIZES = { 48 };
      +    private static final int[] HMACSHA512_SIZES = { 64 };
       
      -    public boolean execute() throws Exception {
      -        KeyGenerator kg = KeyGenerator.getInstance(ALGO, "SunJCE");
      +    public boolean execute(String algo, int[] keySizes) throws Exception {
      +        KeyGenerator kg = KeyGenerator.getInstance(algo, "SunJCE");
       
               // TEST FIX 4628062
               Key keyWithDefaultSize = kg.generateKey();
               byte[] encoding = keyWithDefaultSize.getEncoded();
      -        if (encoding.length == 0) {
      +        int defKeyLen = encoding.length ;
      +        if (defKeyLen == 0) {
                   throw new Exception("default key length is 0!");
      +        } else if (defKeyLen != keySizes[0]) {
      +            throw new Exception("default key length mismatch!");
               }
       
               // BONUS TESTS
      -        // 1. call init(int keysize) with various valid key sizes
      -        // and see if the generated key is the right size.
      -        for (int i=0; i 1) {
      +            // 1. call init(int keysize) with various valid key sizes
      +            // and see if the generated key is the right size.
      +            for (int i=0; i 512) {
      diff --git a/jdk/test/sun/security/pkcs11/rsa/TestSignatures.java b/jdk/test/sun/security/pkcs11/rsa/TestSignatures.java
      index 13c55339429..fd11d0cb67b 100644
      --- a/jdk/test/sun/security/pkcs11/rsa/TestSignatures.java
      +++ b/jdk/test/sun/security/pkcs11/rsa/TestSignatures.java
      @@ -1,5 +1,5 @@
       /*
      - * Copyright (c) 2003, Oracle and/or its affiliates. All rights reserved.
      + * 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
      @@ -81,6 +81,7 @@ public class TestSignatures extends PKCS11Test {
               testSignature("MD2withRSA", privateKey, publicKey);
               testSignature("MD5withRSA", privateKey, publicKey);
               testSignature("SHA1withRSA", privateKey, publicKey);
      +        testSignature("SHA224withRSA", privateKey, publicKey);
               testSignature("SHA256withRSA", privateKey, publicKey);
               RSAPublicKey rsaKey = (RSAPublicKey)publicKey;
               if (rsaKey.getModulus().bitLength() > 512) {
      diff --git a/jdk/test/sun/security/provider/MessageDigest/DigestKAT.java b/jdk/test/sun/security/provider/MessageDigest/DigestKAT.java
      index a49c5ce8707..c6746de867b 100644
      --- a/jdk/test/sun/security/provider/MessageDigest/DigestKAT.java
      +++ b/jdk/test/sun/security/provider/MessageDigest/DigestKAT.java
      @@ -1,5 +1,5 @@
       /*
      - * Copyright (c) 2003, 2005, Oracle and/or its affiliates. All rights reserved.
      + * 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
      @@ -23,7 +23,7 @@
       
       /**
        * @test
      - * @bug 4819771 4834179 5008306
      + * @bug 4819771 4834179 5008306 4963723
        * @summary Basic known-answer-test for all our MessageDigest algorithms
        * @author Andreas Sterbenz
        */
      @@ -190,6 +190,12 @@ public class DigestKAT {
               t("SHA1", ALONG, "ce:56:53:59:08:04:ba:a9:36:9f:72:d4:83:ed:9e:ba:72:f0:4d:29"),
               t("SHA1", BLONG, "1d:a8:1a:de:8d:1e:d0:82:ba:12:13:e2:56:26:30:fc:05:b8:8d:a6"),
       
      +        t("SHA-224", s(""), "d1:4a:02:8c:2a:3a:2b:c9:47:61:02:bb:28:82:34:c4:15:a2:b0:1f:82:8e:a6:2a:c5:b3:e4:2f"),
      +        t("SHA-224", s("abc"), "23:09:7d:22:34:05:d8:22:86:42:a4:77:bd:a2:55:b3:2a:ad:bc:e4:bd:a0:b3:f7:e3:6c:9d:a7"),
      +        t("SHA-224", s("abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq"), "75:38:8b:16:51:27:76:cc:5d:ba:5d:a1:fd:89:01:50:b0:c6:45:5c:b4:f5:8b:19:52:52:25:25"),
      +        t("SHA-224", s("The quick brown fox jumps over the lazy dog"), "73:0e:10:9b:d7:a8:a3:2b:1c:b9:d9:a0:9a:a2:32:5d:24:30:58:7d:db:c0:c3:8b:ad:91:15:25"),
      +        t("SHA-224", s("The quick brown fox jumps over the lazy dog."), "61:9c:ba:8e:8e:05:82:6e:9b:8c:51:9c:0a:5c:68:f4:fb:65:3e:8a:3d:8a:a0:4b:b2:c8:cd:4c"),
      +
               t("SHA-256", s(""), "e3:b0:c4:42:98:fc:1c:14:9a:fb:f4:c8:99:6f:b9:24:27:ae:41:e4:64:9b:93:4c:a4:95:99:1b:78:52:b8:55"),
               t("SHA-256", s("a"), "ca:97:81:12:ca:1b:bd:ca:fa:c2:31:b3:9a:23:dc:4d:a7:86:ef:f8:14:7c:4e:72:b9:80:77:85:af:ee:48:bb"),
               t("SHA-256", s("abc"), "ba:78:16:bf:8f:01:cf:ea:41:41:40:de:5d:ae:22:23:b0:03:61:a3:96:17:7a:9c:b4:10:ff:61:f2:00:15:ad"),
      diff --git a/jdk/test/sun/security/provider/MessageDigest/Offsets.java b/jdk/test/sun/security/provider/MessageDigest/Offsets.java
      index 691278e3d18..eaa98fcbd75 100644
      --- a/jdk/test/sun/security/provider/MessageDigest/Offsets.java
      +++ b/jdk/test/sun/security/provider/MessageDigest/Offsets.java
      @@ -1,5 +1,5 @@
       /*
      - * Copyright (c) 2006, Oracle and/or its affiliates. All rights reserved.
      + * Copyright (c) 2006, 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
      @@ -80,6 +80,7 @@ public class Offsets {
               test("MD2", 0, 64, 0, 128);
               test("MD5", 0, 64, 0, 128);
               test("SHA1", 0, 64, 0, 128);
      +        test("SHA-224", 0, 64, 0, 128);
               test("SHA-256", 0, 64, 0, 128);
               test("SHA-384", 0, 128, 0, 256);
               test("SHA-512", 0, 128, 0, 256);
      diff --git a/jdk/test/sun/security/provider/MessageDigest/TestSHAClone.java b/jdk/test/sun/security/provider/MessageDigest/TestSHAClone.java
      index 376bb4696a4..f1d1089f39a 100644
      --- a/jdk/test/sun/security/provider/MessageDigest/TestSHAClone.java
      +++ b/jdk/test/sun/security/provider/MessageDigest/TestSHAClone.java
      @@ -1,5 +1,5 @@
       /*
      - * Copyright (c) 2002, 2003, Oracle and/or its affiliates. All rights reserved.
      + * Copyright (c) 2002, 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
      @@ -24,7 +24,7 @@
       /**
        * @test
        * @bug 4775971
      - * @summary test the clone implementation of SHA, SHA-256,
      + * @summary test the clone implementation of SHA, SHA-224, SHA-256,
        *          SHA-384, SHA-512 MessageDigest implementation.
        */
       import java.security.*;
      @@ -33,7 +33,7 @@ import java.util.*;
       public class TestSHAClone {
       
           private static final String[] ALGOS = {
      -        "SHA", "SHA-256", "SHA-512", "SHA-384"
      +        "SHA", "SHA-224", "SHA-256", "SHA-512", "SHA-384"
           };
       
           private static byte[] input1 = {
      diff --git a/jdk/test/sun/security/rsa/TestKeyPairGenerator.java b/jdk/test/sun/security/rsa/TestKeyPairGenerator.java
      index 88ab075bced..5e661b08ef1 100644
      --- a/jdk/test/sun/security/rsa/TestKeyPairGenerator.java
      +++ b/jdk/test/sun/security/rsa/TestKeyPairGenerator.java
      @@ -1,5 +1,5 @@
       /*
      - * Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved.
      + * 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
      @@ -23,7 +23,7 @@
       
       /**
        * @test
      - * @bug 4853305 4865198 4888410
      + * @bug 4853305 4865198 4888410 4963723
        * @summary Verify that the RSA KeyPairGenerator works
        * @author Andreas Sterbenz
        */
      @@ -60,6 +60,7 @@ public class TestKeyPairGenerator {
               testSignature("MD2withRSA", privateKey, publicKey);
               testSignature("MD5withRSA", privateKey, publicKey);
               testSignature("SHA1withRSA", privateKey, publicKey);
      +        testSignature("SHA224withRSA", privateKey, publicKey);
               testSignature("SHA256withRSA", privateKey, publicKey);
               RSAPublicKey rsaKey = (RSAPublicKey)publicKey;
               if (rsaKey.getModulus().bitLength() > 512) {
      diff --git a/jdk/test/sun/security/rsa/TestSignatures.java b/jdk/test/sun/security/rsa/TestSignatures.java
      index 2293077dd20..1933f264295 100644
      --- a/jdk/test/sun/security/rsa/TestSignatures.java
      +++ b/jdk/test/sun/security/rsa/TestSignatures.java
      @@ -1,5 +1,5 @@
       /*
      - * Copyright (c) 2003, Oracle and/or its affiliates. All rights reserved.
      + * 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
      @@ -23,7 +23,7 @@
       
       /**
        * @test
      - * @bug 4853305
      + * @bug 4853305 4963723
        * @summary Test signing/verifying using all the signature algorithms
        * @author Andreas Sterbenz
        */
      @@ -80,6 +80,7 @@ public class TestSignatures {
               testSignature("MD2withRSA", privateKey, publicKey);
               testSignature("MD5withRSA", privateKey, publicKey);
               testSignature("SHA1withRSA", privateKey, publicKey);
      +        testSignature("SHA224withRSA", privateKey, publicKey);
               testSignature("SHA256withRSA", privateKey, publicKey);
               RSAPublicKey rsaKey = (RSAPublicKey)publicKey;
               if (rsaKey.getModulus().bitLength() > 512) {
      
      From 081be38b26cca6c1bf0fa98d4c136ae9a452ec7d Mon Sep 17 00:00:00 2001
      From: Xue-Lei Andrew Fan 
      Date: Tue, 8 May 2012 18:08:49 -0700
      Subject: [PATCH 020/128] 7166570: JSSE certificate validation has started to
       fail for certificate chains
      
      Reviewed-by: wetmore
      ---
       .../security/validator/SimpleValidator.java   |   2 +-
       .../BasicConstraints.java                     | 555 ++++++++++++++++++
       2 files changed, 556 insertions(+), 1 deletion(-)
       create mode 100644 jdk/test/sun/security/ssl/com/sun/net/ssl/internal/ssl/X509TrustManagerImpl/BasicConstraints.java
      
      diff --git a/jdk/src/share/classes/sun/security/validator/SimpleValidator.java b/jdk/src/share/classes/sun/security/validator/SimpleValidator.java
      index 94698427b92..a0f4f8b9e7e 100644
      --- a/jdk/src/share/classes/sun/security/validator/SimpleValidator.java
      +++ b/jdk/src/share/classes/sun/security/validator/SimpleValidator.java
      @@ -311,7 +311,7 @@ public final class SimpleValidator extends Validator {
               // if the certificate is self-issued, ignore the pathLenConstraint
               // checking.
               if (!X509CertImpl.isSelfIssued(cert)) {
      -            if (maxPathLen <= 1) {   // reserved one for end-entity certificate
      +            if (maxPathLen <= 0) {
                       throw new ValidatorException("Violated path length constraints",
                           ValidatorException.T_CA_EXTENSIONS, cert);
                   }
      diff --git a/jdk/test/sun/security/ssl/com/sun/net/ssl/internal/ssl/X509TrustManagerImpl/BasicConstraints.java b/jdk/test/sun/security/ssl/com/sun/net/ssl/internal/ssl/X509TrustManagerImpl/BasicConstraints.java
      new file mode 100644
      index 00000000000..1756ba0cacd
      --- /dev/null
      +++ b/jdk/test/sun/security/ssl/com/sun/net/ssl/internal/ssl/X509TrustManagerImpl/BasicConstraints.java
      @@ -0,0 +1,555 @@
      +/*
      + * Copyright (c) 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.
      + */
      +
      +/*
      + * @test
      + * @bug 7166570
      + * @summary JSSE certificate validation has started to fail for
      + *     certificate chains
      + *
      + *     SunJSSE does not support dynamic system properties, no way to re-use
      + *     system properties in samevm/agentvm mode.
      + * @run main/othervm BasicConstraints PKIX
      + * @run main/othervm BasicConstraints SunX509
      + */
      +
      +import java.net.*;
      +import java.util.*;
      +import java.io.*;
      +import javax.net.ssl.*;
      +import java.security.KeyStore;
      +import java.security.KeyFactory;
      +import java.security.cert.*;
      +import java.security.spec.*;
      +import java.security.interfaces.*;
      +import java.math.BigInteger;
      +
      +import sun.misc.BASE64Decoder;
      +
      +public class BasicConstraints {
      +
      +    /*
      +     * =============================================================
      +     * Set the various variables needed for the tests, then
      +     * specify what tests to run on each side.
      +     */
      +
      +    /*
      +     * Should we run the client or server in a separate thread?
      +     * Both sides can throw exceptions, but do you have a preference
      +     * as to which side should be the main thread.
      +     */
      +    static boolean separateServerThread = true;
      +
      +    /*
      +     * Where do we find the keystores?
      +     */
      +    // Certificate information:
      +    // Issuer: C=US, O=Java, OU=SunJSSE Test Serivce
      +    // Validity
      +    //     Not Before: May  5 02:40:50 2012 GMT
      +    //     Not After : Apr 15 02:40:50 2033 GMT
      +    // Subject: C=US, O=Java, OU=SunJSSE Test Serivce
      +    // X509v3 Subject Key Identifier:
      +    //     DD:4E:8D:2A:11:C0:83:03:F0:AC:EB:A2:BF:F9:F2:7D:C8:69:1F:9B
      +    // X509v3 Authority Key Identifier:
      +    //     keyid:DD:4E:8D:2A:11:C0:83:03:F0:AC:EB:A2:BF:F9:F2:7D:C8:69:1F:9B
      +    //     DirName:/C=US/O=Java/OU=SunJSSE Test Serivce
      +    //     serial:00
      +    static String trusedCertStr =
      +        "-----BEGIN CERTIFICATE-----\n" +
      +        "MIICkjCCAfugAwIBAgIBADANBgkqhkiG9w0BAQIFADA7MQswCQYDVQQGEwJVUzEN\n" +
      +        "MAsGA1UEChMESmF2YTEdMBsGA1UECxMUU3VuSlNTRSBUZXN0IFNlcml2Y2UwHhcN\n" +
      +        "MTIwNTA1MDI0MDUwWhcNMzMwNDE1MDI0MDUwWjA7MQswCQYDVQQGEwJVUzENMAsG\n" +
      +        "A1UEChMESmF2YTEdMBsGA1UECxMUU3VuSlNTRSBUZXN0IFNlcml2Y2UwgZ8wDQYJ\n" +
      +        "KoZIhvcNAQEBBQADgY0AMIGJAoGBANtiq0AIJK+iVRwFrqcD7fYXTCbMYC5Qz/k6\n" +
      +        "AXBy7/1rI8wDhEJLE3m/+NSqiJwZcmdq2dNh/1fJFrwvzuURbc9+paOBWeHbN+Sc\n" +
      +        "x3huw91oPZme385VpoK3G13rSE114S/rF4DM9mz4EStFhSHXATjtdbskNOAYGLTV\n" +
      +        "x8uEy9GbAgMBAAGjgaUwgaIwHQYDVR0OBBYEFN1OjSoRwIMD8Kzror/58n3IaR+b\n" +
      +        "MGMGA1UdIwRcMFqAFN1OjSoRwIMD8Kzror/58n3IaR+boT+kPTA7MQswCQYDVQQG\n" +
      +        "EwJVUzENMAsGA1UEChMESmF2YTEdMBsGA1UECxMUU3VuSlNTRSBUZXN0IFNlcml2\n" +
      +        "Y2WCAQAwDwYDVR0TAQH/BAUwAwEB/zALBgNVHQ8EBAMCAQYwDQYJKoZIhvcNAQEC\n" +
      +        "BQADgYEAjjkJesQrkbr36N40egybaIxw7RcqT6iy5fkAGS1JYlBDk8uSCK1o6bCH\n" +
      +        "ls5EpYcGeEoabSS73WRdkO1lgeyWDduO4ef8cCCSpmpT6/YdZG0QS1PtcREeVig+\n" +
      +        "Zr25jNemS4ADHX0aaXP4kiV/G80cR7nX5t5XCUm4bYdbwM07NgI=\n" +
      +        "-----END CERTIFICATE-----";
      +    static String trustedPrivateKey = // Private key in the format of PKCS#8
      +        "MIICeAIBADANBgkqhkiG9w0BAQEFAASCAmIwggJeAgEAAoGBANtiq0AIJK+iVRwF\n" +
      +        "rqcD7fYXTCbMYC5Qz/k6AXBy7/1rI8wDhEJLE3m/+NSqiJwZcmdq2dNh/1fJFrwv\n" +
      +        "zuURbc9+paOBWeHbN+Scx3huw91oPZme385VpoK3G13rSE114S/rF4DM9mz4EStF\n" +
      +        "hSHXATjtdbskNOAYGLTVx8uEy9GbAgMBAAECgYEA2VjHkIiA0ABjkX+PqKeb+VLb\n" +
      +        "fxS7tSca5C8zfdRhLxAWRui0/3ihst0eCJNrBDuxvAOACovsDWyLuaUjtI2v2ysz\n" +
      +        "vz6SPyGy82PhQOFzyKQuQ814N6EpothpiZzF0yFchfKIGhUsdY89UrGs9nM7m6NT\n" +
      +        "rztYvgIu4avg2VPR2AECQQD+pFAqipR2BplQRIuuRSZfHRxvoEyDjT1xnHJsC6WP\n" +
      +        "I5hCLghL91MhQGWbP4EJMKYQOTRVukWlcp2Kycpf+P5hAkEA3I43gmVUAPEdyZdY\n" +
      +        "fatW7OaLlbbYJb6qEtpCZ1Rwe/BIvm6H6E3qSi/lpz7Ia7WDulpbF6BawHH3pRFq\n" +
      +        "CUY5ewJBAP3pUDqrRpBN0jB0uSeDslhjSciQ+dqvSpZv3rSYBHUvlBJhnkpJiy37\n" +
      +        "7ZUZhIxqYxyIPgRBolLwb+FFh7OdL+ECQCtldDic9WVmC+VheRDpCKZ+SlK/8lGi\n" +
      +        "7VXeShiIvcU1JysJFoa35fSI7hf1O3wt7+hX5PqGG7Un94EsJwACKEcCQQC1TWt6\n" +
      +        "ArKH6tRxKjOxFtqfs8fgEVYUaOr3j1jF4KBUuX2mtQtddZe3VfJ2wPsuKMMxmhkB\n" +
      +        "e7xWWZnJsErt2e+E";
      +
      +    // Certificate information:
      +    // Issuer: C=US, O=Java, OU=SunJSSE Test Serivce
      +    // Validity
      +    //     Not Before: May  5 02:40:53 2012 GMT
      +    //     Not After : Jan 21 02:40:53 2032 GMT
      +    // Subject: C=US, O=Java, OU=SunJSSE Test Serivce, CN=casigner
      +    // X509v3 Subject Key Identifier:
      +    //     13:07:E0:11:07:DB:EB:33:23:87:31:D0:DB:7E:16:56:BE:11:90:0A
      +    // X509v3 Authority Key Identifier:
      +    //     keyid:DD:4E:8D:2A:11:C0:83:03:F0:AC:EB:A2:BF:F9:F2:7D:C8:69:1F:9B
      +    //     DirName:/C=US/O=Java/OU=SunJSSE Test Serivce
      +    //     serial:00
      +    static String caSignerStr =
      +        "-----BEGIN CERTIFICATE-----\n" +
      +        "MIICqDCCAhGgAwIBAgIBAjANBgkqhkiG9w0BAQQFADA7MQswCQYDVQQGEwJVUzEN\n" +
      +        "MAsGA1UEChMESmF2YTEdMBsGA1UECxMUU3VuSlNTRSBUZXN0IFNlcml2Y2UwHhcN\n" +
      +        "MTIwNTA1MDI0MDUzWhcNMzIwMTIxMDI0MDUzWjBOMQswCQYDVQQGEwJVUzENMAsG\n" +
      +        "A1UEChMESmF2YTEdMBsGA1UECxMUU3VuSlNTRSBUZXN0IFNlcml2Y2UxETAPBgNV\n" +
      +        "BAMTCGNhc2lnbmVyMIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQC+x8+o7oM0\n" +
      +        "ct/LZmZLXBL4CQ8jrULD5P7NtEW0hg/zxBFZfBHf+44Oo2eMPYZj+7xaREOH5BmV\n" +
      +        "KRYlzRtONAaC5Ng4Mrm5UKNPcMIIUjUOvm7vWM4oSTMSfoEcSX+vp99uUAkw3w7Z\n" +
      +        "+frYDm1M4At/j0b+lLij71GFN2L8drpgPQIDAQABo4GoMIGlMB0GA1UdDgQWBBQT\n" +
      +        "B+ARB9vrMyOHMdDbfhZWvhGQCjBjBgNVHSMEXDBagBTdTo0qEcCDA/Cs66K/+fJ9\n" +
      +        "yGkfm6E/pD0wOzELMAkGA1UEBhMCVVMxDTALBgNVBAoTBEphdmExHTAbBgNVBAsT\n" +
      +        "FFN1bkpTU0UgVGVzdCBTZXJpdmNlggEAMBIGA1UdEwEB/wQIMAYBAf8CAQEwCwYD\n" +
      +        "VR0PBAQDAgEGMA0GCSqGSIb3DQEBBAUAA4GBAI+LXA/UCPkTANablUkt80JNPWsl\n" +
      +        "pS4XLNgPxWaN0bkRDs5oI4ooWAz1rwpeJ/nfetOvWlpmrVjSeovBFja5Hl+dUHTf\n" +
      +        "VfuyzkxXbhuNiJIpo1mVBpNsjwu9YRxuwX6UA2LTUQpgvtVJEE012x3zRvxBCbu2\n" +
      +        "Y/v1R5fZ4c+hXDfC\n" +
      +        "-----END CERTIFICATE-----";
      +    static String caSignerPrivateKey = // Private key in the format of PKCS#8
      +        "MIICdgIBADANBgkqhkiG9w0BAQEFAASCAmAwggJcAgEAAoGBAL7Hz6jugzRy38tm\n" +
      +        "ZktcEvgJDyOtQsPk/s20RbSGD/PEEVl8Ed/7jg6jZ4w9hmP7vFpEQ4fkGZUpFiXN\n" +
      +        "G040BoLk2DgyublQo09wwghSNQ6+bu9YzihJMxJ+gRxJf6+n325QCTDfDtn5+tgO\n" +
      +        "bUzgC3+PRv6UuKPvUYU3Yvx2umA9AgMBAAECgYBYvu30cW8LONyt62Zua9hPFTe7\n" +
      +        "qt9B7QYyfkdmoG5PQMepTrOp84SzfoOukvgvDm0huFuJnSvhXQl2cCDhkgXskvFj\n" +
      +        "Hh7KBCFViVXokGdq5YoS0/KYMyQV0TZfJUvILBl51uc4/siQ2tClC/N4sa+1JhgW\n" +
      +        "a6dFGfRjiUKSSlmMwQJBAPWpIz3Q/c+DYMvoQr5OD8EaYwYIevlTdXb97RnJJh2b\n" +
      +        "UnhB9jrqesJiHYVzPmP0ukyPOXOwlp2T5Am4Kw0LFOkCQQDGz150NoHOp28Mvyc4\n" +
      +        "CTqz/zYzUhy2eCJESl196uyP4N65Y01VYQ3JDww4DlsXiU17tVSbgA9TCcfTYOzy\n" +
      +        "vyw1AkARUky+1hafZCcWGZljK8PmnMKwsTZikCTvL/Zg5BMA8Wu+OQBwpQnk3OAy\n" +
      +        "Aa87gw0DyvGFG8Vy9POWT9sRP1/JAkBqP0hrMvYMSs6+MSn0eHo2151PsAJIQcuO\n" +
      +        "U2/Da1khSzu8N6WMi2GiobgV/RYRbf9KrY2ZzMZjykZQYOxAjopBAkEAghCu38cN\n" +
      +        "aOsW6ueo24uzsWI1FTdE+qWNVEi3RSP120xXBCyhaBjIq4WVSlJK9K2aBaJpit3j\n" +
      +        "iQ5tl6zrLlxQhg==";
      +
      +    // Certificate information:
      +    // Issuer: C=US, O=Java, OU=SunJSSE Test Serivce, CN=casigner
      +    // Validity
      +    //     Not Before: May  5 02:40:57 2012 GMT
      +    //     Not After : Jan 21 02:40:57 2032 GMT
      +    // Subject: C=US, O=Java, OU=SunJSSE Test Serivce, CN=certissuer
      +    // X509v3 Subject Key Identifier:
      +    //     39:0E:C6:33:B1:50:BC:73:07:31:E5:D8:04:F7:BB:97:55:CF:9B:C8
      +    // X509v3 Authority Key Identifier:
      +    //     keyid:13:07:E0:11:07:DB:EB:33:23:87:31:D0:DB:7E:16:56:BE:11:90:0A
      +    //     DirName:/C=US/O=Java/OU=SunJSSE Test Serivce
      +    //     serial:02
      +    static String certIssuerStr =
      +        "-----BEGIN CERTIFICATE-----\n" +
      +        "MIICvjCCAiegAwIBAgIBAzANBgkqhkiG9w0BAQQFADBOMQswCQYDVQQGEwJVUzEN\n" +
      +        "MAsGA1UEChMESmF2YTEdMBsGA1UECxMUU3VuSlNTRSBUZXN0IFNlcml2Y2UxETAP\n" +
      +        "BgNVBAMTCGNhc2lnbmVyMB4XDTEyMDUwNTAyNDA1N1oXDTMyMDEyMTAyNDA1N1ow\n" +
      +        "UDELMAkGA1UEBhMCVVMxDTALBgNVBAoTBEphdmExHTAbBgNVBAsTFFN1bkpTU0Ug\n" +
      +        "VGVzdCBTZXJpdmNlMRMwEQYDVQQDEwpjZXJ0aXNzdWVyMIGfMA0GCSqGSIb3DQEB\n" +
      +        "AQUAA4GNADCBiQKBgQCyz55zinU6kNL/LeiTNiBI0QWYmDG0YTotuC4D75liBNqs\n" +
      +        "7Mmladsh2mTtQUAwmuGaGzaZV25a+cUax0DXZoyBwdbTI09u1bUYsZcaUUKbPoCC\n" +
      +        "HH26e4jLFL4olW13Sv4ZAd57tIYevMw+Fp5f4fLPFGegCJTFlv2Qjpmic/cuvQID\n" +
      +        "AQABo4GpMIGmMB0GA1UdDgQWBBQ5DsYzsVC8cwcx5dgE97uXVc+byDBjBgNVHSME\n" +
      +        "XDBagBQTB+ARB9vrMyOHMdDbfhZWvhGQCqE/pD0wOzELMAkGA1UEBhMCVVMxDTAL\n" +
      +        "BgNVBAoTBEphdmExHTAbBgNVBAsTFFN1bkpTU0UgVGVzdCBTZXJpdmNlggECMBMG\n" +
      +        "A1UdEwEB/wQJMAcBAf8CAgQAMAsGA1UdDwQEAwIBBjANBgkqhkiG9w0BAQQFAAOB\n" +
      +        "gQCQTagenCdClT98C+oTJGJrw/dUBD9K3tE6ZJKPMc/2bUia8G5ei1C0eXj4mWG2\n" +
      +        "lu9umR6C90/A6qB050QB2h50qtqxSrkpu+ym1yypauZpg7U3nUY9wZWJNI1vqrQZ\n" +
      +        "pqUMRcXY3iQIVKx+Qj+4/Za1wwFQzpEoGmqRW31V1SdMEw==\n" +
      +        "-----END CERTIFICATE-----";
      +    static String certIssuerPrivateKey = // Private key in the format of PKCS#8
      +        "MIICeQIBADANBgkqhkiG9w0BAQEFAASCAmMwggJfAgEAAoGBALLPnnOKdTqQ0v8t\n" +
      +        "6JM2IEjRBZiYMbRhOi24LgPvmWIE2qzsyaVp2yHaZO1BQDCa4ZobNplXblr5xRrH\n" +
      +        "QNdmjIHB1tMjT27VtRixlxpRQps+gIIcfbp7iMsUviiVbXdK/hkB3nu0hh68zD4W\n" +
      +        "nl/h8s8UZ6AIlMWW/ZCOmaJz9y69AgMBAAECgYEAjtew2tgm4gxDojqIauF4VPM1\n" +
      +        "pzsdqd1p3pAdomNLgrQiBLZ8N7oiph6TNb1EjA+OXc+ThFgF/oM9ZDD8qZZwcvjN\n" +
      +        "qDZlpTkFs2TaGcyEZfUaMB45NHVs6Nn+pSkagSNwwy3xeyAct7sQEzGNTDlEwVv5\n" +
      +        "7V9LQutQtBd6xT48KzkCQQDpNRfv2OFNG/6GtzJoO68oJhpnpl2MsYNi4ntRkre/\n" +
      +        "6uXpiCYaDskcrPMRwOOs0m7mxG+Ev+uKnLnSoEMm1GCbAkEAxEmDtiD0Psb8Z9BL\n" +
      +        "ZRb83Jqho3xe2MCAh3xUfz9b/Mhae9dZ44o4OCgQZuwvW1mczF0NtpgZl93BmYa2\n" +
      +        "hTwHhwJBAKHrEj6ep/fA6x0gD2idoATRR94VfbiU+7NpqtO9ecVP0+gsdr/66hn1\n" +
      +        "3yLBeZLh3MxvMTrLgkAQh1i9m0JXjOcCQQClLXAHHegrw+u3uNMZeKTFR+Lp3sk6\n" +
      +        "AZSnbvr0Me9I45kxSeG81x3ENALJecvIRbrrRws5MvmmkNhQR8rkh8WVAkEAk6b+\n" +
      +        "aVtmBgUaTS5+FFlHGHJY9HFrfT1a1C/dwyMuqlmbC3YsBmZaMOlKli5TXNybLff8\n" +
      +        "5KMeGEpXMzgC7AscGA==";
      +
      +    // Certificate information:
      +    // Issuer: C=US, O=Java, OU=SunJSSE Test Serivce, CN=certissuer
      +    // Validity
      +    //     Not Before: May  5 02:41:01 2012 GMT
      +    //     Not After : Jan 21 02:41:01 2032 GMT
      +    // Subject: C=US, O=Java, OU=SunJSSE Test Serivce, CN=localhost
      +    // X509v3 Subject Key Identifier:
      +    //     AD:C0:2C:4C:E4:C2:2E:A1:BB:5D:92:BE:66:E0:4E:E0:0D:2F:11:EF
      +    // X509v3 Authority Key Identifier:
      +    //     keyid:39:0E:C6:33:B1:50:BC:73:07:31:E5:D8:04:F7:BB:97:55:CF:9B:C8
      +    static String serverCertStr =
      +        "-----BEGIN CERTIFICATE-----\n" +
      +        "MIICjTCCAfagAwIBAgIBBDANBgkqhkiG9w0BAQQFADBQMQswCQYDVQQGEwJVUzEN\n" +
      +        "MAsGA1UEChMESmF2YTEdMBsGA1UECxMUU3VuSlNTRSBUZXN0IFNlcml2Y2UxEzAR\n" +
      +        "BgNVBAMTCmNlcnRpc3N1ZXIwHhcNMTIwNTA1MDI0MTAxWhcNMzIwMTIxMDI0MTAx\n" +
      +        "WjBPMQswCQYDVQQGEwJVUzENMAsGA1UEChMESmF2YTEdMBsGA1UECxMUU3VuSlNT\n" +
      +        "RSBUZXN0IFNlcml2Y2UxEjAQBgNVBAMTCWxvY2FsaG9zdDCBnzANBgkqhkiG9w0B\n" +
      +        "AQEFAAOBjQAwgYkCgYEAvwaUd7wmBSKqycEstYLWD26vkU08DM39EtaT8wL9HnQ0\n" +
      +        "fgPblwBFI4zdLa2cuYXRZcFUb04N8nrkcpR0D6kkE+AlFAoRWrrZF80B7JTbtEK4\n" +
      +        "1PIeurihXvUT+4MpzGLOojIihMfvM4ufelblD56SInso4WFHm7t4qCln88J1gjkC\n" +
      +        "AwEAAaN4MHYwCwYDVR0PBAQDAgPoMB0GA1UdDgQWBBStwCxM5MIuobtdkr5m4E7g\n" +
      +        "DS8R7zAfBgNVHSMEGDAWgBQ5DsYzsVC8cwcx5dgE97uXVc+byDAnBgNVHSUEIDAe\n" +
      +        "BggrBgEFBQcDAQYIKwYBBQUHAwIGCCsGAQUFBwMDMA0GCSqGSIb3DQEBBAUAA4GB\n" +
      +        "AGfwcfdvEG/nSCiAn2MGbYHp34mgF3OA1SJLWUW0LvWJhwm2cn4AXlSoyvbwrkaB\n" +
      +        "IDDCwhJvvc0vUyL2kTx7sqVaFTq3mDs+ktlB/FfH0Pb+i8FE+g+7T42Iw/j0qxHL\n" +
      +        "YmgbrjBQf5WYN1AvBE/rrPt9aOtS3UsqtVGW574b0shW\n" +
      +        "-----END CERTIFICATE-----";
      +    static String serverPrivateKey = // Private key in the format of PKCS#8
      +        "MIICdAIBADANBgkqhkiG9w0BAQEFAASCAl4wggJaAgEAAoGBAL8GlHe8JgUiqsnB\n" +
      +        "LLWC1g9ur5FNPAzN/RLWk/MC/R50NH4D25cARSOM3S2tnLmF0WXBVG9ODfJ65HKU\n" +
      +        "dA+pJBPgJRQKEVq62RfNAeyU27RCuNTyHrq4oV71E/uDKcxizqIyIoTH7zOLn3pW\n" +
      +        "5Q+ekiJ7KOFhR5u7eKgpZ/PCdYI5AgMBAAECf3CscOYvFD3zNMnMJ5LomVqA7w3F\n" +
      +        "gKYM2jlCWAH+wU41PMEXhW6Lujw92jgXL1o+lERwxFzirVdZJWZwKgUSvzP1G0h3\n" +
      +        "fkucq1/UWnToK+8NSXNM/yS8hXbBgSEoJo5f7LKcIi1Ev6doBVofMxs+njzyWKbM\n" +
      +        "Nb7rOLHadghoon0CQQDgQzbzzSN8Dc1YmmylhI5v+0sQRHH0DL7D24k4Weh4vInG\n" +
      +        "EAbt4x8M7ZKEo8/dv0s4hbmNmAnJl93/RRxIyEqLAkEA2g87DiswSQam2pZ8GlrO\n" +
      +        "+w4Qg9mH8uxx8ou2rl0XlHzH1XiTNbkjfY0EZoL7L31BHFk9n11Fb2P85g6ws+Hy\n" +
      +        "ywJAM/xgyLNM/nzUlS128geAXUULaYH0SHaL4isJ7B4rXZGW/mrIsGxtzjlkNYsj\n" +
      +        "rGujrD6TfNc5rZmexIXowJZtcQJBAIww+pCzZ4mrgx5JXWQ8OZHiiu+ZrPOa2+9J\n" +
      +        "r5sOMpi+WGN/73S8oHqZbNjTINZ5OqEVJq8MchWZPQBTNXuQql0CQHEjUzzkCQa3\n" +
      +        "j6JTa2KAdqyvLOx0XF9zcc1gA069uNQI2gPUHS8V215z57f/gMGnDNhVfLs/vMKz\n" +
      +        "sFkVZ3zg7As=";
      +
      +    // Certificate information:
      +    // Issuer: C=US, O=Java, OU=SunJSSE Test Serivce, CN=certissuer
      +    // Validity
      +    //     Not Before: May  5 02:41:02 2012 GMT
      +    //     Not After : Jan 21 02:41:02 2032 GMT
      +    // Subject: C=US, O=Java, OU=SunJSSE Test Serivce, CN=InterOp Tester
      +    // X509v3 Subject Key Identifier:
      +    //     57:7D:E2:33:33:60:DF:DD:5E:ED:81:3F:EB:F2:1B:59:7F:50:9C:99
      +    // X509v3 Authority Key Identifier:
      +    //     keyid:39:0E:C6:33:B1:50:BC:73:07:31:E5:D8:04:F7:BB:97:55:CF:9B:C8
      +    static String clientCertStr =
      +        "-----BEGIN CERTIFICATE-----\n" +
      +        "MIICaTCCAdKgAwIBAgIBBTANBgkqhkiG9w0BAQQFADBQMQswCQYDVQQGEwJVUzEN\n" +
      +        "MAsGA1UEChMESmF2YTEdMBsGA1UECxMUU3VuSlNTRSBUZXN0IFNlcml2Y2UxEzAR\n" +
      +        "BgNVBAMTCmNlcnRpc3N1ZXIwHhcNMTIwNTA1MDI0MTAyWhcNMzIwMTIxMDI0MTAy\n" +
      +        "WjBUMQswCQYDVQQGEwJVUzENMAsGA1UEChMESmF2YTEdMBsGA1UECxMUU3VuSlNT\n" +
      +        "RSBUZXN0IFNlcml2Y2UxFzAVBgNVBAMTDkludGVyT3AgVGVzdGVyMIGfMA0GCSqG\n" +
      +        "SIb3DQEBAQUAA4GNADCBiQKBgQC1pA71nDg1KhhnHjRdi/eVDUa7uFZAtN8R9huu\n" +
      +        "pTwFoyqSX8lDMz8jDawOMmaI9dVZLjTh3hnf4KBEqQOearFVz45yBOjlgPLBuI4F\n" +
      +        "D/ORhgmDaIu2NK+c1yj6YQlyiO0DPwh55GtPLVG3iuEpejU7gQyaMuTaddoXrO7s\n" +
      +        "xwzanQIDAQABo08wTTALBgNVHQ8EBAMCA+gwHQYDVR0OBBYEFFd94jMzYN/dXu2B\n" +
      +        "P+vyG1l/UJyZMB8GA1UdIwQYMBaAFDkOxjOxULxzBzHl2AT3u5dVz5vIMA0GCSqG\n" +
      +        "SIb3DQEBBAUAA4GBAHTgB5W7wnl7Jnb4wNQcb6JdR8FRHIdslcRfnReFfZBHZZux\n" +
      +        "ChpA1lf62KIzYohKoxQXXMul86vnVSHnXq5xctHEmxCBnALEnoAcCOv6wfWqEA7g\n" +
      +        "2rX+ydmu+0ArbqKhSOypZ7K3ame0UOJJ6HDxdsgBYJuotmSou4KKq9e8GF+d\n" +
      +        "-----END CERTIFICATE-----";
      +    static String clientPrivateKey = // Private key in the format of PKCS#8
      +        "MIICeAIBADANBgkqhkiG9w0BAQEFAASCAmIwggJeAgEAAoGBALWkDvWcODUqGGce\n" +
      +        "NF2L95UNRru4VkC03xH2G66lPAWjKpJfyUMzPyMNrA4yZoj11VkuNOHeGd/goESp\n" +
      +        "A55qsVXPjnIE6OWA8sG4jgUP85GGCYNoi7Y0r5zXKPphCXKI7QM/CHnka08tUbeK\n" +
      +        "4Sl6NTuBDJoy5Np12hes7uzHDNqdAgMBAAECgYEAjLwygwapXjfhdHQoqpp6F9iT\n" +
      +        "h3sKCVSaybXgOO75lHyZzZO9wv1/288KEm3mmBOxXEm6245UievnAYvaq/GKt93O\n" +
      +        "pj2zRefBzZjGbz0v84fmna/MN6zUUYX1PcVRMKWLx9HKKmQihzwoXdBX0o9PPXdi\n" +
      +        "LfzujNa/q8/mpI5PmEECQQDZwLSaL7OReWZTY4NoQuNzwhx5IKJUOtCFQfmHKZSW\n" +
      +        "wtXntZf+E5W9tGaDY5wjpq5cilKDAHdEAlFWxDe1PoE1AkEA1YuTBpctOLBfquFn\n" +
      +        "Y/S3lzGVlnIHDk3dj4bFglkoJ2bCdlwRNUyBSjAjBDcbYhper8S7GlEN5SiEdz9I\n" +
      +        "3OjIyQJBAKEPMgYhZjYhjxf6sQV7A/VpC9pj0u1uGzGVXNUmYisorUKXRHa/UbBh\n" +
      +        "MLnaAXE1Jh54iRMwUwbQmA0PUQ0T0EkCQQCcr6/umwhkWw2nHYK2Vf5LoudGn15M\n" +
      +        "AZg7UsEjVnXfC0hOfllmCT+ohs96rVCbWAv33lsHAUg3x9YChV3aMbf5AkAj1kuV\n" +
      +        "jUTgFKjediyQC6uof7YdLn+gQGiXK1XE0GBN4WMkzcLiS0jC+MFTgKfFnFdh9K0y\n" +
      +        "fswYKdTA/o8RKaa5";
      +
      +    static char passphrase[] = "passphrase".toCharArray();
      +
      +    /*
      +     * Is the server ready to serve?
      +     */
      +    volatile static boolean serverReady = false;
      +
      +    /*
      +     * Turn on SSL debugging?
      +     */
      +    static boolean debug = false;
      +
      +    /*
      +     * Define the server side of the test.
      +     *
      +     * If the server prematurely exits, serverReady will be set to true
      +     * to avoid infinite hangs.
      +     */
      +    void doServerSide() throws Exception {
      +        SSLContext context = getSSLContext(true);
      +        SSLServerSocketFactory sslssf = context.getServerSocketFactory();
      +
      +        SSLServerSocket sslServerSocket =
      +            (SSLServerSocket)sslssf.createServerSocket(serverPort);
      +        serverPort = sslServerSocket.getLocalPort();
      +        SSLSocket sslSocket = null;
      +        try {
      +            /*
      +             * Signal Client, we're ready for his connect.
      +             */
      +            serverReady = true;
      +
      +            sslSocket = (SSLSocket) sslServerSocket.accept();
      +            sslSocket.setNeedClientAuth(true);
      +
      +            InputStream sslIS = sslSocket.getInputStream();
      +            OutputStream sslOS = sslSocket.getOutputStream();
      +
      +            sslIS.read();
      +            sslOS.write(85);
      +            sslOS.flush();
      +        } finally {
      +            if (sslSocket != null) {
      +                sslSocket.close();
      +            }
      +            sslServerSocket.close();
      +        }
      +    }
      +
      +    /*
      +     * Define the client side of the test.
      +     *
      +     * If the server prematurely exits, serverReady will be set to true
      +     * to avoid infinite hangs.
      +     */
      +    void doClientSide() throws Exception {
      +        /*
      +         * Wait for server to get started.
      +         */
      +        while (!serverReady) {
      +            Thread.sleep(50);
      +        }
      +
      +        SSLContext context = getSSLContext(false);
      +        SSLSocketFactory sslsf = context.getSocketFactory();
      +
      +        SSLSocket sslSocket =
      +            (SSLSocket)sslsf.createSocket("localhost", serverPort);
      +        try {
      +            InputStream sslIS = sslSocket.getInputStream();
      +            OutputStream sslOS = sslSocket.getOutputStream();
      +
      +            sslOS.write(280);
      +            sslOS.flush();
      +            sslIS.read();
      +        } finally {
      +            sslSocket.close();
      +        }
      +    }
      +
      +    // get the ssl context
      +    private static SSLContext getSSLContext(boolean isServer) throws Exception {
      +
      +        // generate certificate from cert string
      +        CertificateFactory cf = CertificateFactory.getInstance("X.509");
      +
      +        // create a key store
      +        KeyStore ks = KeyStore.getInstance("JKS");
      +        ks.load(null, null);
      +
      +        // import the trused cert
      +        ByteArrayInputStream is =
      +            new ByteArrayInputStream(trusedCertStr.getBytes());
      +        Certificate trusedCert = cf.generateCertificate(is);
      +        is.close();
      +
      +        ks.setCertificateEntry("SunJSSE Test Serivce", trusedCert);
      +
      +        // import the certificate chain and key
      +        Certificate[] chain = new Certificate[3];
      +
      +        is = new ByteArrayInputStream(caSignerStr.getBytes());
      +        Certificate caSignerCert = cf.generateCertificate(is);
      +        is.close();
      +        chain[2] = caSignerCert;
      +
      +        is = new ByteArrayInputStream(certIssuerStr.getBytes());
      +        Certificate certIssuerCert = cf.generateCertificate(is);
      +        is.close();
      +        chain[1] = certIssuerCert;
      +
      +        PKCS8EncodedKeySpec priKeySpec = null;
      +        if (isServer) {
      +            priKeySpec = new PKCS8EncodedKeySpec(
      +                            new BASE64Decoder().decodeBuffer(serverPrivateKey));
      +            is = new ByteArrayInputStream(serverCertStr.getBytes());
      +        } else {
      +            priKeySpec = new PKCS8EncodedKeySpec(
      +                            new BASE64Decoder().decodeBuffer(clientPrivateKey));
      +            is = new ByteArrayInputStream(clientCertStr.getBytes());
      +        }
      +        KeyFactory kf = KeyFactory.getInstance("RSA");
      +        RSAPrivateKey priKey = (RSAPrivateKey)kf.generatePrivate(priKeySpec);
      +        Certificate keyCert = cf.generateCertificate(is);
      +        is.close();
      +        chain[0] = keyCert;
      +
      +        ks.setKeyEntry("End Entity", priKey, passphrase, chain);
      +
      +        // check the certification path
      +        PKIXParameters paras = new PKIXParameters(ks);
      +        paras.setRevocationEnabled(false);
      +        CertPath path = cf.generateCertPath(Arrays.asList(chain));
      +        CertPathValidator cv = CertPathValidator.getInstance("PKIX");
      +        cv.validate(path, paras);
      +
      +        // create SSL context
      +        TrustManagerFactory tmf = TrustManagerFactory.getInstance(tmAlgorithm);
      +        tmf.init(ks);
      +
      +        SSLContext ctx = SSLContext.getInstance("TLS");
      +        KeyManagerFactory kmf = KeyManagerFactory.getInstance("NewSunX509");
      +        kmf.init(ks, passphrase);
      +
      +        ctx.init(kmf.getKeyManagers(), tmf.getTrustManagers(), null);
      +        ks = null;
      +
      +        return ctx;
      +    }
      +
      +    private static String tmAlgorithm;        // trust manager
      +
      +    private static void parseArguments(String[] args) {
      +        tmAlgorithm = args[0];
      +    }
      +
      +    /*
      +     * =============================================================
      +     * The remainder is just support stuff
      +     */
      +
      +    // use any free port by default
      +    volatile int serverPort = 0;
      +
      +    volatile Exception serverException = null;
      +    volatile Exception clientException = null;
      +
      +    public static void main(String args[]) throws Exception {
      +        if (debug)
      +            System.setProperty("javax.net.debug", "all");
      +
      +
      +        /*
      +         * Get the customized arguments.
      +         */
      +        parseArguments(args);
      +
      +        /*
      +         * Start the tests.
      +         */
      +        new BasicConstraints();
      +    }
      +
      +    Thread clientThread = null;
      +    Thread serverThread = null;
      +    /*
      +     * Primary constructor, used to drive remainder of the test.
      +     *
      +     * Fork off the other side, then do your work.
      +     */
      +    BasicConstraints() throws Exception {
      +        if (separateServerThread) {
      +            startServer(true);
      +            startClient(false);
      +        } else {
      +            startClient(true);
      +            startServer(false);
      +        }
      +
      +        /*
      +         * Wait for other side to close down.
      +         */
      +        if (separateServerThread) {
      +            serverThread.join();
      +        } else {
      +            clientThread.join();
      +        }
      +
      +        /*
      +         * When we get here, the test is pretty much over.
      +         *
      +         * If the main thread excepted, that propagates back
      +         * immediately.  If the other thread threw an exception, we
      +         * should report back.
      +         */
      +        if (serverException != null)
      +            throw serverException;
      +        if (clientException != null)
      +            throw clientException;
      +    }
      +
      +    void startServer(boolean newThread) throws Exception {
      +        if (newThread) {
      +            serverThread = new Thread() {
      +                public void run() {
      +                    try {
      +                        doServerSide();
      +                    } catch (Exception e) {
      +                        /*
      +                         * Our server thread just died.
      +                         *
      +                         * Release the client, if not active already...
      +                         */
      +                        System.err.println("Server died...");
      +                        serverReady = true;
      +                        serverException = e;
      +                    }
      +                }
      +            };
      +            serverThread.start();
      +        } else {
      +            doServerSide();
      +        }
      +    }
      +
      +    void startClient(boolean newThread) throws Exception {
      +        if (newThread) {
      +            clientThread = new Thread() {
      +                public void run() {
      +                    try {
      +                        doClientSide();
      +                    } catch (Exception e) {
      +                        /*
      +                         * Our client thread just died.
      +                         */
      +                        System.err.println("Client died...");
      +                        clientException = e;
      +                    }
      +                }
      +            };
      +            clientThread.start();
      +        } else {
      +            doClientSide();
      +        }
      +    }
      +
      +}
      
      From 7befd87c216ed7c0bdfbfdf38e32ac7c322593f8 Mon Sep 17 00:00:00 2001
      From: Jonathan Lu 
      Date: Wed, 9 May 2012 11:19:54 +0800
      Subject: [PATCH 021/128] 7165722: Invalid path in MemoryMonitor demo's
       README.txt
      
      Reviewed-by: alanb, sla
      ---
       jdk/src/share/demo/management/MemoryMonitor/README.txt | 2 +-
       1 file changed, 1 insertion(+), 1 deletion(-)
      
      diff --git a/jdk/src/share/demo/management/MemoryMonitor/README.txt b/jdk/src/share/demo/management/MemoryMonitor/README.txt
      index 9b264c7f18c..2009e1339e2 100644
      --- a/jdk/src/share/demo/management/MemoryMonitor/README.txt
      +++ b/jdk/src/share/demo/management/MemoryMonitor/README.txt
      @@ -38,7 +38,7 @@ and plots the memory usage history graph.
       
       To run the MemoryMonitor demo
       
      -   java -jar /demo/management/MemoryMonitor.jar 
      +   java -jar /demo/management/MemoryMonitor/MemoryMonitor.jar 
       
       These instructions assume that this installation's version of the java
       command is in your path.  If it isn't, then you should either
      
      From 97d244d75a93cd5353dcad09595fd33a208ae5f7 Mon Sep 17 00:00:00 2001
      From: Andrew Dinn 
      Date: Wed, 9 May 2012 00:28:45 -0400
      Subject: [PATCH 022/128] 7167406: (Zero) Fix for InvokeDynamic needed
      
      Reviewed-by: chrisphi, dholmes
      ---
       .../src/cpu/zero/vm/cppInterpreter_zero.cpp   | 19 +++++++++++++++++++
       1 file changed, 19 insertions(+)
      
      diff --git a/hotspot/src/cpu/zero/vm/cppInterpreter_zero.cpp b/hotspot/src/cpu/zero/vm/cppInterpreter_zero.cpp
      index 0beb4cdad2d..ec2805b4d28 100644
      --- a/hotspot/src/cpu/zero/vm/cppInterpreter_zero.cpp
      +++ b/hotspot/src/cpu/zero/vm/cppInterpreter_zero.cpp
      @@ -1026,6 +1026,16 @@ void CppInterpreter::process_method_handle(oop method_handle, TRAPS) {
               java_lang_invoke_AdapterMethodHandle::vmargslot(method_handle);
             oop arg = VMSLOTS_OBJECT(arg_slot);
             jvalue arg_value;
      +      if (arg == NULL) {
      +        // queue a nullpointer exception for the caller
      +        stack->set_sp(calculate_unwind_sp(stack, method_handle));
      +        CALL_VM_NOCHECK_NOFIX(
      +          throw_exception(
      +            thread, vmSymbols::java_lang_NullPointerException()));
      +        // NB all oops trashed!
      +        assert(HAS_PENDING_EXCEPTION, "should do");
      +        return;
      +      }
             BasicType arg_type = java_lang_boxing_object::get_value(arg, &arg_value);
             if (arg_type == T_LONG || arg_type == T_DOUBLE) {
               intptr_t *unwind_sp = calculate_unwind_sp(stack, method_handle);
      @@ -1112,6 +1122,15 @@ void CppInterpreter::process_method_handle(oop method_handle, TRAPS) {
             case T_SHORT:
               return;
             }
      +      // INT results sometimes need narrowing
      +    case T_BOOLEAN:
      +    case T_CHAR:
      +    case T_BYTE:
      +    case T_SHORT:
      +      switch (src_rtype) {
      +      case T_INT:
      +        return;
      +      }
           }
       
           tty->print_cr("unhandled conversion:");
      
      From 018f4098e84d70016956a57037612a418b2372f9 Mon Sep 17 00:00:00 2001
      From: Nils Loodin 
      Date: Wed, 9 May 2012 16:24:07 +0200
      Subject: [PATCH 023/128] 7163117: Agent can't connect to process on Mac OSX
      
      Reviewed-by: dholmes, coleenp, sla, minqi, kvn
      ---
       .../agent/src/share/classes/sun/jvm/hotspot/HotSpotAgent.java | 4 ++--
       .../share/classes/sun/jvm/hotspot/bugspot/BugSpotAgent.java   | 4 ++--
       .../classes/sun/jvm/hotspot/debugger/bsd/BsdCDebugger.java    | 2 +-
       .../sun/jvm/hotspot/debugger/bsd/BsdThreadContextFactory.java | 2 +-
       .../sun/jvm/hotspot/debugger/proc/ProcDebuggerLocal.java      | 2 +-
       .../sun/jvm/hotspot/debugger/remote/RemoteDebuggerClient.java | 2 +-
       .../src/share/classes/sun/jvm/hotspot/runtime/Threads.java    | 2 +-
       .../sun/jvm/hotspot/ui/classbrowser/HTMLGenerator.java        | 2 +-
       8 files changed, 10 insertions(+), 10 deletions(-)
      
      diff --git a/hotspot/agent/src/share/classes/sun/jvm/hotspot/HotSpotAgent.java b/hotspot/agent/src/share/classes/sun/jvm/hotspot/HotSpotAgent.java
      index 233bc173a88..029c20f0b8e 100644
      --- a/hotspot/agent/src/share/classes/sun/jvm/hotspot/HotSpotAgent.java
      +++ b/hotspot/agent/src/share/classes/sun/jvm/hotspot/HotSpotAgent.java
      @@ -572,10 +572,10 @@ public class HotSpotAgent {
       
               if (cpu.equals("x86")) {
                   machDesc = new MachineDescriptionIntelX86();
      -        } else if (cpu.equals("amd64")) {
      +        } else if (cpu.equals("amd64") || cpu.equals("x86_64")) {
                   machDesc = new MachineDescriptionAMD64();
               } else {
      -            throw new DebuggerException("BSD only supported on x86/amd64");
      +            throw new DebuggerException("BSD only supported on x86/x86_64. Current arch: " + cpu);
               }
       
               BsdDebuggerLocal dbg = new BsdDebuggerLocal(machDesc, !isServer);
      diff --git a/hotspot/agent/src/share/classes/sun/jvm/hotspot/bugspot/BugSpotAgent.java b/hotspot/agent/src/share/classes/sun/jvm/hotspot/bugspot/BugSpotAgent.java
      index bb0a444702f..3b89f5996db 100644
      --- a/hotspot/agent/src/share/classes/sun/jvm/hotspot/bugspot/BugSpotAgent.java
      +++ b/hotspot/agent/src/share/classes/sun/jvm/hotspot/bugspot/BugSpotAgent.java
      @@ -762,10 +762,10 @@ public class BugSpotAgent {
       
               if (cpu.equals("x86")) {
                   machDesc = new MachineDescriptionIntelX86();
      -        } else if (cpu.equals("amd64")) {
      +        } else if (cpu.equals("amd64") || (cpu.equals("x86_64"))) {
                   machDesc = new MachineDescriptionAMD64();
               } else {
      -            throw new DebuggerException("Bsd only supported on x86/amd64");
      +            throw new DebuggerException("Bsd only supported on x86/x86_64. Current arch: " + cpu);
               }
       
               // Note we do not use a cache for the local debugger in server
      diff --git a/hotspot/agent/src/share/classes/sun/jvm/hotspot/debugger/bsd/BsdCDebugger.java b/hotspot/agent/src/share/classes/sun/jvm/hotspot/debugger/bsd/BsdCDebugger.java
      index 92f7bbf3d42..1818d1d5a96 100644
      --- a/hotspot/agent/src/share/classes/sun/jvm/hotspot/debugger/bsd/BsdCDebugger.java
      +++ b/hotspot/agent/src/share/classes/sun/jvm/hotspot/debugger/bsd/BsdCDebugger.java
      @@ -90,7 +90,7 @@ class BsdCDebugger implements CDebugger {
              Address pc  = context.getRegisterAsAddress(X86ThreadContext.EIP);
              if (pc == null) return null;
              return new BsdX86CFrame(dbg, ebp, pc);
      -    } else if (cpu.equals("amd64")) {
      +    } else if (cpu.equals("amd64") || cpu.equals("x86_64")) {
              AMD64ThreadContext context = (AMD64ThreadContext) thread.getContext();
              Address rbp = context.getRegisterAsAddress(AMD64ThreadContext.RBP);
              if (rbp == null) return null;
      diff --git a/hotspot/agent/src/share/classes/sun/jvm/hotspot/debugger/bsd/BsdThreadContextFactory.java b/hotspot/agent/src/share/classes/sun/jvm/hotspot/debugger/bsd/BsdThreadContextFactory.java
      index 8c13adade31..01fe1d74577 100644
      --- a/hotspot/agent/src/share/classes/sun/jvm/hotspot/debugger/bsd/BsdThreadContextFactory.java
      +++ b/hotspot/agent/src/share/classes/sun/jvm/hotspot/debugger/bsd/BsdThreadContextFactory.java
      @@ -33,7 +33,7 @@ class BsdThreadContextFactory {
             String cpu = dbg.getCPU();
             if (cpu.equals("x86")) {
                return new BsdX86ThreadContext(dbg);
      -      } else if (cpu.equals("amd64")) {
      +      } else if (cpu.equals("amd64") || cpu.equals("x86_64")) {
                return new BsdAMD64ThreadContext(dbg);
             } else {
                throw new RuntimeException("cpu " + cpu + " is not yet supported");
      diff --git a/hotspot/agent/src/share/classes/sun/jvm/hotspot/debugger/proc/ProcDebuggerLocal.java b/hotspot/agent/src/share/classes/sun/jvm/hotspot/debugger/proc/ProcDebuggerLocal.java
      index 5d75114fd61..1d9f7cea122 100644
      --- a/hotspot/agent/src/share/classes/sun/jvm/hotspot/debugger/proc/ProcDebuggerLocal.java
      +++ b/hotspot/agent/src/share/classes/sun/jvm/hotspot/debugger/proc/ProcDebuggerLocal.java
      @@ -81,7 +81,7 @@ public class ProcDebuggerLocal extends DebuggerBase implements ProcDebugger {
                   pcRegIndex = X86ThreadContext.EIP;
                   fpRegIndex = X86ThreadContext.EBP;
                   unalignedAccessesOkay = true;
      -        } else if (cpu.equals("amd64")) {
      +        } else if (cpu.equals("amd64") || cpu.equals("x86_64")) {
                   threadFactory = new ProcAMD64ThreadFactory(this);
                   pcRegIndex = AMD64ThreadContext.RIP;
                   fpRegIndex = AMD64ThreadContext.RBP;
      diff --git a/hotspot/agent/src/share/classes/sun/jvm/hotspot/debugger/remote/RemoteDebuggerClient.java b/hotspot/agent/src/share/classes/sun/jvm/hotspot/debugger/remote/RemoteDebuggerClient.java
      index 4f226df522c..beb3f536a14 100644
      --- a/hotspot/agent/src/share/classes/sun/jvm/hotspot/debugger/remote/RemoteDebuggerClient.java
      +++ b/hotspot/agent/src/share/classes/sun/jvm/hotspot/debugger/remote/RemoteDebuggerClient.java
      @@ -64,7 +64,7 @@ public class RemoteDebuggerClient extends DebuggerBase implements JVMDebugger {
               cachePageSize = 4096;
               cacheNumPages = parseCacheNumPagesProperty(cacheSize / cachePageSize);
               unalignedAccessesOkay = true;
      -      } else if (cpu.equals("amd64")) {
      +      } else if (cpu.equals("amd64") || cpu.equals("x86_64")) {
               threadFactory = new RemoteAMD64ThreadFactory(this);
               cachePageSize = 4096;
               cacheNumPages = parseCacheNumPagesProperty(cacheSize / cachePageSize);
      diff --git a/hotspot/agent/src/share/classes/sun/jvm/hotspot/runtime/Threads.java b/hotspot/agent/src/share/classes/sun/jvm/hotspot/runtime/Threads.java
      index 44ce898046c..67d929d1d12 100644
      --- a/hotspot/agent/src/share/classes/sun/jvm/hotspot/runtime/Threads.java
      +++ b/hotspot/agent/src/share/classes/sun/jvm/hotspot/runtime/Threads.java
      @@ -95,7 +95,7 @@ public class Threads {
               } else if (os.equals("bsd")) {
                   if (cpu.equals("x86")) {
                       access = new BsdX86JavaThreadPDAccess();
      -            } else if (cpu.equals("amd64")) {
      +            } else if (cpu.equals("amd64") || cpu.equals("x86_64")) {
                       access = new BsdAMD64JavaThreadPDAccess();
                   }
               }
      diff --git a/hotspot/agent/src/share/classes/sun/jvm/hotspot/ui/classbrowser/HTMLGenerator.java b/hotspot/agent/src/share/classes/sun/jvm/hotspot/ui/classbrowser/HTMLGenerator.java
      index 210bed768f6..b8d5c8bab7b 100644
      --- a/hotspot/agent/src/share/classes/sun/jvm/hotspot/ui/classbrowser/HTMLGenerator.java
      +++ b/hotspot/agent/src/share/classes/sun/jvm/hotspot/ui/classbrowser/HTMLGenerator.java
      @@ -199,7 +199,7 @@ public class HTMLGenerator implements /* imports */ ClassConstants {
                cpuHelper = new SPARCHelper();
             } else if (cpu.equals("x86")) {
                cpuHelper = new X86Helper();
      -      } else if (cpu.equals("amd64")) {
      +      } else if (cpu.equals("amd64") || cpu.equals("x86_64")) {
                cpuHelper = new AMD64Helper();
             } else if (cpu.equals("ia64")) {
                cpuHelper = new IA64Helper();
      
      From 35e44803db2fc4ef891f410187f9e702521fbc43 Mon Sep 17 00:00:00 2001
      From: Deven You 
      Date: Wed, 9 May 2012 07:28:12 -0700
      Subject: [PATCH 024/128] 7166955: (pack200) JNI_GetCreatedJavaVMs needs
       additional checking
      
      Reviewed-by: alanb, dholmes, ksrini
      ---
       jdk/src/share/native/com/sun/java/util/jar/pack/jni.cpp | 8 ++++++--
       1 file changed, 6 insertions(+), 2 deletions(-)
      
      diff --git a/jdk/src/share/native/com/sun/java/util/jar/pack/jni.cpp b/jdk/src/share/native/com/sun/java/util/jar/pack/jni.cpp
      index e77e99f33c5..bedecda5391 100644
      --- a/jdk/src/share/native/com/sun/java/util/jar/pack/jni.cpp
      +++ b/jdk/src/share/native/com/sun/java/util/jar/pack/jni.cpp
      @@ -1,5 +1,5 @@
       /*
      - * Copyright (c) 2003, 2008, Oracle and/or its affiliates. All rights reserved.
      + * 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
      @@ -82,7 +82,11 @@ static unpacker* get_unpacker(JNIEnv *env, jobject pObj, bool noCreate=false) {
       static unpacker* get_unpacker() {
         //fprintf(stderr, "get_unpacker()\n");
         JavaVM* vm = null;
      -  JNI_GetCreatedJavaVMs(&vm, 1, null);
      +  jsize nVM = 0;
      +  jint retval = JNI_GetCreatedJavaVMs(&vm, 1, &nVM);
      +  // other VM implements may differ, thus for correctness, we need these checks
      +  if (retval != JNI_OK || nVM != 1)
      +    return null;
         void* envRaw = null;
         vm->GetEnv(&envRaw, JNI_VERSION_1_1);
         JNIEnv* env = (JNIEnv*) envRaw;
      
      From 769059e3a304d747b39b74ae56f1b832d5a2f294 Mon Sep 17 00:00:00 2001
      From: Kurchi Subhra Hazra 
      Date: Wed, 9 May 2012 11:14:22 -0700
      Subject: [PATCH 025/128] 7165118: (prefs) AbstractPreferences.remove(null)
       does not throw NPE
      
      Insert null argument check in AbstractPreferences.remove()
      
      Reviewed-by: dholmes, chegar, alanb
      ---
       .../java/util/prefs/AbstractPreferences.java  |  2 +
       .../java/util/prefs/RemoveNullKeyCheck.java   | 72 ++++++++++++++++---
       2 files changed, 65 insertions(+), 9 deletions(-)
      
      diff --git a/jdk/src/share/classes/java/util/prefs/AbstractPreferences.java b/jdk/src/share/classes/java/util/prefs/AbstractPreferences.java
      index f4a7e5e0a39..5ba264e5354 100644
      --- a/jdk/src/share/classes/java/util/prefs/AbstractPreferences.java
      +++ b/jdk/src/share/classes/java/util/prefs/AbstractPreferences.java
      @@ -305,8 +305,10 @@ public abstract class AbstractPreferences extends Preferences {
            * @param key key whose mapping is to be removed from the preference node.
            * @throws IllegalStateException if this node (or an ancestor) has been
            *         removed with the {@link #removeNode()} method.
      +     * @throws NullPointerException {@inheritDoc}.
            */
           public void remove(String key) {
      +        Objects.requireNonNull(key, "Specified key cannot be null");
               synchronized(lock) {
                   if (removed)
                       throw new IllegalStateException("Node has been removed.");
      diff --git a/jdk/test/java/util/prefs/RemoveNullKeyCheck.java b/jdk/test/java/util/prefs/RemoveNullKeyCheck.java
      index e45459b4495..c74f0d82d37 100644
      --- a/jdk/test/java/util/prefs/RemoveNullKeyCheck.java
      +++ b/jdk/test/java/util/prefs/RemoveNullKeyCheck.java
      @@ -22,23 +22,77 @@
        */
       
       /* @test
      - * @bug 7160242
      + * @bug 7160242 7165118
        * @summary Check if NullPointerException is thrown if the key passed
        *          to remove() is null.
        */
       
       import java.util.prefs.Preferences;
      +import java.util.prefs.AbstractPreferences;
      +import java.util.prefs.BackingStoreException;
       
       public class RemoveNullKeyCheck {
       
      +    private static boolean failed = false;
      +
           public static void main(String[] args) throws Exception {
      -       try {
      -           Preferences node = Preferences.userRoot().node("N1");
      -           node.remove(null);
      -           throw new RuntimeException("Expected NullPointerException " +
      -                                      "not thrown");
      -       } catch (NullPointerException npe) {
      -           System.out.println("NullPointerException thrown");
      -       }
      +        checkPreferencesRemove();
      +        checkAbstractPreferencesRemove();
      +        if (failed) {
      +            throw new RuntimeException("Expected NullPointerException " +
      +                                       "not thrown");
      +        }
      +    }
      +
      +    public static void checkPreferencesRemove() {
      +        try {
      +            Preferences node = Preferences.userRoot().node("N1");
      +            node.remove(null);
      +            failed = true;
      +        } catch (NullPointerException npe) {
      +        }
      +    }
      +
      +    public static void checkAbstractPreferencesRemove() {
      +
      +        Preferences abstrPrefs = new AbstractPreferences(null, "") {
      +            @Override
      +            protected void putSpi(String key, String value) {
      +            }
      +            @Override
      +            protected String getSpi(String key) {
      +                return null;
      +            }
      +            @Override
      +            protected void removeSpi(String key) {
      +            }
      +            @Override
      +            protected void removeNodeSpi() throws BackingStoreException {
      +            }
      +            @Override
      +            protected String[] keysSpi() throws BackingStoreException {
      +                return new String[0];
      +            }
      +            @Override
      +            protected String[] childrenNamesSpi() throws BackingStoreException {
      +                return new String[0];
      +            }
      +            @Override
      +            protected AbstractPreferences childSpi(String name) {
      +                return null;
      +            }
      +            @Override
      +            protected void syncSpi() throws BackingStoreException {
      +            }
      +            @Override
      +            protected void flushSpi() throws BackingStoreException {
      +            }
      +        };
      +
      +        try {
      +            abstrPrefs.remove(null);
      +            failed = true;
      +        } catch(NullPointerException npe) {
      +        }
           }
       }
      
      From 34aa937e993527ae70c82e9709e08d8d93b82c06 Mon Sep 17 00:00:00 2001
      From: Bradford Wetmore 
      Date: Wed, 9 May 2012 16:33:30 -0700
      Subject: [PATCH 026/128] 7167362: SecureRandom.init should be converted,
       amendment to 7084245
      
      Reviewed-by: sherman
      ---
       jdk/src/share/classes/sun/security/provider/SecureRandom.java | 4 ++--
       1 file changed, 2 insertions(+), 2 deletions(-)
      
      diff --git a/jdk/src/share/classes/sun/security/provider/SecureRandom.java b/jdk/src/share/classes/sun/security/provider/SecureRandom.java
      index aee8846ed14..e79e9d7f49a 100644
      --- a/jdk/src/share/classes/sun/security/provider/SecureRandom.java
      +++ b/jdk/src/share/classes/sun/security/provider/SecureRandom.java
      @@ -1,5 +1,5 @@
       /*
      - * Copyright (c) 1998, 2003, Oracle and/or its affiliates. All rights reserved.
      + * Copyright (c) 1998, 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
      @@ -102,7 +102,7 @@ implements java.io.Serializable {
               try {
                   digest = MessageDigest.getInstance ("SHA");
               } catch (NoSuchAlgorithmException e) {
      -            throw new InternalError("internal error: SHA-1 not available.");
      +            throw new InternalError("internal error: SHA-1 not available.", e);
               }
       
               if (seed != null) {
      
      From 2c13671808d8908ec82a598b78be5007c6cb4a23 Mon Sep 17 00:00:00 2001
      From: Kurchi Subhra Hazra 
      Date: Wed, 9 May 2012 16:55:55 -0700
      Subject: [PATCH 027/128] 7096436: (sc) SocketChannel.connect fails on Windows
       8 when channel configured non-blocking
      
      Set localAddress only when connection is established
      
      Reviewed-by: alanb
      ---
       .../classes/sun/nio/ch/SocketChannelImpl.java     | 15 ++++-----------
       1 file changed, 4 insertions(+), 11 deletions(-)
      
      diff --git a/jdk/src/share/classes/sun/nio/ch/SocketChannelImpl.java b/jdk/src/share/classes/sun/nio/ch/SocketChannelImpl.java
      index fe2c5fe33ac..f0f72551614 100644
      --- a/jdk/src/share/classes/sun/nio/ch/SocketChannelImpl.java
      +++ b/jdk/src/share/classes/sun/nio/ch/SocketChannelImpl.java
      @@ -629,17 +629,6 @@ class SocketChannelImpl
                                       break;
                                   }
       
      -                            synchronized (stateLock) {
      -                                if (isOpen() && (localAddress == null) ||
      -                                    ((InetSocketAddress)localAddress)
      -                                        .getAddress().isAnyLocalAddress())
      -                                {
      -                                    // Socket was not bound before connecting or
      -                                    // Socket was bound with an "anyLocalAddress"
      -                                    localAddress = Net.localAddress(fd);
      -                                }
      -                            }
      -
                               } finally {
                                   readerCleanup();
                                   end((n > 0) || (n == IOStatus.UNAVAILABLE));
      @@ -659,6 +648,8 @@ class SocketChannelImpl
                                   // Connection succeeded; disallow further
                                   // invocation
                                   state = ST_CONNECTED;
      +                            if (isOpen())
      +                                localAddress = Net.localAddress(fd);
                                   return true;
                               }
                               // If nonblocking and no exception then connection
      @@ -747,6 +738,8 @@ class SocketChannelImpl
                       if (n > 0) {
                           synchronized (stateLock) {
                               state = ST_CONNECTED;
      +                        if (isOpen())
      +                            localAddress = Net.localAddress(fd);
                           }
                           return true;
                       }
      
      From c3e4ab9209269331be821d5f99e3d15a36508098 Mon Sep 17 00:00:00 2001
      From: Sean Coffey 
      Date: Thu, 10 May 2012 10:45:04 +0100
      Subject: [PATCH 028/128] 7163470: Build fails if javax.crypto src files not
       present
      
      Reviewed-by: valeriep
      ---
       jdk/make/com/oracle/security/ucrypto/Makefile      | 2 +-
       jdk/make/common/shared/Defs-java.gmk               | 8 ++++----
       jdk/make/sun/security/ec/Makefile                  | 4 ++--
       jdk/make/sun/security/mscapi/Makefile              | 2 +-
       jdk/make/sun/security/pkcs11/Makefile              | 2 +-
       jdk/makefiles/com/oracle/security/ucrypto/Makefile | 2 +-
       jdk/makefiles/common/shared/Defs-java.gmk          | 8 ++++----
       jdk/makefiles/sun/security/ec/Makefile             | 5 +++--
       jdk/makefiles/sun/security/mscapi/Makefile         | 5 +++--
       jdk/makefiles/sun/security/pkcs11/Makefile         | 3 ++-
       10 files changed, 22 insertions(+), 19 deletions(-)
      
      diff --git a/jdk/make/com/oracle/security/ucrypto/Makefile b/jdk/make/com/oracle/security/ucrypto/Makefile
      index 8ea7a749a7b..f6545e89828 100644
      --- a/jdk/make/com/oracle/security/ucrypto/Makefile
      +++ b/jdk/make/com/oracle/security/ucrypto/Makefile
      @@ -139,7 +139,7 @@ ifndef OPENJDK
         #
         CLASSDESTDIR = $(TEMPDIR)/classes
         JAVAHFLAGS = -bootclasspath \
      -    "$(CLASSDESTDIR)$(CLASSPATH_SEPARATOR)$(CLASSBINDIR)"
      +    "$(CLASSDESTDIR)$(CLASSPATH_SEPARATOR)$(CLASSBINDIR)$(JCE_PATH)"
       
         include $(BUILDDIR)/common/Mapfile-vers.gmk
         include $(BUILDDIR)/common/Library.gmk
      diff --git a/jdk/make/common/shared/Defs-java.gmk b/jdk/make/common/shared/Defs-java.gmk
      index 5002c28198a..eb50e475e48 100644
      --- a/jdk/make/common/shared/Defs-java.gmk
      +++ b/jdk/make/common/shared/Defs-java.gmk
      @@ -1,5 +1,5 @@
       #
      -# Copyright (c) 2007, 2011, Oracle and/or its affiliates. All rights reserved.
      +# Copyright (c) 2007, 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
      @@ -139,7 +139,7 @@ JAVACFLAGS += $(JAVAC_LINT_OPTIONS)
       # built implicitly/explicitly.
       #
       ifeq ($(wildcard $(SHARE_SRC)/classes/javax/crypto/Cipher.java),)
      -  JCEFLAGS = $(CLASSPATH_SEPARATOR)$(LIBDIR)/jce.jar
      +  JCE_PATH = $(CLASSPATH_SEPARATOR)$(LIBDIR)/jce.jar
       endif
       
       # Add the source level
      @@ -152,11 +152,11 @@ TARGET_CLASS_VERSION = 7
       CLASS_VERSION = -target $(TARGET_CLASS_VERSION)
       JAVACFLAGS  += $(CLASS_VERSION)
       JAVACFLAGS  += -encoding ascii
      -JAVACFLAGS  += "-Xbootclasspath:$(CLASSBINDIR)$(JCEFLAGS)"
      +JAVACFLAGS  += "-Xbootclasspath:$(CLASSBINDIR)$(JCE_PATH)"
       JAVACFLAGS  += $(OTHER_JAVACFLAGS)
       
       # Needed for javah
      -JAVAHFLAGS += -bootclasspath "$(CLASSBINDIR)$(JCEFLAGS)"
      +JAVAHFLAGS += -bootclasspath "$(CLASSBINDIR)$(JCE_PATH)"
       
       # Needed for javadoc to ensure it builds documentation
       # against the newly built classes
      diff --git a/jdk/make/sun/security/ec/Makefile b/jdk/make/sun/security/ec/Makefile
      index 841fc3716d2..0e92dd59cff 100644
      --- a/jdk/make/sun/security/ec/Makefile
      +++ b/jdk/make/sun/security/ec/Makefile
      @@ -1,5 +1,5 @@
       #
      -# Copyright (c) 2009, 2011, Oracle and/or its affiliates. All rights reserved.
      +# Copyright (c) 2009, 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
      @@ -160,7 +160,7 @@ ifeq ($(NATIVE_ECC_AVAILABLE), true)
             $(PKGDIR)/ECKeyPairGenerator.java
       
         JAVAHFLAGS = -bootclasspath \
      -      "$(CLASSDESTDIR)$(CLASSPATH_SEPARATOR)$(CLASSBINDIR)"
      +      "$(CLASSDESTDIR)$(CLASSPATH_SEPARATOR)$(CLASSBINDIR)$(JCE_PATH)"
       
       
         #
      diff --git a/jdk/make/sun/security/mscapi/Makefile b/jdk/make/sun/security/mscapi/Makefile
      index 65eef782654..1cd6024a9c4 100644
      --- a/jdk/make/sun/security/mscapi/Makefile
      +++ b/jdk/make/sun/security/mscapi/Makefile
      @@ -150,7 +150,7 @@ OTHER_INCLUDES += \
       #
       CLASSDESTDIR = $(TEMPDIR)/classes
       JAVAHFLAGS = -bootclasspath \
      -  "$(CLASSDESTDIR)$(CLASSPATH_SEPARATOR)$(CLASSBINDIR)"
      +  "$(CLASSDESTDIR)$(CLASSPATH_SEPARATOR)$(CLASSBINDIR)$(JCE_PATH)"
       
       include $(BUILDDIR)/common/Mapfile-vers.gmk
       
      diff --git a/jdk/make/sun/security/pkcs11/Makefile b/jdk/make/sun/security/pkcs11/Makefile
      index d7e049d9e1f..ecdba0997da 100644
      --- a/jdk/make/sun/security/pkcs11/Makefile
      +++ b/jdk/make/sun/security/pkcs11/Makefile
      @@ -151,7 +151,7 @@ OTHER_INCLUDES += \
       #
       CLASSDESTDIR = $(TEMPDIR)/classes
       JAVAHFLAGS = -bootclasspath \
      -    "$(CLASSDESTDIR)$(CLASSPATH_SEPARATOR)$(CLASSBINDIR)"
      +    "$(CLASSDESTDIR)$(CLASSPATH_SEPARATOR)$(CLASSBINDIR)$(JCE_PATH)"
       
       include $(BUILDDIR)/common/Mapfile-vers.gmk
       
      diff --git a/jdk/makefiles/com/oracle/security/ucrypto/Makefile b/jdk/makefiles/com/oracle/security/ucrypto/Makefile
      index 8ea7a749a7b..f6545e89828 100644
      --- a/jdk/makefiles/com/oracle/security/ucrypto/Makefile
      +++ b/jdk/makefiles/com/oracle/security/ucrypto/Makefile
      @@ -139,7 +139,7 @@ ifndef OPENJDK
         #
         CLASSDESTDIR = $(TEMPDIR)/classes
         JAVAHFLAGS = -bootclasspath \
      -    "$(CLASSDESTDIR)$(CLASSPATH_SEPARATOR)$(CLASSBINDIR)"
      +    "$(CLASSDESTDIR)$(CLASSPATH_SEPARATOR)$(CLASSBINDIR)$(JCE_PATH)"
       
         include $(BUILDDIR)/common/Mapfile-vers.gmk
         include $(BUILDDIR)/common/Library.gmk
      diff --git a/jdk/makefiles/common/shared/Defs-java.gmk b/jdk/makefiles/common/shared/Defs-java.gmk
      index 4422ca312b0..897b24d77a3 100644
      --- a/jdk/makefiles/common/shared/Defs-java.gmk
      +++ b/jdk/makefiles/common/shared/Defs-java.gmk
      @@ -1,5 +1,5 @@
       #
      -# Copyright (c) 2007, 2011, Oracle and/or its affiliates. All rights reserved.
      +# Copyright (c) 2007, 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
      @@ -141,7 +141,7 @@ JAVACFLAGS += $(JAVAC_LINT_OPTIONS)
       # built implicitly/explicitly.
       #
       ifeq ($(wildcard $(SHARE_SRC)/classes/javax/crypto/Cipher.java),)
      -  JCEFLAGS = $(CLASSPATH_SEPARATOR)$(LIBDIR)/jce.jar
      +  JCE_PATH = $(CLASSPATH_SEPARATOR)$(LIBDIR)/jce.jar
       endif
       
       # Add the source level
      @@ -154,11 +154,11 @@ TARGET_CLASS_VERSION = 7
       CLASS_VERSION = -target $(TARGET_CLASS_VERSION)
       JAVACFLAGS  += $(CLASS_VERSION)
       JAVACFLAGS  += -encoding ascii
      -JAVACFLAGS  += "-Xbootclasspath:$(CLASSBINDIR)$(JCEFLAGS)"
      +JAVACFLAGS  += "-Xbootclasspath:$(CLASSBINDIR)$(JCE_PATH)"
       JAVACFLAGS  += $(OTHER_JAVACFLAGS)
       
       # Needed for javah
      -JAVAHFLAGS += -bootclasspath "$(CLASSBINDIR)$(JCEFLAGS)"
      +JAVAHFLAGS += -bootclasspath "$(CLASSBINDIR)$(JCE_PATH)"
       
       # Needed for javadoc to ensure it builds documentation
       # against the newly built classes
      diff --git a/jdk/makefiles/sun/security/ec/Makefile b/jdk/makefiles/sun/security/ec/Makefile
      index 146a24e7a9b..d09dbecf629 100644
      --- a/jdk/makefiles/sun/security/ec/Makefile
      +++ b/jdk/makefiles/sun/security/ec/Makefile
      @@ -1,5 +1,5 @@
       #
      -# Copyright (c) 2009, 2011, Oracle and/or its affiliates. All rights reserved.
      +# Copyright (c) 2009, 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
      @@ -159,7 +159,8 @@ ifeq ($(NATIVE_ECC_AVAILABLE), true)
             $(PKGDIR)/ECDSASignature.java \
             $(PKGDIR)/ECKeyPairGenerator.java
       
      -  JAVAHFLAGS += -Xbootclasspath/p:$(CLASSDESTDIR)
      +  JAVAHFLAGS = -bootclasspath \
      +    "$(CLASSDESTDIR)$(CLASSPATH_SEPARATOR)$(CLASSBINDIR)$(JCE_PATH)"
       
         #
         # C and C++ files
      diff --git a/jdk/makefiles/sun/security/mscapi/Makefile b/jdk/makefiles/sun/security/mscapi/Makefile
      index 389d5a1a016..1cd6024a9c4 100644
      --- a/jdk/makefiles/sun/security/mscapi/Makefile
      +++ b/jdk/makefiles/sun/security/mscapi/Makefile
      @@ -1,5 +1,5 @@
       #
      -# Copyright (c) 2005, 2011, Oracle and/or its affiliates. All rights reserved.
      +# Copyright (c) 2005, 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
      @@ -149,7 +149,8 @@ OTHER_INCLUDES += \
       # Rules
       #
       CLASSDESTDIR = $(TEMPDIR)/classes
      -JAVAHFLAGS += -Xbootclasspath/p:$(CLASSDESTDIR)
      +JAVAHFLAGS = -bootclasspath \
      +  "$(CLASSDESTDIR)$(CLASSPATH_SEPARATOR)$(CLASSBINDIR)$(JCE_PATH)"
       
       include $(BUILDDIR)/common/Mapfile-vers.gmk
       
      diff --git a/jdk/makefiles/sun/security/pkcs11/Makefile b/jdk/makefiles/sun/security/pkcs11/Makefile
      index 7f9c1c75574..b94a6dbc109 100644
      --- a/jdk/makefiles/sun/security/pkcs11/Makefile
      +++ b/jdk/makefiles/sun/security/pkcs11/Makefile
      @@ -150,7 +150,8 @@ OTHER_INCLUDES += \
       # Rules
       #
       CLASSDESTDIR = $(TEMPDIR)/classes
      -JAVAHFLAGS = -bootclasspath "$(CLASSDESTDIR)$(CLASSPATH_SEPARATOR)$(CLASSBINDIR)"
      +JAVAHFLAGS = -bootclasspath \
      +  "$(CLASSDESTDIR)$(CLASSPATH_SEPARATOR)$(CLASSBINDIR)$(JCE_PATH)"
       
       include $(BUILDDIR)/common/Mapfile-vers.gmk
       
      
      From 8b44324ec46a4b3667129e1c8f3c767e7a886075 Mon Sep 17 00:00:00 2001
      From: Kevin Walls 
      Date: Fri, 11 May 2012 17:24:32 +0100
      Subject: [PATCH 029/128] 7157734: hotspot test scripts not testing 64-bit JVM
       under JPRT/JTREG
      
      Reviewed-by: kvn
      ---
       hotspot/test/compiler/6894807/Test6894807.sh  | 12 ++-----
       hotspot/test/gc/6941923/test6941923.sh        |  6 ++--
       hotspot/test/runtime/6626217/Test6626217.sh   | 14 ++-------
       hotspot/test/runtime/6878713/Test6878713.sh   | 12 ++-----
       hotspot/test/runtime/6929067/Test6929067.sh   | 20 +++++++++---
       hotspot/test/runtime/7020373/Test7020373.sh   | 12 ++-----
       hotspot/test/runtime/7051189/Xchecksig.sh     | 31 ++++++-------------
       .../test/runtime/7158988/TestFieldMonitor.sh  | 12 ++-----
       8 files changed, 38 insertions(+), 81 deletions(-)
      
      diff --git a/hotspot/test/compiler/6894807/Test6894807.sh b/hotspot/test/compiler/6894807/Test6894807.sh
      index da435cc380f..2b11733dc9c 100644
      --- a/hotspot/test/compiler/6894807/Test6894807.sh
      +++ b/hotspot/test/compiler/6894807/Test6894807.sh
      @@ -18,8 +18,6 @@ then
         exit 1
       fi
       
      -BIT_FLAG=""
      -
       # set platform-dependent variables
       OS=`uname -s`
       case "$OS" in
      @@ -27,12 +25,6 @@ case "$OS" in
           NULL=/dev/null
           PS=":"
           FS="/"
      -    ## for solaris, linux it's HOME
      -    FILE_LOCATION=$HOME
      -    if [ -f ${FILE_LOCATION}${FS}JDK64BIT -a ${OS} = "SunOS" ]
      -    then
      -        BIT_FLAG=`cat ${FILE_LOCATION}${FS}JDK64BIT | grep -v '^#'`
      -    fi
           ;;
         Windows_* )
           NULL=NUL
      @@ -50,9 +42,9 @@ CLASSPATH=.${PS}${TESTCLASSES}${PS}${JEMMYPATH} ; export CLASSPATH
       
       THIS_DIR=`pwd`
       
      -${TESTJAVA}${FS}bin${FS}java ${BIT_FLAG} -version
      +${TESTJAVA}${FS}bin${FS}java ${TESTVMOPTS} -version
       
      -${TESTJAVA}${FS}bin${FS}java ${BIT_FLAG} -server IsInstanceTest > test.out 2>&1
      +${TESTJAVA}${FS}bin${FS}java ${TESTVMOPTS} IsInstanceTest > test.out 2>&1
       
       cat test.out
       
      diff --git a/hotspot/test/gc/6941923/test6941923.sh b/hotspot/test/gc/6941923/test6941923.sh
      index a9b77213227..8e108b79567 100644
      --- a/hotspot/test/gc/6941923/test6941923.sh
      +++ b/hotspot/test/gc/6941923/test6941923.sh
      @@ -30,7 +30,7 @@ then
         exit 0
       fi
       
      -$JAVA_HOME/bin/java -version > $NULL 2>&1
      +$JAVA_HOME/bin/java ${TESTVMOPTS} -version > $NULL 2>&1
       
       if [ $? != 0 ]; then
         echo "Wrong JAVA_HOME? JAVA_HOME: $JAVA_HOME"
      @@ -119,7 +119,7 @@ fi
       
       options="-Xloggc:$logfile -XX:+UseConcMarkSweepGC -XX:+PrintGC -XX:+PrintGCDetails -XX:+UseGCLogFileRotation  -XX:NumberOfGCLogFiles=1 -XX:GCLogFileSize=$gclogsize"
       echo "Test gc log rotation in same file, wait for $tts minutes ...."
      -$JAVA_HOME/bin/java $options $testname $tts
      +$JAVA_HOME/bin/java ${TESTVMOPTS} $options $testname $tts
       if [ $? != 0 ]; then
         echo "$msgfail"
         exit -1
      @@ -148,7 +148,7 @@ fi
       numoffiles=3
       options="-Xloggc:$logfile -XX:+UseConcMarkSweepGC -XX:+PrintGC -XX:+PrintGCDetails -XX:+UseGCLogFileRotation  -XX:NumberOfGCLogFiles=$numoffiles -XX:GCLogFileSize=$gclogsize"
       echo "Test gc log rotation in $numoffiles files, wait for $tts minutes ...."
      -$JAVA_HOME/bin/java $options $testname $tts
      +$JAVA_HOME/bin/java ${TESTVMOPTS} $options $testname $tts
       if [ $? != 0 ]; then
         echo "$msgfail"
         exit -1
      diff --git a/hotspot/test/runtime/6626217/Test6626217.sh b/hotspot/test/runtime/6626217/Test6626217.sh
      index 88c3c5bf580..96217b5163b 100644
      --- a/hotspot/test/runtime/6626217/Test6626217.sh
      +++ b/hotspot/test/runtime/6626217/Test6626217.sh
      @@ -1,5 +1,5 @@
       # 
      -#  Copyright (c) 1998, 2010, Oracle and/or its affiliates. All rights reserved.
      +#  Copyright (c) 1998, 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
      @@ -46,8 +46,6 @@ then
         exit 1
       fi
       
      -BIT_FLAG=""
      -
       # set platform-dependent variables
       OS=`uname -s`
       case "$OS" in
      @@ -58,12 +56,6 @@ case "$OS" in
           RM=/bin/rm
           CP=/bin/cp
           MV=/bin/mv
      -    ## for solaris, linux it's HOME
      -    FILE_LOCATION=$HOME
      -    if [ -f ${FILE_LOCATION}${FS}JDK64BIT -a ${OS} = "SunOS" ]
      -    then
      -        BIT_FLAG=`cat ${FILE_LOCATION}${FS}JDK64BIT`
      -    fi
           ;;
         Windows_* )
           NULL=NUL
      @@ -87,7 +79,7 @@ THIS_DIR=`pwd`
       JAVA=${TESTJAVA}${FS}bin${FS}java
       JAVAC=${TESTJAVA}${FS}bin${FS}javac
       
      -${JAVA} ${BIT_FLAG} -version
      +${JAVA} ${TESTVMOPTS} -version
       
       # Current directory is scratch directory, copy all the test source there
       # (for the subsequent moves to work).
      @@ -113,7 +105,7 @@ ${MV} many_loader.class many_loader.impl2
       ${MV} many_loader.impl1 many_loader.class
       ${RM} many_loader.java
       
      -${JAVA} ${BIT_FLAG} -Xverify -Xint -cp . bug_21227 >test.out 2>&1
      +${JAVA} ${TESTVMOPTS} -Xverify -Xint -cp . bug_21227 >test.out 2>&1
       grep "loader constraint" test.out
       exit $?
       
      diff --git a/hotspot/test/runtime/6878713/Test6878713.sh b/hotspot/test/runtime/6878713/Test6878713.sh
      index 54b01146872..eb2064de233 100644
      --- a/hotspot/test/runtime/6878713/Test6878713.sh
      +++ b/hotspot/test/runtime/6878713/Test6878713.sh
      @@ -25,8 +25,6 @@ then
         exit 1
       fi
       
      -BIT_FLAG=""
      -
       # set platform-dependent variables
       OS=`uname -s`
       case "$OS" in
      @@ -34,12 +32,6 @@ case "$OS" in
           NULL=/dev/null
           PS=":"
           FS="/"
      -    ## for solaris, linux it's HOME
      -    FILE_LOCATION=$HOME
      -    if [ -f ${FILE_LOCATION}${FS}JDK64BIT -a ${OS} = "SunOS" ]
      -    then
      -        BIT_FLAG=`cat ${FILE_LOCATION}${FS}JDK64BIT | grep -v '^#'`
      -    fi
           ;;
         Windows_* )
           NULL=NUL
      @@ -57,11 +49,11 @@ CLASSPATH=.${PS}${TESTCLASSES}${PS}${JEMMYPATH} ; export CLASSPATH
       
       THIS_DIR=`pwd`
       
      -${TESTJAVA}${FS}bin${FS}java ${BIT_FLAG} -version
      +${TESTJAVA}${FS}bin${FS}java ${TESTVMOPTS} -version
       
       ${TESTJAVA}${FS}bin${FS}jar xvf ${TESTSRC}${FS}testcase.jar
       
      -${TESTJAVA}${FS}bin${FS}java ${BIT_FLAG} OOMCrashClass1960_2 > test.out 2>&1
      +${TESTJAVA}${FS}bin${FS}java ${TESTVMOPTS} OOMCrashClass1960_2 > test.out 2>&1
       
       if [ -s core -o -s "hs_*.log" ]
       then
      diff --git a/hotspot/test/runtime/6929067/Test6929067.sh b/hotspot/test/runtime/6929067/Test6929067.sh
      index 8f9e13a6f76..3e624d04eb7 100644
      --- a/hotspot/test/runtime/6929067/Test6929067.sh
      +++ b/hotspot/test/runtime/6929067/Test6929067.sh
      @@ -19,8 +19,6 @@ then
         echo "If this is incorrect, try setting the variable manually."
       fi
       
      -BIT_FLAG=""
      -
       # set platform-dependent variables
       OS=`uname -s`
       case "$OS" in
      @@ -42,7 +40,19 @@ case "$OS" in
           ;;
       esac
       
      -LD_LIBRARY_PATH=.:${TESTJAVA}/jre/lib/i386/client:/usr/openwin/lib:/usr/dt/lib:/usr/lib:$LD_LIBRARY_PATH
      +# Choose arch: i386 or amd64 (test is Linux-specific)
      +# Cannot simply look at TESTVMOPTS as -d64 is not
      +# passed if there is only a 64-bit JVM available.
      +
      +${TESTJAVA}/bin/java ${TESTVMOPTS} -version 2>1 | grep "64-Bit" >/dev/null
      +if [ "$?" = "0" ]
      +then
      +  ARCH=amd64
      +else
      +  ARCH=i386
      +fi
      +
      +LD_LIBRARY_PATH=.:${TESTJAVA}/jre/lib/${ARCH}/client:/usr/openwin/lib:/usr/dt/lib:/usr/lib:$LD_LIBRARY_PATH
       export LD_LIBRARY_PATH
       
       THIS_DIR=`pwd`
      @@ -51,10 +61,10 @@ cp ${TESTSRC}${FS}invoke.c ${THIS_DIR}
       cp ${TESTSRC}${FS}T.java ${THIS_DIR}
       
       
      -${TESTJAVA}${FS}bin${FS}java ${BIT_FLAG} -fullversion
      +${TESTJAVA}${FS}bin${FS}java ${TESTVMOPTS} -fullversion
       
       ${TESTJAVA}${FS}bin${FS}javac T.java
       
      -gcc -o invoke -I${TESTJAVA}/include -I${TESTJAVA}/include/linux invoke.c ${TESTJAVA}/jre/lib/i386/client/libjvm.so
      +gcc -o invoke -I${TESTJAVA}/include -I${TESTJAVA}/include/linux invoke.c ${TESTJAVA}/jre/lib/${ARCH}/client/libjvm.so
       ./invoke
       exit $?
      diff --git a/hotspot/test/runtime/7020373/Test7020373.sh b/hotspot/test/runtime/7020373/Test7020373.sh
      index 7f6b03c8fe7..865e68c76c6 100644
      --- a/hotspot/test/runtime/7020373/Test7020373.sh
      +++ b/hotspot/test/runtime/7020373/Test7020373.sh
      @@ -27,8 +27,6 @@ then
         exit 1
       fi
       
      -BIT_FLAG=""
      -
       # set platform-dependent variables
       OS=`uname -s`
       case "$OS" in
      @@ -36,12 +34,6 @@ case "$OS" in
           NULL=/dev/null
           PS=":"
           FS="/"
      -    ## for solaris, linux it's HOME
      -    FILE_LOCATION=$HOME
      -    if [ -f ${FILE_LOCATION}${FS}JDK64BIT -a ${OS} = "SunOS" ]
      -    then
      -        BIT_FLAG=`cat ${FILE_LOCATION}${FS}JDK64BIT | grep -v '^#'`
      -    fi
           ;;
         Windows_* )
           NULL=NUL
      @@ -59,11 +51,11 @@ CLASSPATH=.${PS}${TESTCLASSES}${PS}${JEMMYPATH} ; export CLASSPATH
       
       THIS_DIR=`pwd`
       
      -${TESTJAVA}${FS}bin${FS}java ${BIT_FLAG} -version
      +${TESTJAVA}${FS}bin${FS}java ${TESTVMOPTS} -version
       
       ${TESTJAVA}${FS}bin${FS}jar xvf ${TESTSRC}${FS}testcase.jar
       
      -${TESTJAVA}${FS}bin${FS}java ${BIT_FLAG} OOMCrashClass4000_1 > test.out 2>&1
      +${TESTJAVA}${FS}bin${FS}java ${TESTVMOPTS} OOMCrashClass4000_1 > test.out 2>&1
       
       cat test.out
       
      diff --git a/hotspot/test/runtime/7051189/Xchecksig.sh b/hotspot/test/runtime/7051189/Xchecksig.sh
      index 410cdb9b335..0bf3fe9f21c 100644
      --- a/hotspot/test/runtime/7051189/Xchecksig.sh
      +++ b/hotspot/test/runtime/7051189/Xchecksig.sh
      @@ -1,5 +1,5 @@
       # 
      -#  Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
      +#  Copyright (c) 2011, 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
      @@ -41,18 +41,10 @@ then
       fi
       
       
      -BIT_FLAG=""
      -
       OS=`uname -s`
       case "$OS" in
         SunOS | Linux )
           FS="/"
      -    ## for solaris, linux it's HOME
      -    FILE_LOCATION=$HOME
      -    if [ -f ${FILE_LOCATION}${FS}JDK64BIT -a ${OS} = "SunOS" ]
      -    then
      -        BIT_FLAG=`cat ${FILE_LOCATION}${FS}JDK64BIT`
      -    fi
           ;;
         Windows_* )
           printf "Not testing libjsig.so on Windows. PASSED.\n "
      @@ -69,20 +61,16 @@ JAVA=${TESTJAVA}${FS}bin${FS}java
       
       # LD_PRELOAD arch needs to match the binary we run, so run the java
       # 64-bit binary directly if we are testing 64-bit (bin/ARCH/java).
      -
      -# However JPRT runs: .../solaris_x64_5.10-debug/bin/java
      -# ..which is 32-bit, when it has built the 64-bit version to test.
      -#
      -# How does this script know we are meant to run the 64-bit version?
      -# Can check for the path of the binary containing "x64" on Solaris.
      +# Check if TESTVMOPS contains -d64, but cannot use 
      +# java ${TESTVMOPS} to run "java -d64"  with LD_PRELOAD.
       
       if [ ${OS} -eq "SunOS" ]
       then
      -  printf  "SunOS test JAVA=${JAVA}"
      -  printf ${JAVA} | grep x64 > /dev/null
      +  printf  "SunOS test TESTVMOPTS = ${TESTVMOPTS}"
      +  printf ${TESTVMOPTS} | grep d64 > /dev/null
         if [ $? -eq 0 ]
         then
      -    printf "SunOS x64 test, forcing -d64\n"
      +    printf "SunOS 64-bit test\n"
           BIT_FLAG=-d64
         fi
       fi
      @@ -127,20 +115,19 @@ then
         printf "Skipping test: libjsig missing for given architecture: ${LIBJSIG}\n"
         exit 0
       fi
      -# Use java -version to test, java version info appeas on stderr,
      +# Use java -version to test, java version info appears on stderr,
       # the libjsig message we are removing appears on stdout.
       
       # grep returns zero meaning found, non-zero means not found:
       
      -LD_PRELOAD=${LIBJSIG} ${JAVA} ${BIT_FLAG} -Xcheck:jni -version 2>&1  | grep "libjsig is activated"
      -
      +LD_PRELOAD=${LIBJSIG} ${JAVA} ${TESTVMOPTS} -Xcheck:jni -version 2>&1  | grep "libjsig is activated"
       if [ $? -eq 0 ]; then
         printf "Failed: -Xcheck:jni prints message when libjsig.so is loaded.\n"
         exit 1
       fi
       
       
      -LD_PRELOAD=${LIBJSIG} ${JAVA} ${BIT_FLAG} -Xcheck:jni -verbose:jni -version 2>&1 | grep "libjsig is activated"
      +LD_PRELOAD=${LIBJSIG} ${JAVA} ${TESTVMOPTS} -Xcheck:jni -verbose:jni -version 2>&1 | grep "libjsig is activated"
       if [ $? != 0 ]; then
         printf "Failed: -Xcheck:jni does not print message when libjsig.so is loaded and -verbose:jni is set.\n"
         exit 1
      diff --git a/hotspot/test/runtime/7158988/TestFieldMonitor.sh b/hotspot/test/runtime/7158988/TestFieldMonitor.sh
      index 8715bd546d8..c9268f862e3 100644
      --- a/hotspot/test/runtime/7158988/TestFieldMonitor.sh
      +++ b/hotspot/test/runtime/7158988/TestFieldMonitor.sh
      @@ -18,8 +18,6 @@ then
         exit 1
       fi
       
      -BIT_FLAG=""
      -
       # set platform-dependent variables
       OS=`uname -s`
       case "$OS" in
      @@ -27,12 +25,6 @@ case "$OS" in
           NULL=/dev/null
           PS=":"
           FS="/"
      -    ## for solaris, linux it's HOME
      -    FILE_LOCATION=$HOME
      -    if [ -f ${FILE_LOCATION}${FS}JDK64BIT -a ${OS} = "SunOS" -a `uname -p`='sparc' ]
      -    then
      -        BIT_FLAG="-d64"
      -    fi
           ;;
         Windows_95 | Windows_98 | Windows_ME )
           NULL=NUL
      @@ -56,11 +48,11 @@ esac
       
       cp ${TESTSRC}${FS}*.java .
       
      -${TESTJAVA}${FS}bin${FS}java ${BIT_FLAG} -fullversion
      +${TESTJAVA}${FS}bin${FS}java ${TESTVMOPTS} -fullversion
       
       ${TESTJAVA}${FS}bin${FS}javac -classpath .${PS}$TESTJAVA${FS}lib${FS}tools.jar *.java
       
      -${TESTJAVA}${FS}bin${FS}java ${BIT_FLAG} -classpath .${PS}$TESTJAVA${FS}lib${FS}tools.jar FieldMonitor > test.out 2>&1 &
      +${TESTJAVA}${FS}bin${FS}java ${TESTVMOPTS} -classpath .${PS}$TESTJAVA${FS}lib${FS}tools.jar FieldMonitor > test.out 2>&1 &
       
       P_PID=$!
       
      
      From a160adcf6c85906d87f4550c524aa0116c46f10f Mon Sep 17 00:00:00 2001
      From: "Daniel D. Daugherty" 
      Date: Tue, 15 May 2012 15:16:14 -0700
      Subject: [PATCH 030/128] 7169102: 7165060 merge lost changes to
       make/windows/makefiles/defs.make
      
      Reviewed-by: sspitsyn, acorn
      ---
       hotspot/make/windows/makefiles/defs.make | 4 +---
       1 file changed, 1 insertion(+), 3 deletions(-)
      
      diff --git a/hotspot/make/windows/makefiles/defs.make b/hotspot/make/windows/makefiles/defs.make
      index a1c88284cc2..58e6a606e65 100644
      --- a/hotspot/make/windows/makefiles/defs.make
      +++ b/hotspot/make/windows/makefiles/defs.make
      @@ -143,9 +143,7 @@ _JUNK_ := $(shell \
       MAKE_ARGS += ENABLE_FULL_DEBUG_SYMBOLS=$(ENABLE_FULL_DEBUG_SYMBOLS)
       
       ifeq ($(ENABLE_FULL_DEBUG_SYMBOLS),1)
      -  # Disable ZIP_DEBUGINFO_FILES by default because various tests are
      -  # failing in nightly when the debug info files are ZIP'ed.
      -  ZIP_DEBUGINFO_FILES ?= 0
      +  ZIP_DEBUGINFO_FILES ?= 1
       else
         ZIP_DEBUGINFO_FILES=0
       endif
      
      From 7d82c13142ef912b297895776659591584ddcbae Mon Sep 17 00:00:00 2001
      From: Nils Loodin 
      Date: Thu, 10 May 2012 15:44:19 +0200
      Subject: [PATCH 031/128] 7165755: OS Information much longer on linux than
       other platforms
      
      Reviewed-by: sla, dholmes
      ---
       hotspot/src/os/bsd/vm/os_bsd.cpp         |  90 ++----------------
       hotspot/src/os/linux/vm/os_linux.cpp     | 116 +++++++++--------------
       hotspot/src/os/linux/vm/os_linux.hpp     |   4 +
       hotspot/src/os/posix/vm/os_posix.cpp     |  58 ++++++++++++
       hotspot/src/os/posix/vm/os_posix.hpp     |  41 ++++++++
       hotspot/src/os/solaris/vm/os_solaris.cpp |  75 ++++++---------
       hotspot/src/os/solaris/vm/os_solaris.hpp |   3 +
       hotspot/src/os/windows/vm/os_windows.cpp |   8 ++
       hotspot/src/os/windows/vm/os_windows.hpp |   3 +
       hotspot/src/share/vm/runtime/os.hpp      |   4 +
       10 files changed, 206 insertions(+), 196 deletions(-)
       create mode 100644 hotspot/src/os/posix/vm/os_posix.hpp
      
      diff --git a/hotspot/src/os/bsd/vm/os_bsd.cpp b/hotspot/src/os/bsd/vm/os_bsd.cpp
      index 5643798bc30..f9b21acb464 100644
      --- a/hotspot/src/os/bsd/vm/os_bsd.cpp
      +++ b/hotspot/src/os/bsd/vm/os_bsd.cpp
      @@ -2340,93 +2340,21 @@ void os::print_dll_info(outputStream *st) {
       #endif
       }
       
      +void os::print_os_info_brief(outputStream* st) {
      +  st->print("Bsd");
      +
      +  os::Posix::print_uname_info(st);
      +}
       
       void os::print_os_info(outputStream* st) {
         st->print("OS:");
      +  st->print("Bsd");
       
      -  // Try to identify popular distros.
      -  // Most Bsd distributions have /etc/XXX-release file, which contains
      -  // the OS version string. Some have more than one /etc/XXX-release file
      -  // (e.g. Mandrake has both /etc/mandrake-release and /etc/redhat-release.),
      -  // so the order is important.
      -  if (!_print_ascii_file("/etc/mandrake-release", st) &&
      -      !_print_ascii_file("/etc/sun-release", st) &&
      -      !_print_ascii_file("/etc/redhat-release", st) &&
      -      !_print_ascii_file("/etc/SuSE-release", st) &&
      -      !_print_ascii_file("/etc/turbobsd-release", st) &&
      -      !_print_ascii_file("/etc/gentoo-release", st) &&
      -      !_print_ascii_file("/etc/debian_version", st) &&
      -      !_print_ascii_file("/etc/ltib-release", st) &&
      -      !_print_ascii_file("/etc/angstrom-version", st)) {
      -      st->print("Bsd");
      -  }
      -  st->cr();
      +  os::Posix::print_uname_info(st);
       
      -  // kernel
      -  st->print("uname:");
      -  struct utsname name;
      -  uname(&name);
      -  st->print(name.sysname); st->print(" ");
      -  st->print(name.release); st->print(" ");
      -  st->print(name.version); st->print(" ");
      -  st->print(name.machine);
      -  st->cr();
      +  os::Posix::print_rlimit_info(st);
       
      -#ifndef _ALLBSD_SOURCE
      -  // Print warning if unsafe chroot environment detected
      -  if (unsafe_chroot_detected) {
      -    st->print("WARNING!! ");
      -    st->print_cr(unstable_chroot_error);
      -  }
      -
      -  // libc, pthread
      -  st->print("libc:");
      -  st->print(os::Bsd::glibc_version()); st->print(" ");
      -  st->print(os::Bsd::libpthread_version()); st->print(" ");
      -  if (os::Bsd::is_BsdThreads()) {
      -     st->print("(%s stack)", os::Bsd::is_floating_stack() ? "floating" : "fixed");
      -  }
      -  st->cr();
      -#endif
      -
      -  // rlimit
      -  st->print("rlimit:");
      -  struct rlimit rlim;
      -
      -  st->print(" STACK ");
      -  getrlimit(RLIMIT_STACK, &rlim);
      -  if (rlim.rlim_cur == RLIM_INFINITY) st->print("infinity");
      -  else st->print("%uk", rlim.rlim_cur >> 10);
      -
      -  st->print(", CORE ");
      -  getrlimit(RLIMIT_CORE, &rlim);
      -  if (rlim.rlim_cur == RLIM_INFINITY) st->print("infinity");
      -  else st->print("%uk", rlim.rlim_cur >> 10);
      -
      -  st->print(", NPROC ");
      -  getrlimit(RLIMIT_NPROC, &rlim);
      -  if (rlim.rlim_cur == RLIM_INFINITY) st->print("infinity");
      -  else st->print("%d", rlim.rlim_cur);
      -
      -  st->print(", NOFILE ");
      -  getrlimit(RLIMIT_NOFILE, &rlim);
      -  if (rlim.rlim_cur == RLIM_INFINITY) st->print("infinity");
      -  else st->print("%d", rlim.rlim_cur);
      -
      -#ifndef _ALLBSD_SOURCE
      -  st->print(", AS ");
      -  getrlimit(RLIMIT_AS, &rlim);
      -  if (rlim.rlim_cur == RLIM_INFINITY) st->print("infinity");
      -  else st->print("%uk", rlim.rlim_cur >> 10);
      -  st->cr();
      -
      -  // load average
      -  st->print("load average:");
      -  double loadavg[3];
      -  os::loadavg(loadavg, 3);
      -  st->print("%0.02f %0.02f %0.02f", loadavg[0], loadavg[1], loadavg[2]);
      -  st->cr();
      -#endif
      +  os::Posix::print_load_average(st);
       }
       
       void os::pd_print_cpu_info(outputStream* st) {
      diff --git a/hotspot/src/os/linux/vm/os_linux.cpp b/hotspot/src/os/linux/vm/os_linux.cpp
      index 0297df4dc4b..53457ec8db9 100644
      --- a/hotspot/src/os/linux/vm/os_linux.cpp
      +++ b/hotspot/src/os/linux/vm/os_linux.cpp
      @@ -2020,15 +2020,43 @@ void os::print_dll_info(outputStream *st) {
          }
       }
       
      +void os::print_os_info_brief(outputStream* st) {
      +  os::Linux::print_distro_info(st);
      +
      +  os::Posix::print_uname_info(st);
      +
      +  os::Linux::print_libversion_info(st);
      +
      +}
       
       void os::print_os_info(outputStream* st) {
         st->print("OS:");
       
      -  // Try to identify popular distros.
      -  // Most Linux distributions have /etc/XXX-release file, which contains
      -  // the OS version string. Some have more than one /etc/XXX-release file
      -  // (e.g. Mandrake has both /etc/mandrake-release and /etc/redhat-release.),
      -  // so the order is important.
      +  os::Linux::print_distro_info(st);
      +
      +  os::Posix::print_uname_info(st);
      +
      +  // Print warning if unsafe chroot environment detected
      +  if (unsafe_chroot_detected) {
      +    st->print("WARNING!! ");
      +    st->print_cr(unstable_chroot_error);
      +  }
      +
      +  os::Linux::print_libversion_info(st);
      +
      +  os::Posix::print_rlimit_info(st);
      +
      +  os::Posix::print_load_average(st);
      +
      +  os::Linux::print_full_memory_info(st);
      +}
      +
      +// Try to identify popular distros.
      +// Most Linux distributions have /etc/XXX-release file, which contains
      +// the OS version string. Some have more than one /etc/XXX-release file
      +// (e.g. Mandrake has both /etc/mandrake-release and /etc/redhat-release.),
      +// so the order is important.
      +void os::Linux::print_distro_info(outputStream* st) {
         if (!_print_ascii_file("/etc/mandrake-release", st) &&
             !_print_ascii_file("/etc/sun-release", st) &&
             !_print_ascii_file("/etc/redhat-release", st) &&
      @@ -2041,23 +2069,9 @@ void os::print_os_info(outputStream* st) {
             st->print("Linux");
         }
         st->cr();
      +}
       
      -  // kernel
      -  st->print("uname:");
      -  struct utsname name;
      -  uname(&name);
      -  st->print(name.sysname); st->print(" ");
      -  st->print(name.release); st->print(" ");
      -  st->print(name.version); st->print(" ");
      -  st->print(name.machine);
      -  st->cr();
      -
      -  // Print warning if unsafe chroot environment detected
      -  if (unsafe_chroot_detected) {
      -    st->print("WARNING!! ");
      -    st->print_cr(unstable_chroot_error);
      -  }
      -
      +void os::Linux::print_libversion_info(outputStream* st) {
         // libc, pthread
         st->print("libc:");
         st->print(os::Linux::glibc_version()); st->print(" ");
      @@ -2066,56 +2080,12 @@ void os::print_os_info(outputStream* st) {
            st->print("(%s stack)", os::Linux::is_floating_stack() ? "floating" : "fixed");
         }
         st->cr();
      -
      -  // rlimit
      -  st->print("rlimit:");
      -  struct rlimit rlim;
      -
      -  st->print(" STACK ");
      -  getrlimit(RLIMIT_STACK, &rlim);
      -  if (rlim.rlim_cur == RLIM_INFINITY) st->print("infinity");
      -  else st->print("%uk", rlim.rlim_cur >> 10);
      -
      -  st->print(", CORE ");
      -  getrlimit(RLIMIT_CORE, &rlim);
      -  if (rlim.rlim_cur == RLIM_INFINITY) st->print("infinity");
      -  else st->print("%uk", rlim.rlim_cur >> 10);
      -
      -  st->print(", NPROC ");
      -  getrlimit(RLIMIT_NPROC, &rlim);
      -  if (rlim.rlim_cur == RLIM_INFINITY) st->print("infinity");
      -  else st->print("%d", rlim.rlim_cur);
      -
      -  st->print(", NOFILE ");
      -  getrlimit(RLIMIT_NOFILE, &rlim);
      -  if (rlim.rlim_cur == RLIM_INFINITY) st->print("infinity");
      -  else st->print("%d", rlim.rlim_cur);
      -
      -  st->print(", AS ");
      -  getrlimit(RLIMIT_AS, &rlim);
      -  if (rlim.rlim_cur == RLIM_INFINITY) st->print("infinity");
      -  else st->print("%uk", rlim.rlim_cur >> 10);
      -  st->cr();
      -
      -  // load average
      -  st->print("load average:");
      -  double loadavg[3];
      -  os::loadavg(loadavg, 3);
      -  st->print("%0.02f %0.02f %0.02f", loadavg[0], loadavg[1], loadavg[2]);
      -  st->cr();
      -
      -  // meminfo
      -  st->print("\n/proc/meminfo:\n");
      -  _print_ascii_file("/proc/meminfo", st);
      -  st->cr();
       }
       
      -void os::pd_print_cpu_info(outputStream* st) {
      -  st->print("\n/proc/cpuinfo:\n");
      -  if (!_print_ascii_file("/proc/cpuinfo", st)) {
      -    st->print("  ");
      -  }
      -  st->cr();
      +void os::Linux::print_full_memory_info(outputStream* st) {
      +   st->print("\n/proc/meminfo:\n");
      +   _print_ascii_file("/proc/meminfo", st);
      +   st->cr();
       }
       
       void os::print_memory_info(outputStream* st) {
      @@ -2138,6 +2108,14 @@ void os::print_memory_info(outputStream* st) {
         st->cr();
       }
       
      +void os::pd_print_cpu_info(outputStream* st) {
      +  st->print("\n/proc/cpuinfo:\n");
      +  if (!_print_ascii_file("/proc/cpuinfo", st)) {
      +    st->print("  ");
      +  }
      +  st->cr();
      +}
      +
       // Taken from /usr/include/bits/siginfo.h  Supposed to be architecture specific
       // but they're the same for all the linux arch that we support
       // and they're the same for solaris but there's no common place to put this.
      diff --git a/hotspot/src/os/linux/vm/os_linux.hpp b/hotspot/src/os/linux/vm/os_linux.hpp
      index ec32232f4ed..7c19517e21e 100644
      --- a/hotspot/src/os/linux/vm/os_linux.hpp
      +++ b/hotspot/src/os/linux/vm/os_linux.hpp
      @@ -89,6 +89,10 @@ class Linux {
       
         static bool hugetlbfs_sanity_check(bool warn, size_t page_size);
       
      +  static void print_full_memory_info(outputStream* st);
      +  static void print_distro_info(outputStream* st);
      +  static void print_libversion_info(outputStream* st);
      +
        public:
         static void init_thread_fpu_state();
         static int  get_fpu_control_word();
      diff --git a/hotspot/src/os/posix/vm/os_posix.cpp b/hotspot/src/os/posix/vm/os_posix.cpp
      index 42078342ec9..9f05a74a4a0 100644
      --- a/hotspot/src/os/posix/vm/os_posix.cpp
      +++ b/hotspot/src/os/posix/vm/os_posix.cpp
      @@ -28,6 +28,8 @@
       
       #include 
       #include 
      +#include 
      +
       
       // Check core dump limit and report possible place where core can be found
       void os::check_or_create_dump(void* exceptionRecord, void* contextRecord, char* buffer, size_t bufferSize) {
      @@ -72,3 +74,59 @@ void os::wait_for_keypress_at_exit(void) {
         // don't do anything on posix platforms
         return;
       }
      +
      +void os::Posix::print_load_average(outputStream* st) {
      +  st->print("load average:");
      +  double loadavg[3];
      +  os::loadavg(loadavg, 3);
      +  st->print("%0.02f %0.02f %0.02f", loadavg[0], loadavg[1], loadavg[2]);
      +  st->cr();
      +}
      +
      +void os::Posix::print_rlimit_info(outputStream* st) {
      +  st->print("rlimit:");
      +  struct rlimit rlim;
      +
      +  st->print(" STACK ");
      +  getrlimit(RLIMIT_STACK, &rlim);
      +  if (rlim.rlim_cur == RLIM_INFINITY) st->print("infinity");
      +  else st->print("%uk", rlim.rlim_cur >> 10);
      +
      +  st->print(", CORE ");
      +  getrlimit(RLIMIT_CORE, &rlim);
      +  if (rlim.rlim_cur == RLIM_INFINITY) st->print("infinity");
      +  else st->print("%uk", rlim.rlim_cur >> 10);
      +
      +  //Isn't there on solaris
      +#ifndef TARGET_OS_FAMILY_solaris
      +  st->print(", NPROC ");
      +  getrlimit(RLIMIT_NPROC, &rlim);
      +  if (rlim.rlim_cur == RLIM_INFINITY) st->print("infinity");
      +  else st->print("%d", rlim.rlim_cur);
      +#endif
      +
      +  st->print(", NOFILE ");
      +  getrlimit(RLIMIT_NOFILE, &rlim);
      +  if (rlim.rlim_cur == RLIM_INFINITY) st->print("infinity");
      +  else st->print("%d", rlim.rlim_cur);
      +
      +  st->print(", AS ");
      +  getrlimit(RLIMIT_AS, &rlim);
      +  if (rlim.rlim_cur == RLIM_INFINITY) st->print("infinity");
      +  else st->print("%uk", rlim.rlim_cur >> 10);
      +  st->cr();
      +}
      +
      +void os::Posix::print_uname_info(outputStream* st) {
      +  // kernel
      +  st->print("uname:");
      +  struct utsname name;
      +  uname(&name);
      +  st->print(name.sysname); st->print(" ");
      +  st->print(name.release); st->print(" ");
      +  st->print(name.version); st->print(" ");
      +  st->print(name.machine);
      +  st->cr();
      +}
      +
      +
      diff --git a/hotspot/src/os/posix/vm/os_posix.hpp b/hotspot/src/os/posix/vm/os_posix.hpp
      new file mode 100644
      index 00000000000..62ec7135d14
      --- /dev/null
      +++ b/hotspot/src/os/posix/vm/os_posix.hpp
      @@ -0,0 +1,41 @@
      +/*
      + * Copyright (c) 1999, 2010, 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.
      + *
      + */
      +
      +#ifndef OS_POSIX_VM_OS_POSIX_HPP
      +#define OS_POSIX_VM_OS_POSIX_HPP
      +class Posix {
      +  friend class os;
      +
      +protected:
      +  static void print_distro_info(outputStream* st);
      +  static void print_rlimit_info(outputStream* st);
      +  static void print_uname_info(outputStream* st);
      +  static void print_libversion_info(outputStream* st);
      +  static void print_load_average(outputStream* st);
      +
      +
      +};
      +
      +
      +#endif
      diff --git a/hotspot/src/os/solaris/vm/os_solaris.cpp b/hotspot/src/os/solaris/vm/os_solaris.cpp
      index 31bd41862a6..c3389a47764 100644
      --- a/hotspot/src/os/solaris/vm/os_solaris.cpp
      +++ b/hotspot/src/os/solaris/vm/os_solaris.cpp
      @@ -2242,61 +2242,44 @@ static bool _print_ascii_file(const char* filename, outputStream* st) {
         return true;
       }
       
      +void os::print_os_info_brief(outputStream* st) {
      +  os::Solaris::print_distro_info(st);
      +
      +  os::Posix::print_uname_info(st);
      +
      +  os::Solaris::print_libversion_info(st);
      +}
      +
       void os::print_os_info(outputStream* st) {
         st->print("OS:");
       
      -  if (!_print_ascii_file("/etc/release", st)) {
      -    st->print("Solaris");
      -  }
      -  st->cr();
      +  os::Solaris::print_distro_info(st);
       
      -  // kernel
      -  st->print("uname:");
      -  struct utsname name;
      -  uname(&name);
      -  st->print(name.sysname); st->print(" ");
      -  st->print(name.release); st->print(" ");
      -  st->print(name.version); st->print(" ");
      -  st->print(name.machine);
      +  os::Posix::print_uname_info(st);
       
      -  // libthread
      -  if (os::Solaris::T2_libthread()) st->print("  (T2 libthread)");
      -  else st->print("  (T1 libthread)");
      -  st->cr();
      +  os::Solaris::print_libversion_info(st);
       
      -  // rlimit
      -  st->print("rlimit:");
      -  struct rlimit rlim;
      +  os::Posix::print_rlimit_info(st);
       
      -  st->print(" STACK ");
      -  getrlimit(RLIMIT_STACK, &rlim);
      -  if (rlim.rlim_cur == RLIM_INFINITY) st->print("infinity");
      -  else st->print("%uk", rlim.rlim_cur >> 10);
      -
      -  st->print(", CORE ");
      -  getrlimit(RLIMIT_CORE, &rlim);
      -  if (rlim.rlim_cur == RLIM_INFINITY) st->print("infinity");
      -  else st->print("%uk", rlim.rlim_cur >> 10);
      -
      -  st->print(", NOFILE ");
      -  getrlimit(RLIMIT_NOFILE, &rlim);
      -  if (rlim.rlim_cur == RLIM_INFINITY) st->print("infinity");
      -  else st->print("%d", rlim.rlim_cur);
      -
      -  st->print(", AS ");
      -  getrlimit(RLIMIT_AS, &rlim);
      -  if (rlim.rlim_cur == RLIM_INFINITY) st->print("infinity");
      -  else st->print("%uk", rlim.rlim_cur >> 10);
      -  st->cr();
      -
      -  // load average
      -  st->print("load average:");
      -  double loadavg[3];
      -  os::loadavg(loadavg, 3);
      -  st->print("%0.02f %0.02f %0.02f", loadavg[0], loadavg[1], loadavg[2]);
      -  st->cr();
      +  os::Posix::print_load_average(st);
       }
       
      +void os::Solaris::print_distro_info(outputStream* st) {
      +  if (!_print_ascii_file("/etc/release", st)) {
      +      st->print("Solaris");
      +    }
      +    st->cr();
      +}
      +
      +void os::Solaris::print_libversion_info(outputStream* st) {
      +  if (os::Solaris::T2_libthread()) {
      +    st->print("  (T2 libthread)");
      +  }
      +  else {
      +    st->print("  (T1 libthread)");
      +  }
      +  st->cr();
      +}
       
       static bool check_addr0(outputStream* st) {
         jboolean status = false;
      diff --git a/hotspot/src/os/solaris/vm/os_solaris.hpp b/hotspot/src/os/solaris/vm/os_solaris.hpp
      index 991cf021082..340aa4b7775 100644
      --- a/hotspot/src/os/solaris/vm/os_solaris.hpp
      +++ b/hotspot/src/os/solaris/vm/os_solaris.hpp
      @@ -180,6 +180,9 @@ class Solaris {
         // proc_t structure (note that this is a system struct).
         static address _main_stack_base;
       
      +  static void print_distro_info(outputStream* st);
      +  static void print_libversion_info(outputStream* st);
      +
        public:
         static void libthread_init();
         static void synchronization_init();
      diff --git a/hotspot/src/os/windows/vm/os_windows.cpp b/hotspot/src/os/windows/vm/os_windows.cpp
      index c607905e836..0a8ff680806 100644
      --- a/hotspot/src/os/windows/vm/os_windows.cpp
      +++ b/hotspot/src/os/windows/vm/os_windows.cpp
      @@ -1562,9 +1562,17 @@ void os::print_dll_info(outputStream *st) {
          enumerate_modules(pid, _print_module, (void *)st);
       }
       
      +void os::print_os_info_brief(outputStream* st) {
      +  os::print_os_info(st);
      +}
      +
       void os::print_os_info(outputStream* st) {
         st->print("OS:");
       
      +  os::win32::print_windows_version(st);
      +}
      +
      +void os::win32::print_windows_version(outputStream* st) {
         OSVERSIONINFOEX osvi;
         ZeroMemory(&osvi, sizeof(OSVERSIONINFOEX));
         osvi.dwOSVersionInfoSize = sizeof(OSVERSIONINFOEX);
      diff --git a/hotspot/src/os/windows/vm/os_windows.hpp b/hotspot/src/os/windows/vm/os_windows.hpp
      index 353d595ebc7..e0692e5f2f7 100644
      --- a/hotspot/src/os/windows/vm/os_windows.hpp
      +++ b/hotspot/src/os/windows/vm/os_windows.hpp
      @@ -27,6 +27,7 @@
       // Win32_OS defines the interface to windows operating systems
       
       class win32 {
      +  friend class os;
       
        protected:
         static int    _vm_page_size;
      @@ -39,6 +40,8 @@ class win32 {
         static bool   _is_windows_2003;
         static bool   _is_windows_server;
       
      +  static void print_windows_version(outputStream* st);
      +
        public:
         // Windows-specific interface:
         static void   initialize_system_info();
      diff --git a/hotspot/src/share/vm/runtime/os.hpp b/hotspot/src/share/vm/runtime/os.hpp
      index dd163e9a958..68f8a3ab62a 100644
      --- a/hotspot/src/share/vm/runtime/os.hpp
      +++ b/hotspot/src/share/vm/runtime/os.hpp
      @@ -492,6 +492,7 @@ class os: AllStatic {
         // Print out system information; they are called by fatal error handler.
         // Output format may be different on different platforms.
         static void print_os_info(outputStream* st);
      +  static void print_os_info_brief(outputStream* st);
         static void print_cpu_info(outputStream* st);
         static void pd_print_cpu_info(outputStream* st);
         static void print_memory_info(outputStream* st);
      @@ -685,14 +686,17 @@ class os: AllStatic {
         // Platform dependent stuff
       #ifdef TARGET_OS_FAMILY_linux
       # include "os_linux.hpp"
      +# include "os_posix.hpp"
       #endif
       #ifdef TARGET_OS_FAMILY_solaris
       # include "os_solaris.hpp"
      +# include "os_posix.hpp"
       #endif
       #ifdef TARGET_OS_FAMILY_windows
       # include "os_windows.hpp"
       #endif
       #ifdef TARGET_OS_FAMILY_bsd
      +# include "os_posix.hpp"
       # include "os_bsd.hpp"
       #endif
       #ifdef TARGET_OS_ARCH_linux_x86
      
      From 9668994591df862ad66caebcea334c8e71029e4c Mon Sep 17 00:00:00 2001
      From: Sergey Bylokhov 
      Date: Thu, 10 May 2012 20:05:12 +0400
      Subject: [PATCH 032/128] 7080109: Dialog.show() lacks doPrivileged() to access
       system event queue
      
      Reviewed-by: art, anthony
      ---
       jdk/src/share/classes/java/awt/Dialog.java    |  9 ++-
       .../ModalDialogPermission.java                | 60 +++++++++++++++++++
       .../Dialog/ModalDialogPermission/java.policy  |  3 +
       3 files changed, 70 insertions(+), 2 deletions(-)
       create mode 100644 jdk/test/java/awt/Dialog/ModalDialogPermission/ModalDialogPermission.java
       create mode 100644 jdk/test/java/awt/Dialog/ModalDialogPermission/java.policy
      
      diff --git a/jdk/src/share/classes/java/awt/Dialog.java b/jdk/src/share/classes/java/awt/Dialog.java
      index a388c70e7f5..3faa9280abe 100644
      --- a/jdk/src/share/classes/java/awt/Dialog.java
      +++ b/jdk/src/share/classes/java/awt/Dialog.java
      @@ -1037,7 +1037,7 @@ public class Dialog extends Window {
                       predictedFocusOwner = getMostRecentFocusOwner();
                       if (conditionalShow(predictedFocusOwner, time)) {
                           modalFilter = ModalEventFilter.createFilterForDialog(this);
      -                    Conditional cond = new Conditional() {
      +                    final Conditional cond = new Conditional() {
                               @Override
                               public boolean evaluate() {
                                   return windowClosingException == null;
      @@ -1067,7 +1067,12 @@ public class Dialog extends Window {
       
                           modalityPushed();
                           try {
      -                        EventQueue eventQueue = Toolkit.getDefaultToolkit().getSystemEventQueue();
      +                        final EventQueue eventQueue = AccessController.doPrivileged(
      +                            new PrivilegedAction() {
      +                                public EventQueue run() {
      +                                    return Toolkit.getDefaultToolkit().getSystemEventQueue();
      +                                }
      +                        });
                               secondaryLoop = eventQueue.createSecondaryLoop(cond, modalFilter, 0);
                               if (!secondaryLoop.enter()) {
                                   secondaryLoop = null;
      diff --git a/jdk/test/java/awt/Dialog/ModalDialogPermission/ModalDialogPermission.java b/jdk/test/java/awt/Dialog/ModalDialogPermission/ModalDialogPermission.java
      new file mode 100644
      index 00000000000..5c6cfe2d40e
      --- /dev/null
      +++ b/jdk/test/java/awt/Dialog/ModalDialogPermission/ModalDialogPermission.java
      @@ -0,0 +1,60 @@
      +/*
      + * Copyright (c) 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.
      + */
      +
      +import java.awt.Dialog;
      +import java.awt.Frame;
      +import java.util.Timer;
      +import java.util.TimerTask;
      +
      +/*
      +  @test
      +  @bug 7080109
      +  @summary Dialog.show() lacks doPrivileged() to access system event queue.
      +  @author sergey.bylokhov@oracle.com: area=awt.dialog
      +  @run main/othervm/policy=java.policy -Djava.security.manager ModalDialogPermission
      +*/
      +public final class ModalDialogPermission {
      +
      +    public static void main(final String[] args) {
      +        Thread.setDefaultUncaughtExceptionHandler(new Thread.UncaughtExceptionHandler() {
      +            @Override
      +            public void uncaughtException(final Thread t, final Throwable e) {
      +                throw new RuntimeException(e);
      +            }
      +        });
      +        final Frame frame = new Frame();
      +        final Dialog dialog = new Dialog(frame, "ModalDialog", true);
      +        final Timer t = new Timer();
      +        t.schedule(new TimerTask() {
      +
      +            @Override
      +            public void run() {
      +                dialog.setVisible(false);
      +                dialog.dispose();
      +            }
      +        }, 3000L);
      +        dialog.show();
      +        frame.dispose();
      +        t.cancel();
      +    }
      +}
      diff --git a/jdk/test/java/awt/Dialog/ModalDialogPermission/java.policy b/jdk/test/java/awt/Dialog/ModalDialogPermission/java.policy
      new file mode 100644
      index 00000000000..d0a94d14263
      --- /dev/null
      +++ b/jdk/test/java/awt/Dialog/ModalDialogPermission/java.policy
      @@ -0,0 +1,3 @@
      +grant {
      +    permission java.lang.RuntimePermission "setDefaultUncaughtExceptionHandler";
      +};
      
      From 9feb7f3e15b66062df366c4c99059924e67ed902 Mon Sep 17 00:00:00 2001
      From: Jan Lahoda 
      Date: Thu, 10 May 2012 12:32:58 -0700
      Subject: [PATCH 033/128] 7159445: (javac) emits inaccurate diagnostics for
       enhanced for-loops
      
      Reviewed-by: jjg
      ---
       .../sun/tools/javac/parser/JavacParser.java   |  9 ++++--
       .../tools/javac/resources/compiler.properties |  4 +++
       .../examples/ForeachBadInitialization.java    | 31 +++++++++++++++++++
       .../tools/javac/parser/JavacParserTest.java   |  9 ++++--
       4 files changed, 48 insertions(+), 5 deletions(-)
       create mode 100644 langtools/test/tools/javac/diags/examples/ForeachBadInitialization.java
      
      diff --git a/langtools/src/share/classes/com/sun/tools/javac/parser/JavacParser.java b/langtools/src/share/classes/com/sun/tools/javac/parser/JavacParser.java
      index 9e74b71c61c..dfde7b19bd3 100644
      --- a/langtools/src/share/classes/com/sun/tools/javac/parser/JavacParser.java
      +++ b/langtools/src/share/classes/com/sun/tools/javac/parser/JavacParser.java
      @@ -2206,10 +2206,15 @@ public class JavacParser implements Parser {
               } else {
                   JCExpression t = term(EXPR | TYPE);
                   if ((lastmode & TYPE) != 0 &&
      -                (token.kind == IDENTIFIER || token.kind == ASSERT || token.kind == ENUM))
      +                (token.kind == IDENTIFIER || token.kind == ASSERT ||
      +                 token.kind == ENUM)) {
                       return variableDeclarators(modifiersOpt(), t, stats).toList();
      -            else
      +            } else if ((lastmode & TYPE) != 0 && token.kind == COLON) {
      +                error(pos, "bad.initializer", "for-loop");
      +                return List.of((JCStatement)F.at(pos).VarDef(null, null, t, null));
      +            } else {
                       return moreStatementExpressions(pos, t, stats).toList();
      +            }
               }
           }
       
      diff --git a/langtools/src/share/classes/com/sun/tools/javac/resources/compiler.properties b/langtools/src/share/classes/com/sun/tools/javac/resources/compiler.properties
      index 96e9e3f41ce..5ccfb341cf0 100644
      --- a/langtools/src/share/classes/com/sun/tools/javac/resources/compiler.properties
      +++ b/langtools/src/share/classes/com/sun/tools/javac/resources/compiler.properties
      @@ -137,6 +137,10 @@ compiler.err.array.req.but.found=\
       compiler.err.attribute.value.must.be.constant=\
           attribute value must be constant
       
      +# 0: statement type
      +compiler.err.bad.initializer=\
      +    bad initializer for {0}
      +
       compiler.err.break.outside.switch.loop=\
           break outside switch or loop
       
      diff --git a/langtools/test/tools/javac/diags/examples/ForeachBadInitialization.java b/langtools/test/tools/javac/diags/examples/ForeachBadInitialization.java
      new file mode 100644
      index 00000000000..5a90de10933
      --- /dev/null
      +++ b/langtools/test/tools/javac/diags/examples/ForeachBadInitialization.java
      @@ -0,0 +1,31 @@
      +/*
      + * Copyright (c) 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.
      + */
      +
      +// key: compiler.err.bad.initializer
      +import java.util.List;
      +class ForeachBadInitialization {
      +    void m() {
      +        List s = null;
      +        for (a : s) {}
      +    }
      +}
      diff --git a/langtools/test/tools/javac/parser/JavacParserTest.java b/langtools/test/tools/javac/parser/JavacParserTest.java
      index c297556fa78..e5a3e350350 100644
      --- a/langtools/test/tools/javac/parser/JavacParserTest.java
      +++ b/langtools/test/tools/javac/parser/JavacParserTest.java
      @@ -23,7 +23,7 @@
       
       /*
        * @test
      - * @bug 7073631
      + * @bug 7073631 7159445
        * @summary tests error and diagnostics positions
        * @author  Jan Lahoda
        */
      @@ -875,6 +875,7 @@ public class JavacParserTest extends TestCase {
               testMissingClassError();
               testSwitchError();
               testMethodError();
      +        testErrorRecoveryForEnhancedForLoop142381();
           }
       
           public static void main(String... args) throws IOException {
      @@ -892,8 +893,10 @@ abstract class TestCase {
               }
           }
       
      -    void assertFalse(String message, boolean empty) {
      -        throw new UnsupportedOperationException("Not yet implemented");
      +    void assertFalse(String message, boolean bvalue) {
      +        if (bvalue == true) {
      +            fail(message);
      +        }
           }
       
           void assertEquals(String message, int i, long l) {
      
      From abd7e74713e3c7ff84a18b434411a4ce3300596a Mon Sep 17 00:00:00 2001
      From: Deven You 
      Date: Fri, 11 May 2012 16:20:46 +0800
      Subject: [PATCH 034/128] 7163874: InetAddress.isReachable should support
       pinging 0.0.0.0
      
      Reviewed-by: alanb, chegar
      ---
       jdk/src/share/native/java/net/net_util.h      |  3 +
       .../native/java/net/Inet4AddressImpl.c        | 19 ++--
       .../native/java/net/Inet6AddressImpl.c        | 13 ++-
       jdk/src/solaris/native/java/net/net_util_md.c | 10 ++
       jdk/test/java/net/Inet4Address/PingThis.java  | 91 +++++++++++++++++++
       5 files changed, 126 insertions(+), 10 deletions(-)
       create mode 100644 jdk/test/java/net/Inet4Address/PingThis.java
      
      diff --git a/jdk/src/share/native/java/net/net_util.h b/jdk/src/share/native/java/net/net_util.h
      index d87ffdad280..923520bb2e1 100644
      --- a/jdk/src/share/native/java/net/net_util.h
      +++ b/jdk/src/share/native/java/net/net_util.h
      @@ -139,6 +139,9 @@ NET_IPv4MappedToIPv4(jbyte* caddr);
       int
       NET_IsEqual(jbyte* caddr1, jbyte* caddr2);
       
      +int
      +NET_IsZeroAddr(jbyte* caddr);
      +
       /* Socket operations
        *
        * These work just like the JVM_* procedures, except that they may do some
      diff --git a/jdk/src/solaris/native/java/net/Inet4AddressImpl.c b/jdk/src/solaris/native/java/net/Inet4AddressImpl.c
      index 28e8448bdd1..a6f7ddc1a00 100644
      --- a/jdk/src/solaris/native/java/net/Inet4AddressImpl.c
      +++ b/jdk/src/solaris/native/java/net/Inet4AddressImpl.c
      @@ -671,12 +671,19 @@ ping4(JNIEnv *env, jint fd, struct sockaddr_in* him, jint timeout,
                  * We did receive something, but is it what we were expecting?
                  * I.E.: A ICMP_ECHOREPLY packet with the proper PID.
                  */
      -          if (icmplen >= 8 && icmp->icmp_type == ICMP_ECHOREPLY &&
      -               (ntohs(icmp->icmp_id) == pid) &&
      -               (him->sin_addr.s_addr == sa_recv.sin_addr.s_addr)) {
      -            close(fd);
      -            return JNI_TRUE;
      -          }
      +          if (icmplen >= 8 && icmp->icmp_type == ICMP_ECHOREPLY
      +               && (ntohs(icmp->icmp_id) == pid)) {
      +            if ((him->sin_addr.s_addr == sa_recv.sin_addr.s_addr)) {
      +              close(fd);
      +              return JNI_TRUE;
      +            }
      +
      +            if (him->sin_addr.s_addr == 0) {
      +              close(fd);
      +              return JNI_TRUE;
      +            }
      +         }
      +
               }
             } while (tmout2 > 0);
             timeout -= 1000;
      diff --git a/jdk/src/solaris/native/java/net/Inet6AddressImpl.c b/jdk/src/solaris/native/java/net/Inet6AddressImpl.c
      index 608f3c595d2..63addd9fb70 100644
      --- a/jdk/src/solaris/native/java/net/Inet6AddressImpl.c
      +++ b/jdk/src/solaris/native/java/net/Inet6AddressImpl.c
      @@ -532,10 +532,15 @@ ping6(JNIEnv *env, jint fd, struct sockaddr_in6* him, jint timeout,
                  *       from the host that we are trying to determine is reachable.
                  */
                 if (n >= 8 && icmp6->icmp6_type == ICMP6_ECHO_REPLY &&
      -              (ntohs(icmp6->icmp6_id) == pid) &&
      -              NET_IsEqual(caddr, recv_caddr)) {
      -            close(fd);
      -            return JNI_TRUE;
      +              (ntohs(icmp6->icmp6_id) == pid)) {
      +            if (NET_IsEqual(caddr, recv_caddr)) {
      +              close(fd);
      +              return JNI_TRUE;
      +            }
      +            if (NET_IsZeroAddr(caddr)) {
      +              close(fd);
      +              return JNI_TRUE;
      +            }
                 }
               }
             } while (tmout2 > 0);
      diff --git a/jdk/src/solaris/native/java/net/net_util_md.c b/jdk/src/solaris/native/java/net/net_util_md.c
      index ccbe4b15a72..35330916214 100644
      --- a/jdk/src/solaris/native/java/net/net_util_md.c
      +++ b/jdk/src/solaris/native/java/net/net_util_md.c
      @@ -961,6 +961,16 @@ NET_IsEqual(jbyte* caddr1, jbyte* caddr2) {
           return 1;
       }
       
      +int NET_IsZeroAddr(jbyte* caddr) {
      +    int i;
      +    for (i = 0; i < 16; i++) {
      +        if (caddr[i] != 0) {
      +            return 0;
      +        }
      +    }
      +    return 1;
      +}
      +
       /*
        * Map the Java level socket option to the platform specific
        * level and option name.
      diff --git a/jdk/test/java/net/Inet4Address/PingThis.java b/jdk/test/java/net/Inet4Address/PingThis.java
      new file mode 100644
      index 00000000000..515a873fc6e
      --- /dev/null
      +++ b/jdk/test/java/net/Inet4Address/PingThis.java
      @@ -0,0 +1,91 @@
      +/*
      + * Copyright (c) 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.
      + */
      +
      +/*
      + * Portions Copyright (c) 2012 IBM Corporation
      + */
      +
      +/* @test
      + * @bug 7163874
      + * @summary InetAddress.isReachable is returning false
      + *          for InetAdress 0.0.0.0 and ::0
      + * @run main PingThis
      + * @run main/othervm -Djava.net.preferIPv4Stack=true PingThis
      + */
      +
      +import java.net.Inet6Address;
      +import java.net.InetAddress;
      +import java.net.NetworkInterface;
      +import java.util.ArrayList;
      +import java.util.Collections;
      +import java.util.Iterator;
      +import java.util.List;
      +
      +public class PingThis {
      +    private static boolean hasIPv6() throws Exception {
      +        List nics = Collections.list(NetworkInterface
      +                .getNetworkInterfaces());
      +        for (NetworkInterface nic : nics) {
      +            List addrs = Collections.list(nic.getInetAddresses());
      +            for (InetAddress addr : addrs) {
      +                if (addr instanceof Inet6Address)
      +                    return true;
      +            }
      +        }
      +
      +        return false;
      +    }
      +
      +    public static void main(String args[]) throws Exception {
      +        if (System.getProperty("os.name").startsWith("Windows")) {
      +            return;
      +        }
      +
      +        boolean preferIPv4Stack = "true".equals(System
      +                .getProperty("java.net.preferIPv4Stack"));
      +        List addrs = new ArrayList();
      +        InetAddress inetAddress = null;
      +
      +        addrs.add("0.0.0.0");
      +        if (!preferIPv4Stack) {
      +            if (hasIPv6()) {
      +                addrs.add("::0");
      +            }
      +        }
      +
      +        for (String addr : addrs) {
      +            inetAddress = InetAddress.getByName(addr);
      +            System.out.println("The target ip is "
      +                    + inetAddress.getHostAddress());
      +            boolean isReachable = inetAddress.isReachable(3000);
      +            System.out.println("the target is reachable: " + isReachable);
      +            if (isReachable) {
      +                System.out.println("Test passed ");
      +            } else {
      +                System.out.println("Test failed ");
      +                throw new Exception("address " + inetAddress.getHostAddress()
      +                        + " can not be reachable!");
      +            }
      +        }
      +    }
      +}
      
      From 6e335b37209f397d24a4faaf5732cec757a9070b Mon Sep 17 00:00:00 2001
      From: Sean Coffey 
      Date: Fri, 11 May 2012 10:09:18 +0100
      Subject: [PATCH 035/128] 7167359: (tz) SEGV on solaris if TZ variable not set
      
      Reviewed-by: okutsu
      ---
       jdk/src/solaris/native/java/util/TimeZone_md.c | 2 +-
       1 file changed, 1 insertion(+), 1 deletion(-)
      
      diff --git a/jdk/src/solaris/native/java/util/TimeZone_md.c b/jdk/src/solaris/native/java/util/TimeZone_md.c
      index 3af5d72657f..ce2fa5aca8c 100644
      --- a/jdk/src/solaris/native/java/util/TimeZone_md.c
      +++ b/jdk/src/solaris/native/java/util/TimeZone_md.c
      @@ -651,7 +651,7 @@ findJavaTZ_md(const char *java_home_dir, const char *country)
           }
       
       #ifdef __solaris__
      -    if (strcmp(tz, "localtime") == 0) {
      +    if (tz != NULL && strcmp(tz, "localtime") == 0) {
               tz = getSolarisDefaultZoneID();
               freetz = tz;
           }
      
      From 50d1683efd10a5bcc0f80296d7562a42d9cda2f0 Mon Sep 17 00:00:00 2001
      From: Anthony Petrov 
      Date: Fri, 11 May 2012 16:11:17 +0400
      Subject: [PATCH 036/128] 7166437: [macosx] Support for Window.Type.UTILITY on
       the Mac
      
      Apply the native UTILITY style for UTILITY Java windows
      
      Reviewed-by: art
      ---
       jdk/src/macosx/classes/sun/lwawt/macosx/CPlatformWindow.java | 4 ++++
       1 file changed, 4 insertions(+)
      
      diff --git a/jdk/src/macosx/classes/sun/lwawt/macosx/CPlatformWindow.java b/jdk/src/macosx/classes/sun/lwawt/macosx/CPlatformWindow.java
      index bfaab65d196..efad23e636e 100644
      --- a/jdk/src/macosx/classes/sun/lwawt/macosx/CPlatformWindow.java
      +++ b/jdk/src/macosx/classes/sun/lwawt/macosx/CPlatformWindow.java
      @@ -312,6 +312,10 @@ public class CPlatformWindow extends CFRetainedResource implements PlatformWindo
                   styleBits = SET(styleBits, NONACTIVATING, true);
               }
       
      +        if (Window.Type.UTILITY.equals(target.getType())) {
      +            styleBits = SET(styleBits, UTILITY, true);
      +        }
      +
               if (target instanceof javax.swing.RootPaneContainer) {
                   javax.swing.JRootPane rootpane = ((javax.swing.RootPaneContainer)target).getRootPane();
                   Object prop = null;
      
      From 817ad87a289c96534f65df9aa548d86de402754b Mon Sep 17 00:00:00 2001
      From: Athijegannathan Sundararajan 
      Date: Fri, 11 May 2012 20:06:00 +0530
      Subject: [PATCH 037/128] 7166990: java/compiler Inherited interfaces using
       generics sometimes looses the generic type
      
      Reviewed-by: mcimadamore
      ---
       .../com/sun/tools/javac/comp/Lower.java       |  5 +++
       .../javac/TryWithResources/T7164542.java      | 44 +++++++++++++++++++
       2 files changed, 49 insertions(+)
       create mode 100644 langtools/test/tools/javac/TryWithResources/T7164542.java
      
      diff --git a/langtools/src/share/classes/com/sun/tools/javac/comp/Lower.java b/langtools/src/share/classes/com/sun/tools/javac/comp/Lower.java
      index 5acdc2640bc..07e0c7184cb 100644
      --- a/langtools/src/share/classes/com/sun/tools/javac/comp/Lower.java
      +++ b/langtools/src/share/classes/com/sun/tools/javac/comp/Lower.java
      @@ -1606,6 +1606,11 @@ public class Lower extends TreeTranslator {
           }
       
           private JCStatement makeResourceCloseInvocation(JCExpression resource) {
      +        // convert to AutoCloseable if needed
      +        if (types.asSuper(resource.type, syms.autoCloseableType.tsym) == null) {
      +            resource = (JCExpression) convert(resource, syms.autoCloseableType);
      +        }
      +
               // create resource.close() method invocation
               JCExpression resourceClose = makeCall(resource,
                                                     names.close,
      diff --git a/langtools/test/tools/javac/TryWithResources/T7164542.java b/langtools/test/tools/javac/TryWithResources/T7164542.java
      new file mode 100644
      index 00000000000..9e3f2c16731
      --- /dev/null
      +++ b/langtools/test/tools/javac/TryWithResources/T7164542.java
      @@ -0,0 +1,44 @@
      +/*
      + * Copyright (c) 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.
      + */
      +
      +/*
      + * @test
      + * @bug 7164542
      + * @summary try-with-resources: problem with intersection types
      + * @compile T7164542.java
      + */
      +
      +public class T7164542 {
      +    public static 
      +    void copy(S s, T t, int size) throws Exception {
      +        /*
      +         * compiler used to fail here with:
      +         *     symbol:   method close()
      +         *     location: interface Readable
      +         *     Fatal Error: Unable to find method close
      +         */
      +        try (S src = s; T trg = t) {
      +        }
      +    }
      +}
      
      From 9d4ac4c18868a705329ceca03a00c930a7053d95 Mon Sep 17 00:00:00 2001
      From: Anthony Petrov 
      Date: Fri, 11 May 2012 20:37:07 +0400
      Subject: [PATCH 038/128] 7149062: [macosx] dock menu don't show available
       frames
      
      Inherit from either NSWindow for normal windows or NSPanel for utility windows
      
      Reviewed-by: skovatch, swingler
      ---
       jdk/src/macosx/native/sun/awt/AWTView.m   |   4 +-
       jdk/src/macosx/native/sun/awt/AWTWindow.h |  27 ++-
       jdk/src/macosx/native/sun/awt/AWTWindow.m | 240 ++++++++++++++--------
       3 files changed, 186 insertions(+), 85 deletions(-)
      
      diff --git a/jdk/src/macosx/native/sun/awt/AWTView.m b/jdk/src/macosx/native/sun/awt/AWTView.m
      index 4f3bae7933a..f737c4e8b87 100644
      --- a/jdk/src/macosx/native/sun/awt/AWTView.m
      +++ b/jdk/src/macosx/native/sun/awt/AWTView.m
      @@ -304,8 +304,8 @@ AWT_ASSERT_APPKIT_THREAD;
       -(void) deliverJavaMouseEvent: (NSEvent *) event {
           BOOL isEnabled = YES;
           NSWindow* window = [self window];
      -    if ([window isKindOfClass: [AWTWindow class]]) {
      -        isEnabled = [(AWTWindow*)window isEnabled];
      +    if ([window isKindOfClass: [AWTWindow_Panel class]] || [window isKindOfClass: [AWTWindow_Normal class]]) {
      +        isEnabled = [(AWTWindow*)[window delegate] isEnabled];
           }
       
           if (!isEnabled) {
      diff --git a/jdk/src/macosx/native/sun/awt/AWTWindow.h b/jdk/src/macosx/native/sun/awt/AWTWindow.h
      index 39863eef09e..b350913196d 100644
      --- a/jdk/src/macosx/native/sun/awt/AWTWindow.h
      +++ b/jdk/src/macosx/native/sun/awt/AWTWindow.h
      @@ -35,7 +35,7 @@
       
       @class AWTView;
       
      -@interface AWTWindow : NSPanel  {
      +@interface AWTWindow : NSObject  {
       @private
           JNFWeakJObjectWrapper *javaPlatformWindow;
           CMenuBar *javaMenuBar;
      @@ -45,6 +45,9 @@
           BOOL isEnabled;
       }
       
      +// An instance of either AWTWindow_Normal or AWTWindow_Panel
      +@property (nonatomic, retain) NSWindow *nsWindow;
      +
       @property (nonatomic, retain) JNFWeakJObjectWrapper *javaPlatformWindow;
       @property (nonatomic, retain) CMenuBar *javaMenuBar;
       @property (nonatomic) NSSize javaMinSize;
      @@ -57,8 +60,28 @@
                           frameRect:(NSRect)frameRect
                         contentView:(NSView *)contentView;
       
      -- (void) adjustGrowBoxWindow;
       - (BOOL) isTopmostWindowUnderMouse;
      +
      +// NSWindow overrides delegate methods
      +- (BOOL) canBecomeKeyWindow;
      +- (BOOL) canBecomeMainWindow;
      +- (BOOL) worksWhenModal;
      +- (void)sendEvent:(NSEvent *)event;
      +
      +@end
      +
      +@interface AWTWindow_Normal : NSWindow
      +- (id) initWithDelegate:(AWTWindow *)delegate
      +              frameRect:(NSRect)rect
      +              styleMask:(NSUInteger)styleMask
      +            contentView:(NSView *)view;
      +@end
      +
      +@interface AWTWindow_Panel : NSPanel
      +- (id) initWithDelegate:(AWTWindow *)delegate
      +              frameRect:(NSRect)rect
      +              styleMask:(NSUInteger)styleMask
      +            contentView:(NSView *)view;
       @end
       
       #endif _AWTWINDOW_H
      diff --git a/jdk/src/macosx/native/sun/awt/AWTWindow.m b/jdk/src/macosx/native/sun/awt/AWTWindow.m
      index 3fcf9f0cd65..5f570a752cc 100644
      --- a/jdk/src/macosx/native/sun/awt/AWTWindow.m
      +++ b/jdk/src/macosx/native/sun/awt/AWTWindow.m
      @@ -51,8 +51,61 @@
       
       static JNF_CLASS_CACHE(jc_CPlatformWindow, "sun/lwawt/macosx/CPlatformWindow");
       
      +// --------------------------------------------------------------
      +// NSWindow/NSPanel descendants implementation
      +#define AWT_NS_WINDOW_IMPLEMENTATION                            \
      +- (id) initWithDelegate:(AWTWindow *)delegate                   \
      +              frameRect:(NSRect)contectRect                     \
      +              styleMask:(NSUInteger)styleMask                   \
      +            contentView:(NSView *)view                          \
      +{                                                               \
      +    self = [super initWithContentRect:contectRect               \
      +                            styleMask:styleMask                 \
      +                              backing:NSBackingStoreBuffered    \
      +                                defer:NO];                      \
      +                                                                \
      +    if (self == nil) return nil;                                \
      +                                                                \
      +    [self setDelegate:delegate];                                \
      +    [self setContentView:view];                                 \
      +    [self setInitialFirstResponder:view];                       \
      +    [self setReleasedWhenClosed:NO];                            \
      +    [self setPreservesContentDuringLiveResize:YES];             \
      +                                                                \
      +    return self;                                                \
      +}                                                               \
      +                                                                \
      +/* NSWindow overrides */                                        \
      +- (BOOL) canBecomeKeyWindow {                                   \
      +    return [(AWTWindow*)[self delegate] canBecomeKeyWindow];    \
      +}                                                               \
      +                                                                \
      +- (BOOL) canBecomeMainWindow {                                  \
      +    return [(AWTWindow*)[self delegate] canBecomeMainWindow];   \
      +}                                                               \
      +                                                                \
      +- (BOOL) worksWhenModal {                                       \
      +    return [(AWTWindow*)[self delegate] worksWhenModal];        \
      +}                                                               \
      +                                                                \
      +- (void)sendEvent:(NSEvent *)event {                            \
      +    [(AWTWindow*)[self delegate] sendEvent:event];              \
      +    [super sendEvent:event];                                    \
      +}
      +
      +@implementation AWTWindow_Normal
      +AWT_NS_WINDOW_IMPLEMENTATION
      +@end
      +@implementation AWTWindow_Panel
      +AWT_NS_WINDOW_IMPLEMENTATION
      +@end
      +// END of NSWindow/NSPanel descendants implementation
      +// --------------------------------------------------------------
      +
      +
       @implementation AWTWindow
       
      +@synthesize nsWindow;
       @synthesize javaPlatformWindow;
       @synthesize javaMenuBar;
       @synthesize javaMinSize;
      @@ -62,12 +115,12 @@ static JNF_CLASS_CACHE(jc_CPlatformWindow, "sun/lwawt/macosx/CPlatformWindow");
       
       - (void) updateMinMaxSize:(BOOL)resizable {
           if (resizable) {
      -        [self setMinSize:self.javaMinSize];
      -        [self setMaxSize:self.javaMaxSize];
      +        [self.nsWindow setMinSize:self.javaMinSize];
      +        [self.nsWindow setMaxSize:self.javaMaxSize];
           } else {
      -        NSRect currentFrame = [self frame];
      -        [self setMinSize:currentFrame.size];
      -        [self setMaxSize:currentFrame.size];
      +        NSRect currentFrame = [self.nsWindow frame];
      +        [self.nsWindow setMinSize:currentFrame.size];
      +        [self.nsWindow setMaxSize:currentFrame.size];
           }
       }
       
      @@ -98,38 +151,38 @@ static JNF_CLASS_CACHE(jc_CPlatformWindow, "sun/lwawt/macosx/CPlatformWindow");
           if (IS(mask, RESIZABLE)) {
               BOOL resizable = IS(bits, RESIZABLE);
               [self updateMinMaxSize:resizable];
      -        [self setShowsResizeIndicator:resizable];
      +        [self.nsWindow setShowsResizeIndicator:resizable];
           }
       
           if (IS(mask, HAS_SHADOW)) {
      -        [self setHasShadow:IS(bits, HAS_SHADOW)];
      +        [self.nsWindow setHasShadow:IS(bits, HAS_SHADOW)];
           }
       
           if (IS(mask, ZOOMABLE)) {
      -        [[self standardWindowButton:NSWindowZoomButton] setEnabled:IS(bits, ZOOMABLE)];
      +        [[self.nsWindow standardWindowButton:NSWindowZoomButton] setEnabled:IS(bits, ZOOMABLE)];
           }
       
           if (IS(mask, ALWAYS_ON_TOP)) {
      -        [self setLevel:IS(bits, ALWAYS_ON_TOP) ? NSFloatingWindowLevel : NSNormalWindowLevel];
      +        [self.nsWindow setLevel:IS(bits, ALWAYS_ON_TOP) ? NSFloatingWindowLevel : NSNormalWindowLevel];
           }
       
           if (IS(mask, HIDES_ON_DEACTIVATE)) {
      -        [self setHidesOnDeactivate:IS(bits, HIDES_ON_DEACTIVATE)];
      +        [self.nsWindow setHidesOnDeactivate:IS(bits, HIDES_ON_DEACTIVATE)];
           }
       
           if (IS(mask, DRAGGABLE_BACKGROUND)) {
      -        [self setMovableByWindowBackground:IS(bits, DRAGGABLE_BACKGROUND)];
      +        [self.nsWindow setMovableByWindowBackground:IS(bits, DRAGGABLE_BACKGROUND)];
           }
       
           if (IS(mask, DOCUMENT_MODIFIED)) {
      -        [self setDocumentEdited:IS(bits, DOCUMENT_MODIFIED)];
      +        [self.nsWindow setDocumentEdited:IS(bits, DOCUMENT_MODIFIED)];
           }
       
      -    if ([self respondsToSelector:@selector(toggleFullScreen:)]) {
      +    if ([self.nsWindow respondsToSelector:@selector(toggleFullScreen:)]) {
               if (IS(mask, FULLSCREENABLE)) {
      -            [self setCollectionBehavior:(1 << 7) /*NSWindowCollectionBehaviorFullScreenPrimary*/];
      +            [self.nsWindow setCollectionBehavior:(1 << 7) /*NSWindowCollectionBehaviorFullScreenPrimary*/];
               } else {
      -            [self setCollectionBehavior:NSWindowCollectionBehaviorDefault];
      +            [self.nsWindow setCollectionBehavior:NSWindowCollectionBehaviorDefault];
               }
           }
       
      @@ -151,31 +204,43 @@ AWT_ASSERT_APPKIT_THREAD;
               contentRect.size.height = 1.0;
           }
       
      -    self = [super initWithContentRect:contentRect
      -                            styleMask:styleMask
      -                              backing:NSBackingStoreBuffered
      -                                defer:NO];
      +    self = [super init];
       
           if (self == nil) return nil; // no hope
       
      +    if (IS(bits, UTILITY) ||
      +        IS(bits, NONACTIVATING) ||
      +        IS(bits, HUD) ||
      +        IS(bits, HIDES_ON_DEACTIVATE))
      +    {
      +        self.nsWindow = [[AWTWindow_Panel alloc] initWithDelegate:self
      +                            frameRect:contentRect
      +                            styleMask:styleMask
      +                          contentView:view];
      +    }
      +    else
      +    {
      +        // These windows will appear in the window list in the dock icon menu
      +        self.nsWindow = [[AWTWindow_Normal alloc] initWithDelegate:self
      +                            frameRect:contentRect
      +                            styleMask:styleMask
      +                          contentView:view];
      +    }
      +
      +    if (self.nsWindow == nil) return nil; // no hope either
      +
           self.isEnabled = YES;
           self.javaPlatformWindow = platformWindow;
           self.styleBits = bits;
           [self setPropertiesForStyleBits:styleBits mask:MASK(_METHOD_PROP_BITMASK)];
       
      -    [self setDelegate:self];
      -    [self setContentView:view];
      -    [self setInitialFirstResponder:view];
      -    [self setReleasedWhenClosed:NO];
      -    [self setPreservesContentDuringLiveResize:YES];
      -
           return self;
       }
       
       // checks that this window is under the mouse cursor and this point is not overlapped by others windows
       - (BOOL) isTopmostWindowUnderMouse {
       
      -    int currentWinID = [self windowNumber];
      +    int currentWinID = [self.nsWindow windowNumber];
       
           NSRect screenRect = [[NSScreen mainScreen] frame];
           NSPoint nsMouseLocation = [NSEvent mouseLocation];
      @@ -204,7 +269,7 @@ AWT_ASSERT_APPKIT_THREAD;
       
           int eventType = 0;
           BOOL isUnderMouse = [self isTopmostWindowUnderMouse];
      -    BOOL mouseIsOver = [[self contentView] mouseIsOver];
      +    BOOL mouseIsOver = [[self.nsWindow contentView] mouseIsOver];
       
           if (isUnderMouse && !mouseIsOver) {
               eventType = NSMouseEntered;
      @@ -215,21 +280,21 @@ AWT_ASSERT_APPKIT_THREAD;
           }
       
           NSPoint screenLocation = [NSEvent mouseLocation];
      -    NSPoint windowLocation = [self convertScreenToBase: screenLocation];
      +    NSPoint windowLocation = [self.nsWindow convertScreenToBase: screenLocation];
           int modifierFlags = (eventType == NSMouseEntered) ? NSMouseEnteredMask : NSMouseExitedMask;
       
           NSEvent *mouseEvent = [NSEvent enterExitEventWithType: eventType
                                                         location: windowLocation
                                                    modifierFlags: modifierFlags
                                                        timestamp: 0
      -                                              windowNumber: [self windowNumber]
      +                                              windowNumber: [self.nsWindow windowNumber]
                                                          context: nil
                                                      eventNumber: 0
                                                   trackingNumber: 0
                                                         userData: nil
                                   ];
       
      -    [[self contentView] deliverJavaMouseEvent: mouseEvent];
      +    [[self.nsWindow contentView] deliverJavaMouseEvent: mouseEvent];
       }
       
       - (void) dealloc {
      @@ -238,6 +303,8 @@ AWT_ASSERT_APPKIT_THREAD;
           JNIEnv *env = [ThreadUtilities getJNIEnv];
           [self.javaPlatformWindow setJObject:nil withEnv:env];
       
      +    self.nsWindow = nil;
      +
           [super dealloc];
       }
       
      @@ -271,7 +338,7 @@ AWT_ASSERT_APPKIT_THREAD;
               if (awtWindow != NULL) {
                   // translate the point into Java coordinates
                   NSPoint loc = [event locationInWindow];
      -            loc.y = [self frame].size.height - loc.y;
      +            loc.y = [self.nsWindow frame].size.height - loc.y;
       
                   // send up to the GestureHandler to recursively dispatch on the AWT event thread
                   static JNF_CLASS_CACHE(jc_GestureHandler, "com/apple/eawt/event/GestureHandler");
      @@ -334,7 +401,7 @@ AWT_ASSERT_APPKIT_THREAD;
               // TODO: create generic AWT assert
           }
       
      -    NSRect frame = ConvertNSScreenRect(env, [self frame]);
      +    NSRect frame = ConvertNSScreenRect(env, [self.nsWindow frame]);
       
           static JNF_MEMBER_CACHE(jm_deliverMoveResizeEvent, jc_CPlatformWindow, "deliverMoveResizeEvent", "(IIII)V");
           JNFCallVoidMethod(env, platformWindow, jm_deliverMoveResizeEvent,
      @@ -524,8 +591,8 @@ AWT_ASSERT_APPKIT_THREAD;
               if ([event type] == NSLeftMouseDown || [event type] == NSRightMouseDown || [event type] == NSOtherMouseDown) {
       
                   NSPoint p = [NSEvent mouseLocation];
      -            NSRect frame = [self frame];
      -            NSRect contentRect = [self contentRectForFrameRect:frame];
      +            NSRect frame = [self.nsWindow frame];
      +            NSRect contentRect = [self.nsWindow contentRectForFrameRect:frame];
       
                   // Check if the click happened in the non-client area (title bar)
                   if (p.y >= (frame.origin.y + contentRect.size.height)) {
      @@ -536,15 +603,14 @@ AWT_ASSERT_APPKIT_THREAD;
                       JNFCallVoidMethod(env, platformWindow, jm_deliverNCMouseDown);
                   }
               }
      -        [super sendEvent:event];
       }
       
       - (void)constrainSize:(NSSize*)size {
           float minWidth = 0.f, minHeight = 0.f;
       
           if (IS(self.styleBits, DECORATED)) {
      -        NSRect frame = [self frame];
      -        NSRect contentRect = [NSWindow contentRectForFrameRect:frame styleMask:[self styleMask]];
      +        NSRect frame = [self.nsWindow frame];
      +        NSRect contentRect = [NSWindow contentRectForFrameRect:frame styleMask:[self.nsWindow styleMask]];
       
               float top = frame.size.height - contentRect.size.height;
               float left = contentRect.origin.x - frame.origin.x;
      @@ -567,20 +633,20 @@ AWT_ASSERT_APPKIT_THREAD;
           self.isEnabled = flag;
       
           if (IS(self.styleBits, CLOSEABLE)) {
      -        [[self standardWindowButton:NSWindowCloseButton] setEnabled: flag];
      +        [[self.nsWindow standardWindowButton:NSWindowCloseButton] setEnabled: flag];
           }
       
           if (IS(self.styleBits, MINIMIZABLE)) {
      -        [[self standardWindowButton:NSWindowMiniaturizeButton] setEnabled: flag];
      +        [[self.nsWindow standardWindowButton:NSWindowMiniaturizeButton] setEnabled: flag];
           }
       
           if (IS(self.styleBits, ZOOMABLE)) {
      -        [[self standardWindowButton:NSWindowZoomButton] setEnabled: flag];
      +        [[self.nsWindow standardWindowButton:NSWindowZoomButton] setEnabled: flag];
           }
       
           if (IS(self.styleBits, RESIZABLE)) {
               [self updateMinMaxSize:flag];
      -        [self setShowsResizeIndicator:flag];
      +        [self.nsWindow setShowsResizeIndicator:flag];
           }
       }
       
      @@ -618,7 +684,7 @@ AWT_ASSERT_NOT_APPKIT_THREAD;
       
       JNF_COCOA_EXIT(env);
       
      -    return ptr_to_jlong(window);
      +    return ptr_to_jlong(window ? window.nsWindow : nil);
       }
       
       /*
      @@ -632,17 +698,19 @@ JNIEXPORT void JNICALL Java_sun_lwawt_macosx_CPlatformWindow_nativeSetNSWindowSt
       JNF_COCOA_ENTER(env);
       AWT_ASSERT_NOT_APPKIT_THREAD;
       
      -    AWTWindow *window = OBJC(windowPtr);
      +    NSWindow *nsWindow = OBJC(windowPtr);
           [JNFRunLoop performOnMainThreadWaiting:NO withBlock:^(){
               AWT_ASSERT_APPKIT_THREAD;
       
      +        AWTWindow *window = (AWTWindow*)[nsWindow delegate];
      +
               // scans the bit field, and only updates the values requested by the mask
               // (this implicity handles the _CALLBACK_PROP_BITMASK case, since those are passive reads)
               jint newBits = window.styleBits & ~mask | bits & mask;
       
               // resets the NSWindow's style mask if the mask intersects any of those bits
               if (mask & MASK(_STYLE_PROP_BITMASK)) {
      -            [window setStyleMask:[AWTWindow styleMaskForStyleBits:newBits]];
      +            [nsWindow setStyleMask:[AWTWindow styleMaskForStyleBits:newBits]];
               }
       
               // calls methods on NSWindow to change other properties, based on the mask
      @@ -667,12 +735,14 @@ JNIEXPORT void JNICALL Java_sun_lwawt_macosx_CPlatformWindow_nativeSetNSWindowMe
       JNF_COCOA_ENTER(env);
       AWT_ASSERT_NOT_APPKIT_THREAD;
       
      -    AWTWindow *window = OBJC(windowPtr);
      +    NSWindow *nsWindow = OBJC(windowPtr);
           CMenuBar *menuBar = OBJC(menuBarPtr);
           [JNFRunLoop performOnMainThreadWaiting:NO withBlock:^(){
               AWT_ASSERT_APPKIT_THREAD;
       
      -        if ([window isKeyWindow]) [window.javaMenuBar deactivate];
      +        AWTWindow *window = (AWTWindow*)[nsWindow delegate];
      +
      +        if ([nsWindow isKeyWindow]) [window.javaMenuBar deactivate];
               window.javaMenuBar = menuBar;
       
               // if ([self isKeyWindow]) {
      @@ -696,15 +766,15 @@ JNIEXPORT jobject JNICALL Java_sun_lwawt_macosx_CPlatformWindow_nativeGetNSWindo
       JNF_COCOA_ENTER(env);
       AWT_ASSERT_NOT_APPKIT_THREAD;
       
      -    AWTWindow *window = OBJC(windowPtr);
      +    NSWindow *nsWindow = OBJC(windowPtr);
           __block NSRect contentRect = NSZeroRect;
           __block NSRect frame = NSZeroRect;
       
           [JNFRunLoop performOnMainThreadWaiting:YES withBlock:^(){
               AWT_ASSERT_APPKIT_THREAD;
       
      -        frame = [window frame];
      -        contentRect = [NSWindow contentRectForFrameRect:frame styleMask:[window styleMask]];
      +        frame = [nsWindow frame];
      +        contentRect = [NSWindow contentRectForFrameRect:frame styleMask:[nsWindow styleMask]];
           }];
       
           jint top = (jint)(frame.size.height - contentRect.size.height);
      @@ -734,19 +804,21 @@ AWT_ASSERT_NOT_APPKIT_THREAD;
           NSRect jrect = NSMakeRect(originX, originY, width, height);
       
           // TODO: not sure we need displayIfNeeded message in our view
      -    AWTWindow *window = OBJC(windowPtr);
      +    NSWindow *nsWindow = OBJC(windowPtr);
           [JNFRunLoop performOnMainThreadWaiting:NO withBlock:^(){
               AWT_ASSERT_APPKIT_THREAD;
       
      +        AWTWindow *window = (AWTWindow*)[nsWindow delegate];
      +
               NSRect rect = ConvertNSScreenRect(NULL, jrect);
               [window constrainSize:&rect.size];
       
      -        [window setFrame:rect display:YES];
      +        [nsWindow setFrame:rect display:YES];
       
               // only start tracking events if pointer is above the toplevel
               // TODO: should post an Entered event if YES.
               NSPoint mLocation = [NSEvent mouseLocation];
      -        [window setAcceptsMouseMovedEvents:NSPointInRect(mLocation, rect)];
      +        [nsWindow setAcceptsMouseMovedEvents:NSPointInRect(mLocation, rect)];
       
               // ensure we repaint the whole window after the resize operation
               // (this will also re-enable screen updates, which were disabled above)
      @@ -774,10 +846,12 @@ AWT_ASSERT_NOT_APPKIT_THREAD;
           if (maxW < 1) maxW = 1;
           if (maxH < 1) maxH = 1;
       
      -    AWTWindow *window = OBJC(windowPtr);
      +    NSWindow *nsWindow = OBJC(windowPtr);
           [JNFRunLoop performOnMainThreadWaiting:NO withBlock:^(){
               AWT_ASSERT_APPKIT_THREAD;
       
      +        AWTWindow *window = (AWTWindow*)[nsWindow delegate];
      +
               NSSize min = { minW, minH };
               NSSize max = { maxW, maxH };
       
      @@ -803,11 +877,11 @@ JNIEXPORT void JNICALL Java_sun_lwawt_macosx_CPlatformWindow_nativePushNSWindowT
       JNF_COCOA_ENTER(env);
       AWT_ASSERT_NOT_APPKIT_THREAD;
       
      -    AWTWindow *window = OBJC(windowPtr);
      +    NSWindow *nsWindow = OBJC(windowPtr);
           [JNFRunLoop performOnMainThreadWaiting:NO withBlock:^(){
               AWT_ASSERT_APPKIT_THREAD;
       
      -        [window orderBack:nil];
      +        [nsWindow orderBack:nil];
           }];
       
       JNF_COCOA_EXIT(env);
      @@ -824,14 +898,14 @@ JNIEXPORT void JNICALL Java_sun_lwawt_macosx_CPlatformWindow_nativePushNSWindowT
       JNF_COCOA_ENTER(env);
       AWT_ASSERT_NOT_APPKIT_THREAD;
       
      -    AWTWindow *window = OBJC(windowPtr);
      +    NSWindow *nsWindow = OBJC(windowPtr);
           [JNFRunLoop performOnMainThreadWaiting:NO withBlock:^(){
               AWT_ASSERT_APPKIT_THREAD;
       
      -        if (![window isKeyWindow]) {
      -            [window makeKeyAndOrderFront:window];
      +        if (![nsWindow isKeyWindow]) {
      +            [nsWindow makeKeyAndOrderFront:nsWindow];
               } else {
      -            [window orderFront:window];
      +            [nsWindow orderFront:nsWindow];
               }
           }];
       
      @@ -849,8 +923,8 @@ JNIEXPORT void JNICALL Java_sun_lwawt_macosx_CPlatformWindow_nativeSetNSWindowTi
       JNF_COCOA_ENTER(env);
       AWT_ASSERT_NOT_APPKIT_THREAD;
       
      -    AWTWindow *window = OBJC(windowPtr);
      -    [window performSelectorOnMainThread:@selector(setTitle:)
      +    NSWindow *nsWindow = OBJC(windowPtr);
      +    [nsWindow performSelectorOnMainThread:@selector(setTitle:)
                                     withObject:JNFJavaToNSString(env, jtitle)
                                  waitUntilDone:NO];
       
      @@ -868,11 +942,11 @@ JNIEXPORT void JNICALL Java_sun_lwawt_macosx_CPlatformWindow_nativeSetNSWindowAl
       JNF_COCOA_ENTER(env);
       AWT_ASSERT_NOT_APPKIT_THREAD;
       
      -    AWTWindow *window = OBJC(windowPtr);
      +    NSWindow *nsWindow = OBJC(windowPtr);
           [JNFRunLoop performOnMainThreadWaiting:NO withBlock:^(){
               AWT_ASSERT_APPKIT_THREAD;
       
      -        [window setAlphaValue:alpha];
      +        [nsWindow setAlphaValue:alpha];
           }];
       
       JNF_COCOA_EXIT(env);
      @@ -889,11 +963,11 @@ JNIEXPORT void JNICALL Java_sun_lwawt_macosx_CPlatformWindow_nativeRevalidateNSW
       JNF_COCOA_ENTER(env);
       AWT_ASSERT_NOT_APPKIT_THREAD;
       
      -    AWTWindow *window = OBJC(windowPtr);
      +    NSWindow *nsWindow = OBJC(windowPtr);
           [JNFRunLoop performOnMainThreadWaiting:NO withBlock:^(){
               AWT_ASSERT_APPKIT_THREAD;
       
      -        [window invalidateShadow];
      +        [nsWindow invalidateShadow];
           }];
       
       JNF_COCOA_EXIT(env);
      @@ -912,8 +986,8 @@ JNIEXPORT jint JNICALL Java_sun_lwawt_macosx_CPlatformWindow_nativeScreenOn_1App
       JNF_COCOA_ENTER(env);
       AWT_ASSERT_APPKIT_THREAD;
       
      -    AWTWindow *window = OBJC(windowPtr);
      -    NSDictionary *props = [[window screen] deviceDescription];
      +    NSWindow *nsWindow = OBJC(windowPtr);
      +    NSDictionary *props = [[nsWindow screen] deviceDescription];
           ret = [[props objectForKey:@"NSScreenNumber"] intValue];
       
       JNF_COCOA_EXIT(env);
      @@ -932,12 +1006,12 @@ JNIEXPORT void JNICALL Java_sun_lwawt_macosx_CPlatformWindow_nativeSetNSWindowMi
       JNF_COCOA_ENTER(env);
       AWT_ASSERT_NOT_APPKIT_THREAD;
       
      -    AWTWindow *window = OBJC(windowPtr);
      +    NSWindow *nsWindow = OBJC(windowPtr);
           NSImage *image = OBJC(nsImagePtr);
           [JNFRunLoop performOnMainThreadWaiting:NO withBlock:^(){
               AWT_ASSERT_APPKIT_THREAD;
       
      -        [window setMiniwindowImage:image];
      +        [nsWindow setMiniwindowImage:image];
           }];
       
       JNF_COCOA_EXIT(env);
      @@ -954,12 +1028,12 @@ JNIEXPORT void JNICALL Java_sun_lwawt_macosx_CPlatformWindow_nativeSetNSWindowRe
       JNF_COCOA_ENTER(env);
       AWT_ASSERT_NOT_APPKIT_THREAD;
       
      -    AWTWindow *window = OBJC(windowPtr);
      +    NSWindow *nsWindow = OBJC(windowPtr);
           NSURL *url = (filename == NULL) ? nil : [NSURL fileURLWithPath:JNFNormalizedNSStringForPath(env, filename)];
           [JNFRunLoop performOnMainThreadWaiting:NO withBlock:^(){
               AWT_ASSERT_APPKIT_THREAD;
       
      -        [window setRepresentedURL:url];
      +        [nsWindow setRepresentedURL:url];
           }];
       
       JNF_COCOA_EXIT(env);
      @@ -992,10 +1066,12 @@ JNIEXPORT void JNICALL Java_sun_lwawt_macosx_CPlatformWindow_nativeSynthesizeMou
           JNF_COCOA_ENTER(env);
           AWT_ASSERT_NOT_APPKIT_THREAD;
       
      -    AWTWindow *window = OBJC(windowPtr);
      +    NSWindow *nsWindow = OBJC(windowPtr);
           [JNFRunLoop performOnMainThreadWaiting:NO withBlock:^(){
               AWT_ASSERT_APPKIT_THREAD;
       
      +        AWTWindow *window = (AWTWindow*)[nsWindow delegate];
      +
               [window synthesizeMouseEnteredExitedEvents];
           }];
       
      @@ -1015,8 +1091,8 @@ JNIEXPORT jint JNICALL Java_sun_lwawt_macosx_CPlatformWindow_nativeGetScreenNSWi
       JNF_COCOA_ENTER(env);
       AWT_ASSERT_APPKIT_THREAD;
       
      -    AWTWindow *window = OBJC(windowPtr);
      -    NSScreen* screen = [window screen];
      +    NSWindow *nsWindow = OBJC(windowPtr);
      +    NSScreen* screen = [nsWindow screen];
       
           //+++gdb NOTE: This is using a linear search of the screens. If it should
           //  prove to be a bottleneck, this can definitely be improved. However,
      @@ -1047,12 +1123,12 @@ JNIEXPORT void JNICALL Java_sun_lwawt_macosx_CPlatformWindow__1toggleFullScreenM
       {
       JNF_COCOA_ENTER(env);
       
      -    AWTWindow *window = OBJC(windowPtr);
      +    NSWindow *nsWindow = OBJC(windowPtr);
           SEL toggleFullScreenSelector = @selector(toggleFullScreen:);
      -    if (![window respondsToSelector:toggleFullScreenSelector]) return;
      +    if (![nsWindow respondsToSelector:toggleFullScreenSelector]) return;
       
           [JNFRunLoop performOnMainThreadWaiting:NO withBlock:^(){
      -        [window performSelector:toggleFullScreenSelector withObject:nil];
      +        [nsWindow performSelector:toggleFullScreenSelector withObject:nil];
           }];
       
       JNF_COCOA_EXIT(env);
      @@ -1066,12 +1142,12 @@ JNIEXPORT jboolean JNICALL Java_sun_lwawt_macosx_CMouseInfoPeer_nativeIsWindowUn
       JNF_COCOA_ENTER(env);
       AWT_ASSERT_NOT_APPKIT_THREAD;
       
      -    AWTWindow *aWindow = OBJC(windowPtr);
      +    NSWindow *nsWindow = OBJC(windowPtr);
           [JNFRunLoop performOnMainThreadWaiting:YES withBlock:^() {
               AWT_ASSERT_APPKIT_THREAD;
       
      -        NSPoint pt = [aWindow mouseLocationOutsideOfEventStream];
      -        underMouse = [[aWindow contentView] hitTest:pt] != nil;
      +        NSPoint pt = [nsWindow mouseLocationOutsideOfEventStream];
      +        underMouse = [[nsWindow contentView] hitTest:pt] != nil;
           }];
       
       JNF_COCOA_EXIT(env);
      @@ -1084,8 +1160,10 @@ JNIEXPORT void JNICALL Java_sun_lwawt_macosx_CPlatformWindow_nativeSetEnabled
       {
       JNF_COCOA_ENTER(env);
       
      -    AWTWindow *window = OBJC(windowPtr);
      +    NSWindow *nsWindow = OBJC(windowPtr);
           [JNFRunLoop performOnMainThreadWaiting:NO withBlock:^(){
      +        AWTWindow *window = (AWTWindow*)[nsWindow delegate];
      +
               [window setEnabled: isEnabled];
           }];
       
      
      From bfa3402f161938cbd8e481510f79b785af0c9099 Mon Sep 17 00:00:00 2001
      From: Gary Collins 
      Date: Fri, 11 May 2012 11:30:03 -0700
      Subject: [PATCH 039/128] 7167625: Adjustments for SE-Embedded build process
      
      Simple change to the SE-Embedded build rules that should not affect any other OpenJDK users.
      
      Reviewed-by: kvn, dholmes
      ---
       hotspot/make/linux/makefiles/vm.make       | 8 ++++++--
       hotspot/src/share/vm/runtime/arguments.cpp | 2 +-
       2 files changed, 7 insertions(+), 3 deletions(-)
      
      diff --git a/hotspot/make/linux/makefiles/vm.make b/hotspot/make/linux/makefiles/vm.make
      index a9517a4809b..6e9794ba710 100644
      --- a/hotspot/make/linux/makefiles/vm.make
      +++ b/hotspot/make/linux/makefiles/vm.make
      @@ -102,9 +102,11 @@ CXXFLAGS =           \
       # a time and date. 
       vm_version.o: CXXFLAGS += ${JRE_VERSION}
       
      -ifndef JAVASE_EMBEDDED
      +ifndef JAVASE_EMBEDDED 
      +ifneq (${ARCH},arm)
       CFLAGS += -DINCLUDE_TRACE
       endif
      +endif
       
       # CFLAGS_WARN holds compiler options to suppress/enable warnings.
       CFLAGS += $(CFLAGS_WARN/BYFILE)
      @@ -153,11 +155,13 @@ SOURCE_PATHS+=$(HS_COMMON_SRC)/os/posix/vm
       SOURCE_PATHS+=$(HS_COMMON_SRC)/cpu/$(Platform_arch)/vm
       SOURCE_PATHS+=$(HS_COMMON_SRC)/os_cpu/$(Platform_os_arch)/vm
       
      -ifndef JAVASE_EMBEDDED
      +ifndef JAVASE_EMBEDDED 
      +ifneq (${ARCH},arm)
       SOURCE_PATHS+=$(shell if [ -d $(HS_ALT_SRC)/share/vm/jfr ]; then \
         find $(HS_ALT_SRC)/share/vm/jfr -type d; \
         fi)
       endif
      +endif
       
       CORE_PATHS=$(foreach path,$(SOURCE_PATHS),$(call altsrc,$(path)) $(path))
       CORE_PATHS+=$(GENERATED)/jvmtifiles
      diff --git a/hotspot/src/share/vm/runtime/arguments.cpp b/hotspot/src/share/vm/runtime/arguments.cpp
      index 8deacc6f564..5b257b39e29 100644
      --- a/hotspot/src/share/vm/runtime/arguments.cpp
      +++ b/hotspot/src/share/vm/runtime/arguments.cpp
      @@ -3039,7 +3039,7 @@ jint Arguments::parse(const JavaVMInitArgs* args) {
           return result;
         }
       
      -#ifdef JAVASE_EMBEDDED
      +#if (defined JAVASE_EMBEDDED || defined ARM)
         UNSUPPORTED_OPTION(UseG1GC, "G1 GC");
       #endif
       
      
      From 3b77eb76806a9821f9391a199ce51324e54bf75a Mon Sep 17 00:00:00 2001
      From: Mike Duigou 
      Date: Fri, 11 May 2012 11:31:46 -0700
      Subject: [PATCH 040/128] 7071826: Avoid benign race condition in
       initialization of UUID
      
      Avoids mostly benign but sometimes expensive race condition on initialization of UUID.numberGenerator which is used by UUID.randomUUID()
      
      Reviewed-by: alanb, chegar
      ---
       jdk/src/share/classes/java/util/UUID.java | 16 ++++++++--------
       jdk/test/java/util/UUID/UUIDTest.java     | 18 +++++++++++++++---
       2 files changed, 23 insertions(+), 11 deletions(-)
      
      diff --git a/jdk/src/share/classes/java/util/UUID.java b/jdk/src/share/classes/java/util/UUID.java
      index 448429849b9..d3d8c242b4f 100644
      --- a/jdk/src/share/classes/java/util/UUID.java
      +++ b/jdk/src/share/classes/java/util/UUID.java
      @@ -90,9 +90,11 @@ public final class UUID implements java.io.Serializable, Comparable {
       
           /*
            * The random number generator used by this class to create random
      -     * based UUIDs.
      +     * based UUIDs. In a holder class to defer initialization until needed.
            */
      -    private static volatile SecureRandom numberGenerator = null;
      +    private static class Holder {
      +        static final SecureRandom numberGenerator = new SecureRandom();
      +    }
       
           // Constructors and Factories
       
      @@ -137,10 +139,7 @@ public final class UUID implements java.io.Serializable, Comparable {
            * @return  A randomly generated {@code UUID}
            */
           public static UUID randomUUID() {
      -        SecureRandom ng = numberGenerator;
      -        if (ng == null) {
      -            numberGenerator = ng = new SecureRandom();
      -        }
      +        SecureRandom ng = Holder.numberGenerator;
       
               byte[] randomBytes = new byte[16];
               ng.nextBytes(randomBytes);
      @@ -255,7 +254,8 @@ public final class UUID implements java.io.Serializable, Comparable {
            * The variant number has the following meaning:
            * 

        *
      • 0 Reserved for NCS backward compatibility - *
      • 2 The Leach-Salz variant (used by this class) + *
      • 2 IETF RFC 4122 + * (Leach-Salz), used by this class *
      • 6 Reserved, Microsoft Corporation backward compatibility *
      • 7 Reserved for future definition *
      @@ -265,7 +265,7 @@ public final class UUID implements java.io.Serializable, Comparable { public int variant() { // This field is composed of a varying number of bits. // 0 - - Reserved for NCS backward compatibility - // 1 0 - The Leach-Salz variant (used by this class) + // 1 0 - The IETF aka Leach-Salz variant (used by this class) // 1 1 0 Reserved, Microsoft backward compatibility // 1 1 1 Reserved for future definition. return (int) ((leastSigBits >>> (64 - (leastSigBits >>> 62))) diff --git a/jdk/test/java/util/UUID/UUIDTest.java b/jdk/test/java/util/UUID/UUIDTest.java index d9161c2eab2..dca2d775232 100644 --- a/jdk/test/java/util/UUID/UUIDTest.java +++ b/jdk/test/java/util/UUID/UUIDTest.java @@ -58,6 +58,12 @@ public class UUIDTest { List list = new LinkedList(); for (int i=0; i<100; i++) { UUID u1 = UUID.randomUUID(); + if (4 != u1.version()) { + throw new Exception("bad version"); + } + if (2 != u1.variant()) { + throw new Exception("bad variant"); + } if (list.contains(u1)) throw new Exception("random UUID collision very unlikely"); list.add(u1); @@ -70,10 +76,16 @@ public class UUIDTest { List list = new LinkedList(); for (int i=0; i<100; i++) { byteSource.nextBytes(someBytes); - UUID test = UUID.nameUUIDFromBytes(someBytes); - if (list.contains(test)) + UUID u1 = UUID.nameUUIDFromBytes(someBytes); + if (3 != u1.version()) { + throw new Exception("bad version"); + } + if (2 != u1.variant()) { + throw new Exception("bad variant"); + } + if (list.contains(u1)) throw new Exception("byte UUID collision very unlikely"); - list.add(test); + list.add(u1); } } From 024a3d83707a9ff1286c19f940a678506597ae52 Mon Sep 17 00:00:00 2001 From: Olivier Lagneau Date: Fri, 11 May 2012 14:13:29 -0700 Subject: [PATCH 041/128] 7144861: speed up RMI activation tests Reviewed-by: alanb, smarks, dholmes, dmocek --- .../rmi/activation/checkusage/CheckUsage.java | 7 +- .../rmi/testlibrary/ActivationLibrary.java | 59 +++++++++--- jdk/test/java/rmi/testlibrary/JavaVM.java | 78 ++++++++++++++-- jdk/test/java/rmi/testlibrary/RMID.java | 74 +++++++++++---- jdk/test/java/rmi/testlibrary/StreamPipe.java | 91 ++++++++++++++----- .../runtime/Log/6409194/NoConsoleOutput.java | 5 +- 6 files changed, 246 insertions(+), 68 deletions(-) diff --git a/jdk/test/java/rmi/activation/checkusage/CheckUsage.java b/jdk/test/java/rmi/activation/checkusage/CheckUsage.java index 7f3f041f9c6..095bdc2782e 100644 --- a/jdk/test/java/rmi/activation/checkusage/CheckUsage.java +++ b/jdk/test/java/rmi/activation/checkusage/CheckUsage.java @@ -53,12 +53,9 @@ public class CheckUsage { rmidVM.start(); // wait for registry exit + int rmidVMExitStatus = rmidVM.getVM().waitFor(); System.err.println("rmid exited with status: " + - rmidVM.getVM().waitFor()); - try { - Thread.sleep(7000); - } catch (InterruptedException ie) { - } + rmidVMExitStatus); String usage = new String(berr.toByteArray()); diff --git a/jdk/test/java/rmi/testlibrary/ActivationLibrary.java b/jdk/test/java/rmi/testlibrary/ActivationLibrary.java index 2dd27343685..86c1744ef71 100644 --- a/jdk/test/java/rmi/testlibrary/ActivationLibrary.java +++ b/jdk/test/java/rmi/testlibrary/ActivationLibrary.java @@ -63,19 +63,30 @@ public class ActivationLibrary { */ public static void deactivate(Remote remote, ActivationID id) { - for (int i = 0; i < 5; i ++) { + // We do as much as 50 deactivation trials, each separated by + // at least 100 milliseconds sleep time (max sleep time of 5 secs). + final long deactivateSleepTime = 100; + for (int i = 0; i < 50; i ++) { try { if (Activatable.inactive(id) == true) { mesg("inactive successful"); return; } else { - Thread.sleep(1000); + mesg("inactive trial failed. Sleeping " + + deactivateSleepTime + + " milliseconds before next trial"); + Thread.sleep(deactivateSleepTime); } } catch (InterruptedException e) { - continue; + Thread.currentThread().interrupt(); + mesg("Thread interrupted while trying to deactivate activatable. Exiting deactivation"); + return; } catch (Exception e) { try { // forcibly unexport the object + mesg("Unexpected exception. Have to forcibly unexport the object." + + " Exception was :"); + e.printStackTrace(); Activatable.unexportObject(remote, true); } catch (NoSuchObjectException ex) { } @@ -99,37 +110,61 @@ public class ActivationLibrary { * activation system. */ public static boolean rmidRunning(int port) { - int allowedNotReady = 10; + int allowedNotReady = 50; int connectionRefusedExceptions = 0; - for (int i = 0; i < 15 ; i++) { + /* We wait as much as a total of 7.5 secs trying to see Rmid running. + * We do this by pausing steps of 100 milliseconds (so up to 75 steps), + * right after trying to lookup and find RMID running in the other vm. + */ + final long rmidWaitingStepTime = 100; + for (int i = 0; i <= 74; i++) { try { - Thread.sleep(500); LocateRegistry.getRegistry(port).lookup(SYSTEM_NAME); + mesg("Activation System available after " + + (i * rmidWaitingStepTime) + " milliseconds"); return true; } catch (java.rmi.ConnectException e) { - // ignore connect exceptions until we decide rmid is not up + mesg("Remote connection refused after " + + (i * rmidWaitingStepTime) + " milliseconds"); + // ignore connect exceptions until we decide rmid is not up if ((connectionRefusedExceptions ++) >= allowedNotReady) { return false; } - } catch (NotBoundException e) { + } catch (java.rmi.NoSuchObjectException nsoe) { + /* Activation System still unavailable. + * Ignore this since we are just waiting for its availibility. + * Just signal unavailibility. + */ + mesg("Activation System still unavailable after more than " + + (i * rmidWaitingStepTime) + " milliseconds"); + } catch (NotBoundException e) { return false; } catch (Exception e) { - // print out other types of exceptions as an FYI. - // test should not fail as rmid is likely to be in an - // undetermined state at this point. - + /* print out other types of exceptions as an FYI. + * test should not fail as rmid is likely to be in an + * undetermined state at this point. + */ mesg("caught an exception trying to" + " start rmid, last exception was: " + e.getMessage()); e.printStackTrace(); } + + // Waiting for another 100 milliseconds. + try { + Thread.sleep(100); + } catch (InterruptedException e) { + Thread.currentThread().interrupt(); + mesg("Thread interrupted while checking if Activation System is running. Exiting check"); + return false; + } } return false; } diff --git a/jdk/test/java/rmi/testlibrary/JavaVM.java b/jdk/test/java/rmi/testlibrary/JavaVM.java index 4356f34a803..62be87d8279 100644 --- a/jdk/test/java/rmi/testlibrary/JavaVM.java +++ b/jdk/test/java/rmi/testlibrary/JavaVM.java @@ -36,7 +36,6 @@ import java.util.StringTokenizer; */ public class JavaVM { - // need to protected Process vm = null; private String classname = ""; @@ -46,6 +45,10 @@ public class JavaVM { private OutputStream errorStream = System.err; private String policyFileName = null; + // This is used to shorten waiting time at startup. + private volatile boolean started = false; + private boolean forcesOutput = true; // default behavior + private static void mesg(Object mesg) { System.err.println("JAVAVM: " + mesg.toString()); } @@ -79,6 +82,25 @@ public class JavaVM { this.errorStream = err; } + /* This constructor will instantiate a JavaVM object for which caller + * can ask for forcing initial version output on child vm process + * (if forcesVersionOutput is true), or letting the started vm behave freely + * (when forcesVersionOutput is false). + */ + public JavaVM(String classname, + String options, String args, + OutputStream out, OutputStream err, + boolean forcesVersionOutput) { + this(classname, options, args, out, err); + this.forcesOutput = forcesVersionOutput; + } + + + public void setStarted() { + started = true; + } + + // Prepends passed opts array to current options public void addOptions(String[] opts) { String newOpts = ""; for (int i = 0 ; i < opts.length ; i ++) { @@ -87,6 +109,8 @@ public class JavaVM { newOpts += " "; options = newOpts + options; } + + // Prepends passed arguments array to current args public void addArguments(String[] arguments) { String newArgs = ""; for (int i = 0 ; i < arguments.length ; i ++) { @@ -127,6 +151,18 @@ public class JavaVM { addOptions(new String[] { getCodeCoverageOptions() }); + /* + * If forcesOutput is true : + * We force the new starting vm to output something so that we can know + * when it is effectively started by redirecting standard output through + * the next StreamPipe call (the vm is considered started when a first + * output has been streamed out). + * We do this by prepnding a "-showversion" option in the command line. + */ + if (forcesOutput) { + addOptions(new String[] {"-showversion"}); + } + StringTokenizer optionsTokenizer = new StringTokenizer(options); StringTokenizer argsTokenizer = new StringTokenizer(args); int optionsCount = optionsTokenizer.countTokens(); @@ -150,15 +186,43 @@ public class JavaVM { vm = Runtime.getRuntime().exec(javaCommand); /* output from the execed process may optionally be captured. */ - StreamPipe.plugTogether(vm.getInputStream(), this.outputStream); - StreamPipe.plugTogether(vm.getErrorStream(), this.errorStream); + StreamPipe.plugTogether(this, vm.getInputStream(), this.outputStream); + StreamPipe.plugTogether(this, vm.getErrorStream(), this.errorStream); try { - Thread.sleep(2000); - } catch (Exception ignore) { - } + if (forcesOutput) { + // Wait distant vm to start, by using waiting time slices of 100 ms. + // Wait at most for 2secs, after it considers the vm to be started. + final long vmStartSleepTime = 100; + final int maxTrials = 20; + int numTrials = 0; + while (!started && numTrials < maxTrials) { + numTrials++; + Thread.sleep(vmStartSleepTime); + } - mesg("finished starting vm."); + // Outputs running status of distant vm + String message = + "after " + (numTrials * vmStartSleepTime) + " milliseconds"; + if (started) { + mesg("distant vm process running, " + message); + } + else { + mesg("unknown running status of distant vm process, " + message); + } + } + else { + // Since we have no way to know if the distant vm is started, + // we just consider the vm to be started after a 2secs waiting time. + Thread.sleep(2000); + mesg("distant vm considered to be started after a waiting time of 2 secs"); + } + } catch (InterruptedException e) { + Thread.currentThread().interrupt(); + mesg("Thread interrupted while checking if distant vm is started. Giving up check."); + mesg("Distant vm state unknown"); + return; + } } public void destroy() { diff --git a/jdk/test/java/rmi/testlibrary/RMID.java b/jdk/test/java/rmi/testlibrary/RMID.java index 0663fdf73b2..8a8ac3978ca 100644 --- a/jdk/test/java/rmi/testlibrary/RMID.java +++ b/jdk/test/java/rmi/testlibrary/RMID.java @@ -218,20 +218,30 @@ public class RMID extends JavaVM { } catch (NumberFormatException ignore) {} waitTime = waitTime * slopFactor; - // give rmid time to come up + // We check several times (as many as provides passed waitTime) to + // see if Rmid is currently running. Waiting steps last 100 msecs. + final long rmidStartSleepTime = 100; do { + // Sleeping for another rmidStartSleepTime time slice. try { - Thread.sleep(Math.min(waitTime, 10000)); + Thread.sleep(Math.min(waitTime, rmidStartSleepTime)); } catch (InterruptedException ie) { Thread.currentThread().interrupt(); + mesg("Thread interrupted while checking for start of Activation System. Giving up check."); + mesg("Activation System state unknown"); + return; } - waitTime -= 10000; + waitTime -= rmidStartSleepTime; - // is rmid present? + // Checking if rmid is present if (ActivationLibrary.rmidRunning(port)) { mesg("finished starting rmid."); return; } + else { + mesg("rmid still not started"); + } + } while (waitTime > 0); TestLibrary.bomb("start rmid failed... giving up", null); } @@ -264,6 +274,8 @@ public class RMID extends JavaVM { port + "/java.rmi.activation.ActivationSystem"); mesg("obtained a reference to the activation system"); + } catch (RemoteException re) { + mesg("could not contact registry while trying to shutdown activation system"); } catch (java.net.MalformedURLException mue) { } @@ -272,19 +284,14 @@ public class RMID extends JavaVM { } system.shutdown(); + } catch (RemoteException re) { + mesg("shutting down the activation daemon failed"); } catch (Exception e) { mesg("caught exception trying to shutdown rmid"); mesg(e.getMessage()); e.printStackTrace(); } - try { - // wait for the shutdown to happen - Thread.sleep(5000); - } catch (InterruptedException ie) { - Thread.currentThread().interrupt(); - } - mesg("testlibrary finished shutting down rmid"); } @@ -301,18 +308,47 @@ public class RMID extends JavaVM { if (vm != null) { try { - // destroy rmid if it is still running... - try { - vm.exitValue(); - mesg("rmid exited on shutdown request"); - } catch (IllegalThreadStateException illegal) { - mesg("Had to destroy RMID's process " + - "using Process.destroy()"); + /* Waiting for distant RMID process to shutdown. + * Waiting is bounded at a hardcoded max of 60 secs (1 min). + * Waiting by steps of 200 msecs, thus at most 300 such attempts + * for termination of distant RMID process. If process is not + * known to be terminated properly after that time, + * we give up for a gracefull termination, and thus go for + * forcibly destroying the process. + */ + boolean vmEnded = false; + int waitingTrials = 0; + final int maxTrials = 300; + final long vmProcessEndWaitInterval = 200; + int vmExitValue; + do { + try { + Thread.sleep(vmProcessEndWaitInterval); + waitingTrials++; + vmExitValue = vm.exitValue(); + mesg("rmid exited on shutdown request"); + vmEnded = true; + } catch (IllegalThreadStateException illegal) { + mesg("RMID's process still not terminated after more than " + + (waitingTrials * vmProcessEndWaitInterval) + " milliseconds"); + } + } + while (!vmEnded && + (waitingTrials < maxTrials)); + + if (waitingTrials >= maxTrials) { + mesg("RMID's process still not terminated after more than " + + (waitingTrials * vmProcessEndWaitInterval) + " milliseconds." + + "Givinp up gracefull termination..."); + mesg("destroying RMID's process using Process.destroy()"); super.destroy(); } + } catch (InterruptedException ie) { + Thread.currentThread().interrupt(); + mesg("Thread interrupted while checking for termination of distant rmid vm. Giving up check."); } catch (Exception e) { - mesg("caught exception trying to destroy rmid: " + + mesg("caught unexpected exception trying to destroy rmid: " + e.getMessage()); e.printStackTrace(); } diff --git a/jdk/test/java/rmi/testlibrary/StreamPipe.java b/jdk/test/java/rmi/testlibrary/StreamPipe.java index e68eefe41af..9278539bfdf 100644 --- a/jdk/test/java/rmi/testlibrary/StreamPipe.java +++ b/jdk/test/java/rmi/testlibrary/StreamPipe.java @@ -35,46 +35,89 @@ public class StreamPipe extends Thread { private InputStream in; private OutputStream out; private String preamble; + private JavaVM javaVM; private static Object lock = new Object(); private static int count = 0; - public StreamPipe(InputStream in, OutputStream out, String name) { + + /* StreamPipe constructor : should only be called by plugTogether() method !! + * If passed vm is not null : + * - This is StreamPipe usage when streams to pipe come from a given + * vm (JavaVM) process (the vm process must be started with a prefixed + * "-showversion" option to be able to determine as soon as possible when + * the vm process is started through the redirection of the streams). + * There must be a close connection between the StreamPipe instance and + * the JavaVM object on which a start() call has been done. + * run() method will flag distant JavaVM as started. + * If passed vm is null : + * - We don't have control on the process which we want to redirect the passed + * streams. + * run() method will ignore distant process. + */ + private StreamPipe(JavaVM vm, InputStream in, OutputStream out, String name) { super(name); this.in = in; this.out = out; this.preamble = "# "; + this.javaVM = vm; } - public void run() { - BufferedReader r = new BufferedReader(new InputStreamReader(in), 1); - BufferedWriter w = new BufferedWriter(new OutputStreamWriter(out)); - byte[] buf = new byte[256]; - boolean bol = true; // beginning-of-line - int count; - - try { - String line; - while ((line = r.readLine()) != null) { - w.write(preamble); - w.write(line); - w.newLine(); - w.flush(); - } - } catch (IOException e) { - System.err.println("*** IOException in StreamPipe.run:"); - e.printStackTrace(); - } - } - - public static void plugTogether(InputStream in, OutputStream out) { + // Install redirection of passed InputStream and OutputStream from passed JavaVM + // to this vm standard output and input streams. + public static void plugTogether(JavaVM vm, InputStream in, OutputStream out) { String name = null; synchronized (lock) { name = "TestLibrary: StreamPipe-" + (count ++ ); } - Thread pipe = new StreamPipe(in, out, name); + Thread pipe = new StreamPipe(vm, in, out, name); pipe.setDaemon(true); pipe.start(); } + + /* Redirects the InputStream and OutputStream passed by caller to this + * vm standard output and input streams. + * (we just have to use fully parametered plugTogether() call with a null + * JavaVM input to do this). + */ + public static void plugTogether(InputStream in, OutputStream out) { + plugTogether(null, in, out); + } + + // Starts redirection of streams. + public void run() { + BufferedReader r = new BufferedReader(new InputStreamReader(in), 1); + BufferedWriter w = new BufferedWriter(new OutputStreamWriter(out)); + byte[] buf = new byte[256]; + + try { + String line; + + /* This is to check that the distant vm has started, + * if such a vm has been provided at construction : + * - As soon as we can read something from r BufferedReader, + * that means the distant vm is already started. + * Thus we signal associated JavaVM object that it is now started. + */ + if (((line = r.readLine()) != null) && + (javaVM != null)) { + javaVM.setStarted(); + } + + // Redirects r on w. + while (line != null) { + w.write(preamble); + w.write(line); + w.newLine(); + w.flush(); + line = r.readLine(); + } + + } catch (IOException e) { + System.err.println("*** IOException in StreamPipe.run:"); + e.printStackTrace(); + } + } + } diff --git a/jdk/test/sun/rmi/runtime/Log/6409194/NoConsoleOutput.java b/jdk/test/sun/rmi/runtime/Log/6409194/NoConsoleOutput.java index 7ecfd5e8483..cd1541ccbb7 100644 --- a/jdk/test/sun/rmi/runtime/Log/6409194/NoConsoleOutput.java +++ b/jdk/test/sun/rmi/runtime/Log/6409194/NoConsoleOutput.java @@ -60,9 +60,12 @@ public class NoConsoleOutput { File.separatorChar + "logging.properties"; ByteArrayOutputStream out = new ByteArrayOutputStream(); ByteArrayOutputStream err = new ByteArrayOutputStream(); + + // We instantiate a JavaVM that should not produce any console output + // (neither on standard output, nor on standard err streams). JavaVM vm = new JavaVM(DoRMIStuff.class.getName(), "-Djava.util.logging.config.file=" + loggingPropertiesFile, - "", out, err); + "", out, err, false); vm.start(); vm.getVM().waitFor(); From 17b26a6a0c693e6fcd0d70ad96070812a69818b2 Mon Sep 17 00:00:00 2001 From: Alejandro Murillo Date: Fri, 11 May 2012 14:54:35 -0700 Subject: [PATCH 042/128] 7168247: new hotspot build - hs24-b11 Reviewed-by: jcoomes --- hotspot/make/hotspot_version | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/hotspot/make/hotspot_version b/hotspot/make/hotspot_version index dba5ab40734..6922036c071 100644 --- a/hotspot/make/hotspot_version +++ b/hotspot/make/hotspot_version @@ -1,5 +1,5 @@ # -# Copyright (c) 2006, 2011, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2006, 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 @@ -31,11 +31,11 @@ # # Don't put quotes (fail windows build). -HOTSPOT_VM_COPYRIGHT=Copyright 2011 +HOTSPOT_VM_COPYRIGHT=Copyright 2012 HS_MAJOR_VER=24 HS_MINOR_VER=0 -HS_BUILD_NUMBER=10 +HS_BUILD_NUMBER=11 JDK_MAJOR_VER=1 JDK_MINOR_VER=8 From 65a285cb99599695503e7cc7a2e534be9c561707 Mon Sep 17 00:00:00 2001 From: Alexander Scherbatiy Date: Sat, 12 May 2012 12:01:36 +0400 Subject: [PATCH 043/128] 7024965: Stylepad demo: remove non-translatable resources from Stylepad.properties file Reviewed-by: alexp --- jdk/src/share/demo/jfc/Notepad/Notepad.java | 24 +++++++++++++------ ...em.properties => NotepadSystem.properties} | 0 2 files changed, 17 insertions(+), 7 deletions(-) rename jdk/src/share/demo/jfc/Notepad/resources/{system.properties => NotepadSystem.properties} (100%) diff --git a/jdk/src/share/demo/jfc/Notepad/Notepad.java b/jdk/src/share/demo/jfc/Notepad/Notepad.java index d023dee7990..b6c7199e256 100644 --- a/jdk/src/share/demo/jfc/Notepad/Notepad.java +++ b/jdk/src/share/demo/jfc/Notepad/Notepad.java @@ -62,7 +62,7 @@ import javax.swing.UIManager.LookAndFeelInfo; @SuppressWarnings("serial") class Notepad extends JPanel { - private static Properties properties; + protected static Properties properties; private static ResourceBundle resources; private final static String EXIT_AFTER_PAINT = "-exit"; private static boolean exitAfterFirstPaint; @@ -77,12 +77,12 @@ class Notepad extends JPanel { try { properties = new Properties(); properties.load(Notepad.class.getResourceAsStream( - "resources/system.properties")); + "resources/NotepadSystem.properties")); resources = ResourceBundle.getBundle("resources.Notepad", Locale.getDefault()); } catch (MissingResourceException | IOException e) { System.err.println("resources/Notepad.properties " - + "or resources/system.properties not found"); + + "or resources/NotepadSystem.properties not found"); System.exit(1); } } @@ -298,7 +298,7 @@ class Notepad extends JPanel { */ private Component createToolbar() { toolbar = new JToolBar(); - for (String toolKey: TOOLBAR_KEYS) { + for (String toolKey: getToolBarKeys()) { if (toolKey.equals("-")) { toolbar.add(Box.createHorizontalStrut(5)); } else { @@ -363,7 +363,7 @@ class Notepad extends JPanel { */ protected JMenuBar createMenubar() { JMenuBar mb = new JMenuBar(); - for(String menuKey: MENUBAR_KEYS){ + for(String menuKey: getMenuBarKeys()){ JMenu m = createMenu(menuKey); if (m != null) { mb.add(m); @@ -389,8 +389,10 @@ class Notepad extends JPanel { return menu; } - // get keys for menus - private String[] getItemKeys(String key) { + /** + * Get keys for menus + */ + protected String[] getItemKeys(String key) { switch (key) { case "file": return FILE_KEYS; @@ -403,6 +405,14 @@ class Notepad extends JPanel { } } + protected String[] getMenuBarKeys() { + return MENUBAR_KEYS; + } + + protected String[] getToolBarKeys() { + return TOOLBAR_KEYS; + } + // Yarked from JMenu, ideally this would be public. protected PropertyChangeListener createActionChangeListener(JMenuItem b) { return new ActionChangedListener(b); diff --git a/jdk/src/share/demo/jfc/Notepad/resources/system.properties b/jdk/src/share/demo/jfc/Notepad/resources/NotepadSystem.properties similarity index 100% rename from jdk/src/share/demo/jfc/Notepad/resources/system.properties rename to jdk/src/share/demo/jfc/Notepad/resources/NotepadSystem.properties From 3cdc5fa537ec36a6b4c529cf07313f3b4101cdf4 Mon Sep 17 00:00:00 2001 From: Alexander Potochkin Date: Sat, 12 May 2012 17:46:00 +0400 Subject: [PATCH 044/128] 7149005: [macosx] Java Control Panel's UI controls are distorted when draging scroll bar Reviewed-by: serb --- .../macosx/classes/com/apple/laf/AquaButtonLabeledUI.java | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/jdk/src/macosx/classes/com/apple/laf/AquaButtonLabeledUI.java b/jdk/src/macosx/classes/com/apple/laf/AquaButtonLabeledUI.java index 95503c8271d..d9ebdd0e11d 100644 --- a/jdk/src/macosx/classes/com/apple/laf/AquaButtonLabeledUI.java +++ b/jdk/src/macosx/classes/com/apple/laf/AquaButtonLabeledUI.java @@ -30,6 +30,7 @@ import java.awt.image.BufferedImage; import javax.swing.*; import javax.swing.border.Border; +import javax.swing.plaf.UIResource; import javax.swing.plaf.basic.BasicHTML; import javax.swing.text.View; @@ -76,8 +77,11 @@ public abstract class AquaButtonLabeledUI extends AquaButtonToggleUI implements protected void setThemeBorder(final AbstractButton b) { super.setThemeBorder(b); - // Set the correct border - b.setBorder(AquaButtonBorder.getBevelButtonBorder()); + Border border = b.getBorder(); + if (border == null || border instanceof UIResource) { + // Set the correct border + b.setBorder(AquaButtonBorder.getBevelButtonBorder()); + } } protected abstract AquaButtonBorder getPainter(); From da0a14421344fe530cfcb688fe5fd809acf57c70 Mon Sep 17 00:00:00 2001 From: Anton Tarasov Date: Sat, 12 May 2012 18:50:27 +0400 Subject: [PATCH 045/128] 7110683: Issues with some KeyboardFocusManager method Reviewed-by: ahgross --- jdk/src/share/classes/java/awt/Component.java | 31 ++- .../java/awt/DefaultKeyboardFocusManager.java | 8 +- .../java/awt/KeyboardFocusManager.java | 225 ++++++++++++------ jdk/src/share/classes/java/awt/Window.java | 2 +- 4 files changed, 175 insertions(+), 91 deletions(-) diff --git a/jdk/src/share/classes/java/awt/Component.java b/jdk/src/share/classes/java/awt/Component.java index 00d363c1162..20d733fa93c 100644 --- a/jdk/src/share/classes/java/awt/Component.java +++ b/jdk/src/share/classes/java/awt/Component.java @@ -7833,7 +7833,7 @@ public abstract class Component implements ImageObserver, MenuContainer, if (focusLog.isLoggable(PlatformLogger.FINER)) { focusLog.finer("clear global focus owner"); } - KeyboardFocusManager.getCurrentKeyboardFocusManager().clearGlobalFocusOwner(); + KeyboardFocusManager.getCurrentKeyboardFocusManager().clearGlobalFocusOwnerPriv(); } if (focusLog.isLoggable(PlatformLogger.FINER)) { focusLog.finer("returning result: " + res); @@ -7914,7 +7914,7 @@ public abstract class Component implements ImageObserver, MenuContainer, if (focusLog.isLoggable(PlatformLogger.FINER)) { focusLog.finer("clear global focus owner"); } - KeyboardFocusManager.getCurrentKeyboardFocusManager().clearGlobalFocusOwner(); + KeyboardFocusManager.getCurrentKeyboardFocusManager().clearGlobalFocusOwnerPriv(); } if (focusLog.isLoggable(PlatformLogger.FINER)) { focusLog.finer("returning result: " + res); @@ -7947,21 +7947,32 @@ public abstract class Component implements ImageObserver, MenuContainer, if (rootAncestor != null) { Container rootAncestorRootAncestor = rootAncestor.getFocusCycleRootAncestor(); - KeyboardFocusManager.getCurrentKeyboardFocusManager(). - setGlobalCurrentFocusCycleRoot( - (rootAncestorRootAncestor != null) - ? rootAncestorRootAncestor - : rootAncestor); + + final Container fcr = (rootAncestorRootAncestor != null) ? + rootAncestorRootAncestor : rootAncestor; + + AccessController.doPrivileged(new PrivilegedAction() { + public Object run() { + KeyboardFocusManager.getCurrentKeyboardFocusManager(). + setGlobalCurrentFocusCycleRoot(fcr); + return null; + } + }); rootAncestor.requestFocus(CausedFocusEvent.Cause.TRAVERSAL_UP); } else { - Window window = getContainingWindow(); + final Window window = getContainingWindow(); if (window != null) { Component toFocus = window.getFocusTraversalPolicy(). getDefaultComponent(window); if (toFocus != null) { - KeyboardFocusManager.getCurrentKeyboardFocusManager(). - setGlobalCurrentFocusCycleRoot(window); + AccessController.doPrivileged(new PrivilegedAction() { + public Object run() { + KeyboardFocusManager.getCurrentKeyboardFocusManager(). + setGlobalCurrentFocusCycleRoot(window); + return null; + } + }); toFocus.requestFocus(CausedFocusEvent.Cause.TRAVERSAL_UP); } } diff --git a/jdk/src/share/classes/java/awt/DefaultKeyboardFocusManager.java b/jdk/src/share/classes/java/awt/DefaultKeyboardFocusManager.java index 4f9ef90f5a4..109e70d9d8a 100644 --- a/jdk/src/share/classes/java/awt/DefaultKeyboardFocusManager.java +++ b/jdk/src/share/classes/java/awt/DefaultKeyboardFocusManager.java @@ -116,7 +116,7 @@ public class DefaultKeyboardFocusManager extends KeyboardFocusManager { } else if (fe.getOppositeComponent() != null && doRestoreFocus(fe.getOppositeComponent(), vetoedComponent, false)) { } else { - clearGlobalFocusOwner(); + clearGlobalFocusOwnerPriv(); } } private void restoreFocus(WindowEvent we) { @@ -130,7 +130,7 @@ public class DefaultKeyboardFocusManager extends KeyboardFocusManager { { // do nothing, everything is done in restoreFocus() } else { - clearGlobalFocusOwner(); + clearGlobalFocusOwnerPriv(); } } private boolean restoreFocus(Window aWindow, Component vetoedComponent, @@ -141,7 +141,7 @@ public class DefaultKeyboardFocusManager extends KeyboardFocusManager { if (toFocus != null && toFocus != vetoedComponent && doRestoreFocus(toFocus, vetoedComponent, false)) { return true; } else if (clearOnFailure) { - clearGlobalFocusOwner(); + clearGlobalFocusOwnerPriv(); return true; } else { return false; @@ -164,7 +164,7 @@ public class DefaultKeyboardFocusManager extends KeyboardFocusManager { { return true; } else if (clearOnFailure) { - clearGlobalFocusOwner(); + clearGlobalFocusOwnerPriv(); return true; } else { return false; diff --git a/jdk/src/share/classes/java/awt/KeyboardFocusManager.java b/jdk/src/share/classes/java/awt/KeyboardFocusManager.java index 7b8b9f41e25..d12ed9e3c64 100644 --- a/jdk/src/share/classes/java/awt/KeyboardFocusManager.java +++ b/jdk/src/share/classes/java/awt/KeyboardFocusManager.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 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 @@ -246,15 +246,7 @@ public abstract class KeyboardFocusManager public static void setCurrentKeyboardFocusManager( KeyboardFocusManager newManager) throws SecurityException { - SecurityManager security = System.getSecurityManager(); - if (security != null) { - if (replaceKeyboardFocusManagerPermission == null) { - replaceKeyboardFocusManagerPermission = - new AWTPermission("replaceKeyboardFocusManager"); - } - security. - checkPermission(replaceKeyboardFocusManagerPermission); - } + checkReplaceKFMPermission(); KeyboardFocusManager oldManager = null; @@ -398,11 +390,6 @@ public abstract class KeyboardFocusManager */ private static java.util.Map mostRecentFocusOwners = new WeakHashMap(); - /** - * Error String for initializing SecurityExceptions. - */ - private static final String notPrivileged = "this KeyboardFocusManager is not installed in the current thread's context"; - /** * We cache the permission used to verify that the calling thread is * permitted to access the global focus state. @@ -503,17 +490,13 @@ public abstract class KeyboardFocusManager * @see #setGlobalFocusOwner * @throws SecurityException if this KeyboardFocusManager is not the * current KeyboardFocusManager for the calling thread's context + * and if the calling thread does not have "replaceKeyboardFocusManager" + * permission */ protected Component getGlobalFocusOwner() throws SecurityException { synchronized (KeyboardFocusManager.class) { - if (this == getCurrentKeyboardFocusManager()) { - return focusOwner; - } else { - if (focusLog.isLoggable(PlatformLogger.FINER)) { - focusLog.finer("This manager is " + this + ", current is " + getCurrentKeyboardFocusManager()); - } - throw new SecurityException(notPrivileged); - } + checkKFMSecurity(); + return focusOwner; } } @@ -538,15 +521,23 @@ public abstract class KeyboardFocusManager * @see Component#requestFocus() * @see Component#requestFocusInWindow() * @see Component#isFocusable + * @throws SecurityException if this KeyboardFocusManager is not the + * current KeyboardFocusManager for the calling thread's context + * and if the calling thread does not have "replaceKeyboardFocusManager" + * permission * @beaninfo * bound: true */ - protected void setGlobalFocusOwner(Component focusOwner) { + protected void setGlobalFocusOwner(Component focusOwner) + throws SecurityException + { Component oldFocusOwner = null; boolean shouldFire = false; if (focusOwner == null || focusOwner.isFocusable()) { synchronized (KeyboardFocusManager.class) { + checkKFMSecurity(); + oldFocusOwner = getFocusOwner(); try { @@ -583,6 +574,27 @@ public abstract class KeyboardFocusManager } } + /** + * Clears the focus owner at both the Java and native levels if the + * focus owner exists and resides in the same context as the calling thread, + * otherwise the method returns silently. + *

      + * The focus owner component will receive a permanent FOCUS_LOST event. + * After this operation completes, the native windowing system will discard + * all user-generated KeyEvents until the user selects a new Component to + * receive focus, or a Component is given focus explicitly via a call to + * {@code requestFocus()}. This operation does not change the focused or + * active Windows. + * + * @see Component#requestFocus() + * @see java.awt.event.FocusEvent#FOCUS_LOST + */ + public void clearFocusOwner() { + if (getFocusOwner() != null) { + clearGlobalFocusOwner(); + } + } + /** * Clears the global focus owner at both the Java and native levels. If * there exists a focus owner, that Component will receive a permanent @@ -591,11 +603,26 @@ public abstract class KeyboardFocusManager * a new Component to receive focus, or a Component is given focus * explicitly via a call to requestFocus(). This operation * does not change the focused or active Windows. + *

      + * If a SecurityManager is installed, the calling thread must be granted + * the "replaceKeyboardFocusManager" AWTPermission. If this permission is + * not granted, this method will throw a SecurityException, and the current + * focus owner will not be cleared. + *

      + * This method is intended to be used only by KeyboardFocusManager set as + * current KeyboardFocusManager for the calling thread's context. It is not + * for general client use. * + * @see KeyboardFocusManager#clearFocusOwner * @see Component#requestFocus() * @see java.awt.event.FocusEvent#FOCUS_LOST + * @throws SecurityException if the calling thread does not have + * "replaceKeyboardFocusManager" permission */ - public void clearGlobalFocusOwner() { + public void clearGlobalFocusOwner() + throws SecurityException + { + checkReplaceKFMPermission(); if (!GraphicsEnvironment.isHeadless()) { // Toolkit must be fully initialized, otherwise // _clearGlobalFocusOwner will crash or throw an exception @@ -609,6 +636,15 @@ public abstract class KeyboardFocusManager peer.clearGlobalFocusOwner(activeWindow); } + void clearGlobalFocusOwnerPriv() { + AccessController.doPrivileged(new PrivilegedAction() { + public Object run() { + clearGlobalFocusOwner(); + return null; + } + }); + } + Component getNativeFocusOwner() { return peer.getCurrentFocusOwner(); } @@ -660,29 +696,21 @@ public abstract class KeyboardFocusManager * are equivalent unless a temporary focus change is currently in effect. * In such a situation, the permanent focus owner will again be the focus * owner when the temporary focus change ends. - *

      - * This method will throw a SecurityException if this KeyboardFocusManager - * is not the current KeyboardFocusManager for the calling thread's - * context. * * @return the permanent focus owner * @see #getPermanentFocusOwner * @see #setGlobalPermanentFocusOwner * @throws SecurityException if this KeyboardFocusManager is not the * current KeyboardFocusManager for the calling thread's context + * and if the calling thread does not have "replaceKeyboardFocusManager" + * permission */ protected Component getGlobalPermanentFocusOwner() throws SecurityException { synchronized (KeyboardFocusManager.class) { - if (this == getCurrentKeyboardFocusManager()) { - return permanentFocusOwner; - } else { - if (focusLog.isLoggable(PlatformLogger.FINER)) { - focusLog.finer("This manager is " + this + ", current is " + getCurrentKeyboardFocusManager()); - } - throw new SecurityException(notPrivileged); - } + checkKFMSecurity(); + return permanentFocusOwner; } } @@ -708,16 +736,23 @@ public abstract class KeyboardFocusManager * @see Component#requestFocus() * @see Component#requestFocusInWindow() * @see Component#isFocusable + * @throws SecurityException if this KeyboardFocusManager is not the + * current KeyboardFocusManager for the calling thread's context + * and if the calling thread does not have "replaceKeyboardFocusManager" + * permission * @beaninfo * bound: true */ protected void setGlobalPermanentFocusOwner(Component permanentFocusOwner) + throws SecurityException { Component oldPermanentFocusOwner = null; boolean shouldFire = false; if (permanentFocusOwner == null || permanentFocusOwner.isFocusable()) { synchronized (KeyboardFocusManager.class) { + checkKFMSecurity(); + oldPermanentFocusOwner = getPermanentFocusOwner(); try { @@ -770,27 +805,19 @@ public abstract class KeyboardFocusManager * Returns the focused Window, even if the calling thread is in a different * context than the focused Window. The focused Window is the Window that * is or contains the focus owner. - *

      - * This method will throw a SecurityException if this KeyboardFocusManager - * is not the current KeyboardFocusManager for the calling thread's - * context. * * @return the focused Window * @see #getFocusedWindow * @see #setGlobalFocusedWindow * @throws SecurityException if this KeyboardFocusManager is not the * current KeyboardFocusManager for the calling thread's context + * and if the calling thread does not have "replaceKeyboardFocusManager" + * permission */ protected Window getGlobalFocusedWindow() throws SecurityException { synchronized (KeyboardFocusManager.class) { - if (this == getCurrentKeyboardFocusManager()) { - return focusedWindow; - } else { - if (focusLog.isLoggable(PlatformLogger.FINER)) { - focusLog.finer("This manager is " + this + ", current is " + getCurrentKeyboardFocusManager()); - } - throw new SecurityException(notPrivileged); - } + checkKFMSecurity(); + return focusedWindow; } } @@ -812,15 +839,23 @@ public abstract class KeyboardFocusManager * @see Component#requestFocus() * @see Component#requestFocusInWindow() * @see Window#isFocusableWindow + * @throws SecurityException if this KeyboardFocusManager is not the + * current KeyboardFocusManager for the calling thread's context + * and if the calling thread does not have "replaceKeyboardFocusManager" + * permission * @beaninfo * bound: true */ - protected void setGlobalFocusedWindow(Window focusedWindow) { + protected void setGlobalFocusedWindow(Window focusedWindow) + throws SecurityException + { Window oldFocusedWindow = null; boolean shouldFire = false; if (focusedWindow == null || focusedWindow.isFocusableWindow()) { synchronized (KeyboardFocusManager.class) { + checkKFMSecurity(); + oldFocusedWindow = getFocusedWindow(); try { @@ -874,27 +909,19 @@ public abstract class KeyboardFocusManager * or its children with special decorations, such as a highlighted title * bar. The active Window is always either the focused Window, or the first * Frame or Dialog that is an owner of the focused Window. - *

      - * This method will throw a SecurityException if this KeyboardFocusManager - * is not the current KeyboardFocusManager for the calling thread's - * context. * * @return the active Window * @see #getActiveWindow * @see #setGlobalActiveWindow * @throws SecurityException if this KeyboardFocusManager is not the * current KeyboardFocusManager for the calling thread's context + * and if the calling thread does not have "replaceKeyboardFocusManager" + * permission */ protected Window getGlobalActiveWindow() throws SecurityException { synchronized (KeyboardFocusManager.class) { - if (this == getCurrentKeyboardFocusManager()) { - return activeWindow; - } else { - if (focusLog.isLoggable(PlatformLogger.FINER)) { - focusLog.finer("This manager is " + this + ", current is " + getCurrentKeyboardFocusManager()); - } - throw new SecurityException(notPrivileged); - } + checkKFMSecurity(); + return activeWindow; } } @@ -917,12 +944,20 @@ public abstract class KeyboardFocusManager * @see #getGlobalActiveWindow * @see Component#requestFocus() * @see Component#requestFocusInWindow() + * @throws SecurityException if this KeyboardFocusManager is not the + * current KeyboardFocusManager for the calling thread's context + * and if the calling thread does not have "replaceKeyboardFocusManager" + * permission * @beaninfo * bound: true */ - protected void setGlobalActiveWindow(Window activeWindow) { + protected void setGlobalActiveWindow(Window activeWindow) + throws SecurityException + { Window oldActiveWindow; synchronized (KeyboardFocusManager.class) { + checkKFMSecurity(); + oldActiveWindow = getActiveWindow(); if (focusLog.isLoggable(PlatformLogger.FINER)) { focusLog.finer("Setting global active window to " + activeWindow + ", old active " + oldActiveWindow); @@ -1194,10 +1229,6 @@ public abstract class KeyboardFocusManager * Components represent the next and previous Components to focus during * normal focus traversal. In that case, the current focus cycle root is * used to differentiate among the possibilities. - *

      - * This method will throw a SecurityException if this KeyboardFocusManager - * is not the current KeyboardFocusManager for the calling thread's - * context. * * @return the current focus cycle root, or null if the current focus cycle * root is not a member of the calling thread's context @@ -1205,19 +1236,15 @@ public abstract class KeyboardFocusManager * @see #setGlobalCurrentFocusCycleRoot * @throws SecurityException if this KeyboardFocusManager is not the * current KeyboardFocusManager for the calling thread's context + * and if the calling thread does not have "replaceKeyboardFocusManager" + * permission */ protected Container getGlobalCurrentFocusCycleRoot() throws SecurityException { synchronized (KeyboardFocusManager.class) { - if (this == getCurrentKeyboardFocusManager()) { - return currentFocusCycleRoot; - } else { - if (focusLog.isLoggable(PlatformLogger.FINER)) { - focusLog.finer("This manager is " + this + ", current is " + getCurrentKeyboardFocusManager()); - } - throw new SecurityException(notPrivileged); - } + checkKFMSecurity(); + return currentFocusCycleRoot; } } @@ -1228,16 +1255,27 @@ public abstract class KeyboardFocusManager * In that case, the current focus cycle root is used to differentiate * among the possibilities. *

      + * If a SecurityManager is installed, the calling thread must be granted + * the "replaceKeyboardFocusManager" AWTPermission. If this permission is + * not granted, this method will throw a SecurityException, and the current + * focus cycle root will not be changed. + *

      * This method is intended to be used only by KeyboardFocusManagers and * focus implementations. It is not for general client use. * * @param newFocusCycleRoot the new focus cycle root * @see #getCurrentFocusCycleRoot * @see #getGlobalCurrentFocusCycleRoot + * @throws SecurityException if the calling thread does not have + * "replaceKeyboardFocusManager" permission * @beaninfo * bound: true */ - public void setGlobalCurrentFocusCycleRoot(Container newFocusCycleRoot) { + public void setGlobalCurrentFocusCycleRoot(Container newFocusCycleRoot) + throws SecurityException + { + checkReplaceKFMPermission(); + Container oldFocusCycleRoot; synchronized (KeyboardFocusManager.class) { @@ -3058,4 +3096,39 @@ public abstract class KeyboardFocusManager : null; } } + + private static void checkReplaceKFMPermission() + throws SecurityException + { + SecurityManager security = System.getSecurityManager(); + if (security != null) { + if (replaceKeyboardFocusManagerPermission == null) { + replaceKeyboardFocusManagerPermission = + new AWTPermission("replaceKeyboardFocusManager"); + } + security. + checkPermission(replaceKeyboardFocusManagerPermission); + } + } + + // Checks if this KeyboardFocusManager instance is the current KFM, + // or otherwise checks if the calling thread has "replaceKeyboardFocusManager" + // permission. Here's the reasoning to do so: + // + // A system KFM instance (which is the current KFM by default) may have no + // "replaceKFM" permission when a client code is on the call stack beneath, + // but still it should be able to execute the methods protected by this check + // due to the system KFM is trusted (and so it does like "privileged"). + // + // If this KFM instance is not the current KFM but the client code has all + // permissions we can't throw SecurityException because it would contradict + // the security concepts. In this case the trusted client code is responsible + // for calling the secured methods from KFM instance which is not current. + private void checkKFMSecurity() + throws SecurityException + { + if (this != getCurrentKeyboardFocusManager()) { + checkReplaceKFMPermission(); + } + } } diff --git a/jdk/src/share/classes/java/awt/Window.java b/jdk/src/share/classes/java/awt/Window.java index 1e2ee59a09a..437e806b35c 100644 --- a/jdk/src/share/classes/java/awt/Window.java +++ b/jdk/src/share/classes/java/awt/Window.java @@ -2568,7 +2568,7 @@ public class Window extends Container implements Accessible { } } KeyboardFocusManager.getCurrentKeyboardFocusManager(). - clearGlobalFocusOwner(); + clearGlobalFocusOwnerPriv(); } } From 9190ab1d6bb6c56738cb13cab961f979759c6871 Mon Sep 17 00:00:00 2001 From: Xue-Lei Andrew Fan Date: Mon, 14 May 2012 07:26:53 -0700 Subject: [PATCH 046/128] 7167988: PKIX CertPathBuilder in reverse mode doesn't work if more than one trust anchor is specified Reviewed-by: mullan --- .../provider/certpath/SunCertPathBuilder.java | 4 +- .../certpath/ReverseBuilder/ReverseBuild.java | 345 ++++++++++++++++++ 2 files changed, 348 insertions(+), 1 deletion(-) create mode 100644 jdk/test/sun/security/provider/certpath/ReverseBuilder/ReverseBuild.java diff --git a/jdk/src/share/classes/sun/security/provider/certpath/SunCertPathBuilder.java b/jdk/src/share/classes/sun/security/provider/certpath/SunCertPathBuilder.java index c88c37b3bf7..b3daf348566 100644 --- a/jdk/src/share/classes/sun/security/provider/certpath/SunCertPathBuilder.java +++ b/jdk/src/share/classes/sun/security/provider/certpath/SunCertPathBuilder.java @@ -318,7 +318,9 @@ public final class SunCertPathBuilder extends CertPathBuilderSpi { } // break out of loop if search is successful - break; + if (pathCompleted) { + break; + } } if (debug != null) { diff --git a/jdk/test/sun/security/provider/certpath/ReverseBuilder/ReverseBuild.java b/jdk/test/sun/security/provider/certpath/ReverseBuilder/ReverseBuild.java new file mode 100644 index 00000000000..21736eac623 --- /dev/null +++ b/jdk/test/sun/security/provider/certpath/ReverseBuilder/ReverseBuild.java @@ -0,0 +1,345 @@ +/* + * Copyright (c) 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. + */ + +/* + * @test + * @bug 7167988 + * @summary PKIX CertPathBuilder in reverse mode doesn't work if more than + * one trust anchor is specified + */ +import java.io.*; +import java.util.*; +import java.security.cert.*; + +import sun.security.provider.certpath.SunCertPathBuilderParameters; + +public class ReverseBuild { + // Certificate information: + // Issuer: C=US, ST=Some-State, L=Some-City, O=Some-Org + // Validity + // Not Before: Dec 8 02:43:36 2008 GMT + // Not After : Aug 25 02:43:36 2028 GMT + // Subject: C=US, ST=Some-State, L=Some-City, O=Some-Org + // X509v3 Subject Key Identifier: + // FA:B9:51:BF:4C:E7:D9:86:98:33:F9:E7:CB:1E:F1:33:49:F7:A8:14 + // X509v3 Authority Key Identifier: + // keyid:FA:B9:51:BF:4C:E7:D9:86:98:33:F9:E7:CB:1E:F1:33:49:F7:A8:14 + // DirName:/C=US/ST=Some-State/L=Some-City/O=Some-Org + // serial:00 + static String NoiceTrusedCertStr = + "-----BEGIN CERTIFICATE-----\n" + + "MIICrDCCAhWgAwIBAgIBADANBgkqhkiG9w0BAQQFADBJMQswCQYDVQQGEwJVUzET\n" + + "MBEGA1UECBMKU29tZS1TdGF0ZTESMBAGA1UEBxMJU29tZS1DaXR5MREwDwYDVQQK\n" + + "EwhTb21lLU9yZzAeFw0wODEyMDgwMjQzMzZaFw0yODA4MjUwMjQzMzZaMEkxCzAJ\n" + + "BgNVBAYTAlVTMRMwEQYDVQQIEwpTb21lLVN0YXRlMRIwEAYDVQQHEwlTb21lLUNp\n" + + "dHkxETAPBgNVBAoTCFNvbWUtT3JnMIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKB\n" + + "gQDLxDggB76Ip5OwoUNRLdeOha9U3a2ieyNbz5kTU5lFfe5tui2/461uPZ8a+QOX\n" + + "4BdVrhEmV94BKY4FPyH35zboLjfXSKxT1mAOx1Bt9sWF94umxZE1cjyU7vEX8HHj\n" + + "7BvOyk5AQrBt7moO1uWtPA/JuoJPePiJl4kqlRJM2Akq6QIDAQABo4GjMIGgMB0G\n" + + "A1UdDgQWBBT6uVG/TOfZhpgz+efLHvEzSfeoFDBxBgNVHSMEajBogBT6uVG/TOfZ\n" + + "hpgz+efLHvEzSfeoFKFNpEswSTELMAkGA1UEBhMCVVMxEzARBgNVBAgTClNvbWUt\n" + + "U3RhdGUxEjAQBgNVBAcTCVNvbWUtQ2l0eTERMA8GA1UEChMIU29tZS1PcmeCAQAw\n" + + "DAYDVR0TBAUwAwEB/zANBgkqhkiG9w0BAQQFAAOBgQBcIm534U123Hz+rtyYO5uA\n" + + "ofd81G6FnTfEAV8Kw9fGyyEbQZclBv34A9JsFKeMvU4OFIaixD7nLZ/NZ+IWbhmZ\n" + + "LovmJXyCkOufea73pNiZ+f/4/ScZaIlM/PRycQSqbFNd4j9Wott+08qxHPLpsf3P\n" + + "6Mvf0r1PNTY2hwTJLJmKtg==\n" + + "-----END CERTIFICATE-----"; + + // Certificate information: + // Issuer: C=US, O=Java, OU=SunJSSE Test Serivce + // Validity + // Not Before: Aug 19 01:52:19 2011 GMT + // Not After : Jul 29 01:52:19 2032 GMT + // Subject: C=US, O=Java, OU=SunJSSE Test Serivce + + // X509v3 Subject Key Identifier: + // B9:7C:D5:D9:DF:A7:4C:03:AE:FD:0E:27:5B:31:95:6C:C7:F3:75:E1 + // X509v3 Authority Key Identifier: + // keyid:B9:7C:D5:D9:DF:A7:4C:03:AE:FD:0E:27:5B:31:95:6C:C7:F3:75:E1 + // DirName:/C=US/O=Java/OU=SunJSSE Test Serivce + // serial:00 + static String NoiceTrusedCertStr_2nd = + "-----BEGIN CERTIFICATE-----\n" + + "MIICkjCCAfugAwIBAgIBADANBgkqhkiG9w0BAQQFADA7MQswCQYDVQQGEwJVUzEN\n" + + "MAsGA1UEChMESmF2YTEdMBsGA1UECxMUU3VuSlNTRSBUZXN0IFNlcml2Y2UwHhcN\n" + + "MTEwODE5MDE1MjE5WhcNMzIwNzI5MDE1MjE5WjA7MQswCQYDVQQGEwJVUzENMAsG\n" + + "A1UEChMESmF2YTEdMBsGA1UECxMUU3VuSlNTRSBUZXN0IFNlcml2Y2UwgZ8wDQYJ\n" + + "KoZIhvcNAQEBBQADgY0AMIGJAoGBAM8orG08DtF98TMSscjGsidd1ZoN4jiDpi8U\n" + + "ICz+9dMm1qM1d7O2T+KH3/mxyox7Rc2ZVSCaUD0a3CkhPMnlAx8V4u0H+E9sqso6\n" + + "iDW3JpOyzMExvZiRgRG/3nvp55RMIUV4vEHOZ1QbhuqG4ebN0Vz2DkRft7+flthf\n" + + "vDld6f5JAgMBAAGjgaUwgaIwHQYDVR0OBBYEFLl81dnfp0wDrv0OJ1sxlWzH83Xh\n" + + "MGMGA1UdIwRcMFqAFLl81dnfp0wDrv0OJ1sxlWzH83XhoT+kPTA7MQswCQYDVQQG\n" + + "EwJVUzENMAsGA1UEChMESmF2YTEdMBsGA1UECxMUU3VuSlNTRSBUZXN0IFNlcml2\n" + + "Y2WCAQAwDwYDVR0TAQH/BAUwAwEB/zALBgNVHQ8EBAMCAQYwDQYJKoZIhvcNAQEE\n" + + "BQADgYEALlgaH1gWtoBZ84EW8Hu6YtGLQ/L9zIFmHonUPZwn3Pr//icR9Sqhc3/l\n" + + "pVTxOINuFHLRz4BBtEylzRIOPzK3tg8XwuLb1zd0db90x3KBCiAL6E6cklGEPwLe\n" + + "XYMHDn9eDsaq861Tzn6ZwzMgw04zotPMoZN0mVd/3Qca8UJFucE=\n" + + "-----END CERTIFICATE-----"; + + + // Certificate information: + // Issuer: C=US, O=Java, OU=SunJSSE Test Serivce + // Validity + // Not Before: May 5 02:40:50 2012 GMT + // Not After : Apr 15 02:40:50 2033 GMT + // Subject: C=US, O=Java, OU=SunJSSE Test Serivce + // X509v3 Subject Key Identifier: + // DD:4E:8D:2A:11:C0:83:03:F0:AC:EB:A2:BF:F9:F2:7D:C8:69:1F:9B + // X509v3 Authority Key Identifier: + // keyid:DD:4E:8D:2A:11:C0:83:03:F0:AC:EB:A2:BF:F9:F2:7D:C8:69:1F:9B + // DirName:/C=US/O=Java/OU=SunJSSE Test Serivce + // serial:00 + static String trustedCertStr = + "-----BEGIN CERTIFICATE-----\n" + + "MIICkjCCAfugAwIBAgIBADANBgkqhkiG9w0BAQIFADA7MQswCQYDVQQGEwJVUzEN\n" + + "MAsGA1UEChMESmF2YTEdMBsGA1UECxMUU3VuSlNTRSBUZXN0IFNlcml2Y2UwHhcN\n" + + "MTIwNTA1MDI0MDUwWhcNMzMwNDE1MDI0MDUwWjA7MQswCQYDVQQGEwJVUzENMAsG\n" + + "A1UEChMESmF2YTEdMBsGA1UECxMUU3VuSlNTRSBUZXN0IFNlcml2Y2UwgZ8wDQYJ\n" + + "KoZIhvcNAQEBBQADgY0AMIGJAoGBANtiq0AIJK+iVRwFrqcD7fYXTCbMYC5Qz/k6\n" + + "AXBy7/1rI8wDhEJLE3m/+NSqiJwZcmdq2dNh/1fJFrwvzuURbc9+paOBWeHbN+Sc\n" + + "x3huw91oPZme385VpoK3G13rSE114S/rF4DM9mz4EStFhSHXATjtdbskNOAYGLTV\n" + + "x8uEy9GbAgMBAAGjgaUwgaIwHQYDVR0OBBYEFN1OjSoRwIMD8Kzror/58n3IaR+b\n" + + "MGMGA1UdIwRcMFqAFN1OjSoRwIMD8Kzror/58n3IaR+boT+kPTA7MQswCQYDVQQG\n" + + "EwJVUzENMAsGA1UEChMESmF2YTEdMBsGA1UECxMUU3VuSlNTRSBUZXN0IFNlcml2\n" + + "Y2WCAQAwDwYDVR0TAQH/BAUwAwEB/zALBgNVHQ8EBAMCAQYwDQYJKoZIhvcNAQEC\n" + + "BQADgYEAjjkJesQrkbr36N40egybaIxw7RcqT6iy5fkAGS1JYlBDk8uSCK1o6bCH\n" + + "ls5EpYcGeEoabSS73WRdkO1lgeyWDduO4ef8cCCSpmpT6/YdZG0QS1PtcREeVig+\n" + + "Zr25jNemS4ADHX0aaXP4kiV/G80cR7nX5t5XCUm4bYdbwM07NgI=\n" + + "-----END CERTIFICATE-----"; + static String trustedPrivateKey = // Private key in the format of PKCS#8 + "MIICeAIBADANBgkqhkiG9w0BAQEFAASCAmIwggJeAgEAAoGBANtiq0AIJK+iVRwF\n" + + "rqcD7fYXTCbMYC5Qz/k6AXBy7/1rI8wDhEJLE3m/+NSqiJwZcmdq2dNh/1fJFrwv\n" + + "zuURbc9+paOBWeHbN+Scx3huw91oPZme385VpoK3G13rSE114S/rF4DM9mz4EStF\n" + + "hSHXATjtdbskNOAYGLTVx8uEy9GbAgMBAAECgYEA2VjHkIiA0ABjkX+PqKeb+VLb\n" + + "fxS7tSca5C8zfdRhLxAWRui0/3ihst0eCJNrBDuxvAOACovsDWyLuaUjtI2v2ysz\n" + + "vz6SPyGy82PhQOFzyKQuQ814N6EpothpiZzF0yFchfKIGhUsdY89UrGs9nM7m6NT\n" + + "rztYvgIu4avg2VPR2AECQQD+pFAqipR2BplQRIuuRSZfHRxvoEyDjT1xnHJsC6WP\n" + + "I5hCLghL91MhQGWbP4EJMKYQOTRVukWlcp2Kycpf+P5hAkEA3I43gmVUAPEdyZdY\n" + + "fatW7OaLlbbYJb6qEtpCZ1Rwe/BIvm6H6E3qSi/lpz7Ia7WDulpbF6BawHH3pRFq\n" + + "CUY5ewJBAP3pUDqrRpBN0jB0uSeDslhjSciQ+dqvSpZv3rSYBHUvlBJhnkpJiy37\n" + + "7ZUZhIxqYxyIPgRBolLwb+FFh7OdL+ECQCtldDic9WVmC+VheRDpCKZ+SlK/8lGi\n" + + "7VXeShiIvcU1JysJFoa35fSI7hf1O3wt7+hX5PqGG7Un94EsJwACKEcCQQC1TWt6\n" + + "ArKH6tRxKjOxFtqfs8fgEVYUaOr3j1jF4KBUuX2mtQtddZe3VfJ2wPsuKMMxmhkB\n" + + "e7xWWZnJsErt2e+E"; + + // Certificate information: + // Issuer: C=US, O=Java, OU=SunJSSE Test Serivce + // Validity + // Not Before: May 5 02:40:53 2012 GMT + // Not After : Jan 21 02:40:53 2032 GMT + // Subject: C=US, O=Java, OU=SunJSSE Test Serivce, CN=casigner + // X509v3 Subject Key Identifier: + // 13:07:E0:11:07:DB:EB:33:23:87:31:D0:DB:7E:16:56:BE:11:90:0A + // X509v3 Authority Key Identifier: + // keyid:DD:4E:8D:2A:11:C0:83:03:F0:AC:EB:A2:BF:F9:F2:7D:C8:69:1F:9B + // DirName:/C=US/O=Java/OU=SunJSSE Test Serivce + // serial:00 + static String caSignerStr = + "-----BEGIN CERTIFICATE-----\n" + + "MIICqDCCAhGgAwIBAgIBAjANBgkqhkiG9w0BAQQFADA7MQswCQYDVQQGEwJVUzEN\n" + + "MAsGA1UEChMESmF2YTEdMBsGA1UECxMUU3VuSlNTRSBUZXN0IFNlcml2Y2UwHhcN\n" + + "MTIwNTA1MDI0MDUzWhcNMzIwMTIxMDI0MDUzWjBOMQswCQYDVQQGEwJVUzENMAsG\n" + + "A1UEChMESmF2YTEdMBsGA1UECxMUU3VuSlNTRSBUZXN0IFNlcml2Y2UxETAPBgNV\n" + + "BAMTCGNhc2lnbmVyMIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQC+x8+o7oM0\n" + + "ct/LZmZLXBL4CQ8jrULD5P7NtEW0hg/zxBFZfBHf+44Oo2eMPYZj+7xaREOH5BmV\n" + + "KRYlzRtONAaC5Ng4Mrm5UKNPcMIIUjUOvm7vWM4oSTMSfoEcSX+vp99uUAkw3w7Z\n" + + "+frYDm1M4At/j0b+lLij71GFN2L8drpgPQIDAQABo4GoMIGlMB0GA1UdDgQWBBQT\n" + + "B+ARB9vrMyOHMdDbfhZWvhGQCjBjBgNVHSMEXDBagBTdTo0qEcCDA/Cs66K/+fJ9\n" + + "yGkfm6E/pD0wOzELMAkGA1UEBhMCVVMxDTALBgNVBAoTBEphdmExHTAbBgNVBAsT\n" + + "FFN1bkpTU0UgVGVzdCBTZXJpdmNlggEAMBIGA1UdEwEB/wQIMAYBAf8CAQEwCwYD\n" + + "VR0PBAQDAgEGMA0GCSqGSIb3DQEBBAUAA4GBAI+LXA/UCPkTANablUkt80JNPWsl\n" + + "pS4XLNgPxWaN0bkRDs5oI4ooWAz1rwpeJ/nfetOvWlpmrVjSeovBFja5Hl+dUHTf\n" + + "VfuyzkxXbhuNiJIpo1mVBpNsjwu9YRxuwX6UA2LTUQpgvtVJEE012x3zRvxBCbu2\n" + + "Y/v1R5fZ4c+hXDfC\n" + + "-----END CERTIFICATE-----"; + static String caSignerPrivateKey = // Private key in the format of PKCS#8 + "MIICdgIBADANBgkqhkiG9w0BAQEFAASCAmAwggJcAgEAAoGBAL7Hz6jugzRy38tm\n" + + "ZktcEvgJDyOtQsPk/s20RbSGD/PEEVl8Ed/7jg6jZ4w9hmP7vFpEQ4fkGZUpFiXN\n" + + "G040BoLk2DgyublQo09wwghSNQ6+bu9YzihJMxJ+gRxJf6+n325QCTDfDtn5+tgO\n" + + "bUzgC3+PRv6UuKPvUYU3Yvx2umA9AgMBAAECgYBYvu30cW8LONyt62Zua9hPFTe7\n" + + "qt9B7QYyfkdmoG5PQMepTrOp84SzfoOukvgvDm0huFuJnSvhXQl2cCDhkgXskvFj\n" + + "Hh7KBCFViVXokGdq5YoS0/KYMyQV0TZfJUvILBl51uc4/siQ2tClC/N4sa+1JhgW\n" + + "a6dFGfRjiUKSSlmMwQJBAPWpIz3Q/c+DYMvoQr5OD8EaYwYIevlTdXb97RnJJh2b\n" + + "UnhB9jrqesJiHYVzPmP0ukyPOXOwlp2T5Am4Kw0LFOkCQQDGz150NoHOp28Mvyc4\n" + + "CTqz/zYzUhy2eCJESl196uyP4N65Y01VYQ3JDww4DlsXiU17tVSbgA9TCcfTYOzy\n" + + "vyw1AkARUky+1hafZCcWGZljK8PmnMKwsTZikCTvL/Zg5BMA8Wu+OQBwpQnk3OAy\n" + + "Aa87gw0DyvGFG8Vy9POWT9sRP1/JAkBqP0hrMvYMSs6+MSn0eHo2151PsAJIQcuO\n" + + "U2/Da1khSzu8N6WMi2GiobgV/RYRbf9KrY2ZzMZjykZQYOxAjopBAkEAghCu38cN\n" + + "aOsW6ueo24uzsWI1FTdE+qWNVEi3RSP120xXBCyhaBjIq4WVSlJK9K2aBaJpit3j\n" + + "iQ5tl6zrLlxQhg=="; + + // Certificate information: + // Issuer: C=US, O=Java, OU=SunJSSE Test Serivce, CN=casigner + // Validity + // Not Before: May 5 02:40:57 2012 GMT + // Not After : Jan 21 02:40:57 2032 GMT + // Subject: C=US, O=Java, OU=SunJSSE Test Serivce, CN=certissuer + // X509v3 Subject Key Identifier: + // 39:0E:C6:33:B1:50:BC:73:07:31:E5:D8:04:F7:BB:97:55:CF:9B:C8 + // X509v3 Authority Key Identifier: + // keyid:13:07:E0:11:07:DB:EB:33:23:87:31:D0:DB:7E:16:56:BE:11:90:0A + // DirName:/C=US/O=Java/OU=SunJSSE Test Serivce + // serial:02 + static String certIssuerStr = + "-----BEGIN CERTIFICATE-----\n" + + "MIICvjCCAiegAwIBAgIBAzANBgkqhkiG9w0BAQQFADBOMQswCQYDVQQGEwJVUzEN\n" + + "MAsGA1UEChMESmF2YTEdMBsGA1UECxMUU3VuSlNTRSBUZXN0IFNlcml2Y2UxETAP\n" + + "BgNVBAMTCGNhc2lnbmVyMB4XDTEyMDUwNTAyNDA1N1oXDTMyMDEyMTAyNDA1N1ow\n" + + "UDELMAkGA1UEBhMCVVMxDTALBgNVBAoTBEphdmExHTAbBgNVBAsTFFN1bkpTU0Ug\n" + + "VGVzdCBTZXJpdmNlMRMwEQYDVQQDEwpjZXJ0aXNzdWVyMIGfMA0GCSqGSIb3DQEB\n" + + "AQUAA4GNADCBiQKBgQCyz55zinU6kNL/LeiTNiBI0QWYmDG0YTotuC4D75liBNqs\n" + + "7Mmladsh2mTtQUAwmuGaGzaZV25a+cUax0DXZoyBwdbTI09u1bUYsZcaUUKbPoCC\n" + + "HH26e4jLFL4olW13Sv4ZAd57tIYevMw+Fp5f4fLPFGegCJTFlv2Qjpmic/cuvQID\n" + + "AQABo4GpMIGmMB0GA1UdDgQWBBQ5DsYzsVC8cwcx5dgE97uXVc+byDBjBgNVHSME\n" + + "XDBagBQTB+ARB9vrMyOHMdDbfhZWvhGQCqE/pD0wOzELMAkGA1UEBhMCVVMxDTAL\n" + + "BgNVBAoTBEphdmExHTAbBgNVBAsTFFN1bkpTU0UgVGVzdCBTZXJpdmNlggECMBMG\n" + + "A1UdEwEB/wQJMAcBAf8CAgQAMAsGA1UdDwQEAwIBBjANBgkqhkiG9w0BAQQFAAOB\n" + + "gQCQTagenCdClT98C+oTJGJrw/dUBD9K3tE6ZJKPMc/2bUia8G5ei1C0eXj4mWG2\n" + + "lu9umR6C90/A6qB050QB2h50qtqxSrkpu+ym1yypauZpg7U3nUY9wZWJNI1vqrQZ\n" + + "pqUMRcXY3iQIVKx+Qj+4/Za1wwFQzpEoGmqRW31V1SdMEw==\n" + + "-----END CERTIFICATE-----"; + static String certIssuerPrivateKey = // Private key in the format of PKCS#8 + "MIICeQIBADANBgkqhkiG9w0BAQEFAASCAmMwggJfAgEAAoGBALLPnnOKdTqQ0v8t\n" + + "6JM2IEjRBZiYMbRhOi24LgPvmWIE2qzsyaVp2yHaZO1BQDCa4ZobNplXblr5xRrH\n" + + "QNdmjIHB1tMjT27VtRixlxpRQps+gIIcfbp7iMsUviiVbXdK/hkB3nu0hh68zD4W\n" + + "nl/h8s8UZ6AIlMWW/ZCOmaJz9y69AgMBAAECgYEAjtew2tgm4gxDojqIauF4VPM1\n" + + "pzsdqd1p3pAdomNLgrQiBLZ8N7oiph6TNb1EjA+OXc+ThFgF/oM9ZDD8qZZwcvjN\n" + + "qDZlpTkFs2TaGcyEZfUaMB45NHVs6Nn+pSkagSNwwy3xeyAct7sQEzGNTDlEwVv5\n" + + "7V9LQutQtBd6xT48KzkCQQDpNRfv2OFNG/6GtzJoO68oJhpnpl2MsYNi4ntRkre/\n" + + "6uXpiCYaDskcrPMRwOOs0m7mxG+Ev+uKnLnSoEMm1GCbAkEAxEmDtiD0Psb8Z9BL\n" + + "ZRb83Jqho3xe2MCAh3xUfz9b/Mhae9dZ44o4OCgQZuwvW1mczF0NtpgZl93BmYa2\n" + + "hTwHhwJBAKHrEj6ep/fA6x0gD2idoATRR94VfbiU+7NpqtO9ecVP0+gsdr/66hn1\n" + + "3yLBeZLh3MxvMTrLgkAQh1i9m0JXjOcCQQClLXAHHegrw+u3uNMZeKTFR+Lp3sk6\n" + + "AZSnbvr0Me9I45kxSeG81x3ENALJecvIRbrrRws5MvmmkNhQR8rkh8WVAkEAk6b+\n" + + "aVtmBgUaTS5+FFlHGHJY9HFrfT1a1C/dwyMuqlmbC3YsBmZaMOlKli5TXNybLff8\n" + + "5KMeGEpXMzgC7AscGA=="; + + // Certificate information: + // Issuer: C=US, O=Java, OU=SunJSSE Test Serivce, CN=certissuer + // Validity + // Not Before: May 5 02:41:01 2012 GMT + // Not After : Jan 21 02:41:01 2032 GMT + // Subject: C=US, O=Java, OU=SunJSSE Test Serivce, CN=localhost + // X509v3 Subject Key Identifier: + // AD:C0:2C:4C:E4:C2:2E:A1:BB:5D:92:BE:66:E0:4E:E0:0D:2F:11:EF + // X509v3 Authority Key Identifier: + // keyid:39:0E:C6:33:B1:50:BC:73:07:31:E5:D8:04:F7:BB:97:55:CF:9B:C8 + static String targetCertStr = + "-----BEGIN CERTIFICATE-----\n" + + "MIICjTCCAfagAwIBAgIBBDANBgkqhkiG9w0BAQQFADBQMQswCQYDVQQGEwJVUzEN\n" + + "MAsGA1UEChMESmF2YTEdMBsGA1UECxMUU3VuSlNTRSBUZXN0IFNlcml2Y2UxEzAR\n" + + "BgNVBAMTCmNlcnRpc3N1ZXIwHhcNMTIwNTA1MDI0MTAxWhcNMzIwMTIxMDI0MTAx\n" + + "WjBPMQswCQYDVQQGEwJVUzENMAsGA1UEChMESmF2YTEdMBsGA1UECxMUU3VuSlNT\n" + + "RSBUZXN0IFNlcml2Y2UxEjAQBgNVBAMTCWxvY2FsaG9zdDCBnzANBgkqhkiG9w0B\n" + + "AQEFAAOBjQAwgYkCgYEAvwaUd7wmBSKqycEstYLWD26vkU08DM39EtaT8wL9HnQ0\n" + + "fgPblwBFI4zdLa2cuYXRZcFUb04N8nrkcpR0D6kkE+AlFAoRWrrZF80B7JTbtEK4\n" + + "1PIeurihXvUT+4MpzGLOojIihMfvM4ufelblD56SInso4WFHm7t4qCln88J1gjkC\n" + + "AwEAAaN4MHYwCwYDVR0PBAQDAgPoMB0GA1UdDgQWBBStwCxM5MIuobtdkr5m4E7g\n" + + "DS8R7zAfBgNVHSMEGDAWgBQ5DsYzsVC8cwcx5dgE97uXVc+byDAnBgNVHSUEIDAe\n" + + "BggrBgEFBQcDAQYIKwYBBQUHAwIGCCsGAQUFBwMDMA0GCSqGSIb3DQEBBAUAA4GB\n" + + "AGfwcfdvEG/nSCiAn2MGbYHp34mgF3OA1SJLWUW0LvWJhwm2cn4AXlSoyvbwrkaB\n" + + "IDDCwhJvvc0vUyL2kTx7sqVaFTq3mDs+ktlB/FfH0Pb+i8FE+g+7T42Iw/j0qxHL\n" + + "YmgbrjBQf5WYN1AvBE/rrPt9aOtS3UsqtVGW574b0shW\n" + + "-----END CERTIFICATE-----"; + static String targetPrivateKey = // Private key in the format of PKCS#8 + "MIICdAIBADANBgkqhkiG9w0BAQEFAASCAl4wggJaAgEAAoGBAL8GlHe8JgUiqsnB\n" + + "LLWC1g9ur5FNPAzN/RLWk/MC/R50NH4D25cARSOM3S2tnLmF0WXBVG9ODfJ65HKU\n" + + "dA+pJBPgJRQKEVq62RfNAeyU27RCuNTyHrq4oV71E/uDKcxizqIyIoTH7zOLn3pW\n" + + "5Q+ekiJ7KOFhR5u7eKgpZ/PCdYI5AgMBAAECf3CscOYvFD3zNMnMJ5LomVqA7w3F\n" + + "gKYM2jlCWAH+wU41PMEXhW6Lujw92jgXL1o+lERwxFzirVdZJWZwKgUSvzP1G0h3\n" + + "fkucq1/UWnToK+8NSXNM/yS8hXbBgSEoJo5f7LKcIi1Ev6doBVofMxs+njzyWKbM\n" + + "Nb7rOLHadghoon0CQQDgQzbzzSN8Dc1YmmylhI5v+0sQRHH0DL7D24k4Weh4vInG\n" + + "EAbt4x8M7ZKEo8/dv0s4hbmNmAnJl93/RRxIyEqLAkEA2g87DiswSQam2pZ8GlrO\n" + + "+w4Qg9mH8uxx8ou2rl0XlHzH1XiTNbkjfY0EZoL7L31BHFk9n11Fb2P85g6ws+Hy\n" + + "ywJAM/xgyLNM/nzUlS128geAXUULaYH0SHaL4isJ7B4rXZGW/mrIsGxtzjlkNYsj\n" + + "rGujrD6TfNc5rZmexIXowJZtcQJBAIww+pCzZ4mrgx5JXWQ8OZHiiu+ZrPOa2+9J\n" + + "r5sOMpi+WGN/73S8oHqZbNjTINZ5OqEVJq8MchWZPQBTNXuQql0CQHEjUzzkCQa3\n" + + "j6JTa2KAdqyvLOx0XF9zcc1gA069uNQI2gPUHS8V215z57f/gMGnDNhVfLs/vMKz\n" + + "sFkVZ3zg7As="; + + + public static void main(String args[]) throws Exception { + + // generate certificate from cert string + CertificateFactory cf = CertificateFactory.getInstance("X.509"); + + // create a set of trust anchors + LinkedHashSet trustAnchors = new LinkedHashSet<>(); + + ByteArrayInputStream is = + new ByteArrayInputStream(NoiceTrusedCertStr.getBytes()); + Certificate trustedCert = cf.generateCertificate(is); + is.close(); + TrustAnchor anchor = + new TrustAnchor((X509Certificate)trustedCert, null); + trustAnchors.add(anchor); + + is = new ByteArrayInputStream(trustedCertStr.getBytes()); + trustedCert = cf.generateCertificate(is); + is.close(); + anchor = new TrustAnchor((X509Certificate)trustedCert, null); + trustAnchors.add(anchor); + + is = new ByteArrayInputStream(NoiceTrusedCertStr_2nd.getBytes()); + trustedCert = cf.generateCertificate(is); + is.close(); + anchor = new TrustAnchor((X509Certificate)trustedCert, null); + trustAnchors.add(anchor); + + // create a list of certificates + List chainList = new ArrayList<>(); + + is = new ByteArrayInputStream(targetCertStr.getBytes()); + Certificate cert = cf.generateCertificate(is); + is.close(); + chainList.add(cert); + + is = new ByteArrayInputStream(certIssuerStr.getBytes()); + cert = cf.generateCertificate(is); + is.close(); + chainList.add(cert); + + is = new ByteArrayInputStream(caSignerStr.getBytes()); + cert = cf.generateCertificate(is); + is.close(); + chainList.add(cert); + + // create a certificate selector + X509CertSelector xcs = new X509CertSelector(); + X509Certificate eeCert = (X509Certificate)chainList.get(0); + xcs.setSubject(eeCert.getSubjectX500Principal()); + + // reverse build + SunCertPathBuilderParameters params = + new SunCertPathBuilderParameters(trustAnchors, xcs); + params.setBuildForward(false); + params.setRevocationEnabled(false); + + CollectionCertStoreParameters ccsp = + new CollectionCertStoreParameters(chainList); + params.addCertStore(CertStore.getInstance("Collection", ccsp)); + + CertPathBuilder cpb = CertPathBuilder.getInstance("PKIX"); + CertPathBuilderResult res = cpb.build(params); + } +} From b68794be17d8e9e72604c451e91fe983d34f7086 Mon Sep 17 00:00:00 2001 From: Bengt Rutisson Date: Mon, 14 May 2012 17:32:17 +0200 Subject: [PATCH 047/128] 7161545: G1: Minor cleanups to the G1 logging Rename "to-space-overflow" to "to-space-exhausted", Introduce one decimal point in the size format, Add Sum to the aggregate and re-order the entries, Add number of GC workers to the log output Reviewed-by: johnc, jwilhelm --- .../gc_implementation/g1/g1CollectedHeap.cpp | 2 +- .../g1/g1CollectorPolicy.cpp | 59 +++++++++---------- .../g1/g1CollectorPolicy.hpp | 4 +- .../share/vm/utilities/globalDefinitions.hpp | 10 ++-- 4 files changed, 36 insertions(+), 39 deletions(-) diff --git a/hotspot/src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp b/hotspot/src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp index 270e52e32b4..fa71befcfe8 100644 --- a/hotspot/src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp +++ b/hotspot/src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp @@ -5502,7 +5502,7 @@ void G1CollectedHeap::evacuate_collection_set() { if (evacuation_failed()) { remove_self_forwarding_pointers(); if (G1Log::finer()) { - gclog_or_tty->print(" (to-space overflow)"); + gclog_or_tty->print(" (to-space exhausted)"); } else if (G1Log::fine()) { gclog_or_tty->print("--"); } diff --git a/hotspot/src/share/vm/gc_implementation/g1/g1CollectorPolicy.cpp b/hotspot/src/share/vm/gc_implementation/g1/g1CollectorPolicy.cpp index a4060618131..05dea1c4854 100644 --- a/hotspot/src/share/vm/gc_implementation/g1/g1CollectorPolicy.cpp +++ b/hotspot/src/share/vm/gc_implementation/g1/g1CollectorPolicy.cpp @@ -1010,7 +1010,8 @@ T sum_of(T* sum_arr, int start, int n, int N) { void G1CollectorPolicy::print_par_stats(int level, const char* str, - double* data) { + double* data, + bool showDecimals) { double min = data[0], max = data[0]; double total = 0.0; LineBuffer buf(level); @@ -1023,7 +1024,11 @@ void G1CollectorPolicy::print_par_stats(int level, max = val; total += val; if (G1Log::finest()) { - buf.append(" %.1lf", val); + if (showDecimals) { + buf.append(" %.1lf", val); + } else { + buf.append(" %d", (int)val); + } } } @@ -1031,36 +1036,26 @@ void G1CollectorPolicy::print_par_stats(int level, buf.append_and_print_cr(""); } double avg = total / (double) no_of_gc_threads(); - buf.append_and_print_cr(" Avg: %.1lf Min: %.1lf Max: %.1lf Diff: %.1lf]", - avg, min, max, max - min); -} - -void G1CollectorPolicy::print_par_sizes(int level, - const char* str, - double* data) { - double min = data[0], max = data[0]; - double total = 0.0; - LineBuffer buf(level); - buf.append("[%s :", str); - for (uint i = 0; i < no_of_gc_threads(); ++i) { - double val = data[i]; - if (val < min) - min = val; - if (val > max) - max = val; - total += val; - buf.append(" %d", (int) val); + if (showDecimals) { + buf.append_and_print_cr(" Min: %.1lf, Avg: %.1lf, Max: %.1lf, Diff: %.1lf, Sum: %.1lf]", + min, avg, max, max - min, total); + } else { + buf.append_and_print_cr(" Min: %d, Avg: %d, Max: %d, Diff: %d, Sum: %d]", + (int)min, (int)avg, (int)max, (int)max - (int)min, (int)total); } - buf.append_and_print_cr(""); - double avg = total / (double) no_of_gc_threads(); - buf.append_and_print_cr(" Sum: %d, Avg: %d, Min: %d, Max: %d, Diff: %d]", - (int)total, (int)avg, (int)min, (int)max, (int)max - (int)min); } void G1CollectorPolicy::print_stats(int level, const char* str, double value) { - LineBuffer(level).append_and_print_cr("[%s: %5.1lf ms]", str, value); + LineBuffer(level).append_and_print_cr("[%s: %.1lf ms]", str, value); +} + +void G1CollectorPolicy::print_stats(int level, + const char* str, + double value, + int workers) { + LineBuffer(level).append_and_print_cr("[%s: %.1lf ms, GC Workers: %d]", str, value, workers); } void G1CollectorPolicy::print_stats(int level, @@ -1373,7 +1368,7 @@ void G1CollectorPolicy::record_collection_pause_end(int no_of_gc_threads) { print_stats(1, "Root Region Scan Waiting", _root_region_scan_wait_time_ms); } if (parallel) { - print_stats(1, "Parallel Time", _cur_collection_par_time_ms); + print_stats(1, "Parallel Time", _cur_collection_par_time_ms, no_of_gc_threads); print_par_stats(2, "GC Worker Start", _par_last_gc_worker_start_times_ms); print_par_stats(2, "Ext Root Scanning", _par_last_ext_root_scan_times_ms); if (print_marking_info) { @@ -1381,13 +1376,15 @@ void G1CollectorPolicy::record_collection_pause_end(int no_of_gc_threads) { } print_par_stats(2, "Update RS", _par_last_update_rs_times_ms); if (G1Log::finest()) { - print_par_sizes(3, "Processed Buffers", _par_last_update_rs_processed_buffers); + print_par_stats(3, "Processed Buffers", _par_last_update_rs_processed_buffers, + false /* showDecimals */); } print_par_stats(2, "Scan RS", _par_last_scan_rs_times_ms); print_par_stats(2, "Object Copy", _par_last_obj_copy_times_ms); print_par_stats(2, "Termination", _par_last_termination_times_ms); if (G1Log::finest()) { - print_par_sizes(3, "Termination Attempts", _par_last_termination_attempts); + print_par_stats(3, "Termination Attempts", _par_last_termination_attempts, + false /* showDecimals */); } for (int i = 0; i < _parallel_gc_threads; i++) { @@ -1601,9 +1598,9 @@ void G1CollectorPolicy::record_collection_pause_end(int no_of_gc_threads) { _collectionSetChooser->verify(); } -#define EXT_SIZE_FORMAT "%d%s" +#define EXT_SIZE_FORMAT "%.1f%s" #define EXT_SIZE_PARAMS(bytes) \ - byte_size_in_proper_unit((bytes)), \ + byte_size_in_proper_unit((double)(bytes)), \ proper_unit_for_byte_size((bytes)) void G1CollectorPolicy::print_heap_transition() { diff --git a/hotspot/src/share/vm/gc_implementation/g1/g1CollectorPolicy.hpp b/hotspot/src/share/vm/gc_implementation/g1/g1CollectorPolicy.hpp index 7cdf79d7feb..88069816ef6 100644 --- a/hotspot/src/share/vm/gc_implementation/g1/g1CollectorPolicy.hpp +++ b/hotspot/src/share/vm/gc_implementation/g1/g1CollectorPolicy.hpp @@ -552,10 +552,10 @@ public: private: void print_stats(int level, const char* str, double value); + void print_stats(int level, const char* str, double value, int workers); void print_stats(int level, const char* str, int value); - void print_par_stats(int level, const char* str, double* data); - void print_par_sizes(int level, const char* str, double* data); + void print_par_stats(int level, const char* str, double* data, bool showDecimals = true); void check_other_times(int level, NumberSeq* other_times_ms, diff --git a/hotspot/src/share/vm/utilities/globalDefinitions.hpp b/hotspot/src/share/vm/utilities/globalDefinitions.hpp index 89201f62f92..55904058bf8 100644 --- a/hotspot/src/share/vm/utilities/globalDefinitions.hpp +++ b/hotspot/src/share/vm/utilities/globalDefinitions.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 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 @@ -188,17 +188,17 @@ inline const char* proper_unit_for_byte_size(size_t s) { } } -inline size_t byte_size_in_proper_unit(size_t s) { +template +inline T byte_size_in_proper_unit(T s) { if (s >= 10*M) { - return s/M; + return (T)(s/M); } else if (s >= 10*K) { - return s/K; + return (T)(s/K); } else { return s; } } - //---------------------------------------------------------------------------------------------------- // VM type definitions From eb4a860bc319bd60d19dcaaf3ac8fcce2747dd19 Mon Sep 17 00:00:00 2001 From: Vladimir Kozlov Date: Mon, 14 May 2012 09:36:00 -0700 Subject: [PATCH 048/128] 6924259: Remove String.count/String.offset Allow a version of String class that doesn't have count and offset fields. Reviewed-by: never, coleenp --- .../cpu/sparc/vm/c1_LIRAssembler_sparc.cpp | 56 +++-- .../src/cpu/x86/vm/c1_LIRAssembler_x86.cpp | 25 ++- .../src/share/vm/classfile/javaClasses.cpp | 42 ++-- .../src/share/vm/classfile/javaClasses.hpp | 82 +++++-- .../share/vm/classfile/systemDictionary.cpp | 3 + hotspot/src/share/vm/classfile/vmSymbols.hpp | 3 + hotspot/src/share/vm/memory/dump.cpp | 4 +- hotspot/src/share/vm/opto/graphKit.cpp | 80 ++++++- hotspot/src/share/vm/opto/graphKit.hpp | 10 +- hotspot/src/share/vm/opto/library_call.cpp | 201 ++++++++++-------- hotspot/src/share/vm/opto/stringopts.cpp | 45 ++-- hotspot/src/share/vm/opto/stringopts.hpp | 5 +- 12 files changed, 365 insertions(+), 191 deletions(-) diff --git a/hotspot/src/cpu/sparc/vm/c1_LIRAssembler_sparc.cpp b/hotspot/src/cpu/sparc/vm/c1_LIRAssembler_sparc.cpp index 904489e3a2b..b2587e4d8a2 100644 --- a/hotspot/src/cpu/sparc/vm/c1_LIRAssembler_sparc.cpp +++ b/hotspot/src/cpu/sparc/vm/c1_LIRAssembler_sparc.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 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 @@ -238,9 +238,12 @@ void LIR_Assembler::emit_string_compare(LIR_Opr left, LIR_Opr right, LIR_Opr dst Register result = dst->as_register(); { - // Get a pointer to the first character of string0 in tmp0 and get string0.count in str0 - // Get a pointer to the first character of string1 in tmp1 and get string1.count in str1 - // Also, get string0.count-string1.count in o7 and get the condition code set + // Get a pointer to the first character of string0 in tmp0 + // and get string0.length() in str0 + // Get a pointer to the first character of string1 in tmp1 + // and get string1.length() in str1 + // Also, get string0.length()-string1.length() in + // o7 and get the condition code set // Note: some instructions have been hoisted for better instruction scheduling Register tmp0 = L0; @@ -248,27 +251,40 @@ void LIR_Assembler::emit_string_compare(LIR_Opr left, LIR_Opr right, LIR_Opr dst Register tmp2 = L2; int value_offset = java_lang_String:: value_offset_in_bytes(); // char array - int offset_offset = java_lang_String::offset_offset_in_bytes(); // first character position - int count_offset = java_lang_String:: count_offset_in_bytes(); - - __ load_heap_oop(str0, value_offset, tmp0); - __ ld(str0, offset_offset, tmp2); - __ add(tmp0, arrayOopDesc::base_offset_in_bytes(T_CHAR), tmp0); - __ ld(str0, count_offset, str0); - __ sll(tmp2, exact_log2(sizeof(jchar)), tmp2); + if (java_lang_String::has_offset_field()) { + int offset_offset = java_lang_String::offset_offset_in_bytes(); // first character position + int count_offset = java_lang_String:: count_offset_in_bytes(); + __ load_heap_oop(str0, value_offset, tmp0); + __ ld(str0, offset_offset, tmp2); + __ add(tmp0, arrayOopDesc::base_offset_in_bytes(T_CHAR), tmp0); + __ ld(str0, count_offset, str0); + __ sll(tmp2, exact_log2(sizeof(jchar)), tmp2); + } else { + __ load_heap_oop(str0, value_offset, tmp1); + __ add(tmp1, arrayOopDesc::base_offset_in_bytes(T_CHAR), tmp0); + __ ld(tmp1, arrayOopDesc::length_offset_in_bytes(), str0); + } // str1 may be null add_debug_info_for_null_check_here(info); - __ load_heap_oop(str1, value_offset, tmp1); - __ add(tmp0, tmp2, tmp0); + if (java_lang_String::has_offset_field()) { + int offset_offset = java_lang_String::offset_offset_in_bytes(); // first character position + int count_offset = java_lang_String:: count_offset_in_bytes(); + __ load_heap_oop(str1, value_offset, tmp1); + __ add(tmp0, tmp2, tmp0); - __ ld(str1, offset_offset, tmp2); - __ add(tmp1, arrayOopDesc::base_offset_in_bytes(T_CHAR), tmp1); - __ ld(str1, count_offset, str1); - __ sll(tmp2, exact_log2(sizeof(jchar)), tmp2); + __ ld(str1, offset_offset, tmp2); + __ add(tmp1, arrayOopDesc::base_offset_in_bytes(T_CHAR), tmp1); + __ ld(str1, count_offset, str1); + __ sll(tmp2, exact_log2(sizeof(jchar)), tmp2); + __ add(tmp1, tmp2, tmp1); + } else { + __ load_heap_oop(str1, value_offset, tmp2); + __ add(tmp2, arrayOopDesc::base_offset_in_bytes(T_CHAR), tmp1); + __ ld(tmp2, arrayOopDesc::length_offset_in_bytes(), str1); + } __ subcc(str0, str1, O7); - __ add(tmp1, tmp2, tmp1); } { @@ -302,7 +318,7 @@ void LIR_Assembler::emit_string_compare(LIR_Opr left, LIR_Opr right, LIR_Opr dst // Shift base0 and base1 to the end of the arrays, negate limit __ add(base0, limit, base0); __ add(base1, limit, base1); - __ neg(limit); // limit = -min{string0.count, strin1.count} + __ neg(limit); // limit = -min{string0.length(), string1.length()} __ lduh(base0, limit, chr0); __ bind(Lloop); diff --git a/hotspot/src/cpu/x86/vm/c1_LIRAssembler_x86.cpp b/hotspot/src/cpu/x86/vm/c1_LIRAssembler_x86.cpp index a7cc42e4912..4b2f8699e02 100644 --- a/hotspot/src/cpu/x86/vm/c1_LIRAssembler_x86.cpp +++ b/hotspot/src/cpu/x86/vm/c1_LIRAssembler_x86.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 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 @@ -505,19 +505,28 @@ void LIR_Assembler::emit_string_compare(LIR_Opr arg0, LIR_Opr arg1, LIR_Opr dst, // Get addresses of first characters from both Strings __ load_heap_oop(rsi, Address(rax, java_lang_String::value_offset_in_bytes())); - __ movptr (rcx, Address(rax, java_lang_String::offset_offset_in_bytes())); - __ lea (rsi, Address(rsi, rcx, Address::times_2, arrayOopDesc::base_offset_in_bytes(T_CHAR))); - + if (java_lang_String::has_offset_field()) { + __ movptr (rcx, Address(rax, java_lang_String::offset_offset_in_bytes())); + __ movl (rax, Address(rax, java_lang_String::count_offset_in_bytes())); + __ lea (rsi, Address(rsi, rcx, Address::times_2, arrayOopDesc::base_offset_in_bytes(T_CHAR))); + } else { + __ movl (rax, Address(rsi, arrayOopDesc::length_offset_in_bytes())); + __ lea (rsi, Address(rsi, arrayOopDesc::base_offset_in_bytes(T_CHAR))); + } // rbx, may be NULL add_debug_info_for_null_check_here(info); __ load_heap_oop(rdi, Address(rbx, java_lang_String::value_offset_in_bytes())); - __ movptr (rcx, Address(rbx, java_lang_String::offset_offset_in_bytes())); - __ lea (rdi, Address(rdi, rcx, Address::times_2, arrayOopDesc::base_offset_in_bytes(T_CHAR))); + if (java_lang_String::has_offset_field()) { + __ movptr (rcx, Address(rbx, java_lang_String::offset_offset_in_bytes())); + __ movl (rbx, Address(rbx, java_lang_String::count_offset_in_bytes())); + __ lea (rdi, Address(rdi, rcx, Address::times_2, arrayOopDesc::base_offset_in_bytes(T_CHAR))); + } else { + __ movl (rbx, Address(rdi, arrayOopDesc::length_offset_in_bytes())); + __ lea (rdi, Address(rdi, arrayOopDesc::base_offset_in_bytes(T_CHAR))); + } // compute minimum length (in rax) and difference of lengths (on top of stack) - __ movl (rbx, Address(rbx, java_lang_String::count_offset_in_bytes())); - __ movl (rax, Address(rax, java_lang_String::count_offset_in_bytes())); __ mov (rcx, rbx); __ subptr(rbx, rax); // subtract lengths __ push (rbx); // result diff --git a/hotspot/src/share/vm/classfile/javaClasses.cpp b/hotspot/src/share/vm/classfile/javaClasses.cpp index b5e887f74a8..eab75e181e3 100644 --- a/hotspot/src/share/vm/classfile/javaClasses.cpp +++ b/hotspot/src/share/vm/classfile/javaClasses.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 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 @@ -143,7 +143,27 @@ compute_optional_offset(int& dest_offset, } +int java_lang_String::value_offset = 0; +int java_lang_String::offset_offset = 0; +int java_lang_String::count_offset = 0; +int java_lang_String::hash_offset = 0; + +bool java_lang_String::initialized = false; + +void java_lang_String::compute_offsets() { + assert(!initialized, "offsets should be initialized only once"); + + klassOop k = SystemDictionary::String_klass(); + compute_offset(value_offset, k, vmSymbols::value_name(), vmSymbols::char_array_signature()); + compute_optional_offset(offset_offset, k, vmSymbols::offset_name(), vmSymbols::int_signature()); + compute_optional_offset(count_offset, k, vmSymbols::count_name(), vmSymbols::int_signature()); + compute_optional_offset(hash_offset, k, vmSymbols::hash_name(), vmSymbols::int_signature()); + + initialized = true; +} + Handle java_lang_String::basic_create(int length, bool tenured, TRAPS) { + assert(initialized, "Must be initialized"); // Create the String object first, so there's a chance that the String // and the char array it points to end up in the same cache line. oop obj; @@ -2837,10 +2857,6 @@ int java_lang_System::err_offset_in_bytes() { -int java_lang_String::value_offset; -int java_lang_String::offset_offset; -int java_lang_String::count_offset; -int java_lang_String::hash_offset; int java_lang_Class::_klass_offset; int java_lang_Class::_array_klass_offset; int java_lang_Class::_resolved_constructor_offset; @@ -3000,12 +3016,6 @@ void JavaClasses::compute_hard_coded_offsets() { const int x = heapOopSize; const int header = instanceOopDesc::base_offset_in_bytes(); - // Do the String Class - java_lang_String::value_offset = java_lang_String::hc_value_offset * x + header; - java_lang_String::offset_offset = java_lang_String::hc_offset_offset * x + header; - java_lang_String::count_offset = java_lang_String::offset_offset + sizeof (jint); - java_lang_String::hash_offset = java_lang_String::count_offset + sizeof (jint); - // Throwable Class java_lang_Throwable::backtrace_offset = java_lang_Throwable::hc_backtrace_offset * x + header; java_lang_Throwable::detailMessage_offset = java_lang_Throwable::hc_detailMessage_offset * x + header; @@ -3200,9 +3210,13 @@ void JavaClasses::check_offsets() { // java.lang.String CHECK_OFFSET("java/lang/String", java_lang_String, value, "[C"); - CHECK_OFFSET("java/lang/String", java_lang_String, offset, "I"); - CHECK_OFFSET("java/lang/String", java_lang_String, count, "I"); - CHECK_OFFSET("java/lang/String", java_lang_String, hash, "I"); + if (java_lang_String::has_offset_field()) { + CHECK_OFFSET("java/lang/String", java_lang_String, offset, "I"); + CHECK_OFFSET("java/lang/String", java_lang_String, count, "I"); + } + if (java_lang_String::has_hash_field()) { + CHECK_OFFSET("java/lang/String", java_lang_String, hash, "I"); + } // java.lang.Class diff --git a/hotspot/src/share/vm/classfile/javaClasses.hpp b/hotspot/src/share/vm/classfile/javaClasses.hpp index 2a32801fc73..708ea4f544a 100644 --- a/hotspot/src/share/vm/classfile/javaClasses.hpp +++ b/hotspot/src/share/vm/classfile/javaClasses.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 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 @@ -52,26 +52,36 @@ class java_lang_String : AllStatic { private: - enum { - hc_value_offset = 0, - hc_offset_offset = 1 - //hc_count_offset = 2 -- not a word-scaled offset - //hc_hash_offset = 3 -- not a word-scaled offset - }; - static int value_offset; static int offset_offset; static int count_offset; static int hash_offset; + static bool initialized; + static Handle basic_create(int length, bool tenured, TRAPS); static Handle basic_create_from_unicode(jchar* unicode, int length, bool tenured, TRAPS); - static void set_value( oop string, typeArrayOop buffer) { string->obj_field_put(value_offset, (oop)buffer); } - static void set_offset(oop string, int offset) { string->int_field_put(offset_offset, offset); } - static void set_count( oop string, int count) { string->int_field_put(count_offset, count); } + static void set_value( oop string, typeArrayOop buffer) { + assert(initialized, "Must be initialized"); + string->obj_field_put(value_offset, (oop)buffer); + } + static void set_offset(oop string, int offset) { + assert(initialized, "Must be initialized"); + if (offset_offset > 0) { + string->int_field_put(offset_offset, offset); + } + } + static void set_count( oop string, int count) { + assert(initialized, "Must be initialized"); + if (count_offset > 0) { + string->int_field_put(count_offset, count); + } + } public: + static void compute_offsets(); + // Instance creation static Handle create_from_unicode(jchar* unicode, int len, TRAPS); static Handle create_tenured_from_unicode(jchar* unicode, int len, TRAPS); @@ -82,23 +92,61 @@ class java_lang_String : AllStatic { static Handle create_from_platform_dependent_str(const char* str, TRAPS); static Handle char_converter(Handle java_string, jchar from_char, jchar to_char, TRAPS); - static int value_offset_in_bytes() { return value_offset; } - static int count_offset_in_bytes() { return count_offset; } - static int offset_offset_in_bytes() { return offset_offset; } - static int hash_offset_in_bytes() { return hash_offset; } + static bool has_offset_field() { + assert(initialized, "Must be initialized"); + return (offset_offset > 0); + } + + static bool has_count_field() { + assert(initialized, "Must be initialized"); + return (count_offset > 0); + } + + static bool has_hash_field() { + assert(initialized, "Must be initialized"); + return (hash_offset > 0); + } + + static int value_offset_in_bytes() { + assert(initialized && (value_offset > 0), "Must be initialized"); + return value_offset; + } + static int count_offset_in_bytes() { + assert(initialized && (count_offset > 0), "Must be initialized"); + return count_offset; + } + static int offset_offset_in_bytes() { + assert(initialized && (offset_offset > 0), "Must be initialized"); + return offset_offset; + } + static int hash_offset_in_bytes() { + assert(initialized && (hash_offset > 0), "Must be initialized"); + return hash_offset; + } // Accessors static typeArrayOop value(oop java_string) { + assert(initialized && (value_offset > 0), "Must be initialized"); assert(is_instance(java_string), "must be java_string"); return (typeArrayOop) java_string->obj_field(value_offset); } static int offset(oop java_string) { + assert(initialized, "Must be initialized"); assert(is_instance(java_string), "must be java_string"); - return java_string->int_field(offset_offset); + if (offset_offset > 0) { + return java_string->int_field(offset_offset); + } else { + return 0; + } } static int length(oop java_string) { + assert(initialized, "Must be initialized"); assert(is_instance(java_string), "must be java_string"); - return java_string->int_field(count_offset); + if (count_offset > 0) { + return java_string->int_field(count_offset); + } else { + return ((typeArrayOop)java_string->obj_field(value_offset))->length(); + } } static int utf8_length(oop java_string); diff --git a/hotspot/src/share/vm/classfile/systemDictionary.cpp b/hotspot/src/share/vm/classfile/systemDictionary.cpp index 04bb9d9f5c5..0bdc16de6ff 100644 --- a/hotspot/src/share/vm/classfile/systemDictionary.cpp +++ b/hotspot/src/share/vm/classfile/systemDictionary.cpp @@ -1971,6 +1971,9 @@ void SystemDictionary::initialize_preloaded_classes(TRAPS) { // first do Object, String, Class initialize_wk_klasses_through(WK_KLASS_ENUM_NAME(Class_klass), scan, CHECK); + // Calculate offsets for String and Class classes since they are loaded and + // can be used after this point. + java_lang_String::compute_offsets(); java_lang_Class::compute_offsets(); // Fixup mirrors for classes loaded before java.lang.Class. diff --git a/hotspot/src/share/vm/classfile/vmSymbols.hpp b/hotspot/src/share/vm/classfile/vmSymbols.hpp index 9cee5ac0490..b0d014575aa 100644 --- a/hotspot/src/share/vm/classfile/vmSymbols.hpp +++ b/hotspot/src/share/vm/classfile/vmSymbols.hpp @@ -340,6 +340,9 @@ template(park_event_name, "nativeParkEventPointer") \ template(cache_field_name, "cache") \ template(value_name, "value") \ + template(offset_name, "offset") \ + template(count_name, "count") \ + template(hash_name, "hash") \ template(frontCacheEnabled_name, "frontCacheEnabled") \ template(stringCacheEnabled_name, "stringCacheEnabled") \ template(numberOfLeadingZeros_name, "numberOfLeadingZeros") \ diff --git a/hotspot/src/share/vm/memory/dump.cpp b/hotspot/src/share/vm/memory/dump.cpp index af1d7928dca..e91d33135e4 100644 --- a/hotspot/src/share/vm/memory/dump.cpp +++ b/hotspot/src/share/vm/memory/dump.cpp @@ -78,8 +78,8 @@ public: void do_oop(oop* p) { if (p != NULL) { oop obj = *p; - if (obj->klass() == SystemDictionary::String_klass()) { - + if (obj->klass() == SystemDictionary::String_klass() && + java_lang_String::has_hash_field()) { int hash = java_lang_String::hash_string(obj); obj->int_field_put(hash_offset, hash); } diff --git a/hotspot/src/share/vm/opto/graphKit.cpp b/hotspot/src/share/vm/opto/graphKit.cpp index 61d922760c5..b3dca953133 100644 --- a/hotspot/src/share/vm/opto/graphKit.cpp +++ b/hotspot/src/share/vm/opto/graphKit.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2011, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 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 @@ -3748,3 +3748,81 @@ void GraphKit::g1_write_barrier_post(Node* oop_store, final_sync(ideal); } #undef __ + + + +Node* GraphKit::load_String_offset(Node* ctrl, Node* str) { + if (java_lang_String::has_offset_field()) { + int offset_offset = java_lang_String::offset_offset_in_bytes(); + const TypeInstPtr* string_type = TypeInstPtr::make(TypePtr::NotNull, C->env()->String_klass(), + false, NULL, 0); + const TypePtr* offset_field_type = string_type->add_offset(offset_offset); + int offset_field_idx = C->get_alias_index(offset_field_type); + return make_load(ctrl, + basic_plus_adr(str, str, offset_offset), + TypeInt::INT, T_INT, offset_field_idx); + } else { + return intcon(0); + } +} + +Node* GraphKit::load_String_length(Node* ctrl, Node* str) { + if (java_lang_String::has_count_field()) { + int count_offset = java_lang_String::count_offset_in_bytes(); + const TypeInstPtr* string_type = TypeInstPtr::make(TypePtr::NotNull, C->env()->String_klass(), + false, NULL, 0); + const TypePtr* count_field_type = string_type->add_offset(count_offset); + int count_field_idx = C->get_alias_index(count_field_type); + return make_load(ctrl, + basic_plus_adr(str, str, count_offset), + TypeInt::INT, T_INT, count_field_idx); + } else { + return load_array_length(load_String_value(ctrl, str)); + } +} + +Node* GraphKit::load_String_value(Node* ctrl, Node* str) { + int value_offset = java_lang_String::value_offset_in_bytes(); + const TypeInstPtr* string_type = TypeInstPtr::make(TypePtr::NotNull, C->env()->String_klass(), + false, NULL, 0); + const TypePtr* value_field_type = string_type->add_offset(value_offset); + const TypeAryPtr* value_type = TypeAryPtr::make(TypePtr::NotNull, + TypeAry::make(TypeInt::CHAR,TypeInt::POS), + ciTypeArrayKlass::make(T_CHAR), true, 0); + int value_field_idx = C->get_alias_index(value_field_type); + return make_load(ctrl, basic_plus_adr(str, str, value_offset), + value_type, T_OBJECT, value_field_idx); +} + +void GraphKit::store_String_offset(Node* ctrl, Node* str, Node* value) { + int offset_offset = java_lang_String::offset_offset_in_bytes(); + const TypeInstPtr* string_type = TypeInstPtr::make(TypePtr::NotNull, C->env()->String_klass(), + false, NULL, 0); + const TypePtr* offset_field_type = string_type->add_offset(offset_offset); + int offset_field_idx = C->get_alias_index(offset_field_type); + store_to_memory(ctrl, basic_plus_adr(str, offset_offset), + value, T_INT, offset_field_idx); +} + +void GraphKit::store_String_value(Node* ctrl, Node* str, Node* value) { + int value_offset = java_lang_String::value_offset_in_bytes(); + const TypeInstPtr* string_type = TypeInstPtr::make(TypePtr::NotNull, C->env()->String_klass(), + false, NULL, 0); + const TypePtr* value_field_type = string_type->add_offset(value_offset); + const TypeAryPtr* value_type = TypeAryPtr::make(TypePtr::NotNull, + TypeAry::make(TypeInt::CHAR,TypeInt::POS), + ciTypeArrayKlass::make(T_CHAR), true, 0); + int value_field_idx = C->get_alias_index(value_field_type); + store_to_memory(ctrl, basic_plus_adr(str, value_offset), + value, T_OBJECT, value_field_idx); +} + +void GraphKit::store_String_length(Node* ctrl, Node* str, Node* value) { + int count_offset = java_lang_String::count_offset_in_bytes(); + const TypeInstPtr* string_type = TypeInstPtr::make(TypePtr::NotNull, C->env()->String_klass(), + false, NULL, 0); + const TypePtr* count_field_type = string_type->add_offset(count_offset); + int count_field_idx = C->get_alias_index(count_field_type); + store_to_memory(ctrl, basic_plus_adr(str, count_offset), + value, T_INT, count_field_idx); +} diff --git a/hotspot/src/share/vm/opto/graphKit.hpp b/hotspot/src/share/vm/opto/graphKit.hpp index bffebc8798e..723e65e3b05 100644 --- a/hotspot/src/share/vm/opto/graphKit.hpp +++ b/hotspot/src/share/vm/opto/graphKit.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2011, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 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 @@ -781,6 +781,14 @@ class GraphKit : public Phase { Node* new_array(Node* klass_node, Node* count_val, int nargs, Node* *return_size_val = NULL); + // java.lang.String helpers + Node* load_String_offset(Node* ctrl, Node* str); + Node* load_String_length(Node* ctrl, Node* str); + Node* load_String_value(Node* ctrl, Node* str); + void store_String_offset(Node* ctrl, Node* str, Node* value); + void store_String_length(Node* ctrl, Node* str, Node* value); + void store_String_value(Node* ctrl, Node* str, Node* value); + // Handy for making control flow IfNode* create_and_map_if(Node* ctrl, Node* tst, float prob, float cnt) { IfNode* iff = new (C, 2) IfNode(ctrl, tst, prob, cnt);// New IfNode's diff --git a/hotspot/src/share/vm/opto/library_call.cpp b/hotspot/src/share/vm/opto/library_call.cpp index 13c3a4327ce..e0f5f95915f 100644 --- a/hotspot/src/share/vm/opto/library_call.cpp +++ b/hotspot/src/share/vm/opto/library_call.cpp @@ -147,7 +147,8 @@ class LibraryCallKit : public GraphKit { return generate_method_call(method_id, true, false); } - Node* make_string_method_node(int opcode, Node* str1, Node* cnt1, Node* str2, Node* cnt2); + Node* make_string_method_node(int opcode, Node* str1_start, Node* cnt1, Node* str2_start, Node* cnt2); + Node* make_string_method_node(int opcode, Node* str1, Node* str2); bool inline_string_compareTo(); bool inline_string_indexOf(); Node* string_indexOf(Node* string_object, ciTypeArray* target_array, jint offset, jint cache_i, jint md2_i); @@ -873,48 +874,76 @@ Node* LibraryCallKit::generate_current_thread(Node* &tls_output) { //------------------------------make_string_method_node------------------------ -// Helper method for String intrinsic finctions. -Node* LibraryCallKit::make_string_method_node(int opcode, Node* str1, Node* cnt1, Node* str2, Node* cnt2) { - const int value_offset = java_lang_String::value_offset_in_bytes(); - const int count_offset = java_lang_String::count_offset_in_bytes(); - const int offset_offset = java_lang_String::offset_offset_in_bytes(); - +// Helper method for String intrinsic functions. This version is called +// with str1 and str2 pointing to String object nodes. +// +Node* LibraryCallKit::make_string_method_node(int opcode, Node* str1, Node* str2) { Node* no_ctrl = NULL; - ciInstanceKlass* klass = env()->String_klass(); - const TypeOopPtr* string_type = TypeOopPtr::make_from_klass(klass); - - const TypeAryPtr* value_type = - TypeAryPtr::make(TypePtr::NotNull, - TypeAry::make(TypeInt::CHAR,TypeInt::POS), - ciTypeArrayKlass::make(T_CHAR), true, 0); - - // Get start addr of string and substring - Node* str1_valuea = basic_plus_adr(str1, str1, value_offset); - Node* str1_value = make_load(no_ctrl, str1_valuea, value_type, T_OBJECT, string_type->add_offset(value_offset)); - Node* str1_offseta = basic_plus_adr(str1, str1, offset_offset); - Node* str1_offset = make_load(no_ctrl, str1_offseta, TypeInt::INT, T_INT, string_type->add_offset(offset_offset)); + // Get start addr of string + Node* str1_value = load_String_value(no_ctrl, str1); + Node* str1_offset = load_String_offset(no_ctrl, str1); Node* str1_start = array_element_address(str1_value, str1_offset, T_CHAR); - Node* str2_valuea = basic_plus_adr(str2, str2, value_offset); - Node* str2_value = make_load(no_ctrl, str2_valuea, value_type, T_OBJECT, string_type->add_offset(value_offset)); - Node* str2_offseta = basic_plus_adr(str2, str2, offset_offset); - Node* str2_offset = make_load(no_ctrl, str2_offseta, TypeInt::INT, T_INT, string_type->add_offset(offset_offset)); + // Get length of string 1 + Node* str1_len = load_String_length(no_ctrl, str1); + + Node* str2_value = load_String_value(no_ctrl, str2); + Node* str2_offset = load_String_offset(no_ctrl, str2); Node* str2_start = array_element_address(str2_value, str2_offset, T_CHAR); + Node* str2_len = NULL; + Node* result = NULL; + + switch (opcode) { + case Op_StrIndexOf: + // Get length of string 2 + str2_len = load_String_length(no_ctrl, str2); + + result = new (C, 6) StrIndexOfNode(control(), memory(TypeAryPtr::CHARS), + str1_start, str1_len, str2_start, str2_len); + break; + case Op_StrComp: + // Get length of string 2 + str2_len = load_String_length(no_ctrl, str2); + + result = new (C, 6) StrCompNode(control(), memory(TypeAryPtr::CHARS), + str1_start, str1_len, str2_start, str2_len); + break; + case Op_StrEquals: + result = new (C, 5) StrEqualsNode(control(), memory(TypeAryPtr::CHARS), + str1_start, str2_start, str1_len); + break; + default: + ShouldNotReachHere(); + return NULL; + } + + // All these intrinsics have checks. + C->set_has_split_ifs(true); // Has chance for split-if optimization + + return _gvn.transform(result); +} + +// Helper method for String intrinsic functions. This version is called +// with str1 and str2 pointing to char[] nodes, with cnt1 and cnt2 pointing +// to Int nodes containing the lenghts of str1 and str2. +// +Node* LibraryCallKit::make_string_method_node(int opcode, Node* str1_start, Node* cnt1, Node* str2_start, Node* cnt2) { + Node* result = NULL; switch (opcode) { case Op_StrIndexOf: result = new (C, 6) StrIndexOfNode(control(), memory(TypeAryPtr::CHARS), - str1_start, cnt1, str2_start, cnt2); + str1_start, cnt1, str2_start, cnt2); break; case Op_StrComp: result = new (C, 6) StrCompNode(control(), memory(TypeAryPtr::CHARS), - str1_start, cnt1, str2_start, cnt2); + str1_start, cnt1, str2_start, cnt2); break; case Op_StrEquals: result = new (C, 5) StrEqualsNode(control(), memory(TypeAryPtr::CHARS), - str1_start, str2_start, cnt1); + str1_start, str2_start, cnt1); break; default: ShouldNotReachHere(); @@ -932,10 +961,6 @@ bool LibraryCallKit::inline_string_compareTo() { if (!Matcher::has_match_rule(Op_StrComp)) return false; - const int value_offset = java_lang_String::value_offset_in_bytes(); - const int count_offset = java_lang_String::count_offset_in_bytes(); - const int offset_offset = java_lang_String::offset_offset_in_bytes(); - _sp += 2; Node *argument = pop(); // pop non-receiver first: it was pushed second Node *receiver = pop(); @@ -952,18 +977,7 @@ bool LibraryCallKit::inline_string_compareTo() { return true; } - ciInstanceKlass* klass = env()->String_klass(); - const TypeOopPtr* string_type = TypeOopPtr::make_from_klass(klass); - Node* no_ctrl = NULL; - - // Get counts for string and argument - Node* receiver_cnta = basic_plus_adr(receiver, receiver, count_offset); - Node* receiver_cnt = make_load(no_ctrl, receiver_cnta, TypeInt::INT, T_INT, string_type->add_offset(count_offset)); - - Node* argument_cnta = basic_plus_adr(argument, argument, count_offset); - Node* argument_cnt = make_load(no_ctrl, argument_cnta, TypeInt::INT, T_INT, string_type->add_offset(count_offset)); - - Node* compare = make_string_method_node(Op_StrComp, receiver, receiver_cnt, argument, argument_cnt); + Node* compare = make_string_method_node(Op_StrComp, receiver, argument); push(compare); return true; } @@ -973,10 +987,6 @@ bool LibraryCallKit::inline_string_equals() { if (!Matcher::has_match_rule(Op_StrEquals)) return false; - const int value_offset = java_lang_String::value_offset_in_bytes(); - const int count_offset = java_lang_String::count_offset_in_bytes(); - const int offset_offset = java_lang_String::offset_offset_in_bytes(); - int nargs = 2; _sp += nargs; Node* argument = pop(); // pop non-receiver first: it was pushed second @@ -1030,24 +1040,31 @@ bool LibraryCallKit::inline_string_equals() { } } - const TypeOopPtr* string_type = TypeOopPtr::make_from_klass(klass); - - Node* no_ctrl = NULL; - Node* receiver_cnt; - Node* argument_cnt; - if (!stopped()) { + const TypeOopPtr* string_type = TypeOopPtr::make_from_klass(klass); + // Properly cast the argument to String argument = _gvn.transform(new (C, 2) CheckCastPPNode(control(), argument, string_type)); // This path is taken only when argument's type is String:NotNull. argument = cast_not_null(argument, false); - // Get counts for string and argument - Node* receiver_cnta = basic_plus_adr(receiver, receiver, count_offset); - receiver_cnt = make_load(no_ctrl, receiver_cnta, TypeInt::INT, T_INT, string_type->add_offset(count_offset)); + Node* no_ctrl = NULL; - Node* argument_cnta = basic_plus_adr(argument, argument, count_offset); - argument_cnt = make_load(no_ctrl, argument_cnta, TypeInt::INT, T_INT, string_type->add_offset(count_offset)); + // Get start addr of receiver + Node* receiver_val = load_String_value(no_ctrl, receiver); + Node* receiver_offset = load_String_offset(no_ctrl, receiver); + Node* receiver_start = array_element_address(receiver_val, receiver_offset, T_CHAR); + + // Get length of receiver + Node* receiver_cnt = load_String_length(no_ctrl, receiver); + + // Get start addr of argument + Node* argument_val = load_String_value(no_ctrl, argument); + Node* argument_offset = load_String_offset(no_ctrl, argument); + Node* argument_start = array_element_address(argument_val, argument_offset, T_CHAR); + + // Get length of argument + Node* argument_cnt = load_String_length(no_ctrl, argument); // Check for receiver count != argument count Node* cmp = _gvn.transform( new(C, 3) CmpINode(receiver_cnt, argument_cnt) ); @@ -1057,14 +1074,14 @@ bool LibraryCallKit::inline_string_equals() { phi->init_req(4, intcon(0)); region->init_req(4, if_ne); } - } - // Check for count == 0 is done by mach node StrEquals. + // Check for count == 0 is done by assembler code for StrEquals. - if (!stopped()) { - Node* equals = make_string_method_node(Op_StrEquals, receiver, receiver_cnt, argument, argument_cnt); - phi->init_req(1, equals); - region->init_req(1, control()); + if (!stopped()) { + Node* equals = make_string_method_node(Op_StrEquals, receiver_start, receiver_cnt, argument_start, argument_cnt); + phi->init_req(1, equals); + region->init_req(1, control()); + } } // post merge @@ -1162,20 +1179,9 @@ Node* LibraryCallKit::string_indexOf(Node* string_object, ciTypeArray* target_ar const int nargs = 2; // number of arguments to push back for uncommon trap in predicate - const int value_offset = java_lang_String::value_offset_in_bytes(); - const int count_offset = java_lang_String::count_offset_in_bytes(); - const int offset_offset = java_lang_String::offset_offset_in_bytes(); - - ciInstanceKlass* klass = env()->String_klass(); - const TypeOopPtr* string_type = TypeOopPtr::make_from_klass(klass); - const TypeAryPtr* source_type = TypeAryPtr::make(TypePtr::NotNull, TypeAry::make(TypeInt::CHAR,TypeInt::POS), ciTypeArrayKlass::make(T_CHAR), true, 0); - - Node* sourceOffseta = basic_plus_adr(string_object, string_object, offset_offset); - Node* sourceOffset = make_load(no_ctrl, sourceOffseta, TypeInt::INT, T_INT, string_type->add_offset(offset_offset)); - Node* sourceCounta = basic_plus_adr(string_object, string_object, count_offset); - Node* sourceCount = make_load(no_ctrl, sourceCounta, TypeInt::INT, T_INT, string_type->add_offset(count_offset)); - Node* sourcea = basic_plus_adr(string_object, string_object, value_offset); - Node* source = make_load(no_ctrl, sourcea, source_type, T_OBJECT, string_type->add_offset(value_offset)); + Node* source = load_String_value(no_ctrl, string_object); + Node* sourceOffset = load_String_offset(no_ctrl, string_object); + Node* sourceCount = load_String_length(no_ctrl, string_object); Node* target = _gvn.transform( makecon(TypeOopPtr::make_from_constant(target_array, true)) ); jint target_length = target_array->length(); @@ -1243,10 +1249,6 @@ Node* LibraryCallKit::string_indexOf(Node* string_object, ciTypeArray* target_ar //------------------------------inline_string_indexOf------------------------ bool LibraryCallKit::inline_string_indexOf() { - const int value_offset = java_lang_String::value_offset_in_bytes(); - const int count_offset = java_lang_String::count_offset_in_bytes(); - const int offset_offset = java_lang_String::offset_offset_in_bytes(); - _sp += 2; Node *argument = pop(); // pop non-receiver first: it was pushed second Node *receiver = pop(); @@ -1280,12 +1282,21 @@ bool LibraryCallKit::inline_string_indexOf() { Node* result_phi = new (C, 4) PhiNode(result_rgn, TypeInt::INT); Node* no_ctrl = NULL; - // Get counts for string and substr - Node* source_cnta = basic_plus_adr(receiver, receiver, count_offset); - Node* source_cnt = make_load(no_ctrl, source_cnta, TypeInt::INT, T_INT, string_type->add_offset(count_offset)); + // Get start addr of source string + Node* source = load_String_value(no_ctrl, receiver); + Node* source_offset = load_String_offset(no_ctrl, receiver); + Node* source_start = array_element_address(source, source_offset, T_CHAR); - Node* substr_cnta = basic_plus_adr(argument, argument, count_offset); - Node* substr_cnt = make_load(no_ctrl, substr_cnta, TypeInt::INT, T_INT, string_type->add_offset(count_offset)); + // Get length of source string + Node* source_cnt = load_String_length(no_ctrl, receiver); + + // Get start addr of substring + Node* substr = load_String_value(no_ctrl, argument); + Node* substr_offset = load_String_offset(no_ctrl, argument); + Node* substr_start = array_element_address(substr, substr_offset, T_CHAR); + + // Get length of source string + Node* substr_cnt = load_String_length(no_ctrl, argument); // Check for substr count > string count Node* cmp = _gvn.transform( new(C, 3) CmpINode(substr_cnt, source_cnt) ); @@ -1308,7 +1319,7 @@ bool LibraryCallKit::inline_string_indexOf() { } if (!stopped()) { - result = make_string_method_node(Op_StrIndexOf, receiver, source_cnt, argument, substr_cnt); + result = make_string_method_node(Op_StrIndexOf, source_start, source_cnt, substr_start, substr_cnt); result_phi->init_req(1, result); result_rgn->init_req(1, control()); } @@ -1333,11 +1344,19 @@ bool LibraryCallKit::inline_string_indexOf() { ciInstance* str = str_const->as_instance(); assert(str != NULL, "must be instance"); - ciObject* v = str->field_value_by_offset(value_offset).as_object(); - int o = str->field_value_by_offset(offset_offset).as_int(); - int c = str->field_value_by_offset(count_offset).as_int(); + ciObject* v = str->field_value_by_offset(java_lang_String::value_offset_in_bytes()).as_object(); ciTypeArray* pat = v->as_type_array(); // pattern (argument) character array + int o; + int c; + if (java_lang_String::has_offset_field()) { + o = str->field_value_by_offset(java_lang_String::offset_offset_in_bytes()).as_int(); + c = str->field_value_by_offset(java_lang_String::count_offset_in_bytes()).as_int(); + } else { + o = 0; + c = pat->length(); + } + // constant strings have no offset and count == length which // simplifies the resulting code somewhat so lets optimize for that. if (o != 0 || c != pat->length()) { diff --git a/hotspot/src/share/vm/opto/stringopts.cpp b/hotspot/src/share/vm/opto/stringopts.cpp index 496e7a883d1..99498ea9598 100644 --- a/hotspot/src/share/vm/opto/stringopts.cpp +++ b/hotspot/src/share/vm/opto/stringopts.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2009, 2011, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2009, 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 @@ -528,16 +528,6 @@ PhaseStringOpts::PhaseStringOpts(PhaseGVN* gvn, Unique_Node_List*): } // Collect the types needed to talk about the various slices of memory - const TypeInstPtr* string_type = TypeInstPtr::make(TypePtr::NotNull, C->env()->String_klass(), - false, NULL, 0); - - const TypePtr* value_field_type = string_type->add_offset(java_lang_String::value_offset_in_bytes()); - const TypePtr* offset_field_type = string_type->add_offset(java_lang_String::offset_offset_in_bytes()); - const TypePtr* count_field_type = string_type->add_offset(java_lang_String::count_offset_in_bytes()); - - value_field_idx = C->get_alias_index(value_field_type); - count_field_idx = C->get_alias_index(count_field_type); - offset_field_idx = C->get_alias_index(offset_field_type); char_adr_idx = C->get_alias_index(TypeAryPtr::CHARS); // For each locally allocated StringBuffer see if the usages can be @@ -1174,18 +1164,9 @@ void PhaseStringOpts::int_getChars(GraphKit& kit, Node* arg, Node* char_array, N Node* PhaseStringOpts::copy_string(GraphKit& kit, Node* str, Node* char_array, Node* start) { Node* string = str; - Node* offset = kit.make_load(kit.control(), - kit.basic_plus_adr(string, string, java_lang_String::offset_offset_in_bytes()), - TypeInt::INT, T_INT, offset_field_idx); - Node* count = kit.make_load(kit.control(), - kit.basic_plus_adr(string, string, java_lang_String::count_offset_in_bytes()), - TypeInt::INT, T_INT, count_field_idx); - const TypeAryPtr* value_type = TypeAryPtr::make(TypePtr::NotNull, - TypeAry::make(TypeInt::CHAR,TypeInt::POS), - ciTypeArrayKlass::make(T_CHAR), true, 0); - Node* value = kit.make_load(kit.control(), - kit.basic_plus_adr(string, string, java_lang_String::value_offset_in_bytes()), - value_type, T_OBJECT, value_field_idx); + Node* offset = kit.load_String_offset(kit.control(), string); + Node* count = kit.load_String_length(kit.control(), string); + Node* value = kit.load_String_value (kit.control(), string); // copy the contents if (offset->is_Con() && count->is_Con() && value->is_Con() && count->get_int() < unroll_string_copy_length) { @@ -1342,10 +1323,9 @@ void PhaseStringOpts::replace_string_concat(StringConcat* sc) { arg = phi; sc->set_argument(argi, arg); } - // Node* offset = kit.make_load(NULL, kit.basic_plus_adr(arg, arg, offset_offset), - // TypeInt::INT, T_INT, offset_field_idx); - Node* count = kit.make_load(kit.control(), kit.basic_plus_adr(arg, arg, java_lang_String::count_offset_in_bytes()), - TypeInt::INT, T_INT, count_field_idx); + + Node* count = kit.load_String_length(kit.control(), arg); + length = __ AddI(length, count); string_sizes->init_req(argi, NULL); break; @@ -1436,12 +1416,11 @@ void PhaseStringOpts::replace_string_concat(StringConcat* sc) { } // Intialize the string - kit.store_to_memory(kit.control(), kit.basic_plus_adr(result, java_lang_String::offset_offset_in_bytes()), - __ intcon(0), T_INT, offset_field_idx); - kit.store_to_memory(kit.control(), kit.basic_plus_adr(result, java_lang_String::count_offset_in_bytes()), - length, T_INT, count_field_idx); - kit.store_to_memory(kit.control(), kit.basic_plus_adr(result, java_lang_String::value_offset_in_bytes()), - char_array, T_OBJECT, value_field_idx); + if (java_lang_String::has_offset_field()) { + kit.store_String_offset(kit.control(), result, __ intcon(0)); + kit.store_String_length(kit.control(), result, length); + } + kit.store_String_value(kit.control(), result, char_array); // hook up the outgoing control and result kit.replace_call(sc->end(), result); diff --git a/hotspot/src/share/vm/opto/stringopts.hpp b/hotspot/src/share/vm/opto/stringopts.hpp index 1ffe6c3092d..0fb1ed70f64 100644 --- a/hotspot/src/share/vm/opto/stringopts.hpp +++ b/hotspot/src/share/vm/opto/stringopts.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2009, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2009, 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 @@ -41,9 +41,6 @@ class PhaseStringOpts : public Phase { // Memory slices needed for code gen int char_adr_idx; - int value_field_idx; - int count_field_idx; - int offset_field_idx; // Integer.sizeTable - used for int to String conversion ciField* size_table_field; From c23595da74e4ab46e73b3d6c93068f6b0faa847a Mon Sep 17 00:00:00 2001 From: Mikael Vidstedt Date: Tue, 15 May 2012 00:56:06 +0200 Subject: [PATCH 049/128] 7158457: division by zero in adaptiveweightedaverage Add ceiling to AdaptiveWeightedAverage Reviewed-by: ysr, iveresov --- .../vm/gc_implementation/shared/gcUtil.cpp | 14 +++++++++----- .../vm/gc_implementation/shared/gcUtil.hpp | 18 +++++++++++++++--- 2 files changed, 24 insertions(+), 8 deletions(-) diff --git a/hotspot/src/share/vm/gc_implementation/shared/gcUtil.cpp b/hotspot/src/share/vm/gc_implementation/shared/gcUtil.cpp index 5325fee218b..3b9fd7a68aa 100644 --- a/hotspot/src/share/vm/gc_implementation/shared/gcUtil.cpp +++ b/hotspot/src/share/vm/gc_implementation/shared/gcUtil.cpp @@ -31,9 +31,15 @@ float AdaptiveWeightedAverage::compute_adaptive_average(float new_sample, float average) { // We smooth the samples by not using weight() directly until we've // had enough data to make it meaningful. We'd like the first weight - // used to be 1, the second to be 1/2, etc until we have 100/weight - // samples. - unsigned count_weight = 100/count(); + // used to be 1, the second to be 1/2, etc until we have + // OLD_THRESHOLD/weight samples. + unsigned count_weight = 0; + + // Avoid division by zero if the counter wraps (7158457) + if (!is_old()) { + count_weight = OLD_THRESHOLD/count(); + } + unsigned adaptive_weight = (MAX2(weight(), count_weight)); float new_avg = exp_avg(average, new_sample, adaptive_weight); @@ -43,8 +49,6 @@ float AdaptiveWeightedAverage::compute_adaptive_average(float new_sample, void AdaptiveWeightedAverage::sample(float new_sample) { increment_count(); - assert(count() != 0, - "Wraparound -- history would be incorrectly discarded"); // Compute the new weighted average float new_avg = compute_adaptive_average(new_sample, average()); diff --git a/hotspot/src/share/vm/gc_implementation/shared/gcUtil.hpp b/hotspot/src/share/vm/gc_implementation/shared/gcUtil.hpp index 8dd3258de0a..86daba64c3f 100644 --- a/hotspot/src/share/vm/gc_implementation/shared/gcUtil.hpp +++ b/hotspot/src/share/vm/gc_implementation/shared/gcUtil.hpp @@ -50,11 +50,20 @@ class AdaptiveWeightedAverage : public CHeapObj { unsigned _weight; // The weight used to smooth the averages // A higher weight favors the most // recent data. + bool _is_old; // Has enough historical data + + const static unsigned OLD_THRESHOLD = 100; protected: float _last_sample; // The last value sampled. - void increment_count() { _sample_count++; } + void increment_count() { + _sample_count++; + if (!_is_old && _sample_count > OLD_THRESHOLD) { + _is_old = true; + } + } + void set_average(float avg) { _average = avg; } // Helper function, computes an adaptive weighted average @@ -64,13 +73,15 @@ class AdaptiveWeightedAverage : public CHeapObj { public: // Input weight must be between 0 and 100 AdaptiveWeightedAverage(unsigned weight, float avg = 0.0) : - _average(avg), _sample_count(0), _weight(weight), _last_sample(0.0) { + _average(avg), _sample_count(0), _weight(weight), _last_sample(0.0), + _is_old(false) { } void clear() { _average = 0; _sample_count = 0; _last_sample = 0; + _is_old = false; } // Useful for modifying static structures after startup. @@ -84,7 +95,8 @@ class AdaptiveWeightedAverage : public CHeapObj { float average() const { return _average; } unsigned weight() const { return _weight; } unsigned count() const { return _sample_count; } - float last_sample() const { return _last_sample; } + float last_sample() const { return _last_sample; } + bool is_old() const { return _is_old; } // Update data with a new sample. void sample(float new_sample); From b305cf722e3666f68b38a8547fe8ffeab4f9572a Mon Sep 17 00:00:00 2001 From: Roland Westrelin Date: Tue, 15 May 2012 10:10:23 +0200 Subject: [PATCH 050/128] 7133857: exp() and pow() should use the x87 ISA on x86 Use x87 instructions to implement exp() and pow() in interpreter/c1/c2. Reviewed-by: kvn, never, twisti --- .../cpu/sparc/vm/c1_LIRGenerator_sparc.cpp | 14 +- .../src/cpu/sparc/vm/interpreter_sparc.cpp | 2 + hotspot/src/cpu/x86/vm/assembler_x86.cpp | 441 ++++++++++++++++-- hotspot/src/cpu/x86/vm/assembler_x86.hpp | 24 + .../src/cpu/x86/vm/c1_LIRAssembler_x86.cpp | 6 + .../src/cpu/x86/vm/c1_LIRGenerator_x86.cpp | 29 +- hotspot/src/cpu/x86/vm/c1_LinearScan_x86.cpp | 75 ++- hotspot/src/cpu/x86/vm/interpreter_x86_32.cpp | 13 + hotspot/src/cpu/x86/vm/interpreter_x86_64.cpp | 8 + .../src/cpu/x86/vm/stubGenerator_x86_32.cpp | 20 +- .../src/cpu/x86/vm/stubGenerator_x86_64.cpp | 31 +- .../cpu/x86/vm/templateInterpreter_x86_32.cpp | 8 +- .../cpu/x86/vm/templateInterpreter_x86_64.cpp | 8 +- hotspot/src/cpu/x86/vm/x86_32.ad | 215 ++------- hotspot/src/cpu/x86/vm/x86_64.ad | 32 ++ hotspot/src/share/vm/c1/c1_GraphBuilder.cpp | 7 + hotspot/src/share/vm/c1/c1_LIR.cpp | 57 ++- hotspot/src/share/vm/c1/c1_LIR.hpp | 43 +- hotspot/src/share/vm/c1/c1_LIRAssembler.cpp | 4 +- hotspot/src/share/vm/c1/c1_LIRGenerator.cpp | 4 +- hotspot/src/share/vm/c1/c1_LinearScan.cpp | 2 + .../vm/interpreter/abstractInterpreter.hpp | 2 + .../src/share/vm/interpreter/interpreter.cpp | 2 + .../vm/interpreter/templateInterpreter.cpp | 2 + hotspot/src/share/vm/opto/library_call.cpp | 11 +- hotspot/src/share/vm/opto/subnode.cpp | 2 - 26 files changed, 783 insertions(+), 279 deletions(-) diff --git a/hotspot/src/cpu/sparc/vm/c1_LIRGenerator_sparc.cpp b/hotspot/src/cpu/sparc/vm/c1_LIRGenerator_sparc.cpp index abf3ab9d513..e432fedd68b 100644 --- a/hotspot/src/cpu/sparc/vm/c1_LIRGenerator_sparc.cpp +++ b/hotspot/src/cpu/sparc/vm/c1_LIRGenerator_sparc.cpp @@ -738,7 +738,8 @@ void LIRGenerator::do_MathIntrinsic(Intrinsic* x) { case vmIntrinsics::_dlog: // fall through case vmIntrinsics::_dsin: // fall through case vmIntrinsics::_dtan: // fall through - case vmIntrinsics::_dcos: { + case vmIntrinsics::_dcos: // fall through + case vmIntrinsics::_dexp: { assert(x->number_of_arguments() == 1, "wrong type"); address runtime_entry = NULL; @@ -758,12 +759,23 @@ void LIRGenerator::do_MathIntrinsic(Intrinsic* x) { case vmIntrinsics::_dlog10: runtime_entry = CAST_FROM_FN_PTR(address, SharedRuntime::dlog10); break; + case vmIntrinsics::_dexp: + runtime_entry = CAST_FROM_FN_PTR(address, SharedRuntime::dexp); + break; default: ShouldNotReachHere(); } LIR_Opr result = call_runtime(x->argument_at(0), runtime_entry, x->type(), NULL); set_result(x, result); + break; + } + case vmIntrinsics::_dpow: { + assert(x->number_of_arguments() == 2, "wrong type"); + address runtime_entry = CAST_FROM_FN_PTR(address, SharedRuntime::dpow); + LIR_Opr result = call_runtime(x->argument_at(0), x->argument_at(1), runtime_entry, x->type(), NULL); + set_result(x, result); + break; } } } diff --git a/hotspot/src/cpu/sparc/vm/interpreter_sparc.cpp b/hotspot/src/cpu/sparc/vm/interpreter_sparc.cpp index 5471ebca2f7..7e0623376e1 100644 --- a/hotspot/src/cpu/sparc/vm/interpreter_sparc.cpp +++ b/hotspot/src/cpu/sparc/vm/interpreter_sparc.cpp @@ -403,6 +403,8 @@ address AbstractInterpreterGenerator::generate_method_entry(AbstractInterpreter: case Interpreter::java_lang_math_abs : break; case Interpreter::java_lang_math_log : break; case Interpreter::java_lang_math_log10 : break; + case Interpreter::java_lang_math_pow : break; + case Interpreter::java_lang_math_exp : break; case Interpreter::java_lang_ref_reference_get : entry_point = ((InterpreterGenerator*)this)->generate_Reference_get_entry(); break; default : ShouldNotReachHere(); break; diff --git a/hotspot/src/cpu/x86/vm/assembler_x86.cpp b/hotspot/src/cpu/x86/vm/assembler_x86.cpp index 7c7cb3d8a78..a1c2b00df52 100644 --- a/hotspot/src/cpu/x86/vm/assembler_x86.cpp +++ b/hotspot/src/cpu/x86/vm/assembler_x86.cpp @@ -3578,6 +3578,21 @@ void Assembler::fyl2x() { emit_byte(0xF1); } +void Assembler::frndint() { + emit_byte(0xD9); + emit_byte(0xFC); +} + +void Assembler::f2xm1() { + emit_byte(0xD9); + emit_byte(0xF0); +} + +void Assembler::fldl2e() { + emit_byte(0xD9); + emit_byte(0xEA); +} + // SSE SIMD prefix byte values corresponding to VexSimdPrefix encoding. static int simd_pre[4] = { 0, 0x66, 0xF3, 0xF2 }; // SSE opcode second byte values (first is 0x0F) corresponding to VexOpcode encoding. @@ -6868,6 +6883,242 @@ void MacroAssembler::fldcw(AddressLiteral src) { Assembler::fldcw(as_Address(src)); } +void MacroAssembler::pow_exp_core_encoding() { + // kills rax, rcx, rdx + subptr(rsp,sizeof(jdouble)); + // computes 2^X. Stack: X ... + // f2xm1 computes 2^X-1 but only operates on -1<=X<=1. Get int(X) and + // keep it on the thread's stack to compute 2^int(X) later + // then compute 2^(X-int(X)) as (2^(X-int(X)-1+1) + // final result is obtained with: 2^X = 2^int(X) * 2^(X-int(X)) + fld_s(0); // Stack: X X ... + frndint(); // Stack: int(X) X ... + fsuba(1); // Stack: int(X) X-int(X) ... + fistp_s(Address(rsp,0)); // move int(X) as integer to thread's stack. Stack: X-int(X) ... + f2xm1(); // Stack: 2^(X-int(X))-1 ... + fld1(); // Stack: 1 2^(X-int(X))-1 ... + faddp(1); // Stack: 2^(X-int(X)) + // computes 2^(int(X)): add exponent bias (1023) to int(X), then + // shift int(X)+1023 to exponent position. + // Exponent is limited to 11 bits if int(X)+1023 does not fit in 11 + // bits, set result to NaN. 0x000 and 0x7FF are reserved exponent + // values so detect them and set result to NaN. + movl(rax,Address(rsp,0)); + movl(rcx, -2048); // 11 bit mask and valid NaN binary encoding + addl(rax, 1023); + movl(rdx,rax); + shll(rax,20); + // Check that 0 < int(X)+1023 < 2047. Otherwise set rax to NaN. + addl(rdx,1); + // Check that 1 < int(X)+1023+1 < 2048 + // in 3 steps: + // 1- (int(X)+1023+1)&-2048 == 0 => 0 <= int(X)+1023+1 < 2048 + // 2- (int(X)+1023+1)&-2048 != 0 + // 3- (int(X)+1023+1)&-2048 != 1 + // Do 2- first because addl just updated the flags. + cmov32(Assembler::equal,rax,rcx); + cmpl(rdx,1); + cmov32(Assembler::equal,rax,rcx); + testl(rdx,rcx); + cmov32(Assembler::notEqual,rax,rcx); + movl(Address(rsp,4),rax); + movl(Address(rsp,0),0); + fmul_d(Address(rsp,0)); // Stack: 2^X ... + addptr(rsp,sizeof(jdouble)); +} + +void MacroAssembler::fast_pow() { + // computes X^Y = 2^(Y * log2(X)) + // if fast computation is not possible, result is NaN. Requires + // fallback from user of this macro. + fyl2x(); // Stack: (Y*log2(X)) ... + pow_exp_core_encoding(); // Stack: exp(X) ... +} + +void MacroAssembler::fast_exp() { + // computes exp(X) = 2^(X * log2(e)) + // if fast computation is not possible, result is NaN. Requires + // fallback from user of this macro. + fldl2e(); // Stack: log2(e) X ... + fmulp(1); // Stack: (X*log2(e)) ... + pow_exp_core_encoding(); // Stack: exp(X) ... +} + +void MacroAssembler::pow_or_exp(bool is_exp, int num_fpu_regs_in_use) { + // kills rax, rcx, rdx + // pow and exp needs 2 extra registers on the fpu stack. + Label slow_case, done; + Register tmp = noreg; + if (!VM_Version::supports_cmov()) { + // fcmp needs a temporary so preserve rdx, + tmp = rdx; + } + Register tmp2 = rax; + NOT_LP64(Register tmp3 = rcx;) + + if (is_exp) { + // Stack: X + fld_s(0); // duplicate argument for runtime call. Stack: X X + fast_exp(); // Stack: exp(X) X + fcmp(tmp, 0, false, false); // Stack: exp(X) X + // exp(X) not equal to itself: exp(X) is NaN go to slow case. + jcc(Assembler::parity, slow_case); + // get rid of duplicate argument. Stack: exp(X) + if (num_fpu_regs_in_use > 0) { + fxch(); + fpop(); + } else { + ffree(1); + } + jmp(done); + } else { + // Stack: X Y + Label x_negative, y_odd; + + fldz(); // Stack: 0 X Y + fcmp(tmp, 1, true, false); // Stack: X Y + jcc(Assembler::above, x_negative); + + // X >= 0 + + fld_s(1); // duplicate arguments for runtime call. Stack: Y X Y + fld_s(1); // Stack: X Y X Y + fast_pow(); // Stack: X^Y X Y + fcmp(tmp, 0, false, false); // Stack: X^Y X Y + // X^Y not equal to itself: X^Y is NaN go to slow case. + jcc(Assembler::parity, slow_case); + // get rid of duplicate arguments. Stack: X^Y + if (num_fpu_regs_in_use > 0) { + fxch(); fpop(); + fxch(); fpop(); + } else { + ffree(2); + ffree(1); + } + jmp(done); + + // X <= 0 + bind(x_negative); + + fld_s(1); // Stack: Y X Y + frndint(); // Stack: int(Y) X Y + fcmp(tmp, 2, false, false); // Stack: int(Y) X Y + jcc(Assembler::notEqual, slow_case); + + subptr(rsp, 8); + + // For X^Y, when X < 0, Y has to be an integer and the final + // result depends on whether it's odd or even. We just checked + // that int(Y) == Y. We move int(Y) to gp registers as a 64 bit + // integer to test its parity. If int(Y) is huge and doesn't fit + // in the 64 bit integer range, the integer indefinite value will + // end up in the gp registers. Huge numbers are all even, the + // integer indefinite number is even so it's fine. + +#ifdef ASSERT + // Let's check we don't end up with an integer indefinite number + // when not expected. First test for huge numbers: check whether + // int(Y)+1 == int(Y) which is true for very large numbers and + // those are all even. A 64 bit integer is guaranteed to not + // overflow for numbers where y+1 != y (when precision is set to + // double precision). + Label y_not_huge; + + fld1(); // Stack: 1 int(Y) X Y + fadd(1); // Stack: 1+int(Y) int(Y) X Y + +#ifdef _LP64 + // trip to memory to force the precision down from double extended + // precision + fstp_d(Address(rsp, 0)); + fld_d(Address(rsp, 0)); +#endif + + fcmp(tmp, 1, true, false); // Stack: int(Y) X Y +#endif + + // move int(Y) as 64 bit integer to thread's stack + fistp_d(Address(rsp,0)); // Stack: X Y + +#ifdef ASSERT + jcc(Assembler::notEqual, y_not_huge); + + // Y is huge so we know it's even. It may not fit in a 64 bit + // integer and we don't want the debug code below to see the + // integer indefinite value so overwrite int(Y) on the thread's + // stack with 0. + movl(Address(rsp, 0), 0); + movl(Address(rsp, 4), 0); + + bind(y_not_huge); +#endif + + fld_s(1); // duplicate arguments for runtime call. Stack: Y X Y + fld_s(1); // Stack: X Y X Y + fabs(); // Stack: abs(X) Y X Y + fast_pow(); // Stack: abs(X)^Y X Y + fcmp(tmp, 0, false, false); // Stack: abs(X)^Y X Y + // abs(X)^Y not equal to itself: abs(X)^Y is NaN go to slow case. + + pop(tmp2); + NOT_LP64(pop(tmp3)); + jcc(Assembler::parity, slow_case); + +#ifdef ASSERT + // Check that int(Y) is not integer indefinite value (int + // overflow). Shouldn't happen because for values that would + // overflow, 1+int(Y)==Y which was tested earlier. +#ifndef _LP64 + { + Label integer; + testl(tmp2, tmp2); + jcc(Assembler::notZero, integer); + cmpl(tmp3, 0x80000000); + jcc(Assembler::notZero, integer); + stop("integer indefinite value shouldn't be seen here"); + bind(integer); + } +#else + { + Label integer; + shlq(tmp2, 1); + jcc(Assembler::carryClear, integer); + jcc(Assembler::notZero, integer); + stop("integer indefinite value shouldn't be seen here"); + bind(integer); + } +#endif +#endif + + // get rid of duplicate arguments. Stack: X^Y + if (num_fpu_regs_in_use > 0) { + fxch(); fpop(); + fxch(); fpop(); + } else { + ffree(2); + ffree(1); + } + + testl(tmp2, 1); + jcc(Assembler::zero, done); // X <= 0, Y even: X^Y = abs(X)^Y + // X <= 0, Y even: X^Y = -abs(X)^Y + + fchs(); // Stack: -abs(X)^Y Y + jmp(done); + } + + // slow case: runtime call + bind(slow_case); + + fpop(); // pop incorrect result or int(Y) + + fp_runtime_fallback(is_exp ? CAST_FROM_FN_PTR(address, SharedRuntime::dexp) : CAST_FROM_FN_PTR(address, SharedRuntime::dpow), + is_exp ? 1 : 2, num_fpu_regs_in_use); + + // Come here with result in F-TOS + bind(done); +} + void MacroAssembler::fpop() { ffree(); fincstp(); @@ -8045,6 +8296,144 @@ void MacroAssembler::incr_allocated_bytes(Register thread, #endif } +void MacroAssembler::fp_runtime_fallback(address runtime_entry, int nb_args, int num_fpu_regs_in_use) { + pusha(); + + // if we are coming from c1, xmm registers may be live + if (UseSSE >= 1) { + subptr(rsp, sizeof(jdouble)* LP64_ONLY(16) NOT_LP64(8)); + } + int off = 0; + if (UseSSE == 1) { + movflt(Address(rsp,off++*sizeof(jdouble)),xmm0); + movflt(Address(rsp,off++*sizeof(jdouble)),xmm1); + movflt(Address(rsp,off++*sizeof(jdouble)),xmm2); + movflt(Address(rsp,off++*sizeof(jdouble)),xmm3); + movflt(Address(rsp,off++*sizeof(jdouble)),xmm4); + movflt(Address(rsp,off++*sizeof(jdouble)),xmm5); + movflt(Address(rsp,off++*sizeof(jdouble)),xmm6); + movflt(Address(rsp,off++*sizeof(jdouble)),xmm7); + } else if (UseSSE >= 2) { + movdbl(Address(rsp,off++*sizeof(jdouble)),xmm0); + movdbl(Address(rsp,off++*sizeof(jdouble)),xmm1); + movdbl(Address(rsp,off++*sizeof(jdouble)),xmm2); + movdbl(Address(rsp,off++*sizeof(jdouble)),xmm3); + movdbl(Address(rsp,off++*sizeof(jdouble)),xmm4); + movdbl(Address(rsp,off++*sizeof(jdouble)),xmm5); + movdbl(Address(rsp,off++*sizeof(jdouble)),xmm6); + movdbl(Address(rsp,off++*sizeof(jdouble)),xmm7); +#ifdef _LP64 + movdbl(Address(rsp,off++*sizeof(jdouble)),xmm8); + movdbl(Address(rsp,off++*sizeof(jdouble)),xmm9); + movdbl(Address(rsp,off++*sizeof(jdouble)),xmm10); + movdbl(Address(rsp,off++*sizeof(jdouble)),xmm11); + movdbl(Address(rsp,off++*sizeof(jdouble)),xmm12); + movdbl(Address(rsp,off++*sizeof(jdouble)),xmm13); + movdbl(Address(rsp,off++*sizeof(jdouble)),xmm14); + movdbl(Address(rsp,off++*sizeof(jdouble)),xmm15); +#endif + } + + // Preserve registers across runtime call + int incoming_argument_and_return_value_offset = -1; + if (num_fpu_regs_in_use > 1) { + // Must preserve all other FPU regs (could alternatively convert + // SharedRuntime::dsin, dcos etc. into assembly routines known not to trash + // FPU state, but can not trust C compiler) + NEEDS_CLEANUP; + // NOTE that in this case we also push the incoming argument(s) to + // the stack and restore it later; we also use this stack slot to + // hold the return value from dsin, dcos etc. + for (int i = 0; i < num_fpu_regs_in_use; i++) { + subptr(rsp, sizeof(jdouble)); + fstp_d(Address(rsp, 0)); + } + incoming_argument_and_return_value_offset = sizeof(jdouble)*(num_fpu_regs_in_use-1); + for (int i = nb_args-1; i >= 0; i--) { + fld_d(Address(rsp, incoming_argument_and_return_value_offset-i*sizeof(jdouble))); + } + } + + subptr(rsp, nb_args*sizeof(jdouble)); + for (int i = 0; i < nb_args; i++) { + fstp_d(Address(rsp, i*sizeof(jdouble))); + } + +#ifdef _LP64 + if (nb_args > 0) { + movdbl(xmm0, Address(rsp, 0)); + } + if (nb_args > 1) { + movdbl(xmm1, Address(rsp, sizeof(jdouble))); + } + assert(nb_args <= 2, "unsupported number of args"); +#endif // _LP64 + + // NOTE: we must not use call_VM_leaf here because that requires a + // complete interpreter frame in debug mode -- same bug as 4387334 + // MacroAssembler::call_VM_leaf_base is perfectly safe and will + // do proper 64bit abi + + NEEDS_CLEANUP; + // Need to add stack banging before this runtime call if it needs to + // be taken; however, there is no generic stack banging routine at + // the MacroAssembler level + + MacroAssembler::call_VM_leaf_base(runtime_entry, 0); + +#ifdef _LP64 + movsd(Address(rsp, 0), xmm0); + fld_d(Address(rsp, 0)); +#endif // _LP64 + addptr(rsp, sizeof(jdouble) * nb_args); + if (num_fpu_regs_in_use > 1) { + // Must save return value to stack and then restore entire FPU + // stack except incoming arguments + fstp_d(Address(rsp, incoming_argument_and_return_value_offset)); + for (int i = 0; i < num_fpu_regs_in_use - nb_args; i++) { + fld_d(Address(rsp, 0)); + addptr(rsp, sizeof(jdouble)); + } + fld_d(Address(rsp, (nb_args-1)*sizeof(jdouble))); + addptr(rsp, sizeof(jdouble) * nb_args); + } + + off = 0; + if (UseSSE == 1) { + movflt(xmm0, Address(rsp,off++*sizeof(jdouble))); + movflt(xmm1, Address(rsp,off++*sizeof(jdouble))); + movflt(xmm2, Address(rsp,off++*sizeof(jdouble))); + movflt(xmm3, Address(rsp,off++*sizeof(jdouble))); + movflt(xmm4, Address(rsp,off++*sizeof(jdouble))); + movflt(xmm5, Address(rsp,off++*sizeof(jdouble))); + movflt(xmm6, Address(rsp,off++*sizeof(jdouble))); + movflt(xmm7, Address(rsp,off++*sizeof(jdouble))); + } else if (UseSSE >= 2) { + movdbl(xmm0, Address(rsp,off++*sizeof(jdouble))); + movdbl(xmm1, Address(rsp,off++*sizeof(jdouble))); + movdbl(xmm2, Address(rsp,off++*sizeof(jdouble))); + movdbl(xmm3, Address(rsp,off++*sizeof(jdouble))); + movdbl(xmm4, Address(rsp,off++*sizeof(jdouble))); + movdbl(xmm5, Address(rsp,off++*sizeof(jdouble))); + movdbl(xmm6, Address(rsp,off++*sizeof(jdouble))); + movdbl(xmm7, Address(rsp,off++*sizeof(jdouble))); +#ifdef _LP64 + movdbl(xmm8, Address(rsp,off++*sizeof(jdouble))); + movdbl(xmm9, Address(rsp,off++*sizeof(jdouble))); + movdbl(xmm10, Address(rsp,off++*sizeof(jdouble))); + movdbl(xmm11, Address(rsp,off++*sizeof(jdouble))); + movdbl(xmm12, Address(rsp,off++*sizeof(jdouble))); + movdbl(xmm13, Address(rsp,off++*sizeof(jdouble))); + movdbl(xmm14, Address(rsp,off++*sizeof(jdouble))); + movdbl(xmm15, Address(rsp,off++*sizeof(jdouble))); +#endif + } + if (UseSSE >= 1) { + addptr(rsp, sizeof(jdouble)* LP64_ONLY(16) NOT_LP64(8)); + } + popa(); +} + static const double pi_4 = 0.7853981633974483; void MacroAssembler::trigfunc(char trig, int num_fpu_regs_in_use) { @@ -8092,73 +8481,27 @@ void MacroAssembler::trigfunc(char trig, int num_fpu_regs_in_use) { // slow case: runtime call bind(slow_case); - // Preserve registers across runtime call - pusha(); - int incoming_argument_and_return_value_offset = -1; - if (num_fpu_regs_in_use > 1) { - // Must preserve all other FPU regs (could alternatively convert - // SharedRuntime::dsin and dcos into assembly routines known not to trash - // FPU state, but can not trust C compiler) - NEEDS_CLEANUP; - // NOTE that in this case we also push the incoming argument to - // the stack and restore it later; we also use this stack slot to - // hold the return value from dsin or dcos. - for (int i = 0; i < num_fpu_regs_in_use; i++) { - subptr(rsp, sizeof(jdouble)); - fstp_d(Address(rsp, 0)); - } - incoming_argument_and_return_value_offset = sizeof(jdouble)*(num_fpu_regs_in_use-1); - fld_d(Address(rsp, incoming_argument_and_return_value_offset)); - } - subptr(rsp, sizeof(jdouble)); - fstp_d(Address(rsp, 0)); -#ifdef _LP64 - movdbl(xmm0, Address(rsp, 0)); -#endif // _LP64 - // NOTE: we must not use call_VM_leaf here because that requires a - // complete interpreter frame in debug mode -- same bug as 4387334 - // MacroAssembler::call_VM_leaf_base is perfectly safe and will - // do proper 64bit abi - - NEEDS_CLEANUP; - // Need to add stack banging before this runtime call if it needs to - // be taken; however, there is no generic stack banging routine at - // the MacroAssembler level switch(trig) { case 's': { - MacroAssembler::call_VM_leaf_base(CAST_FROM_FN_PTR(address, SharedRuntime::dsin), 0); + fp_runtime_fallback(CAST_FROM_FN_PTR(address, SharedRuntime::dsin), 1, num_fpu_regs_in_use); } break; case 'c': { - MacroAssembler::call_VM_leaf_base(CAST_FROM_FN_PTR(address, SharedRuntime::dcos), 0); + fp_runtime_fallback(CAST_FROM_FN_PTR(address, SharedRuntime::dcos), 1, num_fpu_regs_in_use); } break; case 't': { - MacroAssembler::call_VM_leaf_base(CAST_FROM_FN_PTR(address, SharedRuntime::dtan), 0); + fp_runtime_fallback(CAST_FROM_FN_PTR(address, SharedRuntime::dtan), 1, num_fpu_regs_in_use); } break; default: assert(false, "bad intrinsic"); break; } -#ifdef _LP64 - movsd(Address(rsp, 0), xmm0); - fld_d(Address(rsp, 0)); -#endif // _LP64 - addptr(rsp, sizeof(jdouble)); - if (num_fpu_regs_in_use > 1) { - // Must save return value to stack and then restore entire FPU stack - fstp_d(Address(rsp, incoming_argument_and_return_value_offset)); - for (int i = 0; i < num_fpu_regs_in_use; i++) { - fld_d(Address(rsp, 0)); - addptr(rsp, sizeof(jdouble)); - } - } - popa(); // Come here with result in F-TOS bind(done); diff --git a/hotspot/src/cpu/x86/vm/assembler_x86.hpp b/hotspot/src/cpu/x86/vm/assembler_x86.hpp index 4a72da83b98..d0f1171f9b0 100644 --- a/hotspot/src/cpu/x86/vm/assembler_x86.hpp +++ b/hotspot/src/cpu/x86/vm/assembler_x86.hpp @@ -1148,6 +1148,9 @@ private: void fxsave(Address dst); void fyl2x(); + void frndint(); + void f2xm1(); + void fldl2e(); void hlt(); @@ -2387,7 +2390,28 @@ class MacroAssembler: public Assembler { void ldmxcsr(Address src) { Assembler::ldmxcsr(src); } void ldmxcsr(AddressLiteral src); + // compute pow(x,y) and exp(x) with x86 instructions. Don't cover + // all corner cases and may result in NaN and require fallback to a + // runtime call. + void fast_pow(); + void fast_exp(); + + // computes exp(x). Fallback to runtime call included. + void exp_with_fallback(int num_fpu_regs_in_use) { pow_or_exp(true, num_fpu_regs_in_use); } + // computes pow(x,y). Fallback to runtime call included. + void pow_with_fallback(int num_fpu_regs_in_use) { pow_or_exp(false, num_fpu_regs_in_use); } + private: + + // call runtime as a fallback for trig functions and pow/exp. + void fp_runtime_fallback(address runtime_entry, int nb_args, int num_fpu_regs_in_use); + + // computes 2^(Ylog2X); Ylog2X in ST(0) + void pow_exp_core_encoding(); + + // computes pow(x,y) or exp(x). Fallback to runtime call included. + void pow_or_exp(bool is_exp, int num_fpu_regs_in_use); + // these are private because users should be doing movflt/movdbl void movss(Address dst, XMMRegister src) { Assembler::movss(dst, src); } diff --git a/hotspot/src/cpu/x86/vm/c1_LIRAssembler_x86.cpp b/hotspot/src/cpu/x86/vm/c1_LIRAssembler_x86.cpp index 4b2f8699e02..764c9cff7d5 100644 --- a/hotspot/src/cpu/x86/vm/c1_LIRAssembler_x86.cpp +++ b/hotspot/src/cpu/x86/vm/c1_LIRAssembler_x86.cpp @@ -2446,6 +2446,12 @@ void LIR_Assembler::intrinsic_op(LIR_Code code, LIR_Opr value, LIR_Opr unused, L // Should consider not saving rbx, if not necessary __ trigfunc('t', op->as_Op2()->fpu_stack_size()); break; + case lir_exp : + __ exp_with_fallback(op->as_Op2()->fpu_stack_size()); + break; + case lir_pow : + __ pow_with_fallback(op->as_Op2()->fpu_stack_size()); + break; default : ShouldNotReachHere(); } } else { diff --git a/hotspot/src/cpu/x86/vm/c1_LIRGenerator_x86.cpp b/hotspot/src/cpu/x86/vm/c1_LIRGenerator_x86.cpp index 1ff91cafb90..66d8ed0a845 100644 --- a/hotspot/src/cpu/x86/vm/c1_LIRGenerator_x86.cpp +++ b/hotspot/src/cpu/x86/vm/c1_LIRGenerator_x86.cpp @@ -823,7 +823,7 @@ void LIRGenerator::do_CompareAndSwap(Intrinsic* x, ValueType* type) { void LIRGenerator::do_MathIntrinsic(Intrinsic* x) { - assert(x->number_of_arguments() == 1, "wrong type"); + assert(x->number_of_arguments() == 1 || (x->number_of_arguments() == 2 && x->id() == vmIntrinsics::_dpow), "wrong type"); LIRItem value(x->argument_at(0), this); bool use_fpu = false; @@ -834,6 +834,8 @@ void LIRGenerator::do_MathIntrinsic(Intrinsic* x) { case vmIntrinsics::_dtan: case vmIntrinsics::_dlog: case vmIntrinsics::_dlog10: + case vmIntrinsics::_dexp: + case vmIntrinsics::_dpow: use_fpu = true; } } else { @@ -843,20 +845,37 @@ void LIRGenerator::do_MathIntrinsic(Intrinsic* x) { value.load_item(); LIR_Opr calc_input = value.result(); + LIR_Opr calc_input2 = NULL; + if (x->id() == vmIntrinsics::_dpow) { + LIRItem extra_arg(x->argument_at(1), this); + if (UseSSE < 2) { + extra_arg.set_destroys_register(); + } + extra_arg.load_item(); + calc_input2 = extra_arg.result(); + } LIR_Opr calc_result = rlock_result(x); - // sin and cos need two free fpu stack slots, so register two temporary operands + // sin, cos, pow and exp need two free fpu stack slots, so register + // two temporary operands LIR_Opr tmp1 = FrameMap::caller_save_fpu_reg_at(0); LIR_Opr tmp2 = FrameMap::caller_save_fpu_reg_at(1); if (use_fpu) { LIR_Opr tmp = FrameMap::fpu0_double_opr; + int tmp_start = 1; + if (calc_input2 != NULL) { + __ move(calc_input2, tmp); + tmp_start = 2; + calc_input2 = tmp; + } __ move(calc_input, tmp); calc_input = tmp; calc_result = tmp; - tmp1 = FrameMap::caller_save_fpu_reg_at(1); - tmp2 = FrameMap::caller_save_fpu_reg_at(2); + + tmp1 = FrameMap::caller_save_fpu_reg_at(tmp_start); + tmp2 = FrameMap::caller_save_fpu_reg_at(tmp_start + 1); } switch(x->id()) { @@ -867,6 +886,8 @@ void LIRGenerator::do_MathIntrinsic(Intrinsic* x) { case vmIntrinsics::_dtan: __ tan (calc_input, calc_result, tmp1, tmp2); break; case vmIntrinsics::_dlog: __ log (calc_input, calc_result, tmp1); break; case vmIntrinsics::_dlog10: __ log10(calc_input, calc_result, tmp1); break; + case vmIntrinsics::_dexp: __ exp (calc_input, calc_result, tmp1, tmp2, FrameMap::rax_opr, FrameMap::rcx_opr, FrameMap::rdx_opr); break; + case vmIntrinsics::_dpow: __ pow (calc_input, calc_input2, calc_result, tmp1, tmp2, FrameMap::rax_opr, FrameMap::rcx_opr, FrameMap::rdx_opr); break; default: ShouldNotReachHere(); } diff --git a/hotspot/src/cpu/x86/vm/c1_LinearScan_x86.cpp b/hotspot/src/cpu/x86/vm/c1_LinearScan_x86.cpp index 0c19851b31f..77859b9d6e1 100644 --- a/hotspot/src/cpu/x86/vm/c1_LinearScan_x86.cpp +++ b/hotspot/src/cpu/x86/vm/c1_LinearScan_x86.cpp @@ -690,8 +690,8 @@ void FpuStackAllocator::handle_op2(LIR_Op2* op2) { case lir_mul_strictfp: case lir_div_strictfp: { - assert(op2->tmp_opr()->is_fpu_register(), "strict operations need temporary fpu stack slot"); - insert_free_if_dead(op2->tmp_opr()); + assert(op2->tmp1_opr()->is_fpu_register(), "strict operations need temporary fpu stack slot"); + insert_free_if_dead(op2->tmp1_opr()); assert(sim()->stack_size() <= 7, "at least one stack slot must be free"); // fall-through: continue with the normal handling of lir_mul and lir_div } @@ -787,16 +787,17 @@ void FpuStackAllocator::handle_op2(LIR_Op2* op2) { case lir_log: case lir_log10: { - // log and log10 needs one temporary fpu stack slot, so there is ontemporary - // registers stored in temp of the operation. - // the stack allocator must guarantee that the stack slots are really free, - // otherwise there might be a stack overflow. + // log and log10 need one temporary fpu stack slot, so + // there is one temporary registers stored in temp of the + // operation. the stack allocator must guarantee that the stack + // slots are really free, otherwise there might be a stack + // overflow. assert(right->is_illegal(), "must be"); assert(left->is_fpu_register(), "must be"); assert(res->is_fpu_register(), "must be"); - assert(op2->tmp_opr()->is_fpu_register(), "must be"); + assert(op2->tmp1_opr()->is_fpu_register(), "must be"); - insert_free_if_dead(op2->tmp_opr()); + insert_free_if_dead(op2->tmp1_opr()); insert_free_if_dead(res, left); insert_exchange(left); do_rename(left, res); @@ -812,8 +813,9 @@ void FpuStackAllocator::handle_op2(LIR_Op2* op2) { case lir_tan: case lir_sin: - case lir_cos: { - // sin and cos need two temporary fpu stack slots, so there are two temporary + case lir_cos: + case lir_exp: { + // sin, cos and exp need two temporary fpu stack slots, so there are two temporary // registers (stored in right and temp of the operation). // the stack allocator must guarantee that the stack slots are really free, // otherwise there might be a stack overflow. @@ -821,11 +823,11 @@ void FpuStackAllocator::handle_op2(LIR_Op2* op2) { assert(res->is_fpu_register(), "must be"); // assert(left->is_last_use(), "old value gets destroyed"); assert(right->is_fpu_register(), "right is used as the first temporary register"); - assert(op2->tmp_opr()->is_fpu_register(), "temp is used as the second temporary register"); - assert(fpu_num(left) != fpu_num(right) && fpu_num(right) != fpu_num(op2->tmp_opr()) && fpu_num(op2->tmp_opr()) != fpu_num(res), "need distinct temp registers"); + assert(op2->tmp1_opr()->is_fpu_register(), "temp is used as the second temporary register"); + assert(fpu_num(left) != fpu_num(right) && fpu_num(right) != fpu_num(op2->tmp1_opr()) && fpu_num(op2->tmp1_opr()) != fpu_num(res), "need distinct temp registers"); insert_free_if_dead(right); - insert_free_if_dead(op2->tmp_opr()); + insert_free_if_dead(op2->tmp1_opr()); insert_free_if_dead(res, left); insert_exchange(left); @@ -839,6 +841,53 @@ void FpuStackAllocator::handle_op2(LIR_Op2* op2) { break; } + case lir_pow: { + // pow needs two temporary fpu stack slots, so there are two temporary + // registers (stored in tmp1 and tmp2 of the operation). + // the stack allocator must guarantee that the stack slots are really free, + // otherwise there might be a stack overflow. + assert(left->is_fpu_register(), "must be"); + assert(right->is_fpu_register(), "must be"); + assert(res->is_fpu_register(), "must be"); + + assert(op2->tmp1_opr()->is_fpu_register(), "tmp1 is the first temporary register"); + assert(op2->tmp2_opr()->is_fpu_register(), "tmp2 is the second temporary register"); + assert(fpu_num(left) != fpu_num(right) && fpu_num(left) != fpu_num(op2->tmp1_opr()) && fpu_num(left) != fpu_num(op2->tmp2_opr()) && fpu_num(left) != fpu_num(res), "need distinct temp registers"); + assert(fpu_num(right) != fpu_num(op2->tmp1_opr()) && fpu_num(right) != fpu_num(op2->tmp2_opr()) && fpu_num(right) != fpu_num(res), "need distinct temp registers"); + assert(fpu_num(op2->tmp1_opr()) != fpu_num(op2->tmp2_opr()) && fpu_num(op2->tmp1_opr()) != fpu_num(res), "need distinct temp registers"); + assert(fpu_num(op2->tmp2_opr()) != fpu_num(res), "need distinct temp registers"); + + insert_free_if_dead(op2->tmp1_opr()); + insert_free_if_dead(op2->tmp2_opr()); + + // Must bring both operands to top of stack with following operand ordering: + // * fpu stack before pow: ... right left + // * fpu stack after pow: ... left + + insert_free_if_dead(res, right); + + if (tos_offset(right) != 1) { + insert_exchange(right); + insert_exchange(1); + } + insert_exchange(left); + assert(tos_offset(right) == 1, "check"); + assert(tos_offset(left) == 0, "check"); + + new_left = to_fpu_stack_top(left); + new_right = to_fpu_stack(right); + + op2->set_fpu_stack_size(sim()->stack_size()); + assert(sim()->stack_size() <= 6, "at least two stack slots must be free"); + + sim()->pop(); + + do_rename(right, res); + + new_res = to_fpu_stack_top(res); + break; + } + default: { assert(false, "missed a fpu-operation"); } diff --git a/hotspot/src/cpu/x86/vm/interpreter_x86_32.cpp b/hotspot/src/cpu/x86/vm/interpreter_x86_32.cpp index 43a5a18a5b6..8072354e9a1 100644 --- a/hotspot/src/cpu/x86/vm/interpreter_x86_32.cpp +++ b/hotspot/src/cpu/x86/vm/interpreter_x86_32.cpp @@ -181,6 +181,19 @@ address InterpreterGenerator::generate_math_entry(AbstractInterpreter::MethodKin __ push_fTOS(); __ pop_fTOS(); break; + case Interpreter::java_lang_math_pow: + __ fld_d(Address(rsp, 3*wordSize)); // second argument + __ pow_with_fallback(0); + // Store to stack to convert 80bit precision back to 64bits + __ push_fTOS(); + __ pop_fTOS(); + break; + case Interpreter::java_lang_math_exp: + __ exp_with_fallback(0); + // Store to stack to convert 80bit precision back to 64bits + __ push_fTOS(); + __ pop_fTOS(); + break; default : ShouldNotReachHere(); } diff --git a/hotspot/src/cpu/x86/vm/interpreter_x86_64.cpp b/hotspot/src/cpu/x86/vm/interpreter_x86_64.cpp index 1c124c2f0b7..76143737858 100644 --- a/hotspot/src/cpu/x86/vm/interpreter_x86_64.cpp +++ b/hotspot/src/cpu/x86/vm/interpreter_x86_64.cpp @@ -271,6 +271,14 @@ address InterpreterGenerator::generate_math_entry(AbstractInterpreter::MethodKin case Interpreter::java_lang_math_log10: __ flog10(); break; + case Interpreter::java_lang_math_pow: + __ fld_d(Address(rsp, 3*wordSize)); // second argument (one + // empty stack slot) + __ pow_with_fallback(0); + break; + case Interpreter::java_lang_math_exp: + __ exp_with_fallback(0); + break; default : ShouldNotReachHere(); } diff --git a/hotspot/src/cpu/x86/vm/stubGenerator_x86_32.cpp b/hotspot/src/cpu/x86/vm/stubGenerator_x86_32.cpp index 4d4e66f600b..43d51bd38c4 100644 --- a/hotspot/src/cpu/x86/vm/stubGenerator_x86_32.cpp +++ b/hotspot/src/cpu/x86/vm/stubGenerator_x86_32.cpp @@ -2136,11 +2136,23 @@ class StubGenerator: public StubCodeGenerator { __ trigfunc('t'); __ ret(0); } + { + StubCodeMark mark(this, "StubRoutines", "exp"); + StubRoutines::_intrinsic_exp = (double (*)(double)) __ pc(); - // The intrinsic version of these seem to return the same value as - // the strict version. - StubRoutines::_intrinsic_exp = SharedRuntime::dexp; - StubRoutines::_intrinsic_pow = SharedRuntime::dpow; + __ fld_d(Address(rsp, 4)); + __ exp_with_fallback(0); + __ ret(0); + } + { + StubCodeMark mark(this, "StubRoutines", "pow"); + StubRoutines::_intrinsic_pow = (double (*)(double,double)) __ pc(); + + __ fld_d(Address(rsp, 12)); + __ fld_d(Address(rsp, 4)); + __ pow_with_fallback(0); + __ ret(0); + } } public: diff --git a/hotspot/src/cpu/x86/vm/stubGenerator_x86_64.cpp b/hotspot/src/cpu/x86/vm/stubGenerator_x86_64.cpp index 9d9472200e3..30382b5ab5f 100644 --- a/hotspot/src/cpu/x86/vm/stubGenerator_x86_64.cpp +++ b/hotspot/src/cpu/x86/vm/stubGenerator_x86_64.cpp @@ -2928,11 +2928,34 @@ class StubGenerator: public StubCodeGenerator { __ addq(rsp, 8); __ ret(0); } + { + StubCodeMark mark(this, "StubRoutines", "exp"); + StubRoutines::_intrinsic_exp = (double (*)(double)) __ pc(); - // The intrinsic version of these seem to return the same value as - // the strict version. - StubRoutines::_intrinsic_exp = SharedRuntime::dexp; - StubRoutines::_intrinsic_pow = SharedRuntime::dpow; + __ subq(rsp, 8); + __ movdbl(Address(rsp, 0), xmm0); + __ fld_d(Address(rsp, 0)); + __ exp_with_fallback(0); + __ fstp_d(Address(rsp, 0)); + __ movdbl(xmm0, Address(rsp, 0)); + __ addq(rsp, 8); + __ ret(0); + } + { + StubCodeMark mark(this, "StubRoutines", "pow"); + StubRoutines::_intrinsic_pow = (double (*)(double,double)) __ pc(); + + __ subq(rsp, 8); + __ movdbl(Address(rsp, 0), xmm1); + __ fld_d(Address(rsp, 0)); + __ movdbl(Address(rsp, 0), xmm0); + __ fld_d(Address(rsp, 0)); + __ pow_with_fallback(0); + __ fstp_d(Address(rsp, 0)); + __ movdbl(xmm0, Address(rsp, 0)); + __ addq(rsp, 8); + __ ret(0); + } } #undef __ diff --git a/hotspot/src/cpu/x86/vm/templateInterpreter_x86_32.cpp b/hotspot/src/cpu/x86/vm/templateInterpreter_x86_32.cpp index 29533832ef6..fda7980d821 100644 --- a/hotspot/src/cpu/x86/vm/templateInterpreter_x86_32.cpp +++ b/hotspot/src/cpu/x86/vm/templateInterpreter_x86_32.cpp @@ -1518,7 +1518,9 @@ address AbstractInterpreterGenerator::generate_method_entry(AbstractInterpreter: case Interpreter::java_lang_math_abs : // fall thru case Interpreter::java_lang_math_log : // fall thru case Interpreter::java_lang_math_log10 : // fall thru - case Interpreter::java_lang_math_sqrt : entry_point = ((InterpreterGenerator*)this)->generate_math_entry(kind); break; + case Interpreter::java_lang_math_sqrt : // fall thru + case Interpreter::java_lang_math_pow : // fall thru + case Interpreter::java_lang_math_exp : entry_point = ((InterpreterGenerator*)this)->generate_math_entry(kind); break; case Interpreter::java_lang_ref_reference_get : entry_point = ((InterpreterGenerator*)this)->generate_Reference_get_entry(); break; default : ShouldNotReachHere(); break; @@ -1540,7 +1542,9 @@ bool AbstractInterpreter::can_be_compiled(methodHandle m) { case Interpreter::java_lang_math_abs : // fall thru case Interpreter::java_lang_math_log : // fall thru case Interpreter::java_lang_math_log10 : // fall thru - case Interpreter::java_lang_math_sqrt : + case Interpreter::java_lang_math_sqrt : // fall thru + case Interpreter::java_lang_math_pow : // fall thru + case Interpreter::java_lang_math_exp : return false; default: return true; diff --git a/hotspot/src/cpu/x86/vm/templateInterpreter_x86_64.cpp b/hotspot/src/cpu/x86/vm/templateInterpreter_x86_64.cpp index 110d8ebdf3c..2e78cd5aa10 100644 --- a/hotspot/src/cpu/x86/vm/templateInterpreter_x86_64.cpp +++ b/hotspot/src/cpu/x86/vm/templateInterpreter_x86_64.cpp @@ -1534,7 +1534,9 @@ address AbstractInterpreterGenerator::generate_method_entry( case Interpreter::java_lang_math_abs : // fall thru case Interpreter::java_lang_math_log : // fall thru case Interpreter::java_lang_math_log10 : // fall thru - case Interpreter::java_lang_math_sqrt : entry_point = ((InterpreterGenerator*) this)->generate_math_entry(kind); break; + case Interpreter::java_lang_math_sqrt : // fall thru + case Interpreter::java_lang_math_pow : // fall thru + case Interpreter::java_lang_math_exp : entry_point = ((InterpreterGenerator*) this)->generate_math_entry(kind); break; case Interpreter::java_lang_ref_reference_get : entry_point = ((InterpreterGenerator*)this)->generate_Reference_get_entry(); break; default : ShouldNotReachHere(); break; @@ -1558,7 +1560,9 @@ bool AbstractInterpreter::can_be_compiled(methodHandle m) { case Interpreter::java_lang_math_abs : // fall thru case Interpreter::java_lang_math_log : // fall thru case Interpreter::java_lang_math_log10 : // fall thru - case Interpreter::java_lang_math_sqrt : + case Interpreter::java_lang_math_sqrt : // fall thru + case Interpreter::java_lang_math_pow : // fall thru + case Interpreter::java_lang_math_exp : return false; default: return true; diff --git a/hotspot/src/cpu/x86/vm/x86_32.ad b/hotspot/src/cpu/x86/vm/x86_32.ad index 1c5248fecbe..cd4adccd352 100644 --- a/hotspot/src/cpu/x86/vm/x86_32.ad +++ b/hotspot/src/cpu/x86/vm/x86_32.ad @@ -2536,45 +2536,6 @@ encode %{ __ fld_d(Address(rsp, 0)); %} - // Compute X^Y using Intel's fast hardware instructions, if possible. - // Otherwise return a NaN. - enc_class pow_exp_core_encoding %{ - // FPR1 holds Y*ln2(X). Compute FPR1 = 2^(Y*ln2(X)) - emit_opcode(cbuf,0xD9); emit_opcode(cbuf,0xC0); // fdup = fld st(0) Q Q - emit_opcode(cbuf,0xD9); emit_opcode(cbuf,0xFC); // frndint int(Q) Q - emit_opcode(cbuf,0xDC); emit_opcode(cbuf,0xE9); // fsub st(1) -= st(0); int(Q) frac(Q) - emit_opcode(cbuf,0xDB); // FISTP [ESP] frac(Q) - emit_opcode(cbuf,0x1C); - emit_d8(cbuf,0x24); - emit_opcode(cbuf,0xD9); emit_opcode(cbuf,0xF0); // f2xm1 2^frac(Q)-1 - emit_opcode(cbuf,0xD9); emit_opcode(cbuf,0xE8); // fld1 1 2^frac(Q)-1 - emit_opcode(cbuf,0xDE); emit_opcode(cbuf,0xC1); // faddp 2^frac(Q) - emit_opcode(cbuf,0x8B); // mov rax,[esp+0]=int(Q) - encode_RegMem(cbuf, EAX_enc, ESP_enc, 0x4, 0, 0, false); - emit_opcode(cbuf,0xC7); // mov rcx,0xFFFFF800 - overflow mask - emit_rm(cbuf, 0x3, 0x0, ECX_enc); - emit_d32(cbuf,0xFFFFF800); - emit_opcode(cbuf,0x81); // add rax,1023 - the double exponent bias - emit_rm(cbuf, 0x3, 0x0, EAX_enc); - emit_d32(cbuf,1023); - emit_opcode(cbuf,0x8B); // mov rbx,eax - emit_rm(cbuf, 0x3, EBX_enc, EAX_enc); - emit_opcode(cbuf,0xC1); // shl rax,20 - Slide to exponent position - emit_rm(cbuf,0x3,0x4,EAX_enc); - emit_d8(cbuf,20); - emit_opcode(cbuf,0x85); // test rbx,ecx - check for overflow - emit_rm(cbuf, 0x3, EBX_enc, ECX_enc); - emit_opcode(cbuf,0x0F); emit_opcode(cbuf,0x45); // CMOVne rax,ecx - overflow; stuff NAN into EAX - emit_rm(cbuf, 0x3, EAX_enc, ECX_enc); - emit_opcode(cbuf,0x89); // mov [esp+4],eax - Store as part of double word - encode_RegMem(cbuf, EAX_enc, ESP_enc, 0x4, 0, 4, false); - emit_opcode(cbuf,0xC7); // mov [esp+0],0 - [ESP] = (double)(1< $Y // KILL $rax, $rcx, $rdx" %} + ins_encode %{ + __ subptr(rsp, 8); + __ fld_s($X$$reg - 1); + __ fast_pow(); + __ addptr(rsp, 8); + %} ins_pipe( pipe_slow ); %} -instruct powD_reg(regD dst, regD src0, regD src1, regDPR1 tmp1, eAXRegI rax, eBXRegI rbx, eCXRegI rcx ) %{ +instruct powD_reg(regD dst, regD src0, regD src1, eAXRegI rax, eDXRegI rdx, eCXRegI rcx, eFlagsReg cr) %{ predicate (UseSSE>=2); match(Set dst (PowD src0 src1)); // Raise src0 to the src1'th power - effect(KILL tmp1, KILL rax, KILL rbx, KILL rcx ); - format %{ "SUB ESP,8\t\t# Fast-path POW encoding\n\t" - "MOVSD [ESP],$src1\n\t" - "FLD FPR1,$src1\n\t" - "MOVSD [ESP],$src0\n\t" - "FLD FPR1,$src0\n\t" - "FYL2X \t\t\t# Q=Y*ln2(X)\n\t" - - "FDUP \t\t\t# Q Q\n\t" - "FRNDINT\t\t\t# int(Q) Q\n\t" - "FSUB ST(1),ST(0)\t# int(Q) frac(Q)\n\t" - "FISTP dword [ESP]\n\t" - "F2XM1 \t\t\t# 2^frac(Q)-1 int(Q)\n\t" - "FLD1 \t\t\t# 1 2^frac(Q)-1 int(Q)\n\t" - "FADDP \t\t\t# 2^frac(Q) int(Q)\n\t" // could use FADD [1.000] instead - "MOV EAX,[ESP]\t# Pick up int(Q)\n\t" - "MOV ECX,0xFFFFF800\t# Overflow mask\n\t" - "ADD EAX,1023\t\t# Double exponent bias\n\t" - "MOV EBX,EAX\t\t# Preshifted biased expo\n\t" - "SHL EAX,20\t\t# Shift exponent into place\n\t" - "TEST EBX,ECX\t\t# Check for overflow\n\t" - "CMOVne EAX,ECX\t\t# If overflow, stuff NaN into EAX\n\t" - "MOV [ESP+4],EAX\t# Marshal 64-bit scaling double\n\t" - "MOV [ESP+0],0\n\t" - "FMUL ST(0),[ESP+0]\t# Scale\n\t" - - "FST_D [ESP]\n\t" - "MOVSD $dst,[ESP]\n\t" - "ADD ESP,8" - %} - ins_encode( push_stack_temp_qword, - push_xmm_to_fpr1(src1), - push_xmm_to_fpr1(src0), - Opcode(0xD9), Opcode(0xF1), // fyl2x - pow_exp_core_encoding, - Push_ResultD(dst) ); + effect(KILL rax, KILL rdx, KILL rcx, KILL cr); + format %{ "fast_pow $src0 $src1 -> $dst // KILL $rax, $rcx, $rdx" %} + ins_encode %{ + __ subptr(rsp, 8); + __ movdbl(Address(rsp, 0), $src1$$XMMRegister); + __ fld_d(Address(rsp, 0)); + __ movdbl(Address(rsp, 0), $src0$$XMMRegister); + __ fld_d(Address(rsp, 0)); + __ fast_pow(); + __ fstp_d(Address(rsp, 0)); + __ movdbl($dst$$XMMRegister, Address(rsp, 0)); + __ addptr(rsp, 8); + %} ins_pipe( pipe_slow ); %} -instruct expDPR_reg(regDPR1 dpr1, eAXRegI rax, eBXRegI rbx, eCXRegI rcx) %{ +instruct expDPR_reg(regDPR1 dpr1, eAXRegI rax, eDXRegI rdx, eCXRegI rcx, eFlagsReg cr) %{ predicate (UseSSE<=1); match(Set dpr1 (ExpD dpr1)); - effect(KILL rax, KILL rbx, KILL rcx); - format %{ "SUB ESP,8\t\t# Fast-path EXP encoding" - "FLDL2E \t\t\t# Ld log2(e) X\n\t" - "FMULP \t\t\t# Q=X*log2(e)\n\t" - - "FDUP \t\t\t# Q Q\n\t" - "FRNDINT\t\t\t# int(Q) Q\n\t" - "FSUB ST(1),ST(0)\t# int(Q) frac(Q)\n\t" - "FISTP dword [ESP]\n\t" - "F2XM1 \t\t\t# 2^frac(Q)-1 int(Q)\n\t" - "FLD1 \t\t\t# 1 2^frac(Q)-1 int(Q)\n\t" - "FADDP \t\t\t# 2^frac(Q) int(Q)\n\t" // could use FADD [1.000] instead - "MOV EAX,[ESP]\t# Pick up int(Q)\n\t" - "MOV ECX,0xFFFFF800\t# Overflow mask\n\t" - "ADD EAX,1023\t\t# Double exponent bias\n\t" - "MOV EBX,EAX\t\t# Preshifted biased expo\n\t" - "SHL EAX,20\t\t# Shift exponent into place\n\t" - "TEST EBX,ECX\t\t# Check for overflow\n\t" - "CMOVne EAX,ECX\t\t# If overflow, stuff NaN into EAX\n\t" - "MOV [ESP+4],EAX\t# Marshal 64-bit scaling double\n\t" - "MOV [ESP+0],0\n\t" - "FMUL ST(0),[ESP+0]\t# Scale\n\t" - - "ADD ESP,8" - %} - ins_encode( push_stack_temp_qword, - Opcode(0xD9), Opcode(0xEA), // fldl2e - Opcode(0xDE), Opcode(0xC9), // fmulp - pow_exp_core_encoding, - pop_stack_temp_qword); + effect(KILL rax, KILL rcx, KILL rdx, KILL cr); + format %{ "fast_exp $dpr1 -> $dpr1 // KILL $rax, $rcx, $rdx" %} + ins_encode %{ + __ fast_exp(); + %} ins_pipe( pipe_slow ); %} -instruct expD_reg(regD dst, regD src, regDPR1 tmp1, eAXRegI rax, eBXRegI rbx, eCXRegI rcx) %{ +instruct expD_reg(regD dst, regD src, eAXRegI rax, eDXRegI rdx, eCXRegI rcx, eFlagsReg cr) %{ predicate (UseSSE>=2); match(Set dst (ExpD src)); - effect(KILL tmp1, KILL rax, KILL rbx, KILL rcx); - format %{ "SUB ESP,8\t\t# Fast-path EXP encoding\n\t" - "MOVSD [ESP],$src\n\t" - "FLDL2E \t\t\t# Ld log2(e) X\n\t" - "FMULP \t\t\t# Q=X*log2(e) X\n\t" - - "FDUP \t\t\t# Q Q\n\t" - "FRNDINT\t\t\t# int(Q) Q\n\t" - "FSUB ST(1),ST(0)\t# int(Q) frac(Q)\n\t" - "FISTP dword [ESP]\n\t" - "F2XM1 \t\t\t# 2^frac(Q)-1 int(Q)\n\t" - "FLD1 \t\t\t# 1 2^frac(Q)-1 int(Q)\n\t" - "FADDP \t\t\t# 2^frac(Q) int(Q)\n\t" // could use FADD [1.000] instead - "MOV EAX,[ESP]\t# Pick up int(Q)\n\t" - "MOV ECX,0xFFFFF800\t# Overflow mask\n\t" - "ADD EAX,1023\t\t# Double exponent bias\n\t" - "MOV EBX,EAX\t\t# Preshifted biased expo\n\t" - "SHL EAX,20\t\t# Shift exponent into place\n\t" - "TEST EBX,ECX\t\t# Check for overflow\n\t" - "CMOVne EAX,ECX\t\t# If overflow, stuff NaN into EAX\n\t" - "MOV [ESP+4],EAX\t# Marshal 64-bit scaling double\n\t" - "MOV [ESP+0],0\n\t" - "FMUL ST(0),[ESP+0]\t# Scale\n\t" - - "FST_D [ESP]\n\t" - "MOVSD $dst,[ESP]\n\t" - "ADD ESP,8" - %} - ins_encode( Push_SrcD(src), - Opcode(0xD9), Opcode(0xEA), // fldl2e - Opcode(0xDE), Opcode(0xC9), // fmulp - pow_exp_core_encoding, - Push_ResultD(dst) ); + effect(KILL rax, KILL rcx, KILL rdx, KILL cr); + format %{ "fast_exp $dst -> $src // KILL $rax, $rcx, $rdx" %} + ins_encode %{ + __ subptr(rsp, 8); + __ movdbl(Address(rsp, 0), $src$$XMMRegister); + __ fld_d(Address(rsp, 0)); + __ fast_exp(); + __ fstp_d(Address(rsp, 0)); + __ movdbl($dst$$XMMRegister, Address(rsp, 0)); + __ addptr(rsp, 8); + %} ins_pipe( pipe_slow ); %} - - instruct log10DPR_reg(regDPR1 dst, regDPR1 src) %{ predicate (UseSSE<=1); // The source Double operand on FPU stack diff --git a/hotspot/src/cpu/x86/vm/x86_64.ad b/hotspot/src/cpu/x86/vm/x86_64.ad index 81a01ff9e00..80928c3fa2d 100644 --- a/hotspot/src/cpu/x86/vm/x86_64.ad +++ b/hotspot/src/cpu/x86/vm/x86_64.ad @@ -9823,7 +9823,39 @@ instruct logD_reg(regD dst) %{ ins_pipe( pipe_slow ); %} +instruct powD_reg(regD dst, regD src0, regD src1, rax_RegI rax, rdx_RegI rdx, rcx_RegI rcx, rFlagsReg cr) %{ + match(Set dst (PowD src0 src1)); // Raise src0 to the src1'th power + effect(KILL rax, KILL rdx, KILL rcx, KILL cr); + format %{ "fast_pow $src0 $src1 -> $dst // KILL $rax, $rcx, $rdx" %} + ins_encode %{ + __ subptr(rsp, 8); + __ movdbl(Address(rsp, 0), $src1$$XMMRegister); + __ fld_d(Address(rsp, 0)); + __ movdbl(Address(rsp, 0), $src0$$XMMRegister); + __ fld_d(Address(rsp, 0)); + __ fast_pow(); + __ fstp_d(Address(rsp, 0)); + __ movdbl($dst$$XMMRegister, Address(rsp, 0)); + __ addptr(rsp, 8); + %} + ins_pipe( pipe_slow ); +%} +instruct expD_reg(regD dst, regD src, rax_RegI rax, rdx_RegI rdx, rcx_RegI rcx, rFlagsReg cr) %{ + match(Set dst (ExpD src)); + effect(KILL rax, KILL rcx, KILL rdx, KILL cr); + format %{ "fast_exp $dst -> $src // KILL $rax, $rcx, $rdx" %} + ins_encode %{ + __ subptr(rsp, 8); + __ movdbl(Address(rsp, 0), $src$$XMMRegister); + __ fld_d(Address(rsp, 0)); + __ fast_exp(); + __ fstp_d(Address(rsp, 0)); + __ movdbl($dst$$XMMRegister, Address(rsp, 0)); + __ addptr(rsp, 8); + %} + ins_pipe( pipe_slow ); +%} //----------Arithmetic Conversion Instructions--------------------------------- diff --git a/hotspot/src/share/vm/c1/c1_GraphBuilder.cpp b/hotspot/src/share/vm/c1/c1_GraphBuilder.cpp index c11a2a2c177..2a2b8ae9d9d 100644 --- a/hotspot/src/share/vm/c1/c1_GraphBuilder.cpp +++ b/hotspot/src/share/vm/c1/c1_GraphBuilder.cpp @@ -2949,6 +2949,8 @@ GraphBuilder::GraphBuilder(Compilation* compilation, IRScope* scope) case vmIntrinsics::_dtan : // fall through case vmIntrinsics::_dlog : // fall through case vmIntrinsics::_dlog10 : // fall through + case vmIntrinsics::_dexp : // fall through + case vmIntrinsics::_dpow : // fall through { // Compiles where the root method is an intrinsic need a special // compilation environment because the bytecodes for the method @@ -2969,6 +2971,9 @@ GraphBuilder::GraphBuilder(Compilation* compilation, IRScope* scope) _state = start_block->state()->copy_for_parsing(); _last = start_block; load_local(doubleType, 0); + if (scope->method()->intrinsic_id() == vmIntrinsics::_dpow) { + load_local(doubleType, 2); + } // Emit the intrinsic node. bool result = try_inline_intrinsics(scope->method()); @@ -3182,6 +3187,8 @@ bool GraphBuilder::try_inline_intrinsics(ciMethod* callee) { case vmIntrinsics::_dtan : // fall through case vmIntrinsics::_dlog : // fall through case vmIntrinsics::_dlog10 : // fall through + case vmIntrinsics::_dexp : // fall through + case vmIntrinsics::_dpow : // fall through if (!InlineMathNatives) return false; cantrap = false; preserves_state = true; diff --git a/hotspot/src/share/vm/c1/c1_LIR.cpp b/hotspot/src/share/vm/c1/c1_LIR.cpp index 776a6a3df2d..c85e71f9954 100644 --- a/hotspot/src/share/vm/c1/c1_LIR.cpp +++ b/hotspot/src/share/vm/c1/c1_LIR.cpp @@ -624,11 +624,13 @@ void LIR_OpVisitState::visit(LIR_Op* op) { { assert(op->as_Op2() != NULL, "must be"); LIR_Op2* op2 = (LIR_Op2*)op; + assert(op2->_tmp2->is_illegal() && op2->_tmp3->is_illegal() && + op2->_tmp4->is_illegal() && op2->_tmp5->is_illegal(), "not used"); if (op2->_info) do_info(op2->_info); if (op2->_opr1->is_valid()) do_input(op2->_opr1); if (op2->_opr2->is_valid()) do_input(op2->_opr2); - if (op2->_tmp->is_valid()) do_temp(op2->_tmp); + if (op2->_tmp1->is_valid()) do_temp(op2->_tmp1); if (op2->_result->is_valid()) do_output(op2->_result); break; @@ -641,7 +643,8 @@ void LIR_OpVisitState::visit(LIR_Op* op) { assert(op->as_Op2() != NULL, "must be"); LIR_Op2* op2 = (LIR_Op2*)op; - assert(op2->_info == NULL && op2->_tmp->is_illegal(), "not used"); + assert(op2->_info == NULL && op2->_tmp1->is_illegal() && op2->_tmp2->is_illegal() && + op2->_tmp3->is_illegal() && op2->_tmp4->is_illegal() && op2->_tmp5->is_illegal(), "not used"); assert(op2->_opr1->is_valid() && op2->_opr2->is_valid() && op2->_result->is_valid(), "used"); do_input(op2->_opr1); @@ -665,10 +668,12 @@ void LIR_OpVisitState::visit(LIR_Op* op) { assert(op2->_opr1->is_valid(), "used"); assert(op2->_opr2->is_valid(), "used"); assert(op2->_result->is_valid(), "used"); + assert(op2->_tmp2->is_illegal() && op2->_tmp3->is_illegal() && + op2->_tmp4->is_illegal() && op2->_tmp5->is_illegal(), "not used"); do_input(op2->_opr1); do_temp(op2->_opr1); do_input(op2->_opr2); do_temp(op2->_opr2); - if (op2->_tmp->is_valid()) do_temp(op2->_tmp); + if (op2->_tmp1->is_valid()) do_temp(op2->_tmp1); do_output(op2->_result); break; @@ -682,6 +687,8 @@ void LIR_OpVisitState::visit(LIR_Op* op) { if (op2->_opr1->is_valid()) do_temp(op2->_opr1); if (op2->_opr2->is_valid()) do_input(op2->_opr2); // exception object is input parameter assert(op2->_result->is_illegal(), "no result"); + assert(op2->_tmp2->is_illegal() && op2->_tmp3->is_illegal() && + op2->_tmp4->is_illegal() && op2->_tmp5->is_illegal(), "not used"); break; } @@ -702,7 +709,8 @@ void LIR_OpVisitState::visit(LIR_Op* op) { case lir_sin: case lir_cos: case lir_log: - case lir_log10: { + case lir_log10: + case lir_exp: { assert(op->as_Op2() != NULL, "must be"); LIR_Op2* op2 = (LIR_Op2*)op; @@ -711,16 +719,47 @@ void LIR_OpVisitState::visit(LIR_Op* op) { // Register input operand as temp to guarantee that it doesn't // overlap with the input. assert(op2->_info == NULL, "not used"); + assert(op2->_tmp5->is_illegal(), "not used"); + assert(op2->_tmp2->is_valid() == (op->code() == lir_exp), "not used"); + assert(op2->_tmp3->is_valid() == (op->code() == lir_exp), "not used"); + assert(op2->_tmp4->is_valid() == (op->code() == lir_exp), "not used"); assert(op2->_opr1->is_valid(), "used"); do_input(op2->_opr1); do_temp(op2->_opr1); if (op2->_opr2->is_valid()) do_temp(op2->_opr2); - if (op2->_tmp->is_valid()) do_temp(op2->_tmp); + if (op2->_tmp1->is_valid()) do_temp(op2->_tmp1); + if (op2->_tmp2->is_valid()) do_temp(op2->_tmp2); + if (op2->_tmp3->is_valid()) do_temp(op2->_tmp3); + if (op2->_tmp4->is_valid()) do_temp(op2->_tmp4); if (op2->_result->is_valid()) do_output(op2->_result); break; } + case lir_pow: { + assert(op->as_Op2() != NULL, "must be"); + LIR_Op2* op2 = (LIR_Op2*)op; + + // On x86 pow needs two temporary fpu stack slots: tmp1 and + // tmp2. Register input operands as temps to guarantee that it + // doesn't overlap with the temporary slots. + assert(op2->_info == NULL, "not used"); + assert(op2->_opr1->is_valid() && op2->_opr2->is_valid(), "used"); + assert(op2->_tmp1->is_valid() && op2->_tmp2->is_valid() && op2->_tmp3->is_valid() + && op2->_tmp4->is_valid() && op2->_tmp5->is_valid(), "used"); + assert(op2->_result->is_valid(), "used"); + + do_input(op2->_opr1); do_temp(op2->_opr1); + do_input(op2->_opr2); do_temp(op2->_opr2); + do_temp(op2->_tmp1); + do_temp(op2->_tmp2); + do_temp(op2->_tmp3); + do_temp(op2->_tmp4); + do_temp(op2->_tmp5); + do_output(op2->_result); + + break; + } // LIR_Op3 case lir_idiv: @@ -1670,6 +1709,8 @@ const char * LIR_Op::name() const { case lir_tan: s = "tan"; break; case lir_log: s = "log"; break; case lir_log10: s = "log10"; break; + case lir_exp: s = "exp"; break; + case lir_pow: s = "pow"; break; case lir_logic_and: s = "logic_and"; break; case lir_logic_or: s = "logic_or"; break; case lir_logic_xor: s = "logic_xor"; break; @@ -1892,7 +1933,11 @@ void LIR_Op2::print_instr(outputStream* out) const { } in_opr1()->print(out); out->print(" "); in_opr2()->print(out); out->print(" "); - if (tmp_opr()->is_valid()) { tmp_opr()->print(out); out->print(" "); } + if (tmp1_opr()->is_valid()) { tmp1_opr()->print(out); out->print(" "); } + if (tmp2_opr()->is_valid()) { tmp2_opr()->print(out); out->print(" "); } + if (tmp3_opr()->is_valid()) { tmp3_opr()->print(out); out->print(" "); } + if (tmp4_opr()->is_valid()) { tmp4_opr()->print(out); out->print(" "); } + if (tmp5_opr()->is_valid()) { tmp5_opr()->print(out); out->print(" "); } result_opr()->print(out); } diff --git a/hotspot/src/share/vm/c1/c1_LIR.hpp b/hotspot/src/share/vm/c1/c1_LIR.hpp index f8589c36964..eb9ff9a5f24 100644 --- a/hotspot/src/share/vm/c1/c1_LIR.hpp +++ b/hotspot/src/share/vm/c1/c1_LIR.hpp @@ -916,6 +916,8 @@ enum LIR_Code { , lir_tan , lir_log , lir_log10 + , lir_exp + , lir_pow , lir_logic_and , lir_logic_or , lir_logic_xor @@ -1560,7 +1562,11 @@ class LIR_Op2: public LIR_Op { LIR_Opr _opr1; LIR_Opr _opr2; BasicType _type; - LIR_Opr _tmp; + LIR_Opr _tmp1; + LIR_Opr _tmp2; + LIR_Opr _tmp3; + LIR_Opr _tmp4; + LIR_Opr _tmp5; LIR_Condition _condition; void verify() const; @@ -1573,7 +1579,11 @@ class LIR_Op2: public LIR_Op { , _type(T_ILLEGAL) , _condition(condition) , _fpu_stack_size(0) - , _tmp(LIR_OprFact::illegalOpr) { + , _tmp1(LIR_OprFact::illegalOpr) + , _tmp2(LIR_OprFact::illegalOpr) + , _tmp3(LIR_OprFact::illegalOpr) + , _tmp4(LIR_OprFact::illegalOpr) + , _tmp5(LIR_OprFact::illegalOpr) { assert(code == lir_cmp, "code check"); } @@ -1584,7 +1594,11 @@ class LIR_Op2: public LIR_Op { , _type(type) , _condition(condition) , _fpu_stack_size(0) - , _tmp(LIR_OprFact::illegalOpr) { + , _tmp1(LIR_OprFact::illegalOpr) + , _tmp2(LIR_OprFact::illegalOpr) + , _tmp3(LIR_OprFact::illegalOpr) + , _tmp4(LIR_OprFact::illegalOpr) + , _tmp5(LIR_OprFact::illegalOpr) { assert(code == lir_cmove, "code check"); assert(type != T_ILLEGAL, "cmove should have type"); } @@ -1597,25 +1611,38 @@ class LIR_Op2: public LIR_Op { , _type(type) , _condition(lir_cond_unknown) , _fpu_stack_size(0) - , _tmp(LIR_OprFact::illegalOpr) { + , _tmp1(LIR_OprFact::illegalOpr) + , _tmp2(LIR_OprFact::illegalOpr) + , _tmp3(LIR_OprFact::illegalOpr) + , _tmp4(LIR_OprFact::illegalOpr) + , _tmp5(LIR_OprFact::illegalOpr) { assert(code != lir_cmp && is_in_range(code, begin_op2, end_op2), "code check"); } - LIR_Op2(LIR_Code code, LIR_Opr opr1, LIR_Opr opr2, LIR_Opr result, LIR_Opr tmp) + LIR_Op2(LIR_Code code, LIR_Opr opr1, LIR_Opr opr2, LIR_Opr result, LIR_Opr tmp1, LIR_Opr tmp2 = LIR_OprFact::illegalOpr, + LIR_Opr tmp3 = LIR_OprFact::illegalOpr, LIR_Opr tmp4 = LIR_OprFact::illegalOpr, LIR_Opr tmp5 = LIR_OprFact::illegalOpr) : LIR_Op(code, result, NULL) , _opr1(opr1) , _opr2(opr2) , _type(T_ILLEGAL) , _condition(lir_cond_unknown) , _fpu_stack_size(0) - , _tmp(tmp) { + , _tmp1(tmp1) + , _tmp2(tmp2) + , _tmp3(tmp3) + , _tmp4(tmp4) + , _tmp5(tmp5) { assert(code != lir_cmp && is_in_range(code, begin_op2, end_op2), "code check"); } LIR_Opr in_opr1() const { return _opr1; } LIR_Opr in_opr2() const { return _opr2; } BasicType type() const { return _type; } - LIR_Opr tmp_opr() const { return _tmp; } + LIR_Opr tmp1_opr() const { return _tmp1; } + LIR_Opr tmp2_opr() const { return _tmp2; } + LIR_Opr tmp3_opr() const { return _tmp3; } + LIR_Opr tmp4_opr() const { return _tmp4; } + LIR_Opr tmp5_opr() const { return _tmp5; } LIR_Condition condition() const { assert(code() == lir_cmp || code() == lir_cmove, "only valid for cmp and cmove"); return _condition; } @@ -2025,6 +2052,8 @@ class LIR_List: public CompilationResourceObj { void sin (LIR_Opr from, LIR_Opr to, LIR_Opr tmp1, LIR_Opr tmp2) { append(new LIR_Op2(lir_sin , from, tmp1, to, tmp2)); } void cos (LIR_Opr from, LIR_Opr to, LIR_Opr tmp1, LIR_Opr tmp2) { append(new LIR_Op2(lir_cos , from, tmp1, to, tmp2)); } void tan (LIR_Opr from, LIR_Opr to, LIR_Opr tmp1, LIR_Opr tmp2) { append(new LIR_Op2(lir_tan , from, tmp1, to, tmp2)); } + void exp (LIR_Opr from, LIR_Opr to, LIR_Opr tmp1, LIR_Opr tmp2, LIR_Opr tmp3, LIR_Opr tmp4, LIR_Opr tmp5) { append(new LIR_Op2(lir_exp , from, tmp1, to, tmp2, tmp3, tmp4, tmp5)); } + void pow (LIR_Opr arg1, LIR_Opr arg2, LIR_Opr res, LIR_Opr tmp1, LIR_Opr tmp2, LIR_Opr tmp3, LIR_Opr tmp4, LIR_Opr tmp5) { append(new LIR_Op2(lir_pow, arg1, arg2, res, tmp1, tmp2, tmp3, tmp4, tmp5)); } void add (LIR_Opr left, LIR_Opr right, LIR_Opr res) { append(new LIR_Op2(lir_add, left, right, res)); } void sub (LIR_Opr left, LIR_Opr right, LIR_Opr res, CodeEmitInfo* info = NULL) { append(new LIR_Op2(lir_sub, left, right, res, info)); } diff --git a/hotspot/src/share/vm/c1/c1_LIRAssembler.cpp b/hotspot/src/share/vm/c1/c1_LIRAssembler.cpp index 528f21e841c..b3082cb0c23 100644 --- a/hotspot/src/share/vm/c1/c1_LIRAssembler.cpp +++ b/hotspot/src/share/vm/c1/c1_LIRAssembler.cpp @@ -718,7 +718,7 @@ void LIR_Assembler::emit_op2(LIR_Op2* op) { if (op->in_opr2()->is_constant()) { shift_op(op->code(), op->in_opr1(), op->in_opr2()->as_constant_ptr()->as_jint(), op->result_opr()); } else { - shift_op(op->code(), op->in_opr1(), op->in_opr2(), op->result_opr(), op->tmp_opr()); + shift_op(op->code(), op->in_opr1(), op->in_opr2(), op->result_opr(), op->tmp1_opr()); } break; @@ -746,6 +746,8 @@ void LIR_Assembler::emit_op2(LIR_Op2* op) { case lir_cos: case lir_log: case lir_log10: + case lir_exp: + case lir_pow: intrinsic_op(op->code(), op->in_opr1(), op->in_opr2(), op->result_opr(), op); break; diff --git a/hotspot/src/share/vm/c1/c1_LIRGenerator.cpp b/hotspot/src/share/vm/c1/c1_LIRGenerator.cpp index 6ed6edf47c3..3e61b92c514 100644 --- a/hotspot/src/share/vm/c1/c1_LIRGenerator.cpp +++ b/hotspot/src/share/vm/c1/c1_LIRGenerator.cpp @@ -2960,7 +2960,9 @@ void LIRGenerator::do_Intrinsic(Intrinsic* x) { case vmIntrinsics::_dsqrt: // fall through case vmIntrinsics::_dtan: // fall through case vmIntrinsics::_dsin : // fall through - case vmIntrinsics::_dcos : do_MathIntrinsic(x); break; + case vmIntrinsics::_dcos : // fall through + case vmIntrinsics::_dexp : // fall through + case vmIntrinsics::_dpow : do_MathIntrinsic(x); break; case vmIntrinsics::_arraycopy: do_ArrayCopy(x); break; // java.nio.Buffer.checkIndex diff --git a/hotspot/src/share/vm/c1/c1_LinearScan.cpp b/hotspot/src/share/vm/c1/c1_LinearScan.cpp index fede09fe8a8..56f94636586 100644 --- a/hotspot/src/share/vm/c1/c1_LinearScan.cpp +++ b/hotspot/src/share/vm/c1/c1_LinearScan.cpp @@ -6579,6 +6579,8 @@ void LinearScanStatistic::collect(LinearScan* allocator) { case lir_abs: case lir_log10: case lir_log: + case lir_pow: + case lir_exp: case lir_logic_and: case lir_logic_or: case lir_logic_xor: diff --git a/hotspot/src/share/vm/interpreter/abstractInterpreter.hpp b/hotspot/src/share/vm/interpreter/abstractInterpreter.hpp index a68fac1d63d..756ad88e28b 100644 --- a/hotspot/src/share/vm/interpreter/abstractInterpreter.hpp +++ b/hotspot/src/share/vm/interpreter/abstractInterpreter.hpp @@ -107,6 +107,8 @@ class AbstractInterpreter: AllStatic { java_lang_math_sqrt, // implementation of java.lang.Math.sqrt (x) java_lang_math_log, // implementation of java.lang.Math.log (x) java_lang_math_log10, // implementation of java.lang.Math.log10 (x) + java_lang_math_pow, // implementation of java.lang.Math.pow (x,y) + java_lang_math_exp, // implementation of java.lang.Math.exp (x) java_lang_ref_reference_get, // implementation of java.lang.ref.Reference.get() number_of_method_entries, invalid = -1 diff --git a/hotspot/src/share/vm/interpreter/interpreter.cpp b/hotspot/src/share/vm/interpreter/interpreter.cpp index 137f50ee3f1..7030d572b6c 100644 --- a/hotspot/src/share/vm/interpreter/interpreter.cpp +++ b/hotspot/src/share/vm/interpreter/interpreter.cpp @@ -221,6 +221,8 @@ AbstractInterpreter::MethodKind AbstractInterpreter::method_kind(methodHandle m) case vmIntrinsics::_dsqrt : return java_lang_math_sqrt ; case vmIntrinsics::_dlog : return java_lang_math_log ; case vmIntrinsics::_dlog10: return java_lang_math_log10; + case vmIntrinsics::_dpow : return java_lang_math_pow ; + case vmIntrinsics::_dexp : return java_lang_math_exp ; case vmIntrinsics::_Reference_get: return java_lang_ref_reference_get; diff --git a/hotspot/src/share/vm/interpreter/templateInterpreter.cpp b/hotspot/src/share/vm/interpreter/templateInterpreter.cpp index 231c46f8746..459d02f98a4 100644 --- a/hotspot/src/share/vm/interpreter/templateInterpreter.cpp +++ b/hotspot/src/share/vm/interpreter/templateInterpreter.cpp @@ -370,6 +370,8 @@ void TemplateInterpreterGenerator::generate_all() { method_entry(java_lang_math_sqrt ) method_entry(java_lang_math_log ) method_entry(java_lang_math_log10) + method_entry(java_lang_math_exp ) + method_entry(java_lang_math_pow ) method_entry(java_lang_ref_reference_get) // all native method kinds (must be one contiguous block) diff --git a/hotspot/src/share/vm/opto/library_call.cpp b/hotspot/src/share/vm/opto/library_call.cpp index e0f5f95915f..56ea23b484a 100644 --- a/hotspot/src/share/vm/opto/library_call.cpp +++ b/hotspot/src/share/vm/opto/library_call.cpp @@ -1557,9 +1557,6 @@ bool LibraryCallKit::inline_exp(vmIntrinsics::ID id) { // every again. NaN results requires StrictMath.exp handling. if (too_many_traps(Deoptimization::Reason_intrinsic)) return false; - // Do not intrinsify on older platforms which lack cmove. - if (ConditionalMoveLimit == 0) return false; - _sp += arg_size(); // restore stack pointer Node *x = pop_math_arg(); Node *result = _gvn.transform(new (C, 2) ExpDNode(0,x)); @@ -1802,15 +1799,11 @@ bool LibraryCallKit::inline_math_native(vmIntrinsics::ID id) { case vmIntrinsics::_dsqrt: return Matcher::has_match_rule(Op_SqrtD) ? inline_sqrt(id) : false; case vmIntrinsics::_dabs: return Matcher::has_match_rule(Op_AbsD) ? inline_abs(id) : false; - // These intrinsics don't work on X86. The ad implementation doesn't - // handle NaN's properly. Instead of returning infinity, the ad - // implementation returns a NaN on overflow. See bug: 6304089 - // Once the ad implementations are fixed, change the code below - // to match the intrinsics above - case vmIntrinsics::_dexp: return + Matcher::has_match_rule(Op_ExpD) ? inline_exp(id) : runtime_math(OptoRuntime::Math_D_D_Type(), CAST_FROM_FN_PTR(address, SharedRuntime::dexp), "EXP"); case vmIntrinsics::_dpow: return + Matcher::has_match_rule(Op_PowD) ? inline_pow(id) : runtime_math(OptoRuntime::Math_DD_D_Type(), CAST_FROM_FN_PTR(address, SharedRuntime::dpow), "POW"); // These intrinsics are not yet correctly implemented diff --git a/hotspot/src/share/vm/opto/subnode.cpp b/hotspot/src/share/vm/opto/subnode.cpp index 51212cff57f..73eede48d03 100644 --- a/hotspot/src/share/vm/opto/subnode.cpp +++ b/hotspot/src/share/vm/opto/subnode.cpp @@ -1314,7 +1314,5 @@ const Type *PowDNode::Value( PhaseTransform *phase ) const { if( t2->base() != Type::DoubleCon ) return Type::DOUBLE; double d1 = t1->getd(); double d2 = t2->getd(); - if( d1 < 0.0 ) return Type::DOUBLE; - if( d2 < 0.0 ) return Type::DOUBLE; return TypeD::make( StubRoutines::intrinsic_pow( d1, d2 ) ); } From 73636f80f035e77c4f4dcb9e40b06315d1b81871 Mon Sep 17 00:00:00 2001 From: John Cuthbertson Date: Tue, 15 May 2012 09:49:18 -0700 Subject: [PATCH 051/128] 7168294: G1: Some Full GCs incorrectly report GC cause as "No GC" GC cause was not being set by the VM_G1CollectForAllocation VM operation. Reviewed-by: jmasa, ysr, brutisso --- hotspot/src/share/vm/gc_implementation/g1/vm_operations_g1.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/hotspot/src/share/vm/gc_implementation/g1/vm_operations_g1.cpp b/hotspot/src/share/vm/gc_implementation/g1/vm_operations_g1.cpp index 1a330ba6483..d880f5509ad 100644 --- a/hotspot/src/share/vm/gc_implementation/g1/vm_operations_g1.cpp +++ b/hotspot/src/share/vm/gc_implementation/g1/vm_operations_g1.cpp @@ -42,6 +42,7 @@ VM_G1CollectForAllocation::VM_G1CollectForAllocation( void VM_G1CollectForAllocation::doit() { G1CollectedHeap* g1h = G1CollectedHeap::heap(); + GCCauseSetter x(g1h, _gc_cause); _result = g1h->satisfy_failed_allocation(_word_size, &_pause_succeeded); assert(_result == NULL || _pause_succeeded, "if we get back a result, the pause should have succeeded"); From b2d4591455d21e86b271c1f728f69daafa6bae18 Mon Sep 17 00:00:00 2001 From: Bengt Rutisson Date: Tue, 15 May 2012 22:26:37 +0200 Subject: [PATCH 052/128] 7169056: Add gigabyte unit to proper_unit_for_byte_size() and byte_size_in_proper_unit() Reviewed-by: jwilhelm, johnc, dholmes --- hotspot/src/share/vm/utilities/globalDefinitions.hpp | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/hotspot/src/share/vm/utilities/globalDefinitions.hpp b/hotspot/src/share/vm/utilities/globalDefinitions.hpp index 55904058bf8..82a9333b789 100644 --- a/hotspot/src/share/vm/utilities/globalDefinitions.hpp +++ b/hotspot/src/share/vm/utilities/globalDefinitions.hpp @@ -179,6 +179,11 @@ const jlong NANOSECS_PER_SEC = CONST64(1000000000); const jint NANOSECS_PER_MILLISEC = 1000000; inline const char* proper_unit_for_byte_size(size_t s) { +#ifdef _LP64 + if (s >= 10*G) { + return "G"; + } +#endif if (s >= 10*M) { return "M"; } else if (s >= 10*K) { @@ -190,6 +195,11 @@ inline const char* proper_unit_for_byte_size(size_t s) { template inline T byte_size_in_proper_unit(T s) { +#ifdef _LP64 + if (s >= 10*G) { + return (T)(s/G); + } +#endif if (s >= 10*M) { return (T)(s/M); } else if (s >= 10*K) { From eba9965d54fd3506afb93d2d7e7cad7531c57a72 Mon Sep 17 00:00:00 2001 From: Bengt Rutisson Date: Tue, 15 May 2012 10:25:06 +0200 Subject: [PATCH 053/128] 7166894: Add gc cause to GC logging for all collectors Reviewed-by: mgerdin, johnc --- .../concurrentMarkSweepGeneration.cpp | 4 +-- .../concurrentMarkSweepGeneration.hpp | 2 +- .../concurrentMarkSweep/vmCMSOperations.cpp | 4 +-- .../gc_implementation/g1/g1CollectedHeap.cpp | 15 +++------ .../g1/g1CollectorPolicy.cpp | 5 ++- .../parNew/parNewGeneration.cpp | 2 +- .../parallelScavenge/psMarkSweep.cpp | 10 ++---- .../parallelScavenge/psParallelCompact.cpp | 13 ++------ .../parallelScavenge/psScavenge.cpp | 2 +- hotspot/src/share/vm/gc_interface/gcCause.hpp | 32 +++++++++++++++++++ .../src/share/vm/memory/defNewGeneration.cpp | 2 +- .../src/share/vm/memory/genCollectedHeap.cpp | 15 ++------- hotspot/src/share/vm/memory/genMarkSweep.cpp | 2 +- hotspot/src/share/vm/runtime/arguments.cpp | 8 +++++ hotspot/src/share/vm/runtime/globals.hpp | 5 ++- hotspot/src/share/vm/runtime/java.hpp | 8 +++++ 16 files changed, 75 insertions(+), 54 deletions(-) diff --git a/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/concurrentMarkSweepGeneration.cpp b/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/concurrentMarkSweepGeneration.cpp index 5825a5772fc..938e94efcff 100644 --- a/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/concurrentMarkSweepGeneration.cpp +++ b/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/concurrentMarkSweepGeneration.cpp @@ -6332,10 +6332,10 @@ void CMSCollector::reset(bool asynch) { ) } -void CMSCollector::do_CMS_operation(CMS_op_type op) { +void CMSCollector::do_CMS_operation(CMS_op_type op, GCCause::Cause gc_cause) { gclog_or_tty->date_stamp(PrintGC && PrintGCDateStamps); TraceCPUTime tcpu(PrintGCDetails, true, gclog_or_tty); - TraceTime t("GC", PrintGC, !PrintGCDetails, gclog_or_tty); + TraceTime t(GCCauseString("GC", gc_cause), PrintGC, !PrintGCDetails, gclog_or_tty); TraceCollectorStats tcs(counters()); switch (op) { diff --git a/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/concurrentMarkSweepGeneration.hpp b/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/concurrentMarkSweepGeneration.hpp index a84253888b0..ecc60cc3ead 100644 --- a/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/concurrentMarkSweepGeneration.hpp +++ b/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/concurrentMarkSweepGeneration.hpp @@ -717,7 +717,7 @@ class CMSCollector: public CHeapObj { CMS_op_checkpointRootsFinal }; - void do_CMS_operation(CMS_op_type op); + void do_CMS_operation(CMS_op_type op, GCCause::Cause gc_cause); bool stop_world_and_do(CMS_op_type op); OopTaskQueueSet* task_queues() { return _task_queues; } diff --git a/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/vmCMSOperations.cpp b/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/vmCMSOperations.cpp index c3b9d54bec3..3b8d5aa0878 100644 --- a/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/vmCMSOperations.cpp +++ b/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/vmCMSOperations.cpp @@ -146,7 +146,7 @@ void VM_CMS_Initial_Mark::doit() { VM_CMS_Operation::verify_before_gc(); IsGCActiveMark x; // stop-world GC active - _collector->do_CMS_operation(CMSCollector::CMS_op_checkpointRootsInitial); + _collector->do_CMS_operation(CMSCollector::CMS_op_checkpointRootsInitial, gch->gc_cause()); VM_CMS_Operation::verify_after_gc(); #ifndef USDT2 @@ -178,7 +178,7 @@ void VM_CMS_Final_Remark::doit() { VM_CMS_Operation::verify_before_gc(); IsGCActiveMark x; // stop-world GC active - _collector->do_CMS_operation(CMSCollector::CMS_op_checkpointRootsFinal); + _collector->do_CMS_operation(CMSCollector::CMS_op_checkpointRootsFinal, gch->gc_cause()); VM_CMS_Operation::verify_after_gc(); #ifndef USDT2 diff --git a/hotspot/src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp b/hotspot/src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp index fa71befcfe8..9d1f9d92ddc 100644 --- a/hotspot/src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp +++ b/hotspot/src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp @@ -1252,10 +1252,7 @@ bool G1CollectedHeap::do_collection(bool explicit_gc, gclog_or_tty->date_stamp(G1Log::fine() && PrintGCDateStamps); TraceCPUTime tcpu(G1Log::finer(), true, gclog_or_tty); - char verbose_str[128]; - sprintf(verbose_str, "Full GC (%s)", GCCause::to_string(gc_cause())); - TraceTime t(verbose_str, G1Log::fine(), true, gclog_or_tty); - + TraceTime t(GCCauseString("Full GC", gc_cause()), G1Log::fine(), true, gclog_or_tty); TraceCollectorStats tcs(g1mm()->full_collection_counters()); TraceMemoryManagerStats tms(true /* fullGC */, gc_cause()); @@ -3600,12 +3597,10 @@ G1CollectedHeap::do_collection_pause_at_safepoint(double target_pause_time_ms) { gclog_or_tty->date_stamp(G1Log::fine() && PrintGCDateStamps); TraceCPUTime tcpu(G1Log::finer(), true, gclog_or_tty); - char verbose_str[128]; - sprintf(verbose_str, "GC pause (%s) (%s)%s", - GCCause::to_string(gc_cause()), - g1_policy()->gcs_are_young() ? "young" : "mixed", - g1_policy()->during_initial_mark_pause() ? " (initial-mark)" : ""); - TraceTime t(verbose_str, G1Log::fine() && !G1Log::finer(), true, gclog_or_tty); + GCCauseString gc_cause_str = GCCauseString("GC pause", gc_cause()) + .append(g1_policy()->gcs_are_young() ? " (young)" : " (mixed)") + .append(g1_policy()->during_initial_mark_pause() ? " (initial-mark)" : ""); + TraceTime t(gc_cause_str, G1Log::fine() && !G1Log::finer(), true, gclog_or_tty); TraceCollectorStats tcs(g1mm()->incremental_collection_counters()); TraceMemoryManagerStats tms(false /* fullGC */, gc_cause()); diff --git a/hotspot/src/share/vm/gc_implementation/g1/g1CollectorPolicy.cpp b/hotspot/src/share/vm/gc_implementation/g1/g1CollectorPolicy.cpp index 05dea1c4854..2050f6f5bba 100644 --- a/hotspot/src/share/vm/gc_implementation/g1/g1CollectorPolicy.cpp +++ b/hotspot/src/share/vm/gc_implementation/g1/g1CollectorPolicy.cpp @@ -886,9 +886,8 @@ void G1CollectorPolicy::record_collection_pause_start(double start_time_sec, size_t start_used) { if (G1Log::finer()) { gclog_or_tty->stamp(PrintGCTimeStamps); - gclog_or_tty->print("[GC pause (%s) (%s)", - GCCause::to_string(_g1->gc_cause()), - gcs_are_young() ? "young" : "mixed"); + gclog_or_tty->print("[%s", (const char*)GCCauseString("GC pause", _g1->gc_cause()) + .append(gcs_are_young() ? " (young)" : " (mixed)")); } // We only need to do this here as the policy will only be applied diff --git a/hotspot/src/share/vm/gc_implementation/parNew/parNewGeneration.cpp b/hotspot/src/share/vm/gc_implementation/parNew/parNewGeneration.cpp index 4f64dff0824..96ae468f0bf 100644 --- a/hotspot/src/share/vm/gc_implementation/parNew/parNewGeneration.cpp +++ b/hotspot/src/share/vm/gc_implementation/parNew/parNewGeneration.cpp @@ -916,7 +916,7 @@ void ParNewGeneration::collect(bool full, size_policy->minor_collection_begin(); } - TraceTime t1("GC", PrintGC && !PrintGCDetails, true, gclog_or_tty); + TraceTime t1(GCCauseString("GC", gch->gc_cause()), PrintGC && !PrintGCDetails, true, gclog_or_tty); // Capture heap used before collection (for printing). size_t gch_prev_used = gch->used(); diff --git a/hotspot/src/share/vm/gc_implementation/parallelScavenge/psMarkSweep.cpp b/hotspot/src/share/vm/gc_implementation/parallelScavenge/psMarkSweep.cpp index ad599ae3219..0ef97523630 100644 --- a/hotspot/src/share/vm/gc_implementation/parallelScavenge/psMarkSweep.cpp +++ b/hotspot/src/share/vm/gc_implementation/parallelScavenge/psMarkSweep.cpp @@ -160,16 +160,10 @@ bool PSMarkSweep::invoke_no_policy(bool clear_all_softrefs) { { HandleMark hm; - const bool is_system_gc = gc_cause == GCCause::_java_lang_system_gc; - // This is useful for debugging but don't change the output the - // the customer sees. - const char* gc_cause_str = "Full GC"; - if (is_system_gc && PrintGCDetails) { - gc_cause_str = "Full GC (System)"; - } + gclog_or_tty->date_stamp(PrintGC && PrintGCDateStamps); TraceCPUTime tcpu(PrintGCDetails, true, gclog_or_tty); - TraceTime t1(gc_cause_str, PrintGC, !PrintGCDetails, gclog_or_tty); + TraceTime t1(GCCauseString("Full GC", gc_cause), PrintGC, !PrintGCDetails, gclog_or_tty); TraceCollectorStats tcs(counters()); TraceMemoryManagerStats tms(true /* Full GC */,gc_cause); diff --git a/hotspot/src/share/vm/gc_implementation/parallelScavenge/psParallelCompact.cpp b/hotspot/src/share/vm/gc_implementation/parallelScavenge/psParallelCompact.cpp index 354b3d04347..8e7c74e4495 100644 --- a/hotspot/src/share/vm/gc_implementation/parallelScavenge/psParallelCompact.cpp +++ b/hotspot/src/share/vm/gc_implementation/parallelScavenge/psParallelCompact.cpp @@ -2047,17 +2047,9 @@ bool PSParallelCompact::invoke_no_policy(bool maximum_heap_compaction) { gc_task_manager()->task_idle_workers(); heap->set_par_threads(gc_task_manager()->active_workers()); - const bool is_system_gc = gc_cause == GCCause::_java_lang_system_gc; - - // This is useful for debugging but don't change the output the - // the customer sees. - const char* gc_cause_str = "Full GC"; - if (is_system_gc && PrintGCDetails) { - gc_cause_str = "Full GC (System)"; - } gclog_or_tty->date_stamp(PrintGC && PrintGCDateStamps); TraceCPUTime tcpu(PrintGCDetails, true, gclog_or_tty); - TraceTime t1(gc_cause_str, PrintGC, !PrintGCDetails, gclog_or_tty); + TraceTime t1(GCCauseString("Full GC", gc_cause), PrintGC, !PrintGCDetails, gclog_or_tty); TraceCollectorStats tcs(counters()); TraceMemoryManagerStats tms(true /* Full GC */,gc_cause); @@ -2090,7 +2082,8 @@ bool PSParallelCompact::invoke_no_policy(bool maximum_heap_compaction) { } #endif // #ifndef PRODUCT - bool max_on_system_gc = UseMaximumCompactionOnSystemGC && is_system_gc; + bool max_on_system_gc = UseMaximumCompactionOnSystemGC + && gc_cause == GCCause::_java_lang_system_gc; summary_phase(vmthread_cm, maximum_heap_compaction || max_on_system_gc); COMPILER2_PRESENT(assert(DerivedPointerTable::is_active(), "Sanity")); diff --git a/hotspot/src/share/vm/gc_implementation/parallelScavenge/psScavenge.cpp b/hotspot/src/share/vm/gc_implementation/parallelScavenge/psScavenge.cpp index 984b1a452eb..65ece052d16 100644 --- a/hotspot/src/share/vm/gc_implementation/parallelScavenge/psScavenge.cpp +++ b/hotspot/src/share/vm/gc_implementation/parallelScavenge/psScavenge.cpp @@ -325,7 +325,7 @@ bool PSScavenge::invoke_no_policy() { gclog_or_tty->date_stamp(PrintGC && PrintGCDateStamps); TraceCPUTime tcpu(PrintGCDetails, true, gclog_or_tty); - TraceTime t1("GC", PrintGC, !PrintGCDetails, gclog_or_tty); + TraceTime t1(GCCauseString("GC", gc_cause), PrintGC, !PrintGCDetails, gclog_or_tty); TraceCollectorStats tcs(counters()); TraceMemoryManagerStats tms(false /* not full GC */,gc_cause); diff --git a/hotspot/src/share/vm/gc_interface/gcCause.hpp b/hotspot/src/share/vm/gc_interface/gcCause.hpp index ae14115d7e2..8866d7675ce 100644 --- a/hotspot/src/share/vm/gc_interface/gcCause.hpp +++ b/hotspot/src/share/vm/gc_interface/gcCause.hpp @@ -88,4 +88,36 @@ class GCCause : public AllStatic { static const char* to_string(GCCause::Cause cause); }; +// Helper class for doing logging that includes the GC Cause +// as a string. +class GCCauseString : StackObj { + private: + static const int _length = 128; + char _buffer[_length]; + int _position; + + public: + GCCauseString(const char* prefix, GCCause::Cause cause) { + if (PrintGCCause) { + _position = jio_snprintf(_buffer, _length, "%s (%s)", prefix, GCCause::to_string(cause)); + } else { + _position = jio_snprintf(_buffer, _length, "%s", prefix); + } + assert(_position >= 0 && _position <= _length, + err_msg("Need to increase the buffer size in GCCauseString? %d", _position)); + } + + GCCauseString& append(const char* str) { + int res = jio_snprintf(_buffer + _position, _length - _position, "%s", str); + _position += res; + assert(res >= 0 && _position <= _length, + err_msg("Need to increase the buffer size in GCCauseString? %d", res)); + return *this; + } + + operator const char*() { + return _buffer; + } +}; + #endif // SHARE_VM_GC_INTERFACE_GCCAUSE_HPP diff --git a/hotspot/src/share/vm/memory/defNewGeneration.cpp b/hotspot/src/share/vm/memory/defNewGeneration.cpp index 315a38248c9..452f630730a 100644 --- a/hotspot/src/share/vm/memory/defNewGeneration.cpp +++ b/hotspot/src/share/vm/memory/defNewGeneration.cpp @@ -548,7 +548,7 @@ void DefNewGeneration::collect(bool full, init_assuming_no_promotion_failure(); - TraceTime t1("GC", PrintGC && !PrintGCDetails, true, gclog_or_tty); + TraceTime t1(GCCauseString("GC", gch->gc_cause()), PrintGC && !PrintGCDetails, true, gclog_or_tty); // Capture heap used before collection (for printing). size_t gch_prev_used = gch->used(); diff --git a/hotspot/src/share/vm/memory/genCollectedHeap.cpp b/hotspot/src/share/vm/memory/genCollectedHeap.cpp index 10c3274548d..40f5afda442 100644 --- a/hotspot/src/share/vm/memory/genCollectedHeap.cpp +++ b/hotspot/src/share/vm/memory/genCollectedHeap.cpp @@ -480,26 +480,15 @@ void GenCollectedHeap::do_collection(bool full, const size_t perm_prev_used = perm_gen()->used(); print_heap_before_gc(); - if (Verbose) { - gclog_or_tty->print_cr("GC Cause: %s", GCCause::to_string(gc_cause())); - } { FlagSetting fl(_is_gc_active, true); bool complete = full && (max_level == (n_gens()-1)); - const char* gc_cause_str = "GC "; - if (complete) { - GCCause::Cause cause = gc_cause(); - if (cause == GCCause::_java_lang_system_gc) { - gc_cause_str = "Full GC (System) "; - } else { - gc_cause_str = "Full GC "; - } - } + const char* gc_cause_prefix = complete ? "Full GC" : "GC"; gclog_or_tty->date_stamp(PrintGC && PrintGCDateStamps); TraceCPUTime tcpu(PrintGCDetails, true, gclog_or_tty); - TraceTime t(gc_cause_str, PrintGCDetails, false, gclog_or_tty); + TraceTime t(GCCauseString(gc_cause_prefix, gc_cause()), PrintGCDetails, false, gclog_or_tty); gc_prologue(complete); increment_total_collections(complete); diff --git a/hotspot/src/share/vm/memory/genMarkSweep.cpp b/hotspot/src/share/vm/memory/genMarkSweep.cpp index d5cf4dc7562..4d13fbb22dd 100644 --- a/hotspot/src/share/vm/memory/genMarkSweep.cpp +++ b/hotspot/src/share/vm/memory/genMarkSweep.cpp @@ -76,7 +76,7 @@ void GenMarkSweep::invoke_at_safepoint(int level, ReferenceProcessor* rp, _ref_processor = rp; rp->setup_policy(clear_all_softrefs); - TraceTime t1("Full GC", PrintGC && !PrintGCDetails, true, gclog_or_tty); + TraceTime t1(GCCauseString("Full GC", gch->gc_cause()), PrintGC && !PrintGCDetails, true, gclog_or_tty); // When collecting the permanent generation methodOops may be moving, // so we either have to flush all bcp data or convert it into bci. diff --git a/hotspot/src/share/vm/runtime/arguments.cpp b/hotspot/src/share/vm/runtime/arguments.cpp index 8deacc6f564..7f3ea3ecf7d 100644 --- a/hotspot/src/share/vm/runtime/arguments.cpp +++ b/hotspot/src/share/vm/runtime/arguments.cpp @@ -3092,6 +3092,14 @@ jint Arguments::parse(const JavaVMInitArgs* args) { PrintGC = true; } + if (!JDK_Version::is_gte_jdk18x_version()) { + // To avoid changing the log format for 7 updates this flag is only + // true by default in JDK8 and above. + if (FLAG_IS_DEFAULT(PrintGCCause)) { + FLAG_SET_DEFAULT(PrintGCCause, false); + } + } + // Set object alignment values. set_object_alignment(); diff --git a/hotspot/src/share/vm/runtime/globals.hpp b/hotspot/src/share/vm/runtime/globals.hpp index 7ad4f9a042c..d030b4f1740 100644 --- a/hotspot/src/share/vm/runtime/globals.hpp +++ b/hotspot/src/share/vm/runtime/globals.hpp @@ -3902,7 +3902,10 @@ class CommandLineFlags { " of this flag is true for JDK 6 and earlier") \ \ diagnostic(bool, WhiteBoxAPI, false, \ - "Enable internal testing APIs") + "Enable internal testing APIs") \ + \ + product(bool, PrintGCCause, true, \ + "Include GC cause in GC logging") /* * Macros for factoring of globals diff --git a/hotspot/src/share/vm/runtime/java.hpp b/hotspot/src/share/vm/runtime/java.hpp index 307fcc2fb36..102fd6b7acd 100644 --- a/hotspot/src/share/vm/runtime/java.hpp +++ b/hotspot/src/share/vm/runtime/java.hpp @@ -206,6 +206,10 @@ class JDK_Version VALUE_OBJ_CLASS_SPEC { return current().compare_major(7) == 0; } + static bool is_jdk18x_version() { + return current().compare_major(8) == 0; + } + static bool is_gte_jdk13x_version() { return current().compare_major(3) >= 0; } @@ -225,6 +229,10 @@ class JDK_Version VALUE_OBJ_CLASS_SPEC { static bool is_gte_jdk17x_version() { return current().compare_major(7) >= 0; } + + static bool is_gte_jdk18x_version() { + return current().compare_major(8) >= 0; + } }; #endif // SHARE_VM_RUNTIME_JAVA_HPP From 6d2f5978f789f139c3265061419b68b3037d610a Mon Sep 17 00:00:00 2001 From: Dmitry Cherepanov Date: Tue, 15 May 2012 15:04:10 +0400 Subject: [PATCH 054/128] 7168550: [macosx] duplicate OGL context state changes related to vertex cache Reviewed-by: bae, swingler --- .../native/sun/java2d/opengl/CGLSurfaceData.m | 3 +- .../native/sun/java2d/opengl/OGLContext.h | 1 + .../sun/java2d/opengl/OGLTextRenderer.c | 9 ++-- .../native/sun/java2d/opengl/OGLVertexCache.c | 42 ++++++++++--------- .../native/sun/java2d/opengl/OGLVertexCache.h | 2 +- 5 files changed, 30 insertions(+), 27 deletions(-) diff --git a/jdk/src/macosx/native/sun/java2d/opengl/CGLSurfaceData.m b/jdk/src/macosx/native/sun/java2d/opengl/CGLSurfaceData.m index 34ba33c496a..cc8de1aa8ec 100644 --- a/jdk/src/macosx/native/sun/java2d/opengl/CGLSurfaceData.m +++ b/jdk/src/macosx/native/sun/java2d/opengl/CGLSurfaceData.m @@ -204,7 +204,8 @@ JNF_COCOA_ENTER(env); if (!CGLSD_MakeCurrentToScratch(env, oglc)) { return NULL; } - } else if ([NSOpenGLContext currentContext] == nil) { + // make sure our context is current + } else if ([NSOpenGLContext currentContext] != ctxinfo->context) { [ctxinfo->context makeCurrentContext]; } diff --git a/jdk/src/share/native/sun/java2d/opengl/OGLContext.h b/jdk/src/share/native/sun/java2d/opengl/OGLContext.h index 866d8f41280..5e236bb28c6 100644 --- a/jdk/src/share/native/sun/java2d/opengl/OGLContext.h +++ b/jdk/src/share/native/sun/java2d/opengl/OGLContext.h @@ -84,6 +84,7 @@ typedef struct { GLdouble *xformMatrix; GLuint blitTextureID; GLint textureFunction; + jboolean vertexCacheEnabled; } OGLContext; /** diff --git a/jdk/src/share/native/sun/java2d/opengl/OGLTextRenderer.c b/jdk/src/share/native/sun/java2d/opengl/OGLTextRenderer.c index 12e028452ba..7a24d5222d5 100644 --- a/jdk/src/share/native/sun/java2d/opengl/OGLTextRenderer.c +++ b/jdk/src/share/native/sun/java2d/opengl/OGLTextRenderer.c @@ -202,11 +202,6 @@ OGLTR_InitGlyphCache(jboolean lcdCache) J2dTraceLn(J2D_TRACE_INFO, "OGLTR_InitGlyphCache"); - // init vertex cache (if it hasn't been already) - if (!OGLVertexCache_InitVertexCache()) { - return JNI_FALSE; - } - // init glyph cache data structure gcinfo = AccelGlyphCache_Init(OGLTR_CACHE_WIDTH, OGLTR_CACHE_HEIGHT, @@ -583,6 +578,10 @@ OGLTR_EnableGlyphVertexCache(OGLContext *oglc) { J2dTraceLn(J2D_TRACE_INFO, "OGLTR_EnableGlyphVertexCache"); + if (!OGLVertexCache_InitVertexCache(oglc)) { + return; + } + if (glyphCache == NULL) { if (!OGLTR_InitGlyphCache(JNI_FALSE)) { return; diff --git a/jdk/src/share/native/sun/java2d/opengl/OGLVertexCache.c b/jdk/src/share/native/sun/java2d/opengl/OGLVertexCache.c index 87556d61d5d..574e2786fb9 100644 --- a/jdk/src/share/native/sun/java2d/opengl/OGLVertexCache.c +++ b/jdk/src/share/native/sun/java2d/opengl/OGLVertexCache.c @@ -67,29 +67,31 @@ static jint maskCacheIndex = 0; } while (0) jboolean -OGLVertexCache_InitVertexCache() +OGLVertexCache_InitVertexCache(OGLContext *oglc) { J2dTraceLn(J2D_TRACE_INFO, "OGLVertexCache_InitVertexCache"); - if (vertexCache != NULL) { - return JNI_TRUE; - } - - vertexCache = (J2DVertex *)malloc(OGLVC_MAX_INDEX * sizeof(J2DVertex)); if (vertexCache == NULL) { - return JNI_FALSE; + vertexCache = (J2DVertex *)malloc(OGLVC_MAX_INDEX * sizeof(J2DVertex)); + if (vertexCache == NULL) { + return JNI_FALSE; + } } - j2d_glTexCoordPointer(2, GL_FLOAT, - sizeof(J2DVertex), vertexCache); - j2d_glColorPointer(4, GL_UNSIGNED_BYTE, - sizeof(J2DVertex), ((jfloat *)vertexCache) + 2); - j2d_glVertexPointer(2, GL_FLOAT, - sizeof(J2DVertex), ((jfloat *)vertexCache) + 3); + if (!oglc->vertexCacheEnabled) { + j2d_glTexCoordPointer(2, GL_FLOAT, + sizeof(J2DVertex), vertexCache); + j2d_glColorPointer(4, GL_UNSIGNED_BYTE, + sizeof(J2DVertex), ((jfloat *)vertexCache) + 2); + j2d_glVertexPointer(2, GL_FLOAT, + sizeof(J2DVertex), ((jfloat *)vertexCache) + 3); - j2d_glEnableClientState(GL_TEXTURE_COORD_ARRAY); - j2d_glEnableClientState(GL_COLOR_ARRAY); - j2d_glEnableClientState(GL_VERTEX_ARRAY); + j2d_glEnableClientState(GL_TEXTURE_COORD_ARRAY); + j2d_glEnableClientState(GL_COLOR_ARRAY); + j2d_glEnableClientState(GL_VERTEX_ARRAY); + + oglc->vertexCacheEnabled = JNI_TRUE; + } return JNI_TRUE; } @@ -149,10 +151,6 @@ OGLVertexCache_InitMaskCache() { J2dTraceLn(J2D_TRACE_INFO, "OGLVertexCache_InitMaskCache"); - if (!OGLVertexCache_InitVertexCache()) { - return JNI_FALSE; - } - maskCacheTexID = OGLContext_CreateBlitTexture(GL_INTENSITY8, GL_LUMINANCE, OGLVC_MASK_CACHE_WIDTH_IN_TEXELS, @@ -179,6 +177,10 @@ OGLVertexCache_EnableMaskCache(OGLContext *oglc) { J2dTraceLn(J2D_TRACE_INFO, "OGLVertexCache_EnableMaskCache"); + if (!OGLVertexCache_InitVertexCache(oglc)) { + return; + } + if (maskCacheTexID == 0) { if (!OGLVertexCache_InitMaskCache()) { return; diff --git a/jdk/src/share/native/sun/java2d/opengl/OGLVertexCache.h b/jdk/src/share/native/sun/java2d/opengl/OGLVertexCache.h index bf22d1f950e..0392d8558ee 100644 --- a/jdk/src/share/native/sun/java2d/opengl/OGLVertexCache.h +++ b/jdk/src/share/native/sun/java2d/opengl/OGLVertexCache.h @@ -65,7 +65,7 @@ /** * Exported methods. */ -jboolean OGLVertexCache_InitVertexCache(); +jboolean OGLVertexCache_InitVertexCache(OGLContext *oglc); void OGLVertexCache_FlushVertexCache(); void OGLVertexCache_RestoreColorState(OGLContext *oglc); From ce388a548abb5c662d2555be0e8cd3130a9e1083 Mon Sep 17 00:00:00 2001 From: Deven You Date: Tue, 15 May 2012 16:46:10 +0400 Subject: [PATCH 055/128] 7164191: properties.putAll API may fail with ConcurrentModifcationException on multi-thread scenario Reviewed-by: dholmes, sla --- .../share/classes/sun/management/Agent.java | 10 ++- jdk/test/sun/management/AgentCMETest.java | 73 +++++++++++++++++++ 2 files changed, 81 insertions(+), 2 deletions(-) create mode 100644 jdk/test/sun/management/AgentCMETest.java diff --git a/jdk/src/share/classes/sun/management/Agent.java b/jdk/src/share/classes/sun/management/Agent.java index 7f65e5ceb9f..19d2dedb5b4 100644 --- a/jdk/src/share/classes/sun/management/Agent.java +++ b/jdk/src/share/classes/sun/management/Agent.java @@ -168,7 +168,10 @@ public class Agent { // management properties can be overridden by system properties // which take precedence - configProps.putAll(System.getProperties()); + Properties sysProps = System.getProperties(); + synchronized(sysProps){ + configProps.putAll(sysProps); + } // if user specifies config file into command line for either // jcmd utilities or attach command it overrides properties set in @@ -264,7 +267,10 @@ public class Agent { // management properties can be overridden by system properties // which take precedence - props.putAll(System.getProperties()); + Properties sysProps = System.getProperties(); + synchronized(sysProps){ + props.putAll(sysProps); + } return props; } diff --git a/jdk/test/sun/management/AgentCMETest.java b/jdk/test/sun/management/AgentCMETest.java new file mode 100644 index 00000000000..f8bfd5355c2 --- /dev/null +++ b/jdk/test/sun/management/AgentCMETest.java @@ -0,0 +1,73 @@ +/* + * Copyright (c) 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. + */ + +/* + * Portions Copyright (c) 2012 IBM Corporation + */ + +/** + * @test + * @bug 7164191 + * @summary properties.putAll API may fail with ConcurrentModifcationException on multi-thread scenario + * @author Deven You + */ + +import java.util.Properties; +import sun.management.Agent; + +public class AgentCMETest { + static Class agentClass; + + /** + * In sun.management.Agent.loadManagementProperties(), call + * properties.putAll API may fail with ConcurrentModifcationException if the + * system properties are modified simultaneously by another thread + * + * @param args + * @throws Exception + */ + public static void main(String[] args) throws Exception { + System.out.println("Start..."); + + final Properties properties = System.getProperties(); + Thread t1 = new Thread(new Runnable() { + public void run() { + for (int i = 0; i < 100; i++) { + properties.put(String.valueOf(i), ""); + try { + Thread.sleep(1); + } catch (InterruptedException e) { + // do nothing + } + } + } + }); + t1.start(); + + for (int i = 0; i < 10000; i++) { + Agent.loadManagementProperties(); + } + + System.out.println("Finished..."); + } +} From aaf2d69944ec59797b3128d46335972170f5aaef Mon Sep 17 00:00:00 2001 From: "Daniel D. Daugherty" Date: Tue, 15 May 2012 10:52:24 -0700 Subject: [PATCH 056/128] 7165060: dtrace tests fail with FDS debug info files Work around 'gobjcopy --add-gnu-debuglink' failure by adding a temporary tool that adds the '.gnu_debuglink' section and nothing more. Reviewed-by: sspitsyn, acorn --- .../solaris/makefiles/add_gnu_debuglink.make | 51 ++++ hotspot/make/solaris/makefiles/vm.make | 12 +- .../add_gnu_debuglink/add_gnu_debuglink.c | 285 ++++++++++++++++++ 3 files changed, 346 insertions(+), 2 deletions(-) create mode 100644 hotspot/make/solaris/makefiles/add_gnu_debuglink.make create mode 100644 hotspot/src/os/solaris/add_gnu_debuglink/add_gnu_debuglink.c diff --git a/hotspot/make/solaris/makefiles/add_gnu_debuglink.make b/hotspot/make/solaris/makefiles/add_gnu_debuglink.make new file mode 100644 index 00000000000..b89a4c443ea --- /dev/null +++ b/hotspot/make/solaris/makefiles/add_gnu_debuglink.make @@ -0,0 +1,51 @@ +# +# Copyright (c) 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. +# +# + +# Rules to build add_gnu_debuglink, used by vm.make on Solaris + +GENERATED = ../generated +ADD_GNU_DEBUGLINK = $(GENERATED)/add_gnu_debuglink + +ADD_GNU_DEBUGLINK_DIR = $(GAMMADIR)/src/os/solaris/add_gnu_debuglink +ADD_GNU_DEBUGLINK_SRC = $(ADD_GNU_DEBUGLINK_DIR)/add_gnu_debuglink.c +ADD_GNU_DEBUGLINK_FLAGS = +LIBS_ADD_GNU_DEBUGLINK += -lelf + +ifeq ("${Platform_compiler}", "sparcWorks") +# Enable the following ADD_GNU_DEBUGLINK_FLAGS addition if you need to +# compare the built ELF objects. +# +# The -g option makes static data global and the "-W0,-noglobal" +# option tells the compiler to not globalize static data using a unique +# globalization prefix. Instead force the use of a static globalization +# prefix based on the source filepath so the objects from two identical +# compilations are the same. +# +# Note: The blog says to use "-W0,-xglobalstatic", but that doesn't +# seem to work. I got "-W0,-noglobal" from Kelly and that works. +#ADD_GNU_DEBUGLINK_FLAGS += -W0,-noglobal +endif # Platform_compiler == sparcWorks + +$(ADD_GNU_DEBUGLINK): $(ADD_GNU_DEBUGLINK_SRC) + $(CC) -g -o $@ $< $(ADD_GNU_DEBUGLINK_FLAGS) $(LIBS_ADD_GNU_DEBUGLINK) diff --git a/hotspot/make/solaris/makefiles/vm.make b/hotspot/make/solaris/makefiles/vm.make index f91f533e3ac..ce3df9abe24 100644 --- a/hotspot/make/solaris/makefiles/vm.make +++ b/hotspot/make/solaris/makefiles/vm.make @@ -144,6 +144,10 @@ JDK_LIBDIR = $(JAVA_HOME)/jre/lib/$(LIBARCH) # jvm_db & dtrace include $(MAKEFILES_DIR)/dtrace.make +#---------------------------------------------------------------------- +# add_gnu_debuglink tool +include $(MAKEFILES_DIR)/add_gnu_debuglink.make + #---------------------------------------------------------------------- # JVM @@ -276,7 +280,7 @@ else LINK_VM = $(LINK_LIB.CXX) endif # making the library: -$(LIBJVM): $(LIBJVM.o) $(LIBJVM_MAPFILE) +$(LIBJVM): $(ADD_GNU_DEBUGLINK) $(LIBJVM.o) $(LIBJVM_MAPFILE) ifeq ($(filter -sbfast -xsbfast, $(CFLAGS_BROWSE)),) @echo Linking vm... $(QUIETLY) $(LINK_LIB.CXX/PRE_HOOK) @@ -287,7 +291,11 @@ ifeq ($(filter -sbfast -xsbfast, $(CFLAGS_BROWSE)),) $(QUIETLY) [ -f $(LIBJVM_G).1 ] || ln -s $@.1 $(LIBJVM_G).1 ifeq ($(ENABLE_FULL_DEBUG_SYMBOLS),1) $(QUIETLY) $(OBJCOPY) --only-keep-debug $@ $(LIBJVM_DEBUGINFO) - $(QUIETLY) $(OBJCOPY) --add-gnu-debuglink=$(LIBJVM_DEBUGINFO) $@ +# $(OBJCOPY) --add-gnu-debuglink=... corrupts the SUNW_dof section +# in libjvm.so. Use $(ADD_GNU_DEBUGLINK) until a fixed $(OBJCOPY) +# is available. +# $(QUIETLY) $(OBJCOPY) --add-gnu-debuglink=$(LIBJVM_DEBUGINFO) $@ + $(QUIETLY) $(ADD_GNU_DEBUGLINK) $(LIBJVM_DEBUGINFO) $@ ifeq ($(STRIP_POLICY),all_strip) $(QUIETLY) $(STRIP) $@ else diff --git a/hotspot/src/os/solaris/add_gnu_debuglink/add_gnu_debuglink.c b/hotspot/src/os/solaris/add_gnu_debuglink/add_gnu_debuglink.c new file mode 100644 index 00000000000..3cb2dc489d4 --- /dev/null +++ b/hotspot/src/os/solaris/add_gnu_debuglink/add_gnu_debuglink.c @@ -0,0 +1,285 @@ +/* + * Copyright (c) 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. + * + */ + +/* + * Name: add_gnu_debuglink.c + * + * Description: Add a ".gnu_debuglink" section that refers to the specified + * debug_info_path to the specified ELF object. + * + * This program is adapted from the example program shown on the + * elf(3elf) man page and from code from the Solaris compiler + * driver. + */ + +/* + * needed to define SHF_EXCLUDE + */ +#define ELF_TARGET_ALL + +#include +#include +#include +#include +#include +#include + +static void failure(void); +static unsigned int gnu_debuglink_crc32(unsigned int crc, unsigned char *buf, + size_t len); + +void +main(int argc, char ** argv) { + /* new ELF section name */ + static char SEC_NAME[] = ".gnu_debuglink"; + + unsigned char buffer[8 * 1024]; /* I/O buffer */ + int buffer_len; /* buffer length */ + char * debug_info_path; /* debug info path */ + void * ehdr; /* ELF header */ + Elf * elf; /* ELF descriptor */ + char * elf_ident; /* ELF identity string */ + char * elf_obj; /* elf_obj file */ + int fd; /* descriptor for files */ + unsigned int file_crc = 0; /* CRC for debug info file */ + int is_elfclass64; /* is an ELFCLASS64 file? */ + Elf_Data * link_dat; /* ELF data for new debug info link */ + Elf_Data * name_dat; /* ELF data for new section name */ + Elf_Scn * new_scn; /* new ELF section descriptor */ + void * new_shdr; /* new ELF section header */ + Elf_Scn * scn; /* ELF section descriptor */ + void * shdr; /* ELF section header */ + + if (argc != 3) { + (void) fprintf(stderr, "Usage: %s debug_info_path elf_obj\n", argv[0]); + exit(2); + } + + debug_info_path = argv[1]; /* save for later */ + if ((fd = open(debug_info_path, O_RDONLY)) == -1) { + (void) fprintf(stderr, "%s: cannot open file.\n", debug_info_path); + exit(3); + } + + (void) printf("Computing CRC for '%s'\n", debug_info_path); + (void) fflush(stdout); + /* compute CRC for the debug info file */ + for (;;) { + int len = read(fd, buffer, sizeof buffer); + if (len <= 0) { + break; + } + file_crc = gnu_debuglink_crc32(file_crc, buffer, len); + } + (void) close(fd); + + /* open the elf_obj */ + elf_obj = argv[2]; + if ((fd = open(elf_obj, O_RDWR)) == -1) { + (void) fprintf(stderr, "%s: cannot open file.\n", elf_obj); + exit(4); + } + + (void) printf("Opening '%s' for update\n", elf_obj); + (void) fflush(stdout); + (void) elf_version(EV_CURRENT); /* coordinate ELF versions */ + + /* obtain the ELF descriptors from the input file */ + if ((elf = elf_begin(fd, ELF_C_RDWR, NULL)) == NULL) { + failure(); + } + + /* determine if ELFCLASS64 or not? */ + elf_ident = elf_getident(elf, NULL); + is_elfclass64 = (elf_ident[EI_CLASS] == ELFCLASS64); + + /* get the ELF header */ + if (is_elfclass64) { + ehdr = elf64_getehdr(elf); + } else { + ehdr = elf32_getehdr(elf); + } + if (ehdr == NULL) { + failure(); + } + + /* get the ELF section descriptor */ + if (is_elfclass64) { + scn = elf_getscn(elf, ((Elf64_Ehdr *) ehdr)->e_shstrndx); + } else { + scn = elf_getscn(elf, ((Elf32_Ehdr *) ehdr)->e_shstrndx); + } + if (scn == NULL) { + failure(); + } + + /* get the section header */ + if (is_elfclass64) { + shdr = elf64_getshdr(scn); + } else { + shdr = elf32_getshdr(scn); + } + if (shdr == NULL) { + failure(); + } + + (void) printf("Adding ELF data for new section name\n"); + (void) fflush(stdout); + name_dat = elf_newdata(scn); + name_dat->d_buf = (void *) SEC_NAME; + if (is_elfclass64) { + name_dat->d_off = ((Elf64_Shdr *) shdr)->sh_size + 1; + } else { + name_dat->d_off = ((Elf32_Shdr *) shdr)->sh_size + 1; + } + name_dat->d_align = 1; + name_dat->d_size = strlen(SEC_NAME) + 1; + + new_scn = elf_newscn(elf); + + if (is_elfclass64) { + new_shdr = elf64_getshdr(new_scn); + ((Elf64_Shdr *) new_shdr)->sh_flags = SHF_EXCLUDE; + ((Elf64_Shdr *) new_shdr)->sh_type = SHT_PROGBITS; + ((Elf64_Shdr *) new_shdr)->sh_name = ((Elf64_Shdr *) shdr)->sh_size; + ((Elf64_Shdr *) new_shdr)->sh_addralign = 1; + ((Elf64_Shdr *) shdr)->sh_size += (strlen(SEC_NAME) + 1); + } else { + new_shdr = elf32_getshdr(new_scn); + ((Elf32_Shdr *) new_shdr)->sh_flags = SHF_EXCLUDE; + ((Elf32_Shdr *) new_shdr)->sh_type = SHT_PROGBITS; + ((Elf32_Shdr *) new_shdr)->sh_name = ((Elf32_Shdr *) shdr)->sh_size; + ((Elf32_Shdr *) new_shdr)->sh_addralign = 1; + ((Elf32_Shdr *) shdr)->sh_size += (strlen(SEC_NAME) + 1); + } + + (void) printf("Adding ELF data for debug_info_path value\n"); + (void) fflush(stdout); + (void) memset(buffer, 0, sizeof buffer); + buffer_len = strlen(debug_info_path) + 1; /* +1 for NUL */ + (void) strncpy((char *) buffer, debug_info_path, buffer_len); + if (buffer_len % 4 != 0) { + /* not on a 4 byte boundary so pad to the next one */ + buffer_len += (4 - buffer_len % 4); + } + /* save the CRC */ + (void) memcpy(&buffer[buffer_len], &file_crc, sizeof file_crc); + buffer_len += sizeof file_crc; + + link_dat = elf_newdata(new_scn); + link_dat->d_type = ELF_T_BYTE; + link_dat->d_size = buffer_len; + link_dat->d_buf = buffer; + link_dat->d_align = 1; + + (void) printf("Saving updates to '%s'\n", elf_obj); + (void) fflush(stdout); + (void) elf_update(elf, ELF_C_NULL); /* recalc ELF memory structures */ + (void) elf_update(elf, ELF_C_WRITE); /* write out changes to ELF obj */ + (void) elf_end(elf); /* done with ELF obj */ + (void) close(fd); + + (void) printf("Done updating '%s'\n", elf_obj); + (void) fflush(stdout); + exit(0); +} /* end main */ + + +static void +failure() { + (void) fprintf(stderr, "%s\n", elf_errmsg(elf_errno())); + exit(5); +} + + +/* + * The CRC used in gnu_debuglink, retrieved from + * http://sourceware.org/gdb/current/onlinedocs/gdb/Separate-Debug-Files.html#Separate-Debug-Files. + */ + +static unsigned int +gnu_debuglink_crc32(unsigned int crc, unsigned char *buf, size_t len) { + static const unsigned int crc32_table[256] = { + 0x00000000, 0x77073096, 0xee0e612c, 0x990951ba, 0x076dc419, + 0x706af48f, 0xe963a535, 0x9e6495a3, 0x0edb8832, 0x79dcb8a4, + 0xe0d5e91e, 0x97d2d988, 0x09b64c2b, 0x7eb17cbd, 0xe7b82d07, + 0x90bf1d91, 0x1db71064, 0x6ab020f2, 0xf3b97148, 0x84be41de, + 0x1adad47d, 0x6ddde4eb, 0xf4d4b551, 0x83d385c7, 0x136c9856, + 0x646ba8c0, 0xfd62f97a, 0x8a65c9ec, 0x14015c4f, 0x63066cd9, + 0xfa0f3d63, 0x8d080df5, 0x3b6e20c8, 0x4c69105e, 0xd56041e4, + 0xa2677172, 0x3c03e4d1, 0x4b04d447, 0xd20d85fd, 0xa50ab56b, + 0x35b5a8fa, 0x42b2986c, 0xdbbbc9d6, 0xacbcf940, 0x32d86ce3, + 0x45df5c75, 0xdcd60dcf, 0xabd13d59, 0x26d930ac, 0x51de003a, + 0xc8d75180, 0xbfd06116, 0x21b4f4b5, 0x56b3c423, 0xcfba9599, + 0xb8bda50f, 0x2802b89e, 0x5f058808, 0xc60cd9b2, 0xb10be924, + 0x2f6f7c87, 0x58684c11, 0xc1611dab, 0xb6662d3d, 0x76dc4190, + 0x01db7106, 0x98d220bc, 0xefd5102a, 0x71b18589, 0x06b6b51f, + 0x9fbfe4a5, 0xe8b8d433, 0x7807c9a2, 0x0f00f934, 0x9609a88e, + 0xe10e9818, 0x7f6a0dbb, 0x086d3d2d, 0x91646c97, 0xe6635c01, + 0x6b6b51f4, 0x1c6c6162, 0x856530d8, 0xf262004e, 0x6c0695ed, + 0x1b01a57b, 0x8208f4c1, 0xf50fc457, 0x65b0d9c6, 0x12b7e950, + 0x8bbeb8ea, 0xfcb9887c, 0x62dd1ddf, 0x15da2d49, 0x8cd37cf3, + 0xfbd44c65, 0x4db26158, 0x3ab551ce, 0xa3bc0074, 0xd4bb30e2, + 0x4adfa541, 0x3dd895d7, 0xa4d1c46d, 0xd3d6f4fb, 0x4369e96a, + 0x346ed9fc, 0xad678846, 0xda60b8d0, 0x44042d73, 0x33031de5, + 0xaa0a4c5f, 0xdd0d7cc9, 0x5005713c, 0x270241aa, 0xbe0b1010, + 0xc90c2086, 0x5768b525, 0x206f85b3, 0xb966d409, 0xce61e49f, + 0x5edef90e, 0x29d9c998, 0xb0d09822, 0xc7d7a8b4, 0x59b33d17, + 0x2eb40d81, 0xb7bd5c3b, 0xc0ba6cad, 0xedb88320, 0x9abfb3b6, + 0x03b6e20c, 0x74b1d29a, 0xead54739, 0x9dd277af, 0x04db2615, + 0x73dc1683, 0xe3630b12, 0x94643b84, 0x0d6d6a3e, 0x7a6a5aa8, + 0xe40ecf0b, 0x9309ff9d, 0x0a00ae27, 0x7d079eb1, 0xf00f9344, + 0x8708a3d2, 0x1e01f268, 0x6906c2fe, 0xf762575d, 0x806567cb, + 0x196c3671, 0x6e6b06e7, 0xfed41b76, 0x89d32be0, 0x10da7a5a, + 0x67dd4acc, 0xf9b9df6f, 0x8ebeeff9, 0x17b7be43, 0x60b08ed5, + 0xd6d6a3e8, 0xa1d1937e, 0x38d8c2c4, 0x4fdff252, 0xd1bb67f1, + 0xa6bc5767, 0x3fb506dd, 0x48b2364b, 0xd80d2bda, 0xaf0a1b4c, + 0x36034af6, 0x41047a60, 0xdf60efc3, 0xa867df55, 0x316e8eef, + 0x4669be79, 0xcb61b38c, 0xbc66831a, 0x256fd2a0, 0x5268e236, + 0xcc0c7795, 0xbb0b4703, 0x220216b9, 0x5505262f, 0xc5ba3bbe, + 0xb2bd0b28, 0x2bb45a92, 0x5cb36a04, 0xc2d7ffa7, 0xb5d0cf31, + 0x2cd99e8b, 0x5bdeae1d, 0x9b64c2b0, 0xec63f226, 0x756aa39c, + 0x026d930a, 0x9c0906a9, 0xeb0e363f, 0x72076785, 0x05005713, + 0x95bf4a82, 0xe2b87a14, 0x7bb12bae, 0x0cb61b38, 0x92d28e9b, + 0xe5d5be0d, 0x7cdcefb7, 0x0bdbdf21, 0x86d3d2d4, 0xf1d4e242, + 0x68ddb3f8, 0x1fda836e, 0x81be16cd, 0xf6b9265b, 0x6fb077e1, + 0x18b74777, 0x88085ae6, 0xff0f6a70, 0x66063bca, 0x11010b5c, + 0x8f659eff, 0xf862ae69, 0x616bffd3, 0x166ccf45, 0xa00ae278, + 0xd70dd2ee, 0x4e048354, 0x3903b3c2, 0xa7672661, 0xd06016f7, + 0x4969474d, 0x3e6e77db, 0xaed16a4a, 0xd9d65adc, 0x40df0b66, + 0x37d83bf0, 0xa9bcae53, 0xdebb9ec5, 0x47b2cf7f, 0x30b5ffe9, + 0xbdbdf21c, 0xcabac28a, 0x53b39330, 0x24b4a3a6, 0xbad03605, + 0xcdd70693, 0x54de5729, 0x23d967bf, 0xb3667a2e, 0xc4614ab8, + 0x5d681b02, 0x2a6f2b94, 0xb40bbe37, 0xc30c8ea1, 0x5a05df1b, + 0x2d02ef8d + }; + + unsigned char *end; + + crc = ~crc & 0xffffffff; + for (end = buf + len; buf < end; ++buf) { + crc = crc32_table[(crc ^ *buf) & 0xff] ^ (crc >> 8); + } + return ~crc & 0xffffffff; +} From 5f43f7c289a884a29d4dd11bbdb030b97999f5a5 Mon Sep 17 00:00:00 2001 From: Kurchi Subhra Hazra Date: Tue, 15 May 2012 11:51:51 -0700 Subject: [PATCH 057/128] 7164636: (prefs) Cleanup src/macosx/classes/java/util/prefs Remove rawtype usages and other code cleanup Reviewed-by: chegar, briangoetz --- .../java/util/prefs/MacOSXPreferences.java | 11 +++++ .../util/prefs/MacOSXPreferencesFactory.java | 2 + .../util/prefs/MacOSXPreferencesFile.java | 44 +++++++++++-------- 3 files changed, 38 insertions(+), 19 deletions(-) diff --git a/jdk/src/macosx/classes/java/util/prefs/MacOSXPreferences.java b/jdk/src/macosx/classes/java/util/prefs/MacOSXPreferences.java index 7a4ef4b6605..cba98be1b2a 100644 --- a/jdk/src/macosx/classes/java/util/prefs/MacOSXPreferences.java +++ b/jdk/src/macosx/classes/java/util/prefs/MacOSXPreferences.java @@ -135,18 +135,21 @@ class MacOSXPreferences extends AbstractPreferences { // AbstractPreferences implementation + @Override protected void putSpi(String key, String value) { file.addKeyToNode(path, key, value); } // AbstractPreferences implementation + @Override protected String getSpi(String key) { return file.getKeyFromNode(path, key); } // AbstractPreferences implementation + @Override protected void removeSpi(String key) { Objects.requireNonNull(key, "Specified key cannot be null"); @@ -155,6 +158,7 @@ class MacOSXPreferences extends AbstractPreferences { // AbstractPreferences implementation + @Override protected void removeNodeSpi() throws BackingStoreException { @@ -174,6 +178,7 @@ class MacOSXPreferences extends AbstractPreferences { // AbstractPreferences implementation + @Override protected String[] childrenNamesSpi() throws BackingStoreException { @@ -183,6 +188,7 @@ class MacOSXPreferences extends AbstractPreferences { } // AbstractPreferences implementation + @Override protected String[] keysSpi() throws BackingStoreException { @@ -192,6 +198,7 @@ class MacOSXPreferences extends AbstractPreferences { } // AbstractPreferences implementation + @Override protected AbstractPreferences childSpi(String name) { // Add to parent's child list here and disallow sync @@ -203,6 +210,7 @@ class MacOSXPreferences extends AbstractPreferences { } // AbstractPreferences override + @Override public void flush() throws BackingStoreException { @@ -217,6 +225,7 @@ class MacOSXPreferences extends AbstractPreferences { } // AbstractPreferences implementation + @Override protected void flushSpi() throws BackingStoreException { @@ -224,6 +233,7 @@ class MacOSXPreferences extends AbstractPreferences { } // AbstractPreferences override + @Override public void sync() throws BackingStoreException { @@ -244,6 +254,7 @@ class MacOSXPreferences extends AbstractPreferences { } // AbstractPreferences implementation + @Override protected void syncSpi() throws BackingStoreException { diff --git a/jdk/src/macosx/classes/java/util/prefs/MacOSXPreferencesFactory.java b/jdk/src/macosx/classes/java/util/prefs/MacOSXPreferencesFactory.java index 05ef30c7800..2d1710e1930 100644 --- a/jdk/src/macosx/classes/java/util/prefs/MacOSXPreferencesFactory.java +++ b/jdk/src/macosx/classes/java/util/prefs/MacOSXPreferencesFactory.java @@ -26,10 +26,12 @@ package java.util.prefs; class MacOSXPreferencesFactory implements PreferencesFactory { + @Override public Preferences userRoot() { return MacOSXPreferences.getUserRoot(); } + @Override public Preferences systemRoot() { return MacOSXPreferences.getSystemRoot(); } diff --git a/jdk/src/macosx/classes/java/util/prefs/MacOSXPreferencesFile.java b/jdk/src/macosx/classes/java/util/prefs/MacOSXPreferencesFile.java index 992ae620338..31355b5be46 100644 --- a/jdk/src/macosx/classes/java/util/prefs/MacOSXPreferencesFile.java +++ b/jdk/src/macosx/classes/java/util/prefs/MacOSXPreferencesFile.java @@ -101,9 +101,10 @@ class MacOSXPreferencesFile { } // Maps string -> weak reference to MacOSXPreferencesFile - private static HashMap cachedFiles = null; + private static HashMap> + cachedFiles; // Files that may have unflushed changes - private static HashSet changedFiles = null; + private static HashSet changedFiles; // Timer and pending sync and flush tasks (which are both scheduled @@ -136,13 +137,14 @@ class MacOSXPreferencesFile { { MacOSXPreferencesFile result = null; - if (cachedFiles == null) cachedFiles = new HashMap(); + if (cachedFiles == null) + cachedFiles = new HashMap<>(); String hashkey = newName + String.valueOf(isUser); - WeakReference hashvalue = (WeakReference)cachedFiles.get(hashkey); + WeakReference hashvalue = cachedFiles.get(hashkey); if (hashvalue != null) { - result = (MacOSXPreferencesFile)hashvalue.get(); + result = hashvalue.get(); } if (result == null) { // Java user node == CF current user, any host @@ -150,7 +152,7 @@ class MacOSXPreferencesFile { result = new MacOSXPreferencesFile(newName, isUser ? cfCurrentUser : cfAnyUser, isUser ? cfAnyHost : cfCurrentHost); - cachedFiles.put(hashkey, new WeakReference(result)); + cachedFiles.put(hashkey, new WeakReference(result)); } // Don't schedule this file for flushing until some nodes or @@ -171,10 +173,11 @@ class MacOSXPreferencesFile { boolean ok = true; if (cachedFiles != null && !cachedFiles.isEmpty()) { - Iterator iter = cachedFiles.values().iterator(); + Iterator> iter = + cachedFiles.values().iterator(); while (iter.hasNext()) { - WeakReference ref = (WeakReference)iter.next(); - MacOSXPreferencesFile f = (MacOSXPreferencesFile)ref.get(); + WeakReference ref = iter.next(); + MacOSXPreferencesFile f = ref.get(); if (f != null) { if (!f.synchronize()) ok = false; } else { @@ -202,10 +205,11 @@ class MacOSXPreferencesFile { static synchronized boolean syncUser() { boolean ok = true; if (cachedFiles != null && !cachedFiles.isEmpty()) { - Iterator iter = cachedFiles.values().iterator(); + Iterator> iter = + cachedFiles.values().iterator(); while (iter.hasNext()) { - WeakReference ref = iter.next(); - MacOSXPreferencesFile f = (MacOSXPreferencesFile)ref.get(); + WeakReference ref = iter.next(); + MacOSXPreferencesFile f = ref.get(); if (f != null && f.user == cfCurrentUser) { if (!f.synchronize()) { ok = false; @@ -240,12 +244,10 @@ class MacOSXPreferencesFile { boolean ok = true; if (changedFiles != null && !changedFiles.isEmpty()) { - Iterator iter = changedFiles.iterator(); - while (iter.hasNext()) { - MacOSXPreferencesFile f = (MacOSXPreferencesFile)iter.next(); - if (!f.synchronize()) ok = false; + for (MacOSXPreferencesFile f : changedFiles) { + if (!f.synchronize()) + ok = false; } - changedFiles.clear(); } @@ -263,7 +265,8 @@ class MacOSXPreferencesFile { private void markChanged() { // Add this file to the changed file list - if (changedFiles == null) changedFiles = new HashSet(); + if (changedFiles == null) + changedFiles = new HashSet<>(); changedFiles.add(this); // Schedule a new flush and a shutdown hook, if necessary @@ -309,7 +312,9 @@ class MacOSXPreferencesFile { if (syncInterval > 0) { timer().schedule(new TimerTask() { - public void run() { MacOSXPreferencesFile.syncWorld();} + @Override + public void run() { + MacOSXPreferencesFile.syncWorld();} }, syncInterval * 1000, syncInterval * 1000); } else { // syncInterval property not set. No sync timer ever. @@ -323,6 +328,7 @@ class MacOSXPreferencesFile { if (timer == null) { timer = new Timer(true); // daemon Thread flushThread = new Thread() { + @Override public void run() { flushWorld(); } From a4ab9d705055ec8edffb49f42b8ded097d354e2b Mon Sep 17 00:00:00 2001 From: Dmitry Cherepanov Date: Wed, 16 May 2012 13:15:27 +0400 Subject: [PATCH 058/128] 7124337: [macosx] FileDialog fails to select multiple files Reviewed-by: anthony, swingler --- .../classes/sun/lwawt/macosx/CFileDialog.java | 50 +++++++++++-------- jdk/src/macosx/native/sun/awt/CFileDialog.h | 12 +++-- jdk/src/macosx/native/sun/awt/CFileDialog.m | 48 +++++++++++++----- .../share/classes/java/awt/FileDialog.java | 12 ++--- .../share/classes/sun/awt/AWTAccessor.java | 4 +- .../sun/awt/X11/GtkFileDialogPeer.java | 10 +++- .../classes/sun/awt/X11/XFileDialogPeer.java | 11 +++- .../sun/awt/windows/WFileDialogPeer.java | 17 ++++--- 8 files changed, 106 insertions(+), 58 deletions(-) diff --git a/jdk/src/macosx/classes/sun/lwawt/macosx/CFileDialog.java b/jdk/src/macosx/classes/sun/lwawt/macosx/CFileDialog.java index 2c55692218e..b905f0bcc93 100644 --- a/jdk/src/macosx/classes/sun/lwawt/macosx/CFileDialog.java +++ b/jdk/src/macosx/classes/sun/lwawt/macosx/CFileDialog.java @@ -34,6 +34,7 @@ import java.util.List; import java.io.*; import sun.awt.CausedFocusEvent.Cause; +import sun.awt.AWTAccessor; import sun.java2d.pipe.Region; class CFileDialog implements FileDialogPeer { @@ -53,33 +54,40 @@ class CFileDialog implements FileDialogPeer { title = " "; } - String userFileName = nativeRunFileDialog(title, - dialogMode, navigateApps, + String[] userFileNames = nativeRunFileDialog(title, + dialogMode, + target.isMultipleMode(), + navigateApps, target.getFilenameFilter() != null, target.getDirectory(), target.getFile()); - File file = null; - if (userFileName != null) { - // the dialog wasn't cancelled - file = new File(userFileName); - } + String directory = null; + String file = null; + File[] files = null; - if (file != null) { - // make sure directory always ends in '/' - String parent = file.getParent(); - if (!parent.endsWith(File.separator)) { - parent = parent + File.separator; + if (userFileNames != null) { + // the dialog wasn't cancelled + int filesNumber = userFileNames.length; + files = new File[filesNumber]; + for (int i = 0; i < filesNumber; i++) { + files[i] = new File(userFileNames[i]); } - // store results back in component - target.setDirectory(parent); - target.setFile(file.getName()); - } else { - // setting file name to null is how we tell - // java client that user hit the cancel button - target.setFile(null); + directory = files[0].getParent(); + // make sure directory always ends in '/' + if (!directory.endsWith(File.separator)) { + directory = directory + File.separator; + } + + file = files[0].getName(); // pick any file } + + // store results back in component + AWTAccessor.FileDialogAccessor accessor = AWTAccessor.getFileDialogAccessor(); + accessor.setDirectory(target, directory); + accessor.setFile(target, file); + accessor.setFiles(target, files); } finally { // Java2 Dialog waits for hide to let show() return target.dispose(); @@ -133,8 +141,8 @@ class CFileDialog implements FileDialogPeer { return ret; } - private native String nativeRunFileDialog(String title, int mode, - boolean shouldNavigateApps, boolean hasFilenameFilter, + private native String[] nativeRunFileDialog(String title, int mode, + boolean multipleMode, boolean shouldNavigateApps, boolean hasFilenameFilter, String directory, String file); @Override diff --git a/jdk/src/macosx/native/sun/awt/CFileDialog.h b/jdk/src/macosx/native/sun/awt/CFileDialog.h index c9015899217..14ed63d24bf 100644 --- a/jdk/src/macosx/native/sun/awt/CFileDialog.h +++ b/jdk/src/macosx/native/sun/awt/CFileDialog.h @@ -46,11 +46,14 @@ // File dialog's mode jint fMode; + // Indicates whether the user can select multiple files + BOOL fMultipleMode; + // Should we navigate into apps? BOOL fNavigateApps; - // panel's filename - NSString *fReturnedFilename; + // Contains the absolute paths of the selected files as URLs + NSArray *fURLs; } // Allocator @@ -60,6 +63,7 @@ directory:(NSString *)inPath file:(NSString *)inFile mode:(jint)inMode + multipleMode:(BOOL)inMultipleMode shouldNavigate:(BOOL)inNavigateApps withEnv:(JNIEnv*)env; @@ -69,7 +73,7 @@ // Get dialog return value - (BOOL) userClickedOK; -// Filename user chose -- (NSString *) filename; +// Returns the absolute paths of the selected files as URLs +- (NSArray *) URLs; @end diff --git a/jdk/src/macosx/native/sun/awt/CFileDialog.m b/jdk/src/macosx/native/sun/awt/CFileDialog.m index 129ffd940b5..283cc8cb781 100644 --- a/jdk/src/macosx/native/sun/awt/CFileDialog.m +++ b/jdk/src/macosx/native/sun/awt/CFileDialog.m @@ -41,6 +41,7 @@ directory:(NSString *)inPath file:(NSString *)inFile mode:(jint)inMode + multipleMode:(BOOL)inMultipleMode shouldNavigate:(BOOL)inNavigateApps withEnv:(JNIEnv*)env; { @@ -54,6 +55,7 @@ fTitle = inTitle; [fTitle retain]; fMode = inMode; + fMultipleMode = inMultipleMode; fNavigateApps = inNavigateApps; fPanelResult = NSCancelButton; } @@ -79,8 +81,8 @@ [fTitle release]; fTitle = nil; - [fReturnedFilename release]; - fReturnedFilename = nil; + [fURLs release]; + fURLs = nil; [super dealloc]; } @@ -105,7 +107,7 @@ if (fMode == java_awt_FileDialog_LOAD) { NSOpenPanel *openPanel = (NSOpenPanel *)thePanel; - [openPanel setAllowsMultipleSelection:NO]; + [openPanel setAllowsMultipleSelection:fMultipleMode]; [openPanel setCanChooseFiles:YES]; [openPanel setCanChooseDirectories:NO]; [openPanel setCanCreateDirectories:YES]; @@ -114,8 +116,16 @@ [thePanel setDelegate:self]; fPanelResult = [thePanel runModalForDirectory:fDirectory file:fFile]; [thePanel setDelegate:nil]; - fReturnedFilename = [thePanel filename]; - [fReturnedFilename retain]; + + if ([self userClickedOK]) { + if (fMode == java_awt_FileDialog_LOAD) { + NSOpenPanel *openPanel = (NSOpenPanel *)thePanel; + fURLs = [openPanel URLs]; + } else { + fURLs = [NSArray arrayWithObject:[thePanel URL]]; + } + [fURLs retain]; + } } [self disposer]; @@ -158,8 +168,8 @@ return fPanelResult == NSOKButton; } -- (NSString *)filename { - return [[fReturnedFilename retain] autorelease]; +- (NSArray *)URLs { + return [[fURLs retain] autorelease]; } @end @@ -167,13 +177,14 @@ * Class: sun_lwawt_macosx_CFileDialog * Method: nativeRunFileDialog * Signature: (Ljava/lang/String;ILjava/io/FilenameFilter; - * Ljava/lang/String;Ljava/lang/String;)Ljava/lang/String; + * Ljava/lang/String;Ljava/lang/String;)[Ljava/lang/String; */ -JNIEXPORT jstring JNICALL +JNIEXPORT jobjectArray JNICALL Java_sun_lwawt_macosx_CFileDialog_nativeRunFileDialog -(JNIEnv *env, jobject peer, jstring title, jint mode, jboolean navigateApps, jboolean hasFilter, jstring directory, jstring file) +(JNIEnv *env, jobject peer, jstring title, jint mode, jboolean multipleMode, + jboolean navigateApps, jboolean hasFilter, jstring directory, jstring file) { - jstring returnValue = NULL; + jobjectArray returnValue = NULL; JNF_COCOA_ENTER(env); NSString *dialogTitle = JNFJavaToNSString(env, title); @@ -187,6 +198,7 @@ JNF_COCOA_ENTER(env); directory:JNFJavaToNSString(env, directory) file:JNFJavaToNSString(env, file) mode:mode + multipleMode:multipleMode shouldNavigate:navigateApps withEnv:env]; @@ -196,8 +208,18 @@ JNF_COCOA_ENTER(env); waitUntilDone:YES]; if ([dialogDelegate userClickedOK]) { - NSString *filename = [dialogDelegate filename]; - returnValue = JNFNSToJavaString(env, filename); + NSArray *urls = [dialogDelegate URLs]; + jsize count = [urls count]; + + jclass stringClass = (*env)->FindClass(env, "java/lang/String"); + returnValue = (*env)->NewObjectArray(env, count, stringClass, NULL); + (*env)->DeleteLocalRef(env, stringClass); + + [urls enumerateObjectsUsingBlock:^(id url, NSUInteger index, BOOL *stop) { + jstring filename = JNFNormalizedJavaStringForPath(env, [url path]); + (*env)->SetObjectArrayElement(env, returnValue, index, filename); + (*env)->DeleteLocalRef(env, filename); + }]; } [dialogDelegate release]; diff --git a/jdk/src/share/classes/java/awt/FileDialog.java b/jdk/src/share/classes/java/awt/FileDialog.java index ebff2c45fee..3739570abb5 100644 --- a/jdk/src/share/classes/java/awt/FileDialog.java +++ b/jdk/src/share/classes/java/awt/FileDialog.java @@ -147,8 +147,8 @@ public class FileDialog extends Dialog { static { AWTAccessor.setFileDialogAccessor( new AWTAccessor.FileDialogAccessor() { - public void setFiles(FileDialog fileDialog, String directory, String files[]) { - fileDialog.setFiles(directory, files); + public void setFiles(FileDialog fileDialog, File files[]) { + fileDialog.setFiles(files); } public void setFile(FileDialog fileDialog, String file) { fileDialog.file = ("".equals(file)) ? null : file; @@ -446,13 +446,9 @@ public class FileDialog extends Dialog { * @see #getFiles * @since 1.7 */ - private void setFiles(String directory, String files[]) { + private void setFiles(File files[]) { synchronized (getObjectLock()) { - int filesNumber = (files != null) ? files.length : 0; - this.files = new File[filesNumber]; - for (int i = 0; i < filesNumber; i++) { - this.files[i] = new File(directory, files[i]); - } + this.files = files; } } diff --git a/jdk/src/share/classes/sun/awt/AWTAccessor.java b/jdk/src/share/classes/sun/awt/AWTAccessor.java index f8047790155..04a2799fe5f 100644 --- a/jdk/src/share/classes/sun/awt/AWTAccessor.java +++ b/jdk/src/share/classes/sun/awt/AWTAccessor.java @@ -34,6 +34,8 @@ import java.awt.geom.Point2D; import java.awt.peer.ComponentPeer; import java.security.AccessControlContext; +import java.io.File; + /** * The AWTAccessor utility class. * The main purpose of this class is to enable accessing @@ -455,7 +457,7 @@ public final class AWTAccessor { /* * Sets the files the user selects */ - void setFiles(FileDialog fileDialog, String directory, String files[]); + void setFiles(FileDialog fileDialog, File files[]); /* * Sets the file the user selects diff --git a/jdk/src/solaris/classes/sun/awt/X11/GtkFileDialogPeer.java b/jdk/src/solaris/classes/sun/awt/X11/GtkFileDialogPeer.java index ebd434a96df..71cb7f3ddc5 100644 --- a/jdk/src/solaris/classes/sun/awt/X11/GtkFileDialogPeer.java +++ b/jdk/src/solaris/classes/sun/awt/X11/GtkFileDialogPeer.java @@ -73,7 +73,7 @@ class GtkFileDialogPeer extends XDialogPeer implements FileDialogPeer { if (filenames == null) { accessor.setDirectory(fd, null); accessor.setFile(fd, null); - accessor.setFiles(fd, null, null); + accessor.setFiles(fd, null); } else { // Fix 6987233: add the trailing slash if it's absent String with_separator = directory; @@ -83,7 +83,13 @@ class GtkFileDialogPeer extends XDialogPeer implements FileDialogPeer { } accessor.setDirectory(fd, with_separator); accessor.setFile(fd, filenames[0]); - accessor.setFiles(fd, directory, filenames); + + int filesNumber = (filenames != null) ? filenames.length : 0; + File[] files = new File[filesNumber]; + for (int i = 0; i < filesNumber; i++) { + files[i] = new File(directory, filenames[i]); + } + accessor.setFiles(fd, files); } } diff --git a/jdk/src/solaris/classes/sun/awt/X11/XFileDialogPeer.java b/jdk/src/solaris/classes/sun/awt/X11/XFileDialogPeer.java index 9fac04660ca..f15dbd209d1 100644 --- a/jdk/src/solaris/classes/sun/awt/X11/XFileDialogPeer.java +++ b/jdk/src/solaris/classes/sun/awt/X11/XFileDialogPeer.java @@ -396,11 +396,18 @@ class XFileDialogPeer extends XDialogPeer implements FileDialogPeer, ActionListe savedFile = file.substring(index+1); } + String[] fileNames = fileList.getSelectedItems(); + int filesNumber = (fileNames != null) ? fileNames.length : 0; + File[] files = new File[filesNumber]; + for (int i = 0; i < filesNumber; i++) { + files[i] = new File(savedDir, fileNames[i]); + } + AWTAccessor.FileDialogAccessor fileDialogAccessor = AWTAccessor.getFileDialogAccessor(); fileDialogAccessor.setDirectory(target, savedDir); fileDialogAccessor.setFile(target, savedFile); - fileDialogAccessor.setFiles(target, savedDir, fileList.getSelectedItems()); + fileDialogAccessor.setFiles(target, files); } /** @@ -419,7 +426,7 @@ class XFileDialogPeer extends XDialogPeer implements FileDialogPeer, ActionListe fileDialogAccessor.setDirectory(target, null); fileDialogAccessor.setFile(target, null); - fileDialogAccessor.setFiles(target, null, null); + fileDialogAccessor.setFiles(target, null); handleQuitButton(); } diff --git a/jdk/src/windows/classes/sun/awt/windows/WFileDialogPeer.java b/jdk/src/windows/classes/sun/awt/windows/WFileDialogPeer.java index 56568dcf3a1..11fe02f83d0 100644 --- a/jdk/src/windows/classes/sun/awt/windows/WFileDialogPeer.java +++ b/jdk/src/windows/classes/sun/awt/windows/WFileDialogPeer.java @@ -139,13 +139,16 @@ public class WFileDialogPeer extends WWindowPeer implements FileDialogPeer { String jDirectory = null; String jFile = null; - String jFiles[] = null; + File[] jFiles = null; if (multiple) { jDirectory = wFiles[0]; - jFiles = new String[wFiles.length - 1]; - System.arraycopy(wFiles, 1, jFiles, 0, jFiles.length); - jFile = jFiles[1]; // choose any file + int filesNumber = wFiles.length - 1; + jFiles = new File[filesNumber]; + for (int i = 0; i < filesNumber; i++) { + jFiles[i] = new File(jDirectory, wFiles[i + 1]); + } + jFile = wFiles[1]; // choose any file } else { int index = wFiles[0].lastIndexOf(java.io.File.separatorChar); if (index == -1) { @@ -155,7 +158,7 @@ public class WFileDialogPeer extends WWindowPeer implements FileDialogPeer { jDirectory = wFiles[0].substring(0, index + 1); jFile = wFiles[0].substring(index + 1); } - jFiles = new String[] { jFile }; + jFiles = new File[] { new File(jDirectory, jFile) }; } final FileDialog fileDialog = (FileDialog)target; @@ -163,7 +166,7 @@ public class WFileDialogPeer extends WWindowPeer implements FileDialogPeer { fileDialogAccessor.setDirectory(fileDialog, jDirectory); fileDialogAccessor.setFile(fileDialog, jFile); - fileDialogAccessor.setFiles(fileDialog, jDirectory, jFiles); + fileDialogAccessor.setFiles(fileDialog, jFiles); WToolkit.executeOnEventHandlerThread(fileDialog, new Runnable() { public void run() { @@ -178,7 +181,7 @@ public class WFileDialogPeer extends WWindowPeer implements FileDialogPeer { final FileDialog fileDialog = (FileDialog)target; AWTAccessor.getFileDialogAccessor().setFile(fileDialog, null); - AWTAccessor.getFileDialogAccessor().setFiles(fileDialog, null, null); + AWTAccessor.getFileDialogAccessor().setFiles(fileDialog, null); WToolkit.executeOnEventHandlerThread(fileDialog, new Runnable() { public void run() { From c4b4c6a9a522581a1a79af23e163546688a72a83 Mon Sep 17 00:00:00 2001 From: Anthony Petrov Date: Wed, 16 May 2012 14:28:12 +0400 Subject: [PATCH 059/128] 7168851: [macosx] Netbeans crashes in CImage.nativeCreateNSImageFromArray Eliminate unnecessary -release call Reviewed-by: dcherepanov --- jdk/src/macosx/native/sun/awt/CImage.m | 1 - 1 file changed, 1 deletion(-) diff --git a/jdk/src/macosx/native/sun/awt/CImage.m b/jdk/src/macosx/native/sun/awt/CImage.m index 64a6f3c4ec1..330e9943f62 100644 --- a/jdk/src/macosx/native/sun/awt/CImage.m +++ b/jdk/src/macosx/native/sun/awt/CImage.m @@ -163,7 +163,6 @@ AWT_ASSERT_ANY_THREAD; if ([reps count]) { NSImage *nsImage = [[NSImage alloc] initWithSize:NSMakeSize(0, 0)]; [nsImage addRepresentations: reps]; - [reps release]; if (nsImage != nil) { CFRetain(nsImage); // GC From 2a928a555dadd81075aa791b2aed51de659b17bf Mon Sep 17 00:00:00 2001 From: Alan Bateman Date: Wed, 16 May 2012 12:43:27 +0100 Subject: [PATCH 060/128] 7168505: (bf) MappedByteBuffer.load does not load buffer's content into memory Reviewed-by: mduigou, forax --- jdk/src/share/classes/java/nio/MappedByteBuffer.java | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/jdk/src/share/classes/java/nio/MappedByteBuffer.java b/jdk/src/share/classes/java/nio/MappedByteBuffer.java index e07ed1e2e0b..b022e1ca0bf 100644 --- a/jdk/src/share/classes/java/nio/MappedByteBuffer.java +++ b/jdk/src/share/classes/java/nio/MappedByteBuffer.java @@ -139,6 +139,9 @@ public abstract class MappedByteBuffer return isLoaded0(mappingAddress(offset), length, Bits.pageCount(length)); } + // not used, but a potential target for a store, see load() for details. + private static byte unused; + /** * Loads this buffer's content into physical memory. * @@ -157,15 +160,20 @@ public abstract class MappedByteBuffer long length = mappingLength(offset); load0(mappingAddress(offset), length); - // touch each page + // Read a byte from each page to bring it into memory. A checksum + // is computed as we go along to prevent the compiler from otherwise + // considering the loop as dead code. Unsafe unsafe = Unsafe.getUnsafe(); int ps = Bits.pageSize(); int count = Bits.pageCount(length); long a = mappingAddress(offset); + byte x = 0; for (int i=0; i Date: Wed, 16 May 2012 16:27:12 +0400 Subject: [PATCH 061/128] 7169226: NLS: Please change the mnemonic assignment system for windows and motif properties Reviewed-by: rupashka --- .../plaf/motif/resources/motif.properties | 43 ++++++++---------- .../plaf/motif/resources/motif_de.properties | 43 ++++++++---------- .../plaf/motif/resources/motif_es.properties | 43 ++++++++---------- .../plaf/motif/resources/motif_fr.properties | 43 ++++++++---------- .../plaf/motif/resources/motif_it.properties | 43 ++++++++---------- .../plaf/motif/resources/motif_ja.properties | 43 ++++++++---------- .../plaf/motif/resources/motif_ko.properties | 43 ++++++++---------- .../motif/resources/motif_pt_BR.properties | 43 ++++++++---------- .../plaf/motif/resources/motif_sv.properties | 43 ++++++++---------- .../motif/resources/motif_zh_CN.properties | 43 ++++++++---------- .../motif/resources/motif_zh_TW.properties | 43 ++++++++---------- .../plaf/windows/resources/windows.properties | 44 +++++++++---------- .../windows/resources/windows_de.properties | 44 +++++++++---------- .../windows/resources/windows_es.properties | 44 +++++++++---------- .../windows/resources/windows_fr.properties | 44 +++++++++---------- .../windows/resources/windows_it.properties | 44 +++++++++---------- .../windows/resources/windows_ja.properties | 44 +++++++++---------- .../windows/resources/windows_ko.properties | 44 +++++++++---------- .../resources/windows_pt_BR.properties | 44 +++++++++---------- .../windows/resources/windows_sv.properties | 44 +++++++++---------- .../resources/windows_zh_CN.properties | 44 +++++++++---------- .../resources/windows_zh_TW.properties | 44 +++++++++---------- 22 files changed, 429 insertions(+), 528 deletions(-) diff --git a/jdk/src/share/classes/com/sun/java/swing/plaf/motif/resources/motif.properties b/jdk/src/share/classes/com/sun/java/swing/plaf/motif/resources/motif.properties index d3fee304abe..fed806c17dd 100644 --- a/jdk/src/share/classes/com/sun/java/swing/plaf/motif/resources/motif.properties +++ b/jdk/src/share/classes/com/sun/java/swing/plaf/motif/resources/motif.properties @@ -18,28 +18,23 @@ ############ FILE CHOOSER STRINGS ############# -FileChooser.acceptAllFileFilterText=* -FileChooser.cancelButtonText=Cancel -FileChooser.saveButtonText=Save -FileChooser.openButtonText=OK -FileChooser.saveDialogTitleText=Save -FileChooser.openDialogTitleText=Open -FileChooser.updateButtonText=Update -FileChooser.helpButtonText=Help -FileChooser.pathLabelText=Enter path or folder name: -FileChooser.pathLabelMnemonic=80 -FileChooser.filterLabelText=Filter -FileChooser.filterLabelMnemonic=82 -FileChooser.foldersLabelText=Folders -FileChooser.foldersLabelMnemonic=76 -FileChooser.filesLabelText=Files -FileChooser.filesLabelMnemonic=73 -FileChooser.enterFileNameLabelText=Enter file name: -FileChooser.enterFileNameLabelMnemonic=78 -FileChooser.enterFolderNameLabelText=Enter folder name: +FileChooser.acceptAllFileFilter.textAndMnemonic=* +FileChooser.cancelButton.textAndMnemonic=Cancel +FileChooser.saveButton.textAndMnemonic=Save +FileChooser.openButton.textAndMnemonic=OK +FileChooser.saveDialogTitle.textAndMnemonic=Save +FileChooser.openDialogTitle.textAndMnemonic=Open +FileChooser.updateButton.textAndMnemonic=Update +FileChooser.helpButton.textAndMnemonic=Help +FileChooser.pathLabel.textAndMnemonic=Enter &path or folder name: +FileChooser.filterLabel.textAndMnemonic=Filte&r +FileChooser.foldersLabel.textAndMnemonic=Fo&lders +FileChooser.filesLabel.textAndMnemonic=F&iles +FileChooser.enterFileNameLabel.textAndMnemonic=E&nter file name: +FileChooser.enterFolderNameLabel.textAndMnemonic=Enter folder name: -FileChooser.cancelButtonToolTipText=Abort file chooser dialog. -FileChooser.saveButtonToolTipText=Save selected file. -FileChooser.openButtonToolTipText=Open selected file. -FileChooser.updateButtonToolTipText=Update directory listing. -FileChooser.helpButtonToolTipText=FileChooser help. +FileChooser.cancelButtonToolTip.textAndMnemonic=Abort file chooser dialog. +FileChooser.saveButtonToolTip.textAndMnemonic=Save selected file. +FileChooser.openButtonToolTip.textAndMnemonic=Open selected file. +FileChooser.updateButtonToolTip.textAndMnemonic=Update directory listing. +FileChooser.helpButtonToolTip.textAndMnemonic=FileChooser help. diff --git a/jdk/src/share/classes/com/sun/java/swing/plaf/motif/resources/motif_de.properties b/jdk/src/share/classes/com/sun/java/swing/plaf/motif/resources/motif_de.properties index e7723574a6d..1d2cc250ed3 100644 --- a/jdk/src/share/classes/com/sun/java/swing/plaf/motif/resources/motif_de.properties +++ b/jdk/src/share/classes/com/sun/java/swing/plaf/motif/resources/motif_de.properties @@ -18,28 +18,23 @@ ############ FILE CHOOSER STRINGS ############# -FileChooser.acceptAllFileFilterText=* -FileChooser.cancelButtonText=Abbrechen -FileChooser.saveButtonText=Speichern -FileChooser.openButtonText=OK -FileChooser.saveDialogTitleText=Speichern -FileChooser.openDialogTitleText=\u00D6ffnen -FileChooser.updateButtonText=Aktualisieren -FileChooser.helpButtonText=Hilfe -FileChooser.pathLabelText=Pfad- oder Ordnernamen eingeben: -FileChooser.pathLabelMnemonic=80 -FileChooser.filterLabelText=Filter -FileChooser.filterLabelMnemonic=82 -FileChooser.foldersLabelText=Ordner -FileChooser.foldersLabelMnemonic=76 -FileChooser.filesLabelText=Dateien -FileChooser.filesLabelMnemonic=73 -FileChooser.enterFileNameLabelText=Dateinamen eingeben: -FileChooser.enterFileNameLabelMnemonic=78 -FileChooser.enterFolderNameLabelText=Ordnernamen eingeben: +FileChooser.acceptAllFileFilter.textAndMnemonic=* +FileChooser.cancelButton.textAndMnemonic=Abbrechen +FileChooser.saveButton.textAndMnemonic=Speichern +FileChooser.openButton.textAndMnemonic=OK +FileChooser.saveDialogTitle.textAndMnemonic=Speichern +FileChooser.openDialogTitle.textAndMnemonic=\u00D6ffnen +FileChooser.updateButton.textAndMnemonic=Aktualisieren +FileChooser.helpButton.textAndMnemonic=Hilfe +FileChooser.pathLabel.textAndMnemonic=&Pfad- oder Ordnernamen eingeben: +FileChooser.filterLabel.textAndMnemonic=Filte&r +FileChooser.foldersLabel.textAndMnemonic=Ordner(&L) +FileChooser.filesLabel.textAndMnemonic=Date&ien +FileChooser.enterFileNameLabel.textAndMnemonic=Datei&namen eingeben: +FileChooser.enterFolderNameLabel.textAndMnemonic=Ordnernamen eingeben: -FileChooser.cancelButtonToolTipText=Dialogfeld f\u00FCr Dateiauswahl schlie\u00DFen. -FileChooser.saveButtonToolTipText=Ausgew\u00E4hlte Datei speichern. -FileChooser.openButtonToolTipText=Ausgew\u00E4hlte Datei \u00F6ffnen. -FileChooser.updateButtonToolTipText=Verzeichnisliste aktualisieren. -FileChooser.helpButtonToolTipText=FileChooser-Hilfe. +FileChooser.cancelButtonToolTip.textAndMnemonic=Dialogfeld f\u00FCr Dateiauswahl schlie\u00DFen. +FileChooser.saveButtonToolTip.textAndMnemonic=Ausgew\u00E4hlte Datei speichern. +FileChooser.openButtonToolTip.textAndMnemonic=Ausgew\u00E4hlte Datei \u00F6ffnen. +FileChooser.updateButtonToolTip.textAndMnemonic=Verzeichnisliste aktualisieren. +FileChooser.helpButtonToolTip.textAndMnemonic=FileChooser-Hilfe. diff --git a/jdk/src/share/classes/com/sun/java/swing/plaf/motif/resources/motif_es.properties b/jdk/src/share/classes/com/sun/java/swing/plaf/motif/resources/motif_es.properties index 6d9aa8f16ba..2add8f218bb 100644 --- a/jdk/src/share/classes/com/sun/java/swing/plaf/motif/resources/motif_es.properties +++ b/jdk/src/share/classes/com/sun/java/swing/plaf/motif/resources/motif_es.properties @@ -18,28 +18,23 @@ ############ FILE CHOOSER STRINGS ############# -FileChooser.acceptAllFileFilterText=* -FileChooser.cancelButtonText=Cancelar -FileChooser.saveButtonText=Guardar -FileChooser.openButtonText=Aceptar -FileChooser.saveDialogTitleText=Guardar -FileChooser.openDialogTitleText=Abrir -FileChooser.updateButtonText=Actualizar -FileChooser.helpButtonText=Ayuda -FileChooser.pathLabelText=Introducir nombre de la ruta de acceso o carpeta: -FileChooser.pathLabelMnemonic=80 -FileChooser.filterLabelText=Filtro -FileChooser.filterLabelMnemonic=82 -FileChooser.foldersLabelText=Carpetas -FileChooser.foldersLabelMnemonic=76 -FileChooser.filesLabelText=Archivos -FileChooser.filesLabelMnemonic=73 -FileChooser.enterFileNameLabelText=Introducir nombre de archivo: -FileChooser.enterFileNameLabelMnemonic=78 -FileChooser.enterFolderNameLabelText=Introducir nombre de carpeta: +FileChooser.acceptAllFileFilter.textAndMnemonic=* +FileChooser.cancelButton.textAndMnemonic=Cancelar +FileChooser.saveButton.textAndMnemonic=Guardar +FileChooser.openButton.textAndMnemonic=Aceptar +FileChooser.saveDialogTitle.textAndMnemonic=Guardar +FileChooser.openDialogTitle.textAndMnemonic=Abrir +FileChooser.updateButton.textAndMnemonic=Actualizar +FileChooser.helpButton.textAndMnemonic=Ayuda +FileChooser.pathLabel.textAndMnemonic=Introducir nombre de la ruta de acceso o car&peta: +FileChooser.filterLabel.textAndMnemonic=Filt&ro +FileChooser.foldersLabel.textAndMnemonic=Carpetas(&L) +FileChooser.filesLabel.textAndMnemonic=Arch&ivos +FileChooser.enterFileNameLabel.textAndMnemonic=I&ntroducir nombre de archivo: +FileChooser.enterFolderNameLabel.textAndMnemonic=Introducir nombre de carpeta: -FileChooser.cancelButtonToolTipText=Abortar cuadro de di\u00E1logo del selector de archivos. -FileChooser.saveButtonToolTipText=Guardar archivo seleccionado. -FileChooser.openButtonToolTipText=Abrir archivo seleccionado. -FileChooser.updateButtonToolTipText=Actualizar lista de directorios. -FileChooser.helpButtonToolTipText=Ayuda del selector de archivos. +FileChooser.cancelButtonToolTip.textAndMnemonic=Abortar cuadro de di\u00E1logo del selector de archivos. +FileChooser.saveButtonToolTip.textAndMnemonic=Guardar archivo seleccionado. +FileChooser.openButtonToolTip.textAndMnemonic=Abrir archivo seleccionado. +FileChooser.updateButtonToolTip.textAndMnemonic=Actualizar lista de directorios. +FileChooser.helpButtonToolTip.textAndMnemonic=Ayuda del selector de archivos. diff --git a/jdk/src/share/classes/com/sun/java/swing/plaf/motif/resources/motif_fr.properties b/jdk/src/share/classes/com/sun/java/swing/plaf/motif/resources/motif_fr.properties index 392ecee5bd2..2d9f97885dd 100644 --- a/jdk/src/share/classes/com/sun/java/swing/plaf/motif/resources/motif_fr.properties +++ b/jdk/src/share/classes/com/sun/java/swing/plaf/motif/resources/motif_fr.properties @@ -18,28 +18,23 @@ ############ FILE CHOOSER STRINGS ############# -FileChooser.acceptAllFileFilterText=* -FileChooser.cancelButtonText=Annuler -FileChooser.saveButtonText=Enregistrer -FileChooser.openButtonText=OK -FileChooser.saveDialogTitleText=Enregistrer -FileChooser.openDialogTitleText=Ouvrir -FileChooser.updateButtonText=Mettre \u00E0 jour -FileChooser.helpButtonText=Aide -FileChooser.pathLabelText=Entrez le chemin ou le nom du dossier : -FileChooser.pathLabelMnemonic=80 -FileChooser.filterLabelText=Filtre -FileChooser.filterLabelMnemonic=82 -FileChooser.foldersLabelText=Dossiers -FileChooser.foldersLabelMnemonic=76 -FileChooser.filesLabelText=Fichiers -FileChooser.filesLabelMnemonic=73 -FileChooser.enterFileNameLabelText=Entrez le nom du fichier : -FileChooser.enterFileNameLabelMnemonic=78 -FileChooser.enterFolderNameLabelText=Entrez le nom du dossier : +FileChooser.acceptAllFileFilter.textAndMnemonic=* +FileChooser.cancelButton.textAndMnemonic=Annuler +FileChooser.saveButton.textAndMnemonic=Enregistrer +FileChooser.openButton.textAndMnemonic=OK +FileChooser.saveDialogTitle.textAndMnemonic=Enregistrer +FileChooser.openDialogTitle.textAndMnemonic=Ouvrir +FileChooser.updateButton.textAndMnemonic=Mettre \u00E0 jour +FileChooser.helpButton.textAndMnemonic=Aide +FileChooser.pathLabel.textAndMnemonic=Entrez le chemin ou le nom du dossier (&P): +FileChooser.filterLabel.textAndMnemonic=Filt&re +FileChooser.foldersLabel.textAndMnemonic=Dossiers(&L) +FileChooser.filesLabel.textAndMnemonic=F&ichiers +FileChooser.enterFileNameLabel.textAndMnemonic=E&ntrez le nom du fichier : +FileChooser.enterFolderNameLabel.textAndMnemonic=Entrez le nom du dossier : -FileChooser.cancelButtonToolTipText=Ferme la bo\u00EEte de dialogue du s\u00E9lecteur de fichiers. -FileChooser.saveButtonToolTipText=Enregistre le fichier s\u00E9lectionn\u00E9. -FileChooser.openButtonToolTipText=Ouvre le fichier s\u00E9lectionn\u00E9. -FileChooser.updateButtonToolTipText=Met \u00E0 jour la liste des r\u00E9pertoires. -FileChooser.helpButtonToolTipText=Aide du s\u00E9lecteur de fichiers +FileChooser.cancelButtonToolTip.textAndMnemonic=Ferme la bo\u00EEte de dialogue du s\u00E9lecteur de fichiers. +FileChooser.saveButtonToolTip.textAndMnemonic=Enregistre le fichier s\u00E9lectionn\u00E9. +FileChooser.openButtonToolTip.textAndMnemonic=Ouvre le fichier s\u00E9lectionn\u00E9. +FileChooser.updateButtonToolTip.textAndMnemonic=Met \u00E0 jour la liste des r\u00E9pertoires. +FileChooser.helpButtonToolTip.textAndMnemonic=Aide du s\u00E9lecteur de fichiers diff --git a/jdk/src/share/classes/com/sun/java/swing/plaf/motif/resources/motif_it.properties b/jdk/src/share/classes/com/sun/java/swing/plaf/motif/resources/motif_it.properties index 9763045aee2..352a9d708cf 100644 --- a/jdk/src/share/classes/com/sun/java/swing/plaf/motif/resources/motif_it.properties +++ b/jdk/src/share/classes/com/sun/java/swing/plaf/motif/resources/motif_it.properties @@ -18,28 +18,23 @@ ############ FILE CHOOSER STRINGS ############# -FileChooser.acceptAllFileFilterText=* -FileChooser.cancelButtonText=Annulla -FileChooser.saveButtonText=Salva -FileChooser.openButtonText=OK -FileChooser.saveDialogTitleText=Salva -FileChooser.openDialogTitleText=Apri -FileChooser.updateButtonText=Aggiorna -FileChooser.helpButtonText=? -FileChooser.pathLabelText=Percorso o nome cartella: -FileChooser.pathLabelMnemonic=80 -FileChooser.filterLabelText=Filtro -FileChooser.filterLabelMnemonic=82 -FileChooser.foldersLabelText=Cartelle -FileChooser.foldersLabelMnemonic=76 -FileChooser.filesLabelText=File -FileChooser.filesLabelMnemonic=73 -FileChooser.enterFileNameLabelText=Nome file: -FileChooser.enterFileNameLabelMnemonic=78 -FileChooser.enterFolderNameLabelText=Nome cartella: +FileChooser.acceptAllFileFilter.textAndMnemonic=* +FileChooser.cancelButton.textAndMnemonic=Annulla +FileChooser.saveButton.textAndMnemonic=Salva +FileChooser.openButton.textAndMnemonic=OK +FileChooser.saveDialogTitle.textAndMnemonic=Salva +FileChooser.openDialogTitle.textAndMnemonic=Apri +FileChooser.updateButton.textAndMnemonic=Aggiorna +FileChooser.helpButton.textAndMnemonic=? +FileChooser.pathLabel.textAndMnemonic=&Percorso o nome cartella: +FileChooser.filterLabel.textAndMnemonic=Filt&ro +FileChooser.foldersLabel.textAndMnemonic=Carte&lle +FileChooser.filesLabel.textAndMnemonic=F&ile +FileChooser.enterFileNameLabel.textAndMnemonic=&Nome file: +FileChooser.enterFolderNameLabel.textAndMnemonic=Nome cartella: -FileChooser.cancelButtonToolTipText=Chiude la finestra di dialogo di selezione file. -FileChooser.saveButtonToolTipText=Salva il file selezionato. -FileChooser.openButtonToolTipText=Apre il file selezionato. -FileChooser.updateButtonToolTipText=Aggiorna lista directory. -FileChooser.helpButtonToolTipText=Guida FileChooser. +FileChooser.cancelButtonToolTip.textAndMnemonic=Chiude la finestra di dialogo di selezione file. +FileChooser.saveButtonToolTip.textAndMnemonic=Salva il file selezionato. +FileChooser.openButtonToolTip.textAndMnemonic=Apre il file selezionato. +FileChooser.updateButtonToolTip.textAndMnemonic=Aggiorna lista directory. +FileChooser.helpButtonToolTip.textAndMnemonic=Guida FileChooser. diff --git a/jdk/src/share/classes/com/sun/java/swing/plaf/motif/resources/motif_ja.properties b/jdk/src/share/classes/com/sun/java/swing/plaf/motif/resources/motif_ja.properties index 97b505b5741..9b28788a645 100644 --- a/jdk/src/share/classes/com/sun/java/swing/plaf/motif/resources/motif_ja.properties +++ b/jdk/src/share/classes/com/sun/java/swing/plaf/motif/resources/motif_ja.properties @@ -18,28 +18,23 @@ ############ FILE CHOOSER STRINGS ############# -FileChooser.acceptAllFileFilterText=* -FileChooser.cancelButtonText=\u53D6\u6D88 -FileChooser.saveButtonText=\u4FDD\u5B58 -FileChooser.openButtonText=OK -FileChooser.saveDialogTitleText=\u4FDD\u5B58 -FileChooser.openDialogTitleText=\u958B\u304F -FileChooser.updateButtonText=\u66F4\u65B0 -FileChooser.helpButtonText=\u30D8\u30EB\u30D7 -FileChooser.pathLabelText=\u30D1\u30B9\u307E\u305F\u306F\u30D5\u30A9\u30EB\u30C0\u540D\u3092\u5165\u529B: -FileChooser.pathLabelMnemonic=80 -FileChooser.filterLabelText=\u30D5\u30A3\u30EB\u30BF -FileChooser.filterLabelMnemonic=82 -FileChooser.foldersLabelText=\u30D5\u30A9\u30EB\u30C0 -FileChooser.foldersLabelMnemonic=76 -FileChooser.filesLabelText=\u30D5\u30A1\u30A4\u30EB -FileChooser.filesLabelMnemonic=73 -FileChooser.enterFileNameLabelText=\u30D5\u30A1\u30A4\u30EB\u540D\u3092\u5165\u529B: -FileChooser.enterFileNameLabelMnemonic=78 -FileChooser.enterFolderNameLabelText=\u30D5\u30A9\u30EB\u30C0\u540D\u3092\u5165\u529B: +FileChooser.acceptAllFileFilter.textAndMnemonic=* +FileChooser.cancelButton.textAndMnemonic=\u53D6\u6D88 +FileChooser.saveButton.textAndMnemonic=\u4FDD\u5B58 +FileChooser.openButton.textAndMnemonic=OK +FileChooser.saveDialogTitle.textAndMnemonic=\u4FDD\u5B58 +FileChooser.openDialogTitle.textAndMnemonic=\u958B\u304F +FileChooser.updateButton.textAndMnemonic=\u66F4\u65B0 +FileChooser.helpButton.textAndMnemonic=\u30D8\u30EB\u30D7 +FileChooser.pathLabel.textAndMnemonic=\u30D1\u30B9\u307E\u305F\u306F\u30D5\u30A9\u30EB\u30C0\u540D\u3092\u5165\u529B(&P): +FileChooser.filterLabel.textAndMnemonic=\u30D5\u30A3\u30EB\u30BF(&R) +FileChooser.foldersLabel.textAndMnemonic=\u30D5\u30A9\u30EB\u30C0(&L) +FileChooser.filesLabel.textAndMnemonic=\u30D5\u30A1\u30A4\u30EB(&I) +FileChooser.enterFileNameLabel.textAndMnemonic=\u30D5\u30A1\u30A4\u30EB\u540D\u3092\u5165\u529B(&N): +FileChooser.enterFolderNameLabel.textAndMnemonic=\u30D5\u30A9\u30EB\u30C0\u540D\u3092\u5165\u529B: -FileChooser.cancelButtonToolTipText=\u30D5\u30A1\u30A4\u30EB\u30FB\u30C1\u30E5\u30FC\u30B6\u30FB\u30C0\u30A4\u30A2\u30ED\u30B0\u3092\u7D42\u4E86\u3057\u307E\u3059\u3002 -FileChooser.saveButtonToolTipText=\u9078\u629E\u3057\u305F\u30D5\u30A1\u30A4\u30EB\u3092\u4FDD\u5B58\u3057\u307E\u3059\u3002 -FileChooser.openButtonToolTipText=\u9078\u629E\u3057\u305F\u30D5\u30A1\u30A4\u30EB\u3092\u958B\u304D\u307E\u3059\u3002 -FileChooser.updateButtonToolTipText=\u30C7\u30A3\u30EC\u30AF\u30C8\u30EA\u306E\u30EA\u30B9\u30C8\u3092\u66F4\u65B0\u3057\u307E\u3059\u3002 -FileChooser.helpButtonToolTipText=FileChooser\u306E\u30D8\u30EB\u30D7\u3067\u3059\u3002 +FileChooser.cancelButtonToolTip.textAndMnemonic=\u30D5\u30A1\u30A4\u30EB\u30FB\u30C1\u30E5\u30FC\u30B6\u30FB\u30C0\u30A4\u30A2\u30ED\u30B0\u3092\u7D42\u4E86\u3057\u307E\u3059\u3002 +FileChooser.saveButtonToolTip.textAndMnemonic=\u9078\u629E\u3057\u305F\u30D5\u30A1\u30A4\u30EB\u3092\u4FDD\u5B58\u3057\u307E\u3059\u3002 +FileChooser.openButtonToolTip.textAndMnemonic=\u9078\u629E\u3057\u305F\u30D5\u30A1\u30A4\u30EB\u3092\u958B\u304D\u307E\u3059\u3002 +FileChooser.updateButtonToolTip.textAndMnemonic=\u30C7\u30A3\u30EC\u30AF\u30C8\u30EA\u306E\u30EA\u30B9\u30C8\u3092\u66F4\u65B0\u3057\u307E\u3059\u3002 +FileChooser.helpButtonToolTip.textAndMnemonic=FileChooser\u306E\u30D8\u30EB\u30D7\u3067\u3059\u3002 diff --git a/jdk/src/share/classes/com/sun/java/swing/plaf/motif/resources/motif_ko.properties b/jdk/src/share/classes/com/sun/java/swing/plaf/motif/resources/motif_ko.properties index 61c06c6949d..f7e2625e9c9 100644 --- a/jdk/src/share/classes/com/sun/java/swing/plaf/motif/resources/motif_ko.properties +++ b/jdk/src/share/classes/com/sun/java/swing/plaf/motif/resources/motif_ko.properties @@ -18,28 +18,23 @@ ############ FILE CHOOSER STRINGS ############# -FileChooser.acceptAllFileFilterText=* -FileChooser.cancelButtonText=\uCDE8\uC18C -FileChooser.saveButtonText=\uC800\uC7A5 -FileChooser.openButtonText=\uD655\uC778 -FileChooser.saveDialogTitleText=\uC800\uC7A5 -FileChooser.openDialogTitleText=\uC5F4\uAE30 -FileChooser.updateButtonText=\uAC31\uC2E0 -FileChooser.helpButtonText=\uB3C4\uC6C0\uB9D0 -FileChooser.pathLabelText=\uACBD\uB85C \uB610\uB294 \uD3F4\uB354 \uC774\uB984 \uC785\uB825: -FileChooser.pathLabelMnemonic=80 -FileChooser.filterLabelText=\uD544\uD130 -FileChooser.filterLabelMnemonic=82 -FileChooser.foldersLabelText=\uD3F4\uB354 -FileChooser.foldersLabelMnemonic=76 -FileChooser.filesLabelText=\uD30C\uC77C -FileChooser.filesLabelMnemonic=73 -FileChooser.enterFileNameLabelText=\uD30C\uC77C \uC774\uB984 \uC785\uB825: -FileChooser.enterFileNameLabelMnemonic=78 -FileChooser.enterFolderNameLabelText=\uD3F4\uB354 \uC774\uB984 \uC785\uB825: +FileChooser.acceptAllFileFilter.textAndMnemonic=* +FileChooser.cancelButton.textAndMnemonic=\uCDE8\uC18C +FileChooser.saveButton.textAndMnemonic=\uC800\uC7A5 +FileChooser.openButton.textAndMnemonic=\uD655\uC778 +FileChooser.saveDialogTitle.textAndMnemonic=\uC800\uC7A5 +FileChooser.openDialogTitle.textAndMnemonic=\uC5F4\uAE30 +FileChooser.updateButton.textAndMnemonic=\uAC31\uC2E0 +FileChooser.helpButton.textAndMnemonic=\uB3C4\uC6C0\uB9D0 +FileChooser.pathLabel.textAndMnemonic=\uACBD\uB85C \uB610\uB294 \uD3F4\uB354 \uC774\uB984 \uC785\uB825(&P): +FileChooser.filterLabel.textAndMnemonic=\uD544\uD130(&R) +FileChooser.foldersLabel.textAndMnemonic=\uD3F4\uB354(&L) +FileChooser.filesLabel.textAndMnemonic=\uD30C\uC77C(&I) +FileChooser.enterFileNameLabel.textAndMnemonic=\uD30C\uC77C \uC774\uB984 \uC785\uB825(&N): +FileChooser.enterFolderNameLabel.textAndMnemonic=\uD3F4\uB354 \uC774\uB984 \uC785\uB825: -FileChooser.cancelButtonToolTipText=\uD30C\uC77C \uC120\uD0DD\uAE30 \uB300\uD654\uC0C1\uC790\uB97C \uC911\uB2E8\uD569\uB2C8\uB2E4. -FileChooser.saveButtonToolTipText=\uC120\uD0DD\uB41C \uD30C\uC77C\uC744 \uC800\uC7A5\uD569\uB2C8\uB2E4. -FileChooser.openButtonToolTipText=\uC120\uD0DD\uB41C \uD30C\uC77C\uC744 \uC5FD\uB2C8\uB2E4. -FileChooser.updateButtonToolTipText=\uB514\uB809\uD1A0\uB9AC \uBAA9\uB85D\uC744 \uAC31\uC2E0\uD569\uB2C8\uB2E4. -FileChooser.helpButtonToolTipText=FileChooser \uB3C4\uC6C0\uB9D0\uC785\uB2C8\uB2E4. +FileChooser.cancelButtonToolTip.textAndMnemonic=\uD30C\uC77C \uC120\uD0DD\uAE30 \uB300\uD654\uC0C1\uC790\uB97C \uC911\uB2E8\uD569\uB2C8\uB2E4. +FileChooser.saveButtonToolTip.textAndMnemonic=\uC120\uD0DD\uB41C \uD30C\uC77C\uC744 \uC800\uC7A5\uD569\uB2C8\uB2E4. +FileChooser.openButtonToolTip.textAndMnemonic=\uC120\uD0DD\uB41C \uD30C\uC77C\uC744 \uC5FD\uB2C8\uB2E4. +FileChooser.updateButtonToolTip.textAndMnemonic=\uB514\uB809\uD1A0\uB9AC \uBAA9\uB85D\uC744 \uAC31\uC2E0\uD569\uB2C8\uB2E4. +FileChooser.helpButtonToolTip.textAndMnemonic=FileChooser \uB3C4\uC6C0\uB9D0\uC785\uB2C8\uB2E4. diff --git a/jdk/src/share/classes/com/sun/java/swing/plaf/motif/resources/motif_pt_BR.properties b/jdk/src/share/classes/com/sun/java/swing/plaf/motif/resources/motif_pt_BR.properties index 6e40ef51c06..a1af5396196 100644 --- a/jdk/src/share/classes/com/sun/java/swing/plaf/motif/resources/motif_pt_BR.properties +++ b/jdk/src/share/classes/com/sun/java/swing/plaf/motif/resources/motif_pt_BR.properties @@ -18,28 +18,23 @@ ############ FILE CHOOSER STRINGS ############# -FileChooser.acceptAllFileFilterText=* -FileChooser.cancelButtonText=Cancelar -FileChooser.saveButtonText=Salvar -FileChooser.openButtonText=OK -FileChooser.saveDialogTitleText=Salvar -FileChooser.openDialogTitleText=Abrir -FileChooser.updateButtonText=Atualizar -FileChooser.helpButtonText=Ajuda -FileChooser.pathLabelText=Informar caminho ou nome da pasta: -FileChooser.pathLabelMnemonic=80 -FileChooser.filterLabelText=Filtro -FileChooser.filterLabelMnemonic=82 -FileChooser.foldersLabelText=Pastas -FileChooser.foldersLabelMnemonic=76 -FileChooser.filesLabelText=Arquivos -FileChooser.filesLabelMnemonic=73 -FileChooser.enterFileNameLabelText=Informar nome do arquivo: -FileChooser.enterFileNameLabelMnemonic=78 -FileChooser.enterFolderNameLabelText=Informar nome da pasta: +FileChooser.acceptAllFileFilter.textAndMnemonic=* +FileChooser.cancelButton.textAndMnemonic=Cancelar +FileChooser.saveButton.textAndMnemonic=Salvar +FileChooser.openButton.textAndMnemonic=OK +FileChooser.saveDialogTitle.textAndMnemonic=Salvar +FileChooser.openDialogTitle.textAndMnemonic=Abrir +FileChooser.updateButton.textAndMnemonic=Atualizar +FileChooser.helpButton.textAndMnemonic=Ajuda +FileChooser.pathLabel.textAndMnemonic=Informar caminho ou nome da &pasta: +FileChooser.filterLabel.textAndMnemonic=Filt&ro +FileChooser.foldersLabel.textAndMnemonic=Pastas(&L) +FileChooser.filesLabel.textAndMnemonic=Arqu&ivos +FileChooser.enterFileNameLabel.textAndMnemonic=I&nformar nome do arquivo: +FileChooser.enterFolderNameLabel.textAndMnemonic=Informar nome da pasta: -FileChooser.cancelButtonToolTipText=Abortar caixa de di\u00E1logo do seletor de arquivos. -FileChooser.saveButtonToolTipText=Salvar arquivo selecionado. -FileChooser.openButtonToolTipText=Abrir arquivo selecionado. -FileChooser.updateButtonToolTipText=Atualizar lista de diret\u00F3rios. -FileChooser.helpButtonToolTipText=Ajuda do FileChooser. +FileChooser.cancelButtonToolTip.textAndMnemonic=Abortar caixa de di\u00E1logo do seletor de arquivos. +FileChooser.saveButtonToolTip.textAndMnemonic=Salvar arquivo selecionado. +FileChooser.openButtonToolTip.textAndMnemonic=Abrir arquivo selecionado. +FileChooser.updateButtonToolTip.textAndMnemonic=Atualizar lista de diret\u00F3rios. +FileChooser.helpButtonToolTip.textAndMnemonic=Ajuda do FileChooser. diff --git a/jdk/src/share/classes/com/sun/java/swing/plaf/motif/resources/motif_sv.properties b/jdk/src/share/classes/com/sun/java/swing/plaf/motif/resources/motif_sv.properties index 4cd736baa9d..3592f4dca7e 100644 --- a/jdk/src/share/classes/com/sun/java/swing/plaf/motif/resources/motif_sv.properties +++ b/jdk/src/share/classes/com/sun/java/swing/plaf/motif/resources/motif_sv.properties @@ -18,28 +18,23 @@ ############ FILE CHOOSER STRINGS ############# -FileChooser.acceptAllFileFilterText=* -FileChooser.cancelButtonText=Avbryt -FileChooser.saveButtonText=Spara -FileChooser.openButtonText=OK -FileChooser.saveDialogTitleText=Spara -FileChooser.openDialogTitleText=\u00D6ppna -FileChooser.updateButtonText=Uppdatera -FileChooser.helpButtonText=Hj\u00E4lp -FileChooser.pathLabelText=Ange s\u00F6kv\u00E4g eller mappnamn: -FileChooser.pathLabelMnemonic=80 -FileChooser.filterLabelText=Filter -FileChooser.filterLabelMnemonic=82 -FileChooser.foldersLabelText=Mappar -FileChooser.foldersLabelMnemonic=76 -FileChooser.filesLabelText=Filer -FileChooser.filesLabelMnemonic=73 -FileChooser.enterFileNameLabelText=Ange filnamn: -FileChooser.enterFileNameLabelMnemonic=78 -FileChooser.enterFolderNameLabelText=Ange ett mappnamn: +FileChooser.acceptAllFileFilter.textAndMnemonic=* +FileChooser.cancelButton.textAndMnemonic=Avbryt +FileChooser.saveButton.textAndMnemonic=Spara +FileChooser.openButton.textAndMnemonic=OK +FileChooser.saveDialogTitle.textAndMnemonic=Spara +FileChooser.openDialogTitle.textAndMnemonic=\u00D6ppna +FileChooser.updateButton.textAndMnemonic=Uppdatera +FileChooser.helpButton.textAndMnemonic=Hj\u00E4lp +FileChooser.pathLabel.textAndMnemonic=Ange s\u00F6kv\u00E4g eller mappnamn(&P): +FileChooser.filterLabel.textAndMnemonic=Filte&r +FileChooser.foldersLabel.textAndMnemonic=Mappar(&L) +FileChooser.filesLabel.textAndMnemonic=F&iler +FileChooser.enterFileNameLabel.textAndMnemonic=A&nge filnamn: +FileChooser.enterFolderNameLabel.textAndMnemonic=Ange ett mappnamn: -FileChooser.cancelButtonToolTipText=Avbryt dialogrutan Filv\u00E4ljare. -FileChooser.saveButtonToolTipText=Spara vald fil. -FileChooser.openButtonToolTipText=\u00D6ppna vald fil. -FileChooser.updateButtonToolTipText=Uppdatera kataloglistan. -FileChooser.helpButtonToolTipText=Hj\u00E4lp - Filv\u00E4ljare. +FileChooser.cancelButtonToolTip.textAndMnemonic=Avbryt dialogrutan Filv\u00E4ljare. +FileChooser.saveButtonToolTip.textAndMnemonic=Spara vald fil. +FileChooser.openButtonToolTip.textAndMnemonic=\u00D6ppna vald fil. +FileChooser.updateButtonToolTip.textAndMnemonic=Uppdatera kataloglistan. +FileChooser.helpButtonToolTip.textAndMnemonic=Hj\u00E4lp - Filv\u00E4ljare. diff --git a/jdk/src/share/classes/com/sun/java/swing/plaf/motif/resources/motif_zh_CN.properties b/jdk/src/share/classes/com/sun/java/swing/plaf/motif/resources/motif_zh_CN.properties index 121fe60a8ff..c2c1ecdfc9f 100644 --- a/jdk/src/share/classes/com/sun/java/swing/plaf/motif/resources/motif_zh_CN.properties +++ b/jdk/src/share/classes/com/sun/java/swing/plaf/motif/resources/motif_zh_CN.properties @@ -18,28 +18,23 @@ ############ FILE CHOOSER STRINGS ############# -FileChooser.acceptAllFileFilterText=* -FileChooser.cancelButtonText=\u53D6\u6D88 -FileChooser.saveButtonText=\u4FDD\u5B58 -FileChooser.openButtonText=\u786E\u5B9A -FileChooser.saveDialogTitleText=\u4FDD\u5B58 -FileChooser.openDialogTitleText=\u6253\u5F00 -FileChooser.updateButtonText=\u66F4\u65B0 -FileChooser.helpButtonText=\u5E2E\u52A9 -FileChooser.pathLabelText=\u952E\u5165\u8DEF\u5F84\u6216\u6587\u4EF6\u5939\u540D: -FileChooser.pathLabelMnemonic=80 -FileChooser.filterLabelText=\u7B5B\u9009\u5668 -FileChooser.filterLabelMnemonic=82 -FileChooser.foldersLabelText=\u6587\u4EF6\u5939 -FileChooser.foldersLabelMnemonic=76 -FileChooser.filesLabelText=\u6587\u4EF6 -FileChooser.filesLabelMnemonic=73 -FileChooser.enterFileNameLabelText=\u952E\u5165\u6587\u4EF6\u540D: -FileChooser.enterFileNameLabelMnemonic=78 -FileChooser.enterFolderNameLabelText=\u8F93\u5165\u6587\u4EF6\u5939\u540D: +FileChooser.acceptAllFileFilter.textAndMnemonic=* +FileChooser.cancelButton.textAndMnemonic=\u53D6\u6D88 +FileChooser.saveButton.textAndMnemonic=\u4FDD\u5B58 +FileChooser.openButton.textAndMnemonic=\u786E\u5B9A +FileChooser.saveDialogTitle.textAndMnemonic=\u4FDD\u5B58 +FileChooser.openDialogTitle.textAndMnemonic=\u6253\u5F00 +FileChooser.updateButton.textAndMnemonic=\u66F4\u65B0 +FileChooser.helpButton.textAndMnemonic=\u5E2E\u52A9 +FileChooser.pathLabel.textAndMnemonic=\u952E\u5165\u8DEF\u5F84\u6216\u6587\u4EF6\u5939\u540D: (&P) +FileChooser.filterLabel.textAndMnemonic=\u7B5B\u9009\u5668(&R) +FileChooser.foldersLabel.textAndMnemonic=\u6587\u4EF6\u5939(&L) +FileChooser.filesLabel.textAndMnemonic=\u6587\u4EF6(&I) +FileChooser.enterFileNameLabel.textAndMnemonic=\u952E\u5165\u6587\u4EF6\u540D: (&N) +FileChooser.enterFolderNameLabel.textAndMnemonic=\u8F93\u5165\u6587\u4EF6\u5939\u540D: -FileChooser.cancelButtonToolTipText=\u4E2D\u6B62\u6587\u4EF6\u9009\u62E9\u5668\u5BF9\u8BDD\u6846\u3002 -FileChooser.saveButtonToolTipText=\u4FDD\u5B58\u6240\u9009\u6587\u4EF6\u3002 -FileChooser.openButtonToolTipText=\u6253\u5F00\u6240\u9009\u6587\u4EF6\u3002 -FileChooser.updateButtonToolTipText=\u66F4\u65B0\u76EE\u5F55\u5217\u8868\u3002 -FileChooser.helpButtonToolTipText=FileChooser \u5E2E\u52A9\u3002 +FileChooser.cancelButtonToolTip.textAndMnemonic=\u4E2D\u6B62\u6587\u4EF6\u9009\u62E9\u5668\u5BF9\u8BDD\u6846\u3002 +FileChooser.saveButtonToolTip.textAndMnemonic=\u4FDD\u5B58\u6240\u9009\u6587\u4EF6\u3002 +FileChooser.openButtonToolTip.textAndMnemonic=\u6253\u5F00\u6240\u9009\u6587\u4EF6\u3002 +FileChooser.updateButtonToolTip.textAndMnemonic=\u66F4\u65B0\u76EE\u5F55\u5217\u8868\u3002 +FileChooser.helpButtonToolTip.textAndMnemonic=FileChooser \u5E2E\u52A9\u3002 diff --git a/jdk/src/share/classes/com/sun/java/swing/plaf/motif/resources/motif_zh_TW.properties b/jdk/src/share/classes/com/sun/java/swing/plaf/motif/resources/motif_zh_TW.properties index 1b2d9d76c4b..6e77bbaf126 100644 --- a/jdk/src/share/classes/com/sun/java/swing/plaf/motif/resources/motif_zh_TW.properties +++ b/jdk/src/share/classes/com/sun/java/swing/plaf/motif/resources/motif_zh_TW.properties @@ -18,28 +18,23 @@ ############ FILE CHOOSER STRINGS ############# -FileChooser.acceptAllFileFilterText=* -FileChooser.cancelButtonText=\u53D6\u6D88 -FileChooser.saveButtonText=\u5132\u5B58 -FileChooser.openButtonText=\u78BA\u5B9A -FileChooser.saveDialogTitleText=\u5132\u5B58 -FileChooser.openDialogTitleText=\u958B\u555F -FileChooser.updateButtonText=\u66F4\u65B0 -FileChooser.helpButtonText=\u8AAA\u660E -FileChooser.pathLabelText=\u8F38\u5165\u8DEF\u5F91\u6216\u8CC7\u6599\u593E\u540D\u7A31: -FileChooser.pathLabelMnemonic=80 -FileChooser.filterLabelText=\u7BE9\u9078 -FileChooser.filterLabelMnemonic=82 -FileChooser.foldersLabelText=\u8CC7\u6599\u593E -FileChooser.foldersLabelMnemonic=76 -FileChooser.filesLabelText=\u6A94\u6848 -FileChooser.filesLabelMnemonic=73 -FileChooser.enterFileNameLabelText=\u8F38\u5165\u6A94\u6848\u540D\u7A31: -FileChooser.enterFileNameLabelMnemonic=78 -FileChooser.enterFolderNameLabelText=\u8F38\u5165\u8CC7\u6599\u593E\u540D\u7A31: +FileChooser.acceptAllFileFilter.textAndMnemonic=* +FileChooser.cancelButton.textAndMnemonic=\u53D6\u6D88 +FileChooser.saveButton.textAndMnemonic=\u5132\u5B58 +FileChooser.openButton.textAndMnemonic=\u78BA\u5B9A +FileChooser.saveDialogTitle.textAndMnemonic=\u5132\u5B58 +FileChooser.openDialogTitle.textAndMnemonic=\u958B\u555F +FileChooser.updateButton.textAndMnemonic=\u66F4\u65B0 +FileChooser.helpButton.textAndMnemonic=\u8AAA\u660E +FileChooser.pathLabel.textAndMnemonic=\u8F38\u5165\u8DEF\u5F91\u6216\u8CC7\u6599\u593E\u540D\u7A31(&P): +FileChooser.filterLabel.textAndMnemonic=\u7BE9\u9078(&R) +FileChooser.foldersLabel.textAndMnemonic=\u8CC7\u6599\u593E(&L) +FileChooser.filesLabel.textAndMnemonic=\u6A94\u6848(&I) +FileChooser.enterFileNameLabel.textAndMnemonic=\u8F38\u5165\u6A94\u6848\u540D\u7A31(&N): +FileChooser.enterFolderNameLabel.textAndMnemonic=\u8F38\u5165\u8CC7\u6599\u593E\u540D\u7A31: -FileChooser.cancelButtonToolTipText=\u4E2D\u6B62\u6A94\u6848\u9078\u64C7\u5668\u5C0D\u8A71\u65B9\u584A\u3002 -FileChooser.saveButtonToolTipText=\u5132\u5B58\u9078\u53D6\u7684\u6A94\u6848\u3002 -FileChooser.openButtonToolTipText=\u958B\u555F\u9078\u53D6\u7684\u6A94\u6848\u3002 -FileChooser.updateButtonToolTipText=\u66F4\u65B0\u76EE\u9304\u6E05\u55AE\u3002 -FileChooser.helpButtonToolTipText=\u300C\u6A94\u6848\u9078\u64C7\u5668\u300D\u8AAA\u660E\u3002 +FileChooser.cancelButtonToolTip.textAndMnemonic=\u4E2D\u6B62\u6A94\u6848\u9078\u64C7\u5668\u5C0D\u8A71\u65B9\u584A\u3002 +FileChooser.saveButtonToolTip.textAndMnemonic=\u5132\u5B58\u9078\u53D6\u7684\u6A94\u6848\u3002 +FileChooser.openButtonToolTip.textAndMnemonic=\u958B\u555F\u9078\u53D6\u7684\u6A94\u6848\u3002 +FileChooser.updateButtonToolTip.textAndMnemonic=\u66F4\u65B0\u76EE\u9304\u6E05\u55AE\u3002 +FileChooser.helpButtonToolTip.textAndMnemonic=\u300C\u6A94\u6848\u9078\u64C7\u5668\u300D\u8AAA\u660E\u3002 diff --git a/jdk/src/share/classes/com/sun/java/swing/plaf/windows/resources/windows.properties b/jdk/src/share/classes/com/sun/java/swing/plaf/windows/resources/windows.properties index 0f27244f37a..7f36db65a47 100644 --- a/jdk/src/share/classes/com/sun/java/swing/plaf/windows/resources/windows.properties +++ b/jdk/src/share/classes/com/sun/java/swing/plaf/windows/resources/windows.properties @@ -18,34 +18,30 @@ ############ FILE CHOOSER STRINGS ############# -FileChooser.lookInLabelText=Look in: -FileChooser.lookInLabelMnemonic=73 -FileChooser.saveInLabelText=Save in: -FileChooser.fileNameLabelText=File name: -FileChooser.fileNameLabelMnemonic=78 -FileChooser.folderNameLabelText=Folder name: -FileChooser.folderNameLabelMnemonic=78 -FileChooser.filesOfTypeLabelText=Files of type: -FileChooser.filesOfTypeLabelMnemonic=84 -FileChooser.upFolderToolTipText=Up One Level +FileChooser.lookInLabel.textAndMnemonic=Look &in: +FileChooser.saveInLabel.textAndMnemonic=Save in: +FileChooser.fileNameLabel.textAndMnemonic=File &name: +FileChooser.folderNameLabel.textAndMnemonic=Folder &name: +FileChooser.filesOfTypeLabel.textAndMnemonic=Files of &type: +FileChooser.upFolderToolTip.textAndMnemonic=Up One Level FileChooser.upFolderAccessibleName=Up -FileChooser.homeFolderToolTipText=Home +FileChooser.homeFolderToolTip.textAndMnemonic=Home FileChooser.homeFolderAccessibleName=Home -FileChooser.newFolderToolTipText=Create New Folder +FileChooser.newFolderToolTip.textAndMnemonic=Create New Folder FileChooser.newFolderAccessibleName=New Folder -FileChooser.newFolderActionLabelText=New Folder -FileChooser.listViewButtonToolTipText=List +FileChooser.newFolderActionLabel.textAndMnemonic=New Folder +FileChooser.listViewButtonToolTip.textAndMnemonic=List FileChooser.listViewButtonAccessibleName=List -FileChooser.listViewActionLabelText=List -FileChooser.detailsViewButtonToolTipText=Details +FileChooser.listViewActionLabel.textAndMnemonic=List +FileChooser.detailsViewButtonToolTip.textAndMnemonic=Details FileChooser.detailsViewButtonAccessibleName=Details FileChooser.viewMenuButtonToolTipText = View Menu FileChooser.viewMenuButtonAccessibleName = View Menu -FileChooser.detailsViewActionLabelText=Details -FileChooser.refreshActionLabelText=Refresh -FileChooser.viewMenuLabelText=View -FileChooser.fileNameHeaderText=Name -FileChooser.fileSizeHeaderText=Size -FileChooser.fileTypeHeaderText=Type -FileChooser.fileDateHeaderText=Modified -FileChooser.fileAttrHeaderText=Attributes +FileChooser.detailsViewActionLabel.textAndMnemonic=Details +FileChooser.refreshActionLabel.textAndMnemonic=Refresh +FileChooser.viewMenuLabel.textAndMnemonic=View +FileChooser.fileNameHeader.textAndMnemonic=Name +FileChooser.fileSizeHeader.textAndMnemonic=Size +FileChooser.fileTypeHeader.textAndMnemonic=Type +FileChooser.fileDateHeader.textAndMnemonic=Modified +FileChooser.fileAttrHeader.textAndMnemonic=Attributes diff --git a/jdk/src/share/classes/com/sun/java/swing/plaf/windows/resources/windows_de.properties b/jdk/src/share/classes/com/sun/java/swing/plaf/windows/resources/windows_de.properties index b9d8c341f47..0fb04994737 100644 --- a/jdk/src/share/classes/com/sun/java/swing/plaf/windows/resources/windows_de.properties +++ b/jdk/src/share/classes/com/sun/java/swing/plaf/windows/resources/windows_de.properties @@ -18,34 +18,30 @@ ############ FILE CHOOSER STRINGS ############# -FileChooser.lookInLabelText=Suchen in: -FileChooser.lookInLabelMnemonic=73 -FileChooser.saveInLabelText=Speichern in: -FileChooser.fileNameLabelText=Dateiname: -FileChooser.fileNameLabelMnemonic=78 -FileChooser.folderNameLabelText=Ordnername: -FileChooser.folderNameLabelMnemonic=78 -FileChooser.filesOfTypeLabelText=Dateityp: -FileChooser.filesOfTypeLabelMnemonic=84 -FileChooser.upFolderToolTipText=Eine Ebene h\u00F6her +FileChooser.lookInLabel.textAndMnemonic=Suchen &in: +FileChooser.saveInLabel.textAndMnemonic=Speichern in: +FileChooser.fileNameLabel.textAndMnemonic=Datei&name: +FileChooser.folderNameLabel.textAndMnemonic=Ord&nername: +FileChooser.filesOfTypeLabel.textAndMnemonic=Da&teityp: +FileChooser.upFolderToolTip.textAndMnemonic=Eine Ebene h\u00F6her FileChooser.upFolderAccessibleName=Nach oben -FileChooser.homeFolderToolTipText=Home +FileChooser.homeFolderToolTip.textAndMnemonic=Home FileChooser.homeFolderAccessibleName=Home -FileChooser.newFolderToolTipText=Neuen Ordner erstellen +FileChooser.newFolderToolTip.textAndMnemonic=Neuen Ordner erstellen FileChooser.newFolderAccessibleName=Neuer Ordner -FileChooser.newFolderActionLabelText=Neuer Ordner -FileChooser.listViewButtonToolTipText=Liste +FileChooser.newFolderActionLabel.textAndMnemonic=Neuer Ordner +FileChooser.listViewButtonToolTip.textAndMnemonic=Liste FileChooser.listViewButtonAccessibleName=Liste -FileChooser.listViewActionLabelText=Liste -FileChooser.detailsViewButtonToolTipText=Details +FileChooser.listViewActionLabel.textAndMnemonic=Liste +FileChooser.detailsViewButtonToolTip.textAndMnemonic=Details FileChooser.detailsViewButtonAccessibleName=Details FileChooser.viewMenuButtonToolTipText = Ansichtsmen\u00FC FileChooser.viewMenuButtonAccessibleName = Ansichtsmen\u00FC -FileChooser.detailsViewActionLabelText=Details -FileChooser.refreshActionLabelText=Aktualisieren -FileChooser.viewMenuLabelText=Ansicht -FileChooser.fileNameHeaderText=Name -FileChooser.fileSizeHeaderText=Gr\u00F6\u00DFe -FileChooser.fileTypeHeaderText=Typ -FileChooser.fileDateHeaderText=Ge\u00E4ndert -FileChooser.fileAttrHeaderText=Attribute +FileChooser.detailsViewActionLabel.textAndMnemonic=Details +FileChooser.refreshActionLabel.textAndMnemonic=Aktualisieren +FileChooser.viewMenuLabel.textAndMnemonic=Ansicht +FileChooser.fileNameHeader.textAndMnemonic=Name +FileChooser.fileSizeHeader.textAndMnemonic=Gr\u00F6\u00DFe +FileChooser.fileTypeHeader.textAndMnemonic=Typ +FileChooser.fileDateHeader.textAndMnemonic=Ge\u00E4ndert +FileChooser.fileAttrHeader.textAndMnemonic=Attribute diff --git a/jdk/src/share/classes/com/sun/java/swing/plaf/windows/resources/windows_es.properties b/jdk/src/share/classes/com/sun/java/swing/plaf/windows/resources/windows_es.properties index d7b610e746d..4e68630f090 100644 --- a/jdk/src/share/classes/com/sun/java/swing/plaf/windows/resources/windows_es.properties +++ b/jdk/src/share/classes/com/sun/java/swing/plaf/windows/resources/windows_es.properties @@ -18,34 +18,30 @@ ############ FILE CHOOSER STRINGS ############# -FileChooser.lookInLabelText=Buscar en: -FileChooser.lookInLabelMnemonic=73 -FileChooser.saveInLabelText=Guardar en: -FileChooser.fileNameLabelText=Nombre de Archivo: -FileChooser.fileNameLabelMnemonic=78 -FileChooser.folderNameLabelText=Nombre de la Carpeta: -FileChooser.folderNameLabelMnemonic=78 -FileChooser.filesOfTypeLabelText=Archivos de Tipo: -FileChooser.filesOfTypeLabelMnemonic=84 -FileChooser.upFolderToolTipText=Subir un Nivel +FileChooser.lookInLabel.textAndMnemonic=Buscar en(&I): +FileChooser.saveInLabel.textAndMnemonic=Guardar en: +FileChooser.fileNameLabel.textAndMnemonic=&Nombre de Archivo: +FileChooser.folderNameLabel.textAndMnemonic=&Nombre de la Carpeta: +FileChooser.filesOfTypeLabel.textAndMnemonic=Archivos de &Tipo: +FileChooser.upFolderToolTip.textAndMnemonic=Subir un Nivel FileChooser.upFolderAccessibleName=Arriba -FileChooser.homeFolderToolTipText=Inicio +FileChooser.homeFolderToolTip.textAndMnemonic=Inicio FileChooser.homeFolderAccessibleName=Inicio -FileChooser.newFolderToolTipText=Crear Nueva Carpeta +FileChooser.newFolderToolTip.textAndMnemonic=Crear Nueva Carpeta FileChooser.newFolderAccessibleName=Nueva Carpeta -FileChooser.newFolderActionLabelText=Nueva Carpeta -FileChooser.listViewButtonToolTipText=Lista +FileChooser.newFolderActionLabel.textAndMnemonic=Nueva Carpeta +FileChooser.listViewButtonToolTip.textAndMnemonic=Lista FileChooser.listViewButtonAccessibleName=Lista -FileChooser.listViewActionLabelText=Lista -FileChooser.detailsViewButtonToolTipText=Detalles +FileChooser.listViewActionLabel.textAndMnemonic=Lista +FileChooser.detailsViewButtonToolTip.textAndMnemonic=Detalles FileChooser.detailsViewButtonAccessibleName=Detalles FileChooser.viewMenuButtonToolTipText = Men\u00FA Ver FileChooser.viewMenuButtonAccessibleName = Men\u00FA Ver -FileChooser.detailsViewActionLabelText=Detalles -FileChooser.refreshActionLabelText=Refrescar -FileChooser.viewMenuLabelText=Ver -FileChooser.fileNameHeaderText=Nombre -FileChooser.fileSizeHeaderText=Tama\u00F1o -FileChooser.fileTypeHeaderText=Tipo -FileChooser.fileDateHeaderText=Modificado -FileChooser.fileAttrHeaderText=Atributos +FileChooser.detailsViewActionLabel.textAndMnemonic=Detalles +FileChooser.refreshActionLabel.textAndMnemonic=Refrescar +FileChooser.viewMenuLabel.textAndMnemonic=Ver +FileChooser.fileNameHeader.textAndMnemonic=Nombre +FileChooser.fileSizeHeader.textAndMnemonic=Tama\u00F1o +FileChooser.fileTypeHeader.textAndMnemonic=Tipo +FileChooser.fileDateHeader.textAndMnemonic=Modificado +FileChooser.fileAttrHeader.textAndMnemonic=Atributos diff --git a/jdk/src/share/classes/com/sun/java/swing/plaf/windows/resources/windows_fr.properties b/jdk/src/share/classes/com/sun/java/swing/plaf/windows/resources/windows_fr.properties index 39736484777..b410f5f4926 100644 --- a/jdk/src/share/classes/com/sun/java/swing/plaf/windows/resources/windows_fr.properties +++ b/jdk/src/share/classes/com/sun/java/swing/plaf/windows/resources/windows_fr.properties @@ -18,34 +18,30 @@ ############ FILE CHOOSER STRINGS ############# -FileChooser.lookInLabelText=Rechercher dans : -FileChooser.lookInLabelMnemonic=73 -FileChooser.saveInLabelText=Enregistrer dans : -FileChooser.fileNameLabelText=Nom du fichier : -FileChooser.fileNameLabelMnemonic=78 -FileChooser.folderNameLabelText=Nom du dossier : -FileChooser.folderNameLabelMnemonic=78 -FileChooser.filesOfTypeLabelText=Fichiers de type : -FileChooser.filesOfTypeLabelMnemonic=84 -FileChooser.upFolderToolTipText=Remonte d'un niveau. +FileChooser.lookInLabel.textAndMnemonic=Rechercher dans (&I): +FileChooser.saveInLabel.textAndMnemonic=Enregistrer dans : +FileChooser.fileNameLabel.textAndMnemonic=&Nom du fichier : +FileChooser.folderNameLabel.textAndMnemonic=&Nom du dossier : +FileChooser.filesOfTypeLabel.textAndMnemonic=Fichiers de &type : +FileChooser.upFolderToolTip.textAndMnemonic=Remonte d'un niveau. FileChooser.upFolderAccessibleName=Monter -FileChooser.homeFolderToolTipText=R\u00E9pertoire d'origine +FileChooser.homeFolderToolTip.textAndMnemonic=R\u00E9pertoire d'origine FileChooser.homeFolderAccessibleName=R\u00E9pertoire d'origine -FileChooser.newFolderToolTipText=Cr\u00E9e un dossier. +FileChooser.newFolderToolTip.textAndMnemonic=Cr\u00E9e un dossier. FileChooser.newFolderAccessibleName=Nouveau dossier -FileChooser.newFolderActionLabelText=Nouveau dossier -FileChooser.listViewButtonToolTipText=Liste +FileChooser.newFolderActionLabel.textAndMnemonic=Nouveau dossier +FileChooser.listViewButtonToolTip.textAndMnemonic=Liste FileChooser.listViewButtonAccessibleName=Liste -FileChooser.listViewActionLabelText=Liste -FileChooser.detailsViewButtonToolTipText=D\u00E9tails +FileChooser.listViewActionLabel.textAndMnemonic=Liste +FileChooser.detailsViewButtonToolTip.textAndMnemonic=D\u00E9tails FileChooser.detailsViewButtonAccessibleName=D\u00E9tails FileChooser.viewMenuButtonToolTipText = Menu Affichage FileChooser.viewMenuButtonAccessibleName = Menu Affichage -FileChooser.detailsViewActionLabelText=D\u00E9tails -FileChooser.refreshActionLabelText=Actualiser -FileChooser.viewMenuLabelText=Affichage -FileChooser.fileNameHeaderText=Nom -FileChooser.fileSizeHeaderText=Taille -FileChooser.fileTypeHeaderText=Type -FileChooser.fileDateHeaderText=Modifi\u00E9 -FileChooser.fileAttrHeaderText=Attributs +FileChooser.detailsViewActionLabel.textAndMnemonic=D\u00E9tails +FileChooser.refreshActionLabel.textAndMnemonic=Actualiser +FileChooser.viewMenuLabel.textAndMnemonic=Affichage +FileChooser.fileNameHeader.textAndMnemonic=Nom +FileChooser.fileSizeHeader.textAndMnemonic=Taille +FileChooser.fileTypeHeader.textAndMnemonic=Type +FileChooser.fileDateHeader.textAndMnemonic=Modifi\u00E9 +FileChooser.fileAttrHeader.textAndMnemonic=Attributs diff --git a/jdk/src/share/classes/com/sun/java/swing/plaf/windows/resources/windows_it.properties b/jdk/src/share/classes/com/sun/java/swing/plaf/windows/resources/windows_it.properties index 5e3e6f12634..dc9e9c02a98 100644 --- a/jdk/src/share/classes/com/sun/java/swing/plaf/windows/resources/windows_it.properties +++ b/jdk/src/share/classes/com/sun/java/swing/plaf/windows/resources/windows_it.properties @@ -18,34 +18,30 @@ ############ FILE CHOOSER STRINGS ############# -FileChooser.lookInLabelText=Cerca in: -FileChooser.lookInLabelMnemonic=73 -FileChooser.saveInLabelText=Salva in: -FileChooser.fileNameLabelText=Nome file: -FileChooser.fileNameLabelMnemonic=78 -FileChooser.folderNameLabelText=Nome della cartella: -FileChooser.folderNameLabelMnemonic=78 -FileChooser.filesOfTypeLabelText=Tipo file: -FileChooser.filesOfTypeLabelMnemonic=84 -FileChooser.upFolderToolTipText=Cartella superiore +FileChooser.lookInLabel.textAndMnemonic=Cerca &in: +FileChooser.saveInLabel.textAndMnemonic=Salva in: +FileChooser.fileNameLabel.textAndMnemonic=&Nome file: +FileChooser.folderNameLabel.textAndMnemonic=&Nome della cartella: +FileChooser.filesOfTypeLabel.textAndMnemonic=&Tipo file: +FileChooser.upFolderToolTip.textAndMnemonic=Cartella superiore FileChooser.upFolderAccessibleName=Superiore -FileChooser.homeFolderToolTipText=Home +FileChooser.homeFolderToolTip.textAndMnemonic=Home FileChooser.homeFolderAccessibleName=Home -FileChooser.newFolderToolTipText=Crea nuova cartella +FileChooser.newFolderToolTip.textAndMnemonic=Crea nuova cartella FileChooser.newFolderAccessibleName=Nuova cartella -FileChooser.newFolderActionLabelText=Nuova cartella -FileChooser.listViewButtonToolTipText=Lista +FileChooser.newFolderActionLabel.textAndMnemonic=Nuova cartella +FileChooser.listViewButtonToolTip.textAndMnemonic=Lista FileChooser.listViewButtonAccessibleName=Lista -FileChooser.listViewActionLabelText=Lista -FileChooser.detailsViewButtonToolTipText=Dettagli +FileChooser.listViewActionLabel.textAndMnemonic=Lista +FileChooser.detailsViewButtonToolTip.textAndMnemonic=Dettagli FileChooser.detailsViewButtonAccessibleName=Dettagli FileChooser.viewMenuButtonToolTipText = Visualizza menu FileChooser.viewMenuButtonAccessibleName = Visualizza menu -FileChooser.detailsViewActionLabelText=Dettagli -FileChooser.refreshActionLabelText=Aggiorna -FileChooser.viewMenuLabelText=Visualizza -FileChooser.fileNameHeaderText=Nome -FileChooser.fileSizeHeaderText=Dimensioni -FileChooser.fileTypeHeaderText=Tipo -FileChooser.fileDateHeaderText=Modificato -FileChooser.fileAttrHeaderText=Attributi +FileChooser.detailsViewActionLabel.textAndMnemonic=Dettagli +FileChooser.refreshActionLabel.textAndMnemonic=Aggiorna +FileChooser.viewMenuLabel.textAndMnemonic=Visualizza +FileChooser.fileNameHeader.textAndMnemonic=Nome +FileChooser.fileSizeHeader.textAndMnemonic=Dimensioni +FileChooser.fileTypeHeader.textAndMnemonic=Tipo +FileChooser.fileDateHeader.textAndMnemonic=Modificato +FileChooser.fileAttrHeader.textAndMnemonic=Attributi diff --git a/jdk/src/share/classes/com/sun/java/swing/plaf/windows/resources/windows_ja.properties b/jdk/src/share/classes/com/sun/java/swing/plaf/windows/resources/windows_ja.properties index adc5d930d69..edeaac2e862 100644 --- a/jdk/src/share/classes/com/sun/java/swing/plaf/windows/resources/windows_ja.properties +++ b/jdk/src/share/classes/com/sun/java/swing/plaf/windows/resources/windows_ja.properties @@ -18,34 +18,30 @@ ############ FILE CHOOSER STRINGS ############# -FileChooser.lookInLabelText=\u53C2\u7167: -FileChooser.lookInLabelMnemonic=73 -FileChooser.saveInLabelText=\u4FDD\u5B58: -FileChooser.fileNameLabelText=\u30D5\u30A1\u30A4\u30EB\u540D: -FileChooser.fileNameLabelMnemonic=78 -FileChooser.folderNameLabelText=\u30D5\u30A9\u30EB\u30C0\u540D: -FileChooser.folderNameLabelMnemonic=78 -FileChooser.filesOfTypeLabelText=\u30D5\u30A1\u30A4\u30EB\u306E\u30BF\u30A4\u30D7: -FileChooser.filesOfTypeLabelMnemonic=84 -FileChooser.upFolderToolTipText=1\u30EC\u30D9\u30EB\u4E0A\u3078 +FileChooser.lookInLabel.textAndMnemonic=\u53C2\u7167(&I): +FileChooser.saveInLabel.textAndMnemonic=\u4FDD\u5B58: +FileChooser.fileNameLabel.textAndMnemonic=\u30D5\u30A1\u30A4\u30EB\u540D(&N): +FileChooser.folderNameLabel.textAndMnemonic=\u30D5\u30A9\u30EB\u30C0\u540D(&N): +FileChooser.filesOfTypeLabel.textAndMnemonic=\u30D5\u30A1\u30A4\u30EB\u306E\u30BF\u30A4\u30D7(&T): +FileChooser.upFolderToolTip.textAndMnemonic=1\u30EC\u30D9\u30EB\u4E0A\u3078 FileChooser.upFolderAccessibleName=\u4E0A\u3078 -FileChooser.homeFolderToolTipText=\u30DB\u30FC\u30E0 +FileChooser.homeFolderToolTip.textAndMnemonic=\u30DB\u30FC\u30E0 FileChooser.homeFolderAccessibleName=\u30DB\u30FC\u30E0 -FileChooser.newFolderToolTipText=\u65B0\u898F\u30D5\u30A9\u30EB\u30C0\u306E\u4F5C\u6210 +FileChooser.newFolderToolTip.textAndMnemonic=\u65B0\u898F\u30D5\u30A9\u30EB\u30C0\u306E\u4F5C\u6210 FileChooser.newFolderAccessibleName=\u65B0\u898F\u30D5\u30A9\u30EB\u30C0 -FileChooser.newFolderActionLabelText=\u65B0\u898F\u30D5\u30A9\u30EB\u30C0 -FileChooser.listViewButtonToolTipText=\u30EA\u30B9\u30C8 +FileChooser.newFolderActionLabel.textAndMnemonic=\u65B0\u898F\u30D5\u30A9\u30EB\u30C0 +FileChooser.listViewButtonToolTip.textAndMnemonic=\u30EA\u30B9\u30C8 FileChooser.listViewButtonAccessibleName=\u30EA\u30B9\u30C8 -FileChooser.listViewActionLabelText=\u30EA\u30B9\u30C8 -FileChooser.detailsViewButtonToolTipText=\u8A73\u7D30 +FileChooser.listViewActionLabel.textAndMnemonic=\u30EA\u30B9\u30C8 +FileChooser.detailsViewButtonToolTip.textAndMnemonic=\u8A73\u7D30 FileChooser.detailsViewButtonAccessibleName=\u8A73\u7D30 FileChooser.viewMenuButtonToolTipText = \u8868\u793A\u30E1\u30CB\u30E5\u30FC FileChooser.viewMenuButtonAccessibleName = \u8868\u793A\u30E1\u30CB\u30E5\u30FC -FileChooser.detailsViewActionLabelText=\u8A73\u7D30 -FileChooser.refreshActionLabelText=\u30EA\u30D5\u30EC\u30C3\u30B7\u30E5 -FileChooser.viewMenuLabelText=\u8868\u793A -FileChooser.fileNameHeaderText=\u540D\u524D -FileChooser.fileSizeHeaderText=\u30B5\u30A4\u30BA -FileChooser.fileTypeHeaderText=\u30BF\u30A4\u30D7 -FileChooser.fileDateHeaderText=\u4FEE\u6B63\u65E5 -FileChooser.fileAttrHeaderText=\u5C5E\u6027 +FileChooser.detailsViewActionLabel.textAndMnemonic=\u8A73\u7D30 +FileChooser.refreshActionLabel.textAndMnemonic=\u30EA\u30D5\u30EC\u30C3\u30B7\u30E5 +FileChooser.viewMenuLabel.textAndMnemonic=\u8868\u793A +FileChooser.fileNameHeader.textAndMnemonic=\u540D\u524D +FileChooser.fileSizeHeader.textAndMnemonic=\u30B5\u30A4\u30BA +FileChooser.fileTypeHeader.textAndMnemonic=\u30BF\u30A4\u30D7 +FileChooser.fileDateHeader.textAndMnemonic=\u4FEE\u6B63\u65E5 +FileChooser.fileAttrHeader.textAndMnemonic=\u5C5E\u6027 diff --git a/jdk/src/share/classes/com/sun/java/swing/plaf/windows/resources/windows_ko.properties b/jdk/src/share/classes/com/sun/java/swing/plaf/windows/resources/windows_ko.properties index 6922556c77e..94a1054bcef 100644 --- a/jdk/src/share/classes/com/sun/java/swing/plaf/windows/resources/windows_ko.properties +++ b/jdk/src/share/classes/com/sun/java/swing/plaf/windows/resources/windows_ko.properties @@ -18,34 +18,30 @@ ############ FILE CHOOSER STRINGS ############# -FileChooser.lookInLabelText=\uAC80\uC0C9 \uC704\uCE58: -FileChooser.lookInLabelMnemonic=73 -FileChooser.saveInLabelText=\uC800\uC7A5 \uC704\uCE58: -FileChooser.fileNameLabelText=\uD30C\uC77C \uC774\uB984: -FileChooser.fileNameLabelMnemonic=78 -FileChooser.folderNameLabelText=\uD3F4\uB354 \uC774\uB984: -FileChooser.folderNameLabelMnemonic=78 -FileChooser.filesOfTypeLabelText=\uD30C\uC77C \uC720\uD615: -FileChooser.filesOfTypeLabelMnemonic=84 -FileChooser.upFolderToolTipText=\uD55C \uB808\uBCA8 \uC704\uB85C +FileChooser.lookInLabel.textAndMnemonic=\uAC80\uC0C9 \uC704\uCE58(&I): +FileChooser.saveInLabel.textAndMnemonic=\uC800\uC7A5 \uC704\uCE58: +FileChooser.fileNameLabel.textAndMnemonic=\uD30C\uC77C \uC774\uB984(&N): +FileChooser.folderNameLabel.textAndMnemonic=\uD3F4\uB354 \uC774\uB984(&N): +FileChooser.filesOfTypeLabel.textAndMnemonic=\uD30C\uC77C \uC720\uD615(&T): +FileChooser.upFolderToolTip.textAndMnemonic=\uD55C \uB808\uBCA8 \uC704\uB85C FileChooser.upFolderAccessibleName=\uC704\uB85C -FileChooser.homeFolderToolTipText=\uD648 +FileChooser.homeFolderToolTip.textAndMnemonic=\uD648 FileChooser.homeFolderAccessibleName=\uD648 -FileChooser.newFolderToolTipText=\uC0C8 \uD3F4\uB354 \uC0DD\uC131 +FileChooser.newFolderToolTip.textAndMnemonic=\uC0C8 \uD3F4\uB354 \uC0DD\uC131 FileChooser.newFolderAccessibleName=\uC0C8 \uD3F4\uB354 -FileChooser.newFolderActionLabelText=\uC0C8 \uD3F4\uB354 -FileChooser.listViewButtonToolTipText=\uBAA9\uB85D +FileChooser.newFolderActionLabel.textAndMnemonic=\uC0C8 \uD3F4\uB354 +FileChooser.listViewButtonToolTip.textAndMnemonic=\uBAA9\uB85D FileChooser.listViewButtonAccessibleName=\uBAA9\uB85D -FileChooser.listViewActionLabelText=\uBAA9\uB85D -FileChooser.detailsViewButtonToolTipText=\uC138\uBD80 \uC815\uBCF4 +FileChooser.listViewActionLabel.textAndMnemonic=\uBAA9\uB85D +FileChooser.detailsViewButtonToolTip.textAndMnemonic=\uC138\uBD80 \uC815\uBCF4 FileChooser.detailsViewButtonAccessibleName=\uC138\uBD80 \uC815\uBCF4 FileChooser.viewMenuButtonToolTipText = \uBCF4\uAE30 \uBA54\uB274 FileChooser.viewMenuButtonAccessibleName = \uBCF4\uAE30 \uBA54\uB274 -FileChooser.detailsViewActionLabelText=\uC138\uBD80 \uC815\uBCF4 -FileChooser.refreshActionLabelText=\uC0C8\uB85C \uACE0\uCE68 -FileChooser.viewMenuLabelText=\uBCF4\uAE30 -FileChooser.fileNameHeaderText=\uC774\uB984 -FileChooser.fileSizeHeaderText=\uD06C\uAE30 -FileChooser.fileTypeHeaderText=\uC720\uD615 -FileChooser.fileDateHeaderText=\uC218\uC815 \uB0A0\uC9DC -FileChooser.fileAttrHeaderText=\uC18D\uC131 +FileChooser.detailsViewActionLabel.textAndMnemonic=\uC138\uBD80 \uC815\uBCF4 +FileChooser.refreshActionLabel.textAndMnemonic=\uC0C8\uB85C \uACE0\uCE68 +FileChooser.viewMenuLabel.textAndMnemonic=\uBCF4\uAE30 +FileChooser.fileNameHeader.textAndMnemonic=\uC774\uB984 +FileChooser.fileSizeHeader.textAndMnemonic=\uD06C\uAE30 +FileChooser.fileTypeHeader.textAndMnemonic=\uC720\uD615 +FileChooser.fileDateHeader.textAndMnemonic=\uC218\uC815 \uB0A0\uC9DC +FileChooser.fileAttrHeader.textAndMnemonic=\uC18D\uC131 diff --git a/jdk/src/share/classes/com/sun/java/swing/plaf/windows/resources/windows_pt_BR.properties b/jdk/src/share/classes/com/sun/java/swing/plaf/windows/resources/windows_pt_BR.properties index 7faf8c19c80..44ecb60ed6e 100644 --- a/jdk/src/share/classes/com/sun/java/swing/plaf/windows/resources/windows_pt_BR.properties +++ b/jdk/src/share/classes/com/sun/java/swing/plaf/windows/resources/windows_pt_BR.properties @@ -18,34 +18,30 @@ ############ FILE CHOOSER STRINGS ############# -FileChooser.lookInLabelText=Consultar em: -FileChooser.lookInLabelMnemonic=73 -FileChooser.saveInLabelText=Salvar em: -FileChooser.fileNameLabelText=Nome do arquivo: -FileChooser.fileNameLabelMnemonic=78 -FileChooser.folderNameLabelText=Nome da pasta: -FileChooser.folderNameLabelMnemonic=78 -FileChooser.filesOfTypeLabelText=Arquivos do tipo: -FileChooser.filesOfTypeLabelMnemonic=84 -FileChooser.upFolderToolTipText=Um N\u00EDvel Acima +FileChooser.lookInLabel.textAndMnemonic=Consultar em(&I): +FileChooser.saveInLabel.textAndMnemonic=Salvar em: +FileChooser.fileNameLabel.textAndMnemonic=&Nome do arquivo: +FileChooser.folderNameLabel.textAndMnemonic=&Nome da pasta: +FileChooser.filesOfTypeLabel.textAndMnemonic=Arquivos do &tipo: +FileChooser.upFolderToolTip.textAndMnemonic=Um N\u00EDvel Acima FileChooser.upFolderAccessibleName=Acima -FileChooser.homeFolderToolTipText=In\u00EDcio +FileChooser.homeFolderToolTip.textAndMnemonic=In\u00EDcio FileChooser.homeFolderAccessibleName=In\u00EDcio -FileChooser.newFolderToolTipText=Criar Nova Pasta +FileChooser.newFolderToolTip.textAndMnemonic=Criar Nova Pasta FileChooser.newFolderAccessibleName=Nova Pasta -FileChooser.newFolderActionLabelText=Nova Pasta -FileChooser.listViewButtonToolTipText=Lista +FileChooser.newFolderActionLabel.textAndMnemonic=Nova Pasta +FileChooser.listViewButtonToolTip.textAndMnemonic=Lista FileChooser.listViewButtonAccessibleName=Lista -FileChooser.listViewActionLabelText=Lista -FileChooser.detailsViewButtonToolTipText=Detalhes +FileChooser.listViewActionLabel.textAndMnemonic=Lista +FileChooser.detailsViewButtonToolTip.textAndMnemonic=Detalhes FileChooser.detailsViewButtonAccessibleName=Detalhes FileChooser.viewMenuButtonToolTipText = Exibir Menu FileChooser.viewMenuButtonAccessibleName = Exibir Menu -FileChooser.detailsViewActionLabelText=Detalhes -FileChooser.refreshActionLabelText=Atualizar -FileChooser.viewMenuLabelText=Exibir -FileChooser.fileNameHeaderText=Nome -FileChooser.fileSizeHeaderText=Tamanho -FileChooser.fileTypeHeaderText=Tipo -FileChooser.fileDateHeaderText=Modificado -FileChooser.fileAttrHeaderText=Atributos +FileChooser.detailsViewActionLabel.textAndMnemonic=Detalhes +FileChooser.refreshActionLabel.textAndMnemonic=Atualizar +FileChooser.viewMenuLabel.textAndMnemonic=Exibir +FileChooser.fileNameHeader.textAndMnemonic=Nome +FileChooser.fileSizeHeader.textAndMnemonic=Tamanho +FileChooser.fileTypeHeader.textAndMnemonic=Tipo +FileChooser.fileDateHeader.textAndMnemonic=Modificado +FileChooser.fileAttrHeader.textAndMnemonic=Atributos diff --git a/jdk/src/share/classes/com/sun/java/swing/plaf/windows/resources/windows_sv.properties b/jdk/src/share/classes/com/sun/java/swing/plaf/windows/resources/windows_sv.properties index 4e83498093f..e44a096a29e 100644 --- a/jdk/src/share/classes/com/sun/java/swing/plaf/windows/resources/windows_sv.properties +++ b/jdk/src/share/classes/com/sun/java/swing/plaf/windows/resources/windows_sv.properties @@ -18,34 +18,30 @@ ############ FILE CHOOSER STRINGS ############# -FileChooser.lookInLabelText=Leta i: -FileChooser.lookInLabelMnemonic=73 -FileChooser.saveInLabelText=Spara i: -FileChooser.fileNameLabelText=Filnamn: -FileChooser.fileNameLabelMnemonic=78 -FileChooser.folderNameLabelText=Mapp: -FileChooser.folderNameLabelMnemonic=78 -FileChooser.filesOfTypeLabelText=Filformat: -FileChooser.filesOfTypeLabelMnemonic=84 -FileChooser.upFolderToolTipText=Upp en niv\u00E5 +FileChooser.lookInLabel.textAndMnemonic=Leta &i: +FileChooser.saveInLabel.textAndMnemonic=Spara i: +FileChooser.fileNameLabel.textAndMnemonic=Fil&namn: +FileChooser.folderNameLabel.textAndMnemonic=Mapp(&N): +FileChooser.filesOfTypeLabel.textAndMnemonic=Filforma&t: +FileChooser.upFolderToolTip.textAndMnemonic=Upp en niv\u00E5 FileChooser.upFolderAccessibleName=Upp -FileChooser.homeFolderToolTipText=Hem +FileChooser.homeFolderToolTip.textAndMnemonic=Hem FileChooser.homeFolderAccessibleName=Hem -FileChooser.newFolderToolTipText=Skapa ny mapp +FileChooser.newFolderToolTip.textAndMnemonic=Skapa ny mapp FileChooser.newFolderAccessibleName=Ny mapp -FileChooser.newFolderActionLabelText=Ny mapp -FileChooser.listViewButtonToolTipText=Lista +FileChooser.newFolderActionLabel.textAndMnemonic=Ny mapp +FileChooser.listViewButtonToolTip.textAndMnemonic=Lista FileChooser.listViewButtonAccessibleName=Lista -FileChooser.listViewActionLabelText=Lista -FileChooser.detailsViewButtonToolTipText=Detaljer +FileChooser.listViewActionLabel.textAndMnemonic=Lista +FileChooser.detailsViewButtonToolTip.textAndMnemonic=Detaljer FileChooser.detailsViewButtonAccessibleName=Detaljer FileChooser.viewMenuButtonToolTipText = Menyn Visa FileChooser.viewMenuButtonAccessibleName = Menyn Visa -FileChooser.detailsViewActionLabelText=Detaljer -FileChooser.refreshActionLabelText=F\u00F6rnya -FileChooser.viewMenuLabelText=Vy -FileChooser.fileNameHeaderText=Namn -FileChooser.fileSizeHeaderText=Storlek -FileChooser.fileTypeHeaderText=Typ -FileChooser.fileDateHeaderText=\u00C4ndrad -FileChooser.fileAttrHeaderText=Attribut +FileChooser.detailsViewActionLabel.textAndMnemonic=Detaljer +FileChooser.refreshActionLabel.textAndMnemonic=F\u00F6rnya +FileChooser.viewMenuLabel.textAndMnemonic=Vy +FileChooser.fileNameHeader.textAndMnemonic=Namn +FileChooser.fileSizeHeader.textAndMnemonic=Storlek +FileChooser.fileTypeHeader.textAndMnemonic=Typ +FileChooser.fileDateHeader.textAndMnemonic=\u00C4ndrad +FileChooser.fileAttrHeader.textAndMnemonic=Attribut diff --git a/jdk/src/share/classes/com/sun/java/swing/plaf/windows/resources/windows_zh_CN.properties b/jdk/src/share/classes/com/sun/java/swing/plaf/windows/resources/windows_zh_CN.properties index 3a4c0cd6942..3dfa7533aa3 100644 --- a/jdk/src/share/classes/com/sun/java/swing/plaf/windows/resources/windows_zh_CN.properties +++ b/jdk/src/share/classes/com/sun/java/swing/plaf/windows/resources/windows_zh_CN.properties @@ -18,34 +18,30 @@ ############ FILE CHOOSER STRINGS ############# -FileChooser.lookInLabelText=\u67E5\u770B: -FileChooser.lookInLabelMnemonic=73 -FileChooser.saveInLabelText=\u4FDD\u5B58: -FileChooser.fileNameLabelText=\u6587\u4EF6\u540D: -FileChooser.fileNameLabelMnemonic=78 -FileChooser.folderNameLabelText=\u6587\u4EF6\u5939\u540D: -FileChooser.folderNameLabelMnemonic=78 -FileChooser.filesOfTypeLabelText=\u6587\u4EF6\u7C7B\u578B: -FileChooser.filesOfTypeLabelMnemonic=84 -FileChooser.upFolderToolTipText=\u5411\u4E0A\u4E00\u7EA7 +FileChooser.lookInLabel.textAndMnemonic=\u67E5\u770B: (&I) +FileChooser.saveInLabel.textAndMnemonic=\u4FDD\u5B58: +FileChooser.fileNameLabel.textAndMnemonic=\u6587\u4EF6\u540D: (&N) +FileChooser.folderNameLabel.textAndMnemonic=\u6587\u4EF6\u5939\u540D: (&N) +FileChooser.filesOfTypeLabel.textAndMnemonic=\u6587\u4EF6\u7C7B\u578B: (&T) +FileChooser.upFolderToolTip.textAndMnemonic=\u5411\u4E0A\u4E00\u7EA7 FileChooser.upFolderAccessibleName=\u5411\u4E0A -FileChooser.homeFolderToolTipText=\u4E3B\u76EE\u5F55 +FileChooser.homeFolderToolTip.textAndMnemonic=\u4E3B\u76EE\u5F55 FileChooser.homeFolderAccessibleName=\u4E3B\u76EE\u5F55 -FileChooser.newFolderToolTipText=\u521B\u5EFA\u65B0\u6587\u4EF6\u5939 +FileChooser.newFolderToolTip.textAndMnemonic=\u521B\u5EFA\u65B0\u6587\u4EF6\u5939 FileChooser.newFolderAccessibleName=\u65B0\u5EFA\u6587\u4EF6\u5939 -FileChooser.newFolderActionLabelText=\u65B0\u5EFA\u6587\u4EF6\u5939 -FileChooser.listViewButtonToolTipText=\u5217\u8868 +FileChooser.newFolderActionLabel.textAndMnemonic=\u65B0\u5EFA\u6587\u4EF6\u5939 +FileChooser.listViewButtonToolTip.textAndMnemonic=\u5217\u8868 FileChooser.listViewButtonAccessibleName=\u5217\u8868 -FileChooser.listViewActionLabelText=\u5217\u8868 -FileChooser.detailsViewButtonToolTipText=\u8BE6\u7EC6\u8D44\u6599 +FileChooser.listViewActionLabel.textAndMnemonic=\u5217\u8868 +FileChooser.detailsViewButtonToolTip.textAndMnemonic=\u8BE6\u7EC6\u8D44\u6599 FileChooser.detailsViewButtonAccessibleName=\u8BE6\u7EC6\u8D44\u6599 FileChooser.viewMenuButtonToolTipText = \u67E5\u770B\u83DC\u5355 FileChooser.viewMenuButtonAccessibleName = \u67E5\u770B\u83DC\u5355 -FileChooser.detailsViewActionLabelText=\u8BE6\u7EC6\u8D44\u6599 -FileChooser.refreshActionLabelText=\u5237\u65B0 -FileChooser.viewMenuLabelText=\u89C6\u56FE -FileChooser.fileNameHeaderText=\u540D\u79F0 -FileChooser.fileSizeHeaderText=\u5927\u5C0F -FileChooser.fileTypeHeaderText=\u7C7B\u578B -FileChooser.fileDateHeaderText=\u4FEE\u6539\u65E5\u671F -FileChooser.fileAttrHeaderText=\u5C5E\u6027 +FileChooser.detailsViewActionLabel.textAndMnemonic=\u8BE6\u7EC6\u8D44\u6599 +FileChooser.refreshActionLabel.textAndMnemonic=\u5237\u65B0 +FileChooser.viewMenuLabel.textAndMnemonic=\u89C6\u56FE +FileChooser.fileNameHeader.textAndMnemonic=\u540D\u79F0 +FileChooser.fileSizeHeader.textAndMnemonic=\u5927\u5C0F +FileChooser.fileTypeHeader.textAndMnemonic=\u7C7B\u578B +FileChooser.fileDateHeader.textAndMnemonic=\u4FEE\u6539\u65E5\u671F +FileChooser.fileAttrHeader.textAndMnemonic=\u5C5E\u6027 diff --git a/jdk/src/share/classes/com/sun/java/swing/plaf/windows/resources/windows_zh_TW.properties b/jdk/src/share/classes/com/sun/java/swing/plaf/windows/resources/windows_zh_TW.properties index e4c8ad0c081..099caadda8c 100644 --- a/jdk/src/share/classes/com/sun/java/swing/plaf/windows/resources/windows_zh_TW.properties +++ b/jdk/src/share/classes/com/sun/java/swing/plaf/windows/resources/windows_zh_TW.properties @@ -18,34 +18,30 @@ ############ FILE CHOOSER STRINGS ############# -FileChooser.lookInLabelText=\u67E5\u8A62: -FileChooser.lookInLabelMnemonic=73 -FileChooser.saveInLabelText=\u5132\u5B58\u65BC: -FileChooser.fileNameLabelText=\u6A94\u6848\u540D\u7A31: -FileChooser.fileNameLabelMnemonic=78 -FileChooser.folderNameLabelText=\u8CC7\u6599\u593E\u540D\u7A31: -FileChooser.folderNameLabelMnemonic=78 -FileChooser.filesOfTypeLabelText=\u6A94\u6848\u985E\u578B: -FileChooser.filesOfTypeLabelMnemonic=84 -FileChooser.upFolderToolTipText=\u5F80\u4E0A\u4E00\u5C64 +FileChooser.lookInLabel.textAndMnemonic=\u67E5\u8A62(&I): +FileChooser.saveInLabel.textAndMnemonic=\u5132\u5B58\u65BC: +FileChooser.fileNameLabel.textAndMnemonic=\u6A94\u6848\u540D\u7A31(&N): +FileChooser.folderNameLabel.textAndMnemonic=\u8CC7\u6599\u593E\u540D\u7A31(&N): +FileChooser.filesOfTypeLabel.textAndMnemonic=\u6A94\u6848\u985E\u578B(&T): +FileChooser.upFolderToolTip.textAndMnemonic=\u5F80\u4E0A\u4E00\u5C64 FileChooser.upFolderAccessibleName=\u5F80\u4E0A -FileChooser.homeFolderToolTipText=\u4E3B\u76EE\u9304 +FileChooser.homeFolderToolTip.textAndMnemonic=\u4E3B\u76EE\u9304 FileChooser.homeFolderAccessibleName=\u4E3B\u76EE\u9304 -FileChooser.newFolderToolTipText=\u5EFA\u7ACB\u65B0\u8CC7\u6599\u593E +FileChooser.newFolderToolTip.textAndMnemonic=\u5EFA\u7ACB\u65B0\u8CC7\u6599\u593E FileChooser.newFolderAccessibleName=\u65B0\u8CC7\u6599\u593E -FileChooser.newFolderActionLabelText=\u65B0\u8CC7\u6599\u593E -FileChooser.listViewButtonToolTipText=\u6E05\u55AE +FileChooser.newFolderActionLabel.textAndMnemonic=\u65B0\u8CC7\u6599\u593E +FileChooser.listViewButtonToolTip.textAndMnemonic=\u6E05\u55AE FileChooser.listViewButtonAccessibleName=\u6E05\u55AE -FileChooser.listViewActionLabelText=\u6E05\u55AE -FileChooser.detailsViewButtonToolTipText=\u8A73\u7D30\u8CC7\u8A0A +FileChooser.listViewActionLabel.textAndMnemonic=\u6E05\u55AE +FileChooser.detailsViewButtonToolTip.textAndMnemonic=\u8A73\u7D30\u8CC7\u8A0A FileChooser.detailsViewButtonAccessibleName=\u8A73\u7D30\u8CC7\u8A0A FileChooser.viewMenuButtonToolTipText = \u6AA2\u8996\u529F\u80FD\u8868 FileChooser.viewMenuButtonAccessibleName = \u6AA2\u8996\u529F\u80FD\u8868 -FileChooser.detailsViewActionLabelText=\u8A73\u7D30\u8CC7\u8A0A -FileChooser.refreshActionLabelText=\u91CD\u65B0\u6574\u7406 -FileChooser.viewMenuLabelText=\u6AA2\u8996 -FileChooser.fileNameHeaderText=\u540D\u7A31 -FileChooser.fileSizeHeaderText=\u5927\u5C0F -FileChooser.fileTypeHeaderText=\u985E\u578B -FileChooser.fileDateHeaderText=\u4FEE\u6539\u65E5\u671F -FileChooser.fileAttrHeaderText=\u5C6C\u6027 +FileChooser.detailsViewActionLabel.textAndMnemonic=\u8A73\u7D30\u8CC7\u8A0A +FileChooser.refreshActionLabel.textAndMnemonic=\u91CD\u65B0\u6574\u7406 +FileChooser.viewMenuLabel.textAndMnemonic=\u6AA2\u8996 +FileChooser.fileNameHeader.textAndMnemonic=\u540D\u7A31 +FileChooser.fileSizeHeader.textAndMnemonic=\u5927\u5C0F +FileChooser.fileTypeHeader.textAndMnemonic=\u985E\u578B +FileChooser.fileDateHeader.textAndMnemonic=\u4FEE\u6539\u65E5\u671F +FileChooser.fileAttrHeader.textAndMnemonic=\u5C6C\u6027 From f7483afe41a02ed5fb445a8467a9a5572f5e6dc3 Mon Sep 17 00:00:00 2001 From: Alexander Scherbatiy Date: Wed, 16 May 2012 18:11:48 +0400 Subject: [PATCH 062/128] 7158928: [macosx] NLS: Please change the mnemonic assignment system Reviewed-by: rupashka, serb --- jdk/make/com/apple/osxui/Makefile | 8 +- jdk/make/common/internal/Resources.gmk | 4 + .../com/apple/laf/AquaLookAndFeel.java | 2 +- .../com/apple/laf/resources/aqua.properties | 180 ++++++++---------- 4 files changed, 86 insertions(+), 108 deletions(-) diff --git a/jdk/make/com/apple/osxui/Makefile b/jdk/make/com/apple/osxui/Makefile index 63d78d2872e..0970061d1f7 100644 --- a/jdk/make/com/apple/osxui/Makefile +++ b/jdk/make/com/apple/osxui/Makefile @@ -65,12 +65,8 @@ FILES_export = \ com/apple/laf/ScreenMenuPropertyHandler.java \ com/apple/laf/ScreenMenuPropertyListener.java -#RESOURCE_BUNDLES_COMPILED_PROPERTIES += \ -# com/apple/laf/resources/aqua.properties \ -# com/apple/laf/resources/aqua_de.properties \ -# com/apple/laf/resources/aqua_fr.properties \ -# com/apple/laf/resources/aqua_ja.properties - +RESOURCE_BUNDLES_COMPILED_PROPERTIES += \ + com/apple/laf/resources/aqua.properties # # Rules diff --git a/jdk/make/common/internal/Resources.gmk b/jdk/make/common/internal/Resources.gmk index 56a81fbf09e..fccfe273c63 100644 --- a/jdk/make/common/internal/Resources.gmk +++ b/jdk/make/common/internal/Resources.gmk @@ -197,6 +197,10 @@ $(GENSRCDIR)/%.java: $(SHARE_SRC)/classes/%.properties $(add-property-java-file) $(GENSRCDIR)/%.java: $(GENSRCDIR)/%.properties $(add-property-java-file) +ifdef PLATFORM_SRC_MACOS +$(GENSRCDIR)/%.java: $(PLATFORM_SRC_MACOS)/classes/%.properties + $(add-property-java-file) +endif ifndef OPENJDK $(GENSRCDIR)/%.java: $(CLOSED_PLATFORM_SRC)/classes/%.properties $(add-property-java-file) diff --git a/jdk/src/macosx/classes/com/apple/laf/AquaLookAndFeel.java b/jdk/src/macosx/classes/com/apple/laf/AquaLookAndFeel.java index c7d970c13fd..3c872df2b26 100644 --- a/jdk/src/macosx/classes/com/apple/laf/AquaLookAndFeel.java +++ b/jdk/src/macosx/classes/com/apple/laf/AquaLookAndFeel.java @@ -250,6 +250,7 @@ public class AquaLookAndFeel extends BasicLookAndFeel { */ private void initResourceBundle(final UIDefaults table) { table.setDefaultLocale(Locale.getDefault()); + table.addResourceBundle(PKG_PREFIX + "resources.aqua"); try { final ResourceBundle aquaProperties = MacOSXResourceBundle.getMacResourceBundle(PKG_PREFIX + "resources.aqua"); final Enumeration propertyKeys = aquaProperties.getKeys(); @@ -259,7 +260,6 @@ public class AquaLookAndFeel extends BasicLookAndFeel { table.put(key, aquaProperties.getString(key)); } } catch (final Exception e) { - table.addResourceBundle(PKG_PREFIX + "resources.aqua"); } } diff --git a/jdk/src/macosx/classes/com/apple/laf/resources/aqua.properties b/jdk/src/macosx/classes/com/apple/laf/resources/aqua.properties index 30a840d9520..17f7a94584a 100644 --- a/jdk/src/macosx/classes/com/apple/laf/resources/aqua.properties +++ b/jdk/src/macosx/classes/com/apple/laf/resources/aqua.properties @@ -36,45 +36,45 @@ # support. ############ FILE CHOOSER STRINGS ############# -FileChooser.fileDescriptionText=Generic File -FileChooser.directoryDescriptionText=Directory -FileChooser.newFolderErrorText=Error occured during folder creation +FileChooser.fileDescription.textAndMnemonic=Generic File +FileChooser.directoryDescription.textAndMnemonic=Directory +FileChooser.newFolderError.textAndMnemonic=Error occured during folder creation FileChooser.newFolderErrorSeparator= : -FileChooser.acceptAllFileFilterText=All Files -FileChooser.cancelButtonText=Cancel -FileChooser.saveButtonText=Save -FileChooser.openButtonText=Open -FileChooser.saveDialogTitleText=Save -FileChooser.openDialogTitleText=Open -FileChooser.updateButtonText=Update -FileChooser.helpButtonText=Help -FileChooser.directoryOpenButtonText=Open +FileChooser.acceptAllFileFilter.textAndMnemonic=All Files +FileChooser.cancelButton.textAndMnemonic=Cancel +FileChooser.saveButton.textAndMnemonic=Save +FileChooser.openButton.textAndMnemonic=Open +FileChooser.saveDialogTitle.textAndMnemonic=Save +FileChooser.openDialogTitle.textAndMnemonic=Open +FileChooser.updateButton.textAndMnemonic=Update +FileChooser.helpButton.textAndMnemonic=Help +FileChooser.directoryOpenButton.textAndMnemonic=Open # File Size Units FileChooser.fileSizeKiloBytes={0} KB FileChooser.fileSizeMegaBytes={0} MB FileChooser.fileSizeGigaBytes={0} GB -// Mac-specific strings -FileChooser.saveTitleText=Save -FileChooser.openTitleText=Open -FileChooser.newFolderExistsErrorText=That name is already taken -FileChooser.chooseButtonText=Choose +# Mac-specific strings +FileChooser.saveTitle.textAndMnemonic=Save +FileChooser.openTitle.textAndMnemonic=Open +FileChooser.newFolderExistsError.textAndMnemonic=That name is already taken +FileChooser.chooseButton.textAndMnemonic=Choose -FileChooser.newFolderButtonText=New Folder -FileChooser.newFolderTitleText=New Folder -FileChooser.fileNameLabelText=File: -FileChooser.saveDialogFileNameLabelText=Save As: -FileChooser.filesOfTypeLabelText=File Format: +FileChooser.newFolderButton.textAndMnemonic=New Folder +FileChooser.newFolderTitle.textAndMnemonic=New Folder +FileChooser.fileNameLabel.textAndMnemonic=File: +FileChooser.saveDialogFileNameLabel.textAndMnemonic=Save As: +FileChooser.filesOfTypeLabel.textAndMnemonic=File Format: FileChooser.desktopName=Desktop -FileChooser.newFolderPromptText=Name of new folder: +FileChooser.newFolderPrompt.textAndMnemonic=Name of new folder: FileChooser.untitledFolderName=untitled folder FileChooser.untitledFileName=untitled -FileChooser.createButtonText=Create +FileChooser.createButton.textAndMnemonic=Create -FileChooser.byDateText=Date Modified -FileChooser.byNameText=Name +FileChooser.byDate.textAndMnemonic=Date Modified +FileChooser.by.textAndMnemonic=Name FileChooser.newFolderAccessibleName=New Folder FileChooser.mac.newFolder=untitled folder @@ -82,76 +82,54 @@ FileChooser.mac.newFolder.subsequent=untitled folder {0} ############ COLOR CHOOSER STRINGS ############# -ColorChooser.previewText=Preview -ColorChooser.okText=OK -ColorChooser.cancelText=Cancel -ColorChooser.resetText=Reset -# VK_XXX constant for 'ColorChooser.resetText' button to make mnemonic -ColorChooser.resetMnemonic=82 -ColorChooser.sampleText=Sample Text Sample Text -ColorChooser.swatchesNameText=Swatches -ColorChooser.swatchesMnemonic=83 -ColorChooser.swatchesDisplayedMnemonicIndex=0 -ColorChooser.swatchesRecentText=Recent: -ColorChooser.hsbNameText=HSB -# Each of the ColorChooser types can define a mnemonic, as a KeyEvent.VK_XXX -# constant, and an index into the text to render the mnemonic as. The -# mnemonic is xxxMnemonic and the index of the character to underline is -# xxxDisplayedMnemonicIndex. -ColorChooser.hsbMnemonic=72 -ColorChooser.hsbDisplayedMnemonicIndex=0 -ColorChooser.hsbHueText=H -ColorChooser.hsbSaturationText=S -ColorChooser.hsbBrightnessText=B -ColorChooser.hsbRedText=R -ColorChooser.hsbGreenText=G -ColorChooser.hsbBlueText=B -ColorChooser.rgbNameText=RGB -ColorChooser.rgbMnemonic=71 -ColorChooser.rgbDisplayedMnemonicIndex=1 -ColorChooser.rgbRedText=Red -ColorChooser.rgbRedMnemonic=68 -ColorChooser.rgbGreenText=Green -ColorChooser.rgbGreenMnemonic=78 -ColorChooser.rgbBlueText=Blue -ColorChooser.rgbBlueMnemonic=66 +ColorChooser.preview.textAndMnemonic=Preview +ColorChooser.ok.textAndMnemonic=OK +ColorChooser.cancel.textAndMnemonic=Cancel +ColorChooser.reset.textAndMnemonic=&Reset +ColorChooser.sample.textAndMnemonic=Sample Text Sample Text +ColorChooser.swatches.textAndMnemonic=&Swatches +ColorChooser.swatchesRecent.textAndMnemonic=Recent: +ColorChooser.hsb.textAndMnemonic=&HSB +ColorChooser.hsbHue.textAndMnemonic=H +ColorChooser.hsbSaturation.textAndMnemonic=S +ColorChooser.hsbBrightness.textAndMnemonic=B +ColorChooser.hsbRed.textAndMnemonic=R +ColorChooser.hsbGreen.textAndMnemonic=G +ColorChooser.hsbBlue.textAndMnemonic=B +ColorChooser.rgb.textAndMnemonic=R&GB +ColorChooser.rgbRed.textAndMnemonic=Re&d +ColorChooser.rgbGreen.textAndMnemonic=Gree&n +ColorChooser.rgbBlue.textAndMnemonic=&Blue ############ OPTION PANE STRINGS ############# -# Mnemonic keys correspond to KeyEvent.VK_XXX constant # We only define mnemonics for YES/NO, but for completeness you can # define mnemonics for any of the buttons. -OptionPane.yesButtonText=Yes -OptionPane.yesButtonMnemonic=89 -OptionPane.noButtonText=No -OptionPane.noButtonMnemonic=78 -OptionPane.okButtonText=OK -OptionPane.okButtonMnemonic=0 -OptionPane.cancelButtonText=Cancel -OptionPane.cancelButtonMnemonic=0 -OptionPane.titleText=Select an Option +OptionPane.yesButton.textAndMnemonic=&Yes +OptionPane.noButton.textAndMnemonic=&No +OptionPane.okButton.textAndMnemonic=OK +OptionPane.cancelButton.textAndMnemonic=Cancel +OptionPane.title.textAndMnemonic=Select an Option # Title for the dialog for the showInputDialog methods. Only used if # the developer uses one of the variants that doesn't take a title. -OptionPane.inputDialogTitle=Input +OptionPane.inputDialog.titleAndMnemonic=Input # Title for the dialog for the showMessageDialog methods. Only used if # the developer uses one of the variants that doesn't take a title. -OptionPane.messageDialogTitle=Message +OptionPane.messageDialog.titleAndMnemonic=Message ############ Printing Dialog Strings ############ -PrintingDialog.titleProgressText=Printing -PrintingDialog.titleAbortingText=Printing (Aborting) +PrintingDialog.titleProgress.textAndMnemonic=Printing +PrintingDialog.titleAborting.textAndMnemonic=Printing (Aborting) -PrintingDialog.contentInitialText=Printing in progress... +PrintingDialog.contentInitial.textAndMnemonic=Printing in progress... # The following string will be formatted by a MessageFormat # and {0} will be replaced by page number being printed -PrintingDialog.contentProgressText=Printed page {0}... +PrintingDialog.contentProgress.textAndMnemonic=Printed page {0}... -PrintingDialog.contentAbortingText=Printing aborting... +PrintingDialog.contentAborting.textAndMnemonic=Printing aborting... -PrintingDialog.abortButtonText=Abort -PrintingDialog.abortButtonMnemonic=65 -PrintingDialog.abortButtonDisplayedMnemonicIndex=0 -PrintingDialog.abortButtonToolTipText=Abort Printing +PrintingDialog.abortButton.textAndMnemonic=&Abort +PrintingDialog.abortButtonToolTip.textAndMnemonic=Abort Printing ############ Internal Frame Strings ############ InternalFrame.iconButtonToolTip=Minimize @@ -160,42 +138,42 @@ InternalFrame.restoreButtonToolTip=Restore InternalFrame.closeButtonToolTip=Close ############ Internal Frame Title Pane Strings ############ -InternalFrameTitlePane.restoreButtonText=Restore -InternalFrameTitlePane.moveButtonText=Move -InternalFrameTitlePane.sizeButtonText=Size -InternalFrameTitlePane.minimizeButtonText=Minimize -InternalFrameTitlePane.maximizeButtonText=Maximize -InternalFrameTitlePane.closeButtonText=Close +InternalFrameTitlePane.restoreButton.textAndMnemonic=Restore +InternalFrameTitlePane.moveButton.textAndMnemonic=Move +InternalFrameTitlePane.sizeButton.textAndMnemonic=Size +InternalFrameTitlePane.minimizeButton.textAndMnemonic=Minimize +InternalFrameTitlePane.maximizeButton.textAndMnemonic=Maximize +InternalFrameTitlePane.closeButton.textAndMnemonic=Close ############ Text strings ############# # Used for html forms -FormView.submitButtonText=Submit Query -FormView.resetButtonText=Reset -FormView.browseFileButtonText=Browse... +FormView.submitButton.textAndMnemonic=Submit Query +FormView.resetButton.textAndMnemonic=Reset +FormView.browseFileButton.textAndMnemonic=Browse... ############ Abstract Document Strings ############ -AbstractDocument.styleChangeText=style change -AbstractDocument.additionText=addition -AbstractDocument.deletionText=deletion -AbstractDocument.undoText=Undo -AbstractDocument.redoText=Redo +AbstractDocument.styleChange.textAndMnemonic=style change +AbstractDocument.addition.textAndMnemonic=addition +AbstractDocument.deletion.textAndMnemonic=deletion +AbstractDocument.undo.textAndMnemonic=Undo +AbstractDocument.redo.textAndMnemonic=Redo ############ Abstract Button Strings ############ -AbstractButton.clickText=click +AbstractButton.click.textAndMnemonic=click ############ Abstract Undoable Edit Strings ############ -AbstractUndoableEdit.undoText=Undo -AbstractUndoableEdit.redoText=Redo +AbstractUndoableEdit.undo.textAndMnemonic=Undo +AbstractUndoableEdit.redo.textAndMnemonic=Redo ############ Combo Box Strings ############ -ComboBox.togglePopupText=togglePopup +ComboBox.togglePopup.textAndMnemonic=togglePopup ############ Progress Monitor Strings ############ -ProgressMonitor.progressText=Progress... +ProgressMonitor.progress.textAndMnemonic=Progress... ############ Split Pane Strings ############ -SplitPane.leftButtonText=left button -SplitPane.rightButtonText=right button +SplitPane.leftButton.textAndMnemonic=left button +SplitPane.rightButton.textAndMnemonic=right button # Used for Isindex IsindexView.prompt=This is a searchable index. Enter search keywords: From 04d132c069597b94fcc28f8da9021be7ffe3928b Mon Sep 17 00:00:00 2001 From: "Daniel D. Daugherty" Date: Wed, 16 May 2012 12:47:27 -0700 Subject: [PATCH 063/128] 7169409: enabling ZIP_DEBUGINFO_FILES causes unexpected test failures on Windows X86 Disable ZIP_DEBUGINFO_FILES by default on Windows. Reviewed-by: acorn --- hotspot/make/windows/makefiles/defs.make | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/hotspot/make/windows/makefiles/defs.make b/hotspot/make/windows/makefiles/defs.make index 58e6a606e65..a1c88284cc2 100644 --- a/hotspot/make/windows/makefiles/defs.make +++ b/hotspot/make/windows/makefiles/defs.make @@ -143,7 +143,9 @@ _JUNK_ := $(shell \ MAKE_ARGS += ENABLE_FULL_DEBUG_SYMBOLS=$(ENABLE_FULL_DEBUG_SYMBOLS) ifeq ($(ENABLE_FULL_DEBUG_SYMBOLS),1) - ZIP_DEBUGINFO_FILES ?= 1 + # Disable ZIP_DEBUGINFO_FILES by default because various tests are + # failing in nightly when the debug info files are ZIP'ed. + ZIP_DEBUGINFO_FILES ?= 0 else ZIP_DEBUGINFO_FILES=0 endif From d06f47f95c85ab6001e6c161b56b9ccf828a34ab Mon Sep 17 00:00:00 2001 From: Alexander Scherbatiy Date: Thu, 17 May 2012 14:27:11 +0400 Subject: [PATCH 064/128] 7148281: [macosx] JTabbedPane tabs with HTML text do not render correctly Reviewed-by: kizune --- jdk/src/macosx/classes/com/apple/laf/AquaTabbedPaneUI.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/jdk/src/macosx/classes/com/apple/laf/AquaTabbedPaneUI.java b/jdk/src/macosx/classes/com/apple/laf/AquaTabbedPaneUI.java index f463d640fed..7dbc187296d 100644 --- a/jdk/src/macosx/classes/com/apple/laf/AquaTabbedPaneUI.java +++ b/jdk/src/macosx/classes/com/apple/laf/AquaTabbedPaneUI.java @@ -318,7 +318,7 @@ public class AquaTabbedPaneUI extends AquaTabbedPaneCopyFromBasicUI { } // not for the scrolling tabs - if (tabIndex >= 0) { + if (component == null && tabIndex >= 0) { paintTitle(g2d, font, metrics, textRect, tabIndex, title); } From c0f2f2b464b576b6cc7c1473c0d11a96c3862306 Mon Sep 17 00:00:00 2001 From: Pavel Porvatov Date: Thu, 17 May 2012 15:41:09 +0400 Subject: [PATCH 065/128] 7166322: closed/javax/swing/text/html/HTMLEditorKit/4242228/bug4242228.java failed since 1.8.0b36 Reviewed-by: alexsch --- .../HTMLEditorKit/4242228/bug4242228.java | 101 ++++++++++++++++++ 1 file changed, 101 insertions(+) create mode 100644 jdk/test/javax/swing/text/html/HTMLEditorKit/4242228/bug4242228.java diff --git a/jdk/test/javax/swing/text/html/HTMLEditorKit/4242228/bug4242228.java b/jdk/test/javax/swing/text/html/HTMLEditorKit/4242228/bug4242228.java new file mode 100644 index 00000000000..c18dccd02de --- /dev/null +++ b/jdk/test/javax/swing/text/html/HTMLEditorKit/4242228/bug4242228.java @@ -0,0 +1,101 @@ +/* + * Copyright (c) 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. + */ + +/* @test + @bug 4242228 + @summary Tests that HTMLEditorKit.setText() doesn't throw exceptions + @author Peter Zhelezniakov +*/ + +import sun.awt.SunToolkit; + +import javax.swing.*; +import javax.swing.event.ChangeEvent; +import javax.swing.event.ChangeListener; +import javax.swing.text.StyledEditorKit; +import javax.swing.text.html.HTMLDocument; +import javax.swing.text.html.HTMLEditorKit; +import java.awt.*; + +public class bug4242228 { + private static JTabbedPane tabPane; + private static JFrame frame; + + public static void main(String[] argv) throws Exception { + SwingUtilities.invokeAndWait(new Runnable() { + @Override + public void run() { + frame = new JFrame("4242228 Test"); + + JScrollPane sourcePane = new JScrollPane(); + final JTextPane htmlEditor = new JTextPane(); + final JTextPane sourceEditor = new JTextPane(); + final JScrollPane editorPane = new JScrollPane(); + + tabPane = new JTabbedPane(); + htmlEditor.setText(" "); + htmlEditor.setEditorKit(new HTMLEditorKit()); + + sourceEditor.setText(" "); + sourceEditor.setEditorKit(new StyledEditorKit()); + + frame.setLayout(new BorderLayout()); + + editorPane.getViewport().add(htmlEditor); + + tabPane.addTab("Editor", editorPane); + tabPane.addChangeListener(new ChangeListener() { + public void stateChanged(ChangeEvent e) { + if (tabPane.getSelectedComponent() == editorPane) { + htmlEditor.setText(sourceEditor.getText()); + } else { + sourceEditor.setText(htmlEditor.getText()); + } + } + }); + + sourcePane.getViewport().add(sourceEditor); + tabPane.addTab("Source", sourcePane); + tabPane.setTabPlacement(SwingConstants.BOTTOM); + htmlEditor.setDocument(new HTMLDocument()); + + frame.add(tabPane); + frame.setSize(400, 300); + frame.setVisible(true); + } + }); + + ((SunToolkit) Toolkit.getDefaultToolkit()).realSync(); + + SwingUtilities.invokeAndWait(new Runnable() { + @Override + public void run() { + for (int i = 0; i < 50; i++) { + tabPane.setSelectedIndex(i % 2); + } + + frame.dispose(); + } + }); + } +} From 00a5b03f1ba51c83e222852670c229056315ad5b Mon Sep 17 00:00:00 2001 From: David Katleman Date: Thu, 17 May 2012 06:20:10 -0700 Subject: [PATCH 066/128] Added tag jdk8-b39 for changeset 8c8235b1fcb6 --- .hgtags-top-repo | 1 + 1 file changed, 1 insertion(+) diff --git a/.hgtags-top-repo b/.hgtags-top-repo index 7c912d85790..5b76297fec5 100644 --- a/.hgtags-top-repo +++ b/.hgtags-top-repo @@ -160,3 +160,4 @@ cc771d92284f71765eca14d6d08703c4af254c04 jdk8-b21 6a6ba0a07f33d37a2f97b1107e60c6a9a69ec84d jdk8-b36 b2972095a4b1e2a97409b7c3df61f3b263a5ce14 jdk8-b37 d939bd0ab13c16647ffa38cc4b64fb31b7d44e10 jdk8-b38 +8927dd68aee3fa54a1a698e2980e1b2f6c7c12c1 jdk8-b39 From c285bb9bd613aba4a9e75b56ab545f434f4dd9d2 Mon Sep 17 00:00:00 2001 From: David Katleman Date: Thu, 17 May 2012 06:20:16 -0700 Subject: [PATCH 067/128] Added tag jdk8-b39 for changeset 999611eec364 --- corba/.hgtags | 1 + 1 file changed, 1 insertion(+) diff --git a/corba/.hgtags b/corba/.hgtags index ec31f642407..611c780360f 100644 --- a/corba/.hgtags +++ b/corba/.hgtags @@ -160,3 +160,4 @@ e3d735914edd0a621b16bb85417423f8e6af5d51 jdk8-b35 a5a61f259961a7f46b002e5cc50b4a9bf86927b6 jdk8-b36 83fac66442cf680bb59ec9e3a71cc4729322b595 jdk8-b37 b8cbfb31139f820e5e094ba71449e58159fbe22e jdk8-b38 +785af00e2827990f149b32ec37f523dbca3efdd1 jdk8-b39 From 6412273c9485d60ad767682c64d4589a92d98132 Mon Sep 17 00:00:00 2001 From: David Katleman Date: Thu, 17 May 2012 06:20:23 -0700 Subject: [PATCH 068/128] Added tag jdk8-b39 for changeset 402efa0d91d4 --- hotspot/.hgtags | 1 + 1 file changed, 1 insertion(+) diff --git a/hotspot/.hgtags b/hotspot/.hgtags index ae16a349a6a..6beed08f8a6 100644 --- a/hotspot/.hgtags +++ b/hotspot/.hgtags @@ -246,3 +246,4 @@ bfcf92bfefb82da00f7fdbf0d9273feaa0a9456d jdk8-b37 7d5ec8bf38d1b12e0e09ec381f10976b8beede3b hs24-b09 637c3f5f068f88fb9ec9c5867341cf59fd5ebedc jdk8-b38 73147e6c48813b5fee904aa33f79a77103250ff4 hs24-b10 +96a403721094ecdaf6a1f4f52ebd0a82e07df199 jdk8-b39 From b57dfbffa8c16e3e818fd2a73781c358356fd641 Mon Sep 17 00:00:00 2001 From: David Katleman Date: Thu, 17 May 2012 06:20:35 -0700 Subject: [PATCH 069/128] Added tag jdk8-b39 for changeset a70d185bcc77 --- jaxp/.hgtags | 1 + 1 file changed, 1 insertion(+) diff --git a/jaxp/.hgtags b/jaxp/.hgtags index c8892c35ae6..0c06d95a38f 100644 --- a/jaxp/.hgtags +++ b/jaxp/.hgtags @@ -160,3 +160,4 @@ e187f3ede64965dc2979df9a211107cd3d38eacb jdk8-b35 cfd288fe1d3e2b700838342e70d71d44ac991af5 jdk8-b36 90204bfab4e2bed402badcc997cbf8446ab5669f jdk8-b37 5bbe0cb6f2f2d7ce292da77bf4fa9d618d770a78 jdk8-b38 +f95fdbe525c88ef0d57dc1390be6582a8af5e07c jdk8-b39 From 66e90b1610c55dcdf55eff3447aece3a59b561c9 Mon Sep 17 00:00:00 2001 From: David Katleman Date: Thu, 17 May 2012 06:20:38 -0700 Subject: [PATCH 070/128] Added tag jdk8-b39 for changeset b5e60661b9a2 --- jaxws/.hgtags | 1 + 1 file changed, 1 insertion(+) diff --git a/jaxws/.hgtags b/jaxws/.hgtags index 6513a494ea2..a0c4c18e846 100644 --- a/jaxws/.hgtags +++ b/jaxws/.hgtags @@ -160,3 +160,4 @@ e8afc16522e190cb93c66bcb15d6fba0fe9e6833 jdk8-b35 89b36c658e39f0a2957be55453a3a3befd9c8a6b jdk8-b36 b05a948db1b6c933c980f24e4dc8fd897b7cf4ef jdk8-b37 ac1ba3b56775e3cdcd91b7a48793b59f6a3c18b5 jdk8-b38 +7f6b44fd303478caa83575dbc225de187c509c50 jdk8-b39 From 4b002876d3ff21dc97c8cfe352a7926103e03c0b Mon Sep 17 00:00:00 2001 From: David Katleman Date: Thu, 17 May 2012 06:20:51 -0700 Subject: [PATCH 071/128] Added tag jdk8-b39 for changeset 679d89b6a21a --- langtools/.hgtags | 1 + 1 file changed, 1 insertion(+) diff --git a/langtools/.hgtags b/langtools/.hgtags index e3d8e553653..56653f53587 100644 --- a/langtools/.hgtags +++ b/langtools/.hgtags @@ -160,3 +160,4 @@ defd666a786334465496c8901fa302b779c7e045 jdk8-b35 94bbaa67686f44a124cd16fd9f1e8a6a3f684d2d jdk8-b36 5891b38985e8b2502296fc29e726b527d03116d2 jdk8-b37 1f224f160aa852c9541380735a27a3439dfb7217 jdk8-b38 +a9f547c218d957306dfc0cdd710be041bb62a555 jdk8-b39 From eb7d35d85e6b6421e8ad1904faef2be9ba32106b Mon Sep 17 00:00:00 2001 From: "Daniel D. Daugherty" Date: Thu, 17 May 2012 06:26:05 -0700 Subject: [PATCH 072/128] 7168520: No jdk8 TL Nightly linux builds due to broken link in b39-2012-05-13_231 ZIP libjsig.debuginfo links into libjsig.diz files since aurora doesn't like dangling symlinks Reviewed-by: katleman --- jdk/make/java/redist/Makefile | 35 +++++++++++++++++++++++++++++------ 1 file changed, 29 insertions(+), 6 deletions(-) diff --git a/jdk/make/java/redist/Makefile b/jdk/make/java/redist/Makefile index f72ad57333b..fb257f5c354 100644 --- a/jdk/make/java/redist/Makefile +++ b/jdk/make/java/redist/Makefile @@ -261,8 +261,7 @@ ifndef BUILD_CLIENT_ONLY ifeq ($(ZIP_DEBUGINFO_FILES),1) # the import JDK may not contain the target of the symlink ifneq ($(wildcard $(HOTSPOT_IMPORT_PATH)/$(ARCH_VM_SUBDIR)/$(LIBJSIG_DIZ_NAME)),) - # check for the .diz file, but create the .debuginfo link - IMPORT_LIST += $(LIB_LOCATION)/$(SERVER_LOCATION)/$(LIBJSIG_DEBUGINFO_NAME) + IMPORT_LIST += $(LIB_LOCATION)/$(SERVER_LOCATION)/$(LIBJSIG_DIZ_NAME) endif else # the import JDK may not contain the target of the symlink @@ -319,8 +318,7 @@ ifeq ($(ENABLE_FULL_DEBUG_SYMBOLS),1) ifeq ($(ZIP_DEBUGINFO_FILES),1) # the import JDK may not contain the target of the symlink ifneq ($(wildcard $(HOTSPOT_IMPORT_PATH)/$(ARCH_VM_SUBDIR)/$(LIBJSIG_DIZ_NAME)),) - # check for the .diz file, but create the .debuginfo link - IMPORT_LIST += $(LIB_LOCATION)/$(CLIENT_LOCATION)/$(LIBJSIG_DEBUGINFO_NAME) + IMPORT_LIST += $(LIB_LOCATION)/$(CLIENT_LOCATION)/$(LIBJSIG_DIZ_NAME) endif else # the import JDK may not contain the target of the symlink @@ -472,11 +470,24 @@ $(LIB_LOCATION)/$(SERVER_LOCATION)/$(LIBJSIG_NAME): $(call install-sym-link, ../$(LIBJSIG_NAME)) ifeq ($(ENABLE_FULL_DEBUG_SYMBOLS),1) -# we don't create a symlink to a libjsig.diz file +# We don't create a symlink to a libjsig.diz file, but we do put +# the libjsig.debuginfo symlink into a libjsig.diz file. The aurora +# system does not like dangling symlinks. + ifeq ($(ZIP_DEBUGINFO_FILES),1) +$(LIB_LOCATION)/$(CLIENT_LOCATION)/$(LIBJSIG_DIZ_NAME) \ +$(LIB_LOCATION)/$(SERVER_LOCATION)/$(LIBJSIG_DIZ_NAME): + @$(prep-target) + $(LN) -s ../$(LIBJSIG_DEBUGINFO_NAME) $(@D)/$(LIBJSIG_DEBUGINFO_NAME) + ( $(CD) $(@D) ; \ + $(ZIPEXE) -y $(LIBJSIG_DIZ_NAME) $(LIBJSIG_DEBUGINFO_NAME) ; \ + $(RM) $(LIBJSIG_DEBUGINFO_NAME) ; \ + ) + else $(LIB_LOCATION)/$(CLIENT_LOCATION)/$(LIBJSIG_DEBUGINFO_NAME) \ $(LIB_LOCATION)/$(SERVER_LOCATION)/$(LIBJSIG_DEBUGINFO_NAME): @$(prep-target) $(call install-sym-link, ../$(LIBJSIG_DEBUGINFO_NAME)) + endif endif else $(LIB_LOCATION)/$(CLIENT_LOCATION)/$(LIBJSIG_NAME): @@ -484,10 +495,22 @@ $(LIB_LOCATION)/$(CLIENT_LOCATION)/$(LIBJSIG_NAME): $(call install-sym-link, ../$(LIBJSIG_NAME)) ifeq ($(ENABLE_FULL_DEBUG_SYMBOLS),1) -# we don't create a symlink to a libjsig.diz file +# We don't create a symlink to a libjsig.diz file, but we do put +# the libjsig.debuginfo symlink into a libjsig.diz file. The aurora +# system does not like dangling symlinks. + ifeq ($(ZIP_DEBUGINFO_FILES),1) +$(LIB_LOCATION)/$(CLIENT_LOCATION)/$(LIBJSIG_DIZ_NAME): + @$(prep-target) + $(LN) -s ../$(LIBJSIG_DEBUGINFO_NAME) $(@D)/$(LIBJSIG_DEBUGINFO_NAME) + ( $(CD) $(@D) ; \ + $(ZIPEXE) -y $(LIBJSIG_DIZ_NAME) $(LIBJSIG_DEBUGINFO_NAME) ; \ + $(RM) $(LIBJSIG_DEBUGINFO_NAME) ; \ + ) + else $(LIB_LOCATION)/$(CLIENT_LOCATION)/$(LIBJSIG_DEBUGINFO_NAME): @$(prep-target) $(call install-sym-link, ../$(LIBJSIG_DEBUGINFO_NAME)) + endif endif endif From e49b6e7624fd15d0d6d281df95e6f99c137e5c80 Mon Sep 17 00:00:00 2001 From: Anton Tarasov Date: Thu, 17 May 2012 21:27:19 +0400 Subject: [PATCH 073/128] 7142565: [macosx] Many special keys processed twice in text fields Forward port from 7u4 Reviewed-by: anthony --- jdk/src/macosx/native/sun/awt/AWTView.m | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/jdk/src/macosx/native/sun/awt/AWTView.m b/jdk/src/macosx/native/sun/awt/AWTView.m index f737c4e8b87..16e8ed7aab3 100644 --- a/jdk/src/macosx/native/sun/awt/AWTView.m +++ b/jdk/src/macosx/native/sun/awt/AWTView.m @@ -48,7 +48,6 @@ //#define IM_DEBUG TRUE //#define EXTRA_DEBUG - static BOOL shouldUsePressAndHold() { static int shouldUsePressAndHold = -1; if (shouldUsePressAndHold != -1) return shouldUsePressAndHold; @@ -394,6 +393,13 @@ AWT_ASSERT_APPKIT_THREAD; } -(void) deliverJavaKeyEventHelper: (NSEvent *) event { + static id sUnretainedLastKeyEvent = nil; + if (event == sUnretainedLastKeyEvent) { + // The event is repeatedly delivered by keyDown: after performKeyEquivalent: + return; + } + sUnretainedLastKeyEvent = event; + [AWTToolkit eventCountPlusPlus]; JNIEnv *env = [ThreadUtilities getJNIEnv]; From 50220cd3d115c3f744e68a3065c13afb3ebb0992 Mon Sep 17 00:00:00 2001 From: Anton Tarasov Date: Thu, 17 May 2012 21:31:55 +0400 Subject: [PATCH 074/128] 7154072: [macosx] swallowing key events Forward posrt from 7u4 Reviewed-by: anthony --- jdk/src/macosx/native/sun/awt/AWTView.m | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/jdk/src/macosx/native/sun/awt/AWTView.m b/jdk/src/macosx/native/sun/awt/AWTView.m index 16e8ed7aab3..f46714c9ee9 100644 --- a/jdk/src/macosx/native/sun/awt/AWTView.m +++ b/jdk/src/macosx/native/sun/awt/AWTView.m @@ -393,12 +393,13 @@ AWT_ASSERT_APPKIT_THREAD; } -(void) deliverJavaKeyEventHelper: (NSEvent *) event { - static id sUnretainedLastKeyEvent = nil; - if (event == sUnretainedLastKeyEvent) { + static NSEvent* sLastKeyEvent = nil; + if (event == sLastKeyEvent) { // The event is repeatedly delivered by keyDown: after performKeyEquivalent: return; } - sUnretainedLastKeyEvent = event; + [sLastKeyEvent release]; + sLastKeyEvent = [event retain]; [AWTToolkit eventCountPlusPlus]; JNIEnv *env = [ThreadUtilities getJNIEnv]; From 781549f47d26e153d30b5a5c09eb4036c946c6df Mon Sep 17 00:00:00 2001 From: Anton Tarasov Date: Thu, 17 May 2012 21:48:57 +0400 Subject: [PATCH 075/128] 7125044: [macosx] Test failure because Component.transferFocus() works differently in applet and application Forward port from 7u4 Reviewed-by: art --- jdk/src/share/classes/java/awt/Dialog.java | 4 +- jdk/src/share/classes/java/awt/Frame.java | 2 +- jdk/src/share/classes/java/awt/Window.java | 2 +- .../share/classes/javax/swing/JApplet.java | 2 +- .../share/classes/javax/swing/JDialog.java | 2 +- jdk/src/share/classes/javax/swing/JFrame.java | 2 +- .../classes/javax/swing/JInternalFrame.java | 2 +- .../share/classes/javax/swing/JWindow.java | 2 +- .../share/classes/javax/swing/UIManager.java | 34 ++++-- jdk/src/share/classes/sun/awt/SunToolkit.java | 45 +------- .../FocusTraversalPolicy/InitialFTP.java | 26 +++++ .../FocusTraversalPolicy/InitialFTP_AWT.java | 50 +++++++++ .../InitialFTP_Swing.java | 46 ++++++++ .../SwallowKeyEvents/SwallowKeyEvents.java | 100 ++++++++++++++++++ 14 files changed, 258 insertions(+), 61 deletions(-) create mode 100644 jdk/test/java/awt/Focus/FocusTraversalPolicy/InitialFTP.java create mode 100644 jdk/test/java/awt/Focus/FocusTraversalPolicy/InitialFTP_AWT.java create mode 100644 jdk/test/java/awt/Focus/FocusTraversalPolicy/InitialFTP_Swing.java create mode 100644 jdk/test/java/awt/event/KeyEvent/SwallowKeyEvents/SwallowKeyEvents.java diff --git a/jdk/src/share/classes/java/awt/Dialog.java b/jdk/src/share/classes/java/awt/Dialog.java index 3faa9280abe..47f2f221c0d 100644 --- a/jdk/src/share/classes/java/awt/Dialog.java +++ b/jdk/src/share/classes/java/awt/Dialog.java @@ -670,7 +670,7 @@ public class Dialog extends Window { this.title = title; setModalityType(modalityType); - SunToolkit.checkAndSetPolicy(this, false); + SunToolkit.checkAndSetPolicy(this); } /** @@ -721,7 +721,7 @@ public class Dialog extends Window { this.title = title; setModalityType(modalityType); - SunToolkit.checkAndSetPolicy(this, false); + SunToolkit.checkAndSetPolicy(this); } /** diff --git a/jdk/src/share/classes/java/awt/Frame.java b/jdk/src/share/classes/java/awt/Frame.java index 4c6a46938c2..1a3173730e5 100644 --- a/jdk/src/share/classes/java/awt/Frame.java +++ b/jdk/src/share/classes/java/awt/Frame.java @@ -449,7 +449,7 @@ public class Frame extends Window implements MenuContainer { private void init(String title, GraphicsConfiguration gc) { this.title = title; - SunToolkit.checkAndSetPolicy(this, false); + SunToolkit.checkAndSetPolicy(this); } /** diff --git a/jdk/src/share/classes/java/awt/Window.java b/jdk/src/share/classes/java/awt/Window.java index 437e806b35c..984e287bd50 100644 --- a/jdk/src/share/classes/java/awt/Window.java +++ b/jdk/src/share/classes/java/awt/Window.java @@ -506,7 +506,7 @@ public class Window extends Container implements Accessible { modalExclusionType = Dialog.ModalExclusionType.NO_EXCLUDE; - SunToolkit.checkAndSetPolicy(this, false); + SunToolkit.checkAndSetPolicy(this); } /** diff --git a/jdk/src/share/classes/javax/swing/JApplet.java b/jdk/src/share/classes/javax/swing/JApplet.java index e36cd55e891..0da6c3e532a 100644 --- a/jdk/src/share/classes/javax/swing/JApplet.java +++ b/jdk/src/share/classes/javax/swing/JApplet.java @@ -149,7 +149,7 @@ public class JApplet extends Applet implements Accessible, setRootPaneCheckingEnabled(true); setFocusTraversalPolicyProvider(true); - sun.awt.SunToolkit.checkAndSetPolicy(this, true); + sun.awt.SunToolkit.checkAndSetPolicy(this); enableEvents(AWTEvent.KEY_EVENT_MASK); } diff --git a/jdk/src/share/classes/javax/swing/JDialog.java b/jdk/src/share/classes/javax/swing/JDialog.java index a4e35b66351..a53c4abe50c 100644 --- a/jdk/src/share/classes/javax/swing/JDialog.java +++ b/jdk/src/share/classes/javax/swing/JDialog.java @@ -654,7 +654,7 @@ public class JDialog extends Dialog implements WindowConstants, getRootPane().setWindowDecorationStyle(JRootPane.PLAIN_DIALOG); } } - sun.awt.SunToolkit.checkAndSetPolicy(this, true); + sun.awt.SunToolkit.checkAndSetPolicy(this); } /** diff --git a/jdk/src/share/classes/javax/swing/JFrame.java b/jdk/src/share/classes/javax/swing/JFrame.java index 3d5dea1f7cb..cccd6f98aa5 100644 --- a/jdk/src/share/classes/javax/swing/JFrame.java +++ b/jdk/src/share/classes/javax/swing/JFrame.java @@ -266,7 +266,7 @@ public class JFrame extends Frame implements WindowConstants, getRootPane().setWindowDecorationStyle(JRootPane.FRAME); } } - sun.awt.SunToolkit.checkAndSetPolicy(this, true); + sun.awt.SunToolkit.checkAndSetPolicy(this); } /** diff --git a/jdk/src/share/classes/javax/swing/JInternalFrame.java b/jdk/src/share/classes/javax/swing/JInternalFrame.java index 516ac9afb08..a0ba3a18084 100644 --- a/jdk/src/share/classes/javax/swing/JInternalFrame.java +++ b/jdk/src/share/classes/javax/swing/JInternalFrame.java @@ -349,7 +349,7 @@ public class JInternalFrame extends JComponent implements setRootPaneCheckingEnabled(true); desktopIcon = new JDesktopIcon(this); updateUI(); - sun.awt.SunToolkit.checkAndSetPolicy(this, true); + sun.awt.SunToolkit.checkAndSetPolicy(this); addPropertyChangeListenerIfNecessary(); } diff --git a/jdk/src/share/classes/javax/swing/JWindow.java b/jdk/src/share/classes/javax/swing/JWindow.java index 4a12d0205fb..f5d7b08a4bd 100644 --- a/jdk/src/share/classes/javax/swing/JWindow.java +++ b/jdk/src/share/classes/javax/swing/JWindow.java @@ -264,7 +264,7 @@ public class JWindow extends Window implements Accessible, setLocale( JComponent.getDefaultLocale() ); setRootPane(createRootPane()); setRootPaneCheckingEnabled(true); - sun.awt.SunToolkit.checkAndSetPolicy(this, true); + sun.awt.SunToolkit.checkAndSetPolicy(this); } /** diff --git a/jdk/src/share/classes/javax/swing/UIManager.java b/jdk/src/share/classes/javax/swing/UIManager.java index c3199d5f8d2..d135e34b5c9 100644 --- a/jdk/src/share/classes/javax/swing/UIManager.java +++ b/jdk/src/share/classes/javax/swing/UIManager.java @@ -191,6 +191,7 @@ public class UIManager implements Serializable private UIDefaults[] tables = new UIDefaults[2]; boolean initialized = false; + boolean focusPolicyInitialized = false; MultiUIDefaults multiUIDefaults = new MultiUIDefaults(tables); LookAndFeel lookAndFeel; LookAndFeel multiLookAndFeel = null; @@ -1000,6 +1001,7 @@ public class UIManager implements Serializable */ public static ComponentUI getUI(JComponent target) { maybeInitialize(); + maybeInitializeFocusPolicy(target); ComponentUI ui = null; LookAndFeel multiLAF = getLAFState().multiLookAndFeel; if (multiLAF != null) { @@ -1422,6 +1424,27 @@ public class UIManager implements Serializable } } + /* + * Sets default swing focus traversal policy. + */ + private static void maybeInitializeFocusPolicy(JComponent comp) { + // Check for JRootPane which indicates that a swing toplevel + // is coming, in which case a swing default focus policy + // should be instatiated. See 7125044. + if (comp instanceof JRootPane) { + synchronized (classLock) { + if (!getLAFState().focusPolicyInitialized) { + getLAFState().focusPolicyInitialized = true; + + if (FocusManager.isFocusManagerEnabled()) { + KeyboardFocusManager.getCurrentKeyboardFocusManager(). + setDefaultFocusTraversalPolicy( + new LayoutFocusTraversalPolicy()); + } + } + } + } + } /* * Only called by maybeInitialize(). @@ -1433,17 +1456,6 @@ public class UIManager implements Serializable initializeAuxiliaryLAFs(swingProps); initializeInstalledLAFs(swingProps); - // Enable the Swing default LayoutManager. - String toolkitName = Toolkit.getDefaultToolkit().getClass().getName(); - // don't set default policy if this is XAWT. - if (!"sun.awt.X11.XToolkit".equals(toolkitName)) { - if (FocusManager.isFocusManagerEnabled()) { - KeyboardFocusManager.getCurrentKeyboardFocusManager(). - setDefaultFocusTraversalPolicy( - new LayoutFocusTraversalPolicy()); - } - } - // Install Swing's PaintEventDispatcher if (RepaintManager.HANDLE_TOP_LEVEL_PAINT) { sun.awt.PaintEventDispatcher.setPaintEventDispatcher( diff --git a/jdk/src/share/classes/sun/awt/SunToolkit.java b/jdk/src/share/classes/sun/awt/SunToolkit.java index b63403961a6..a1c0d184eb9 100644 --- a/jdk/src/share/classes/sun/awt/SunToolkit.java +++ b/jdk/src/share/classes/sun/awt/SunToolkit.java @@ -461,48 +461,11 @@ public abstract class SunToolkit extends Toolkit AWTAccessor.getWindowAccessor().setLWRequestStatus(changed, status); }; - public static void checkAndSetPolicy(Container cont, boolean isSwingCont) - { - FocusTraversalPolicy defaultPolicy = KeyboardFocusManager - .getCurrentKeyboardFocusManager().getDefaultFocusTraversalPolicy(); + public static void checkAndSetPolicy(Container cont) { + FocusTraversalPolicy defaultPolicy = KeyboardFocusManager. + getCurrentKeyboardFocusManager(). + getDefaultFocusTraversalPolicy(); - String toolkitName = Toolkit.getDefaultToolkit().getClass().getName(); - // if this is not XAWT then use default policy - // because Swing change it - if (!"sun.awt.X11.XToolkit".equals(toolkitName)) { - cont.setFocusTraversalPolicy(defaultPolicy); - return; - } - - String policyName = defaultPolicy.getClass().getName(); - - if (DefaultFocusTraversalPolicy.class != defaultPolicy.getClass()) { - // Policy was changed - // Check if it is awt policy or swing policy - // If it is Swing policy we shouldn't use it in AWT frames - // If it is AWT policy we shouldn't use it in Swing frames - // Otherwise we should use this policy - if (policyName.startsWith("java.awt.")) { - // AWT - if (isSwingCont) { - // Can't use AWT policy in Swing windows - should use Swing's one. - defaultPolicy = createLayoutPolicy(); - } else { - // New awt policy. - } - } else if (policyName.startsWith("javax.swing.")) { - if (isSwingCont) { - // New Swing's policy - } else { - defaultPolicy = new DefaultFocusTraversalPolicy(); - } - } - } else { - // Policy is default, use different default policy for swing - if (isSwingCont) { - defaultPolicy = createLayoutPolicy(); - } - } cont.setFocusTraversalPolicy(defaultPolicy); } diff --git a/jdk/test/java/awt/Focus/FocusTraversalPolicy/InitialFTP.java b/jdk/test/java/awt/Focus/FocusTraversalPolicy/InitialFTP.java new file mode 100644 index 00000000000..44cf627ba51 --- /dev/null +++ b/jdk/test/java/awt/Focus/FocusTraversalPolicy/InitialFTP.java @@ -0,0 +1,26 @@ +/* + @test + @bug 7125044 + @summary Tests defaut focus traversal policy in AWT & Swing toplevel windows. + @author anton.tarasov@sun.com: area=awt.focus + @run main InitialFTP_AWT + @run main InitialFTP_Swing +*/ + +import java.awt.FocusTraversalPolicy; +import java.awt.Window; + +public class InitialFTP { + public static void test(Window win, Class expectedPolicy) { + FocusTraversalPolicy ftp = win.getFocusTraversalPolicy(); + + System.out.println("==============" + "\n" + + "Tested window: " + win + "\n" + + "Expected policy: " + expectedPolicy + "\n" + + "Effective policy: " + ftp.getClass()); + + if (!expectedPolicy.equals(ftp.getClass())) { + throw new RuntimeException("Test failed: wrong effective focus policy"); + } + } +} diff --git a/jdk/test/java/awt/Focus/FocusTraversalPolicy/InitialFTP_AWT.java b/jdk/test/java/awt/Focus/FocusTraversalPolicy/InitialFTP_AWT.java new file mode 100644 index 00000000000..b22117a1dec --- /dev/null +++ b/jdk/test/java/awt/Focus/FocusTraversalPolicy/InitialFTP_AWT.java @@ -0,0 +1,50 @@ +/* + @bug 7125044 + @summary Tests default focus traversal policy in AWT toplevel windows. + @author anton.tarasov@sun.com: area=awt.focus +*/ + +import java.awt.Button; +import java.awt.DefaultFocusTraversalPolicy; +import java.awt.FlowLayout; +import java.awt.FocusTraversalPolicy; +import java.awt.Frame; +import java.awt.List; +import java.awt.TextArea; +import java.awt.Window; + +public class InitialFTP_AWT { + public static void main(String[] args) { + AWTFrame f0 = new AWTFrame("frame0"); + f0.setVisible(true); + + InitialFTP.test(f0, DefaultFocusTraversalPolicy.class); + + AWTFrame f1 = new AWTFrame("frame1"); + f1.setVisible(true); + + InitialFTP.test(f1, DefaultFocusTraversalPolicy.class); + + System.out.println("Test passed."); + } +} + +class AWTFrame extends Frame { + Button button = new Button("button"); + TextArea text = new TextArea("qwerty"); + List list = new List(); + + public AWTFrame(String title) { + super(title); + + list.add("one"); + list.add("two"); + list.add("three"); + + this.setLayout(new FlowLayout()); + this.add(button); + this.add(text); + this.add(list); + this.pack(); + } +} diff --git a/jdk/test/java/awt/Focus/FocusTraversalPolicy/InitialFTP_Swing.java b/jdk/test/java/awt/Focus/FocusTraversalPolicy/InitialFTP_Swing.java new file mode 100644 index 00000000000..ab756220b6b --- /dev/null +++ b/jdk/test/java/awt/Focus/FocusTraversalPolicy/InitialFTP_Swing.java @@ -0,0 +1,46 @@ +/* + @bug 7125044 + @summary Tests default focus traversal policy in Swing toplevel windows. + @author anton.tarasov@sun.com: area=awt.focus +*/ + +import java.awt.FlowLayout; +import java.awt.FocusTraversalPolicy; +import java.awt.Window; +import javax.swing.JButton; +import javax.swing.JFrame; +import javax.swing.JList; +import javax.swing.JTextArea; +import javax.swing.LayoutFocusTraversalPolicy; + +public class InitialFTP_Swing { + public static void main(String[] args) { + SwingFrame f0 = new SwingFrame("frame0"); + f0.setVisible(true); + + InitialFTP.test(f0, LayoutFocusTraversalPolicy.class); + + SwingFrame f1 = new SwingFrame("frame1"); + f1.setVisible(true); + + InitialFTP.test(f1, LayoutFocusTraversalPolicy.class); + + System.out.println("Test passed."); + } +} + +class SwingFrame extends JFrame { + JButton button = new JButton("button"); + JTextArea text = new JTextArea("qwerty"); + JList list = new JList(new String[] {"one", "two", "three"}); + + public SwingFrame(String title) { + super(title); + + this.setLayout(new FlowLayout()); + this.add(button); + this.add(text); + this.add(list); + this.pack(); + } +} diff --git a/jdk/test/java/awt/event/KeyEvent/SwallowKeyEvents/SwallowKeyEvents.java b/jdk/test/java/awt/event/KeyEvent/SwallowKeyEvents/SwallowKeyEvents.java new file mode 100644 index 00000000000..c10094eed67 --- /dev/null +++ b/jdk/test/java/awt/event/KeyEvent/SwallowKeyEvents/SwallowKeyEvents.java @@ -0,0 +1,100 @@ +/* + * Copyright (c) 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. + */ + +/* + @test + @bug 7154072 + @summary Tests that key events with modifiers are not swallowed. + @author anton.tarasov: area=awt.focus + @library ../../../regtesthelpers + @build Util + @run main SwallowKeyEvents +*/ + +import java.awt.AWTException; +import java.awt.Frame; +import java.awt.Robot; +import java.awt.TextField; +import java.awt.event.KeyAdapter; +import java.awt.event.KeyEvent; +import test.java.awt.regtesthelpers.Util; + +public class SwallowKeyEvents { + static final int PRESS_COUNT = 10; + + static int keyPressedCount = 0; + + static Frame f = new Frame("Frame"); + static TextField t = new TextField("text"); + static Robot r; + + public static void main(String[] args) { + f.add(t); + f.pack(); + f.setVisible(true); + + t.requestFocus(); + + try { + r = new Robot(); + } catch (AWTException ex) { + throw new RuntimeException(ex); + } + + Util.waitForIdle(r); + + t.addKeyListener(new KeyAdapter() { + public void keyPressed(KeyEvent ke) { + System.out.println(ke); + if (ke.getKeyCode() == KeyEvent.VK_M) { + keyPressedCount++; + } + } + }); + + test(); + + System.out.println("key_pressed count: " + keyPressedCount); + + if (keyPressedCount != PRESS_COUNT) { + throw new RuntimeException("Test failed!"); + } else { + System.out.println("Test passed."); + } + } + + public static void test() { + r.keyPress(KeyEvent.VK_SHIFT); + r.keyPress(KeyEvent.VK_META); + + for (int i=0; i Date: Thu, 17 May 2012 22:10:40 +0400 Subject: [PATCH 076/128] 7145768: [macosx] Regression: failure in b11 of ModalDialogInFocusEventTest Forward port from 7u4 Reviewed-by: art --- .../classes/sun/lwawt/LWComponentPeer.java | 40 ++++++++++++++++++- .../classes/sun/lwawt/LWWindowPeer.java | 32 +++++++++------ 2 files changed, 57 insertions(+), 15 deletions(-) diff --git a/jdk/src/macosx/classes/sun/lwawt/LWComponentPeer.java b/jdk/src/macosx/classes/sun/lwawt/LWComponentPeer.java index 0b8b290f082..517973b98b5 100644 --- a/jdk/src/macosx/classes/sun/lwawt/LWComponentPeer.java +++ b/jdk/src/macosx/classes/sun/lwawt/LWComponentPeer.java @@ -56,6 +56,8 @@ import sun.java2d.SunGraphics2D; import sun.java2d.opengl.OGLRenderQueue; import sun.java2d.pipe.Region; +import sun.util.logging.PlatformLogger; + import javax.swing.JComponent; import javax.swing.SwingUtilities; import javax.swing.RepaintManager; @@ -65,7 +67,10 @@ import sun.lwawt.macosx.CDropTarget; import com.sun.java.swing.SwingUtilities3; public abstract class LWComponentPeer - implements ComponentPeer, DropTargetPeer { + implements ComponentPeer, DropTargetPeer +{ + private static final PlatformLogger focusLog = PlatformLogger.getLogger("sun.lwawt.focus.LWComponentPeer"); + // State lock is to be used for modifications to this // peer's fields (e.g. bounds, background, font, etc.) // It should be the last lock in the lock chain @@ -885,7 +890,13 @@ public abstract class LWComponentPeer @Override public boolean requestFocus(Component lightweightChild, boolean temporary, boolean focusedWindowChangeAllowed, long time, - CausedFocusEvent.Cause cause) { + CausedFocusEvent.Cause cause) + { + if (focusLog.isLoggable(PlatformLogger.FINEST)) { + focusLog.finest("lightweightChild=" + lightweightChild + ", temporary=" + temporary + + ", focusedWindowChangeAllowed=" + focusedWindowChangeAllowed + + ", time= " + time + ", cause=" + cause); + } if (LWKeyboardFocusManagerPeer.getInstance(getAppContext()). processSynchronousLightweightTransfer(getTarget(), lightweightChild, temporary, focusedWindowChangeAllowed, time)) { @@ -901,19 +912,44 @@ public abstract class LWComponentPeer case LWKeyboardFocusManagerPeer.SNFH_SUCCESS_PROCEED: Window parentWindow = SunToolkit.getContainingWindow(getTarget()); if (parentWindow == null) { + focusLog.fine("request rejected, parentWindow is null"); LWKeyboardFocusManagerPeer.removeLastFocusRequest(getTarget()); return false; } LWWindowPeer parentPeer = (LWWindowPeer) parentWindow.getPeer(); if (parentPeer == null) { + focusLog.fine("request rejected, parentPeer is null"); LWKeyboardFocusManagerPeer.removeLastFocusRequest(getTarget()); return false; } + // A fix for 7145768. Ensure the parent window is currently natively focused. + // The more evident place to perform this check is in KFM.shouldNativelyFocusHeavyweight, + // however that is the shared code and this particular problem's reproducibility has + // platform specifics. So, it was decided to narrow down the fix to lwawt (OSX) in + // current release. TODO: consider fixing it in the shared code. + if (!focusedWindowChangeAllowed) { + LWWindowPeer decoratedPeer = parentPeer.isSimpleWindow() ? + LWWindowPeer.getOwnerFrameDialog(parentPeer) : parentPeer; + + if (decoratedPeer == null || !decoratedPeer.getPlatformWindow().isActive()) { + if (focusLog.isLoggable(PlatformLogger.FINE)) { + focusLog.fine("request rejected, focusedWindowChangeAllowed==false, " + + "decoratedPeer is inactive: " + decoratedPeer); + } + LWKeyboardFocusManagerPeer.removeLastFocusRequest(getTarget()); + return false; + } + } + boolean res = parentPeer.requestWindowFocus(cause); // If parent window can be made focused and has been made focused (synchronously) // then we can proceed with children, otherwise we retreat if (!res || !parentWindow.isFocused()) { + if (focusLog.isLoggable(PlatformLogger.FINE)) { + focusLog.fine("request rejected, res= " + res + ", parentWindow.isFocused()=" + + parentWindow.isFocused()); + } LWKeyboardFocusManagerPeer.removeLastFocusRequest(getTarget()); return false; } diff --git a/jdk/src/macosx/classes/sun/lwawt/LWWindowPeer.java b/jdk/src/macosx/classes/sun/lwawt/LWWindowPeer.java index 82d97c01aaa..997e4740040 100644 --- a/jdk/src/macosx/classes/sun/lwawt/LWWindowPeer.java +++ b/jdk/src/macosx/classes/sun/lwawt/LWWindowPeer.java @@ -50,7 +50,7 @@ public class LWWindowPeer EMBEDDEDFRAME } - private static final sun.util.logging.PlatformLogger focusLog = PlatformLogger.getLogger("sun.lwawt.focus.LWWindowPeer"); + private static final PlatformLogger focusLog = PlatformLogger.getLogger("sun.lwawt.focus.LWWindowPeer"); private PlatformWindow platformWindow; @@ -245,15 +245,17 @@ public class LWWindowPeer getInstance(getAppContext()); if (visible) { - updateFocusableWindowState(); - changeFocusedWindow(true, true); - + if (!getTarget().isAutoRequestFocus()) { + return; + } else { + requestWindowFocus(CausedFocusEvent.Cause.ACTIVATION); + } // Focus the owner in case this window is focused. } else if (manager.getCurrentFocusedWindow() == getTarget()) { + // Transfer focus to the owner. LWWindowPeer owner = getOwnerFrameDialog(LWWindowPeer.this); if (owner != null) { - // KFM will do all the rest. - owner.changeFocusedWindow(true, false); + owner.requestWindowFocus(CausedFocusEvent.Cause.ACTIVATION); } } } @@ -619,7 +621,7 @@ public class LWWindowPeer } public void notifyActivation(boolean activation) { - changeFocusedWindow(activation, false); + changeFocusedWindow(activation); } // MouseDown in non-client area @@ -1065,6 +1067,10 @@ public class LWWindowPeer return lastMouseEventPeer; } + /* + * Requests platform to set native focus on a frame/dialog. + * In case of a simple window, triggers appropriate java focus change. + */ public boolean requestWindowFocus(CausedFocusEvent.Cause cause) { if (focusLog.isLoggable(PlatformLogger.FINE)) { focusLog.fine("requesting native focus to " + this); @@ -1108,14 +1114,14 @@ public class LWWindowPeer } // DKFM will synthesize all the focus/activation events correctly. - changeFocusedWindow(true, false); + changeFocusedWindow(true); return true; // In case the toplevel is active but not focused, change focus directly, // as requesting native focus on it will not have effect. } else if (getTarget() == currentActive && !getTarget().hasFocus()) { - changeFocusedWindow(true, false); + changeFocusedWindow(true); return true; } return platformWindow.requestWindowFocus(); @@ -1133,13 +1139,13 @@ public class LWWindowPeer } /* - * "Delegates" the responsibility of managing focus to keyboard focus manager. + * Changes focused window on java level. */ - private void changeFocusedWindow(boolean becomesFocused, boolean isShowing) { + private void changeFocusedWindow(boolean becomesFocused) { if (focusLog.isLoggable(PlatformLogger.FINE)) { focusLog.fine((becomesFocused?"gaining":"loosing") + " focus window: " + this); } - if (isShowing && !getTarget().isAutoRequestFocus() || skipNextFocusChange) { + if (skipNextFocusChange) { focusLog.fine("skipping focus change"); skipNextFocusChange = false; return; @@ -1184,7 +1190,7 @@ public class LWWindowPeer postEvent(windowEvent); } - private static LWWindowPeer getOwnerFrameDialog(LWWindowPeer peer) { + static LWWindowPeer getOwnerFrameDialog(LWWindowPeer peer) { Window owner = (peer != null ? peer.getTarget().getOwner() : null); while (owner != null && !(owner instanceof Frame || owner instanceof Dialog)) { owner = owner.getOwner(); From 4a46c4fa607e84ac968fb7fb3a1dd9dd05e29ad0 Mon Sep 17 00:00:00 2001 From: Anton Tarasov Date: Thu, 17 May 2012 22:21:27 +0400 Subject: [PATCH 077/128] 7145827: [macosx] JCK failure in b11: FocusableWindow3 Forward posrt from 7u4 Reviewed-by: art --- .../classes/sun/lwawt/LWWindowPeer.java | 23 ++++++++++++------- 1 file changed, 15 insertions(+), 8 deletions(-) diff --git a/jdk/src/macosx/classes/sun/lwawt/LWWindowPeer.java b/jdk/src/macosx/classes/sun/lwawt/LWWindowPeer.java index 997e4740040..f5617772458 100644 --- a/jdk/src/macosx/classes/sun/lwawt/LWWindowPeer.java +++ b/jdk/src/macosx/classes/sun/lwawt/LWWindowPeer.java @@ -101,8 +101,6 @@ public class LWWindowPeer // events between MOUSE_PRESSED and MOUSE_RELEASED for particular button private static int mouseClickButtons = 0; - private volatile boolean cachedFocusableWindow; - private volatile boolean isOpaque = true; private static final Font DEFAULT_FONT = new Font("Lucida Grande", Font.PLAIN, 13); @@ -172,8 +170,6 @@ public class LWWindowPeer setAlwaysOnTop(getTarget().isAlwaysOnTop()); updateMinimumSize(); - cachedFocusableWindow = getTarget().isFocusableWindow(); - setOpacity(getTarget().getOpacity()); setOpaque(getTarget().isOpaque()); @@ -402,7 +398,6 @@ public class LWWindowPeer @Override public void updateFocusableWindowState() { - cachedFocusableWindow = getTarget().isFocusableWindow(); platformWindow.updateFocusableWindowState(); } @@ -1130,7 +1125,19 @@ public class LWWindowPeer private boolean focusAllowedFor() { Window window = getTarget(); // TODO: check if modal blocked - return window.isVisible() && window.isEnabled() && window.isFocusableWindow(); + return window.isVisible() && window.isEnabled() && isFocusableWindow(); + } + + private boolean isFocusableWindow() { + boolean focusable = getTarget().isFocusableWindow(); + if (isSimpleWindow()) { + LWWindowPeer ownerPeer = getOwnerFrameDialog(this); + if (ownerPeer == null) { + return false; + } + return focusable && ownerPeer.getTarget().isFocusableWindow(); + } + return focusable; } public boolean isSimpleWindow() { @@ -1150,8 +1157,8 @@ public class LWWindowPeer skipNextFocusChange = false; return; } - - if (!cachedFocusableWindow) { + if (!isFocusableWindow() && becomesFocused) { + focusLog.fine("the window is not focusable"); return; } if (becomesFocused) { From 6e3096a0fa032bddcbd9db719b46b0cf40f13c83 Mon Sep 17 00:00:00 2001 From: Bengt Rutisson Date: Thu, 17 May 2012 21:53:40 +0200 Subject: [PATCH 078/128] 7169062: CMS: Assertion failed with -XX:+ObjectAlignmentInBytes=64 Removed the assert in CompactibleFreeListSpace::check_free_list_consistency() since it was too strict. Simplified CompactibleFreeListSpace::set_cms_values() to reducde the need for asserts. Reviewed-by: jcoomes, stefank --- .../compactibleFreeListSpace.cpp | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/compactibleFreeListSpace.cpp b/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/compactibleFreeListSpace.cpp index 121829113c7..6ba15a2f240 100644 --- a/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/compactibleFreeListSpace.cpp +++ b/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/compactibleFreeListSpace.cpp @@ -58,8 +58,11 @@ size_t MinChunkSize = 0; void CompactibleFreeListSpace::set_cms_values() { // Set CMS global values assert(MinChunkSize == 0, "already set"); - #define numQuanta(x,y) ((x+y-1)/y) - MinChunkSize = numQuanta(sizeof(FreeChunk), MinObjAlignmentInBytes) * MinObjAlignment; + + // MinChunkSize should be a multiple of MinObjAlignment and be large enough + // for chunks to contain a FreeChunk. + size_t min_chunk_size_in_bytes = align_size_up(sizeof(FreeChunk), MinObjAlignmentInBytes); + MinChunkSize = min_chunk_size_in_bytes / BytesPerWord; assert(IndexSetStart == 0 && IndexSetStride == 0, "already set"); IndexSetStart = MinChunkSize; @@ -2534,12 +2537,8 @@ void CompactibleFreeListSpace::check_free_list_consistency() const { " linear allocation buffers"); assert(BinaryTreeDictionary::min_tree_chunk_size*HeapWordSize == sizeof(TreeChunk), "else MIN_TREE_CHUNK_SIZE is wrong"); - assert((IndexSetStride == 2 && IndexSetStart == 4) || // 32-bit - (IndexSetStride == 1 && IndexSetStart == 3), "just checking"); // 64-bit - assert((IndexSetStride != 2) || (IndexSetStart % 2 == 0), - "Some for-loops may be incorrectly initialized"); - assert((IndexSetStride != 2) || (IndexSetSize % 2 == 1), - "For-loops that iterate over IndexSet with stride 2 may be wrong"); + assert(IndexSetStart != 0, "IndexSetStart not initialized"); + assert(IndexSetStride != 0, "IndexSetStride not initialized"); } #endif From 890b6d7ba8b3e8438ff9140356f95b4ca648db11 Mon Sep 17 00:00:00 2001 From: Rob McKenna Date: Thu, 17 May 2012 22:42:32 +0100 Subject: [PATCH 079/128] 7168110: Misleading jstack error message Reviewed-by: alanb, dsamersoff --- .../native/sun/tools/attach/WindowsVirtualMachine.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/jdk/src/windows/native/sun/tools/attach/WindowsVirtualMachine.c b/jdk/src/windows/native/sun/tools/attach/WindowsVirtualMachine.c index a956730d8ca..2ee38039823 100644 --- a/jdk/src/windows/native/sun/tools/attach/WindowsVirtualMachine.c +++ b/jdk/src/windows/native/sun/tools/attach/WindowsVirtualMachine.c @@ -466,7 +466,17 @@ JNIEXPORT void JNICALL Java_sun_tools_attach_WindowsVirtualMachine_enqueue } CloseHandle(hThread); } else { - JNU_ThrowIOExceptionWithLastError(env, "CreateRemoteThread failed"); + if (GetLastError() == ERROR_NOT_ENOUGH_MEMORY) { + // + // This error will occur when attaching to a process belonging to + // another terminal session. See "Remarks": + // http://msdn.microsoft.com/en-us/library/ms682437%28VS.85%29.aspx + // + JNU_ThrowIOException(env, + "Insufficient memory or insufficient privileges to attach"); + } else { + JNU_ThrowIOExceptionWithLastError(env, "CreateRemoteThread failed"); + } } VirtualFreeEx(hProcess, pCode, 0, MEM_RELEASE); From 955e0697ba1b2de891ded69c8d4befafaddd73dc Mon Sep 17 00:00:00 2001 From: Xue-Lei Andrew Fan Date: Thu, 17 May 2012 21:59:26 -0700 Subject: [PATCH 080/128] 7145960: sun/security/mscapi/ShortRSAKey1024.sh failing on windows Reviewed-by: vinnie, wetmore --- .../sun/security/mscapi/ShortRSAKey1024.sh | 25 +++++++++++++++---- .../sun/security/mscapi/ShortRSAKey512.sh | 25 +++++++++++++++---- .../sun/security/mscapi/ShortRSAKey768.sh | 25 +++++++++++++++---- 3 files changed, 60 insertions(+), 15 deletions(-) diff --git a/jdk/test/sun/security/mscapi/ShortRSAKey1024.sh b/jdk/test/sun/security/mscapi/ShortRSAKey1024.sh index b446143ecb1..9caeed46c39 100644 --- a/jdk/test/sun/security/mscapi/ShortRSAKey1024.sh +++ b/jdk/test/sun/security/mscapi/ShortRSAKey1024.sh @@ -46,11 +46,20 @@ if [ "${TESTJAVA}" = "" ] ; then fi OS=`uname -s` +case "$OS" in + SunOS | Linux | Darwin | CYGWIN* ) + FS="/" + ;; + Windows_* ) + FS="\\" + ;; +esac + case "$OS" in Windows* | CYGWIN* ) echo "Creating a temporary RSA keypair in the Windows-My store..." - ${TESTJAVA}/bin/keytool \ + ${TESTJAVA}${FS}bin${FS}keytool \ -genkeypair \ -storetype Windows-My \ -keyalg RSA \ @@ -59,22 +68,28 @@ case "$OS" in -dname "cn=localhost,c=US" \ -noprompt + if [ "$?" -ne "0" ]; then + echo "Unable to generate key pair in Windows-My keystore" + exit 1 + fi + echo echo "Running the test..." - ${TESTJAVA}/bin/javac -d . ${TESTSRC}\\ShortRSAKeyWithinTLS.java - ${TESTJAVA}/bin/java ShortRSAKeyWithinTLS 7106773.1024 1024 \ + ${TESTJAVA}${FS}bin${FS}javac -d . \ + ${TESTSRC}${FS}ShortRSAKeyWithinTLS.java + ${TESTJAVA}${FS}bin${FS}java ShortRSAKeyWithinTLS 7106773.1024 1024 \ TLSv1.2 TLS_DHE_RSA_WITH_AES_128_CBC_SHA rc=$? echo echo "Removing the temporary RSA keypair from the Windows-My store..." - ${TESTJAVA}/bin/keytool \ + ${TESTJAVA}${FS}bin${FS}keytool \ -delete \ -storetype Windows-My \ -alias 7106773.1024 - echo done. + echo "Done". exit $rc ;; diff --git a/jdk/test/sun/security/mscapi/ShortRSAKey512.sh b/jdk/test/sun/security/mscapi/ShortRSAKey512.sh index e4cae406383..b8cb84076a3 100644 --- a/jdk/test/sun/security/mscapi/ShortRSAKey512.sh +++ b/jdk/test/sun/security/mscapi/ShortRSAKey512.sh @@ -46,11 +46,20 @@ if [ "${TESTJAVA}" = "" ] ; then fi OS=`uname -s` +case "$OS" in + SunOS | Linux | Darwin | CYGWIN* ) + FS="/" + ;; + Windows_* ) + FS="\\" + ;; +esac + case "$OS" in Windows* | CYGWIN* ) echo "Creating a temporary RSA keypair in the Windows-My store..." - ${TESTJAVA}/bin/keytool \ + ${TESTJAVA}${FS}bin${FS}keytool \ -genkeypair \ -storetype Windows-My \ -keyalg RSA \ @@ -59,10 +68,16 @@ case "$OS" in -dname "cn=localhost,c=US" \ -noprompt + if [ "$?" -ne "0" ]; then + echo "Unable to generate key pair in Windows-My keystore" + exit 1 + fi + echo echo "Running the test..." - ${TESTJAVA}/bin/javac -d . ${TESTSRC}\\ShortRSAKeyWithinTLS.java - ${TESTJAVA}/bin/java ShortRSAKeyWithinTLS 7106773.512 512 \ + ${TESTJAVA}${FS}bin${FS}javac -d . \ + ${TESTSRC}${FS}ShortRSAKeyWithinTLS.java + ${TESTJAVA}${FS}bin${FS}java ShortRSAKeyWithinTLS 7106773.512 512 \ TLSv1.2 TLS_DHE_RSA_WITH_AES_128_CBC_SHA @@ -70,12 +85,12 @@ case "$OS" in echo echo "Removing the temporary RSA keypair from the Windows-My store..." - ${TESTJAVA}/bin/keytool \ + ${TESTJAVA}${FS}bin${FS}keytool \ -delete \ -storetype Windows-My \ -alias 7106773.512 - echo done. + echo "Done". exit $rc ;; diff --git a/jdk/test/sun/security/mscapi/ShortRSAKey768.sh b/jdk/test/sun/security/mscapi/ShortRSAKey768.sh index a81903b818c..0732f9a1029 100644 --- a/jdk/test/sun/security/mscapi/ShortRSAKey768.sh +++ b/jdk/test/sun/security/mscapi/ShortRSAKey768.sh @@ -46,11 +46,20 @@ if [ "${TESTJAVA}" = "" ] ; then fi OS=`uname -s` +case "$OS" in + SunOS | Linux | Darwin | CYGWIN* ) + FS="/" + ;; + Windows_* ) + FS="\\" + ;; +esac + case "$OS" in Windows* | CYGWIN* ) echo "Creating a temporary RSA keypair in the Windows-My store..." - ${TESTJAVA}/bin/keytool \ + ${TESTJAVA}${FS}bin${FS}keytool \ -genkeypair \ -storetype Windows-My \ -keyalg RSA \ @@ -59,22 +68,28 @@ case "$OS" in -dname "cn=localhost,c=US" \ -noprompt + if [ "$?" -ne "0" ]; then + echo "Unable to generate key pair in Windows-My keystore" + exit 1 + fi + echo echo "Running the test..." - ${TESTJAVA}/bin/javac -d . ${TESTSRC}\\ShortRSAKeyWithinTLS.java - ${TESTJAVA}/bin/java ShortRSAKeyWithinTLS 7106773.768 768 \ + ${TESTJAVA}${FS}bin${FS}javac -d . \ + ${TESTSRC}${FS}ShortRSAKeyWithinTLS.java + ${TESTJAVA}${FS}bin${FS}java ShortRSAKeyWithinTLS 7106773.768 768 \ TLSv1.2 TLS_DHE_RSA_WITH_AES_128_CBC_SHA rc=$? echo echo "Removing the temporary RSA keypair from the Windows-My store..." - ${TESTJAVA}/bin/keytool \ + ${TESTJAVA}${FS}bin${FS}keytool \ -delete \ -storetype Windows-My \ -alias 7106773.768 - echo done. + echo "Done". exit $rc ;; From 285f7e064046f73807d8f5bf9b414c55d0545df3 Mon Sep 17 00:00:00 2001 From: Roland Westrelin Date: Fri, 18 May 2012 15:50:09 +0200 Subject: [PATCH 081/128] 7167254: Crash on OSX in Enumerator.nextElement() with compressed oops Null checks in "compressed oops with base" mode may trigger a SIGBUS rather than a SIGSEGV. Reviewed-by: dsamersoff, dcubed, rbackman, kvn --- hotspot/src/os_cpu/bsd_x86/vm/os_bsd_x86.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/hotspot/src/os_cpu/bsd_x86/vm/os_bsd_x86.cpp b/hotspot/src/os_cpu/bsd_x86/vm/os_bsd_x86.cpp index 12d6871ca04..2806e79ea4a 100644 --- a/hotspot/src/os_cpu/bsd_x86/vm/os_bsd_x86.cpp +++ b/hotspot/src/os_cpu/bsd_x86/vm/os_bsd_x86.cpp @@ -522,11 +522,12 @@ JVM_handle_bsd_signal(int sig, if ((sig == SIGSEGV || sig == SIGBUS) && os::is_poll_address((address)info->si_addr)) { stub = SharedRuntime::get_poll_stub(pc); -#if defined(__APPLE__) && !defined(AMD64) +#if defined(__APPLE__) // 32-bit Darwin reports a SIGBUS for nearly all memory access exceptions. + // 64-bit Darwin may also use a SIGBUS (seen with compressed oops). // Catching SIGBUS here prevents the implicit SIGBUS NULL check below from // being called, so only do so if the implicit NULL check is not necessary. - } else if (sig == SIGBUS && MacroAssembler::needs_explicit_null_check((int)info->si_addr)) { + } else if (sig == SIGBUS && MacroAssembler::needs_explicit_null_check((intptr_t)info->si_addr)) { #else } else if (sig == SIGBUS /* && info->si_code == BUS_OBJERR */) { #endif From 7f4d14efbe41ed07e4190a5268eea2d57de514aa Mon Sep 17 00:00:00 2001 From: Dmitry Cherepanov Date: Fri, 18 May 2012 19:39:24 +0400 Subject: [PATCH 082/128] 7156191: [macosx] Can't type into applet demos in Pivot Reviewed-by: art --- .../sun/lwawt/macosx/CEmbeddedFrame.java | 21 ++++++------------- .../sun/lwawt/macosx/CPlatformResponder.java | 4 ++++ .../sun/lwawt/macosx/CPlatformView.java | 4 ++-- .../sun/lwawt/macosx/CPlatformWindow.java | 6 ++++-- 4 files changed, 16 insertions(+), 19 deletions(-) diff --git a/jdk/src/macosx/classes/sun/lwawt/macosx/CEmbeddedFrame.java b/jdk/src/macosx/classes/sun/lwawt/macosx/CEmbeddedFrame.java index fa711c9a9d2..2415ff7d8d8 100644 --- a/jdk/src/macosx/classes/sun/lwawt/macosx/CEmbeddedFrame.java +++ b/jdk/src/macosx/classes/sun/lwawt/macosx/CEmbeddedFrame.java @@ -112,28 +112,19 @@ public class CEmbeddedFrame extends EmbeddedFrame { public void handleFocusEvent(boolean focused) { this.focused = focused; - updateOverlayWindowActiveState(); + if (parentWindowActive) { + responder.handleWindowFocusEvent(focused); + } } public void handleWindowFocusEvent(boolean parentWindowActive) { this.parentWindowActive = parentWindowActive; - updateOverlayWindowActiveState(); + if (focused) { + responder.handleWindowFocusEvent(parentWindowActive); + } } public boolean isParentWindowActive() { return parentWindowActive; } - - /* - * May change appearance of contents of window, and generate a - * WINDOW_ACTIVATED event. - */ - private void updateOverlayWindowActiveState() { - final boolean showAsFocused = parentWindowActive && focused; - dispatchEvent( - new FocusEvent(this, showAsFocused ? - FocusEvent.FOCUS_GAINED : - FocusEvent.FOCUS_LOST)); - } - } diff --git a/jdk/src/macosx/classes/sun/lwawt/macosx/CPlatformResponder.java b/jdk/src/macosx/classes/sun/lwawt/macosx/CPlatformResponder.java index 739e5679008..aa5c616b428 100644 --- a/jdk/src/macosx/classes/sun/lwawt/macosx/CPlatformResponder.java +++ b/jdk/src/macosx/classes/sun/lwawt/macosx/CPlatformResponder.java @@ -204,4 +204,8 @@ final class CPlatformResponder { } } } + + void handleWindowFocusEvent(boolean gained) { + peer.notifyActivation(gained); + } } diff --git a/jdk/src/macosx/classes/sun/lwawt/macosx/CPlatformView.java b/jdk/src/macosx/classes/sun/lwawt/macosx/CPlatformView.java index 77a81e0d78f..5c072a69800 100644 --- a/jdk/src/macosx/classes/sun/lwawt/macosx/CPlatformView.java +++ b/jdk/src/macosx/classes/sun/lwawt/macosx/CPlatformView.java @@ -49,9 +49,9 @@ public class CPlatformView extends CFRetainedResource { super(0, true); } - public void initialize(LWWindowPeer peer) { + public void initialize(LWWindowPeer peer, CPlatformResponder responder) { this.peer = peer; - this.responder = new CPlatformResponder(peer, false); + this.responder = responder; if (!LWCToolkit.getSunAwtDisableCALayers()) { this.windowLayer = new CGLLayer(peer); diff --git a/jdk/src/macosx/classes/sun/lwawt/macosx/CPlatformWindow.java b/jdk/src/macosx/classes/sun/lwawt/macosx/CPlatformWindow.java index efad23e636e..2d7cfea3941 100644 --- a/jdk/src/macosx/classes/sun/lwawt/macosx/CPlatformWindow.java +++ b/jdk/src/macosx/classes/sun/lwawt/macosx/CPlatformWindow.java @@ -208,6 +208,7 @@ public class CPlatformWindow extends CFRetainedResource implements PlatformWindo private boolean visible = false; // visibility status from native perspective private boolean undecorated; // initialized in getInitialStyleBits() private Rectangle normalBounds = null; // not-null only for undecorated maximized windows + private CPlatformResponder responder; public CPlatformWindow(final PeerType peerType) { super(0, true); @@ -232,8 +233,9 @@ public class CPlatformWindow extends CFRetainedResource implements PlatformWindo final long parentNSWindowPtr = (owner != null ? owner.getNSWindowPtr() : 0); String warningString = target.getWarningString(); + responder = new CPlatformResponder(peer, false); contentView = new CPlatformView(); - contentView.initialize(peer); + contentView.initialize(peer, responder); final long nativeWindowPtr = nativeCreateNSWindow(contentView.getAWTView(), styleBits, 0, 0, 0, 0); setPtr(nativeWindowPtr); @@ -865,7 +867,7 @@ public class CPlatformWindow extends CFRetainedResource implements PlatformWindo focusLogger.fine("the app is inactive, so the notification is ignored"); return; } - peer.notifyActivation(gained); + responder.handleWindowFocusEvent(gained); } private void deliverMoveResizeEvent(int x, int y, int width, int height) { From 5ea3d5b1ea764006459cde47d283982cd0db7a68 Mon Sep 17 00:00:00 2001 From: "Daniel D. Daugherty" Date: Fri, 18 May 2012 09:15:15 -0700 Subject: [PATCH 083/128] 7170010: conditional "ZIP_DEBUGINFO_FILES ?= 0" setting is not reliable on Windows Always disable ZIP_DEBUGINFO_FILES on Windows. Reviewed-by: acorn --- hotspot/make/windows/makefiles/defs.make | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/hotspot/make/windows/makefiles/defs.make b/hotspot/make/windows/makefiles/defs.make index a1c88284cc2..8037a7b4070 100644 --- a/hotspot/make/windows/makefiles/defs.make +++ b/hotspot/make/windows/makefiles/defs.make @@ -145,7 +145,12 @@ MAKE_ARGS += ENABLE_FULL_DEBUG_SYMBOLS=$(ENABLE_FULL_DEBUG_SYMBOLS) ifeq ($(ENABLE_FULL_DEBUG_SYMBOLS),1) # Disable ZIP_DEBUGINFO_FILES by default because various tests are # failing in nightly when the debug info files are ZIP'ed. - ZIP_DEBUGINFO_FILES ?= 0 + #ZIP_DEBUGINFO_FILES ?= 0 + # The above conditional setting logic is unreliable on Windows for + # unknown reasons. We force ZIP_DEBUGINFO_FILES to be disabled on + # Windows until we figure out why the various tests are failing + # AND why the conditional setting logic is unreliable. + ZIP_DEBUGINFO_FILES=0 else ZIP_DEBUGINFO_FILES=0 endif From 100eb2036d51a9c44274011ada68fc69d788d639 Mon Sep 17 00:00:00 2001 From: Krystal Mok Date: Fri, 18 May 2012 12:20:24 -0700 Subject: [PATCH 084/128] 7170053: crash in C2 when using -XX:+CountCompiledCalls Reviewed-by: kvn, twisti --- hotspot/src/share/vm/opto/doCall.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hotspot/src/share/vm/opto/doCall.cpp b/hotspot/src/share/vm/opto/doCall.cpp index fdbbc108b18..f90f1eac0d4 100644 --- a/hotspot/src/share/vm/opto/doCall.cpp +++ b/hotspot/src/share/vm/opto/doCall.cpp @@ -780,7 +780,7 @@ void Parse::count_compiled_calls(bool at_method_entry, bool is_inline) { if( at_method_entry ) { // bump invocation counter if top method (for statistics) if (CountCompiledCalls && depth() == 1) { - const TypeInstPtr* addr_type = TypeInstPtr::make(method()); + const TypeOopPtr* addr_type = TypeOopPtr::make_from_constant(method()); Node* adr1 = makecon(addr_type); Node* adr2 = basic_plus_adr(adr1, adr1, in_bytes(methodOopDesc::compiled_invocation_counter_offset())); increment_counter(adr2); From 2321d8e2b63e94a9f10547fc400c05e648c5bcba Mon Sep 17 00:00:00 2001 From: Valerie Peng Date: Fri, 18 May 2012 12:29:33 -0700 Subject: [PATCH 085/128] 7169496: Problem with the SHA-224 support for SunMSCAPI provider Remove SHA224withRSA signature from SunMSCAPI provider due to lack of windows support. Reviewed-by: vinnie --- .../classes/sun/security/mscapi/RSASignature.java | 11 +---------- .../classes/sun/security/mscapi/SunMSCAPI.java | 8 +------- .../sun/security/mscapi/SignUsingNONEwithRSA.java | 6 ------ .../sun/security/mscapi/SignUsingSHA2withRSA.java | 4 ---- 4 files changed, 2 insertions(+), 27 deletions(-) diff --git a/jdk/src/windows/classes/sun/security/mscapi/RSASignature.java b/jdk/src/windows/classes/sun/security/mscapi/RSASignature.java index f29a62af583..d8d8849e13c 100644 --- a/jdk/src/windows/classes/sun/security/mscapi/RSASignature.java +++ b/jdk/src/windows/classes/sun/security/mscapi/RSASignature.java @@ -47,7 +47,6 @@ import sun.security.rsa.RSAKeyFactory; * * . "NONEwithRSA" * . "SHA1withRSA" - * . "SHA224withRSA" * . "SHA256withRSA" * . "SHA384withRSA" * . "SHA512withRSA" @@ -58,7 +57,7 @@ import sun.security.rsa.RSAKeyFactory; * * NOTE: NONEwithRSA must be supplied with a pre-computed message digest. * Only the following digest algorithms are supported: MD5, SHA-1, - * SHA-224, SHA-256, SHA-384, SHA-512 and a special-purpose digest + * SHA-256, SHA-384, SHA-512 and a special-purpose digest * algorithm which is a concatenation of SHA-1 and MD5 digests. * * @since 1.6 @@ -181,8 +180,6 @@ abstract class RSASignature extends java.security.SignatureSpi setDigestName("SHA-512"); } else if (offset == 16) { setDigestName("MD5"); - } else if (offset == 28) { - setDigestName("SHA-224"); } else { throw new SignatureException( "Message digest length is not supported"); @@ -202,12 +199,6 @@ abstract class RSASignature extends java.security.SignatureSpi } } - public static final class SHA224 extends RSASignature { - public SHA224() { - super("SHA-224"); - } - } - public static final class SHA256 extends RSASignature { public SHA256() { super("SHA-256"); diff --git a/jdk/src/windows/classes/sun/security/mscapi/SunMSCAPI.java b/jdk/src/windows/classes/sun/security/mscapi/SunMSCAPI.java index bcba08c739a..1af669415ee 100644 --- a/jdk/src/windows/classes/sun/security/mscapi/SunMSCAPI.java +++ b/jdk/src/windows/classes/sun/security/mscapi/SunMSCAPI.java @@ -81,16 +81,12 @@ public final class SunMSCAPI extends Provider { */ // NONEwithRSA must be supplied with a pre-computed message digest. // Only the following digest algorithms are supported: MD5, SHA-1, - // SHA-224, SHA-256, SHA-384, SHA-512 and a special-purpose digest + // SHA-256, SHA-384, SHA-512 and a special-purpose digest // algorithm which is a concatenation of SHA-1 and MD5 digests. map.put("Signature.NONEwithRSA", "sun.security.mscapi.RSASignature$Raw"); map.put("Signature.SHA1withRSA", "sun.security.mscapi.RSASignature$SHA1"); - map.put("Signature.SHA224withRSA", - "sun.security.mscapi.RSASignature$SHA224"); - map.put("Alg.Alias.Signature.1.2.840.113549.1.1.14", "SHA224withRSA"); - map.put("Alg.Alias.Signature.OID.1.2.840.113549.1.1.14", "SHA224withRSA"); map.put("Signature.SHA256withRSA", "sun.security.mscapi.RSASignature$SHA256"); map.put("Alg.Alias.Signature.1.2.840.113549.1.1.11", "SHA256withRSA"); @@ -115,8 +111,6 @@ public final class SunMSCAPI extends Provider { "sun.security.mscapi.Key"); map.put("Signature.SHA1withRSA SupportedKeyClasses", "sun.security.mscapi.Key"); - map.put("Signature.SHA224withRSA SupportedKeyClasses", - "sun.security.mscapi.Key"); map.put("Signature.SHA256withRSA SupportedKeyClasses", "sun.security.mscapi.Key"); map.put("Signature.SHA384withRSA SupportedKeyClasses", diff --git a/jdk/test/sun/security/mscapi/SignUsingNONEwithRSA.java b/jdk/test/sun/security/mscapi/SignUsingNONEwithRSA.java index 2ebc2ec95e4..02cf4f67c80 100644 --- a/jdk/test/sun/security/mscapi/SignUsingNONEwithRSA.java +++ b/jdk/test/sun/security/mscapi/SignUsingNONEwithRSA.java @@ -48,12 +48,6 @@ public class SignUsingNONEwithRSA { 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27, 0x28, 0x29, 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36 }, - // A SHA-224 hash - new byte[] { - 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x10, - 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18, 0x19, 0x20, - 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27, 0x28 - }, // A SHA-256 hash new byte[] { 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x10, diff --git a/jdk/test/sun/security/mscapi/SignUsingSHA2withRSA.java b/jdk/test/sun/security/mscapi/SignUsingSHA2withRSA.java index 6683809009c..6835bd3f959 100644 --- a/jdk/test/sun/security/mscapi/SignUsingSHA2withRSA.java +++ b/jdk/test/sun/security/mscapi/SignUsingSHA2withRSA.java @@ -78,16 +78,12 @@ public class SignUsingSHA2withRSA { generatedSignatures.add(signUsing("SHA256withRSA", privateKey)); generatedSignatures.add(signUsing("SHA384withRSA", privateKey)); generatedSignatures.add(signUsing("SHA512withRSA", privateKey)); - generatedSignatures.add(signUsing("SHA224withRSA", privateKey)); - System.out.println("-------------------------------------------------"); verifyUsing("SHA256withRSA", publicKey, generatedSignatures.get(0)); verifyUsing("SHA384withRSA", publicKey, generatedSignatures.get(1)); verifyUsing("SHA512withRSA", publicKey, generatedSignatures.get(2)); - verifyUsing("SHA224withRSA", publicKey, generatedSignatures.get(3)); - System.out.println("-------------------------------------------------"); } From f1828f22b9bd0faa721032fe97bd9a793e3d6acd Mon Sep 17 00:00:00 2001 From: Alejandro Murillo Date: Fri, 18 May 2012 14:50:18 -0700 Subject: [PATCH 086/128] Added tag hs24-b11 for changeset 100019c94f7c --- hotspot/.hgtags | 1 + 1 file changed, 1 insertion(+) diff --git a/hotspot/.hgtags b/hotspot/.hgtags index 6beed08f8a6..03a516d1f0d 100644 --- a/hotspot/.hgtags +++ b/hotspot/.hgtags @@ -247,3 +247,4 @@ bfcf92bfefb82da00f7fdbf0d9273feaa0a9456d jdk8-b37 637c3f5f068f88fb9ec9c5867341cf59fd5ebedc jdk8-b38 73147e6c48813b5fee904aa33f79a77103250ff4 hs24-b10 96a403721094ecdaf6a1f4f52ebd0a82e07df199 jdk8-b39 +14b0e07ab9a6fa1662414496b7e07ac8450cf517 hs24-b11 From 57692966b73dea9a82e3f859bfd9fa379fc03ca3 Mon Sep 17 00:00:00 2001 From: Alejandro Murillo Date: Fri, 18 May 2012 14:57:28 -0700 Subject: [PATCH 087/128] 7170006: new hotspot build - hs24-b12 Reviewed-by: jcoomes --- hotspot/make/hotspot_version | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hotspot/make/hotspot_version b/hotspot/make/hotspot_version index 6922036c071..01760936fd5 100644 --- a/hotspot/make/hotspot_version +++ b/hotspot/make/hotspot_version @@ -35,7 +35,7 @@ HOTSPOT_VM_COPYRIGHT=Copyright 2012 HS_MAJOR_VER=24 HS_MINOR_VER=0 -HS_BUILD_NUMBER=11 +HS_BUILD_NUMBER=12 JDK_MAJOR_VER=1 JDK_MINOR_VER=8 From d11c407c11d95ea68078dcd2d1c44bf167096493 Mon Sep 17 00:00:00 2001 From: Weijun Wang Date: Mon, 21 May 2012 15:40:30 +0800 Subject: [PATCH 088/128] 7170308: timing error in the krb5 test SSL.java Reviewed-by: xuelei --- jdk/test/sun/security/krb5/auto/SSL.java | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/jdk/test/sun/security/krb5/auto/SSL.java b/jdk/test/sun/security/krb5/auto/SSL.java index 496097bbc8c..7ad0bd82c70 100644 --- a/jdk/test/sun/security/krb5/auto/SSL.java +++ b/jdk/test/sun/security/krb5/auto/SSL.java @@ -53,6 +53,9 @@ public class SSL { private static volatile String server; private static volatile int port; + // 0-Not started, 1-Start OK, 2-Failure + private static volatile int serverState = 0; + public static void main(String[] args) throws Exception { krb5Cipher = args[0]; @@ -109,14 +112,20 @@ public class SSL { s.doAs(new JsseServerAction(), null); } catch (Exception e) { e.printStackTrace(); + serverState = 2; } } }); server.setDaemon(true); server.start(); - // Warm the server - Thread.sleep(2000); + while (serverState == 0) { + Thread.sleep(50); + } + + if (serverState == 2) { + throw new Exception("Server already failed"); + } // Now create the keytab @@ -214,6 +223,7 @@ public class SSL { (SSLServerSocket) sslssf.createServerSocket(0); // any port port = sslServerSocket.getLocalPort(); System.out.println("Listening on " + port); + serverState = 1; // Enable only a KRB5 cipher suite. String enabledSuites[] = {krb5Cipher}; From e97577956501905232173f83cd251c11d2a05f23 Mon Sep 17 00:00:00 2001 From: Roland Westrelin Date: Mon, 21 May 2012 09:46:02 +0200 Subject: [PATCH 089/128] 7169934: pow(x,y) or x64 computes incorrect result when x<0 and y is an odd integer Bad test for parity of y in pow(x,y) (c1, interpreter) Reviewed-by: kvn, twisti --- hotspot/src/cpu/x86/vm/assembler_x86.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/hotspot/src/cpu/x86/vm/assembler_x86.cpp b/hotspot/src/cpu/x86/vm/assembler_x86.cpp index a1c2b00df52..4537a24e002 100644 --- a/hotspot/src/cpu/x86/vm/assembler_x86.cpp +++ b/hotspot/src/cpu/x86/vm/assembler_x86.cpp @@ -6954,7 +6954,7 @@ void MacroAssembler::pow_or_exp(bool is_exp, int num_fpu_regs_in_use) { tmp = rdx; } Register tmp2 = rax; - NOT_LP64(Register tmp3 = rcx;) + Register tmp3 = rcx; if (is_exp) { // Stack: X @@ -7081,7 +7081,8 @@ void MacroAssembler::pow_or_exp(bool is_exp, int num_fpu_regs_in_use) { #else { Label integer; - shlq(tmp2, 1); + mov(tmp3, tmp2); // preserve tmp2 for parity check below + shlq(tmp3, 1); jcc(Assembler::carryClear, integer); jcc(Assembler::notZero, integer); stop("integer indefinite value shouldn't be seen here"); From 66b51d0b9f75ac1607ec1b656882053a1a035341 Mon Sep 17 00:00:00 2001 From: Alan Bateman Date: Mon, 21 May 2012 10:41:08 +0100 Subject: [PATCH 090/128] 7170203: TEST_BUG: test/java/nio/MappedByteBuffer/Truncate.java failing intermittently Reviewed-by: chegar --- jdk/test/java/nio/MappedByteBuffer/Truncate.java | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/jdk/test/java/nio/MappedByteBuffer/Truncate.java b/jdk/test/java/nio/MappedByteBuffer/Truncate.java index 09dee07e60c..be74c80df93 100644 --- a/jdk/test/java/nio/MappedByteBuffer/Truncate.java +++ b/jdk/test/java/nio/MappedByteBuffer/Truncate.java @@ -88,6 +88,11 @@ public class Truncate { } }; Thread t = new Thread(r); + t.setUncaughtExceptionHandler(new Thread.UncaughtExceptionHandler() { + public void uncaughtException(Thread t, Throwable e) { + e.printStackTrace(); + } + }); t.start(); try { t.join(); } catch (InterruptedException ignore) { } } From 9ea4ab4133f05c27f588716e06518431b46b0b17 Mon Sep 17 00:00:00 2001 From: Andrew Brygin Date: Mon, 21 May 2012 14:04:46 +0400 Subject: [PATCH 091/128] 7124400: [macosx] CGraphicsDevice.getConfigurations() returns reference to member (does not copy configs) Reviewed-by: anthony, kizune --- jdk/src/macosx/classes/sun/awt/CGraphicsDevice.java | 6 +++--- jdk/test/java/awt/GraphicsDevice/CloneConfigsTest.java | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/jdk/src/macosx/classes/sun/awt/CGraphicsDevice.java b/jdk/src/macosx/classes/sun/awt/CGraphicsDevice.java index 1fda340c509..02f743d3e72 100644 --- a/jdk/src/macosx/classes/sun/awt/CGraphicsDevice.java +++ b/jdk/src/macosx/classes/sun/awt/CGraphicsDevice.java @@ -40,7 +40,7 @@ public class CGraphicsDevice extends GraphicsDevice { private final int displayID; // Array of all GraphicsConfig instances for this device - private final CGraphicsConfig[] configs; + private final GraphicsConfiguration[] configs; // Default config (temporarily hard coded) private final int DEFAULT_CONFIG = 0; @@ -49,7 +49,7 @@ public class CGraphicsDevice extends GraphicsDevice { public CGraphicsDevice(int displayID) { this.displayID = displayID; - configs = new CGraphicsConfig[] { + configs = new GraphicsConfiguration[] { CGLGraphicsConfig.getConfig(this, 0) }; } @@ -66,7 +66,7 @@ public class CGraphicsDevice extends GraphicsDevice { */ @Override public GraphicsConfiguration[] getConfigurations() { - return configs; + return configs.clone(); } /** diff --git a/jdk/test/java/awt/GraphicsDevice/CloneConfigsTest.java b/jdk/test/java/awt/GraphicsDevice/CloneConfigsTest.java index c124ff5f434..29c3aa9b575 100644 --- a/jdk/test/java/awt/GraphicsDevice/CloneConfigsTest.java +++ b/jdk/test/java/awt/GraphicsDevice/CloneConfigsTest.java @@ -23,7 +23,7 @@ /* * @test - * @bug 6822057 + * @bug 6822057 7124400 * * @summary Test verifies that list of supported graphics configurations * can not be changed via modification of elements of an array From ecf06b34593b06009308c51b6822a3fefcf62cb1 Mon Sep 17 00:00:00 2001 From: Andrew Brygin Date: Mon, 21 May 2012 14:53:51 +0400 Subject: [PATCH 092/128] 7154088: [macosx] Regression: Component.createImage do not inherits component attributes Reviewed-by: art, kizune --- jdk/src/macosx/classes/sun/lwawt/LWComponentPeer.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/jdk/src/macosx/classes/sun/lwawt/LWComponentPeer.java b/jdk/src/macosx/classes/sun/lwawt/LWComponentPeer.java index a7b15e07c96..6701434bb20 100644 --- a/jdk/src/macosx/classes/sun/lwawt/LWComponentPeer.java +++ b/jdk/src/macosx/classes/sun/lwawt/LWComponentPeer.java @@ -940,8 +940,8 @@ public abstract class LWComponentPeer @Override public Image createImage(int w, int h) { - // TODO: accelerated image - return getGraphicsConfiguration().createCompatibleImage(w, h); + CGraphicsConfig gc = (CGraphicsConfig)getGraphicsConfiguration(); + return gc.createAcceleratedImage(getTarget(), w, h); } @Override From 818597ae4f0559af613342ff052687ba0085bf10 Mon Sep 17 00:00:00 2001 From: Matherey Nunez Date: Mon, 21 May 2012 14:59:59 +0200 Subject: [PATCH 093/128] 7168848: Add test to check that humongous object allocation path also checks the heap occupancy Added test that checks humongous object allocation path also check the heap occupancy and initiate a marking cycle when / if needed. Reviewed-by: brutisso, jwilhelm --- hotspot/test/gc/7168848/HumongousAlloc.java | 74 +++++++++++++++++++++ 1 file changed, 74 insertions(+) create mode 100644 hotspot/test/gc/7168848/HumongousAlloc.java diff --git a/hotspot/test/gc/7168848/HumongousAlloc.java b/hotspot/test/gc/7168848/HumongousAlloc.java new file mode 100644 index 00000000000..7ac6074bd67 --- /dev/null +++ b/hotspot/test/gc/7168848/HumongousAlloc.java @@ -0,0 +1,74 @@ +/* + * Copyright (c) 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. + */ + +/* + * @test Humongous.java + * @bug 7168848 + * @summary G1: humongous object allocations should initiate marking cycles when necessary + * @run main/othervm -Xms100m -Xmx100m -XX:+PrintGC -XX:G1HeapRegionSize=1m -XX:+UseG1GC HumongousAlloc + * + */ +import java.lang.management.GarbageCollectorMXBean; +import java.lang.management.ManagementFactory; +import java.util.List; + +public class HumongousAlloc { + + public static byte[] dummy; + private static int sleepFreq = 40; + private static int sleepTime = 1000; + private static double size = 0.75; + private static int iterations = 50; + private static int MB = 1024 * 1024; + + public static void allocate(int size, int sleepTime, int sleepFreq) throws InterruptedException { + System.out.println("Will allocate objects of size: " + size + + " bytes and sleep for " + sleepTime + + " ms after every " + sleepFreq + "th allocation."); + int count = 0; + while (count < iterations) { + for (int i = 0; i < sleepFreq; i++) { + dummy = new byte[size - 16]; + } + Thread.sleep(sleepTime); + count++; + } + } + + public static void main(String[] args) throws InterruptedException { + allocate((int) (size * MB), sleepTime, sleepFreq); + List collectors = ManagementFactory.getGarbageCollectorMXBeans(); + for (GarbageCollectorMXBean collector : collectors) { + if (collector.getName().contains("G1 Old")) { + long count = collector.getCollectionCount(); + if (count > 0) { + throw new RuntimeException("Failed: FullGCs should not have happened. The number of FullGC run is " + count); + } + else { + System.out.println("Passed."); + } + } + } + } +} + From 1d1ed3ddb34545aad060e93e190084450e740dd8 Mon Sep 17 00:00:00 2001 From: Pavel Porvatov Date: Mon, 21 May 2012 18:55:36 +0400 Subject: [PATCH 094/128] 7168144: No appropriate CCC request for changes introduced by 7154030 Reviewed-by: alexsch --- jdk/src/share/classes/javax/swing/JComponent.java | 1 + 1 file changed, 1 insertion(+) diff --git a/jdk/src/share/classes/javax/swing/JComponent.java b/jdk/src/share/classes/javax/swing/JComponent.java index 83f88bfbfdc..dbf4b3c3343 100644 --- a/jdk/src/share/classes/javax/swing/JComponent.java +++ b/jdk/src/share/classes/javax/swing/JComponent.java @@ -5573,6 +5573,7 @@ public abstract class JComponent extends Container implements Serializable, * {@inheritDoc} */ @Override + @Deprecated public void hide() { boolean showing = isShowing(); super.hide(); From ae57b6a361886ea074d0ffbf46655b2c28af6682 Mon Sep 17 00:00:00 2001 From: Kumar Srinivasan Date: Mon, 21 May 2012 09:40:32 -0700 Subject: [PATCH 095/128] 7170087: tools/launcher/Arrghs.java test has wrong bugID for 7151434 Reviewed-by: ohair --- jdk/test/tools/launcher/Arrrghs.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/jdk/test/tools/launcher/Arrrghs.java b/jdk/test/tools/launcher/Arrrghs.java index e551bdf3cf2..fb9437228db 100644 --- a/jdk/test/tools/launcher/Arrrghs.java +++ b/jdk/test/tools/launcher/Arrrghs.java @@ -24,7 +24,7 @@ /** * @test * @bug 5030233 6214916 6356475 6571029 6684582 6742159 4459600 6758881 6753938 - * 6894719 6968053 7151314 + * 6894719 6968053 7151434 * @summary Argument parsing validation. * @compile -XDignore.symbol.file Arrrghs.java * @run main Arrrghs @@ -238,7 +238,7 @@ public class Arrrghs extends TestHelper { tr.isNotZeroOutput(); System.out.println(tr); - // 7151314, test for non-negative exit value for an incorrectly formed + // 7151434, test for non-negative exit value for an incorrectly formed // command line, '% java -jar -W', note the bogus -W tr = doExec(javaCmd, "-jar", "-W"); tr.checkNegative(); From f88f95d5751a43b90d726b84dbcf57aa4fa93a02 Mon Sep 17 00:00:00 2001 From: Staffan Larsen Date: Mon, 21 May 2012 19:28:41 +0200 Subject: [PATCH 096/128] 7167157: jcmd command file parsing does not respect the "stop" command Reviewed-by: alanb, dsamersoff, nloodin --- jdk/src/share/classes/sun/tools/jcmd/JCmd.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/jdk/src/share/classes/sun/tools/jcmd/JCmd.java b/jdk/src/share/classes/sun/tools/jcmd/JCmd.java index 3ec79968fed..4690a5bc4f6 100644 --- a/jdk/src/share/classes/sun/tools/jcmd/JCmd.java +++ b/jdk/src/share/classes/sun/tools/jcmd/JCmd.java @@ -142,8 +142,11 @@ public class JCmd { // Cast to HotSpotVirtualMachine as this is an // implementation specific method. HotSpotVirtualMachine hvm = (HotSpotVirtualMachine) vm; - String lines[] = command .split("\\n"); + String lines[] = command.split("\\n"); for (String line : lines) { + if (line.trim().equals("stop")) { + break; + } try (InputStream in = hvm.executeJCmd(line);) { // read to EOF and just print output byte b[] = new byte[256]; From 31e63d5a3ab764bf3df56b4a5e7ac2b4d0673b7c Mon Sep 17 00:00:00 2001 From: Jiangli Zhou Date: Mon, 21 May 2012 14:10:35 -0400 Subject: [PATCH 097/128] 7168280: Eliminate the generic signature index slot from field array for field without generic signature Only allocate the generic signature index slot in the field array for field with generic signature attribute. Reviewed-by: coleenp, dlong --- .../sun/jvm/hotspot/oops/AccessFlags.java | 1 + .../sun/jvm/hotspot/oops/InstanceKlass.java | 35 ++++++++- .../jvm/hotspot/runtime/ClassConstants.java | 2 + .../share/vm/classfile/classFileParser.cpp | 74 ++++++++++++++----- .../share/vm/classfile/systemDictionary.cpp | 2 +- hotspot/src/share/vm/oops/fieldInfo.hpp | 18 +---- hotspot/src/share/vm/oops/fieldStreams.hpp | 74 +++++++++++++++++-- hotspot/src/share/vm/oops/instanceKlass.hpp | 18 +++-- .../src/share/vm/runtime/fieldDescriptor.cpp | 15 ++++ .../src/share/vm/runtime/fieldDescriptor.hpp | 2 +- hotspot/src/share/vm/runtime/vmStructs.cpp | 1 - .../src/share/vm/utilities/accessFlags.hpp | 10 ++- 12 files changed, 199 insertions(+), 53 deletions(-) diff --git a/hotspot/agent/src/share/classes/sun/jvm/hotspot/oops/AccessFlags.java b/hotspot/agent/src/share/classes/sun/jvm/hotspot/oops/AccessFlags.java index 02314153e15..76c73162fa3 100644 --- a/hotspot/agent/src/share/classes/sun/jvm/hotspot/oops/AccessFlags.java +++ b/hotspot/agent/src/share/classes/sun/jvm/hotspot/oops/AccessFlags.java @@ -81,6 +81,7 @@ public class AccessFlags implements /* imports */ ClassConstants { // field flags public boolean fieldAccessWatched () { return (flags & JVM_ACC_FIELD_ACCESS_WATCHED) != 0; } public boolean fieldModificationWatched() { return (flags & JVM_ACC_FIELD_MODIFICATION_WATCHED) != 0; } + public boolean fieldHasGenericSignature() { return (flags & JVM_ACC_FIELD_HAS_GENERIC_SIGNATURE)!= 0; } public void printOn(PrintStream tty) { // prints only .class flags and not the hotspot internal flags diff --git a/hotspot/agent/src/share/classes/sun/jvm/hotspot/oops/InstanceKlass.java b/hotspot/agent/src/share/classes/sun/jvm/hotspot/oops/InstanceKlass.java index f342eb72882..9536da39838 100644 --- a/hotspot/agent/src/share/classes/sun/jvm/hotspot/oops/InstanceKlass.java +++ b/hotspot/agent/src/share/classes/sun/jvm/hotspot/oops/InstanceKlass.java @@ -50,7 +50,6 @@ public class InstanceKlass extends Klass { private static int INITVAL_INDEX_OFFSET; private static int LOW_OFFSET; private static int HIGH_OFFSET; - private static int GENERIC_SIGNATURE_INDEX_OFFSET; private static int FIELD_SLOTS; // ClassState constants @@ -99,7 +98,6 @@ public class InstanceKlass extends Klass { INITVAL_INDEX_OFFSET = db.lookupIntConstant("FieldInfo::initval_index_offset").intValue(); LOW_OFFSET = db.lookupIntConstant("FieldInfo::low_offset").intValue(); HIGH_OFFSET = db.lookupIntConstant("FieldInfo::high_offset").intValue(); - GENERIC_SIGNATURE_INDEX_OFFSET = db.lookupIntConstant("FieldInfo::generic_signature_offset").intValue(); FIELD_SLOTS = db.lookupIntConstant("FieldInfo::field_slots").intValue(); // read ClassState constants CLASS_STATE_UNPARSABLE_BY_GC = db.lookupIntConstant("instanceKlass::unparsable_by_gc").intValue(); @@ -279,7 +277,25 @@ public class InstanceKlass extends Klass { } public short getFieldGenericSignatureIndex(int index) { - return getFields().getShortAt(index * FIELD_SLOTS + GENERIC_SIGNATURE_INDEX_OFFSET); + int len = (int)getFields().getLength(); + int allFieldsCount = getAllFieldsCount(); + int generic_signature_slot = allFieldsCount * FIELD_SLOTS; + for (int i = 0; i < allFieldsCount; i++) { + short flags = getFieldAccessFlags(i); + AccessFlags access = new AccessFlags(flags); + if (i == index) { + if (access.fieldHasGenericSignature()) { + return getFields().getShortAt(generic_signature_slot); + } else { + return 0; + } + } else { + if (access.fieldHasGenericSignature()) { + generic_signature_slot ++; + } + } + } + return 0; } public Symbol getFieldGenericSignature(int index) { @@ -309,7 +325,18 @@ public class InstanceKlass extends Klass { public ObjArray getTransitiveInterfaces() { return (ObjArray) transitiveInterfaces.getValue(this); } public TypeArray getFields() { return (TypeArray) fields.getValue(this); } public int getJavaFieldsCount() { return (int) javaFieldsCount.getValue(this); } - public int getAllFieldsCount() { return (int)getFields().getLength() / FIELD_SLOTS; } + public int getAllFieldsCount() { + int len = (int)getFields().getLength(); + int allFieldsCount = 0; + for (; allFieldsCount*FIELD_SLOTS < len; allFieldsCount++) { + short flags = getFieldAccessFlags(allFieldsCount); + AccessFlags access = new AccessFlags(flags); + if (access.fieldHasGenericSignature()) { + len --; + } + } + return allFieldsCount; + } public ConstantPool getConstants() { return (ConstantPool) constants.getValue(this); } public Oop getClassLoader() { return classLoader.getValue(this); } public Oop getProtectionDomain() { return protectionDomain.getValue(this); } diff --git a/hotspot/agent/src/share/classes/sun/jvm/hotspot/runtime/ClassConstants.java b/hotspot/agent/src/share/classes/sun/jvm/hotspot/runtime/ClassConstants.java index 722496e3c27..e17a75c1f43 100644 --- a/hotspot/agent/src/share/classes/sun/jvm/hotspot/runtime/ClassConstants.java +++ b/hotspot/agent/src/share/classes/sun/jvm/hotspot/runtime/ClassConstants.java @@ -153,6 +153,8 @@ public interface ClassConstants public static final long JVM_ACC_FIELD_ACCESS_WATCHED = 0x00002000; // field modification is watched by JVMTI public static final long JVM_ACC_FIELD_MODIFICATION_WATCHED = 0x00008000; + // field has generic signature + public static final long JVM_ACC_FIELD_HAS_GENERIC_SIGNATURE = 0x00000800; // flags accepted by set_field_flags public static final long JVM_ACC_FIELD_FLAGS = 0x00008000 | JVM_ACC_WRITTEN_FLAGS; diff --git a/hotspot/src/share/vm/classfile/classFileParser.cpp b/hotspot/src/share/vm/classfile/classFileParser.cpp index f24610c060c..b2330e61e37 100644 --- a/hotspot/src/share/vm/classfile/classFileParser.cpp +++ b/hotspot/src/share/vm/classfile/classFileParser.cpp @@ -1082,12 +1082,36 @@ typeArrayHandle ClassFileParser::parse_fields(Symbol* class_name, int num_injected = 0; InjectedField* injected = JavaClasses::get_injected(class_name, &num_injected); + int total_fields = length + num_injected; - // Tuples of shorts [access, name index, sig index, initial value index, byte offset, generic signature index] - typeArrayOop new_fields = oopFactory::new_permanent_shortArray((length + num_injected) * FieldInfo::field_slots, CHECK_(nullHandle)); - typeArrayHandle fields(THREAD, new_fields); + // The field array starts with tuples of shorts + // [access, name index, sig index, initial value index, byte offset]. + // A generic signature slot only exists for field with generic + // signature attribute. And the access flag is set with + // JVM_ACC_FIELD_HAS_GENERIC_SIGNATURE for that field. The generic + // signature slots are at the end of the field array and after all + // other fields data. + // + // f1: [access, name index, sig index, initial value index, low_offset, high_offset] + // f2: [access, name index, sig index, initial value index, low_offset, high_offset] + // ... + // fn: [access, name index, sig index, initial value index, low_offset, high_offset] + // [generic signature index] + // [generic signature index] + // ... + // + // Allocate a temporary resource array for field data. For each field, + // a slot is reserved in the temporary array for the generic signature + // index. After parsing all fields, the data are copied to a permanent + // array and any unused slots will be discarded. + ResourceMark rm(THREAD); + u2* fa = NEW_RESOURCE_ARRAY_IN_THREAD( + THREAD, u2, total_fields * (FieldInfo::field_slots + 1)); typeArrayHandle field_annotations; + // The generic signature slots start after all other fields' data. + int generic_signature_slot = total_fields * FieldInfo::field_slots; + int num_generic_signature = 0; for (int n = 0; n < length; n++) { cfs->guarantee_more(8, CHECK_(nullHandle)); // access_flags, name_index, descriptor_index, attributes_count @@ -1135,14 +1159,19 @@ typeArrayHandle ClassFileParser::parse_fields(Symbol* class_name, if (is_synthetic) { access_flags.set_is_synthetic(); } + if (generic_signature_index != 0) { + access_flags.set_field_has_generic_signature(); + fa[generic_signature_slot] = generic_signature_index; + generic_signature_slot ++; + num_generic_signature ++; + } } - FieldInfo* field = FieldInfo::from_field_array(fields(), n); + FieldInfo* field = FieldInfo::from_field_array(fa, n); field->initialize(access_flags.as_short(), name_index, signature_index, constantvalue_index, - generic_signature_index, 0); BasicType type = cp->basic_type_for_signature_at(signature_index); @@ -1155,8 +1184,8 @@ typeArrayHandle ClassFileParser::parse_fields(Symbol* class_name, field->set_offset(atype); } + int index = length; if (num_injected != 0) { - int index = length; for (int n = 0; n < num_injected; n++) { // Check for duplicates if (injected[n].may_be_java) { @@ -1164,7 +1193,7 @@ typeArrayHandle ClassFileParser::parse_fields(Symbol* class_name, Symbol* signature = injected[n].signature(); bool duplicate = false; for (int i = 0; i < length; i++) { - FieldInfo* f = FieldInfo::from_field_array(fields(), i); + FieldInfo* f = FieldInfo::from_field_array(fa, i); if (name == cp->symbol_at(f->name_index()) && signature == cp->symbol_at(f->signature_index())) { // Symbol is desclared in Java so skip this one @@ -1179,12 +1208,11 @@ typeArrayHandle ClassFileParser::parse_fields(Symbol* class_name, } // Injected field - FieldInfo* field = FieldInfo::from_field_array(fields(), index); + FieldInfo* field = FieldInfo::from_field_array(fa, index); field->initialize(JVM_ACC_FIELD_INTERNAL, injected[n].name_index, injected[n].signature_index, 0, - 0, 0); BasicType type = FieldType::basic_type(injected[n].signature()); @@ -1197,17 +1225,27 @@ typeArrayHandle ClassFileParser::parse_fields(Symbol* class_name, field->set_offset(atype); index++; } + } - if (index < length + num_injected) { - // sometimes injected fields already exist in the Java source so - // the fields array could be too long. In that case trim the - // fields array. - new_fields = oopFactory::new_permanent_shortArray(index * FieldInfo::field_slots, CHECK_(nullHandle)); - for (int i = 0; i < index * FieldInfo::field_slots; i++) { - new_fields->short_at_put(i, fields->short_at(i)); - } - fields = new_fields; + // Now copy the fields' data from the temporary resource array. + // Sometimes injected fields already exist in the Java source so + // the fields array could be too long. In that case the + // fields array is trimed. Also unused slots that were reserved + // for generic signature indexes are discarded. + typeArrayOop new_fields = oopFactory::new_permanent_shortArray( + index * FieldInfo::field_slots + num_generic_signature, + CHECK_(nullHandle)); + typeArrayHandle fields(THREAD, new_fields); + { + int i = 0; + for (; i < index * FieldInfo::field_slots; i++) { + new_fields->short_at_put(i, fa[i]); } + for (int j = total_fields * FieldInfo::field_slots; + j < generic_signature_slot; j++) { + new_fields->short_at_put(i++, fa[j]); + } + assert(i == new_fields->length(), ""); } if (_need_verify && length > 1) { diff --git a/hotspot/src/share/vm/classfile/systemDictionary.cpp b/hotspot/src/share/vm/classfile/systemDictionary.cpp index 0bdc16de6ff..78c854f3058 100644 --- a/hotspot/src/share/vm/classfile/systemDictionary.cpp +++ b/hotspot/src/share/vm/classfile/systemDictionary.cpp @@ -2763,7 +2763,7 @@ class ClassStatistics: AllStatic { class_size += ik->local_interfaces()->size(); class_size += ik->transitive_interfaces()->size(); // We do not have to count implementors, since we only store one! - class_size += ik->all_fields_count() * FieldInfo::field_slots; + class_size += ik->fields()->length(); } } diff --git a/hotspot/src/share/vm/oops/fieldInfo.hpp b/hotspot/src/share/vm/oops/fieldInfo.hpp index 69de3aef110..f4cf1a4c40f 100644 --- a/hotspot/src/share/vm/oops/fieldInfo.hpp +++ b/hotspot/src/share/vm/oops/fieldInfo.hpp @@ -50,8 +50,7 @@ class FieldInfo VALUE_OBJ_CLASS_SPEC { initval_index_offset = 3, low_offset = 4, high_offset = 5, - generic_signature_offset = 6, - field_slots = 7 + field_slots = 6 }; private: @@ -60,29 +59,28 @@ class FieldInfo VALUE_OBJ_CLASS_SPEC { void set_name_index(u2 val) { _shorts[name_index_offset] = val; } void set_signature_index(u2 val) { _shorts[signature_index_offset] = val; } void set_initval_index(u2 val) { _shorts[initval_index_offset] = val; } - void set_generic_signature_index(u2 val) { _shorts[generic_signature_offset] = val; } u2 name_index() const { return _shorts[name_index_offset]; } u2 signature_index() const { return _shorts[signature_index_offset]; } u2 initval_index() const { return _shorts[initval_index_offset]; } - u2 generic_signature_index() const { return _shorts[generic_signature_offset]; } public: static FieldInfo* from_field_array(typeArrayOop fields, int index) { return ((FieldInfo*)fields->short_at_addr(index * field_slots)); } + static FieldInfo* from_field_array(u2* fields, int index) { + return ((FieldInfo*)(fields + index * field_slots)); + } void initialize(u2 access_flags, u2 name_index, u2 signature_index, u2 initval_index, - u2 generic_signature_index, u4 offset) { _shorts[access_flags_offset] = access_flags; _shorts[name_index_offset] = name_index; _shorts[signature_index_offset] = signature_index; _shorts[initval_index_offset] = initval_index; - _shorts[generic_signature_offset] = generic_signature_index; set_offset(offset); } @@ -105,14 +103,6 @@ class FieldInfo VALUE_OBJ_CLASS_SPEC { return cp->symbol_at(index); } - Symbol* generic_signature(constantPoolHandle cp) const { - int index = generic_signature_index(); - if (index == 0) { - return NULL; - } - return cp->symbol_at(index); - } - void set_access_flags(u2 val) { _shorts[access_flags_offset] = val; } void set_offset(u4 val) { _shorts[low_offset] = extract_low_short_from_int(val); diff --git a/hotspot/src/share/vm/oops/fieldStreams.hpp b/hotspot/src/share/vm/oops/fieldStreams.hpp index 07c28f32eee..08127bfb0df 100644 --- a/hotspot/src/share/vm/oops/fieldStreams.hpp +++ b/hotspot/src/share/vm/oops/fieldStreams.hpp @@ -42,21 +42,57 @@ class FieldStreamBase : public StackObj { constantPoolHandle _constants; int _index; int _limit; + int _generic_signature_slot; FieldInfo* field() const { return FieldInfo::from_field_array(_fields(), _index); } + int init_generic_signature_start_slot() { + int length = _fields->length(); + int num_fields = 0; + int skipped_generic_signature_slots = 0; + FieldInfo* fi; + AccessFlags flags; + /* Scan from 0 to the current _index. Count the number of generic + signature slots for field[0] to field[_index - 1]. */ + for (int i = 0; i < _index; i++) { + fi = FieldInfo::from_field_array(_fields(), i); + flags.set_flags(fi->access_flags()); + if (flags.field_has_generic_signature()) { + length --; + skipped_generic_signature_slots ++; + } + } + /* Scan from the current _index. */ + for (int i = _index; i*FieldInfo::field_slots < length; i++) { + fi = FieldInfo::from_field_array(_fields(), i); + flags.set_flags(fi->access_flags()); + if (flags.field_has_generic_signature()) { + length --; + } + num_fields ++; + } + _generic_signature_slot = length + skipped_generic_signature_slots; + assert(_generic_signature_slot <= _fields->length(), ""); + return num_fields; + } + FieldStreamBase(typeArrayHandle fields, constantPoolHandle constants, int start, int limit) { _fields = fields; _constants = constants; _index = start; - _limit = limit; + int num_fields = init_generic_signature_start_slot(); + if (limit < start) { + _limit = num_fields; + } else { + _limit = limit; + } } FieldStreamBase(typeArrayHandle fields, constantPoolHandle constants) { _fields = fields; _constants = constants; _index = 0; - _limit = fields->length() / FieldInfo::field_slots; + _limit = init_generic_signature_start_slot(); } public: @@ -65,18 +101,26 @@ class FieldStreamBase : public StackObj { _constants = klass->constants(); _index = 0; _limit = klass->java_fields_count(); + init_generic_signature_start_slot(); } FieldStreamBase(instanceKlassHandle klass) { _fields = klass->fields(); _constants = klass->constants(); _index = 0; _limit = klass->java_fields_count(); + init_generic_signature_start_slot(); } // accessors int index() const { return _index; } - void next() { _index += 1; } + void next() { + if (access_flags().field_has_generic_signature()) { + _generic_signature_slot ++; + assert(_generic_signature_slot <= _fields->length(), ""); + } + _index += 1; + } bool done() const { return _index >= _limit; } // Accessors for current field @@ -103,7 +147,13 @@ class FieldStreamBase : public StackObj { } Symbol* generic_signature() const { - return field()->generic_signature(_constants); + if (access_flags().field_has_generic_signature()) { + assert(_generic_signature_slot < _fields->length(), "out of bounds"); + int index = _fields->short_at(_generic_signature_slot); + return _constants->symbol_at(index); + } else { + return NULL; + } } int offset() const { @@ -139,11 +189,19 @@ class JavaFieldStream : public FieldStreamBase { } int generic_signature_index() const { assert(!field()->is_internal(), "regular only"); - return field()->generic_signature_index(); + if (access_flags().field_has_generic_signature()) { + assert(_generic_signature_slot < _fields->length(), "out of bounds"); + return _fields->short_at(_generic_signature_slot); + } else { + return 0; + } } void set_generic_signature_index(int index) { assert(!field()->is_internal(), "regular only"); - field()->set_generic_signature_index(index); + if (access_flags().field_has_generic_signature()) { + assert(_generic_signature_slot < _fields->length(), "out of bounds"); + _fields->short_at_put(_generic_signature_slot, index); + } } int initval_index() const { assert(!field()->is_internal(), "regular only"); @@ -159,8 +217,8 @@ class JavaFieldStream : public FieldStreamBase { // Iterate over only the internal fields class InternalFieldStream : public FieldStreamBase { public: - InternalFieldStream(instanceKlass* k): FieldStreamBase(k->fields(), k->constants(), k->java_fields_count(), k->all_fields_count()) {} - InternalFieldStream(instanceKlassHandle k): FieldStreamBase(k->fields(), k->constants(), k->java_fields_count(), k->all_fields_count()) {} + InternalFieldStream(instanceKlass* k): FieldStreamBase(k->fields(), k->constants(), k->java_fields_count(), 0) {} + InternalFieldStream(instanceKlassHandle k): FieldStreamBase(k->fields(), k->constants(), k->java_fields_count(), 0) {} }; diff --git a/hotspot/src/share/vm/oops/instanceKlass.hpp b/hotspot/src/share/vm/oops/instanceKlass.hpp index dd42bce8628..229750bce64 100644 --- a/hotspot/src/share/vm/oops/instanceKlass.hpp +++ b/hotspot/src/share/vm/oops/instanceKlass.hpp @@ -168,8 +168,19 @@ class instanceKlass: public Klass { objArrayOop _local_interfaces; // Interface (klassOops) this class implements transitively. objArrayOop _transitive_interfaces; - // Instance and static variable information, 5-tuples of shorts [access, name - // index, sig index, initval index, offset]. + // Instance and static variable information, starts with 6-tuples of shorts + // [access, name index, sig index, initval index, low_offset, high_offset] + // for all fields, followed by the generic signature data at the end of + // the array. Only fields with generic signature attributes have the generic + // signature data set in the array. The fields array looks like following: + // + // f1: [access, name index, sig index, initial value index, low_offset, high_offset] + // f2: [access, name index, sig index, initial value index, low_offset, high_offset] + // ... + // fn: [access, name index, sig index, initial value index, low_offset, high_offset] + // [generic signature index] + // [generic signature index] + // ... typeArrayOop _fields; // Constant pool for this class. constantPoolOop _constants; @@ -351,9 +362,6 @@ class instanceKlass: public Klass { // Number of Java declared fields int java_fields_count() const { return (int)_java_fields_count; } - // Number of fields including any injected fields - int all_fields_count() const { return _fields->length() / FieldInfo::field_slots; } - typeArrayOop fields() const { return _fields; } void set_fields(typeArrayOop f, u2 java_fields_count) { diff --git a/hotspot/src/share/vm/runtime/fieldDescriptor.cpp b/hotspot/src/share/vm/runtime/fieldDescriptor.cpp index 1fb0ce0c5e8..fc26d9cd09e 100644 --- a/hotspot/src/share/vm/runtime/fieldDescriptor.cpp +++ b/hotspot/src/share/vm/runtime/fieldDescriptor.cpp @@ -28,6 +28,7 @@ #include "memory/resourceArea.hpp" #include "memory/universe.inline.hpp" #include "oops/instanceKlass.hpp" +#include "oops/fieldStreams.hpp" #include "runtime/fieldDescriptor.hpp" #include "runtime/handles.inline.hpp" #include "runtime/signature.hpp" @@ -37,6 +38,20 @@ oop fieldDescriptor::loader() const { return instanceKlass::cast(_cp->pool_holder())->class_loader(); } +Symbol* fieldDescriptor::generic_signature() const { + int idx = 0; + instanceKlass* ik = instanceKlass::cast(field_holder()); + for (AllFieldStream fs(ik); !fs.done(); fs.next()) { + if (idx == _index) { + return fs.generic_signature(); + } else { + idx ++; + } + } + assert(false, "should never happen"); + return NULL; +} + typeArrayOop fieldDescriptor::annotations() const { instanceKlass* ik = instanceKlass::cast(field_holder()); objArrayOop md = ik->fields_annotations(); diff --git a/hotspot/src/share/vm/runtime/fieldDescriptor.hpp b/hotspot/src/share/vm/runtime/fieldDescriptor.hpp index e68b5c5f005..f2cdbadbab9 100644 --- a/hotspot/src/share/vm/runtime/fieldDescriptor.hpp +++ b/hotspot/src/share/vm/runtime/fieldDescriptor.hpp @@ -67,7 +67,7 @@ class fieldDescriptor VALUE_OBJ_CLASS_SPEC { oop loader() const; // Offset (in words) of field from start of instanceOop / klassOop int offset() const { return field()->offset(); } - Symbol* generic_signature() const { return field()->generic_signature(_cp); } + Symbol* generic_signature() const; int index() const { return _index; } typeArrayOop annotations() const; diff --git a/hotspot/src/share/vm/runtime/vmStructs.cpp b/hotspot/src/share/vm/runtime/vmStructs.cpp index cc2d0783430..921945a9532 100644 --- a/hotspot/src/share/vm/runtime/vmStructs.cpp +++ b/hotspot/src/share/vm/runtime/vmStructs.cpp @@ -2352,7 +2352,6 @@ static inline uint64_t cast_uint64_t(size_t x) declare_constant(FieldInfo::initval_index_offset) \ declare_constant(FieldInfo::low_offset) \ declare_constant(FieldInfo::high_offset) \ - declare_constant(FieldInfo::generic_signature_offset) \ declare_constant(FieldInfo::field_slots) \ \ /************************************************/ \ diff --git a/hotspot/src/share/vm/utilities/accessFlags.hpp b/hotspot/src/share/vm/utilities/accessFlags.hpp index 484ce4f3f8d..2e86497b682 100644 --- a/hotspot/src/share/vm/utilities/accessFlags.hpp +++ b/hotspot/src/share/vm/utilities/accessFlags.hpp @@ -80,10 +80,12 @@ enum { JVM_ACC_FIELD_ACCESS_WATCHED = 0x00002000, // field access is watched by JVMTI JVM_ACC_FIELD_MODIFICATION_WATCHED = 0x00008000, // field modification is watched by JVMTI JVM_ACC_FIELD_INTERNAL = 0x00000400, // internal field, same as JVM_ACC_ABSTRACT + JVM_ACC_FIELD_HAS_GENERIC_SIGNATURE = 0x00000800, // field has generic signature JVM_ACC_FIELD_INTERNAL_FLAGS = JVM_ACC_FIELD_ACCESS_WATCHED | JVM_ACC_FIELD_MODIFICATION_WATCHED | - JVM_ACC_FIELD_INTERNAL, + JVM_ACC_FIELD_INTERNAL | + JVM_ACC_FIELD_HAS_GENERIC_SIGNATURE, // flags accepted by set_field_flags() JVM_ACC_FIELD_FLAGS = JVM_RECOGNIZED_FIELD_MODIFIERS | JVM_ACC_FIELD_INTERNAL_FLAGS @@ -156,6 +158,8 @@ class AccessFlags VALUE_OBJ_CLASS_SPEC { bool is_field_modification_watched() const { return (_flags & JVM_ACC_FIELD_MODIFICATION_WATCHED) != 0; } bool is_internal() const { return (_flags & JVM_ACC_FIELD_INTERNAL) != 0; } + bool field_has_generic_signature() const + { return (_flags & JVM_ACC_FIELD_HAS_GENERIC_SIGNATURE) != 0; } // get .class file flags jint get_flags () const { return (_flags & JVM_ACC_WRITTEN_FLAGS); } @@ -225,6 +229,10 @@ class AccessFlags VALUE_OBJ_CLASS_SPEC { atomic_clear_bits(JVM_ACC_FIELD_MODIFICATION_WATCHED); } } + void set_field_has_generic_signature() + { + atomic_set_bits(JVM_ACC_FIELD_HAS_GENERIC_SIGNATURE); + } // Conversion jshort as_short() const { return (jshort)_flags; } From 33648efb4cf56722a43da96c5a977f3beecf4dc1 Mon Sep 17 00:00:00 2001 From: Anton Tarasov Date: Tue, 22 May 2012 01:12:16 +0400 Subject: [PATCH 098/128] 7170427: setGlobalCurrentFocusCycleRoot unexpectedly throws SecurityException Reviewed-by: art --- jdk/src/share/classes/java/awt/Component.java | 23 +++++-------------- jdk/src/share/classes/java/awt/Container.java | 6 ++--- .../java/awt/KeyboardFocusManager.java | 13 +++++++++-- 3 files changed, 20 insertions(+), 22 deletions(-) diff --git a/jdk/src/share/classes/java/awt/Component.java b/jdk/src/share/classes/java/awt/Component.java index 20d733fa93c..df80032a1a9 100644 --- a/jdk/src/share/classes/java/awt/Component.java +++ b/jdk/src/share/classes/java/awt/Component.java @@ -7947,32 +7947,21 @@ public abstract class Component implements ImageObserver, MenuContainer, if (rootAncestor != null) { Container rootAncestorRootAncestor = rootAncestor.getFocusCycleRootAncestor(); - - final Container fcr = (rootAncestorRootAncestor != null) ? + Container fcr = (rootAncestorRootAncestor != null) ? rootAncestorRootAncestor : rootAncestor; - AccessController.doPrivileged(new PrivilegedAction() { - public Object run() { - KeyboardFocusManager.getCurrentKeyboardFocusManager(). - setGlobalCurrentFocusCycleRoot(fcr); - return null; - } - }); + KeyboardFocusManager.getCurrentKeyboardFocusManager(). + setGlobalCurrentFocusCycleRootPriv(fcr); rootAncestor.requestFocus(CausedFocusEvent.Cause.TRAVERSAL_UP); } else { - final Window window = getContainingWindow(); + Window window = getContainingWindow(); if (window != null) { Component toFocus = window.getFocusTraversalPolicy(). getDefaultComponent(window); if (toFocus != null) { - AccessController.doPrivileged(new PrivilegedAction() { - public Object run() { - KeyboardFocusManager.getCurrentKeyboardFocusManager(). - setGlobalCurrentFocusCycleRoot(window); - return null; - } - }); + KeyboardFocusManager.getCurrentKeyboardFocusManager(). + setGlobalCurrentFocusCycleRootPriv(window); toFocus.requestFocus(CausedFocusEvent.Cause.TRAVERSAL_UP); } } diff --git a/jdk/src/share/classes/java/awt/Container.java b/jdk/src/share/classes/java/awt/Container.java index 99cbdaff124..65c7ceaec5f 100644 --- a/jdk/src/share/classes/java/awt/Container.java +++ b/jdk/src/share/classes/java/awt/Container.java @@ -3245,7 +3245,7 @@ public class Container extends Component { if (root != currentFocusCycleRoot) { KeyboardFocusManager.getCurrentKeyboardFocusManager(). - setGlobalCurrentFocusCycleRoot(root); + setGlobalCurrentFocusCycleRootPriv(root); } return root; } @@ -3302,7 +3302,7 @@ public class Container extends Component { Container cont = kfm.getCurrentFocusCycleRoot(); if (cont == this || isParentOf(cont)) { - kfm.setGlobalCurrentFocusCycleRoot(null); + kfm.setGlobalCurrentFocusCycleRootPriv(null); } } @@ -3506,7 +3506,7 @@ public class Container extends Component { public void transferFocusDownCycle() { if (isFocusCycleRoot()) { KeyboardFocusManager.getCurrentKeyboardFocusManager(). - setGlobalCurrentFocusCycleRoot(this); + setGlobalCurrentFocusCycleRootPriv(this); Component toFocus = getFocusTraversalPolicy(). getDefaultComponent(this); if (toFocus != null) { diff --git a/jdk/src/share/classes/java/awt/KeyboardFocusManager.java b/jdk/src/share/classes/java/awt/KeyboardFocusManager.java index d12ed9e3c64..5e7792a26d8 100644 --- a/jdk/src/share/classes/java/awt/KeyboardFocusManager.java +++ b/jdk/src/share/classes/java/awt/KeyboardFocusManager.java @@ -637,8 +637,8 @@ public abstract class KeyboardFocusManager } void clearGlobalFocusOwnerPriv() { - AccessController.doPrivileged(new PrivilegedAction() { - public Object run() { + AccessController.doPrivileged(new PrivilegedAction() { + public Void run() { clearGlobalFocusOwner(); return null; } @@ -1287,6 +1287,15 @@ public abstract class KeyboardFocusManager newFocusCycleRoot); } + void setGlobalCurrentFocusCycleRootPriv(final Container newFocusCycleRoot) { + AccessController.doPrivileged(new PrivilegedAction() { + public Void run() { + setGlobalCurrentFocusCycleRoot(newFocusCycleRoot); + return null; + } + }); + } + /** * Adds a PropertyChangeListener to the listener list. The listener is * registered for all bound properties of this class, including the From be3945d9ff5c8a0167714c9d8c81b6c423c71fbe Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rickard=20B=C3=A4ckman?= Date: Tue, 22 May 2012 10:11:53 +0200 Subject: [PATCH 099/128] 7161732: Improve handling of thread_id in OSThread Reviewed-by: dholmes, kamg --- hotspot/src/os/bsd/vm/osThread_bsd.hpp | 54 +++---------------- hotspot/src/os/linux/vm/osThread_linux.hpp | 17 +----- .../src/os/solaris/vm/osThread_solaris.hpp | 6 +-- .../src/os/windows/vm/osThread_windows.hpp | 10 ++-- .../os_cpu/bsd_x86/vm/vmStructs_bsd_x86.hpp | 10 +--- .../linux_sparc/vm/vmStructs_linux_sparc.hpp | 6 +-- .../linux_x86/vm/vmStructs_linux_x86.hpp | 6 +-- .../vm/vmStructs_solaris_sparc.hpp | 6 +-- .../solaris_x86/vm/vmStructs_solaris_x86.hpp | 6 +-- .../windows_x86/vm/vmStructs_windows_x86.hpp | 4 +- hotspot/src/share/vm/runtime/osThread.hpp | 18 +++++-- 11 files changed, 44 insertions(+), 99 deletions(-) diff --git a/hotspot/src/os/bsd/vm/osThread_bsd.hpp b/hotspot/src/os/bsd/vm/osThread_bsd.hpp index 914a0439c02..c72b36025f6 100644 --- a/hotspot/src/os/bsd/vm/osThread_bsd.hpp +++ b/hotspot/src/os/bsd/vm/osThread_bsd.hpp @@ -42,26 +42,19 @@ #ifdef _ALLBSD_SOURCE #ifdef __APPLE__ - thread_t _thread_id; + typedef thread_t thread_id_t; #else - pthread_t _thread_id; + typedef pthread_t thread_id_t; +#endif + +#else + typedef pid_t thread_id_t; #endif // _pthread_id is the pthread id, which is used by library calls // (e.g. pthread_kill). pthread_t _pthread_id; -#else - // _thread_id is kernel thread id (similar to LWP id on Solaris). Each - // thread has a unique thread_id (BsdThreads or NPTL). It can be used - // to access /proc. - pid_t _thread_id; - - // _pthread_id is the pthread id, which is used by library calls - // (e.g. pthread_kill). - pthread_t _pthread_id; -#endif - sigset_t _caller_sigmask; // Caller's signal mask public: @@ -70,28 +63,11 @@ sigset_t caller_sigmask() const { return _caller_sigmask; } void set_caller_sigmask(sigset_t sigmask) { _caller_sigmask = sigmask; } -#ifdef _ALLBSD_SOURCE -#ifdef __APPLE__ - static size_t thread_id_size() { return sizeof(thread_t); } - thread_t thread_id() const { - return _thread_id; - } -#else - static size_t thread_id_size() { return sizeof(pthread_t); } - pthread_t thread_id() const { - return _thread_id; - } -#endif -#else - static size_t thread_id_size() { return sizeof(pid_t); } - pid_t thread_id() const { - return _thread_id; - } -#endif #ifndef PRODUCT // Used for debugging, return a unique integer for each thread. intptr_t thread_identifier() const { return (intptr_t)_pthread_id; } #endif + #ifdef ASSERT // We expect no reposition failures so kill vm if we get one. // @@ -99,21 +75,7 @@ return false; } #endif // ASSERT -#ifdef _ALLBSD_SOURCE -#ifdef __APPLE__ - void set_thread_id(thread_t id) { - _thread_id = id; - } -#else - void set_thread_id(pthread_t id) { - _thread_id = id; - } -#endif -#else - void set_thread_id(pid_t id) { - _thread_id = id; - } -#endif + pthread_t pthread_id() const { return _pthread_id; } diff --git a/hotspot/src/os/linux/vm/osThread_linux.hpp b/hotspot/src/os/linux/vm/osThread_linux.hpp index fe9fe6188fa..904ab52e68f 100644 --- a/hotspot/src/os/linux/vm/osThread_linux.hpp +++ b/hotspot/src/os/linux/vm/osThread_linux.hpp @@ -24,6 +24,8 @@ #ifndef OS_LINUX_VM_OSTHREAD_LINUX_HPP #define OS_LINUX_VM_OSTHREAD_LINUX_HPP + public: + typedef pid_t thread_id_t; private: int _thread_type; @@ -37,13 +39,6 @@ _thread_type = type; } - private: - - // _thread_id is kernel thread id (similar to LWP id on Solaris). Each - // thread has a unique thread_id (LinuxThreads or NPTL). It can be used - // to access /proc. - pid_t _thread_id; - // _pthread_id is the pthread id, which is used by library calls // (e.g. pthread_kill). pthread_t _pthread_id; @@ -56,11 +51,6 @@ sigset_t caller_sigmask() const { return _caller_sigmask; } void set_caller_sigmask(sigset_t sigmask) { _caller_sigmask = sigmask; } - static size_t thread_id_size() { return sizeof(pid_t); } - - pid_t thread_id() const { - return _thread_id; - } #ifndef PRODUCT // Used for debugging, return a unique integer for each thread. int thread_identifier() const { return _thread_id; } @@ -72,9 +62,6 @@ return false; } #endif // ASSERT - void set_thread_id(pid_t id) { - _thread_id = id; - } pthread_t pthread_id() const { return _pthread_id; } diff --git a/hotspot/src/os/solaris/vm/osThread_solaris.hpp b/hotspot/src/os/solaris/vm/osThread_solaris.hpp index 6e79e1855db..2a7a2470a08 100644 --- a/hotspot/src/os/solaris/vm/osThread_solaris.hpp +++ b/hotspot/src/os/solaris/vm/osThread_solaris.hpp @@ -26,9 +26,10 @@ #define OS_SOLARIS_VM_OSTHREAD_SOLARIS_HPP // This is embedded via include into the class OSThread + public: + typedef thread_t thread_id_t; private: - thread_t _thread_id; // Solaris thread id uint _lwp_id; // lwp ID, only used with bound threads int _native_priority; // Saved native priority when starting // a bound thread @@ -36,8 +37,6 @@ bool _vm_created_thread; // true if the VM created this thread, // false if primary thread or attached thread public: - static size_t thread_id_size() { return sizeof(thread_t); } - thread_t thread_id() const { return _thread_id; } uint lwp_id() const { return _lwp_id; } int native_priority() const { return _native_priority; } @@ -63,7 +62,6 @@ return true; } #endif - void set_thread_id(thread_t id) { _thread_id = id; } void set_lwp_id(uint id) { _lwp_id = id; } void set_native_priority(int prio) { _native_priority = prio; } diff --git a/hotspot/src/os/windows/vm/osThread_windows.hpp b/hotspot/src/os/windows/vm/osThread_windows.hpp index 28cd45c5c2f..af07695aa75 100644 --- a/hotspot/src/os/windows/vm/osThread_windows.hpp +++ b/hotspot/src/os/windows/vm/osThread_windows.hpp @@ -25,12 +25,13 @@ #ifndef OS_WINDOWS_VM_OSTHREAD_WINDOWS_HPP #define OS_WINDOWS_VM_OSTHREAD_WINDOWS_HPP -typedef void* HANDLE; + typedef void* HANDLE; + public: + typedef unsigned long thread_id_t; private: // Win32-specific thread information HANDLE _thread_handle; // Win32 thread handle - unsigned long _thread_id; // Win32 thread id HANDLE _interrupt_event; // Event signalled on thread interrupt ThreadState _last_state; @@ -42,9 +43,6 @@ typedef void* HANDLE; HANDLE interrupt_event() const { return _interrupt_event; } void set_interrupt_event(HANDLE interrupt_event) { _interrupt_event = interrupt_event; } - - static size_t thread_id_size() { return sizeof(unsigned long); } - unsigned long thread_id() const { return _thread_id; } #ifndef PRODUCT // Used for debugging, return a unique integer for each thread. int thread_identifier() const { return _thread_id; } @@ -56,8 +54,6 @@ typedef void* HANDLE; return false; } #endif // ASSERT - void set_thread_id(unsigned long thread_id) { _thread_id = thread_id; } - bool is_try_mutex_enter() { return false; } // This is a temporary fix for the thread states during diff --git a/hotspot/src/os_cpu/bsd_x86/vm/vmStructs_bsd_x86.hpp b/hotspot/src/os_cpu/bsd_x86/vm/vmStructs_bsd_x86.hpp index 4ccf8074424..b98d975408a 100644 --- a/hotspot/src/os_cpu/bsd_x86/vm/vmStructs_bsd_x86.hpp +++ b/hotspot/src/os_cpu/bsd_x86/vm/vmStructs_bsd_x86.hpp @@ -29,18 +29,12 @@ // constants required by the Serviceability Agent. This file is // referenced by vmStructs.cpp. -#ifdef __APPLE__ -#define OS_THREAD_ID_TYPE thread_t -#else -#define OS_THREAD_ID_TYPE pthread_t -#endif - #define VM_STRUCTS_OS_CPU(nonstatic_field, static_field, unchecked_nonstatic_field, volatile_nonstatic_field, nonproduct_nonstatic_field, c2_nonstatic_field, unchecked_c1_static_field, unchecked_c2_static_field, last_entry) \ \ /******************************/ \ /* Threads (NOTE: incomplete) */ \ /******************************/ \ - nonstatic_field(OSThread, _thread_id, OS_THREAD_ID_TYPE) \ + nonstatic_field(OSThread, _thread_id, OSThread::thread_id_t) \ nonstatic_field(OSThread, _pthread_id, pthread_t) \ /* This must be the last entry, and must be present */ \ last_entry() @@ -52,7 +46,7 @@ /* Posix Thread IDs */ \ /**********************/ \ \ - declare_unsigned_integer_type(thread_t) \ + declare_unsigned_integer_type(OSThread::thread_id_t) \ declare_unsigned_integer_type(pthread_t) \ \ /* This must be the last entry, and must be present */ \ diff --git a/hotspot/src/os_cpu/linux_sparc/vm/vmStructs_linux_sparc.hpp b/hotspot/src/os_cpu/linux_sparc/vm/vmStructs_linux_sparc.hpp index 4b0a3e63a29..58fc94bbc38 100644 --- a/hotspot/src/os_cpu/linux_sparc/vm/vmStructs_linux_sparc.hpp +++ b/hotspot/src/os_cpu/linux_sparc/vm/vmStructs_linux_sparc.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 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 @@ -36,7 +36,7 @@ /******************************/ \ \ nonstatic_field(JavaThread, _base_of_stack_pointer, intptr_t*) \ - nonstatic_field(OSThread, _thread_id, pid_t) \ + nonstatic_field(OSThread, _thread_id, OSThread::thread_id_t) \ nonstatic_field(OSThread, _pthread_id, pthread_t) \ /* This must be the last entry, and must be present */ \ last_entry() @@ -48,7 +48,7 @@ /* POSIX Thread IDs */ \ /**********************/ \ \ - declare_integer_type(pid_t) \ + declare_integer_type(OSThread::thread_id_t) \ declare_unsigned_integer_type(pthread_t) \ \ /* This must be the last entry, and must be present */ \ diff --git a/hotspot/src/os_cpu/linux_x86/vm/vmStructs_linux_x86.hpp b/hotspot/src/os_cpu/linux_x86/vm/vmStructs_linux_x86.hpp index c54cb1d729d..c01e6c91c2a 100644 --- a/hotspot/src/os_cpu/linux_x86/vm/vmStructs_linux_x86.hpp +++ b/hotspot/src/os_cpu/linux_x86/vm/vmStructs_linux_x86.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 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 @@ -34,7 +34,7 @@ /******************************/ \ /* Threads (NOTE: incomplete) */ \ /******************************/ \ - nonstatic_field(OSThread, _thread_id, pid_t) \ + nonstatic_field(OSThread, _thread_id, OSThread::thread_id_t) \ nonstatic_field(OSThread, _pthread_id, pthread_t) \ /* This must be the last entry, and must be present */ \ last_entry() @@ -46,7 +46,7 @@ /* Posix Thread IDs */ \ /**********************/ \ \ - declare_integer_type(pid_t) \ + declare_integer_type(OSThread::thread_id_t) \ declare_unsigned_integer_type(pthread_t) \ \ /* This must be the last entry, and must be present */ \ diff --git a/hotspot/src/os_cpu/solaris_sparc/vm/vmStructs_solaris_sparc.hpp b/hotspot/src/os_cpu/solaris_sparc/vm/vmStructs_solaris_sparc.hpp index 710e3369042..58113a9ea49 100644 --- a/hotspot/src/os_cpu/solaris_sparc/vm/vmStructs_solaris_sparc.hpp +++ b/hotspot/src/os_cpu/solaris_sparc/vm/vmStructs_solaris_sparc.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 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 @@ -36,7 +36,7 @@ /******************************/ \ \ nonstatic_field(JavaThread, _base_of_stack_pointer, intptr_t*) \ - nonstatic_field(OSThread, _thread_id, thread_t) \ + nonstatic_field(OSThread, _thread_id, OSThread::thread_id_t) \ /* This must be the last entry, and must be present */ \ last_entry() @@ -47,7 +47,7 @@ /* Solaris Thread IDs */ \ /**********************/ \ \ - declare_unsigned_integer_type(thread_t) \ + declare_unsigned_integer_type(OSThread::thread_id_t) \ \ /* This must be the last entry, and must be present */ \ last_entry() diff --git a/hotspot/src/os_cpu/solaris_x86/vm/vmStructs_solaris_x86.hpp b/hotspot/src/os_cpu/solaris_x86/vm/vmStructs_solaris_x86.hpp index 76338956021..a2a4f7c60b7 100644 --- a/hotspot/src/os_cpu/solaris_x86/vm/vmStructs_solaris_x86.hpp +++ b/hotspot/src/os_cpu/solaris_x86/vm/vmStructs_solaris_x86.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 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 @@ -35,7 +35,7 @@ /* Threads (NOTE: incomplete) */ \ /******************************/ \ \ - nonstatic_field(OSThread, _thread_id, thread_t) \ + nonstatic_field(OSThread, _thread_id, OSThread::thread_id_t) \ \ /* This must be the last entry, and must be present */ \ last_entry() @@ -46,7 +46,7 @@ /* Solaris Thread IDs */ \ /**********************/ \ \ - declare_unsigned_integer_type(thread_t) \ + declare_unsigned_integer_type(OSThread::thread_id_t) \ \ /* This must be the last entry, and must be present */ \ last_entry() diff --git a/hotspot/src/os_cpu/windows_x86/vm/vmStructs_windows_x86.hpp b/hotspot/src/os_cpu/windows_x86/vm/vmStructs_windows_x86.hpp index 6df1f7226fa..46e5f4c4251 100644 --- a/hotspot/src/os_cpu/windows_x86/vm/vmStructs_windows_x86.hpp +++ b/hotspot/src/os_cpu/windows_x86/vm/vmStructs_windows_x86.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 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 @@ -35,7 +35,7 @@ /* Threads (NOTE: incomplete) */ \ /******************************/ \ \ - nonstatic_field(OSThread, _thread_id, unsigned long) \ + nonstatic_field(OSThread, _thread_id, OSThread::thread_id_t) \ unchecked_nonstatic_field(OSThread, _thread_handle, sizeof(HANDLE)) /* NOTE: no type */ \ \ /* This must be the last entry, and must be present */ \ diff --git a/hotspot/src/share/vm/runtime/osThread.hpp b/hotspot/src/share/vm/runtime/osThread.hpp index bb3fd79637b..c0f2b1932c9 100644 --- a/hotspot/src/share/vm/runtime/osThread.hpp +++ b/hotspot/src/share/vm/runtime/osThread.hpp @@ -61,7 +61,6 @@ enum ThreadState { class OSThread: public CHeapObj { friend class VMStructs; private: - //void* _start_proc; // Thread start routine OSThreadStartFunc _start_proc; // Thread start routine void* _start_parm; // Thread start routine parameter volatile ThreadState _state; // Thread state *hint* @@ -77,10 +76,7 @@ class OSThread: public CHeapObj { void set_state(ThreadState state) { _state = state; } ThreadState get_state() { return _state; } - // Constructor OSThread(OSThreadStartFunc start_proc, void* start_parm); - - // Destructor ~OSThread(); // Accessors @@ -98,7 +94,6 @@ class OSThread: public CHeapObj { // For java intrinsics: static ByteSize interrupted_offset() { return byte_offset_of(OSThread, _interrupted); } - static ByteSize thread_id_offset() { return byte_offset_of(OSThread, _thread_id); } // Platform dependent stuff #ifdef TARGET_OS_FAMILY_linux @@ -114,6 +109,19 @@ class OSThread: public CHeapObj { # include "osThread_bsd.hpp" #endif + public: + static ByteSize thread_id_offset() { return byte_offset_of(OSThread, _thread_id); } + static size_t thread_id_size() { return sizeof(thread_id_t); } + + thread_id_t thread_id() const { return _thread_id; } + + void set_thread_id(thread_id_t id) { _thread_id = id; } + + private: + // _thread_id is kernel thread id (similar to LWP id on Solaris). Each + // thread has a unique thread_id (BsdThreads or NPTL). It can be used + // to access /proc. + thread_id_t _thread_id; }; From 529f652312162ad9a385f4d9ff11b03f5997106f Mon Sep 17 00:00:00 2001 From: David Holmes Date: Wed, 23 May 2012 20:09:56 -0400 Subject: [PATCH 100/128] 7170197: Update JPRT default build targets to support embedded builds Reviewed-by: jcoomes, kvn --- hotspot/make/jprt.properties | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/hotspot/make/jprt.properties b/hotspot/make/jprt.properties index b4ad0af98b0..964413b8ff1 100644 --- a/hotspot/make/jprt.properties +++ b/hotspot/make/jprt.properties @@ -133,7 +133,8 @@ jprt.build.targets.standard= \ ${jprt.my.linux.x64}-{product|fastdebug}, \ ${jprt.my.macosx.x64}-{product|fastdebug|debug}, \ ${jprt.my.windows.i586}-{product|fastdebug|debug}, \ - ${jprt.my.windows.x64}-{product|fastdebug|debug} + ${jprt.my.windows.x64}-{product|fastdebug|debug}, \ + ${jprt.my.linux.armvfp}-{product|fastdebug} jprt.build.targets.open= \ ${jprt.my.solaris.i586}-{productOpen}, \ From 0ccc41fc10da0c2c5e0b461388bae7ef8987a3fa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rickard=20B=C3=A4ckman?= Date: Thu, 24 May 2012 13:37:47 +0200 Subject: [PATCH 101/128] 7171422: Change 7161732 breaks SA on Windows Reviewed-by: dholmes, sla --- hotspot/src/os_cpu/windows_x86/vm/vmStructs_windows_x86.hpp | 1 + 1 file changed, 1 insertion(+) diff --git a/hotspot/src/os_cpu/windows_x86/vm/vmStructs_windows_x86.hpp b/hotspot/src/os_cpu/windows_x86/vm/vmStructs_windows_x86.hpp index 46e5f4c4251..69d25c93186 100644 --- a/hotspot/src/os_cpu/windows_x86/vm/vmStructs_windows_x86.hpp +++ b/hotspot/src/os_cpu/windows_x86/vm/vmStructs_windows_x86.hpp @@ -43,6 +43,7 @@ #define VM_TYPES_OS_CPU(declare_type, declare_toplevel_type, declare_oop_type, declare_integer_type, declare_unsigned_integer_type, declare_c1_toplevel_type, declare_c2_type, declare_c2_toplevel_type, last_entry) \ \ + declare_unsigned_integer_type(OSThread::thread_id_t) \ /* This must be the last entry, and must be present */ \ last_entry() From cad78d6f046f6edee3bf2f91e19a4227b9d17c7f Mon Sep 17 00:00:00 2001 From: "Daniel D. Daugherty" Date: Thu, 24 May 2012 12:03:42 -0700 Subject: [PATCH 102/128] 7165598: enable FDS on Solaris X64 when 7165593 is fixed Work around 'gobjcopy' failure on Solaris X64 by adding a temporary tool that removes the SHF_ALLOC flag from "empty" section headers. Reviewed-by: sspitsyn, acorn --- hotspot/make/solaris/makefiles/defs.make | 23 +-- hotspot/make/solaris/makefiles/dtrace.make | 37 +++- .../makefiles/fix_empty_sec_hdr_flags.make | 51 +++++ hotspot/make/solaris/makefiles/jsig.make | 15 +- hotspot/make/solaris/makefiles/saproc.make | 13 +- hotspot/make/solaris/makefiles/vm.make | 17 +- .../fix_empty_sec_hdr_flags.c | 181 ++++++++++++++++++ 7 files changed, 301 insertions(+), 36 deletions(-) create mode 100644 hotspot/make/solaris/makefiles/fix_empty_sec_hdr_flags.make create mode 100644 hotspot/src/os/solaris/fix_empty_sec_hdr_flags/fix_empty_sec_hdr_flags.c diff --git a/hotspot/make/solaris/makefiles/defs.make b/hotspot/make/solaris/makefiles/defs.make index 8e480946bc8..7c79113ce3a 100644 --- a/hotspot/make/solaris/makefiles/defs.make +++ b/hotspot/make/solaris/makefiles/defs.make @@ -111,25 +111,10 @@ ifeq ($(JDK6_OR_EARLIER),0) ifeq ($(ENABLE_FULL_DEBUG_SYMBOLS),1) # Default OBJCOPY comes from the SUNWbinutils package: DEF_OBJCOPY=/usr/sfw/bin/gobjcopy - ifeq ($(VM_PLATFORM),solaris_amd64) - # On Solaris AMD64/X64, gobjcopy is not happy and fails: - # - # usr/sfw/bin/gobjcopy --add-gnu-debuglink=.debuginfo .so - # BFD: stKPaiop: Not enough room for program headers, try linking with -N - # /usr/sfw/bin/gobjcopy: stKPaiop: Bad value - # BFD: stKPaiop: Not enough room for program headers, try linking with -N - # /usr/sfw/bin/gobjcopy: libsaproc.debuginfo: Bad value - # BFD: stKPaiop: Not enough room for program headers, try linking with -N - # /usr/sfw/bin/gobjcopy: stKPaiop: Bad value - _JUNK_ := $(shell \ - echo >&2 "INFO: $(DEF_OBJCOPY) is not working on Solaris AMD64/X64") - OBJCOPY= - else - OBJCOPY=$(shell test -x $(DEF_OBJCOPY) && echo $(DEF_OBJCOPY)) - ifneq ($(ALT_OBJCOPY),) - _JUNK_ := $(shell echo >&2 "INFO: ALT_OBJCOPY=$(ALT_OBJCOPY)") - OBJCOPY=$(shell test -x $(ALT_OBJCOPY) && echo $(ALT_OBJCOPY)) - endif + OBJCOPY=$(shell test -x $(DEF_OBJCOPY) && echo $(DEF_OBJCOPY)) + ifneq ($(ALT_OBJCOPY),) + _JUNK_ := $(shell echo >&2 "INFO: ALT_OBJCOPY=$(ALT_OBJCOPY)") + OBJCOPY=$(shell test -x $(ALT_OBJCOPY) && echo $(ALT_OBJCOPY)) endif else OBJCOPY= diff --git a/hotspot/make/solaris/makefiles/dtrace.make b/hotspot/make/solaris/makefiles/dtrace.make index 6b15fc2f185..d8dc58b8135 100644 --- a/hotspot/make/solaris/makefiles/dtrace.make +++ b/hotspot/make/solaris/makefiles/dtrace.make @@ -108,15 +108,24 @@ XLIBJVM_DTRACE_DIZ = 64/$(LIBJVM_DTRACE_DIZ) XLIBJVM_DTRACE_G_DEBUGINFO = 64/$(LIBJVM_DTRACE_G_DEBUGINFO) XLIBJVM_DTRACE_G_DIZ = 64/$(LIBJVM_DTRACE_G_DIZ) -$(XLIBJVM_DB): $(DTRACE_SRCDIR)/$(JVM_DB).c $(JVMOFFS).h $(LIBJVM_DB_MAPFILE) +$(XLIBJVM_DB): $(ADD_GNU_DEBUGLINK) $(FIX_EMPTY_SEC_HDR_FLAGS) $(DTRACE_SRCDIR)/$(JVM_DB).c $(JVMOFFS).h $(LIBJVM_DB_MAPFILE) @echo Making $@ $(QUIETLY) mkdir -p 64/ ; \ $(CC) $(SYMFLAG) $(ARCHFLAG/$(ISA)) -D$(TYPE) -I. -I$(GENERATED) \ $(SHARED_FLAG) $(LFLAGS_JVM_DB) -o $@ $(DTRACE_SRCDIR)/$(JVM_DB).c -lc [ -f $(XLIBJVM_DB_G) ] || { ln -s $(LIBJVM_DB) $(XLIBJVM_DB_G); } ifeq ($(ENABLE_FULL_DEBUG_SYMBOLS),1) +# gobjcopy crashes on "empty" section headers with the SHF_ALLOC flag set. +# Clear the SHF_ALLOC flag (if set) from empty section headers. +# An empty section header has sh_addr == 0 and sh_size == 0. +# This problem has only been seen on Solaris X64, but we call this tool +# on all Solaris builds just in case. + $(QUIETLY) $(FIX_EMPTY_SEC_HDR_FLAGS) $@ $(QUIETLY) $(OBJCOPY) --only-keep-debug $@ $(XLIBJVM_DB_DEBUGINFO) - $(QUIETLY) $(OBJCOPY) --add-gnu-debuglink=$(XLIBJVM_DB_DEBUGINFO) $@ +# $(OBJCOPY) --add-gnu-debuglink=... corrupts SUNW_* sections. +# Use $(ADD_GNU_DEBUGLINK) until a fixed $(OBJCOPY) is available. +# $(QUIETLY) $(OBJCOPY) --add-gnu-debuglink=$(XLIBJVM_DB_DEBUGINFO) $@ + $(QUIETLY) $(ADD_GNU_DEBUGLINK) $(XLIBJVM_DB_DEBUGINFO) $@ ifeq ($(STRIP_POLICY),all_strip) $(QUIETLY) $(STRIP) $@ else @@ -133,15 +142,19 @@ ifeq ($(ENABLE_FULL_DEBUG_SYMBOLS),1) endif endif -$(XLIBJVM_DTRACE): $(DTRACE_SRCDIR)/$(JVM_DTRACE).c $(DTRACE_SRCDIR)/$(JVM_DTRACE).h $(LIBJVM_DTRACE_MAPFILE) +$(XLIBJVM_DTRACE): $(ADD_GNU_DEBUGLINK) $(FIX_EMPTY_SEC_HDR_FLAGS) $(DTRACE_SRCDIR)/$(JVM_DTRACE).c $(DTRACE_SRCDIR)/$(JVM_DTRACE).h $(LIBJVM_DTRACE_MAPFILE) @echo Making $@ $(QUIETLY) mkdir -p 64/ ; \ $(CC) $(SYMFLAG) $(ARCHFLAG/$(ISA)) -D$(TYPE) -I. \ $(SHARED_FLAG) $(LFLAGS_JVM_DTRACE) -o $@ $(DTRACE_SRCDIR)/$(JVM_DTRACE).c -lc -lthread -ldoor [ -f $(XLIBJVM_DTRACE_G) ] || { ln -s $(LIBJVM_DTRACE) $(XLIBJVM_DTRACE_G); } ifeq ($(ENABLE_FULL_DEBUG_SYMBOLS),1) +# Clear the SHF_ALLOC flag (if set) from empty section headers. + $(QUIETLY) $(FIX_EMPTY_SEC_HDR_FLAGS) $@ $(QUIETLY) $(OBJCOPY) --only-keep-debug $@ $(XLIBJVM_DTRACE_DEBUGINFO) - $(QUIETLY) $(OBJCOPY) --add-gnu-debuglink=$(XLIBJVM_DTRACE_DEBUGINFO) $@ +# $(OBJCOPY) --add-gnu-debuglink=... corrupts SUNW_* sections. +# $(QUIETLY) $(OBJCOPY) --add-gnu-debuglink=$(XLIBJVM_DTRACE_DEBUGINFO) $@ + $(QUIETLY) $(ADD_GNU_DEBUGLINK) $(XLIBJVM_DTRACE_DEBUGINFO) $@ ifeq ($(STRIP_POLICY),all_strip) $(QUIETLY) $(STRIP) $@ else @@ -198,14 +211,18 @@ $(JVMOFFS).cpp: $(GENOFFS) $(JVMOFFS).h $(JVMOFFS)Index.h $(JVMOFFS.o): $(JVMOFFS).h $(JVMOFFS).cpp $(QUIETLY) $(CXX) -c -I. -o $@ $(ARCHFLAG) -D$(TYPE) $(JVMOFFS).cpp -$(LIBJVM_DB): $(DTRACE_SRCDIR)/$(JVM_DB).c $(JVMOFFS.o) $(XLIBJVM_DB) $(LIBJVM_DB_MAPFILE) +$(LIBJVM_DB): $(ADD_GNU_DEBUGLINK) $(FIX_EMPTY_SEC_HDR_FLAGS) $(DTRACE_SRCDIR)/$(JVM_DB).c $(JVMOFFS.o) $(XLIBJVM_DB) $(LIBJVM_DB_MAPFILE) @echo Making $@ $(QUIETLY) $(CC) $(SYMFLAG) $(ARCHFLAG) -D$(TYPE) -I. -I$(GENERATED) \ $(SHARED_FLAG) $(LFLAGS_JVM_DB) -o $@ $(DTRACE_SRCDIR)/$(JVM_DB).c -lc [ -f $(LIBJVM_DB_G) ] || { ln -s $@ $(LIBJVM_DB_G); } ifeq ($(ENABLE_FULL_DEBUG_SYMBOLS),1) +# Clear the SHF_ALLOC flag (if set) from empty section headers. + $(QUIETLY) $(FIX_EMPTY_SEC_HDR_FLAGS) $@ $(QUIETLY) $(OBJCOPY) --only-keep-debug $@ $(LIBJVM_DB_DEBUGINFO) - $(QUIETLY) $(OBJCOPY) --add-gnu-debuglink=$(LIBJVM_DB_DEBUGINFO) $@ +# $(OBJCOPY) --add-gnu-debuglink=... corrupts SUNW_* sections. +# $(QUIETLY) $(OBJCOPY) --add-gnu-debuglink=$(LIBJVM_DB_DEBUGINFO) $@ + $(QUIETLY) $(ADD_GNU_DEBUGLINK) $(LIBJVM_DB_DEBUGINFO) $@ ifeq ($(STRIP_POLICY),all_strip) $(QUIETLY) $(STRIP) $@ else @@ -222,14 +239,18 @@ ifeq ($(ENABLE_FULL_DEBUG_SYMBOLS),1) endif endif -$(LIBJVM_DTRACE): $(DTRACE_SRCDIR)/$(JVM_DTRACE).c $(XLIBJVM_DTRACE) $(DTRACE_SRCDIR)/$(JVM_DTRACE).h $(LIBJVM_DTRACE_MAPFILE) +$(LIBJVM_DTRACE): $(ADD_GNU_DEBUGLINK) $(FIX_EMPTY_SEC_HDR_FLAGS) $(DTRACE_SRCDIR)/$(JVM_DTRACE).c $(XLIBJVM_DTRACE) $(DTRACE_SRCDIR)/$(JVM_DTRACE).h $(LIBJVM_DTRACE_MAPFILE) @echo Making $@ $(QUIETLY) $(CC) $(SYMFLAG) $(ARCHFLAG) -D$(TYPE) -I. \ $(SHARED_FLAG) $(LFLAGS_JVM_DTRACE) -o $@ $(DTRACE_SRCDIR)/$(JVM_DTRACE).c -lc -lthread -ldoor [ -f $(LIBJVM_DTRACE_G) ] || { ln -s $@ $(LIBJVM_DTRACE_G); } ifeq ($(ENABLE_FULL_DEBUG_SYMBOLS),1) +# Clear the SHF_ALLOC flag (if set) from empty section headers. + $(QUIETLY) $(FIX_EMPTY_SEC_HDR_FLAGS) $@ $(QUIETLY) $(OBJCOPY) --only-keep-debug $@ $(LIBJVM_DTRACE_DEBUGINFO) - $(QUIETLY) $(OBJCOPY) --add-gnu-debuglink=$(LIBJVM_DTRACE_DEBUGINFO) $@ +# $(OBJCOPY) --add-gnu-debuglink=... corrupts SUNW_* sections. +# $(QUIETLY) $(OBJCOPY) --add-gnu-debuglink=$(LIBJVM_DTRACE_DEBUGINFO) $@ + $(QUIETLY) $(ADD_GNU_DEBUGLINK) $(LIBJVM_DTRACE_DEBUGINFO) $@ ifeq ($(STRIP_POLICY),all_strip) $(QUIETLY) $(STRIP) $@ else diff --git a/hotspot/make/solaris/makefiles/fix_empty_sec_hdr_flags.make b/hotspot/make/solaris/makefiles/fix_empty_sec_hdr_flags.make new file mode 100644 index 00000000000..75e15bf193e --- /dev/null +++ b/hotspot/make/solaris/makefiles/fix_empty_sec_hdr_flags.make @@ -0,0 +1,51 @@ +# +# Copyright (c) 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. +# +# + +# Rules to build fix_empty_sec_hdr_flags, used by vm.make on Solaris + +GENERATED = ../generated +FIX_EMPTY_SEC_HDR_FLAGS = $(GENERATED)/fix_empty_sec_hdr_flags + +FIX_EMPTY_SEC_HDR_FLAGS_DIR = $(GAMMADIR)/src/os/solaris/fix_empty_sec_hdr_flags +FIX_EMPTY_SEC_HDR_FLAGS_SRC = $(FIX_EMPTY_SEC_HDR_FLAGS_DIR)/fix_empty_sec_hdr_flags.c +FIX_EMPTY_SEC_HDR_FLAGS_FLAGS = +LIBS_FIX_EMPTY_SEC_HDR_FLAGS += -lelf + +ifeq ("${Platform_compiler}", "sparcWorks") +# Enable the following FIX_EMPTY_SEC_HDR_FLAGS_FLAGS addition if you need to +# compare the built ELF objects. +# +# The -g option makes static data global and the "-W0,-noglobal" +# option tells the compiler to not globalize static data using a unique +# globalization prefix. Instead force the use of a static globalization +# prefix based on the source filepath so the objects from two identical +# compilations are the same. +# +# Note: The blog says to use "-W0,-xglobalstatic", but that doesn't +# seem to work. I got "-W0,-noglobal" from Kelly and that works. +#FIX_EMPTY_SEC_HDR_FLAGS_FLAGS += -W0,-noglobal +endif # Platform_compiler == sparcWorks + +$(FIX_EMPTY_SEC_HDR_FLAGS): $(FIX_EMPTY_SEC_HDR_FLAGS_SRC) + $(CC) -g -o $@ $< $(FIX_EMPTY_SEC_HDR_FLAGS_FLAGS) $(LIBS_FIX_EMPTY_SEC_HDR_FLAGS) diff --git a/hotspot/make/solaris/makefiles/jsig.make b/hotspot/make/solaris/makefiles/jsig.make index 6cc40754107..3a7204715ef 100644 --- a/hotspot/make/solaris/makefiles/jsig.make +++ b/hotspot/make/solaris/makefiles/jsig.make @@ -52,14 +52,23 @@ else LFLAGS_JSIG += -mt -xnolib endif -$(LIBJSIG): $(JSIGSRCDIR)/jsig.c $(LIBJSIG_MAPFILE) +$(LIBJSIG): $(ADD_GNU_DEBUGLINK) $(FIX_EMPTY_SEC_HDR_FLAGS) $(JSIGSRCDIR)/jsig.c $(LIBJSIG_MAPFILE) @echo Making signal interposition lib... $(QUIETLY) $(CC) $(SYMFLAG) $(ARCHFLAG) $(SHARED_FLAG) $(PICFLAG) \ - $(LFLAGS_JSIG) -o $@ $< -ldl + $(LFLAGS_JSIG) -o $@ $(JSIGSRCDIR)/jsig.c -ldl [ -f $(LIBJSIG_G) ] || { ln -s $@ $(LIBJSIG_G); } ifeq ($(ENABLE_FULL_DEBUG_SYMBOLS),1) +# gobjcopy crashes on "empty" section headers with the SHF_ALLOC flag set. +# Clear the SHF_ALLOC flag (if set) from empty section headers. +# An empty section header has sh_addr == 0 and sh_size == 0. +# This problem has only been seen on Solaris X64, but we call this tool +# on all Solaris builds just in case. + $(QUIETLY) $(FIX_EMPTY_SEC_HDR_FLAGS) $@ $(QUIETLY) $(OBJCOPY) --only-keep-debug $@ $(LIBJSIG_DEBUGINFO) - $(QUIETLY) $(OBJCOPY) --add-gnu-debuglink=$(LIBJSIG_DEBUGINFO) $@ +# $(OBJCOPY) --add-gnu-debuglink=... corrupts SUNW_* sections. +# Use $(ADD_GNU_DEBUGLINK) until a fixed $(OBJCOPY) is available. +# $(QUIETLY) $(OBJCOPY) --add-gnu-debuglink=$(LIBJSIG_DEBUGINFO) $@ + $(QUIETLY) $(ADD_GNU_DEBUGLINK) $(LIBJSIG_DEBUGINFO) $@ ifeq ($(STRIP_POLICY),all_strip) $(QUIETLY) $(STRIP) $@ else diff --git a/hotspot/make/solaris/makefiles/saproc.make b/hotspot/make/solaris/makefiles/saproc.make index d4c305c6839..3e16f431d73 100644 --- a/hotspot/make/solaris/makefiles/saproc.make +++ b/hotspot/make/solaris/makefiles/saproc.make @@ -90,7 +90,7 @@ $(shell uname -r -v \ # when actually building on Nevada-B158 or earlier: #SOLARIS_11_B159_OR_LATER=-DSOLARIS_11_B159_OR_LATER -$(LIBSAPROC): $(SASRCFILES) $(SAMAPFILE) +$(LIBSAPROC): $(ADD_GNU_DEBUGLINK) $(FIX_EMPTY_SEC_HDR_FLAGS) $(SASRCFILES) $(SAMAPFILE) $(QUIETLY) if [ "$(BOOT_JAVA_HOME)" = "" ]; then \ echo "ALT_BOOTDIR, BOOTDIR or JAVA_HOME needs to be defined to build SA"; \ exit 1; \ @@ -109,8 +109,17 @@ $(LIBSAPROC): $(SASRCFILES) $(SAMAPFILE) -ldl -ldemangle -lthread -lc [ -f $(LIBSAPROC_G) ] || { ln -s $@ $(LIBSAPROC_G); } ifeq ($(ENABLE_FULL_DEBUG_SYMBOLS),1) +# gobjcopy crashes on "empty" section headers with the SHF_ALLOC flag set. +# Clear the SHF_ALLOC flag (if set) from empty section headers. +# An empty section header has sh_addr == 0 and sh_size == 0. +# This problem has only been seen on Solaris X64, but we call this tool +# on all Solaris builds just in case. + $(QUIETLY) $(FIX_EMPTY_SEC_HDR_FLAGS) $@ $(QUIETLY) $(OBJCOPY) --only-keep-debug $@ $(LIBSAPROC_DEBUGINFO) - $(QUIETLY) $(OBJCOPY) --add-gnu-debuglink=$(LIBSAPROC_DEBUGINFO) $@ +# $(OBJCOPY) --add-gnu-debuglink=... corrupts SUNW_* sections. +# Use $(ADD_GNU_DEBUGLINK) until a fixed $(OBJCOPY) is available. +# $(QUIETLY) $(OBJCOPY) --add-gnu-debuglink=$(LIBSAPROC_DEBUGINFO) $@ + $(QUIETLY) $(ADD_GNU_DEBUGLINK) $(LIBSAPROC_DEBUGINFO) $@ ifeq ($(STRIP_POLICY),all_strip) $(QUIETLY) $(STRIP) $@ else diff --git a/hotspot/make/solaris/makefiles/vm.make b/hotspot/make/solaris/makefiles/vm.make index ce3df9abe24..4fc8d3253b6 100644 --- a/hotspot/make/solaris/makefiles/vm.make +++ b/hotspot/make/solaris/makefiles/vm.make @@ -148,6 +148,10 @@ include $(MAKEFILES_DIR)/dtrace.make # add_gnu_debuglink tool include $(MAKEFILES_DIR)/add_gnu_debuglink.make +#---------------------------------------------------------------------- +# fix_empty_sec_hdr_flags tool +include $(MAKEFILES_DIR)/fix_empty_sec_hdr_flags.make + #---------------------------------------------------------------------- # JVM @@ -280,7 +284,7 @@ else LINK_VM = $(LINK_LIB.CXX) endif # making the library: -$(LIBJVM): $(ADD_GNU_DEBUGLINK) $(LIBJVM.o) $(LIBJVM_MAPFILE) +$(LIBJVM): $(ADD_GNU_DEBUGLINK) $(FIX_EMPTY_SEC_HDR_FLAGS) $(LIBJVM.o) $(LIBJVM_MAPFILE) ifeq ($(filter -sbfast -xsbfast, $(CFLAGS_BROWSE)),) @echo Linking vm... $(QUIETLY) $(LINK_LIB.CXX/PRE_HOOK) @@ -290,10 +294,15 @@ ifeq ($(filter -sbfast -xsbfast, $(CFLAGS_BROWSE)),) $(QUIETLY) [ -f $(LIBJVM_G) ] || ln -s $@ $(LIBJVM_G) $(QUIETLY) [ -f $(LIBJVM_G).1 ] || ln -s $@.1 $(LIBJVM_G).1 ifeq ($(ENABLE_FULL_DEBUG_SYMBOLS),1) +# gobjcopy crashes on "empty" section headers with the SHF_ALLOC flag set. +# Clear the SHF_ALLOC flag (if set) from empty section headers. +# An empty section header has sh_addr == 0 and sh_size == 0. +# This problem has only been seen on Solaris X64, but we call this tool +# on all Solaris builds just in case. + $(QUIETLY) $(FIX_EMPTY_SEC_HDR_FLAGS) $@ $(QUIETLY) $(OBJCOPY) --only-keep-debug $@ $(LIBJVM_DEBUGINFO) -# $(OBJCOPY) --add-gnu-debuglink=... corrupts the SUNW_dof section -# in libjvm.so. Use $(ADD_GNU_DEBUGLINK) until a fixed $(OBJCOPY) -# is available. +# $(OBJCOPY) --add-gnu-debuglink=... corrupts SUNW_* sections. +# Use $(ADD_GNU_DEBUGLINK) until a fixed $(OBJCOPY) is available. # $(QUIETLY) $(OBJCOPY) --add-gnu-debuglink=$(LIBJVM_DEBUGINFO) $@ $(QUIETLY) $(ADD_GNU_DEBUGLINK) $(LIBJVM_DEBUGINFO) $@ ifeq ($(STRIP_POLICY),all_strip) diff --git a/hotspot/src/os/solaris/fix_empty_sec_hdr_flags/fix_empty_sec_hdr_flags.c b/hotspot/src/os/solaris/fix_empty_sec_hdr_flags/fix_empty_sec_hdr_flags.c new file mode 100644 index 00000000000..6582d950639 --- /dev/null +++ b/hotspot/src/os/solaris/fix_empty_sec_hdr_flags/fix_empty_sec_hdr_flags.c @@ -0,0 +1,181 @@ +/* + * Copyright (c) 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. + * + */ + +/* + * Name: fix_empty_sec_hdr_flags.c + * + * Description: Remove the SHF_ALLOC flag from "empty" section headers. + * An "empty" section header has sh_addr == 0 and sh_size == 0. + * + * This program is adapted from the example program shown on the + * elf(3elf) man page and from code from the Solaris compiler + * driver. + */ + +#include +#include +#include +#include +#include +#include + +static void failure(void); + +void +main(int argc, char ** argv) { + void * ehdr; /* ELF header */ + unsigned int i; /* section counter */ + int fd; /* descriptor for file */ + Elf * elf; /* ELF descriptor */ + char * elf_ident; /* ELF identity string */ + char * elf_obj; /* elf_obj file */ + int fix_count; /* number of flags fixed */ + int is_elfclass64; /* is an ELFCLASS64 file? */ + Elf_Scn * scn; /* ELF section descriptor */ + void * shdr; /* ELF section header */ + Elf_Data * shstrtab; /* ELF section header string table */ + + if (argc != 2) { + (void) fprintf(stderr, "Usage: %s elf_obj\n", argv[0]); + exit(2); + } + + /* open the elf_obj */ + elf_obj = argv[1]; + if ((fd = open(elf_obj, O_RDWR)) == -1) { + (void) fprintf(stderr, "%s: cannot open file.\n", elf_obj); + exit(3); + } + + (void) printf("Opening '%s' for update\n", elf_obj); + (void) fflush(stdout); + (void) elf_version(EV_CURRENT); /* coordinate ELF versions */ + + /* obtain the ELF descriptors from the input file */ + if ((elf = elf_begin(fd, ELF_C_RDWR, NULL)) == NULL) { + failure(); + } + + /* determine if ELFCLASS64 or not? */ + elf_ident = elf_getident(elf, NULL); + is_elfclass64 = (elf_ident[EI_CLASS] == ELFCLASS64); + + /* get the ELF header */ + if (is_elfclass64) { + ehdr = elf64_getehdr(elf); + } else { + ehdr = elf32_getehdr(elf); + } + if (ehdr == NULL) { + failure(); + } + + /* get the ELF section descriptor */ + if (is_elfclass64) { + scn = elf_getscn(elf, ((Elf64_Ehdr *) ehdr)->e_shstrndx); + } else { + scn = elf_getscn(elf, ((Elf32_Ehdr *) ehdr)->e_shstrndx); + } + if (scn == NULL) { + failure(); + } + + /* get the section header string table */ + shstrtab = elf_getdata(scn, NULL); + if (shstrtab == NULL) { + failure(); + } + + fix_count = 0; + + /* traverse the sections of the input file */ + for (i = 1, scn = NULL; scn = elf_nextscn(elf, scn); i++) { + int has_flag_set; /* is SHF_ALLOC flag set? */ + int is_empty; /* is section empty? */ + char * name; /* short hand pointer */ + + /* get the section header */ + if (is_elfclass64) { + shdr = elf64_getshdr(scn); + } else { + shdr = elf32_getshdr(scn); + } + if (shdr == NULL) { + failure(); + } + + if (is_elfclass64) { + name = (char *)shstrtab->d_buf + ((Elf64_Shdr *) shdr)->sh_name; + } else { + name = (char *)shstrtab->d_buf + ((Elf32_Shdr *) shdr)->sh_name; + } + + if (is_elfclass64) { + has_flag_set = ((Elf64_Shdr *) shdr)->sh_flags & SHF_ALLOC; + is_empty = ((Elf64_Shdr *) shdr)->sh_addr == 0 && + ((Elf64_Shdr *) shdr)->sh_size == 0; + } else { + has_flag_set = ((Elf32_Shdr *) shdr)->sh_flags & SHF_ALLOC; + is_empty = ((Elf32_Shdr *) shdr)->sh_addr == 0 && + ((Elf32_Shdr *) shdr)->sh_size == 0; + } + + if (is_empty && has_flag_set) { + (void) printf("section[%u] '%s' is empty, " + "but SHF_ALLOC flag is set.\n", i, name); + (void) printf("Clearing the SHF_ALLOC flag.\n"); + + if (is_elfclass64) { + ((Elf64_Shdr *) shdr)->sh_flags &= ~SHF_ALLOC; + } else { + ((Elf32_Shdr *) shdr)->sh_flags &= ~SHF_ALLOC; + } + fix_count++; + } + } /* end for each ELF section */ + + if (fix_count > 0) { + (void) printf("Saving %d updates to '%s'\n", fix_count, elf_obj); + (void) fflush(stdout); + (void) elf_update(elf, ELF_C_NULL); /* recalc ELF memory structures */ + (void) elf_update(elf, ELF_C_WRITE); /* write out changes to ELF obj */ + } else { + (void) printf("No SHF_ALLOC flags needed to be cleared.\n"); + } + + (void) elf_end(elf); /* done with ELF obj */ + (void) close(fd); + + (void) printf("Done %s '%s'\n", + (fix_count > 0) ? "updating" : "with", elf_obj); + (void) fflush(stdout); + exit(0); +} /* end main */ + + +static void +failure() { + (void) fprintf(stderr, "%s\n", elf_errmsg(elf_errno())); + exit(6); +} From b0d8fccba710e92b92b77c54ed8a09f5bd20e4ad Mon Sep 17 00:00:00 2001 From: David Katleman Date: Thu, 24 May 2012 16:15:30 -0700 Subject: [PATCH 103/128] Added tag jdk8-b40 for changeset 7693b47ff4f5 --- .hgtags-top-repo | 1 + 1 file changed, 1 insertion(+) diff --git a/.hgtags-top-repo b/.hgtags-top-repo index 5b76297fec5..5688a089f99 100644 --- a/.hgtags-top-repo +++ b/.hgtags-top-repo @@ -161,3 +161,4 @@ cc771d92284f71765eca14d6d08703c4af254c04 jdk8-b21 b2972095a4b1e2a97409b7c3df61f3b263a5ce14 jdk8-b37 d939bd0ab13c16647ffa38cc4b64fb31b7d44e10 jdk8-b38 8927dd68aee3fa54a1a698e2980e1b2f6c7c12c1 jdk8-b39 +a2b2d435f1d275fa8010774c653197c64e326d3a jdk8-b40 From 9432db3c2ce694e7f132016554a796328016cb83 Mon Sep 17 00:00:00 2001 From: David Katleman Date: Thu, 24 May 2012 16:15:32 -0700 Subject: [PATCH 104/128] Added tag jdk8-b40 for changeset 966bd1f6ee4c --- corba/.hgtags | 1 + 1 file changed, 1 insertion(+) diff --git a/corba/.hgtags b/corba/.hgtags index 611c780360f..f65a0ee93f3 100644 --- a/corba/.hgtags +++ b/corba/.hgtags @@ -161,3 +161,4 @@ a5a61f259961a7f46b002e5cc50b4a9bf86927b6 jdk8-b36 83fac66442cf680bb59ec9e3a71cc4729322b595 jdk8-b37 b8cbfb31139f820e5e094ba71449e58159fbe22e jdk8-b38 785af00e2827990f149b32ec37f523dbca3efdd1 jdk8-b39 +56d030e5035fdee5bba6cf318a06287fda5d67ec jdk8-b40 From 42a2cab56e281230022b0c2eb8e0ed3ccec6e1c9 Mon Sep 17 00:00:00 2001 From: David Katleman Date: Thu, 24 May 2012 16:15:37 -0700 Subject: [PATCH 105/128] Added tag jdk8-b40 for changeset 287fd8991324 --- hotspot/.hgtags | 1 + 1 file changed, 1 insertion(+) diff --git a/hotspot/.hgtags b/hotspot/.hgtags index 03a516d1f0d..05ac000d31d 100644 --- a/hotspot/.hgtags +++ b/hotspot/.hgtags @@ -248,3 +248,4 @@ bfcf92bfefb82da00f7fdbf0d9273feaa0a9456d jdk8-b37 73147e6c48813b5fee904aa33f79a77103250ff4 hs24-b10 96a403721094ecdaf6a1f4f52ebd0a82e07df199 jdk8-b39 14b0e07ab9a6fa1662414496b7e07ac8450cf517 hs24-b11 +ff9decc8235d5af80ea45fda4ecbe643ea252564 jdk8-b40 From a0c3e086d9d0f1a140e6556adf4c38c4406dcc12 Mon Sep 17 00:00:00 2001 From: David Katleman Date: Thu, 24 May 2012 16:15:45 -0700 Subject: [PATCH 106/128] Added tag jdk8-b40 for changeset aaf5a4412dd3 --- jaxp/.hgtags | 1 + 1 file changed, 1 insertion(+) diff --git a/jaxp/.hgtags b/jaxp/.hgtags index 0c06d95a38f..73ec4bb7df7 100644 --- a/jaxp/.hgtags +++ b/jaxp/.hgtags @@ -161,3 +161,4 @@ cfd288fe1d3e2b700838342e70d71d44ac991af5 jdk8-b36 90204bfab4e2bed402badcc997cbf8446ab5669f jdk8-b37 5bbe0cb6f2f2d7ce292da77bf4fa9d618d770a78 jdk8-b38 f95fdbe525c88ef0d57dc1390be6582a8af5e07c jdk8-b39 +9ecfdbd6aed4702674eaede2023b4a19513d6b36 jdk8-b40 From 0f097de5737c5c7308c8f855818df7adc73e1900 Mon Sep 17 00:00:00 2001 From: David Katleman Date: Thu, 24 May 2012 16:15:49 -0700 Subject: [PATCH 107/128] Added tag jdk8-b40 for changeset 907be86f2bd8 --- jaxws/.hgtags | 1 + 1 file changed, 1 insertion(+) diff --git a/jaxws/.hgtags b/jaxws/.hgtags index a0c4c18e846..7c13cce610a 100644 --- a/jaxws/.hgtags +++ b/jaxws/.hgtags @@ -161,3 +161,4 @@ e8afc16522e190cb93c66bcb15d6fba0fe9e6833 jdk8-b35 b05a948db1b6c933c980f24e4dc8fd897b7cf4ef jdk8-b37 ac1ba3b56775e3cdcd91b7a48793b59f6a3c18b5 jdk8-b38 7f6b44fd303478caa83575dbc225de187c509c50 jdk8-b39 +09a0ddda03cb36deb6ee9edf789da12aa4674c6b jdk8-b40 From 66750be14c44dfc23b9059b8fd938dfe3cf0eee4 Mon Sep 17 00:00:00 2001 From: David Katleman Date: Thu, 24 May 2012 16:15:58 -0700 Subject: [PATCH 108/128] Added tag jdk8-b40 for changeset 95f428cdf9d2 --- jdk/.hgtags | 1 + 1 file changed, 1 insertion(+) diff --git a/jdk/.hgtags b/jdk/.hgtags index 29bb09eac0e..d1ac29cc4ec 100644 --- a/jdk/.hgtags +++ b/jdk/.hgtags @@ -161,3 +161,4 @@ ddfe5562f61f54ed2121ac0c73b688b94f3e66b5 jdk8-b32 9e82ac15ab80370d6e021aea7b98c7c9626adb5e jdk8-b37 c45f3509a70796c54b48f32910d1caf435763416 jdk8-b38 b6f52911752110a2889681923992c7a0baa52ccc jdk8-b39 +b88fc3359dc7edabfa8a228855d8cebf8843c055 jdk8-b40 From 1c9465c6df887c3f1b5b913e4253149da7e5affc Mon Sep 17 00:00:00 2001 From: David Katleman Date: Thu, 24 May 2012 16:16:05 -0700 Subject: [PATCH 109/128] Added tag jdk8-b40 for changeset 305a3d828f11 --- langtools/.hgtags | 1 + 1 file changed, 1 insertion(+) diff --git a/langtools/.hgtags b/langtools/.hgtags index 56653f53587..2e6c4389303 100644 --- a/langtools/.hgtags +++ b/langtools/.hgtags @@ -161,3 +161,4 @@ defd666a786334465496c8901fa302b779c7e045 jdk8-b35 5891b38985e8b2502296fc29e726b527d03116d2 jdk8-b37 1f224f160aa852c9541380735a27a3439dfb7217 jdk8-b38 a9f547c218d957306dfc0cdd710be041bb62a555 jdk8-b39 +86e0dad6aadf626bf5755f503aee2d0da525d9d5 jdk8-b40 From 3f38785a0a1ea95e883dcb2730fd8a730995940f Mon Sep 17 00:00:00 2001 From: John Cuthbertson Date: Tue, 29 May 2012 10:18:02 -0700 Subject: [PATCH 110/128] 7143858: G1: Back to back young GCs with the second GC having a minimally sized eden Before the last thread to leave a JNI critical region was able to schedule a GCLocker Initiated GC, another thread was attempting an allocation and saw that the GCLocker region was no longer active and successfully scheduled a GC. Stall allocating threads until the GCLocker Initiated GC is performed and then retry the allocation. Reviewed-by: brutisso, huntch --- .../gc_implementation/g1/g1CollectedHeap.cpp | 36 +++++++++++++++---- 1 file changed, 30 insertions(+), 6 deletions(-) diff --git a/hotspot/src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp b/hotspot/src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp index 9d1f9d92ddc..212d578e076 100644 --- a/hotspot/src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp +++ b/hotspot/src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp @@ -952,9 +952,18 @@ HeapWord* G1CollectedHeap::attempt_allocation_slow(size_t word_size, } should_try_gc = false; } else { - // Read the GC count while still holding the Heap_lock. - gc_count_before = total_collections(); - should_try_gc = true; + // The GCLocker may not be active but the GCLocker initiated + // GC may not yet have been performed (GCLocker::needs_gc() + // returns true). In this case we do not try this GC and + // wait until the GCLocker initiated GC is performed, and + // then retry the allocation. + if (GC_locker::needs_gc()) { + should_try_gc = false; + } else { + // Read the GC count while still holding the Heap_lock. + gc_count_before = total_collections(); + should_try_gc = true; + } } } @@ -975,6 +984,9 @@ HeapWord* G1CollectedHeap::attempt_allocation_slow(size_t word_size, return NULL; } } else { + // The GCLocker is either active or the GCLocker initiated + // GC has not yet been performed. Stall until it is and + // then retry the allocation. GC_locker::stall_until_clear(); } @@ -1054,9 +1066,18 @@ HeapWord* G1CollectedHeap::attempt_allocation_humongous(size_t word_size, if (GC_locker::is_active_and_needs_gc()) { should_try_gc = false; } else { - // Read the GC count while still holding the Heap_lock. - gc_count_before = total_collections(); - should_try_gc = true; + // The GCLocker may not be active but the GCLocker initiated + // GC may not yet have been performed (GCLocker::needs_gc() + // returns true). In this case we do not try this GC and + // wait until the GCLocker initiated GC is performed, and + // then retry the allocation. + if (GC_locker::needs_gc()) { + should_try_gc = false; + } else { + // Read the GC count while still holding the Heap_lock. + gc_count_before = total_collections(); + should_try_gc = true; + } } } @@ -1081,6 +1102,9 @@ HeapWord* G1CollectedHeap::attempt_allocation_humongous(size_t word_size, return NULL; } } else { + // The GCLocker is either active or the GCLocker initiated + // GC has not yet been performed. Stall until it is and + // then retry the allocation. GC_locker::stall_until_clear(); } From b76f6e07ab7d11b8d77a4b793beef5dba86ec079 Mon Sep 17 00:00:00 2001 From: Bengt Rutisson Date: Fri, 25 May 2012 22:35:13 +0200 Subject: [PATCH 111/128] 7171936: LOG_G incorrectly defined in globalDefinitions.hpp Removed LOG_G and LOG_K. Moved LOG_M to where it is being used. Reviewed-by: twisti, johnc --- .../src/share/vm/gc_implementation/g1/heapRegionRemSet.cpp | 3 ++- hotspot/src/share/vm/utilities/globalDefinitions.hpp | 4 ---- 2 files changed, 2 insertions(+), 5 deletions(-) diff --git a/hotspot/src/share/vm/gc_implementation/g1/heapRegionRemSet.cpp b/hotspot/src/share/vm/gc_implementation/g1/heapRegionRemSet.cpp index a23bd79a7b3..fc275a6edae 100644 --- a/hotspot/src/share/vm/gc_implementation/g1/heapRegionRemSet.cpp +++ b/hotspot/src/share/vm/gc_implementation/g1/heapRegionRemSet.cpp @@ -1106,7 +1106,8 @@ HeapRegionRemSet::HeapRegionRemSet(G1BlockOffsetSharedArray* bosa, void HeapRegionRemSet::setup_remset_size() { // Setup sparse and fine-grain tables sizes. // table_size = base * (log(region_size / 1M) + 1) - int region_size_log_mb = MAX2((int)HeapRegion::LogOfHRGrainBytes - (int)LOG_M, 0); + const int LOG_M = 20; + int region_size_log_mb = MAX2(HeapRegion::LogOfHRGrainBytes - LOG_M, 0); if (FLAG_IS_DEFAULT(G1RSetSparseRegionEntries)) { G1RSetSparseRegionEntries = G1RSetSparseRegionEntriesBase * (region_size_log_mb + 1); } diff --git a/hotspot/src/share/vm/utilities/globalDefinitions.hpp b/hotspot/src/share/vm/utilities/globalDefinitions.hpp index 82a9333b789..19dcec160f4 100644 --- a/hotspot/src/share/vm/utilities/globalDefinitions.hpp +++ b/hotspot/src/share/vm/utilities/globalDefinitions.hpp @@ -161,10 +161,6 @@ const size_t M = K*K; const size_t G = M*K; const size_t HWperKB = K / sizeof(HeapWord); -const size_t LOG_K = 10; -const size_t LOG_M = 2 * LOG_K; -const size_t LOG_G = 2 * LOG_M; - const jint min_jint = (jint)1 << (sizeof(jint)*BitsPerByte-1); // 0x80000000 == smallest jint const jint max_jint = (juint)min_jint - 1; // 0x7FFFFFFF == largest jint From 963943745e800dab3298e2e5abbeac2b9438c033 Mon Sep 17 00:00:00 2001 From: Alejandro Murillo Date: Fri, 25 May 2012 14:45:36 -0700 Subject: [PATCH 112/128] Added tag hs24-b12 for changeset 686dd42705db --- hotspot/.hgtags | 1 + 1 file changed, 1 insertion(+) diff --git a/hotspot/.hgtags b/hotspot/.hgtags index 05ac000d31d..0c36bc11c20 100644 --- a/hotspot/.hgtags +++ b/hotspot/.hgtags @@ -249,3 +249,4 @@ bfcf92bfefb82da00f7fdbf0d9273feaa0a9456d jdk8-b37 96a403721094ecdaf6a1f4f52ebd0a82e07df199 jdk8-b39 14b0e07ab9a6fa1662414496b7e07ac8450cf517 hs24-b11 ff9decc8235d5af80ea45fda4ecbe643ea252564 jdk8-b40 +785573170238f0eae6dc8e22ecf1050fbc9ea055 hs24-b12 From a5780148fd35ef24b356b3d93430eb6b6c131d68 Mon Sep 17 00:00:00 2001 From: Alejandro Murillo Date: Fri, 25 May 2012 14:56:19 -0700 Subject: [PATCH 113/128] 7171853: new hotspot build - hs24-b13 Reviewed-by: jcoomes --- hotspot/make/hotspot_version | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hotspot/make/hotspot_version b/hotspot/make/hotspot_version index 01760936fd5..fd867f1ad0a 100644 --- a/hotspot/make/hotspot_version +++ b/hotspot/make/hotspot_version @@ -35,7 +35,7 @@ HOTSPOT_VM_COPYRIGHT=Copyright 2012 HS_MAJOR_VER=24 HS_MINOR_VER=0 -HS_BUILD_NUMBER=12 +HS_BUILD_NUMBER=13 JDK_MAJOR_VER=1 JDK_MINOR_VER=8 From 7da56bf73511359ca53df9d5b0652af9c70fcdec Mon Sep 17 00:00:00 2001 From: Magnus Ihse Bursie Date: Fri, 25 May 2012 18:55:22 -0700 Subject: [PATCH 114/128] 7172014: Remove empty and unused javah include files Reviewed-by: ohair, erikj --- jdk/src/share/native/sun/awt/image/cvutils/img_dcm.h | 2 -- jdk/src/share/native/sun/awt/image/cvutils/img_dcm8.h | 2 -- jdk/src/share/native/sun/java2d/pipe/SpanClipRenderer.c | 1 - jdk/src/solaris/native/sun/awt/initIDs.c | 2 -- 4 files changed, 7 deletions(-) diff --git a/jdk/src/share/native/sun/awt/image/cvutils/img_dcm.h b/jdk/src/share/native/sun/awt/image/cvutils/img_dcm.h index 4bc29f0ee59..a3eb74d5265 100644 --- a/jdk/src/share/native/sun/awt/image/cvutils/img_dcm.h +++ b/jdk/src/share/native/sun/awt/image/cvutils/img_dcm.h @@ -52,8 +52,6 @@ #define DecodeDeclared #endif -#include "java_awt_image_DirectColorModel.h" - #define DeclareDCMVars \ IfAlpha(int alpha_mask; \ int alpha_scale; \ diff --git a/jdk/src/share/native/sun/awt/image/cvutils/img_dcm8.h b/jdk/src/share/native/sun/awt/image/cvutils/img_dcm8.h index df3d5bf4919..42a29434c81 100644 --- a/jdk/src/share/native/sun/awt/image/cvutils/img_dcm8.h +++ b/jdk/src/share/native/sun/awt/image/cvutils/img_dcm8.h @@ -52,8 +52,6 @@ #define DecodeDeclared #endif -#include "java_awt_image_DirectColorModel.h" - #define DeclareDCM8Vars \ IfAlpha(unsigned int alpha_off;) \ unsigned int red_off, green_off, blue_off; diff --git a/jdk/src/share/native/sun/java2d/pipe/SpanClipRenderer.c b/jdk/src/share/native/sun/java2d/pipe/SpanClipRenderer.c index addb4ad6e37..ad53574bdeb 100644 --- a/jdk/src/share/native/sun/java2d/pipe/SpanClipRenderer.c +++ b/jdk/src/share/native/sun/java2d/pipe/SpanClipRenderer.c @@ -31,7 +31,6 @@ #include "jni_util.h" #include "sun_java2d_pipe_SpanClipRenderer.h" -#include "sun_java2d_pipe_RegionIterator.h" jfieldID pBandsArrayID; jfieldID pEndIndexID; diff --git a/jdk/src/solaris/native/sun/awt/initIDs.c b/jdk/src/solaris/native/sun/awt/initIDs.c index 41080d6dcec..3bd1e68903c 100644 --- a/jdk/src/solaris/native/sun/awt/initIDs.c +++ b/jdk/src/solaris/native/sun/awt/initIDs.c @@ -26,14 +26,12 @@ #include "java_awt_Color.h" #include "java_awt_Dimension.h" #include "java_awt_MenuBar.h" -//#include "java_awt_Label.h" #include "java_awt_FontMetrics.h" #include "java_awt_event_MouseEvent.h" #include "java_awt_Rectangle.h" #include "java_awt_ScrollPaneAdjustable.h" #include "java_awt_Toolkit.h" #include "java_awt_CheckboxMenuItem.h" -#include "sun_awt_CharsetString.h" #include "jni_util.h" From 884f00e27eb9135c3a23343b8a7d1f7f03d0b09b Mon Sep 17 00:00:00 2001 From: David Holmes Date: Wed, 30 May 2012 00:37:21 -0400 Subject: [PATCH 115/128] 7171653: 32-bit cross-compile on 64-bit build host generates 64-bit data for awt/X11 leading to crash Reviewed-by: ohair, anthony --- jdk/make/sun/xawt/Makefile | 23 +++++++++++++++-------- jdk/makefiles/sun/xawt/Makefile | 24 ++++++++++++++++-------- 2 files changed, 31 insertions(+), 16 deletions(-) diff --git a/jdk/make/sun/xawt/Makefile b/jdk/make/sun/xawt/Makefile index 6ed7370888f..791bd2dc326 100644 --- a/jdk/make/sun/xawt/Makefile +++ b/jdk/make/sun/xawt/Makefile @@ -1,5 +1,5 @@ # -# Copyright (c) 2002, 2011, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2002, 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 @@ -225,10 +225,16 @@ ifeq ($(ARCH_DATA_MODEL), 32) SIZERS = $(SIZER).32 SIZERS_C = $(SIZER_32_C) SIZES = $(WRAPPER_GENERATOR_DIR)/sizes.32 +ifdef CROSS_COMPILE_ARCH +CFLAGS_32 = -m32 +endif else # !32 SIZERS = $(SIZER).64 SIZERS_C = $(SIZER_64_C) SIZES = $(WRAPPER_GENERATOR_DIR)/sizes.64 +ifdef CROSS_COMPILE_ARCH +CFLAGS_64 = -m64 +endif endif # 32 endif # !macosx endif # solaris @@ -264,15 +270,16 @@ WRAPPER_GENERATOR_TEMPDIR=$(TEMPDIR)/sun/awt/X11/generator WRAPPER_GENERATOR_CLASS=$(WRAPPER_GENERATOR_TEMPDIR)/WrapperGenerator.class XLIBTYPES=$(PLATFORM_SRC)/classes/sun/awt/X11/generator/xlibtypes.txt +ifndef CROSS_COMPILE_ARCH +SIZERS_CC = $(CC) +else +SIZERS_CC = $(HOST_CC) +endif + $(SIZERS): $(SIZERS_C) $(prep-target) -ifndef CROSS_COMPILE_ARCH - $(CC) $(CFLAGS_$(subst .,,$(suffix $@))) $(CPPFLAGS) -c -o $(SIZER)$(suffix $@).o $(SIZER)$(suffix $@).c - $(CC) $(CFLAGS_$(subst .,,$(suffix $@))) -o $@ $(CPPFLAGS) $(SIZER)$(suffix $@).o -else - $(HOST_CC) $(CPPFLAGS) -c -o $(SIZER)$(suffix $@).o $(SIZER)$(suffix $@).c - $(HOST_CC) $(CPPFLAGS) -o $@ $(SIZER)$(suffix $@).o -endif + $(SIZERS_CC) $(CFLAGS_$(subst .,,$(suffix $@))) $(CPPFLAGS) -c -o $(SIZER)$(suffix $@).o $(SIZER)$(suffix $@).c + $(SIZERS_CC) $(CFLAGS_$(subst .,,$(suffix $@))) -o $@ $(CPPFLAGS) $(SIZER)$(suffix $@).o $(WRAPPER_GENERATOR_CLASS): $(WRAPPER_GENERATOR_JAVA) $(prep-target) diff --git a/jdk/makefiles/sun/xawt/Makefile b/jdk/makefiles/sun/xawt/Makefile index 14409bd18f2..14b0651843a 100644 --- a/jdk/makefiles/sun/xawt/Makefile +++ b/jdk/makefiles/sun/xawt/Makefile @@ -1,5 +1,5 @@ # -# Copyright (c) 2002, 2011, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2002, 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 @@ -225,10 +225,16 @@ ifeq ($(ARCH_DATA_MODEL), 32) SIZERS = $(SIZER).32 SIZERS_C = $(SIZER_32_C) SIZES = $(WRAPPER_GENERATOR_DIR)/sizes.32 +ifdef CROSS_COMPILE_ARCH +CFLAGS_32 = -m32 +endif else # !32 SIZERS = $(SIZER).64 SIZERS_C = $(SIZER_64_C) SIZES = $(WRAPPER_GENERATOR_DIR)/sizes.64 +ifdef CROSS_COMPILE_ARCH +CFLAGS_64 = -m64 +endif endif # 32 endif # !macosx endif # solaris @@ -264,15 +270,17 @@ WRAPPER_GENERATOR_TEMPDIR=$(TEMPDIR)/sun/awt/X11/generator WRAPPER_GENERATOR_CLASS=$(WRAPPER_GENERATOR_TEMPDIR)/WrapperGenerator.class XLIBTYPES=$(PLATFORM_SRC)/classes/sun/awt/X11/generator/xlibtypes.txt +ifndef CROSS_COMPILE_ARCH +SIZERS_CC = $(CC) +else +SIZERS_CC = $(HOST_CC) +endif + $(SIZERS): $(SIZERS_C) $(prep-target) -ifndef CROSS_COMPILE_ARCH - $(CC) $(CFLAGS_$(subst .,,$(suffix $@))) $(CPPFLAGS) -c -o $(SIZER)$(suffix $@).o $(SIZER)$(suffix $@).c - $(CC) $(CFLAGS_$(subst .,,$(suffix $@))) -o $@ $(CPPFLAGS) $(SIZER)$(suffix $@).o -else - $(HOST_CC) $(CPPFLAGS) -c -o $(SIZER)$(suffix $@).o $(SIZER)$(suffix $@).c - $(HOST_CC) $(CPPFLAGS) -o $@ $(SIZER)$(suffix $@).o -endif + + $(SIZERS_CC) $(CFLAGS_$(subst .,,$(suffix $@))) $(CPPFLAGS) -c -o $(SIZER)$(suffix $@).o $(SIZER)$(suffix $@).c + $(SIZERS_CC) $(CFLAGS_$(subst .,,$(suffix $@))) -o $@ $(CPPFLAGS) $(SIZER)$(suffix $@).o $(WRAPPER_GENERATOR_CLASS): $(WRAPPER_GENERATOR_JAVA) $(prep-target) From 057a1b712837b431474b050992eee217c0aa3200 Mon Sep 17 00:00:00 2001 From: John Cuthbertson Date: Wed, 30 May 2012 10:26:24 -0700 Subject: [PATCH 116/128] 7158682: G1: Handle leak when running nsk.sysdict tests Place HandleMarks in the code that allocates handles for the pending list lock so that the handles are freed and multiple, unsuccessful, attempts to schedule a GC do not cause an OOM. Reviewed-by: brutisso --- hotspot/src/share/vm/oops/instanceRefKlass.cpp | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/hotspot/src/share/vm/oops/instanceRefKlass.cpp b/hotspot/src/share/vm/oops/instanceRefKlass.cpp index 1cabe507eae..7db4f039c25 100644 --- a/hotspot/src/share/vm/oops/instanceRefKlass.cpp +++ b/hotspot/src/share/vm/oops/instanceRefKlass.cpp @@ -515,6 +515,12 @@ bool instanceRefKlass::owns_pending_list_lock(JavaThread* thread) { void instanceRefKlass::acquire_pending_list_lock(BasicLock *pending_list_basic_lock) { // we may enter this with pending exception set PRESERVE_EXCEPTION_MARK; // exceptions are never thrown, needed for TRAPS argument + + // Create a HandleMark in case we retry a GC multiple times. + // Each time we attempt the GC, we allocate the handle below + // to hold the pending list lock. We want to free this handle. + HandleMark hm; + Handle h_lock(THREAD, java_lang_ref_Reference::pending_list_lock()); ObjectSynchronizer::fast_enter(h_lock, pending_list_basic_lock, false, THREAD); assert(ObjectSynchronizer::current_thread_holds_lock( @@ -527,7 +533,12 @@ void instanceRefKlass::release_and_notify_pending_list_lock( BasicLock *pending_list_basic_lock) { // we may enter this with pending exception set PRESERVE_EXCEPTION_MARK; // exceptions are never thrown, needed for TRAPS argument - // + + // Create a HandleMark in case we retry a GC multiple times. + // Each time we attempt the GC, we allocate the handle below + // to hold the pending list lock. We want to free this handle. + HandleMark hm; + Handle h_lock(THREAD, java_lang_ref_Reference::pending_list_lock()); assert(ObjectSynchronizer::current_thread_holds_lock( JavaThread::current(), h_lock), From 212ab5c73a1f706c4d3e7b100b3b8c84d77d0407 Mon Sep 17 00:00:00 2001 From: Bengt Rutisson Date: Thu, 31 May 2012 21:10:33 +0200 Subject: [PATCH 117/128] 7172279: G1: Clean up TraceGen0Time and TraceGen1Time data gathering Simplify code, remove unused code, remove ExitAfterGCNum Reviewed-by: huntch, johnc --- .../gc_implementation/g1/g1CollectedHeap.cpp | 6 - .../g1/g1CollectorPolicy.cpp | 404 +++++++----------- .../g1/g1CollectorPolicy.hpp | 124 +++--- .../src/share/vm/memory/genCollectedHeap.cpp | 5 - hotspot/src/share/vm/runtime/globals.hpp | 3 - hotspot/src/share/vm/utilities/numberSeq.cpp | 18 - hotspot/src/share/vm/utilities/numberSeq.hpp | 1 - 7 files changed, 193 insertions(+), 368 deletions(-) diff --git a/hotspot/src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp b/hotspot/src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp index 212d578e076..27863989e0c 100644 --- a/hotspot/src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp +++ b/hotspot/src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp @@ -3930,12 +3930,6 @@ G1CollectedHeap::do_collection_pause_at_safepoint(double target_pause_time_ms) { gc_epilogue(false); } - - if (ExitAfterGCNum > 0 && total_collections() == ExitAfterGCNum) { - gclog_or_tty->print_cr("Stopping after GC #%d", ExitAfterGCNum); - print_tracing_info(); - vm_exit(-1); - } } // The closing of the inner scope, immediately above, will complete diff --git a/hotspot/src/share/vm/gc_implementation/g1/g1CollectorPolicy.cpp b/hotspot/src/share/vm/gc_implementation/g1/g1CollectorPolicy.cpp index 2050f6f5bba..b91d04a0915 100644 --- a/hotspot/src/share/vm/gc_implementation/g1/g1CollectorPolicy.cpp +++ b/hotspot/src/share/vm/gc_implementation/g1/g1CollectorPolicy.cpp @@ -133,12 +133,7 @@ G1CollectorPolicy::G1CollectorPolicy() : ? ParallelGCThreads : 1), _recent_gc_times_ms(new TruncatedSeq(NumPrevPausesForHeuristics)), - _all_pause_times_ms(new NumberSeq()), _stop_world_start(0.0), - _all_stop_world_times_ms(new NumberSeq()), - _all_yield_times_ms(new NumberSeq()), - - _summary(new Summary()), _cur_clear_ct_time_ms(0.0), _root_region_scan_wait_time_ms(0.0), @@ -154,12 +149,6 @@ G1CollectorPolicy::G1CollectorPolicy() : _num_cc_clears(0L), #endif - _aux_num(10), - _all_aux_times_ms(new NumberSeq[_aux_num]), - _cur_aux_start_times_ms(new double[_aux_num]), - _cur_aux_times_ms(new double[_aux_num]), - _cur_aux_times_set(new bool[_aux_num]), - _concurrent_mark_remark_times_ms(new TruncatedSeq(NumPrevPausesForHeuristics)), _concurrent_mark_cleanup_times_ms(new TruncatedSeq(NumPrevPausesForHeuristics)), @@ -185,8 +174,6 @@ G1CollectorPolicy::G1CollectorPolicy() : _pause_time_target_ms((double) MaxGCPauseMillis), _gcs_are_young(true), - _young_pause_num(0), - _mixed_pause_num(0), _during_marking(false), _in_marking_window(false), @@ -197,8 +184,6 @@ G1CollectorPolicy::G1CollectorPolicy() : _recent_avg_pause_time_ratio(0.0), - _all_full_gc_times_ms(new NumberSeq()), - _initiate_conc_mark_if_possible(false), _during_initial_mark_pause(false), _last_young_gc(false), @@ -851,7 +836,7 @@ void G1CollectorPolicy::record_full_collection_end() { double full_gc_time_sec = end_sec - _cur_collection_start_sec; double full_gc_time_ms = full_gc_time_sec * 1000.0; - _all_full_gc_times_ms->add(full_gc_time_ms); + _trace_gen1_time_data.record_full_collection(full_gc_time_ms); update_recent_gc_times(end_sec, full_gc_time_ms); @@ -900,7 +885,7 @@ void G1CollectorPolicy::record_collection_pause_start(double start_time_sec, _g1->used(), _g1->recalculate_used())); double s_w_t_ms = (start_time_sec - _stop_world_start) * 1000.0; - _all_stop_world_times_ms->add(s_w_t_ms); + _trace_gen0_time_data.record_start_collection(s_w_t_ms); _stop_world_start = 0.0; _cur_collection_start_sec = start_time_sec; @@ -937,11 +922,6 @@ void G1CollectorPolicy::record_collection_pause_start(double start_time_sec, } #endif - for (int i = 0; i < _aux_num; ++i) { - _cur_aux_times_ms[i] = 0.0; - _cur_aux_times_set[i] = false; - } - // This is initialized to zero here and is set during the evacuation // pause if we actually waited for the root region scanning to finish. _root_region_scan_wait_time_ms = 0.0; @@ -990,7 +970,7 @@ void G1CollectorPolicy::record_concurrent_mark_cleanup_completed() { void G1CollectorPolicy::record_concurrent_pause() { if (_stop_world_start > 0.0) { double yield_ms = (os::elapsedTime() - _stop_world_start) * 1000.0; - _all_yield_times_ms->add(yield_ms); + _trace_gen0_time_data.record_yield_time(yield_ms); } } @@ -1197,21 +1177,6 @@ void G1CollectorPolicy::record_collection_pause_end(int no_of_gc_threads) { _mmu_tracker->add_pause(end_time_sec - elapsed_ms/1000.0, end_time_sec, false); - // This assert is exempted when we're doing parallel collection pauses, - // because the fragmentation caused by the parallel GC allocation buffers - // can lead to more memory being used during collection than was used - // before. Best leave this out until the fragmentation problem is fixed. - // Pauses in which evacuation failed can also lead to negative - // collections, since no space is reclaimed from a region containing an - // object whose evacuation failed. - // Further, we're now always doing parallel collection. But I'm still - // leaving this here as a placeholder for a more precise assertion later. - // (DLD, 10/05.) - assert((true || parallel) // Always using GC LABs now. - || _g1->evacuation_failed() - || _cur_collection_pause_used_at_start_bytes >= cur_used_bytes, - "Negative collection"); - size_t freed_bytes = _cur_collection_pause_used_at_start_bytes - cur_used_bytes; size_t surviving_bytes = _collection_set_bytes_used_before - freed_bytes; @@ -1259,44 +1224,15 @@ void G1CollectorPolicy::record_collection_pause_end(int no_of_gc_threads) { other_time_ms -= _cur_clear_ct_time_ms; // TraceGen0Time and TraceGen1Time summary info updating. - _all_pause_times_ms->add(elapsed_ms); if (update_stats) { - _summary->record_total_time_ms(elapsed_ms); - _summary->record_other_time_ms(other_time_ms); + double parallel_known_time = known_time + termination_time; + double parallel_other_time = _cur_collection_par_time_ms - parallel_known_time; - MainBodySummary* body_summary = _summary->main_body_summary(); - assert(body_summary != NULL, "should not be null!"); - - body_summary->record_root_region_scan_wait_time_ms( - _root_region_scan_wait_time_ms); - body_summary->record_ext_root_scan_time_ms(ext_root_scan_time); - body_summary->record_satb_filtering_time_ms(satb_filtering_time); - body_summary->record_update_rs_time_ms(update_rs_time); - body_summary->record_scan_rs_time_ms(scan_rs_time); - body_summary->record_obj_copy_time_ms(obj_copy_time); - - if (parallel) { - body_summary->record_parallel_time_ms(_cur_collection_par_time_ms); - body_summary->record_termination_time_ms(termination_time); - - double parallel_known_time = known_time + termination_time; - double parallel_other_time = _cur_collection_par_time_ms - parallel_known_time; - body_summary->record_parallel_other_time_ms(parallel_other_time); - } - - body_summary->record_clear_ct_time_ms(_cur_clear_ct_time_ms); - - // We exempt parallel collection from this check because Alloc Buffer - // fragmentation can produce negative collections. Same with evac - // failure. - // Further, we're now always doing parallel collection. But I'm still - // leaving this here as a placeholder for a more precise assertion later. - // (DLD, 10/05. - assert((true || parallel) - || _g1->evacuation_failed() - || surviving_bytes <= _collection_set_bytes_used_before, - "Or else negative collection!"); + _trace_gen0_time_data.record_end_collection( + elapsed_ms, other_time_ms, _root_region_scan_wait_time_ms, _cur_collection_par_time_ms, + ext_root_scan_time, satb_filtering_time, update_rs_time, scan_rs_time, obj_copy_time, + termination_time, parallel_other_time, _cur_clear_ct_time_ms); // this is where we update the allocation rate of the application double app_time_ms = @@ -1349,12 +1285,6 @@ void G1CollectorPolicy::record_collection_pause_end(int no_of_gc_threads) { } } - for (int i = 0; i < _aux_num; ++i) { - if (_cur_aux_times_set[i]) { - _all_aux_times_ms[i].add(_cur_aux_times_ms[i]); - } - } - if (G1Log::finer()) { bool print_marking_info = _g1->mark_in_progress() && !last_pause_included_initial_mark; @@ -1436,14 +1366,6 @@ void G1CollectorPolicy::record_collection_pause_end(int no_of_gc_threads) { print_stats(2, "Free CSet", (_recorded_young_free_cset_time_ms + _recorded_non_young_free_cset_time_ms)); - - for (int i = 0; i < _aux_num; ++i) { - if (_cur_aux_times_set[i]) { - char buffer[96]; - sprintf(buffer, "Aux%d", i); - print_stats(1, buffer, _cur_aux_times_ms[i]); - } - } } bool new_in_marking_window = _in_marking_window; @@ -1808,179 +1730,9 @@ void G1CollectorPolicy::count_CS_bytes_used() { _g1->collection_set_iterate(&cs_closure); } -void G1CollectorPolicy::print_summary(int level, - const char* str, - NumberSeq* seq) const { - double sum = seq->sum(); - LineBuffer(level + 1).append_and_print_cr("%-24s = %8.2lf s (avg = %8.2lf ms)", - str, sum / 1000.0, seq->avg()); -} - -void G1CollectorPolicy::print_summary_sd(int level, - const char* str, - NumberSeq* seq) const { - print_summary(level, str, seq); - LineBuffer(level + 6).append_and_print_cr("(num = %5d, std dev = %8.2lf ms, max = %8.2lf ms)", - seq->num(), seq->sd(), seq->maximum()); -} - -void G1CollectorPolicy::check_other_times(int level, - NumberSeq* other_times_ms, - NumberSeq* calc_other_times_ms) const { - bool should_print = false; - LineBuffer buf(level + 2); - - double max_sum = MAX2(fabs(other_times_ms->sum()), - fabs(calc_other_times_ms->sum())); - double min_sum = MIN2(fabs(other_times_ms->sum()), - fabs(calc_other_times_ms->sum())); - double sum_ratio = max_sum / min_sum; - if (sum_ratio > 1.1) { - should_print = true; - buf.append_and_print_cr("## CALCULATED OTHER SUM DOESN'T MATCH RECORDED ###"); - } - - double max_avg = MAX2(fabs(other_times_ms->avg()), - fabs(calc_other_times_ms->avg())); - double min_avg = MIN2(fabs(other_times_ms->avg()), - fabs(calc_other_times_ms->avg())); - double avg_ratio = max_avg / min_avg; - if (avg_ratio > 1.1) { - should_print = true; - buf.append_and_print_cr("## CALCULATED OTHER AVG DOESN'T MATCH RECORDED ###"); - } - - if (other_times_ms->sum() < -0.01) { - buf.append_and_print_cr("## RECORDED OTHER SUM IS NEGATIVE ###"); - } - - if (other_times_ms->avg() < -0.01) { - buf.append_and_print_cr("## RECORDED OTHER AVG IS NEGATIVE ###"); - } - - if (calc_other_times_ms->sum() < -0.01) { - should_print = true; - buf.append_and_print_cr("## CALCULATED OTHER SUM IS NEGATIVE ###"); - } - - if (calc_other_times_ms->avg() < -0.01) { - should_print = true; - buf.append_and_print_cr("## CALCULATED OTHER AVG IS NEGATIVE ###"); - } - - if (should_print) - print_summary(level, "Other(Calc)", calc_other_times_ms); -} - -void G1CollectorPolicy::print_summary(PauseSummary* summary) const { - bool parallel = G1CollectedHeap::use_parallel_gc_threads(); - MainBodySummary* body_summary = summary->main_body_summary(); - if (summary->get_total_seq()->num() > 0) { - print_summary_sd(0, "Evacuation Pauses", summary->get_total_seq()); - if (body_summary != NULL) { - print_summary(1, "Root Region Scan Wait", body_summary->get_root_region_scan_wait_seq()); - if (parallel) { - print_summary(1, "Parallel Time", body_summary->get_parallel_seq()); - print_summary(2, "Ext Root Scanning", body_summary->get_ext_root_scan_seq()); - print_summary(2, "SATB Filtering", body_summary->get_satb_filtering_seq()); - print_summary(2, "Update RS", body_summary->get_update_rs_seq()); - print_summary(2, "Scan RS", body_summary->get_scan_rs_seq()); - print_summary(2, "Object Copy", body_summary->get_obj_copy_seq()); - print_summary(2, "Termination", body_summary->get_termination_seq()); - print_summary(2, "Parallel Other", body_summary->get_parallel_other_seq()); - { - NumberSeq* other_parts[] = { - body_summary->get_ext_root_scan_seq(), - body_summary->get_satb_filtering_seq(), - body_summary->get_update_rs_seq(), - body_summary->get_scan_rs_seq(), - body_summary->get_obj_copy_seq(), - body_summary->get_termination_seq() - }; - NumberSeq calc_other_times_ms(body_summary->get_parallel_seq(), - 6, other_parts); - check_other_times(2, body_summary->get_parallel_other_seq(), - &calc_other_times_ms); - } - } else { - print_summary(1, "Ext Root Scanning", body_summary->get_ext_root_scan_seq()); - print_summary(1, "SATB Filtering", body_summary->get_satb_filtering_seq()); - print_summary(1, "Update RS", body_summary->get_update_rs_seq()); - print_summary(1, "Scan RS", body_summary->get_scan_rs_seq()); - print_summary(1, "Object Copy", body_summary->get_obj_copy_seq()); - } - } - print_summary(1, "Clear CT", body_summary->get_clear_ct_seq()); - print_summary(1, "Other", summary->get_other_seq()); - { - if (body_summary != NULL) { - NumberSeq calc_other_times_ms; - if (parallel) { - // parallel - NumberSeq* other_parts[] = { - body_summary->get_root_region_scan_wait_seq(), - body_summary->get_parallel_seq(), - body_summary->get_clear_ct_seq() - }; - calc_other_times_ms = NumberSeq(summary->get_total_seq(), - 3, other_parts); - } else { - // serial - NumberSeq* other_parts[] = { - body_summary->get_root_region_scan_wait_seq(), - body_summary->get_update_rs_seq(), - body_summary->get_ext_root_scan_seq(), - body_summary->get_satb_filtering_seq(), - body_summary->get_scan_rs_seq(), - body_summary->get_obj_copy_seq() - }; - calc_other_times_ms = NumberSeq(summary->get_total_seq(), - 6, other_parts); - } - check_other_times(1, summary->get_other_seq(), &calc_other_times_ms); - } - } - } else { - LineBuffer(1).append_and_print_cr("none"); - } - LineBuffer(0).append_and_print_cr(""); -} - void G1CollectorPolicy::print_tracing_info() const { - if (TraceGen0Time) { - gclog_or_tty->print_cr("ALL PAUSES"); - print_summary_sd(0, "Total", _all_pause_times_ms); - gclog_or_tty->print_cr(""); - gclog_or_tty->print_cr(""); - gclog_or_tty->print_cr(" Young GC Pauses: %8d", _young_pause_num); - gclog_or_tty->print_cr(" Mixed GC Pauses: %8d", _mixed_pause_num); - gclog_or_tty->print_cr(""); - - gclog_or_tty->print_cr("EVACUATION PAUSES"); - print_summary(_summary); - - gclog_or_tty->print_cr("MISC"); - print_summary_sd(0, "Stop World", _all_stop_world_times_ms); - print_summary_sd(0, "Yields", _all_yield_times_ms); - for (int i = 0; i < _aux_num; ++i) { - if (_all_aux_times_ms[i].num() > 0) { - char buffer[96]; - sprintf(buffer, "Aux%d", i); - print_summary_sd(0, buffer, &_all_aux_times_ms[i]); - } - } - } - if (TraceGen1Time) { - if (_all_full_gc_times_ms->num() > 0) { - gclog_or_tty->print("\n%4d full_gcs: total time = %8.2f s", - _all_full_gc_times_ms->num(), - _all_full_gc_times_ms->sum() / 1000.0); - gclog_or_tty->print_cr(" (avg = %8.2fms).", _all_full_gc_times_ms->avg()); - gclog_or_tty->print_cr(" [std. dev = %8.2f ms, max = %8.2f ms]", - _all_full_gc_times_ms->sd(), - _all_full_gc_times_ms->maximum()); - } - } + _trace_gen0_time_data.print(); + _trace_gen1_time_data.print(); } void G1CollectorPolicy::print_yg_surv_rate_info() const { @@ -2531,9 +2283,9 @@ void G1CollectorPolicy::finalize_cset(double target_pause_time_ms) { _last_gc_was_young = gcs_are_young() ? true : false; if (_last_gc_was_young) { - ++_young_pause_num; + _trace_gen0_time_data.increment_young_collection_count(); } else { - ++_mixed_pause_num; + _trace_gen0_time_data.increment_mixed_collection_count(); } // The young list is laid with the survivor regions from the previous @@ -2690,3 +2442,133 @@ void G1CollectorPolicy::finalize_cset(double target_pause_time_ms) { _recorded_non_young_cset_choice_time_ms = (non_young_end_time_sec - non_young_start_time_sec) * 1000.0; } + +void TraceGen0TimeData::record_start_collection(double time_to_stop_the_world_ms) { + if(TraceGen0Time) { + _all_stop_world_times_ms.add(time_to_stop_the_world_ms); + } +} + +void TraceGen0TimeData::record_yield_time(double yield_time_ms) { + if(TraceGen0Time) { + _all_yield_times_ms.add(yield_time_ms); + } +} + +void TraceGen0TimeData::record_end_collection( + double total_ms, + double other_ms, + double root_region_scan_wait_ms, + double parallel_ms, + double ext_root_scan_ms, + double satb_filtering_ms, + double update_rs_ms, + double scan_rs_ms, + double obj_copy_ms, + double termination_ms, + double parallel_other_ms, + double clear_ct_ms) +{ + if(TraceGen0Time) { + _total.add(total_ms); + _other.add(other_ms); + _root_region_scan_wait.add(root_region_scan_wait_ms); + _parallel.add(parallel_ms); + _ext_root_scan.add(ext_root_scan_ms); + _satb_filtering.add(satb_filtering_ms); + _update_rs.add(update_rs_ms); + _scan_rs.add(scan_rs_ms); + _obj_copy.add(obj_copy_ms); + _termination.add(termination_ms); + _parallel_other.add(parallel_other_ms); + _clear_ct.add(clear_ct_ms); + } +} + +void TraceGen0TimeData::increment_young_collection_count() { + if(TraceGen0Time) { + ++_young_pause_num; + } +} + +void TraceGen0TimeData::increment_mixed_collection_count() { + if(TraceGen0Time) { + ++_mixed_pause_num; + } +} + +void TraceGen0TimeData::print_summary(int level, + const char* str, + const NumberSeq* seq) const { + double sum = seq->sum(); + LineBuffer(level + 1).append_and_print_cr("%-24s = %8.2lf s (avg = %8.2lf ms)", + str, sum / 1000.0, seq->avg()); +} + +void TraceGen0TimeData::print_summary_sd(int level, + const char* str, + const NumberSeq* seq) const { + print_summary(level, str, seq); + LineBuffer(level + 6).append_and_print_cr("(num = %5d, std dev = %8.2lf ms, max = %8.2lf ms)", + seq->num(), seq->sd(), seq->maximum()); +} + +void TraceGen0TimeData::print() const { + if (!TraceGen0Time) { + return; + } + + gclog_or_tty->print_cr("ALL PAUSES"); + print_summary_sd(0, "Total", &_total); + gclog_or_tty->print_cr(""); + gclog_or_tty->print_cr(""); + gclog_or_tty->print_cr(" Young GC Pauses: %8d", _young_pause_num); + gclog_or_tty->print_cr(" Mixed GC Pauses: %8d", _mixed_pause_num); + gclog_or_tty->print_cr(""); + + gclog_or_tty->print_cr("EVACUATION PAUSES"); + + if (_young_pause_num == 0 && _mixed_pause_num == 0) { + gclog_or_tty->print_cr("none"); + } else { + print_summary_sd(0, "Evacuation Pauses", &_total); + print_summary(1, "Root Region Scan Wait", &_root_region_scan_wait); + print_summary(1, "Parallel Time", &_parallel); + print_summary(2, "Ext Root Scanning", &_ext_root_scan); + print_summary(2, "SATB Filtering", &_satb_filtering); + print_summary(2, "Update RS", &_update_rs); + print_summary(2, "Scan RS", &_scan_rs); + print_summary(2, "Object Copy", &_obj_copy); + print_summary(2, "Termination", &_termination); + print_summary(2, "Parallel Other", &_parallel_other); + print_summary(1, "Clear CT", &_clear_ct); + print_summary(1, "Other", &_other); + } + gclog_or_tty->print_cr(""); + + gclog_or_tty->print_cr("MISC"); + print_summary_sd(0, "Stop World", &_all_stop_world_times_ms); + print_summary_sd(0, "Yields", &_all_yield_times_ms); +} + +void TraceGen1TimeData::record_full_collection(double full_gc_time_ms) { + if (TraceGen1Time) { + _all_full_gc_times.add(full_gc_time_ms); + } +} + +void TraceGen1TimeData::print() const { + if (!TraceGen1Time) { + return; + } + + if (_all_full_gc_times.num() > 0) { + gclog_or_tty->print("\n%4d full_gcs: total time = %8.2f s", + _all_full_gc_times.num(), + _all_full_gc_times.sum() / 1000.0); + gclog_or_tty->print_cr(" (avg = %8.2fms).", _all_full_gc_times.avg()); + gclog_or_tty->print_cr(" [std. dev = %8.2f ms, max = %8.2f ms]", + _all_full_gc_times.sd(), + _all_full_gc_times.maximum()); + } +} diff --git a/hotspot/src/share/vm/gc_implementation/g1/g1CollectorPolicy.hpp b/hotspot/src/share/vm/gc_implementation/g1/g1CollectorPolicy.hpp index 88069816ef6..b3b839752b9 100644 --- a/hotspot/src/share/vm/gc_implementation/g1/g1CollectorPolicy.hpp +++ b/hotspot/src/share/vm/gc_implementation/g1/g1CollectorPolicy.hpp @@ -37,49 +37,62 @@ class HeapRegion; class CollectionSetChooser; -// Yes, this is a bit unpleasant... but it saves replicating the same thing -// over and over again and introducing subtle problems through small typos and -// cutting and pasting mistakes. The macros below introduces a number -// sequnce into the following two classes and the methods that access it. +// TraceGen0Time collects data on _both_ young and mixed evacuation pauses +// (the latter may contain non-young regions - i.e. regions that are +// technically in Gen1) while TraceGen1Time collects data about full GCs. +class TraceGen0TimeData : public CHeapObj { + private: + unsigned _young_pause_num; + unsigned _mixed_pause_num; -#define define_num_seq(name) \ -private: \ - NumberSeq _all_##name##_times_ms; \ -public: \ - void record_##name##_time_ms(double ms) { \ - _all_##name##_times_ms.add(ms); \ - } \ - NumberSeq* get_##name##_seq() { \ - return &_all_##name##_times_ms; \ - } + NumberSeq _all_stop_world_times_ms; + NumberSeq _all_yield_times_ms; -class MainBodySummary; + NumberSeq _total; + NumberSeq _other; + NumberSeq _root_region_scan_wait; + NumberSeq _parallel; + NumberSeq _ext_root_scan; + NumberSeq _satb_filtering; + NumberSeq _update_rs; + NumberSeq _scan_rs; + NumberSeq _obj_copy; + NumberSeq _termination; + NumberSeq _parallel_other; + NumberSeq _clear_ct; -class PauseSummary: public CHeapObj { - define_num_seq(total) - define_num_seq(other) + void print_summary (int level, const char* str, const NumberSeq* seq) const; + void print_summary_sd (int level, const char* str, const NumberSeq* seq) const; public: - virtual MainBodySummary* main_body_summary() { return NULL; } + TraceGen0TimeData() : _young_pause_num(0), _mixed_pause_num(0) {}; + void record_start_collection(double time_to_stop_the_world_ms); + void record_yield_time(double yield_time_ms); + void record_end_collection( + double total_ms, + double other_ms, + double root_region_scan_wait_ms, + double parallel_ms, + double ext_root_scan_ms, + double satb_filtering_ms, + double update_rs_ms, + double scan_rs_ms, + double obj_copy_ms, + double termination_ms, + double parallel_other_ms, + double clear_ct_ms); + void increment_young_collection_count(); + void increment_mixed_collection_count(); + void print() const; }; -class MainBodySummary: public CHeapObj { - define_num_seq(root_region_scan_wait) - define_num_seq(parallel) // parallel only - define_num_seq(ext_root_scan) - define_num_seq(satb_filtering) - define_num_seq(update_rs) - define_num_seq(scan_rs) - define_num_seq(obj_copy) - define_num_seq(termination) // parallel only - define_num_seq(parallel_other) // parallel only - define_num_seq(clear_ct) -}; +class TraceGen1TimeData : public CHeapObj { + private: + NumberSeq _all_full_gc_times; -class Summary: public PauseSummary, - public MainBodySummary { -public: - virtual MainBodySummary* main_body_summary() { return this; } + public: + void record_full_collection(double full_gc_time_ms); + void print() const; }; // There are three command line options related to the young gen size: @@ -199,19 +212,10 @@ private: TruncatedSeq* _concurrent_mark_remark_times_ms; TruncatedSeq* _concurrent_mark_cleanup_times_ms; - Summary* _summary; + TraceGen0TimeData _trace_gen0_time_data; + TraceGen1TimeData _trace_gen1_time_data; - NumberSeq* _all_pause_times_ms; - NumberSeq* _all_full_gc_times_ms; double _stop_world_start; - NumberSeq* _all_stop_world_times_ms; - NumberSeq* _all_yield_times_ms; - - int _aux_num; - NumberSeq* _all_aux_times_ms; - double* _cur_aux_start_times_ms; - double* _cur_aux_times_ms; - bool* _cur_aux_times_set; double* _par_last_gc_worker_start_times_ms; double* _par_last_ext_root_scan_times_ms; @@ -243,9 +247,6 @@ private: bool _last_gc_was_young; - unsigned _young_pause_num; - unsigned _mixed_pause_num; - bool _during_marking; bool _in_marking_window; bool _in_marking_window_im; @@ -557,15 +558,6 @@ private: void print_par_stats(int level, const char* str, double* data, bool showDecimals = true); - void check_other_times(int level, - NumberSeq* other_times_ms, - NumberSeq* calc_other_times_ms) const; - - void print_summary (PauseSummary* stats) const; - - void print_summary (int level, const char* str, NumberSeq* seq) const; - void print_summary_sd (int level, const char* str, NumberSeq* seq) const; - double avg_value (double* data); double max_value (double* data); double sum_of_values (double* data); @@ -745,10 +737,6 @@ public: return _bytes_in_collection_set_before_gc; } - unsigned calc_gc_alloc_time_stamp() { - return _all_pause_times_ms->num() + 1; - } - // This should be called after the heap is resized. void record_new_heap_size(uint new_number_of_regions); @@ -867,18 +855,6 @@ public: _cur_collection_code_root_fixup_time_ms = ms; } - void record_aux_start_time(int i) { - guarantee(i < _aux_num, "should be within range"); - _cur_aux_start_times_ms[i] = os::elapsedTime() * 1000.0; - } - - void record_aux_end_time(int i) { - guarantee(i < _aux_num, "should be within range"); - double ms = os::elapsedTime() * 1000.0 - _cur_aux_start_times_ms[i]; - _cur_aux_times_set[i] = true; - _cur_aux_times_ms[i] += ms; - } - void record_ref_proc_time(double ms) { _cur_ref_proc_time_ms = ms; } diff --git a/hotspot/src/share/vm/memory/genCollectedHeap.cpp b/hotspot/src/share/vm/memory/genCollectedHeap.cpp index 40f5afda442..f8d779224ce 100644 --- a/hotspot/src/share/vm/memory/genCollectedHeap.cpp +++ b/hotspot/src/share/vm/memory/genCollectedHeap.cpp @@ -677,11 +677,6 @@ void GenCollectedHeap::do_collection(bool full, #ifdef TRACESPINNING ParallelTaskTerminator::print_termination_counts(); #endif - - if (ExitAfterGCNum > 0 && total_collections() == ExitAfterGCNum) { - tty->print_cr("Stopping after GC #%d", ExitAfterGCNum); - vm_exit(-1); - } } HeapWord* GenCollectedHeap::satisfy_failed_allocation(size_t size, bool is_tlab) { diff --git a/hotspot/src/share/vm/runtime/globals.hpp b/hotspot/src/share/vm/runtime/globals.hpp index d030b4f1740..1838252c37b 100644 --- a/hotspot/src/share/vm/runtime/globals.hpp +++ b/hotspot/src/share/vm/runtime/globals.hpp @@ -3285,9 +3285,6 @@ class CommandLineFlags { diagnostic(intx, VerifyGCLevel, 0, \ "Generation level at which to start +VerifyBefore/AfterGC") \ \ - develop(uintx, ExitAfterGCNum, 0, \ - "If non-zero, exit after this GC.") \ - \ product(intx, MaxTenuringThreshold, 15, \ "Maximum value for tenuring threshold") \ \ diff --git a/hotspot/src/share/vm/utilities/numberSeq.cpp b/hotspot/src/share/vm/utilities/numberSeq.cpp index 2cc41854071..a2ebc40f180 100644 --- a/hotspot/src/share/vm/utilities/numberSeq.cpp +++ b/hotspot/src/share/vm/utilities/numberSeq.cpp @@ -115,24 +115,6 @@ bool NumberSeq::check_nums(NumberSeq *total, int n, NumberSeq **parts) { return true; } -NumberSeq::NumberSeq(NumberSeq *total, int n, NumberSeq **parts) { - guarantee(check_nums(total, n, parts), "all seq lengths should match"); - double sum = total->sum(); - for (int i = 0; i < n; ++i) { - if (parts[i] != NULL) - sum -= parts[i]->sum(); - } - - _num = total->num(); - _sum = sum; - - // we do not calculate these... - _sum_of_squares = -1.0; - _maximum = -1.0; - _davg = -1.0; - _dvariance = -1.0; -} - void NumberSeq::add(double val) { AbsSeq::add(val); diff --git a/hotspot/src/share/vm/utilities/numberSeq.hpp b/hotspot/src/share/vm/utilities/numberSeq.hpp index 358448eb8f7..3f42a52dc72 100644 --- a/hotspot/src/share/vm/utilities/numberSeq.hpp +++ b/hotspot/src/share/vm/utilities/numberSeq.hpp @@ -93,7 +93,6 @@ protected: public: NumberSeq(double alpha = DEFAULT_ALPHA_VALUE); - NumberSeq(NumberSeq* total, int n_parts, NumberSeq** parts); virtual void add(double val); virtual double maximum() const { return _maximum; } From e6f8d1b836fcf4545fb4a4294a38c1c7dc87096e Mon Sep 17 00:00:00 2001 From: Christine Lu Date: Fri, 1 Jun 2012 14:11:59 -0700 Subject: [PATCH 118/128] Added tag jdk8-b41 for changeset beca65859e06 --- .hgtags-top-repo | 1 + 1 file changed, 1 insertion(+) diff --git a/.hgtags-top-repo b/.hgtags-top-repo index 5688a089f99..b322fa51d81 100644 --- a/.hgtags-top-repo +++ b/.hgtags-top-repo @@ -162,3 +162,4 @@ b2972095a4b1e2a97409b7c3df61f3b263a5ce14 jdk8-b37 d939bd0ab13c16647ffa38cc4b64fb31b7d44e10 jdk8-b38 8927dd68aee3fa54a1a698e2980e1b2f6c7c12c1 jdk8-b39 a2b2d435f1d275fa8010774c653197c64e326d3a jdk8-b40 +1a8c7c530f8a9b7f5bdb9b0693b2f5435ca5205e jdk8-b41 From 27d4c7ead065ddbd1e19eafe5699b3374788287a Mon Sep 17 00:00:00 2001 From: Christine Lu Date: Fri, 1 Jun 2012 14:12:06 -0700 Subject: [PATCH 119/128] Added tag jdk8-b41 for changeset 039a50f38068 --- corba/.hgtags | 1 + 1 file changed, 1 insertion(+) diff --git a/corba/.hgtags b/corba/.hgtags index f65a0ee93f3..d092dca1acd 100644 --- a/corba/.hgtags +++ b/corba/.hgtags @@ -162,3 +162,4 @@ a5a61f259961a7f46b002e5cc50b4a9bf86927b6 jdk8-b36 b8cbfb31139f820e5e094ba71449e58159fbe22e jdk8-b38 785af00e2827990f149b32ec37f523dbca3efdd1 jdk8-b39 56d030e5035fdee5bba6cf318a06287fda5d67ec jdk8-b40 +113f0d5f0a08aa0947b3edf783b603e7f042748a jdk8-b41 From 90d6f85d39568ba30579312e89134077c7219bc7 Mon Sep 17 00:00:00 2001 From: Christine Lu Date: Fri, 1 Jun 2012 14:12:10 -0700 Subject: [PATCH 120/128] Added tag jdk8-b41 for changeset 609e4849830f --- hotspot/.hgtags | 1 + 1 file changed, 1 insertion(+) diff --git a/hotspot/.hgtags b/hotspot/.hgtags index 0c36bc11c20..00a37d9af6b 100644 --- a/hotspot/.hgtags +++ b/hotspot/.hgtags @@ -250,3 +250,4 @@ bfcf92bfefb82da00f7fdbf0d9273feaa0a9456d jdk8-b37 14b0e07ab9a6fa1662414496b7e07ac8450cf517 hs24-b11 ff9decc8235d5af80ea45fda4ecbe643ea252564 jdk8-b40 785573170238f0eae6dc8e22ecf1050fbc9ea055 hs24-b12 +37add4fa0296705f67481e1fd50e2900cd25e39b jdk8-b41 From 2349d985f7f6cbb6dce3d08b511448c788a828eb Mon Sep 17 00:00:00 2001 From: Christine Lu Date: Fri, 1 Jun 2012 14:12:20 -0700 Subject: [PATCH 121/128] Added tag jdk8-b41 for changeset 1ef14f73e385 --- jaxp/.hgtags | 1 + 1 file changed, 1 insertion(+) diff --git a/jaxp/.hgtags b/jaxp/.hgtags index 73ec4bb7df7..e7bf7362fd7 100644 --- a/jaxp/.hgtags +++ b/jaxp/.hgtags @@ -162,3 +162,4 @@ cfd288fe1d3e2b700838342e70d71d44ac991af5 jdk8-b36 5bbe0cb6f2f2d7ce292da77bf4fa9d618d770a78 jdk8-b38 f95fdbe525c88ef0d57dc1390be6582a8af5e07c jdk8-b39 9ecfdbd6aed4702674eaede2023b4a19513d6b36 jdk8-b40 +6f5c0e17415de7a9c74900ef4ba12f47accdf88b jdk8-b41 From cc7c813d9bc908f2da87987107f2e586103ddd24 Mon Sep 17 00:00:00 2001 From: Christine Lu Date: Fri, 1 Jun 2012 14:12:25 -0700 Subject: [PATCH 122/128] Added tag jdk8-b41 for changeset 39a51a9b90e1 --- jaxws/.hgtags | 1 + 1 file changed, 1 insertion(+) diff --git a/jaxws/.hgtags b/jaxws/.hgtags index 7c13cce610a..c6d6f79b536 100644 --- a/jaxws/.hgtags +++ b/jaxws/.hgtags @@ -162,3 +162,4 @@ b05a948db1b6c933c980f24e4dc8fd897b7cf4ef jdk8-b37 ac1ba3b56775e3cdcd91b7a48793b59f6a3c18b5 jdk8-b38 7f6b44fd303478caa83575dbc225de187c509c50 jdk8-b39 09a0ddda03cb36deb6ee9edf789da12aa4674c6b jdk8-b40 +f2072b164b0519227833a2994f78e3988ee67827 jdk8-b41 From d08ae1fefe20b0df29d7adf75b3d490e9a49669e Mon Sep 17 00:00:00 2001 From: Christine Lu Date: Fri, 1 Jun 2012 14:12:28 -0700 Subject: [PATCH 123/128] Added tag jdk8-b41 for changeset e29decc8b008 --- jdk/.hgtags | 1 + 1 file changed, 1 insertion(+) diff --git a/jdk/.hgtags b/jdk/.hgtags index d1ac29cc4ec..67e484c4aba 100644 --- a/jdk/.hgtags +++ b/jdk/.hgtags @@ -162,3 +162,4 @@ ddfe5562f61f54ed2121ac0c73b688b94f3e66b5 jdk8-b32 c45f3509a70796c54b48f32910d1caf435763416 jdk8-b38 b6f52911752110a2889681923992c7a0baa52ccc jdk8-b39 b88fc3359dc7edabfa8a228855d8cebf8843c055 jdk8-b40 +4eac56f073ea8179b1a35fcd2af9b48b0088be9f jdk8-b41 From 65eb5b19cf63c283bd2fff0f6e1bffd2722823b7 Mon Sep 17 00:00:00 2001 From: Christine Lu Date: Fri, 1 Jun 2012 14:12:35 -0700 Subject: [PATCH 124/128] Added tag jdk8-b41 for changeset b7d886b99bba --- langtools/.hgtags | 1 + 1 file changed, 1 insertion(+) diff --git a/langtools/.hgtags b/langtools/.hgtags index 2e6c4389303..a1c69a6ee09 100644 --- a/langtools/.hgtags +++ b/langtools/.hgtags @@ -162,3 +162,4 @@ defd666a786334465496c8901fa302b779c7e045 jdk8-b35 1f224f160aa852c9541380735a27a3439dfb7217 jdk8-b38 a9f547c218d957306dfc0cdd710be041bb62a555 jdk8-b39 86e0dad6aadf626bf5755f503aee2d0da525d9d5 jdk8-b40 +179fa85aeefab338cccf1cbe8b494c59bc5df122 jdk8-b41 From 48140aa4e1e6595e0e89cbc320a25d650c3c954e Mon Sep 17 00:00:00 2001 From: Alejandro Murillo Date: Fri, 1 Jun 2012 15:24:09 -0700 Subject: [PATCH 125/128] Added tag hs24-b13 for changeset 4f7547c15006 --- hotspot/.hgtags | 1 + 1 file changed, 1 insertion(+) diff --git a/hotspot/.hgtags b/hotspot/.hgtags index 00a37d9af6b..c82b49c5543 100644 --- a/hotspot/.hgtags +++ b/hotspot/.hgtags @@ -251,3 +251,4 @@ bfcf92bfefb82da00f7fdbf0d9273feaa0a9456d jdk8-b37 ff9decc8235d5af80ea45fda4ecbe643ea252564 jdk8-b40 785573170238f0eae6dc8e22ecf1050fbc9ea055 hs24-b12 37add4fa0296705f67481e1fd50e2900cd25e39b jdk8-b41 +bd568544be7fcd12a9327e6c448592198d57b043 hs24-b13 From 7dabba40eef869019c3c395456e3645f11ae60d9 Mon Sep 17 00:00:00 2001 From: "J. Duke" Date: Wed, 5 Jul 2017 18:10:55 +0200 Subject: [PATCH 126/128] Added tag jdk8-b39 for changeset 35a539727877 --- .hgtags | 1 + 1 file changed, 1 insertion(+) diff --git a/.hgtags b/.hgtags index fd9cacb7c88..b9e82f0d134 100644 --- a/.hgtags +++ b/.hgtags @@ -160,3 +160,4 @@ f151d5833912a82cd4f203944da0305c3be83ecc jdk8-b35 98ce9816ae089c959ba1e70fba98423a31c4e9fa jdk8-b36 b3a91113026c99b0da010d41055719ab0d8938f0 jdk8-b37 4cc5610a6dd6227da766ebf9742eb11ff5ded6c0 jdk8-b38 +35a5397278779a2f8f3013f81586dc8f30cb149d jdk8-b39 From 76281117bf847881909b865a4cd5522336cbce77 Mon Sep 17 00:00:00 2001 From: "J. Duke" Date: Wed, 5 Jul 2017 18:11:33 +0200 Subject: [PATCH 127/128] Added tag jdk8-b40 for changeset 6e4e654931b9 --- .hgtags | 1 + 1 file changed, 1 insertion(+) diff --git a/.hgtags b/.hgtags index b9e82f0d134..e583046c163 100644 --- a/.hgtags +++ b/.hgtags @@ -161,3 +161,4 @@ f151d5833912a82cd4f203944da0305c3be83ecc jdk8-b35 b3a91113026c99b0da010d41055719ab0d8938f0 jdk8-b37 4cc5610a6dd6227da766ebf9742eb11ff5ded6c0 jdk8-b38 35a5397278779a2f8f3013f81586dc8f30cb149d jdk8-b39 +6e4e654931b976304bf6e7b4d0d6db8f75bac5d9 jdk8-b40 From 4ab6f2a73e549d7f4b5e6af53c88031fe2644fe7 Mon Sep 17 00:00:00 2001 From: "J. Duke" Date: Wed, 5 Jul 2017 18:12:04 +0200 Subject: [PATCH 128/128] Added tag jdk8-b41 for changeset c029c972396c --- .hgtags | 1 + 1 file changed, 1 insertion(+) diff --git a/.hgtags b/.hgtags index e583046c163..bd28104aa70 100644 --- a/.hgtags +++ b/.hgtags @@ -162,3 +162,4 @@ b3a91113026c99b0da010d41055719ab0d8938f0 jdk8-b37 4cc5610a6dd6227da766ebf9742eb11ff5ded6c0 jdk8-b38 35a5397278779a2f8f3013f81586dc8f30cb149d jdk8-b39 6e4e654931b976304bf6e7b4d0d6db8f75bac5d9 jdk8-b40 +c029c972396cea042a0dc67c0f7ccf2fe68007d4 jdk8-b41