Merge
authorlana
Wed, 18 Apr 2012 10:16:23 -0700
changeset 12395 2b900319e3ae
parent 12348 990e362f6829 (current diff)
parent 12394 7ded3320efee (diff)
child 12419 b81249542f14
Merge
--- a/jdk/make/sun/font/Makefile	Thu Apr 12 09:35:30 2012 -0700
+++ b/jdk/make/sun/font/Makefile	Wed Apr 18 10:16:23 2012 -0700
@@ -62,7 +62,7 @@
     java/text/Bidi.java \
     sun/font/FileFont.java \
     sun/font/FileFontStrike.java \
-    sun/font/FontManager.java \
+    sun/font/SunFontManager.java \
     sun/font/GlyphList.java \
     sun/font/NativeFont.java \
     sun/font/StrikeCache.java \
--- a/jdk/make/sun/font/t2k/Makefile	Thu Apr 12 09:35:30 2012 -0700
+++ b/jdk/make/sun/font/t2k/Makefile	Wed Apr 18 10:16:23 2012 -0700
@@ -52,7 +52,6 @@
 FILES_export = \
     java/awt/Font.java \
     sun/font/FileFont.java \
-    sun/font/FontManager.java \
     sun/font/GlyphList.java \
     sun/font/NativeFont.java \
     sun/font/StrikeCache.java \
--- a/jdk/src/share/classes/sun/awt/image/ImageWatched.java	Thu Apr 12 09:35:30 2012 -0700
+++ b/jdk/src/share/classes/sun/awt/image/ImageWatched.java	Wed Apr 18 10:16:23 2012 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1995, 2003, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1995, 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,6 +143,7 @@
         if (iw != null && !isWatcher(iw)) {
             watcherList = new WeakLink(iw, watcherList);
         }
+        watcherList = watcherList.removeWatcher(null);
     }
 
     public synchronized boolean isWatcher(ImageObserver iw) {
--- a/jdk/src/share/classes/sun/tools/jcmd/JCmd.java	Thu Apr 12 09:35:30 2012 -0700
+++ b/jdk/src/share/classes/sun/tools/jcmd/JCmd.java	Wed Apr 18 10:16:23 2012 -0700
@@ -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.
  *com.sun.tools.attach.AttachNotSupportedException
 
@@ -142,17 +142,20 @@
         // Cast to HotSpotVirtualMachine as this is an
         // implementation specific method.
         HotSpotVirtualMachine hvm = (HotSpotVirtualMachine) vm;
-        try (InputStream in = hvm.executeJCmd(command);) {
-            // read to EOF and just print output
-            byte b[] = new byte[256];
-            int n;
-            do {
-                n = in.read(b);
-                if (n > 0) {
-                    String s = new String(b, 0, n, "UTF-8");
-                    System.out.print(s);
-                }
-            } while (n > 0);
+        String lines[] = command .split("\\n");
+        for (String line : lines) {
+            try (InputStream in = hvm.executeJCmd(line);) {
+                // read to EOF and just print output
+                byte b[] = new byte[256];
+                int n;
+                do {
+                    n = in.read(b);
+                    if (n > 0) {
+                        String s = new String(b, 0, n, "UTF-8");
+                        System.out.print(s);
+                    }
+                } while (n > 0);
+            }
         }
         vm.detach();
     }
--- a/jdk/src/share/native/sun/font/sunFont.c	Thu Apr 12 09:35:30 2012 -0700
+++ b/jdk/src/share/native/sun/font/sunFont.c	Wed Apr 18 10:16:23 2012 -0700
@@ -29,7 +29,7 @@
 #include "jlong.h"
 #include "sunfontids.h"
 #include "fontscalerdefs.h"
-#include "sun_font_FontManager.h"
+#include "sun_font_SunFontManager.h"
 #include "sun_font_NullFontScaler.h"
 #include "sun_font_StrikeCache.h"
 
--- a/jdk/src/solaris/classes/sun/java2d/xr/XRRenderer.java	Thu Apr 12 09:35:30 2012 -0700
+++ b/jdk/src/solaris/classes/sun/java2d/xr/XRRenderer.java	Wed Apr 18 10:16:23 2012 -0700
@@ -69,20 +69,26 @@
     }
 
     public void drawLine(SunGraphics2D sg2d, int x1, int y1, int x2, int y2) {
-        try {
-            SunToolkit.awtLock();
-
-            validateSurface(sg2d);
-            int transx = sg2d.transX;
-            int transy = sg2d.transY;
+        Region compClip = sg2d.getCompClip();
+        int transX1 = x1 + sg2d.transX;
+        int transY1 = y1 + sg2d.transY;
+        int transX2 = x2 + sg2d.transX;
+        int transY2 = y2 + sg2d.transY;
 
-            XRSurfaceData xrsd = (XRSurfaceData) sg2d.surfaceData;
+        // Non clipped fast path
+        if (compClip.contains(transX1, transY1)
+                && compClip.contains(transX2, transY2)) {
+            try {
+                SunToolkit.awtLock();
 
-            tileManager.addLine(x1 + transx, y1 + transy,
-                                x2 + transx, y2 + transy);
-            tileManager.fillMask(xrsd);
-        } finally {
-            SunToolkit.awtUnlock();
+                validateSurface(sg2d);
+                tileManager.addLine(transX1, transY1, transX2, transY2);
+                tileManager.fillMask((XRSurfaceData) sg2d.surfaceData);
+            } finally {
+                SunToolkit.awtUnlock();
+            }
+        } else {
+            draw(sg2d, new Line2D.Float(x1, y1, x2, y2));
         }
     }
 
--- a/jdk/src/solaris/native/sun/awt/fontpath.c	Thu Apr 12 09:35:30 2012 -0700
+++ b/jdk/src/solaris/native/sun/awt/fontpath.c	Wed Apr 18 10:16:23 2012 -0700
@@ -583,9 +583,6 @@
 }
 
 #include <dlfcn.h>
-#if !(defined(__linux__) || defined(MACOSX))
-#include <link.h>
-#endif
 
 #include "fontconfig.h"
 
--- a/jdk/src/solaris/native/sun/java2d/opengl/OGLFuncs_md.h	Thu Apr 12 09:35:30 2012 -0700
+++ b/jdk/src/solaris/native/sun/java2d/opengl/OGLFuncs_md.h	Wed Apr 18 10:16:23 2012 -0700
@@ -28,7 +28,7 @@
 
 #include <stdlib.h>
 #ifndef MACOSX
-#include <link.h>
+#include <dlfcn.h>
 #endif
 #include "jvm_md.h"
 #include "J2D_GL/glx.h"
--- a/jdk/src/solaris/native/sun/java2d/x11/XRBackendNative.c	Thu Apr 12 09:35:30 2012 -0700
+++ b/jdk/src/solaris/native/sun/java2d/x11/XRBackendNative.c	Wed Apr 18 10:16:23 2012 -0700
@@ -70,7 +70,6 @@
 
 #ifdef __solaris__
 /* Solaris 10 will not have these symbols at runtime */
-#include <link.h>
 
 typedef Picture (*XRenderCreateLinearGradientFuncType)
                                      (Display *dpy,
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/sun/awt/image/ImageWatched/AddNoLeak.java	Wed Apr 18 10:16:23 2012 -0700
@@ -0,0 +1,59 @@
+/*
+ * 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.image.ImageObserver;
+import java.awt.image.ImageProducer;
+import java.awt.image.ImageConsumer;
+import java.awt.Image;
+import java.awt.Container;
+
+/* @test 1.0 12/01/17
+   @bug 7104151
+   @summary Make sure that we don't leak image observers (or related objects)
+   @run main/othervm AddNoLeak
+   @author David Buck
+*/
+
+public class AddNoLeak {
+    public static void main(String[] args) {
+        System.setProperty("java.awt.headless", "true");
+        Container cont = new Container();
+        Image img = cont.createImage(new DummyImageSource());
+        for(int i=0;i < 15000;i++) {
+            img.getWidth(new ImageObserver() {
+                public boolean imageUpdate(Image img, int infoflags, int x, int y, int width, int height) {return false;}
+            });
+            if (i % 100 == 0) {
+                System.gc();
+            }
+        }
+    }
+
+    private static class DummyImageSource implements ImageProducer {
+        public void addConsumer(ImageConsumer ic){}
+        public boolean isConsumer(ImageConsumer ic){return false;}
+        public void removeConsumer(ImageConsumer ic){}
+        public void startProduction(ImageConsumer ic){}
+        public void requestTopDownLeftRightResend(ImageConsumer ic){}
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/sun/tools/jcmd/dcmd-big-script.txt	Wed Apr 18 10:16:23 2012 -0700
@@ -0,0 +1,95 @@
+VM.version
+VM.version
+VM.version
+VM.version
+VM.version
+VM.version
+VM.version
+VM.version
+VM.version
+VM.version
+VM.version
+VM.version
+VM.version
+VM.version
+VM.version
+VM.version
+VM.version
+VM.version
+VM.version
+VM.version
+VM.version
+VM.version
+VM.version
+VM.version
+VM.version
+VM.version
+VM.version
+VM.version
+VM.version
+VM.version
+VM.version
+VM.version
+VM.version
+VM.version
+VM.version
+VM.version
+VM.version
+VM.version
+VM.version
+VM.version
+VM.version
+VM.version
+VM.version
+VM.version
+VM.version
+VM.version
+VM.version
+VM.version
+VM.version
+VM.version
+VM.version
+VM.version
+VM.version
+VM.version
+VM.version
+VM.version
+VM.version
+VM.version
+VM.version
+VM.version
+VM.version
+VM.version
+VM.version
+VM.version
+VM.version
+VM.version
+VM.version
+VM.version
+VM.version
+VM.version
+VM.version
+VM.version
+VM.version
+VM.version
+VM.version
+VM.version
+VM.version
+VM.version
+VM.version
+VM.version
+VM.version
+VM.version
+VM.version
+VM.version
+VM.version
+VM.version
+VM.version
+VM.version
+VM.version
+VM.version
+VM.version
+VM.version
+VM.version
+VM.version
+VM.version
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/sun/tools/jcmd/jcmd-big-script.sh	Wed Apr 18 10:16:23 2012 -0700
@@ -0,0 +1,70 @@
+#!/bin/sh
+
+#
+# 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 7154822
+# @summary test if we can send a file over 1024 bytes large via jcmd -f
+# @author David Buck
+#
+# @library ../common
+# @build SimpleApplication ShutdownSimpleApplication
+# @run shell jcmd-big-script.sh
+
+. ${TESTSRC}/../common/CommonSetup.sh
+. ${TESTSRC}/../common/ApplicationSetup.sh
+
+# Start application and use PORTFILE for coordination
+PORTFILE="${TESTCLASSES}"/shutdown.port
+startApplication SimpleApplication "${PORTFILE}"
+
+failed=0;
+
+# -f <script>
+rm -f jcmd.out 2>/dev/null
+set +e # even if jcmd fails, we do not want abort the script yet.
+${JCMD} -J-XX:+UsePerfData $appJavaPid -f ${TESTSRC}/dcmd-big-script.txt > jcmd.out 2>&1
+status="$?"
+set -e
+if [ "$status" != 0 ]; then
+  echo "jcmd command returned non-zero exit code (status=$status). Failed."
+  failed=1;
+fi
+cat jcmd.out
+set +e # if the test passes, grep will "fail" with an exit code of 1
+grep Exception jcmd.out > /dev/null 2>&1
+status="$?"
+set -e
+if [ "$status" = 0 ]; then
+  echo "Output of \"jcmd [pid] -f dcmd-big-script.txt\" contains string \"Exception\". Failed."
+  failed=1;
+fi
+
+# clean up
+rm -f jcmd.out 2>/dev/null
+stopApplication "${PORTFILE}"
+waitForApplication
+
+exit $failed