+ The top-level directory of the libraries and include files for the platform's
+ graphical programming environment. The default location is platform specific.
+ For example, on Linux it defaults to /usr/X11R6/.
+
+ Set to the target architecture of a cross-compilation build. If set, this
+ variable is used to signify that we are cross-compiling. The expectation
+ is that ALT_COMPILER_PATH is set
+ to point to the cross-compiler and that any cross-compilation specific flags
+ are passed using EXTRA_CFLAGS.
+ The ALT_OPENWIN_HOME variable should
+ also be set to point to the graphical header files (e.g. X11) provided with
+ the cross-compiler.
+ When cross-compiling we skip execution of any demos etc that may be built, and
+ also skip binary-file verification.
+
+ Used primarily for cross-compilation builds (and always set in that case)
+ this variable indicates that tools from the boot JDK should be used during
+ the build process, not the tools (javac, javah, jar)
+ just built (which can't execute on the build host).
+
+ The location of the C compiler to generate programs to run on the build host.
+ Some parts of the build generate programs that are then compiled and executed
+ to produce other parts of the build. Normally the primary C compiler is used
+ to do this, but when cross-compiling that would be the cross-compiler and the
+ resulting program could not be executed.
+ On Linux this defaults to /usr/bin/gcc; on other platforms it must be
+ set explicitly.
+
+
+
Specialized Build Options:
+
+ Some build variables exist to support specialized build environments and/or specialized
+ build products. Their use is only supported in those contexts:
+
+ Indicates this build will only contain the Hotspot client VM. In addition to
+ controlling the Hotspot build target, it ensures that we don't try to copy
+ any server VM files/directories, and defines a default jvm.cfg file
+ suitable for a client-only environment. Using this in a 64-bit build will
+ generate a sanity warning as 64-bit client builds are not directly supported.
+
+
BUILD_HEADLESS_ONLY
+
+ Used when the build environment has no graphical capabilities at all. This
+ excludes building anything that requires graphical libraries to be available.
+
+
JAVASE_EMBEDDED
+
+ Used to indicate this is a build of the Oracle Java SE Embedded product.
+ This will enable the directives included in the SE-Embedded specific build
+ files.
+
+ If set to false, disables the use of mmap by the zip utility. Otherwise,
+ mmap will be used.
+
+
COMPRESS_JARS
+
+ If set to true, causes certain jar files that would otherwise be built without
+ compression, to use compression.
+
+
+
diff --git a/corba/.hgtags b/corba/.hgtags
index 74c2a7b7f9e..159f7343ec9 100644
--- a/corba/.hgtags
+++ b/corba/.hgtags
@@ -109,3 +109,6 @@ d7532bcd3742f1576dd07ff9fbb535c9c9a276e9 jdk7-b126
1b1e75e8f476e5c07f0d2b035993895e2603e1f0 jdk7-b132
671fe2e623ffefb4b7c312be919fc71eb48c1df1 jdk7-b133
918003855fa0dba5acf4bf1fe36526d2fc4c1ba8 jdk7-b134
+e0b72ae5dc5e824b342801c8d1d336a55eb54e2c jdk7-b135
+48ef0c712e7cbf272f47f9224db92a3c6a9e2612 jdk7-b136
+a66c01d8bf895261715955df0b95545c000ed6a8 jdk7-b137
diff --git a/corba/src/share/classes/com/sun/corba/se/impl/orbutil/resources/sunorb_de.properties b/corba/src/share/classes/com/sun/corba/se/impl/orbutil/resources/sunorb_de.properties
index b33670ea62f..3343f1fb225 100644
--- a/corba/src/share/classes/com/sun/corba/se/impl/orbutil/resources/sunorb_de.properties
+++ b/corba/src/share/classes/com/sun/corba/se/impl/orbutil/resources/sunorb_de.properties
@@ -1,5 +1,5 @@
#
-# Copyright (c) 2000, 2005, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2000, 2011, 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
diff --git a/corba/src/share/classes/com/sun/corba/se/impl/orbutil/resources/sunorb_es.properties b/corba/src/share/classes/com/sun/corba/se/impl/orbutil/resources/sunorb_es.properties
index 12562891caa..96707e40f75 100644
--- a/corba/src/share/classes/com/sun/corba/se/impl/orbutil/resources/sunorb_es.properties
+++ b/corba/src/share/classes/com/sun/corba/se/impl/orbutil/resources/sunorb_es.properties
@@ -1,5 +1,5 @@
#
-# Copyright (c) 2000, 2005, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2000, 2011, 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
diff --git a/corba/src/share/classes/com/sun/corba/se/impl/orbutil/resources/sunorb_fr.properties b/corba/src/share/classes/com/sun/corba/se/impl/orbutil/resources/sunorb_fr.properties
index b1b64f1f9f3..b46f46cd619 100644
--- a/corba/src/share/classes/com/sun/corba/se/impl/orbutil/resources/sunorb_fr.properties
+++ b/corba/src/share/classes/com/sun/corba/se/impl/orbutil/resources/sunorb_fr.properties
@@ -1,5 +1,5 @@
#
-# Copyright (c) 2000, 2005, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2000, 2011, 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
diff --git a/corba/src/share/classes/com/sun/corba/se/impl/orbutil/resources/sunorb_it.properties b/corba/src/share/classes/com/sun/corba/se/impl/orbutil/resources/sunorb_it.properties
index 1ef1814688f..7d39881dddf 100644
--- a/corba/src/share/classes/com/sun/corba/se/impl/orbutil/resources/sunorb_it.properties
+++ b/corba/src/share/classes/com/sun/corba/se/impl/orbutil/resources/sunorb_it.properties
@@ -1,5 +1,5 @@
#
-# Copyright (c) 2000, 2005, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2000, 2011, 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
diff --git a/corba/src/share/classes/com/sun/corba/se/impl/orbutil/resources/sunorb_ja.properties b/corba/src/share/classes/com/sun/corba/se/impl/orbutil/resources/sunorb_ja.properties
index c236f07507b..8911bd177f1 100644
--- a/corba/src/share/classes/com/sun/corba/se/impl/orbutil/resources/sunorb_ja.properties
+++ b/corba/src/share/classes/com/sun/corba/se/impl/orbutil/resources/sunorb_ja.properties
@@ -1,5 +1,5 @@
#
-# Copyright (c) 2000, 2005, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2000, 2011, 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
diff --git a/corba/src/share/classes/com/sun/corba/se/impl/orbutil/resources/sunorb_ko.properties b/corba/src/share/classes/com/sun/corba/se/impl/orbutil/resources/sunorb_ko.properties
index 7be6158a9f5..7d58921d36f 100644
--- a/corba/src/share/classes/com/sun/corba/se/impl/orbutil/resources/sunorb_ko.properties
+++ b/corba/src/share/classes/com/sun/corba/se/impl/orbutil/resources/sunorb_ko.properties
@@ -1,5 +1,5 @@
#
-# Copyright (c) 2000, 2005, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2000, 2011, 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
diff --git a/corba/src/share/classes/com/sun/corba/se/impl/orbutil/resources/sunorb_pt_BR.properties b/corba/src/share/classes/com/sun/corba/se/impl/orbutil/resources/sunorb_pt_BR.properties
index eeeb083abae..6393482a863 100644
--- a/corba/src/share/classes/com/sun/corba/se/impl/orbutil/resources/sunorb_pt_BR.properties
+++ b/corba/src/share/classes/com/sun/corba/se/impl/orbutil/resources/sunorb_pt_BR.properties
@@ -1,5 +1,5 @@
#
-# Copyright (c) 2000, 2005, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2000, 2011, 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
diff --git a/corba/src/share/classes/com/sun/corba/se/impl/orbutil/resources/sunorb_sv.properties b/corba/src/share/classes/com/sun/corba/se/impl/orbutil/resources/sunorb_sv.properties
index c11488e9f48..eaf5b45f79a 100644
--- a/corba/src/share/classes/com/sun/corba/se/impl/orbutil/resources/sunorb_sv.properties
+++ b/corba/src/share/classes/com/sun/corba/se/impl/orbutil/resources/sunorb_sv.properties
@@ -1,5 +1,5 @@
#
-# Copyright (c) 2000, 2005, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2000, 2011, 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
diff --git a/corba/src/share/classes/com/sun/corba/se/impl/orbutil/resources/sunorb_zh_CN.properties b/corba/src/share/classes/com/sun/corba/se/impl/orbutil/resources/sunorb_zh_CN.properties
index 6dce9e6e827..e03e66b400f 100644
--- a/corba/src/share/classes/com/sun/corba/se/impl/orbutil/resources/sunorb_zh_CN.properties
+++ b/corba/src/share/classes/com/sun/corba/se/impl/orbutil/resources/sunorb_zh_CN.properties
@@ -1,5 +1,5 @@
#
-# Copyright (c) 2000, 2005, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2000, 2011, 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
diff --git a/corba/src/share/classes/com/sun/corba/se/impl/orbutil/resources/sunorb_zh_TW.properties b/corba/src/share/classes/com/sun/corba/se/impl/orbutil/resources/sunorb_zh_TW.properties
index db797522663..075fa02a2ba 100644
--- a/corba/src/share/classes/com/sun/corba/se/impl/orbutil/resources/sunorb_zh_TW.properties
+++ b/corba/src/share/classes/com/sun/corba/se/impl/orbutil/resources/sunorb_zh_TW.properties
@@ -1,5 +1,5 @@
#
-# Copyright (c) 2000, 2005, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2000, 2011, 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
diff --git a/corba/src/share/classes/com/sun/corba/se/spi/logging/data/Activation.mc b/corba/src/share/classes/com/sun/corba/se/spi/logging/data/Activation.mc
index ab7b2a6b74e..1286d5d0d75 100644
--- a/corba/src/share/classes/com/sun/corba/se/spi/logging/data/Activation.mc
+++ b/corba/src/share/classes/com/sun/corba/se/spi/logging/data/Activation.mc
@@ -1,5 +1,5 @@
;
-; Copyright (c) 2003, Oracle and/or its affiliates. All rights reserved.
+; Copyright (c) 2003, 2011, 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
diff --git a/corba/src/share/classes/com/sun/corba/se/spi/logging/data/IOR.mc b/corba/src/share/classes/com/sun/corba/se/spi/logging/data/IOR.mc
index 958cb6ee40b..3527c846080 100644
--- a/corba/src/share/classes/com/sun/corba/se/spi/logging/data/IOR.mc
+++ b/corba/src/share/classes/com/sun/corba/se/spi/logging/data/IOR.mc
@@ -1,5 +1,5 @@
;
-; Copyright (c) 2003, Oracle and/or its affiliates. All rights reserved.
+; Copyright (c) 2003, 2011, 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
diff --git a/corba/src/share/classes/com/sun/corba/se/spi/logging/data/Interceptors.mc b/corba/src/share/classes/com/sun/corba/se/spi/logging/data/Interceptors.mc
index 5b27058ec50..c0677129ef1 100644
--- a/corba/src/share/classes/com/sun/corba/se/spi/logging/data/Interceptors.mc
+++ b/corba/src/share/classes/com/sun/corba/se/spi/logging/data/Interceptors.mc
@@ -1,5 +1,5 @@
;
-; Copyright (c) 2003, Oracle and/or its affiliates. All rights reserved.
+; Copyright (c) 2003, 2011, 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
diff --git a/corba/src/share/classes/com/sun/corba/se/spi/logging/data/Naming.mc b/corba/src/share/classes/com/sun/corba/se/spi/logging/data/Naming.mc
index ec6d05e5383..605e4f32fbf 100644
--- a/corba/src/share/classes/com/sun/corba/se/spi/logging/data/Naming.mc
+++ b/corba/src/share/classes/com/sun/corba/se/spi/logging/data/Naming.mc
@@ -1,5 +1,5 @@
;
-; Copyright (c) 2003, Oracle and/or its affiliates. All rights reserved.
+; Copyright (c) 2003, 2011, 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
diff --git a/corba/src/share/classes/com/sun/corba/se/spi/logging/data/OMG.mc b/corba/src/share/classes/com/sun/corba/se/spi/logging/data/OMG.mc
index 757e6dd3fbb..9af41dddb46 100644
--- a/corba/src/share/classes/com/sun/corba/se/spi/logging/data/OMG.mc
+++ b/corba/src/share/classes/com/sun/corba/se/spi/logging/data/OMG.mc
@@ -1,5 +1,5 @@
;
-; Copyright (c) 2003, 2004, Oracle and/or its affiliates. All rights reserved.
+; Copyright (c) 2003, 2011, 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
diff --git a/corba/src/share/classes/com/sun/corba/se/spi/logging/data/ORBUtil.mc b/corba/src/share/classes/com/sun/corba/se/spi/logging/data/ORBUtil.mc
index 412c742a461..e82f724642d 100644
--- a/corba/src/share/classes/com/sun/corba/se/spi/logging/data/ORBUtil.mc
+++ b/corba/src/share/classes/com/sun/corba/se/spi/logging/data/ORBUtil.mc
@@ -1,6 +1,6 @@
;
-; Copyright (c) 2003, 2009, Oracle and/or its affiliates. All rights reserved.
+; Copyright (c) 2003, 2011, 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
diff --git a/corba/src/share/classes/com/sun/corba/se/spi/logging/data/POA.mc b/corba/src/share/classes/com/sun/corba/se/spi/logging/data/POA.mc
index 0c8d477cd10..5eb198dd555 100644
--- a/corba/src/share/classes/com/sun/corba/se/spi/logging/data/POA.mc
+++ b/corba/src/share/classes/com/sun/corba/se/spi/logging/data/POA.mc
@@ -1,5 +1,5 @@
;
-; Copyright (c) 2003, Oracle and/or its affiliates. All rights reserved.
+; Copyright (c) 2003, 2011, 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
diff --git a/corba/src/share/classes/com/sun/corba/se/spi/logging/data/Util.mc b/corba/src/share/classes/com/sun/corba/se/spi/logging/data/Util.mc
index 3d6b58e08a8..f46e0ef599e 100644
--- a/corba/src/share/classes/com/sun/corba/se/spi/logging/data/Util.mc
+++ b/corba/src/share/classes/com/sun/corba/se/spi/logging/data/Util.mc
@@ -1,5 +1,5 @@
;
-; Copyright (c) 2003, 2004, Oracle and/or its affiliates. All rights reserved.
+; Copyright (c) 2003, 2011, 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
diff --git a/corba/src/share/classes/com/sun/tools/corba/se/idl/idl_ja.prp b/corba/src/share/classes/com/sun/tools/corba/se/idl/idl_ja.prp
index 16cfd33fce6..ab409ba6fa5 100644
--- a/corba/src/share/classes/com/sun/tools/corba/se/idl/idl_ja.prp
+++ b/corba/src/share/classes/com/sun/tools/corba/se/idl/idl_ja.prp
@@ -64,97 +64,97 @@
#
# Translator: Start Translating
-Compile.parsing=%0 \u3092\u69cb\u6587\u89e3\u6790\u4e2d
-Compile.parseDone=\u5b8c\u4e86 - %0
-Compile.generating=%0 \u3092\u751f\u6210\u4e2d
-Compile.genDone=\u5b8c\u4e86 - %0
-Deprecated.keyword=\u8b66\u544a: \u30ad\u30fc\u30ef\u30fc\u30c9 `%0' \u306f\u63a8\u5968\u3055\u308c\u3066\u3044\u307e\u305b\u3093\u3002
-EvaluationException.1=%0 \u6f14\u7b97\u5b50\u306e\u30aa\u30da\u30e9\u30f3\u30c9 %1 \u3068 %2 \u304c\u4e00\u81f4\u3057\u3066\u3044\u307e\u305b\u3093\u3002
-EvaluationException.2=%0 \u6f14\u7b97\u5b50\u306e\u30aa\u30da\u30e9\u30f3\u30c9\u306f %1 \u3067\u306f\u306a\u304f\u6570\u5024\u3067\u306a\u3051\u308c\u3070\u306a\u308a\u307e\u305b\u3093\u3002
-EvaluationException.or=\u30d3\u30c3\u30c8\u5358\u4f4d\u306e\u8ad6\u7406\u548c
-EvaluationException.xor=\u30d3\u30c3\u30c8\u5358\u4f4d\u306e\u6392\u4ed6\u7684\u8ad6\u7406\u548c
-EvaluationException.and=\u30d3\u30c3\u30c8\u5358\u4f4d\u306e\u8ad6\u7406\u7a4d
-EvaluationException.plus=\u52a0\u7b97
-EvaluationException.minus=\u6e1b\u7b97
-EvaluationException.left=\u5de6\u30b7\u30d5\u30c8
-EvaluationException.right=\u53f3\u30b7\u30d5\u30c8
-EvaluationException.times=\u4e57\u7b97
-EvaluationException.divide=\u9664\u7b97
-EvaluationException.mod=\u30e2\u30b8\u30e5\u30ed
-EvaluationException.pos=\u5358\u9805\u6b63\u6570
-EvaluationException.neg=\u5358\u9805\u8ca0\u6570
-EvaluationException.not=\u30d3\u30c3\u30c8\u5358\u4f4d\u306e\u5426\u5b9a
-EvaluationException.booleanNot=\u30d6\u30fc\u30eb\u306e\u5426\u5b9a
-EvaluationException.booleanAnd=\u30d6\u30fc\u30eb\u306e\u8ad6\u7406\u7a4d
-EvaluationException.booleanOr=\u30d6\u30fc\u30eb\u306e\u8ad6\u7406\u548c
-EvaluationException.equal=\u7b49\u4fa1
-EvaluationException.notEqual=\u4e0d\u7b49\u4fa1
-EvaluationException.greaterThan=\u5927\u304d\u3044
-EvaluationException.lessThan=\u5c0f\u3055\u3044
-EvaluationException.greaterEqual=\u5927\u304d\u3044\u304b\u7b49\u3057\u3044
-EvaluationException.lessEqual=\u5c0f\u3055\u3044\u304b\u7b49\u3057\u3044
-GenFileStream.1=%0 \u3092\u751f\u6210\u3067\u304d\u307e\u305b\u3093: %1
-InvalidArgument.1=\u4e0d\u6b63\u306a\u5f15\u6570: %0
-InvalidArgument.2=IDL \u30d5\u30a1\u30a4\u30eb\u304c\u6307\u5b9a\u3055\u308c\u3066\u3044\u307e\u305b\u3093\u3002
-InvalidCharacter.1=%0 (%1 \u884c\u76ee): \u4e0d\u6b63\u306a\u6587\u5b57: %2 (ASCII %3).\n%4\n%5
-Migration.futureKeyword=\u8b66\u544a: \u8b58\u5225\u5b50 `%0' \u304c\u30ad\u30fc\u30ef\u30fc\u30c9\u3068\u885d\u7a81\u3057\u3066\u3044\u307e\u3059\u3002\u4eca\u5f8c\u3082\u4e92\u63db\u6027\u3092\u4fdd\u3064\u305f\u3081\u306b\u306f\u62e1\u5f35\u8b58\u5225\u5b50\u3092\u4f7f\u7528\u3057\u3066\u304f\u3060\u3055\u3044\u3002
-Migration.keywordCollision=\u8b66\u544a: \u8b58\u5225\u5b50 `%0' \u304c\u30ad\u30fc\u30ef\u30fc\u30c9\u3068\u885d\u7a81\u3057\u3066\u3044\u307e\u3059\u3002\u4eca\u5f8c\u3082\u4e92\u63db\u6027\u3092\u4fdd\u3064\u305f\u3081\u306b\u306f\u62e1\u5f35\u8b58\u5225\u5b50\u3092\u4f7f\u7528\u3057\u3066\u304f\u3060\u3055\u3044\u3002
-ParseException.abstractValueBox=%0 (%1 \u884c\u76ee): \u5024\u30dc\u30c3\u30af\u30b9\u3092 abstract \u3067\u5ba3\u8a00\u3067\u304d\u307e\u305b\u3093\u3002\n%2\n%3
-ParseException.alreadyDeclared=%0 (%1 \u884c\u76ee): %2 \u306f\u65e2\u306b\u5ba3\u8a00\u3055\u308c\u3066\u3044\u307e\u3059\u3002\n%3\n%4
-ParseException.declNotInSameFile=%0 (%1 \u884c\u76ee): %2 \u306f\u4ee5\u524d\u306b\u30d5\u30a1\u30a4\u30eb %3 \u306e\u524d\u65b9\u5ba3\u8a00\u306b\u5ba3\u8a00\u3055\u308c\u307e\u3057\u305f\u3002\n%4\n%5
-ParseException.alreadyDerived=%0 (%1 \u884c\u76ee): %2 \u306f %3 \u306e\u89aa\u3068\u3057\u3066\u65e2\u306b\u5ba3\u8a00\u3055\u308c\u3066\u3044\u307e\u3059\u3002\n%4\n%5
-ParseException.alreadyDefaulted=%0 (%1 \u884c\u76ee): \u30c7\u30d5\u30a9\u30eb\u30c8\u306e\u5206\u5c90\u306f\u65e2\u306b\u691c\u51fa\u3055\u308c\u3066\u3044\u307e\u3059\u3002\n%2\n%3
-ParseException.alreadyRaised=%0 (%1 \u884c\u76ee): %2 \u306f raises \u7bc0\u3067\u65e2\u306b\u6307\u5b9a\u3055\u308c\u3066\u3044\u307e\u3059\u3002\n%3\n%4
-ParseException.attributeNotType=%0 (%1 \u884c\u76ee): %2 \u306f\u5c5e\u6027\u3067\u3059\u3002\u578b\u3068\u3057\u3066\u4f7f\u7528\u3059\u308b\u3053\u3068\u306f\u3067\u304d\u307e\u305b\u3093\u3002\n%3\n%4
-ParseException.badAbstract=%0 (%1 \u884c\u76ee): %2 \u306e\u524d\u65b9\u306e\u5ba3\u8a00\u3068\u5b9f\u969b\u306e\u5ba3\u8a00\u304c\u4e00\u81f4\u3057\u307e\u305b\u3093\u3002\u4e00\u65b9\u306f abstract \u3067\u4ed6\u65b9\u306f\u305d\u308c\u3068\u7570\u306a\u308a\u307e\u3059\u3002\n%3\n%4
-ParseException.badCustom=%0 (%1 \u884c\u76ee): \u524d\u65b9\u5024\u5ba3\u8a00\u3092 custom \u3067\u5ba3\u8a00\u3067\u304d\u307e\u305b\u3093\u3002\n%2\n%3
-ParseException.badRepIDAlreadyAssigned=%0 (%1 \u884c\u76ee): \u578b %2 \u306f\u524d\u306e ID \u30d7\u30e9\u30b0\u30de\u6307\u793a\u306e\u30ea\u30dd\u30b8\u30c8\u30ea ID \u306b\u5272\u308a\u5f53\u3066\u3089\u308c\u3066\u3044\u307e\u3059\u3002\n%3\n%4
-ParseException.badRepIDForm=%0 (%1 \u884c\u76ee): \u30ea\u30dd\u30b8\u30c8\u30ea ID '%2' \u306f ':' \u306e\u5f62\u5f0f\u3067\u306a\u3051\u308c\u3070\u306a\u308a\u307e\u305b\u3093\u3002\n%3\n%4
-ParseException.badRepIDPrefix=%0 (%1 \u884c\u76ee): \u30a4\u30f3\u30bf\u30d5\u30a7\u30fc\u30b9 %2 \u306e\u30ea\u30dd\u30b8\u30c8\u30ea ID \u306e\u63a5\u982d\u8f9e\u306f '%4' \u3067\u306a\u304f `%3' \u3067\u306a\u3051\u308c\u3070\u306a\u308a\u307e\u305b\u3093\u3002\n%5\n%6
-ParseException.badState=%0 (%1 \u884c\u76ee): %2 \u3092\u72b6\u614b\u3092\u6301\u3063\u305f\u30a4\u30f3\u30bf\u30d5\u30a7\u30fc\u30b9\u306b\u3059\u308b\u3053\u3068\u306f\u3067\u304d\u307e\u305b\u3093\u30022 \u3064\u4ee5\u4e0a\u306e\u72b6\u614b\u3092\u6301\u3063\u305f\u89aa\u304c\u3042\u308a\u307e\u3059\u3002\n%3\n%4
-ParseException.branchLabel=%0 (%1 \u884c\u76ee): case %2 \u306f\u65e2\u306b\u5ba3\u8a00\u3055\u308c\u3066\u3044\u307e\u3059\u3002\n%3\n%4
-ParseException.branchName=%0 (%1 \u884c\u76ee): %2 \u3068\u3044\u3046\u5206\u5c90\u306f\u65e2\u306b\u5ba3\u8a00\u3055\u308c\u3066\u3044\u307e\u3059\u3002\n%3\n%4
-ParseException.duplicateInit=%0 (%1 \u884c\u76ee): \u521d\u671f\u5316\u5b50\u306e\u30b7\u30b0\u30cb\u30c1\u30e3\u30fc\u304c\u524d\u306e\u521d\u671f\u5316\u5b50\u3068\u540c\u3058\u3067\u3059\u3002\n%2\n%3
-ParseException.duplicateState=%0 (%1 \u884c\u76ee): \u30c7\u30fc\u30bf\u30e1\u30f3\u30d0 %2 \u306e\u540d\u524d\u304c\u524d\u306e\u30c7\u30fc\u30bf\u30e1\u30f3\u30d0\u3068\u540c\u3058\u3067\u3059\u3002\n%3\n%4
-ParseException.elseNoIf=%0 (%1 \u884c\u76ee): #if \u3068\u30de\u30c3\u30c1\u30f3\u30b0\u3057\u306a\u3044 #else \u304c\u691c\u51fa\u3055\u308c\u307e\u3057\u305f\u3002\n%2\n%3
-ParseException.endNoIf=%0 (%1 \u884c\u76ee): #if \u3068\u30de\u30c3\u30c1\u30f3\u30b0\u3057\u306a\u3044 #endif \u304c\u691c\u51fa\u3055\u308c\u307e\u3057\u305f\u3002\n%2\n%3
-ParseException.evaluation=%0 (%1 \u884c\u76ee): %2\n%3\n%4
-ParseException.forwardEntry=%0 (%1 \u884c\u76ee): %2 \u3078\u306e\u524d\u65b9\u53c2\u7167\u304c\u3042\u308a\u307e\u3057\u305f\u304c\u5b9a\u7fa9\u3055\u308c\u3066\u3044\u307e\u305b\u3093\u3002\n%3\n%4
-ParseException.forwardedValueBox=%0 (%1 \u884c\u76ee): %2 \u306b\u524d\u65b9\u5ba3\u8a00\u304c\u3042\u308a\u307e\u3059\u3002\u5024\u30dc\u30c3\u30af\u30b9\u3092\u524d\u65b9\u5ba3\u8a00\u3059\u308b\u3053\u3068\u306f\u3067\u304d\u307e\u305b\u3093\u3002\n%3\n%4
-ParseException.forwardInheritance=%0 (%1 \u884c\u76ee): %3 \u306e\u4e0d\u5b8c\u5168\u306a\u524d\u65b9\u5ba3\u8a00\u3092 %2 \u304c\u7d99\u627f\u3059\u308b\u3053\u3068\u306f\u3067\u304d\u307e\u305b\u3093\u3002\n%4\n%5
-ParseException.generic=%0 (%1 \u884c\u76ee): %2\n%3\n%4
-ParseException.illegalArray=%0 (%1 \u884c\u76ee): %2 \u306e\u914d\u5217\u306e\u578b\u304c\u4e0d\u6b63\u3067\u3059\u3002\n%3\n%4
-ParseException.illegalException=%0 (%1 \u884c\u76ee): %2 \u5185\u3067\u4f8b\u5916\u3092\u751f\u6210\u3059\u308b\u3053\u3068\u306f\u3067\u304d\u307e\u305b\u3093\u3002\n%3\n%4
-ParseException.invalidConst1=%0 (%1 \u884c\u76ee): \u5b9a\u6570\u5f0f\u306e\u578b\u306f %3 \u3067\u306f\u306a\u304f %2 \u3067\u306a\u3051\u308c\u3070\u306a\u308a\u307e\u305b\u3093\u3002\n%4\n%5
-ParseException.invalidConst2=%0 (%1 \u884c\u76ee): \u5b9a\u6570\u5f0f\u5185\u306e\u8b58\u5225\u5b50\u306f %2 \u3067\u306f\u306a\u304f\u5b9a\u6570\u3067\u306a\u3051\u308c\u3070\u306a\u308a\u307e\u305b\u3093\u3002\n%3\n%4
-ParseException.keywordCollision=%0 (%1 \u884c\u76ee): \u8b58\u5225\u5b50 `%2' \u304c\u30ad\u30fc\u30ef\u30fc\u30c9\u3068\u885d\u7a81\u3057\u3066\u3044\u307e\u3059\u3002\u62e1\u5f35\u8b58\u5225\u5b50\u3092\u5fc5\u8981\u306b\u5fdc\u3058\u3066\u4f7f\u7528\u3057\u3066\u304f\u3060\u3055\u3044\u3002\n%3\n%4
-ParseException.methodClash=%0 (%1 \u884c\u76ee): \u30e1\u30bd\u30c3\u30c9\u540d\u304c\u30a4\u30f3\u30bf\u30d5\u30a7\u30fc\u30b9 %2 \u3067\u885d\u7a81\u3057\u3066\u3044\u307e\u3059: %3.\n%4\n%5
-ParseException.moduleNotType=%0 (%1 \u884c\u76ee): %2 \u306f\u30e2\u30b8\u30e5\u30fc\u30eb\u3067\u3059\u3002\u578b\u3068\u3057\u3066\u4f7f\u7528\u3059\u308b\u3053\u3068\u306f\u3067\u304d\u307e\u305b\u3093\u3002\n%3\n%4
-ParseException.nestedValueBox=%0 (%1 \u884c\u76ee): \u5024\u30dc\u30c3\u30af\u30b9\u3092\u5165\u308c\u5b50\u306b\u3059\u308b\u3053\u3068\u306f\u3067\u304d\u307e\u305b\u3093\u3002\n%2\n%3
-ParseException.noDefault=%0 (%1 \u884c\u76ee): \u8d77\u3053\u308a\u3046\u308b\u5168 case \u304c\u5b8c\u5168\u306b\u30ab\u30d0\u30fc\u3055\u308c\u3066\u3044\u306a\u3044\u9650\u308a\u3001\u30c7\u30d5\u30a9\u30eb\u30c8\u306e\u5206\u5c90\u3092\u4f7f\u7528\u3059\u308b\u3053\u3068\u306f\u3067\u304d\u307e\u305b\u3093\u3002\n%2\n%3
-ParseException.nonAbstractParent=%0 (%1 \u884c\u76ee): abstract \u30a4\u30f3\u30bf\u30d5\u30a7\u30fc\u30b9 %2 \u306f\u975e abstract \u30a4\u30f3\u30bf\u30d5\u30a7\u30fc\u30b9 %3 \u3092\u7d99\u627f\u3067\u304d\u307e\u305b\u3093\u3002\n%4\n%5
-ParseException.nonAbstractParent2=%0 (%1 \u884c\u76ee): abstract \u5024 %2 \u306f\u975e abstract \u5024 %3 \u3092\u7d99\u627f\u3067\u304d\u307e\u305b\u3093\u3002\n%4\n%5
-ParseException.nonAbstractParent3=%0 (%1 \u884c\u76ee): \u5024 %2 \u306f\u6307\u5b9a\u3055\u308c\u305f\u975e abstract \u5024 %3 \u3092\u7d99\u627f\u3067\u304d\u307e\u305b\u3093\u3002\n%4\n%5
-ParseException.notANumber=%0 (%1 \u884c\u76ee): \u6570\u5024\u304c\u4e88\u671f\u3055\u308c\u3066\u3044\u307e\u3057\u305f\u3002%2 \u306f\u4e0d\u6b63\u306a\u6570\u5024\u3067\u3059\u3002\n%3\n%4
-ParseException.nothing=%0 \u306f\u7a7a\u3067\u3059\u3002\u30b3\u30f3\u30d1\u30a4\u30eb\u5bfe\u8c61\u304c\u5b58\u5728\u3057\u307e\u305b\u3093\u3002
-ParseException.notPosInt=%0 (%1 \u884c\u76ee): %2 \u3067\u306f\u306a\u304f\u6b63\u306e\u6574\u6570\u5b9a\u6570\u304c\u4e88\u671f\u3055\u308c\u3066\u3044\u307e\u3057\u305f\u3002\n%3\n%4
-ParseException.oneway=%0 (%1 \u884c\u76ee): %2 \u306f\u7247\u65b9\u5411\u306b\u5ba3\u8a00\u3055\u308c\u3066\u3044\u307e\u3059\u3002\u7247\u65b9\u5411\u30e1\u30bd\u30c3\u30c9\u306f\u3001void \u3092\u8fd4\u3059\u3053\u3068\u3001\u30d1\u30e9\u30e1\u30fc\u30bf\u5185\u3067 1 \u3064\u3060\u3051\u3067\u3042\u308b\u3053\u3068\u3001\u4f8b\u5916\u3092\u751f\u6210\u3057\u306a\u3044\u3053\u3068\u304c\u8981\u6c42\u3055\u308c\u307e\u3059\u3002\n%3\n%4
-ParseException.operationNotType=%0 (%1 \u884c\u76ee): %2 \u306f\u6f14\u7b97\u5b50\u3067\u3059\u3002\u578b\u3068\u3057\u3066\u4f7f\u7528\u3059\u308b\u3053\u3068\u306f\u3067\u304d\u307e\u305b\u3093\u3002\n%3\n%4
-ParseException.outOfRange=%0 (%1 \u884c\u76ee): \u5b9a\u6570\u5f0f\u306e\u5024 %2 \u306f\u578b %3 \u306e\u7bc4\u56f2\u5916\u3067\u3059\u3002\n%4\n%5
-ParseException.recursive=%0 (%1 \u884c\u76ee): \u6b63\u5f53\u306a\u518d\u5e30\u5b9a\u7fa9\u306f\u6b21\u306e\u3082\u306e\u3060\u3051\u3067\u3059: sequence<%2> %3.\n%4\n%5
-ParseException.selfInherit=%0 (%1 \u884c\u76ee): %2 \u306f\u81ea\u8eab\u3092\u7d99\u627f\u3059\u308b\u3053\u3068\u306f\u3067\u304d\u307e\u305b\u3093\u3002\n%3\n%4
-ParseException.stringTooLong=%0 (%1 \u884c\u76ee): "%2" \u306f %3 \u6587\u5b57\u4ee5\u4e0a\u306e\u9577\u3055\u306b\u3059\u308b\u3053\u3068\u306f\u3067\u304d\u307e\u305b\u3093\u3002\n%4\n%5
-ParseException.syntax1=%0 (%1 \u884c\u76ee): `%2' \u304c\u4e88\u671f\u3055\u308c `%3' \u304c\u691c\u51fa\u3055\u308c\u307e\u3057\u305f\u3002\n%4\n%5
-ParseException.syntax2=%0 (%1 \u884c\u76ee): %2 \u306e 1 \u3064\u304c\u4e88\u671f\u3055\u308c `%3'\u304c\u691c\u51fa\u3055\u308c\u307e\u3057\u305f\u3002\n%4\n%5
-ParseException.unclosed=%0: \u30b3\u30e1\u30f3\u30c8\u5185\u306b\u4e88\u60f3\u5916\u306e EOF \u304c\u691c\u51fa\u3055\u308c\u307e\u3057\u305f\u3002
-ParseException.undeclaredType=%0 (%1 \u884c\u76ee): %2 \u306f\u5ba3\u8a00\u3055\u308c\u3066\u3044\u306a\u3044\u578b\u3067\u3059\u3002\n%3\n%4
-ParseException.warning=%0 (%1 \u884c\u76ee): %2\n%3\n%4
-ParseException.constExprType=%0 (%1 \u884c\u76ee): \u5b9a\u6570\u5f0f\u306e\u578b\u306f %2 \u3067\u3059\u304c\u3001%3 \u3067\u306a\u3051\u308c\u3070\u306a\u308a\u307e\u305b\u3093\u3002\n%4\n%5
-ParseException.wrongType=%0 (%1 \u884c\u76ee): %2 \u306e\u578b\u306f %3 \u3067\u3059\u304c %4 \u3067\u306a\u3051\u308c\u3070\u306a\u308a\u307e\u305b\u3093\u3002\n%5\n%6
-ParseException.illegalIncompleteTypeReference=%0 (%1 \u884c\u76ee): \u578b %2 \u306e\u4e0d\u5b8c\u5168\u306a\u524d\u65b9\u5ba3\u8a00\u3078\u306e\u4e0d\u6b63\u306a\u53c2\u7167\u3067\u3059\u3002\n%3\n%4
-Preprocessor.unknown=`%0'\u306f\u672a\u77e5\u306e\u30d7\u30ea\u30d7\u30ed\u30bb\u30c3\u30b5\u6307\u793a\u3067\u3059\u3002\u884c\u306f\u7121\u8996\u3055\u308c\u307e\u3059\u3002
-Preprocessor.unknownPragma=`%0'\u306f\u672a\u77e5\u306e\u30d7\u30e9\u30b0\u30de\u3067\u3059\u3002\u884c\u306f\u7121\u8996\u3055\u308c\u307e\u3059\u3002
-Preprocessor.undefinedName=%1 \u306f\u30d7\u30e9\u30b0\u30de %0 \u306e\u672a\u5b9a\u7fa9\u306e\u578b\u540d\u3067\u3059\u3002\u884c\u306f\u7121\u8996\u3055\u308c\u307e\u3059\u3002
+Compile.parsing=%0\u306E\u89E3\u6790\u4E2D
+Compile.parseDone=\u5B8C\u4E86 - %0
+Compile.generating=%0\u306E\u751F\u6210\u4E2D
+Compile.genDone=\u5B8C\u4E86 - %0
+Deprecated.keyword=\u8B66\u544A: \u30AD\u30FC\u30EF\u30FC\u30C9`%0'\u306F\u63A8\u5968\u3055\u308C\u3066\u3044\u307E\u305B\u3093\u3002
+EvaluationException.1=%0\u6F14\u7B97\u5B50\u306E\u30AA\u30DA\u30E9\u30F3\u30C9\u306B\u4E00\u8CAB\u6027\u304C\u3042\u308A\u307E\u305B\u3093: %1\u304A\u3088\u3073%2\u3002
+EvaluationException.2=%0\u6F14\u7B97\u5B50\u306E\u30AA\u30DA\u30E9\u30F3\u30C9\u306F\u3001%1\u3067\u306F\u306A\u304F\u6570\u5024\u3067\u3042\u308B\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059\u3002
+EvaluationException.or=\u30D3\u30C3\u30C8\u5358\u4F4D\u306EOR\u6F14\u7B97
+EvaluationException.xor=\u30D3\u30C3\u30C8\u5358\u4F4D\u306EXOR\u6F14\u7B97
+EvaluationException.and=\u30D3\u30C3\u30C8\u5358\u4F4D\u306EAND\u6F14\u7B97
+EvaluationException.plus=\u52A0\u7B97
+EvaluationException.minus=\u6E1B\u7B97
+EvaluationException.left=\u5DE6\u30B7\u30D5\u30C8
+EvaluationException.right=\u53F3\u30B7\u30D5\u30C8
+EvaluationException.times=\u4E57\u7B97
+EvaluationException.divide=\u9664\u7B97
+EvaluationException.mod=\u3079\u304D\u4E57
+EvaluationException.pos=\u5358\u9805\u30D7\u30E9\u30B9
+EvaluationException.neg=\u5358\u9805\u30DE\u30A4\u30CA\u30B9
+EvaluationException.not=\u30D3\u30C3\u30C8\u5358\u4F4D\u306ENOT\u6F14\u7B97
+EvaluationException.booleanNot=boolean NOT
+EvaluationException.booleanAnd=boolean AND
+EvaluationException.booleanOr=boolean OR
+EvaluationException.equal=\u6B21\u3068\u7B49\u3057\u3044
+EvaluationException.notEqual=\u6B21\u3068\u7B49\u3057\u304F\u306A\u3044
+EvaluationException.greaterThan=\u304C\u6B21\u306E\u5024\u3088\u308A\u5927\u304D\u3044
+EvaluationException.lessThan=\u304C\u6B21\u306E\u5024\u3088\u308A\u5C0F\u3055\u3044
+EvaluationException.greaterEqual=\u304C\u6B21\u306E\u5024\u4EE5\u4E0A
+EvaluationException.lessEqual=\u304C\u6B21\u306E\u5024\u4EE5\u4E0B
+GenFileStream.1=%0\u3092\u751F\u6210\u3067\u304D\u307E\u305B\u3093\u3067\u3057\u305F: %1
+InvalidArgument.1=\u5F15\u6570\u304C\u7121\u52B9\u3067\u3059: %0\u3002
+InvalidArgument.2=IDL\u30D5\u30A1\u30A4\u30EB\u304C\u6307\u5B9A\u3055\u308C\u3066\u3044\u307E\u305B\u3093\u3002
+InvalidCharacter.1=%0 (\u884C%1): \u6587\u5B57\u304C\u7121\u52B9\u3067\u3059: %2 (ASCII %3)\u3002\n%4\n%5
+Migration.futureKeyword=\u8B66\u544A: \u8B58\u5225\u5B50`%0'\u304C\u30AD\u30FC\u30EF\u30FC\u30C9\u3068\u7AF6\u5408\u3057\u3066\u3044\u307E\u3059\u3002\u5C06\u6765\u306E\u4E92\u63DB\u6027\u306E\u305F\u3081\u306B\u3001\u30A8\u30B9\u30B1\u30FC\u30D7\u3055\u308C\u305F\u8B58\u5225\u5B50\u3092\u4F7F\u7528\u3057\u3066\u304F\u3060\u3055\u3044\u3002
+Migration.keywordCollision=\u8B66\u544A: \u8B58\u5225\u5B50`%0'\u304C\u30AD\u30FC\u30EF\u30FC\u30C9\u3068\u7AF6\u5408\u3057\u3066\u3044\u307E\u3059\u3002\u5C06\u6765\u306E\u4E92\u63DB\u6027\u306E\u305F\u3081\u306B\u3001\u30A8\u30B9\u30B1\u30FC\u30D7\u3055\u308C\u305F\u8B58\u5225\u5B50\u3092\u4F7F\u7528\u3057\u3066\u304F\u3060\u3055\u3044\u3002
+ParseException.abstractValueBox=%0 (\u884C%1): \u5024\u30DC\u30C3\u30AF\u30B9\u306Fabstract\u3068\u3057\u3066\u5BA3\u8A00\u3067\u304D\u307E\u305B\u3093\u3002\n%2\n%3
+ParseException.alreadyDeclared=%0 (\u884C%1): %2\u306F\u3059\u3067\u306B\u5BA3\u8A00\u3055\u308C\u3066\u3044\u307E\u3059\u3002\n%3\n%4
+ParseException.declNotInSameFile=%0 (\u884C%1): %2\u306F\u30D5\u30A1\u30A4\u30EB%3\u306Eforward\u5BA3\u8A00\u3067\u4EE5\u524D\u306B\u5BA3\u8A00\u3055\u308C\u3066\u3044\u307E\u3059\u3002\n%4\n%5
+ParseException.alreadyDerived=%0 (\u884C%1): %2\u306F%3\u306E\u89AA\u3068\u3057\u3066\u3059\u3067\u306B\u5BA3\u8A00\u3055\u308C\u3066\u3044\u307E\u3059\u3002\n%4\n%5
+ParseException.alreadyDefaulted=%0 (\u884C%1): \u30C7\u30D5\u30A9\u30EB\u30C8\u306E\u5206\u5C90\u306F\u3059\u3067\u306B\u691C\u51FA\u3055\u308C\u3066\u3044\u307E\u3059\u3002\n%2\n%3
+ParseException.alreadyRaised=%0 (\u884C%1): %2\u306Fraises\u53E5\u3067\u3059\u3067\u306B\u6307\u5B9A\u3055\u308C\u3066\u3044\u307E\u3059\u3002\n%3\n%4
+ParseException.attributeNotType=%0 (\u884C%1): %2\u306F\u5C5E\u6027\u3067\u3059\u3002\u578B\u3068\u3057\u3066\u4F7F\u7528\u3059\u308B\u3053\u3068\u306F\u3067\u304D\u307E\u305B\u3093\u3002\n%3\n%4
+ParseException.badAbstract=%0 (\u884C%1): %2\u306Eforward\u5BA3\u8A00\u3068\u5B9F\u969B\u306E\u5BA3\u8A00\u306B\u4E00\u8CAB\u6027\u304C\u3042\u308A\u307E\u305B\u3093\u3002\u4E00\u65B9\u306Fabstract\u3067\u3059\u304C\u3001\u3082\u3046\u4E00\u65B9\u306Fabstract\u3067\u306F\u3042\u308A\u307E\u305B\u3093\u3002\n%3\n%4
+ParseException.badCustom=%0 (\u884C%1): forward\u5024\u5BA3\u8A00\u306Fcustom\u3068\u3057\u3066\u5BA3\u8A00\u3067\u304D\u307E\u305B\u3093\u3002\n%2\n%3
+ParseException.badRepIDAlreadyAssigned=%0 (\u884C%1): \u578B%2\u306B\u306F\u3001\u524D\u306EID\u30D7\u30E9\u30B0\u30DE\u30FB\u30C7\u30A3\u30EC\u30AF\u30C6\u30A3\u30D6\u306E\u30EA\u30DD\u30B8\u30C8\u30EAID\u304C\u3059\u3067\u306B\u5272\u308A\u5F53\u3066\u3089\u308C\u3066\u3044\u307E\u3059\u3002\n%3\n%4
+ParseException.badRepIDForm=%0 (\u884C%1): \u30EA\u30DD\u30B8\u30C8\u30EAID '%2'\u306E\u5F62\u5F0F\u306F':'\u306B\u3059\u308B\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059\u3002\n%3\n%4
+ParseException.badRepIDPrefix=%0 (\u884C%1): \u30A4\u30F3\u30BF\u30D5\u30A7\u30FC\u30B9%2\u306B\u306F\u3001'%4'\u3067\u306F\u306A\u304F\u30EA\u30DD\u30B8\u30C8\u30EAID\u30D7\u30EC\u30D5\u30A3\u30C3\u30AF\u30B9`%3'\u304C\u5FC5\u8981\u3067\u3059\u3002\n%5\n%6
+ParseException.badState=%0 (\u884C%1): %2\u306F\u30B9\u30C6\u30FC\u30C8\u30D5\u30EB\u30FB\u30A4\u30F3\u30BF\u30D5\u30A7\u30FC\u30B9\u306B\u3067\u304D\u307E\u305B\u3093\u3002\u8907\u6570\u306E\u30B9\u30C6\u30FC\u30C8\u30D5\u30EB\u89AA\u304C\u3042\u308A\u307E\u3059\u3002\n%3\n%4
+ParseException.branchLabel=%0 (\u884C%1): case %2\u306F\u3059\u3067\u306B\u5BA3\u8A00\u3055\u308C\u3066\u3044\u307E\u3059\u3002\n%3\n%4
+ParseException.branchName=%0 (\u884C%1): %2\u3068\u3044\u3046\u540D\u524D\u306E\u5206\u5C90\u306F\u3059\u3067\u306B\u5BA3\u8A00\u3055\u308C\u3066\u3044\u307E\u3059\u3002\n%3\n%4
+ParseException.duplicateInit=%0 (\u884C%1): \u521D\u671F\u5316\u5B50\u306B\u306F\u524D\u306E\u521D\u671F\u5316\u5B50\u3068\u540C\u3058\u7F72\u540D\u304C\u3042\u308A\u307E\u3059\u3002\n%2\n%3
+ParseException.duplicateState=%0 (\u884C%1): \u30C7\u30FC\u30BF\u30FB\u30E1\u30F3\u30D0\u30FC%2\u306E\u540D\u524D\u304C\u524D\u306E\u30C7\u30FC\u30BF\u30FB\u30E1\u30F3\u30D0\u30FC\u3068\u540C\u3058\u3067\u3059\u3002\n%3\n%4
+ParseException.elseNoIf=%0 (\u884C%1): \u4E00\u81F4\u3059\u308B#if\u304C\u306A\u3044#else\u304C\u691C\u51FA\u3055\u308C\u307E\u3057\u305F\u3002\n%2\n%3
+ParseException.endNoIf=%0 (\u884C%1): \u4E00\u81F4\u3059\u308B#if\u304C\u306A\u3044#endif\u304C\u691C\u51FA\u3055\u308C\u307E\u3057\u305F\u3002\n%2\n%3
+ParseException.evaluation=%0 (\u884C%1): %2\n%3\n%4
+ParseException.forwardEntry=%0 (\u884C%1): %2\u3078\u306E\u524D\u65B9\u53C2\u7167\u304C\u3042\u308A\u307E\u3059\u304C\u3001\u5B9A\u7FA9\u3055\u308C\u3066\u3044\u307E\u305B\u3093\u3002\n%3\n%4
+ParseException.forwardedValueBox=%0 (\u884C%1): %2\u306B\u306Fforward\u5BA3\u8A00\u304C\u3042\u308A\u307E\u3059\u3002\u5024\u30DC\u30C3\u30AF\u30B9\u306Fforward\u3068\u3057\u3066\u5BA3\u8A00\u3067\u304D\u307E\u305B\u3093\u3002\n%3\n%4
+ParseException.forwardInheritance=%0 (\u884C%1): %3\u306E\u4E0D\u5B8C\u5168\u306Aforward\u5BA3\u8A00\u304B\u3089\u306E%2\u306E\u7D99\u627F\u306F\u7121\u52B9\u3067\u3059\u3002\n%4\n%5
+ParseException.generic=%0 (\u884C%1): %2\n%3\n%4
+ParseException.illegalArray=%0 (\u884C%1): \u914D\u5217\u306F%2\u306E\u6B63\u3057\u3044\u578B\u3067\u306F\u3042\u308A\u307E\u305B\u3093\u3002\n%3\n%4
+ParseException.illegalException=%0 (\u884C%1): \u4F8B\u5916\u3092%2s\u5185\u306B\u8868\u793A\u3059\u308B\u3053\u3068\u306F\u3067\u304D\u307E\u305B\u3093\u3002\n%3\n%4
+ParseException.invalidConst1=%0 (\u884C%1): \u5B9A\u6570\u5F0F\u306F%3\u578B\u3067\u306F\u306A\u304F%2\u578B\u3067\u3042\u308B\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059\u3002\n%4\n%5
+ParseException.invalidConst2=%0 (\u884C%1): \u5B9A\u6570\u5F0F\u306E\u8B58\u5225\u5B50\u306F\u3001%2\u3067\u306F\u306A\u304F\u5B9A\u6570\u306B\u3059\u308B\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059\u3002\n%3\n%4
+ParseException.keywordCollision=%0 (\u884C%1): \u8B58\u5225\u5B50`%2'\u304C\u30AD\u30FC\u30EF\u30FC\u30C9\u3068\u7AF6\u5408\u3057\u3066\u3044\u307E\u3059\u3002\u5FC5\u8981\u306A\u5834\u5408\u306F\u30A8\u30B9\u30B1\u30FC\u30D7\u3055\u308C\u305F\u8B58\u5225\u5B50\u3092\u4F7F\u7528\u3057\u3066\u304F\u3060\u3055\u3044\u3002\n%3\n%4
+ParseException.methodClash=%0 (\u884C%1): \u30E1\u30BD\u30C3\u30C9\u540D\u304C\u30A4\u30F3\u30BF\u30D5\u30A7\u30FC\u30B9%2\u3067\u7AF6\u5408\u3057\u3066\u3044\u307E\u3059: %3\u3002\n%4\n%5
+ParseException.moduleNotType=%0 (\u884C%1): %2\u306F\u30E2\u30B8\u30E5\u30FC\u30EB\u3067\u3059\u3002\u578B\u3068\u3057\u3066\u4F7F\u7528\u3059\u308B\u3053\u3068\u306F\u3067\u304D\u307E\u305B\u3093\u3002\n%3\n%4
+ParseException.nestedValueBox=%0 (\u884C%1): \u5024\u30DC\u30C3\u30AF\u30B9\u306F\u30CD\u30B9\u30C8\u3067\u304D\u307E\u305B\u3093\u3002\n%2\n%3
+ParseException.noDefault=%0 (\u884C%1): \u8003\u3048\u3089\u308C\u308B\u3059\u3079\u3066\u306Ecase\u304C\u5B8C\u5168\u306B\u9069\u7528\u3055\u308C\u308B\u5834\u5408\u3001\u30C7\u30D5\u30A9\u30EB\u30C8\u306E\u5206\u5C90\u306F\u8A31\u53EF\u3055\u308C\u307E\u305B\u3093\u3002\n%2\n%3
+ParseException.nonAbstractParent=%0 (\u884C%1): abstract\u30A4\u30F3\u30BF\u30D5\u30A7\u30FC\u30B9%2\u306F\u975Eabstract\u30A4\u30F3\u30BF\u30D5\u30A7\u30FC\u30B9%3\u304B\u3089\u7D99\u627F\u3067\u304D\u307E\u305B\u3093\u3002\n%4\n%5
+ParseException.nonAbstractParent2=%0 (\u884C%1): abstract\u5024%2\u306F\u975Eabstract\u5024%3\u304B\u3089\u7D99\u627F\u3067\u304D\u307E\u305B\u3093\u3002\n%4\n%5
+ParseException.nonAbstractParent3=%0 (\u884C%1): \u5024%2\u306F\u6307\u5B9A\u3069\u304A\u308A\u306B\u975Eabstract\u5024%3\u304B\u3089\u7D99\u627F\u3067\u304D\u307E\u305B\u3093\u3002\n%4\n%5
+ParseException.notANumber=%0 (\u884C%1): \u6570\u5024\u304C\u5FC5\u8981\u3067\u3059\u3002%2\u306F\u6709\u52B9\u306A\u6570\u5024\u3067\u306F\u3042\u308A\u307E\u305B\u3093\u3002\n%3\n%4
+ParseException.nothing=%0\u306F\u7A7A\u3067\u3059\u3002\u30B3\u30F3\u30D1\u30A4\u30EB\u3059\u308B\u3082\u306E\u304C\u3042\u308A\u307E\u305B\u3093\u3002
+ParseException.notPosInt=%0 (\u884C%1): %2\u3067\u306F\u306A\u304F\u6B63\u306E\u6574\u6570\u306E\u5B9A\u6570\u304C\u5FC5\u8981\u3067\u3059\u3002\n%3\n%4
+ParseException.oneway=%0 (\u884C%1): %2\u306Foneway\u306B\u306A\u308B\u3088\u3046\u306B\u5BA3\u8A00\u3055\u308C\u307E\u3059\u3002oneway\u30E1\u30BD\u30C3\u30C9\u306F\u3001void\u3092\u8FD4\u3057\u3001\u30D1\u30E9\u30E1\u30FC\u30BF\u5185\u3067\u306E\u307F\u4F7F\u7528\u3057\u3001\u4F8B\u5916\u3092\u767A\u751F\u3057\u306A\u3044\u3088\u3046\u306B\u3059\u308B\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059\u3002\n%3\n%4
+ParseException.operationNotType=%0 (\u884C%1): %2\u306F\u64CD\u4F5C\u3067\u3059\u3002\u578B\u3068\u3057\u3066\u4F7F\u7528\u3059\u308B\u3053\u3068\u306F\u3067\u304D\u307E\u305B\u3093\u3002\n%3\n%4
+ParseException.outOfRange=%0 (\u884C%1): \u5B9A\u6570\u5F0F\u306E\u5024%2\u304C\u578B%3\u306E\u7BC4\u56F2\u3092\u8D85\u3048\u3066\u3044\u307E\u3059\u3002\n%4\n%5
+ParseException.recursive=%0 (\u884C%1): \u552F\u4E00\u306E\u6B63\u3057\u3044\u518D\u5E30\u7684\u5B9A\u7FA9\u306F\u6B21\u306E\u3068\u304A\u308A\u3067\u3059: \u30B7\u30FC\u30B1\u30F3\u30B9<%2> %3\u3002\n%4\n%5
+ParseException.selfInherit=%0 (\u884C%1): %2\u3092\u305D\u308C\u81EA\u4F53\u304B\u3089\u7D99\u627F\u3059\u308B\u3053\u3068\u306F\u3067\u304D\u307E\u305B\u3093\u3002\n%3\n%4
+ParseException.stringTooLong=%0 (\u884C%1): "%2"\u306F%3\u6587\u5B57\u4EE5\u5185\u306B\u3057\u3066\u304F\u3060\u3055\u3044\u3002\n%4\n%5
+ParseException.syntax1=%0 (\u884C%1): `%2'\u304C\u5FC5\u8981\u3067\u3059\u304C\u3001`%3'\u304C\u691C\u51FA\u3055\u308C\u307E\u3057\u305F\u3002\n%4\n%5
+ParseException.syntax2=%0 (\u884C%1): %2\u306E1\u3064\u304C\u5FC5\u8981\u3067\u3059\u304C\u3001`%3'\u304C\u691C\u51FA\u3055\u308C\u307E\u3057\u305F\u3002\n%4\n%5
+ParseException.unclosed=%0: \u30B3\u30E1\u30F3\u30C8\u3067\u4E88\u671F\u3057\u306A\u3044EOF\u3092\u691C\u51FA\u3057\u307E\u3057\u305F\u3002
+ParseException.undeclaredType=%0 (\u884C%1): %2\u306F\u5BA3\u8A00\u3055\u308C\u3066\u3044\u306A\u3044\u578B\u3067\u3059\u3002\n%3\n%4
+ParseException.warning=%0 (\u884C%1): %2\n%3\n%4
+ParseException.constExprType=%0 (\u884C%1): \u5B9A\u6570\u5F0F\u306E\u578B\u306F%2\u3067\u3059\u304C\u3001%3\u306B\u3059\u308B\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059\u3002\n%4\n%5
+ParseException.wrongType=%0 (\u884C%1): %2\u306E\u578B\u306F%3\u3067\u3059\u304C\u3001%4\u306B\u3059\u308B\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059\u3002\n%5\n%6
+ParseException.illegalIncompleteTypeReference=%0 (\u884C%1): %2\u578B\u306E\u4E0D\u5B8C\u5168\u306Aforward\u5BA3\u8A00\u3078\u306E\u7121\u52B9\u306A\u53C2\u7167\u3067\u3059\u3002\n%3\n%4
+Preprocessor.unknown=\u4E0D\u660E\u306A\u30D7\u30EA\u30D7\u30ED\u30BB\u30C3\u30B5\u30FB\u30C7\u30A3\u30EC\u30AF\u30C6\u30A3\u30D6`%0'\u3067\u3059\u3002\u884C\u306F\u7121\u8996\u3055\u308C\u307E\u3057\u305F\u3002
+Preprocessor.unknownPragma=\u4E0D\u660E\u306A\u30D7\u30E9\u30B0\u30DE`%0'\u3067\u3059\u3002\u884C\u306F\u7121\u8996\u3055\u308C\u307E\u3057\u305F\u3002
+Preprocessor.undefinedName=\u30D7\u30E9\u30B0\u30DE%0\u306E\u578B\u540D\u304C\u672A\u5B9A\u7FA9\u3067\u3059: %1\u3002\u884C\u306F\u7121\u8996\u3055\u308C\u307E\u3057\u305F\u3002
Token.boolLit=
Token.charLit=
Token.intLit=
@@ -164,32 +164,14 @@ Token.literal=
Token.identifier=
Token.endOfFile=EOF
Token.unknown=?
-Util.cantCreatePkg=\u30d1\u30c3\u30b1\u30fc\u30b8 %0 \u3092\u4f5c\u6210\u3067\u304d\u307e\u305b\u3093\u3002
-Version.product=IDL Parser Framework, \u30d0\u30fc\u30b8\u30e7\u30f3 "%0"
-Version.number=3.0
-default=\u30a8\u30e9\u30fc! \u5b58\u5728\u3057\u306a\u3044\u30e1\u30c3\u30bb\u30fc\u30b8\u304c\u8981\u6c42\u3055\u308c\u307e\u3057\u305f\u3002\u30e1\u30c3\u30bb\u30fc\u30b8\u30d5\u30a1\u30a4\u30eb\u306b\u30ad\u30fc\u304c\u3042\u308a\u307e\u305b\u3093: %0.
+Util.cantCreatePkg=\u30D1\u30C3\u30B1\u30FC\u30B8%0\u3092\u4F5C\u6210\u3067\u304D\u307E\u305B\u3093\u3002
+Version.product=IDL\u30D1\u30FC\u30B5\u30FC\u30FB\u30D5\u30EC\u30FC\u30E0\u30EF\u30FC\u30AF\u3001\u30D0\u30FC\u30B8\u30E7\u30F3"%0"
+Version.number=3.2
+default=\u30A8\u30E9\u30FC\u3002\u5B58\u5728\u3057\u306A\u3044\u30E1\u30C3\u30BB\u30FC\u30B8\u304C\u30EA\u30AF\u30A8\u30B9\u30C8\u3055\u308C\u307E\u3057\u305F\u3002\u30E1\u30C3\u30BB\u30FC\u30B8\u30FB\u30D5\u30A1\u30A4\u30EB\u306B\u30AD\u30FC\u304C\u542B\u307E\u308C\u3066\u3044\u307E\u305B\u3093: %0\u3002
# Translator: In the list of options below, do not translate:
# -i, -d, -keep, -emitAll, -noWarn, -v, -verbose, -version, #define
# Do not translate the string "java com.sun.tools.corba.se.idl.Compile"
-usage=\u30b3\u30f3\u30d1\u30a4\u30e9\u306e\u4f7f\u3044\u65b9:\n\
-\ java com.sun.tools.corba.se.idl.Compile [options] \n\
- \u306f IDL \u5b9a\u7fa9\u304c\u683c\u7d0d\u3055\u308c\u305f\u30d5\u30a1\u30a4\u30eb\u306e\u540d\u524d\u3067\u3059\u3002\n\
-[options] \u306f\u4ee5\u4e0b\u306b\u793a\u3059\u30aa\u30d7\u30b7\u30e7\u30f3\u306e\u7d44\u307f\u5408\u308f\u305b\u3067\u3059\u3002\n\
-\u3053\u308c\u3089\u306e\u30aa\u30d7\u30b7\u30e7\u30f3\u306f\u7701\u7565\u53ef\u80fd\u3067\u3001\u4efb\u610f\u306e\u9806\u5e8f\u3067\u4f7f\u7528\u3067\u304d\u307e\u3059\u3002\n\
-\u305f\u3060\u3057 \u306f\u5fc5\u9808\u3067\u3001\u6700\u5f8c\u306b\u6307\u5b9a\u3059\u308b\u5fc5\u8981\u304c\u3042\u308a\u307e\u3059\u3002\n\
-\ \n\
-\u30aa\u30d7\u30b7\u30e7\u30f3:\n\
- -d IDL \u30d5\u30a1\u30a4\u30eb\u5185\u306e\u6b21\u306e\u884c\u3068\u7b49\u4fa1:\n\
-\ #define \n\
- -emitAll #included \u30d5\u30a1\u30a4\u30eb\u5185\u306e\u3082\u306e\u3092\u542b\u3080\u5168\u578b\u3092\n\
-\ \u751f\u6210\u3059\u308b\n\
- -i \u30c7\u30d5\u30a9\u30eb\u30c8\u3067\u306f\u73fe\u5728\u306e\u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u3067\u30a4\u30f3\u30af\u30eb\u30fc\u30c9\u30d5\u30a1\u30a4\u30eb\u3092\u691c\u7d22\n\
-\ \u3059\u308b\u3002\u305d\u308c\u4ee5\u5916\u306e\u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u306f\u3053\u306e\u30aa\u30d7\u30b7\u30e7\u30f3\u3067\u8ffd\u52a0\u3059\u308b\n\
- -keep \u751f\u6210\u3059\u308b\u30d5\u30a1\u30a4\u30eb\u304c\u3059\u3067\u306b\u5b58\u5728\u3059\u308b\u5834\u5408\u3001\u65e2\u5b58\u306e\u30d5\u30a1\u30a4\u30eb\u3092\n\
-\ \u4e0a\u66f8\u304d\u3057\u306a\u3044\u3002\u30c7\u30d5\u30a9\u30eb\u30c8\u3067\u306f\u4e0a\u66f8\u304d\u3059\u308b\n\
- -noWarn \u8b66\u544a\u3092\u751f\u6210\u3057\u306a\u3044\n\
- -v, -verbose \u8a73\u7d30\u30e2\u30fc\u30c9\n\
- -version \u30d0\u30fc\u30b8\u30e7\u30f3\u756a\u53f7\u3092\u8868\u793a\u3059\u308b\n
+usage=\u30B3\u30F3\u30D1\u30A4\u30E9\u306E\u4F7F\u7528\u65B9\u6CD5:\n\ java com.sun.tools.corba.se.idl.Compile [options] \n\u306FIDL\u5B9A\u7FA9\u3092\u542B\u3080\u30D5\u30A1\u30A4\u30EB\u306E\u540D\u524D\u3067\u3001\n[options]\u306F\u6B21\u306B\u30EA\u30B9\u30C8\u3059\u308B\u30AA\u30D7\u30B7\u30E7\u30F3\u306E\u7D44\u5408\u305B\u3067\u3059\u3002\u30AA\u30D7\u30B7\u30E7\u30F3\u306F\n\u7701\u7565\u53EF\u80FD\u3067\u3001\u4EFB\u610F\u306E\u9806\u5E8F\u3067\u8868\u793A\u3055\u308C\u307E\u3059\u3002\u306F\u5FC5\u9808\u3067\u3001\n\u6700\u5F8C\u306B\u8868\u793A\u3059\u308B\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059\u3002\n\ \n\u30AA\u30D7\u30B7\u30E7\u30F3:\n-d IDL\u30D5\u30A1\u30A4\u30EB\u306E\u6B21\u306E\u884C\u3068\n\ \u540C\u3058\u3067\u3059: #define \n-emitAll #included\u30D5\u30A1\u30A4\u30EB\u3067\u898B\u3064\u304B\u3063\u305F\u30BF\u30A4\u30D7\u3092\u542B\u3080\u3001\u3059\u3079\u3066\u306E\u30BF\u30A4\u30D7\u3092\n\ \u767A\u884C\u3057\u307E\u3059\u3002\n-i \u30C7\u30D5\u30A9\u30EB\u30C8\u3067\u306F\u3001\u73FE\u5728\u306E\u30C7\u30A3\u30EC\u30AF\u30C8\u30EA\u306E\u30A4\u30F3\u30AF\u30EB\u30FC\u30C9\u3055\u308C\u305F\u30D5\u30A1\u30A4\u30EB\u304C\n\ \u30B9\u30AD\u30E3\u30F3\u3055\u308C\u307E\u3059\u3002\u3053\u306E\u30AA\u30D7\u30B7\u30E7\u30F3\u306F\u5225\u306E\u30C7\u30A3\u30EC\u30AF\u30C8\u30EA\u3092\u8FFD\u52A0\u3057\u307E\u3059\u3002\n-keep \u751F\u6210\u3055\u308C\u308B\u30D5\u30A1\u30A4\u30EB\u304C\u3059\u3067\u306B\u5B58\u5728\u3059\u308B\u5834\u5408\u306F\u3001\u4E0A\u66F8\u304D\n\ \u3057\u307E\u305B\u3093\u3002\u30C7\u30D5\u30A9\u30EB\u30C8\u3067\u306F\u4E0A\u66F8\u304D\u3055\u308C\u307E\u3059\u3002\n-noWarn \u8B66\u544A\u3092\u51FA\u3055\u306A\u3044\u3088\u3046\u306B\u3057\u307E\u3059\u3002\n-v, -verbose \u8A73\u7D30\u30E2\u30FC\u30C9\u3002\n-version \u30D0\u30FC\u30B8\u30E7\u30F3\u756A\u53F7\u3092\u8868\u793A\u3057\u307E\u3059\u3002\n
diff --git a/corba/src/share/classes/com/sun/tools/corba/se/idl/idl_zh_CN.prp b/corba/src/share/classes/com/sun/tools/corba/se/idl/idl_zh_CN.prp
index 9c532fd14d6..ed66b727a78 100644
--- a/corba/src/share/classes/com/sun/tools/corba/se/idl/idl_zh_CN.prp
+++ b/corba/src/share/classes/com/sun/tools/corba/se/idl/idl_zh_CN.prp
@@ -1,5 +1,5 @@
#
-# Copyright (c) 2005, 2009, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 1999, 2009, 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
@@ -64,132 +64,114 @@
#
# Translator: Start Translating
-Compile.parsing=\u6b63\u5728\u89e3\u6790 %0
-Compile.parseDone=\u5b8c\u6210--%0
-Compile.generating=\u6b63\u5728\u751f\u6210 %0
-Compile.genDone=\u5b8c\u6210--%0
-Deprecated.keyword=\u8b66\u544a\uff1a\u5173\u952e\u5b57 `%0' \u5df2\u8fc7\u65f6\u3002
-EvaluationException.1=%0 \u8fd0\u7b97\u7b26\u7684\u64cd\u4f5c\u6570\u4e0d\u4e00\u81f4\uff1a%1 \u548c %2\u3002
-EvaluationException.2=%0 \u8fd0\u7b97\u7b26\u7684\u64cd\u4f5c\u6570\u5fc5\u987b\u4e3a\u6570\u5b57\uff0c\u800c\u975e %1\u3002
-EvaluationException.or=\u6309\u4f4d or
-EvaluationException.xor=\u6309\u4f4d xor
-EvaluationException.and=\u6309\u4f4d and
-EvaluationException.plus=\u52a0
-EvaluationException.minus=\u51cf
-EvaluationException.left=\u5411\u5de6\u79fb\u4f4d
-EvaluationException.right=\u5411\u53f3\u79fb\u4f4d
-EvaluationException.times=\u4e58
-EvaluationException.divide=\u9664
-EvaluationException.mod=\u5efa\u6a21
-EvaluationException.pos=\u4e00\u5143\u6b63\u6570
-EvaluationException.neg=\u4e00\u5143\u8d1f\u6570
-EvaluationException.not=\u6309\u4f4d not
-EvaluationException.booleanNot=\u5e03\u5c14\u503c not
-EvaluationException.booleanAnd=\u5e03\u5c14\u503c and
-EvaluationException.booleanOr=\u5e03\u5c14\u503c or
-EvaluationException.equal=\u7b49\u4e8e
-EvaluationException.notEqual=\u4e0d\u7b49\u4e8e
-EvaluationException.greaterThan=\u5927\u4e8e
-EvaluationException.lessThan=\u5c0f\u4e8e
-EvaluationException.greaterEqual=\u5927\u4e8e\u6216\u7b49\u4e8e
-EvaluationException.lessEqual=\u5c0f\u4e8e\u6216\u7b49\u4e8e
-GenFileStream.1=\u65e0\u6cd5\u751f\u6210 {0}\uff1a%1
-InvalidArgument.1=\u53c2\u6570\u65e0\u6548\uff1a%0\u3002
-InvalidArgument.2=\u672a\u6307\u5b9a\u4efb\u4f55 IDL \u6587\u4ef6\u3002
-InvalidCharacter.1=%0\uff08\u7b2c %1 \u884c\uff09\uff1a\u5b57\u7b26\u65e0\u6548\uff1a%2 (ASCII %3)\u3002\n%4\n%5
-Migration.futureKeyword=\u8b66\u544a\uff1a\u6807\u8bc6\u7b26 `%0' \u4e0e\u5173\u952e\u5b57\u51b2\u7a81\uff0c\u8bf7\u4f7f\u7528\u6362\u7801\u7684\u6807\u8bc6\u7b26\u786e\u4fdd\u4ee5\u540e\u7684\u517c\u5bb9\u6027\u3002
-Migration.keywordCollision=\u8b66\u544a\uff1a\u6807\u8bc6\u7b26 `%0' \u4e0e\u5173\u952e\u5b57\u51b2\u7a81\uff0c\u8bf7\u4f7f\u7528\u6362\u7801\u7684\u6807\u8bc6\u7b26\u786e\u4fdd\u4ee5\u540e\u7684\u517c\u5bb9\u6027\u3002
-ParseException.abstractValueBox=%0\uff08\u7b2c %1 \u884c\uff09\uff1a\u65e0\u6cd5\u5c06\u503c\u6846\u58f0\u660e\u4e3a\u62bd\u8c61\u3002\n%2\n%3
-ParseException.alreadyDeclared=%0\uff08\u7b2c %1 \u884c\uff09\uff1a\u5df2\u58f0\u660e %2\u3002\n%3\n%4
-ParseException.declNotInSameFile=%0\uff08\u7b2c %1 \u884c\uff09\uff1a\u4ee5\u524d\u5df2\u5728\u6587\u4ef6 %3 \u7684\u5411\u524d\u58f0\u660e\u4e2d\u58f0\u660e\u4e86 %2\u3002\n%4\n%5
-ParseException.alreadyDerived=%0\uff08\u7b2c %1 \u884c\uff09\uff1a\u5df2\u5c06 %2 \u58f0\u660e\u4e3a %3 \u7684\u7236\u9879\u3002\n%4\n%5
-ParseException.alreadyDefaulted=%0\uff08\u7b2c %1 \u884c\uff09\uff1a\u9047\u5230\u9ed8\u8ba4\u5206\u652f\u3002\n%2\n%3
-ParseException.alreadyRaised=%0\uff08\u7b2c %1 \u884c\uff09\uff1a\u5df2\u5728 raises \u5b50\u53e5\u4e2d\u6307\u5b9a\u4e86 %2\u3002\n%3\n%4
-ParseException.attributeNotType=%0\uff08\u7b2c %1 \u884c\uff09\uff1a%2 \u4e3a\u5c5e\u6027\u3002\u4e0d\u80fd\u5c06\u5176\u7528\u4f5c\u7c7b\u578b\u3002\n%3\n%4
-ParseException.badAbstract=%0\uff08\u7b2c %1 \u884c\uff09\uff1a%2 \u7684\u5411\u524d\u548c\u5b9e\u9645\u58f0\u660e\u4e0d\u4e00\u81f4\u3002\u5176\u4e2d\u4e00\u4e2a\u662f\u62bd\u8c61\u58f0\u660e\uff0c\u800c\u53e6\u4e00\u4e2a\u5374\u4e0d\u662f\u3002\n%3\n%4
-ParseException.badCustom=%0\uff08\u7b2c %1 \u884c\uff09\uff1a\u65e0\u6cd5\u81ea\u5b9a\u4e49\u58f0\u660e\u5411\u524d\u503c\u58f0\u660e\u3002\n%2\n%3
-ParseException.badRepIDAlreadyAssigned=%0\uff08\u7b2c %1 \u884c\uff09\uff1a\u5728\u4ee5\u524d\u7684 ID pragma \u6307\u4ee4\u4e2d\u5df2\u5411\u7c7b\u578b %2 \u6307\u5b9a\u4e86\u7cfb\u7edf\u4fe1\u606f\u5e93 ID\u3002\n%3\n%4
-ParseException.badRepIDForm=%0\uff08\u7b2c %1 \u884c\uff09\uff1a\u7cfb\u7edf\u4fe1\u606f\u5e93 ID '%2' \u7684\u683c\u5f0f\u5e94\u4e3a '<\u683c\u5f0f>:<\u5b57\u7b26\u4e32>'\u3002\n%3\n%4
-ParseException.badRepIDPrefix=%0\uff08\u7b2c %1 \u884c\uff09\uff1a\u63a5\u53e3 %2 \u7684\u7cfb\u7edf\u4fe1\u606f\u5e93 ID \u524d\u7f00\u5e94\u4e3a `%3' \u800c\u975e '%4'\u3002\n%5\n%6
-ParseException.badState=%0\uff08\u7b2c %1 \u884c\uff09\uff1a%2 \u4e0d\u80fd\u4e3a\u6709\u72b6\u6001\u63a5\u53e3\uff1b\u5b83\u5177\u6709\u591a\u4e2a\u6709\u72b6\u6001\u7236\u63a5\u53e3\u3002\n%3\n%4
-ParseException.branchLabel=%0\uff08\u7b2c %1 \u884c\uff09\uff1a\u5df2\u58f0\u660e\u6761\u4ef6 %2\u3002\n%3\n%4
-ParseException.branchName=%0\uff08\u7b2c %1 \u884c\uff09\uff1a\u5df2\u58f0\u660e\u540d\u4e3a %2 \u7684\u5206\u652f\u3002\n%3\n%4
-ParseException.duplicateInit=%0\uff08\u7b2c %1 \u884c\uff09\uff1a\u521d\u59cb\u5316\u7a0b\u5e8f\u4e0e\u4ee5\u524d\u7684\u521d\u59cb\u5316\u7a0b\u5e8f\u5177\u6709\u76f8\u540c\u7684\u7b7e\u540d\u3002\n%2\n%3
-ParseException.duplicateState=%0\uff08\u7b2c %1 \u884c\uff09\uff1a\u6570\u636e\u6210\u5458 %2 \u4e0e\u4ee5\u524d\u7684\u6570\u636e\u6210\u5458\u5177\u6709\u76f8\u540c\u7684\u540d\u79f0\u3002\n%3\n%4
-ParseException.elseNoIf=%0\uff08\u7b2c %1 \u884c\uff09\uff1a\u9047\u5230\u7684 #else \u6ca1\u6709\u5339\u914d\u7684 #if\u3002\n%2\n%3
-ParseException.endNoIf=%0\uff08\u7b2c %1 \u884c\uff09\uff1a\u9047\u5230\u7684 #endif \u6ca1\u6709\u5339\u914d\u7684 #if\u3002\n%2\n%3
-ParseException.evaluation=%0\uff08\u7b2c %1 \u884c\uff09\uff1a %2\n%3\n%4
-ParseException.forwardEntry=%0\uff08\u7b2c %1 \u884c\uff09\uff1a\u5b58\u5728\u5bf9 %2 \u7684\u5411\u524d\u5f15\u7528\uff0c\u4f46\u5c1a\u672a\u8fdb\u884c\u5b9a\u4e49\u3002\n%3\n%4
-ParseException.forwardedValueBox=%0\uff08\u7b2c %1 \u884c\uff09\uff1a%2 \u5177\u6709\u5411\u524d\u58f0\u660e\u3002\u65e0\u6cd5\u5411\u524d\u58f0\u660e\u503c\u6846\u3002\n%3\n%4
-ParseException.forwardInheritance=%0\uff08\u7b2c %1 \u884c\uff09\uff1a%2 \u4ece %3 \u7684\u4e0d\u5b8c\u6574\u7684\u5411\u524d\u58f0\u660e\u8fdb\u884c\u7ee7\u627f\u662f\u975e\u6cd5\u7684\u3002\n%4\n%5
-ParseException.generic=%0\uff08\u7b2c %1 \u884c\uff09\uff1a %2\n%3\n%4
-ParseException.illegalArray=%0\uff08\u7b2c %1 \u884c\uff09\uff1a%2 \u4e2d\u7684\u6570\u7ec4\u7684\u7c7b\u578b\u4e0d\u5408\u6cd5\u3002\n%3\n%4
-ParseException.illegalException=%0\uff08\u7b2c %1 \u884c\uff09\uff1a\u5f02\u5e38\u4e0d\u80fd\u663e\u793a\u5728 %2 \u4e2d\u3002\n%3\n%4
-ParseException.invalidConst1=%0\uff08\u7b2c %1 \u884c\uff09\uff1a\u5e38\u91cf\u8868\u8fbe\u5f0f\u7684\u7c7b\u578b\u5fc5\u987b\u4e3a %2\uff0c\u800c\u4e0d\u80fd\u4e3a %3\u3002\n%4\n%5
-ParseException.invalidConst2=%0\uff08\u7b2c %1 \u884c\uff09\uff1a\u5e38\u91cf\u8868\u8fbe\u5f0f\u4e2d\u7684\u6807\u8bc6\u7b26\u5fc5\u987b\u4e3a\u5e38\u91cf\uff0c\u800c\u4e0d\u80fd\u4e3a %2\u3002\n%3\n%4
-ParseException.keywordCollision=%0\uff08\u7b2c %1 \u884c\uff09\uff1a\u6807\u8bc6\u7b26 `%2' \u4e0e\u5173\u952e\u5b57\u51b2\u7a81\uff1b\u5982\u679c\u9700\u8981\uff0c\u8bf7\u4f7f\u7528\u6362\u7801\u7684\u6807\u8bc6\u7b26\u3002\n%3\n%4
-ParseException.methodClash=%0\uff08\u7b2c %1 \u884c\uff09\uff1a\u63a5\u53e3 %2 \u4e2d\u7684\u65b9\u6cd5\u540d\u51b2\u7a81\uff1a%3\u3002\n%4\n%5
-ParseException.moduleNotType=%0\uff08\u7b2c %1 \u884c\uff09\uff1a%2 \u4e3a\u6a21\u5757\u3002\u4e0d\u80fd\u5c06\u5176\u7528\u4f5c\u7c7b\u578b\u3002\n%3\n%4
-ParseException.nestedValueBox=%0\uff08\u7b2c %1 \u884c\uff09\uff1a\u503c\u6846\u4e0d\u80fd\u5d4c\u5957\u3002\n%2\n%3
-ParseException.noDefault=%0\uff08\u7b2c %1 \u884c\uff09\uff1a\u6ee1\u8db3\u6240\u6709\u53ef\u80fd\u60c5\u51b5\u65f6\uff0c\u4e0d\u5141\u8bb8\u4f7f\u7528\u9ed8\u8ba4\u5206\u652f\u3002\n%2\n%3
-ParseException.nonAbstractParent=%0\uff08\u7b2c %1 \u884c\uff09\uff1a\u62bd\u8c61\u63a5\u53e3 %2 \u4e0d\u80fd\u4ece\u975e\u62bd\u8c61\u63a5\u53e3 %3 \u8fdb\u884c\u7ee7\u627f\u3002\n%4\n%5
-ParseException.nonAbstractParent2=%0\uff08\u7b2c %1 \u884c\uff09\uff1a\u62bd\u8c61\u503c %2 \u4e0d\u80fd\u4ece\u975e\u62bd\u8c61\u503c %3 \u8fdb\u884c\u7ee7\u627f\u3002\n%4\n%5
-ParseException.nonAbstractParent3=%0\uff08\u7b2c %1 \u884c\uff09\uff1a\u503c %2 \u65e0\u6cd5\u6309\u6307\u5b9a\u7684\u90a3\u6837\u4ece\u975e\u62bd\u8c61\u503c %3 \u8fdb\u884c\u7ee7\u627f\u3002\n%4\n%5
-ParseException.notANumber=%0\uff08\u7b2c %1 \u884c\uff09\uff1a\u9700\u8981\u6570\u5b57\u3002%2 \u4e0d\u662f\u6709\u6548\u6570\u5b57\u3002\n%3\n%4
-ParseException.nothing=%0 \u4e3a\u7a7a\u3002\u65e0\u7f16\u8bd1\u5185\u5bb9\u3002
-ParseException.notPosInt=%0\uff08\u7b2c %1 \u884c\uff09\uff1a\u9700\u8981\u6b63\u6574\u6570\u5e38\u91cf\uff0c\u800c\u4e0d\u662f %2\u3002\n%3\n%4
-ParseException.oneway=%0\uff08\u7b2c %1 \u884c\uff09\uff1a\u5c06 %2 \u58f0\u660e\u4e3a oneway\u3002Oneway \u65b9\u6cd5\u5fc5\u987b\uff1a\u8fd4\u56de void\uff1b\u4ec5\u5728\u53c2\u6570\u4e2d\u624d\u6709\uff1b\u4e0d\u4f1a\u51fa\u73b0\u4efb\u4f55\u5f02\u5e38\u3002\n%3\n%4
-ParseException.operationNotType=%0\uff08\u7b2c %1 \u884c\uff09\uff1a%2 \u4e3a\u64cd\u4f5c\u3002\u4e0d\u80fd\u5c06\u5176\u7528\u4f5c\u7c7b\u578b\u3002\n%3\n%4
-ParseException.outOfRange=%0\uff08\u7b2c %1 \u884c\uff09\uff1a\u5e38\u91cf\u8868\u8fbe\u5f0f\u7684\u503c %2 \u8d85\u51fa\u4e86\u7c7b\u578b %3 \u7684\u8303\u56f4\u3002\n%4\n%5
-ParseException.recursive=%0\uff08\u7b2c %1 \u884c\uff09\uff1a\u552f\u4e00\u7684\u5408\u6cd5\u9012\u5f52\u5b9a\u4e49\u4e3a\uff1asequence<%2> %3\u3002\n%4\n%5
-ParseException.selfInherit=%0\uff08\u7b2c %1 \u884c\uff09\uff1a%2 \u4e0d\u80fd\u4ece\u5176\u672c\u8eab\u8fdb\u884c\u7ee7\u627f\u3002\n%3\n%4
-ParseException.stringTooLong=%0\uff08\u7b2c %1 \u884c\uff09\uff1a"%2" \u7684\u957f\u5ea6\u4e0d\u80fd\u8d85\u8fc7 %3 \u4e2a\u5b57\u7b26\u3002\n%4\n%5
-ParseException.syntax1=%0\uff08\u7b2c %1 \u884c\uff09\uff1a\u9700\u8981 `%2'\uff0c\u800c\u9047\u5230 `%3'\u3002\n%4\n%5
-ParseException.syntax2=%0\uff08\u7b2c %1 \u884c\uff09\uff1a\u9700\u8981\u5176\u4e2d\u4e00\u4e2a `%2'\uff0c\u800c\u9047\u5230 `%3'\u3002\n%4\n%5
-ParseException.unclosed=%0\uff1a\u5728\u6ce8\u91ca\u4e2d\u9047\u5230\u610f\u5916\u7684\u6587\u4ef6\u7ed3\u5c3e\u3002
-ParseException.undeclaredType=%0\uff08\u7b2c %1 \u884c\uff09\uff1a%2 \u662f\u672a\u58f0\u660e\u7684\u7c7b\u578b\u3002\n%3\n%4
-ParseException.warning=%0\uff08\u7b2c %1 \u884c\uff09\uff1a %2\n%3\n%4
-ParseException.constExprType=%0\uff08\u7b2c %1 \u884c\uff09\uff1a\u5e38\u91cf\u8868\u8fbe\u5f0f\u7684\u7c7b\u578b\u4e3a %2\uff0c\u4f46\u662f\u5b83\u5e94\u8be5\u4e3a %3\u3002\n%4\n%5
-ParseException.wrongType=%0\uff08\u7b2c %1 \u884c\uff09\uff1a%2 \u7684\u7c7b\u578b\u4e3a %3\uff0c\u4f46\u662f\u5b83\u5e94\u8be5\u4e3a %4\u3002\n%5\n%6
-ParseException.illegalIncompleteTypeReference=%0\uff08\u7b2c %1 \u884c\uff09\uff1a\u5bf9\u7c7b\u578b %2 \u7684\u4e0d\u5b8c\u6574\u5411\u524d\u58f0\u660e\u7684\u5f15\u7528\u975e\u6cd5\u3002\n%3\n%4
-Preprocessor.unknown=\u672a\u77e5\u9884\u5904\u7406\u7a0b\u5e8f\u6307\u4ee4 `%0'\u3002\u5ffd\u7565\u884c\u3002
-Preprocessor.unknownPragma=\u672a\u77e5 pragma `%0'\u3002\u5ffd\u7565\u884c\u3002
-Preprocessor.undefinedName=pragma %0 \u7684\u672a\u5b9a\u4e49\u7c7b\u578b\u540d\uff1a%1\u3002 \u5ffd\u7565\u884c\u3002
-Token.boolLit=<\u5e03\u5c14\u503c\u5b57\u9762\u503c>
-Token.charLit=<\u5b57\u7b26\u5b57\u9762\u503c>
-Token.intLit=<\u6574\u578b\u5b57\u9762\u503c>
-Token.floatLit=<\u6d6e\u70b9\u5b57\u9762\u503c>
-Token.stringLit=<\u5b57\u7b26\u4e32\u5b57\u9762\u503c>
-Token.literal=<\u5b57\u9762\u503c>
-Token.identifier=<\u6807\u8bc6\u7b26>
+Compile.parsing=\u6B63\u5728\u5BF9 %0 \u8FDB\u884C\u8BED\u6CD5\u5206\u6790
+Compile.parseDone=\u5B8C\u6210 - %0
+Compile.generating=\u6B63\u5728\u751F\u6210 %0
+Compile.genDone=\u5B8C\u6210 - %0
+Deprecated.keyword=\u8B66\u544A: \u5173\u952E\u5B57 `%0' \u5DF2\u8FC7\u65F6\u3002
+EvaluationException.1=%0 \u8FD0\u7B97\u7B26\u7684\u64CD\u4F5C\u6570\u4E0D\u4E00\u81F4: %1 \u548C %2\u3002
+EvaluationException.2=%0 \u8FD0\u7B97\u7B26\u7684\u64CD\u4F5C\u6570\u5FC5\u987B\u662F\u6570\u5B57, \u800C\u4E0D\u662F %1\u3002
+EvaluationException.or=\u6309\u4F4D\u6216
+EvaluationException.xor=\u6309\u4F4D\u5F02\u6216
+EvaluationException.and=\u6309\u4F4D\u4E0E
+EvaluationException.plus=\u6DFB\u52A0
+EvaluationException.minus=\u51CF\u6CD5
+EvaluationException.left=\u5411\u5DE6\u79FB\u4F4D
+EvaluationException.right=\u5411\u53F3\u79FB\u4F4D
+EvaluationException.times=\u4E58\u6CD5
+EvaluationException.divide=\u9664\u6CD5
+EvaluationException.mod=\u53D6\u6A21
+EvaluationException.pos=\u4E00\u5143\u6B63\u6570
+EvaluationException.neg=\u4E00\u5143\u8D1F\u6570
+EvaluationException.not=\u6309\u4F4D\u975E
+EvaluationException.booleanNot=\u5E03\u5C14\u975E
+EvaluationException.booleanAnd=\u5E03\u5C14\u4E0E
+EvaluationException.booleanOr=\u5E03\u5C14\u6216
+EvaluationException.equal=\u7B49\u4E8E
+EvaluationException.notEqual=\u4E0D\u7B49\u4E8E
+EvaluationException.greaterThan=\u5927\u4E8E
+EvaluationException.lessThan=\u5C0F\u4E8E
+EvaluationException.greaterEqual=\u5927\u4E8E\u7B49\u4E8E
+EvaluationException.lessEqual=\u5C0F\u4E8E\u7B49\u4E8E
+GenFileStream.1=\u65E0\u6CD5\u751F\u6210%0: %1
+InvalidArgument.1=\u53C2\u6570\u65E0\u6548: %0\u3002
+InvalidArgument.2=\u672A\u6307\u5B9A IDL \u6587\u4EF6\u3002
+InvalidCharacter.1=%0 (\u884C %1): \u5B57\u7B26\u65E0\u6548: %2 (ASCII %3)\u3002\n%4\n%5
+Migration.futureKeyword=\u8B66\u544A: \u6807\u8BC6\u7B26 `%0' \u4E0E\u5173\u952E\u5B57\u51B2\u7A81; \u8BF7\u4F7F\u7528\u8F6C\u4E49\u6807\u8BC6\u7B26\u4EE5\u786E\u4FDD\u5C06\u6765\u517C\u5BB9\u3002
+Migration.keywordCollision=\u8B66\u544A: \u6807\u8BC6\u7B26 `%0' \u4E0E\u5173\u952E\u5B57\u51B2\u7A81; \u8BF7\u4F7F\u7528\u8F6C\u4E49\u6807\u8BC6\u7B26\u4EE5\u786E\u4FDD\u5C06\u6765\u517C\u5BB9\u3002
+ParseException.abstractValueBox=%0 (\u884C %1): \u4E0D\u80FD\u5C06\u503C\u6846\u58F0\u660E\u4E3A\u62BD\u8C61\u3002\n%2\n%3
+ParseException.alreadyDeclared=%0 (\u884C %1): %2\u5DF2\u58F0\u660E\u3002\n%3\n%4
+ParseException.declNotInSameFile=%0 (\u884C %1): %2\u4EE5\u524D\u66FE\u5728\u6587\u4EF6%3\u7684\u524D\u5411\u58F0\u660E\u4E2D\u58F0\u660E\u3002\n%4\n%5
+ParseException.alreadyDerived=%0 (\u884C %1): %2\u5DF2\u58F0\u660E\u4E3A%3\u7684\u7236\u7EA7\u3002\n%4\n%5
+ParseException.alreadyDefaulted=%0 (\u884C %1): \u5DF2\u9047\u5230\u9ED8\u8BA4\u5206\u652F\u3002\n%2\n%3
+ParseException.alreadyRaised=%0 (\u884C %1): %2\u5DF2\u5728 raise \u5B50\u53E5\u4E2D\u6307\u5B9A\u3002\n%3\n%4
+ParseException.attributeNotType=%0 (\u884C %1): %2 \u662F\u5C5E\u6027\u3002\u4E0D\u80FD\u5C06\u5176\u7528\u4F5C\u7C7B\u578B\u3002\n%3\n%4
+ParseException.badAbstract=%0 (\u884C %1): %2\u7684\u524D\u5411\u58F0\u660E\u548C\u5B9E\u9645\u58F0\u660E\u4E0D\u4E00\u81F4\u3002\u4E00\u4E2A\u662F\u62BD\u8C61\u7684, \u800C\u53E6\u4E00\u4E2A\u4E0D\u662F\u62BD\u8C61\u7684\u3002\n%3\n%4
+ParseException.badCustom=%0 (\u884C %1): \u65E0\u6CD5\u5C06\u524D\u5411\u503C\u58F0\u660E\u58F0\u660E\u4E3A\u5B9A\u5236\u3002\n%2\n%3
+ParseException.badRepIDAlreadyAssigned=%0 (\u884C %1): \u5DF2\u5728\u4E0A\u4E00\u4E2A ID \u7F16\u8BD1\u6307\u793A\u6307\u4EE4\u4E2D\u4E3A\u7C7B\u578B%2\u5206\u914D\u4E86\u8D44\u6599\u6863\u6848\u5E93 ID\u3002\n%3\n%4
+ParseException.badRepIDForm=%0 (\u884C %1): \u8D44\u6599\u6863\u6848\u5E93 ID '%2' \u7684\u683C\u5F0F\u5E94\u4E3A ':'\u3002\n%3\n%4
+ParseException.badRepIDPrefix=%0 (\u884C %1): \u63A5\u53E3 %2 \u7684\u8D44\u6599\u6863\u6848\u5E93 ID \u524D\u7F00\u5E94\u4E3A `%3', \u800C\u975E '%4'\u3002\n%5\n%6
+ParseException.badState=%0 (\u884C %1): %2 \u4E0D\u80FD\u662F\u6709\u72B6\u6001\u63A5\u53E3; \u5B83\u5305\u542B\u591A\u4E2A\u6709\u72B6\u6001\u7236\u7EA7\u3002\n%3\n%4
+ParseException.branchLabel=%0 (\u884C %1): case %2\u5DF2\u58F0\u660E\u3002\n%3\n%4
+ParseException.branchName=%0 (\u884C %1): \u540D\u4E3A%2\u7684\u5206\u652F\u5DF2\u58F0\u660E\u3002\n%3\n%4
+ParseException.duplicateInit=%0 (\u884C %1): \u67D0\u4E2A\u521D\u59CB\u5316\u7A0B\u5E8F\u4E0E\u4E0A\u4E00\u4E2A\u521D\u59CB\u5316\u7A0B\u5E8F\u5177\u6709\u76F8\u540C\u7684\u7B7E\u540D\u3002\n%2\n%3
+ParseException.duplicateState=%0 (\u884C %1): \u6570\u636E\u6210\u5458 %2 \u4E0E\u4E0A\u4E00\u4E2A\u6570\u636E\u6210\u5458\u5177\u6709\u76F8\u540C\u7684\u540D\u79F0\u3002\n%3\n%4
+ParseException.elseNoIf=%0 (\u884C %1): \u9047\u5230\u4E86 #else, \u4F46\u6CA1\u6709\u5339\u914D\u7684 #if\u3002\n%2\n%3
+ParseException.endNoIf=%0 (\u884C %1): \u9047\u5230\u4E86 #endif, \u4F46\u6CA1\u6709\u5339\u914D\u7684 #if\u3002\n%2\n%3
+ParseException.evaluation=%0 (\u884C %1): %2\n%3\n%4
+ParseException.forwardEntry=%0 (\u884C %1): \u5B58\u5728\u9488\u5BF9%2\u7684\u524D\u5411\u5F15\u7528, \u4F46\u5B83\u5C1A\u672A\u5B9A\u4E49\u3002\n%3\n%4
+ParseException.forwardedValueBox=%0 (\u884C %1): %2 \u5177\u6709\u524D\u5411\u58F0\u660E\u3002\u4E0D\u80FD\u5BF9\u503C\u6846\u8FDB\u884C\u524D\u5411\u58F0\u660E\u3002\n%3\n%4
+ParseException.forwardInheritance=%0 (\u884C %1): \u5BF9\u4E8E%2, \u4ECE%3\u7684\u4E0D\u5B8C\u6574\u524D\u5411\u58F0\u660E\u8FDB\u884C\u7EE7\u627F\u662F\u975E\u6CD5\u7684\u3002\n%4\n%5
+ParseException.generic=%0 (\u884C %1): %2\n%3\n%4
+ParseException.illegalArray=%0 (\u884C %1): %2\u4E2D\u67D0\u4E2A\u6570\u7EC4\u7684\u7C7B\u578B\u975E\u6CD5\u3002\n%3\n%4
+ParseException.illegalException=%0 (\u884C %1): %2s \u4E2D\u4E0D\u80FD\u51FA\u73B0\u5F02\u5E38\u9519\u8BEF\u3002\n%3\n%4
+ParseException.invalidConst1=%0 (\u884C %1): \u5E38\u91CF\u8868\u8FBE\u5F0F\u7684\u7C7B\u578B\u5FC5\u987B\u662F%2, \u800C\u4E0D\u80FD\u662F%3\u3002\n%4\n%5
+ParseException.invalidConst2=%0 (\u884C %1): \u5E38\u91CF\u8868\u8FBE\u5F0F\u4E2D\u7684\u6807\u8BC6\u7B26\u5FC5\u987B\u662F\u5E38\u91CF, \u800C\u4E0D\u80FD\u662F%2\u3002\n%3\n%4
+ParseException.keywordCollision=%0 (\u884C %1): \u6807\u8BC6\u7B26 `%2' \u4E0E\u5173\u952E\u5B57\u51B2\u7A81; \u5982\u6709\u5FC5\u8981, \u8BF7\u4F7F\u7528\u8F6C\u4E49\u6807\u8BC6\u7B26\u3002\n%3\n%4
+ParseException.methodClash=%0 (\u884C %1): \u63A5\u53E3 %2 \u4E2D\u7684\u65B9\u6CD5\u540D\u51B2\u7A81: %3\u3002\n%4\n%5
+ParseException.moduleNotType=%0 (\u884C %1): %2 \u662F\u6A21\u5757\u3002\u4E0D\u80FD\u5C06\u5176\u7528\u4F5C\u7C7B\u578B\u3002\n%3\n%4
+ParseException.nestedValueBox=%0 (\u884C %1): \u503C\u6846\u4E0D\u80FD\u5D4C\u5957\u3002\n%2\n%3
+ParseException.noDefault=%0 (\u884C %1): \u5F53\u5B8C\u5168\u6D89\u53CA\u6240\u6709\u53EF\u80FD\u7684 case \u65F6, \u4E0D\u5141\u8BB8\u4F7F\u7528\u9ED8\u8BA4\u5206\u652F\u3002\n%2\n%3
+ParseException.nonAbstractParent=%0 (\u884C %1): \u62BD\u8C61\u63A5\u53E3 %2 \u4E0D\u80FD\u4ECE\u975E\u62BD\u8C61\u63A5\u53E3 %3 \u7EE7\u627F\u3002\n%4\n%5
+ParseException.nonAbstractParent2=%0 (\u884C %1): \u62BD\u8C61\u503C %2 \u4E0D\u80FD\u4ECE\u975E\u62BD\u8C61\u503C %3 \u7EE7\u627F\u3002\n%4\n%5
+ParseException.nonAbstractParent3=%0 (\u884C %1): \u503C %2 \u4E0D\u80FD\u6839\u636E\u6307\u5B9A\u4ECE\u975E\u62BD\u8C61\u503C %3 \u7EE7\u627F\u3002\n%4\n%5
+ParseException.notANumber=%0 (\u884C %1): \u5E94\u4E3A\u6570\u5B57\u3002%2\u4E0D\u662F\u6709\u6548\u7684\u6570\u5B57\u3002\n%3\n%4
+ParseException.nothing=%0\u4E3A\u7A7A\u3002\u6CA1\u6709\u8981\u7F16\u8BD1\u7684\u5BF9\u8C61\u3002
+ParseException.notPosInt=%0 (\u884C %1): \u5E94\u4E3A\u6B63\u6574\u6570\u5E38\u91CF, \u800C\u975E%2\u3002\n%3\n%4
+ParseException.oneway=%0 (\u884C %1): %2\u5DF2\u58F0\u660E\u4E3A\u5355\u5411\u3002\u5355\u5411\u65B9\u6CD5\u5FC5\u987B: \u8FD4\u56DE\u7A7A\u503C; \u53EA\u6709 in \u53C2\u6570; \u4E0D\u5F15\u53D1\u5F02\u5E38\u9519\u8BEF\u3002\n%3\n%4
+ParseException.operationNotType=%0 (\u884C %1): %2\u662F\u8FD0\u7B97\u3002\u4E0D\u80FD\u5C06\u5176\u7528\u4F5C\u7C7B\u578B\u3002\n%3\n%4
+ParseException.outOfRange=%0 (\u884C %1): \u5E38\u91CF\u8868\u8FBE\u5F0F %2 \u7684\u503C\u8D85\u51FA\u4E86\u7C7B\u578B%3\u7684\u8303\u56F4\u3002\n%4\n%5
+ParseException.recursive=%0 (\u884C %1): \u552F\u4E00\u7684\u5408\u6CD5\u9012\u5F52\u5B9A\u4E49\u662F: sequence<%2> %3\u3002\n%4\n%5
+ParseException.selfInherit=%0 (\u884C %1): %2 \u4E0D\u80FD\u4ECE\u81EA\u8EAB\u7EE7\u627F\u3002\n%3\n%4
+ParseException.stringTooLong=%0 (\u884C %1): "%2" \u7684\u957F\u5EA6\u4E0D\u80FD\u8D85\u8FC7 %3 \u4E2A\u5B57\u7B26\u3002\n%4\n%5
+ParseException.syntax1=%0 (\u884C %1): \u5E94\u4E3A `%2'; \u4F46\u9047\u5230 `%3'\u3002\n%4\n%5
+ParseException.syntax2=%0 (\u884C %1): \u5E94\u4E3A %2 \u4E4B\u4E00; \u4F46\u9047\u5230 `%3'\u3002\n%4\n%5
+ParseException.unclosed=%0: \u5728\u6CE8\u91CA\u4E2D\u9047\u5230\u610F\u5916\u7684\u6587\u4EF6\u7ED3\u5C3E\u3002
+ParseException.undeclaredType=%0 (\u884C %1): %2 \u662F\u672A\u58F0\u660E\u7684\u7C7B\u578B\u3002\n%3\n%4
+ParseException.warning=%0 (\u884C %1): %2\n%3\n%4
+ParseException.constExprType=%0 (\u884C %1): \u5E38\u91CF\u8868\u8FBE\u5F0F\u7684\u7C7B\u578B\u4E3A %2, \u4F46\u5E94\u4E3A %3\u3002\n%4\n%5
+ParseException.wrongType=%0 (\u884C %1): %2\u7684\u7C7B\u578B\u4E3A%3, \u4F46\u5E94\u4E3A%4\u3002\n%5\n%6
+ParseException.illegalIncompleteTypeReference=%0 (\u884C %1): \u5BF9\u7C7B\u578B%2\u7684\u4E0D\u5B8C\u6574\u524D\u5411\u58F0\u660E\u7684\u5F15\u7528\u975E\u6CD5\u3002\n%3\n%4
+Preprocessor.unknown=\u672A\u77E5\u7684\u9884\u5904\u7406\u7A0B\u5E8F\u6307\u4EE4 `%0'\u3002\u5DF2\u5FFD\u7565\u884C\u3002
+Preprocessor.unknownPragma=\u672A\u77E5\u7684\u7F16\u8BD1\u6307\u793A\u6307\u4EE4 `%0'\u3002\u5DF2\u5FFD\u7565\u884C\u3002
+Preprocessor.undefinedName=\u7F16\u8BD1\u6307\u793A %0 \u7684\u672A\u5B9A\u4E49\u7C7B\u578B\u540D: %1\u3002\u5DF2\u5FFD\u7565\u884C\u3002
+Token.boolLit=<\u5E03\u5C14\u6587\u5B57>
+Token.charLit=<\u5B57\u7B26\u6587\u5B57>
+Token.intLit=<\u6574\u578B\u6587\u5B57>
+Token.floatLit=<\u6D6E\u70B9\u6587\u5B57>
+Token.stringLit=<\u5B57\u7B26\u4E32\u6587\u5B57>
+Token.literal=<\u6587\u5B57>
+Token.identifier=<\u6807\u8BC6\u7B26>
Token.endOfFile=EOF
Token.unknown=?
-Util.cantCreatePkg=\u65e0\u6cd5\u521b\u5efa\u8f6f\u4ef6\u5305 %0\u3002
-Version.product=IDL Parser Framework\uff0c\u7248\u672c "%0"
+Util.cantCreatePkg=\u65E0\u6CD5\u521B\u5EFA\u7A0B\u5E8F\u5305%0\u3002
+Version.product=IDL \u8BED\u6CD5\u5206\u6790\u5668\u6846\u67B6, \u7248\u672C "%0"
Version.number=3.2
-default=\u9519\u8bef\uff01\u8bf7\u6c42\u7684\u6d88\u606f\u4e0d\u5b58\u5728\u3002\u6d88\u606f\u6587\u4ef6\u4e0d\u5305\u542b\u5bc6\u94a5\uff1a%0\u3002
+default=\u9519\u8BEF! \u8BF7\u6C42\u4E86\u4E0D\u5B58\u5728\u7684\u6D88\u606F\u3002\u6D88\u606F\u6587\u4EF6\u672A\u5305\u542B\u5173\u952E\u5B57: %0\u3002
# Translator: In the list of options below, do not translate:
# -i, -d, -keep, -emitAll, -noWarn, -v, -verbose, -version, #define
# Do not translate the string "java com.sun.tools.corba.se.idl.Compile"
-usage=\u7f16\u8bd1\u5668\u7528\u6cd5\uff1a\n\
-\ java com.sun.tools.corba.se.idl.Compile [\u9009\u9879] \n\
-\u5176\u4e2d\uff0c \u662f\u5305\u542b IDL \u5b9a\u4e49\u7684\u6587\u4ef6\u7684\u540d\u79f0\uff0c\u800c\n\
-[\u9009\u9879] \u662f\u4ee5\u4e0b\u6240\u5217\u9009\u9879\u7684\u4efb\u4e00\u7ec4\u5408\u3002\u8fd9\u4e9b\u9009\u9879\n\
-\u662f\u53ef\u9009\u7684\u5e76\u4e14\u53ef\u4ee5\u4ee5\u4efb\u610f\u987a\u5e8f\u663e\u793a\uff1b \u662f\u5fc5\u987b\u7684\u5e76\u4e14\n\
-\u5fc5\u987b\u663e\u793a\u5728\u6700\u540e\u3002\n\
-\ \n\
-\u9009\u9879\uff1a\n\
--d <\u7b26\u53f7> \u7b49\u4ef7\u4e8e IDL \u6587\u4ef6\u4e2d\u7684\u4ee5\u4e0b\u884c\uff1a\n\
-\ #define <\u7b26\u53f7>\n\
--emitAll \u53d1\u51fa\u6240\u6709\u7c7b\u578b\uff0c\u5305\u62ec\u5728 #included\n\
-\ \u6587\u4ef6\u4e2d\u627e\u5230\u7684\u90a3\u4e9b\u7c7b\u578b\u3002\n\
--i <\u5305\u62ec\u8def\u5f84> \u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0c\u641c\u7d22\u5f53\u524d\u76ee\u5f55\u4ee5\u83b7\u5f97\u5176\u6240\u5305\u542b\u7684\u6587\u4ef6\u3002\n\
-\ \u6b64\u9009\u9879\u5c06\u6dfb\u52a0\u5176\u4ed6\u76ee\u5f55\u3002\n\
--keep \u5982\u679c\u8981\u751f\u6210\u7684\u6587\u4ef6\u5df2\u5b58\u5728\uff0c\u5219\u4e0d\n\
-\ \u8986\u76d6\u5b83\u3002\u9ed8\u8ba4\u60c5\u51b5\u4e0b\u4f1a\u8986\u76d6\u8be5\u6587\u4ef6\u3002\n\
--noWarn \u6291\u5236\u8b66\u544a\u3002\n\
--v, -verbose \u8be6\u7ec6\u6a21\u5f0f\u3002\n\
--version \u663e\u793a\u7248\u672c\u53f7\u3002\n
+usage=\u7F16\u8BD1\u5668\u7528\u6CD5:\n\ java com.sun.tools.corba.se.idl.Compile [\u9009\u9879] \n\u5176\u4E2D, \u662F\u5305\u542B IDL \u5B9A\u4E49\u7684\u6587\u4EF6\u7684\u540D\u79F0, \u800C\n[\u9009\u9879] \u662F\u4E0B\u5217\u9009\u9879\u7684\u4EFB\u610F\u7EC4\u5408\u3002\u8FD9\u4E9B\u9009\u9879\n\u662F\u53EF\u9009\u7684, \u5E76\u4E14\u663E\u793A\u987A\u5E8F\u5E76\u4E0D\u56FA\u5B9A; \u662F\u5FC5\u9700\u7684\n\u5E76\u4E14\u5FC5\u987B\u663E\u793A\u5728\u6700\u540E\u3002\n\ \n\u9009\u9879:\n-d <\u7B26\u53F7> \u8FD9\u7B49\u540C\u4E8E IDL \u6587\u4EF6\u4E2D\u7684\n\ \u4E0B\u9762\u4E00\u884C: #define <\u7B26\u53F7>\n-emitAll \u53D1\u51FA\u6240\u6709\u7C7B\u578B, \u5305\u62EC\u5728 #included\n\ \u6587\u4EF6\u4E2D\u627E\u5230\u7684\u7C7B\u578B\u3002\n-i <\u5305\u542B\u8DEF\u5F84> \u9ED8\u8BA4\u60C5\u51B5\u4E0B, \u5C06\u5728\u5F53\u524D\u76EE\u5F55\u4E2D\u626B\u63CF\n\ \u5305\u542B\u7684\u6587\u4EF6\u3002\u6B64\u9009\u9879\u5C06\u6DFB\u52A0\u53E6\u4E00\u4E2A\u76EE\u5F55\u3002\n-keep \u5982\u679C\u8981\u751F\u6210\u7684\u6587\u4EF6\u5DF2\u5B58\u5728, \u8BF7\u4E0D\u8981\n\ \u8986\u76D6\u5B83\u3002\u9ED8\u8BA4\u60C5\u51B5\u4E0B\u4F1A\u8986\u76D6\u5B83\u3002\n-noWarn \u9690\u85CF\u8B66\u544A\u3002\n-v, -verbose \u8BE6\u7EC6\u6A21\u5F0F\u3002\n-version \u663E\u793A\u7248\u672C\u53F7\u3002\n
diff --git a/corba/src/share/classes/com/sun/tools/corba/se/idl/toJavaPortable/toJavaPortable_ja.prp b/corba/src/share/classes/com/sun/tools/corba/se/idl/toJavaPortable/toJavaPortable_ja.prp
index 09c330fd512..1171c88b7f2 100644
--- a/corba/src/share/classes/com/sun/tools/corba/se/idl/toJavaPortable/toJavaPortable_ja.prp
+++ b/corba/src/share/classes/com/sun/tools/corba/se/idl/toJavaPortable/toJavaPortable_ja.prp
@@ -1,5 +1,5 @@
#
-# Copyright (c) 2001, 2009, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 1999, 2009, 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
@@ -51,61 +51,18 @@
#
# Translator: Start Translating
#
-toJavaProlog1=%0 \u3067\u751f\u6210
-toJavaProlog2=\u751f\u6210\u5143: %0
-PreEmit.indeterminateTypeInfo=%0 \u306e\u578b\u60c5\u5831\u3092\u5224\u5b9a\u3067\u304d\u307e\u305b\u3093\u3002
-InterfaceGen.noImpl=%0 \u306e\u30ed\u30fc\u30ab\u30eb\u5b9f\u88c5\u304c\u898b\u3064\u304b\u308a\u307e\u305b\u3093\u3002
-Version.product=IDL-to-Java \u30b3\u30f3\u30d1\u30a4\u30e9 (\u30dd\u30fc\u30bf\u30d6\u30eb), \u30d0\u30fc\u30b8\u30e7\u30f3 "%0"
-Version.number=3.1
-NameModifier.TooManyPercent=\u30d1\u30bf\u30fc\u30f3\u306b\u30011 \u3064\u4ee5\u4e0a\u306e % \u6587\u5b57\u304c\u542b\u307e\u308c\u3066\u3044\u307e\u3059
-NameModifier.NoPercent=\u30d1\u30bf\u30fc\u30f3\u306b % \u6587\u5b57\u304c 1 \u3064\u3082\u542b\u307e\u308c\u3066\u3044\u307e\u305b\u3093
-NameModifier.InvalidChar=\u30d1\u30bf\u30fc\u30f3\u306b\u7121\u52b9\u306a\u6587\u5b57 %0 \u304c\u542b\u307e\u308c\u3066\u3044\u307e\u3059
+toJavaProlog1=%0\u306B\u3088\u3063\u3066\u751F\u6210\u3055\u308C\u307E\u3057\u305F
+toJavaProlog2=%0\u304B\u3089
+PreEmit.indeterminateTypeInfo=%0\u306E\u30BF\u30A4\u30D7\u60C5\u5831\u3092\u5224\u65AD\u3067\u304D\u307E\u305B\u3093\u3002
+InterfaceGen.noImpl=%0\u306E\u30ED\u30FC\u30AB\u30EB\u5B9F\u88C5\u304C\u898B\u3064\u304B\u308A\u307E\u305B\u3093\u3002
+Version.product=IDL-to-Java\u30B3\u30F3\u30D1\u30A4\u30E9(\u30DD\u30FC\u30BF\u30D6\u30EB)\u3001\u30D0\u30FC\u30B8\u30E7\u30F3"%0"
+Version.number=3.2
+NameModifier.TooManyPercent=\u30D1\u30BF\u30FC\u30F3\u306B\u8907\u6570\u306E\u30D1\u30FC\u30BB\u30F3\u30C8\u6587\u5B57\u304C\u542B\u307E\u308C\u3066\u3044\u307E\u3059
+NameModifier.NoPercent=\u30D1\u30BF\u30FC\u30F3\u306B\u30D1\u30FC\u30BB\u30F3\u30C8\u6587\u5B57\u304C\u542B\u307E\u308C\u3066\u3044\u307E\u305B\u3093
+NameModifier.InvalidChar=\u30D1\u30BF\u30FC\u30F3\u306B\u7121\u52B9\u306A\u6587\u5B57%0\u304C\u542B\u307E\u308C\u3066\u3044\u307E\u3059
#
# Translator: In the list of options below, do not translate:
# -d, -emitAll, -f, -i, -keep, -m, -sep, -pkgPrefix, -td, -v, -verbose, -version, -implbase
# Do not translate the string "java com.sun.tools.corba.se.idl.toJavaPortable.Compile"
#
-usage=\u30b3\u30f3\u30d1\u30a4\u30e9\u306e\u4f7f\u3044\u65b9:\n\
-\n\
-\ java com.sun.tools.corba.se.idl.toJavaPortable.Compile [options] \n\
-\n\
- \u306f IDL \u5b9a\u7fa9\u304c\u683c\u7d0d\u3055\u308c\u305f\u30d5\u30a1\u30a4\u30eb\u306e\u540d\u524d\u3067\u3059\u3002\n\
-[options] \u306f\u4ee5\u4e0b\u306b\u793a\u3059\u30aa\u30d7\u30b7\u30e7\u30f3\u306e\u7d44\u307f\u5408\u308f\u305b\u3067\u3059\u3002\n\
-\u3053\u308c\u3089\u306e\u30aa\u30d7\u30b7\u30e7\u30f3\u306f\u7701\u7565\u53ef\u80fd\u3067\u3001\u4efb\u610f\u306e\u9806\u5e8f\u3067\u4f7f\u7528\u3067\u304d\u307e\u3059\u3002\n\
-\u305f\u3060\u3057 \u306f\u5fc5\u9808\u3067\u3001\u6700\u5f8c\u306b\u6307\u5b9a\u3059\u308b\u5fc5\u8981\u304c\u3042\u308a\u307e\u3059\u3002\n\
-\ \n\
-\u30aa\u30d7\u30b7\u30e7\u30f3:\n\
- -d IDL \u30d5\u30a1\u30a4\u30eb\u5185\u306e\u6b21\u306e\u884c\u3068\u7b49\u4fa1:\n\
-\ #define \n\
- -emitAll #included \u30d5\u30a1\u30a4\u30eb\u5185\u306e\u3082\u306e\u3092\u542b\u3080\u5168\u578b\u3092\u751f\u6210\u3059\u308b\u3002\n\
- -f \u751f\u6210\u3059\u308b\u30d3\u30eb\u30c9\u3092\u5b9a\u7fa9\u3059\u308b\u3002 \u306b\u306f\u3001client\u3001server\u3001\n\
-\ all\u3001serverTIE\u3001allTIE \u306e\u3046\u3061\u306e 1 \u3064\u3092\u6307\u5b9a\u3059\u308b\u3002serverTIE \u3068\n\
-\ allTIE \u3067\u306f\u59d4\u8b72\u30e2\u30c7\u30eb\u30b9\u30b1\u30eb\u30c8\u30f3\u304c\u751f\u6210\u3055\u308c\u308b\u3002\u3053\u306e\u30d5\u30e9\u30b0\u3092\n\
-\ \u6307\u5b9a\u3057\u306a\u3044\u5834\u5408\u3001-fclient \u304c\u6307\u5b9a\u3055\u308c\u305f\u3082\u306e\u3068\u3057\u3066\u52d5\u4f5c\u3059\u308b\u3002\n\
- -i \u30c7\u30d5\u30a9\u30eb\u30c8\u3067\u306f\u73fe\u5728\u306e\u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u3067\u30a4\u30f3\u30af\u30eb\u30fc\u30c9\u30d5\u30a1\u30a4\u30eb\u3092\u691c\u7d22\n\
-\ \u3059\u308b\u3002\u305d\u308c\u4ee5\u5916\u306e\u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u306f\u3053\u306e\u30aa\u30d7\u30b7\u30e7\u30f3\u3067\u8ffd\u52a0\u3059\u308b\n\
- -keep \u751f\u6210\u3059\u308b\u30d5\u30a1\u30a4\u30eb\u304c\u3059\u3067\u306b\u5b58\u5728\u3059\u308b\u5834\u5408\u3001\u65e2\u5b58\u306e\u30d5\u30a1\u30a4\u30eb\u3092\n\
-\ \u4e0a\u66f8\u304d\u3057\u306a\u3044\u3002\u30c7\u30d5\u30a9\u30eb\u30c8\u3067\u306f\u4e0a\u66f8\u304d\u3059\u308b\n\
- -noWarn \u8b66\u544a\u3092\u751f\u6210\u3057\u306a\u3044\n\
- -oldImplBase \u65e7 JDK (1.4 \u4ee5\u524d) \u306e ORB \u3068\u4e92\u63db\u6027\u306e\u3042\u308b\u30b9\u30b1\u30eb\u30c8\u30f3\u3092\u751f\u6210\u3059\u308b\n\
- -pkgPrefix \u30d5\u30a1\u30a4\u30eb\u30b9\u30b3\u30fc\u30d7\u3067\u578b\u540d\u307e\u305f\u306f\u30e2\u30b8\u30e5\u30fc\u30eb\u540d \u304c\u691c\u51fa\u3055\u308c\u305f\n\
-\ \u5834\u5408\u3001 \u306b\u5bfe\u3057\u3066\u751f\u6210\u3059\u308b\u5168\u30d5\u30a1\u30a4\u30eb\u306e Java \u30d1\u30c3\u30b1\u30fc\u30b8\u540d\u306e\n\
-\ \u5148\u982d\u306b \u3092\u8ffd\u52a0\u3059\u308b\n\
- -pkgTranslate \u578b\u307e\u305f\u306f\u30e2\u30b8\u30e5\u30fc\u30eb\u540d \u3092\u691c\u51fa\u3059\u308b\u3068\u3001\u751f\u6210\u3057\u305f java\n\
-\ \u30d1\u30c3\u30b1\u30fc\u30b8\u5185\u306e \u306b\u7f6e\u304d\u63db\u3048\u3089\u308c\u308b\u3002pkgPrefix \u304c\u6700\u521d\u306b\n\
-\ \u5909\u66f4\u3055\u308c\u308b\u3053\u3068\u306b\u6ce8\u610f\u3059\u308b\u3053\u3068\u3002 \u306f\u30d1\u30c3\u30b1\u30fc\u30b8\u540d\u3068\u6b63\u78ba\u306b\n\
-\ \u4e00\u81f4\u3057\u3066\u3044\u308b\u5fc5\u8981\u304c\u3042\u308b\u3002\u307e\u305f\u3001 \u306f\u3001org\u3001org.omg\u3001\u307e\u305f\u306f\n\
-\ org.omg \u306e\u30b5\u30d6\u30d1\u30c3\u30b1\u30fc\u30b8\u3067\u3042\u3063\u3066\u306f\u306a\u3089\u306a\u3044\u3002\n\
- -skeletonName \u30d1\u30bf\u30fc\u30f3\u306b\u5f93\u3063\u3066\u30b9\u30b1\u30eb\u30c8\u30f3\u306b\u540d\u524d\u3092\u4ed8\u3051\u308b\u3002\u30c7\u30d5\u30a9\u30eb\u30c8\u306f\n\
-\ \u4ee5\u4e0b\u306e\u901a\u308a:\n\
-\ POA \u57fa\u5e95\u30af\u30e9\u30b9 (-fserver \u307e\u305f\u306f -fall) \u306b\u306f %POA\u3001\n\
-\ oldImplBase \u57fa\u5e95\u30af\u30e9\u30b9 (-oldImplBase \u304a\u3088\u3073 (-fserver \n\
-\ \u307e\u305f\u306f -fall)) \u306b\u306f _%Impl\u3002\n\
- -td \u51fa\u529b\u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u3068\u3057\u3066\u73fe\u5728\u306e\u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u306e\u4ee3\u308f\u308a\u306b \u3092\n\
-\ \u4f7f\u7528\u3059\u308b\n\
- -tieName \u30d1\u30bf\u30fc\u30f3\u306b\u5f93\u3063\u3066 Tie \u306b\u540d\u524d\u3092\u4ed8\u3051\u308b\u3002\u30c7\u30d5\u30a9\u30eb\u30c8\u306f\u4ee5\u4e0b\u306e\u901a\u308a:\n\
-\ POA Tie (-fserverTie \u307e\u305f\u306f -fallTie) \u306b\u306f %POATie\u3001\n\
-\ oldImplBase Tie (-oldImplBase \u304a\u3088\u3073 (-fserverTie \u307e\u305f\u306f\n\
-\ -fallTie)) \u306b\u306f _%Tie\u3002\n\
- -v, -verbose \u8a73\u7d30\u30e2\u30fc\u30c9\n\
- -version \u30d0\u30fc\u30b8\u30e7\u30f3\u756a\u53f7\u3092\u8868\u793a\u3057\u3066\u7d42\u4e86\u3059\u308b\n
+usage=\u30B3\u30F3\u30D1\u30A4\u30E9\u306E\u4F7F\u7528\u65B9\u6CD5:\n\n\ java com.sun.tools.corba.se.idl.toJavaPortable.Compile [options] \n\n\u306FIDL\u5B9A\u7FA9\u3092\u542B\u3080\u30D5\u30A1\u30A4\u30EB\u306E\u540D\u524D\u3067\u3001\n[options]\u306F\u6B21\u306B\u30EA\u30B9\u30C8\u3059\u308B\u30AA\u30D7\u30B7\u30E7\u30F3\u306E\u7D44\u5408\u305B\u3067\u3059\u3002\u30AA\u30D7\u30B7\u30E7\u30F3\u306F\n\u7701\u7565\u53EF\u80FD\u3067\u3001\u4EFB\u610F\u306E\u9806\u5E8F\u3067\u8868\u793A\u3055\u308C\u307E\u3059\u3002\u306F\u5FC5\u9808\u3067\u3001\n\u6700\u5F8C\u306B\u8868\u793A\u3059\u308B\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059\u3002\n\ \n\u30AA\u30D7\u30B7\u30E7\u30F3:\n-d IDL\u30D5\u30A1\u30A4\u30EB\u306E\u6B21\u306E\u884C\u3068\n\ \u540C\u3058\u3067\u3059: #define \n-emitAll #included\u30D5\u30A1\u30A4\u30EB\u3067\u898B\u3064\u304B\u3063\u305F\u30BF\u30A4\u30D7\u3092\u542B\u3080\u3001\u3059\u3079\u3066\u306E\u30BF\u30A4\u30D7\u3092\u767A\u884C\u3057\u307E\u3059\u3002\n-f \u767A\u884C\u3059\u308B\u30D0\u30A4\u30F3\u30C7\u30A3\u30F3\u30B0\u3092\u5B9A\u7FA9\u3057\u307E\u3059\u3002\u306Fclient\u3001\n\ server\u3001all\u3001serverTIE\u3001allTIE\u306E\u3044\u305A\u308C\u304B\u3067\u3059\u3002serverTIE\u3068allTIE\u306F\n\ \u59D4\u4EFB\u30E2\u30C7\u30EB\u30FB\u30B9\u30B1\u30EB\u30C8\u30F3\u3092\u767A\u884C\u3057\u307E\u3059\u3002\u3053\u306E\u30D5\u30E9\u30B0\u3092\n\ \u4F7F\u7528\u3057\u306A\u3044\u5834\u5408\u306F\u3001-fclient\u3068\u307F\u306A\u3055\u308C\u307E\u3059\u3002\n-i \u30C7\u30D5\u30A9\u30EB\u30C8\u3067\u306F\u3001\u73FE\u5728\u306E\u30C7\u30A3\u30EC\u30AF\u30C8\u30EA\u306E\u30A4\u30F3\u30AF\u30EB\u30FC\u30C9\u3055\u308C\u305F\u30D5\u30A1\u30A4\u30EB\u304C\n\ \u30B9\u30AD\u30E3\u30F3\u3055\u308C\u307E\u3059\u3002\u3053\u306E\u30AA\u30D7\u30B7\u30E7\u30F3\u306F\u5225\u306E\u30C7\u30A3\u30EC\u30AF\u30C8\u30EA\u3092\u8FFD\u52A0\u3057\u307E\u3059\u3002\n-keep \u751F\u6210\u3055\u308C\u308B\u30D5\u30A1\u30A4\u30EB\u304C\u3059\u3067\u306B\u5B58\u5728\u3059\u308B\u5834\u5408\u306F\u3001\u4E0A\u66F8\u304D\n\ \u3057\u307E\u305B\u3093\u3002\u30C7\u30D5\u30A9\u30EB\u30C8\u3067\u306F\u4E0A\u66F8\u304D\u3055\u308C\u307E\u3059\u3002\n-noWarn \u8B66\u544A\u3092\u51FA\u3055\u306A\u3044\u3088\u3046\u306B\u3057\u307E\u3059\u3002\n-oldImplBase \u53E4\u3044(1.4\u4EE5\u524D) JDK ORB\u3068\u4E92\u63DB\u6027\u306E\u3042\u308B\u30B9\u30B1\u30EB\u30C8\u30F3\u3092\u751F\u6210\u3057\u307E\u3059\u3002\n-pkgPrefix \u30D5\u30A1\u30A4\u30EB\u30FB\u30B9\u30B3\u30FC\u30D7\u3067\u30BF\u30A4\u30D7\u307E\u305F\u306F\u30E2\u30B8\u30E5\u30FC\u30EB\u540D\u304C\u691C\u51FA\u3055\u308C\u305F\u5834\u5408\u3001\n\ \u306B\u5BFE\u3057\u3066\u751F\u6210\u3055\u308C\u305F\u3059\u3079\u3066\u306E\u30D5\u30A1\u30A4\u30EB\u306EJava\u30D1\u30C3\u30B1\u30FC\u30B8\u540D\u3092\n\ \u3067\u59CB\u3081\u307E\u3059\u3002\n-pkgTranslate \u30BF\u30A4\u30D7\u307E\u305F\u306F\u30E2\u30B8\u30E5\u30FC\u30EB\u540D\u304C\u691C\u51FA\u3055\u308C\u305F\u5834\u5408\u3001\n\ \u751F\u6210\u3055\u308C\u305FJava\u30D1\u30C3\u30B1\u30FC\u30B8\u5185\u3067\u306B\u7F6E\u63DB\u3055\u308C\u307E\u3059\u3002pkgPrefix\u306E\n\ \u5909\u66F4\u304C\u5148\u306B\u884C\u308F\u308C\u308B\u3053\u3068\u306B\u6CE8\u610F\u3057\u3066\u304F\u3060\u3055\u3044\u3002\u306F\u30D1\u30C3\u30B1\u30FC\u30B8\u306E\n\ \u6B63\u5F0F\u540D\u3068\u5B8C\u5168\u306B\u4E00\u81F4\u3057\u3066\u3044\u308B\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059\u3002\u307E\u305F\u3001\u3092\n\ org\u3001org.omg\u307E\u305F\u306Forg.omg\u306E\u30B5\u30D6\u30D1\u30C3\u30B1\u30FC\u30B8\u306B\u3057\u306A\u3044\u3067\u304F\u3060\u3055\u3044\u3002\n-skeletonName \u30D1\u30BF\u30FC\u30F3\u306B\u5F93\u3063\u3066\u30B9\u30B1\u30EB\u30C8\u30F3\u306B\u540D\u524D\u3092\u4ED8\u3051\u307E\u3059\u3002\n\ \u30C7\u30D5\u30A9\u30EB\u30C8\u306F\u6B21\u306E\u3068\u304A\u308A\u3067\u3059:\n\ POA\u30D9\u30FC\u30B9\u30FB\u30AF\u30E9\u30B9\u306E\u5834\u5408\u306F%POA (-fserver\u307E\u305F\u306F-fall) \n\ oldImplBase\u30D9\u30FC\u30B9\u30FB\u30AF\u30E9\u30B9\u306E\u5834\u5408\u306F_%ImplBase\n\ (-oldImplBase\u304A\u3088\u3073(-fserver\u307E\u305F\u306F-fall))\u3002\n-td \u51FA\u529B\u30C7\u30A3\u30EC\u30AF\u30C8\u30EA\u306B\u306F\u3001\u73FE\u5728\u306E\u30C7\u30A3\u30EC\u30AF\u30C8\u30EA\u306E\u304B\u308F\u308A\u306B\u3092\n\ \u4F7F\u7528\u3057\u307E\u3059\u3002\n-tieName \u30D1\u30BF\u30FC\u30F3\u306B\u5F93\u3063\u3066tie\u306B\u540D\u524D\u3092\u4ED8\u3051\u307E\u3059\u3002\u30C7\u30D5\u30A9\u30EB\u30C8\u306F\u6B21\u306E\u3068\u304A\u308A\u3067\u3059:\n\ POA tie\u306E\u5834\u5408\u306F%POATie (-fserverTie\u307E\u305F\u306F-fallTie) \n\ oldImplBase tie\u306E\u5834\u5408\u306F%_Tie\n\ (-oldImplBase\u304A\u3088\u3073(-fserverTie\u307E\u305F\u306F-fallTie))\u3002\n-v, -verbose \u8A73\u7D30\u30E2\u30FC\u30C9\u3002\n-version \u30D0\u30FC\u30B8\u30E7\u30F3\u756A\u53F7\u3092\u8868\u793A\u3057\u3066\u7D42\u4E86\u3057\u307E\u3059\u3002\n
diff --git a/corba/src/share/classes/com/sun/tools/corba/se/idl/toJavaPortable/toJavaPortable_zh_CN.prp b/corba/src/share/classes/com/sun/tools/corba/se/idl/toJavaPortable/toJavaPortable_zh_CN.prp
index fc7cf7aaa67..dd385beab8f 100644
--- a/corba/src/share/classes/com/sun/tools/corba/se/idl/toJavaPortable/toJavaPortable_zh_CN.prp
+++ b/corba/src/share/classes/com/sun/tools/corba/se/idl/toJavaPortable/toJavaPortable_zh_CN.prp
@@ -1,5 +1,5 @@
#
-# Copyright (c) 2005, 2009, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 1999, 2009, 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
@@ -51,61 +51,18 @@
#
# Translator: Start Translating
#
-toJavaProlog1=\u7531 %0 \u751f\u6210
-toJavaProlog2=\u6765\u81ea %0
-PreEmit.indeterminateTypeInfo=\u65e0\u6cd5\u786e\u5b9a %0 \u7684\u7c7b\u578b\u4fe1\u606f\u3002
-InterfaceGen.noImpl=\u672a\u627e\u5230 %0 \u7684\u672c\u5730\u5b9e\u73b0\u3002
-Version.product=IDL-to-Java \u7f16\u8bd1\u5668\uff08\u53ef\u79fb\u690d\uff09\uff0c\u7248\u672c "%0"
+toJavaProlog1=\u7531%0\u751F\u6210
+toJavaProlog2=\u4ECE%0
+PreEmit.indeterminateTypeInfo=\u65E0\u6CD5\u786E\u5B9A%0\u7684\u7C7B\u578B\u4FE1\u606F\u3002
+InterfaceGen.noImpl=\u627E\u4E0D\u5230%0\u7684\u672C\u5730\u5B9E\u73B0\u3002
+Version.product=IDL-to-Java \u7F16\u8BD1\u5668 (\u53EF\u79FB\u690D), \u7248\u672C "%0"
Version.number=3.2
-NameModifier.TooManyPercent=\u6a21\u5f0f\u5305\u542b\u591a\u4e2a\u767e\u5206\u6bd4\u5b57\u7b26
-NameModifier.NoPercent=\u6a21\u5f0f\u4e0d\u5305\u542b\u4efb\u4f55\u767e\u5206\u6bd4\u5b57\u7b26
-NameModifier.InvalidChar=\u6a21\u5f0f\u5305\u542b\u65e0\u6548\u5b57\u7b26 %0
+NameModifier.TooManyPercent=\u6A21\u5F0F\u4E2D\u5305\u542B\u591A\u4E2A\u767E\u5206\u6BD4\u5B57\u7B26
+NameModifier.NoPercent=\u6A21\u5F0F\u4E2D\u4E0D\u5305\u542B\u767E\u5206\u6BD4\u5B57\u7B26
+NameModifier.InvalidChar=\u6A21\u5F0F\u4E2D\u5305\u542B\u65E0\u6548\u5B57\u7B26 %0
#
# Translator: In the list of options below, do not translate:
# -d, -emitAll, -f, -i, -keep, -m, -sep, -pkgPrefix, -td, -v, -verbose, -version, -implbase
# Do not translate the string "java com.sun.tools.corba.se.idl.toJavaPortable.Compile"
#
-usage=\u7f16\u8bd1\u5668\u7528\u6cd5\uff1a\n\
-\n\
-\ java com.sun.tools.corba.se.idl.toJavaPortable.Compile [\u9009\u9879] \n\
-\n\
-\u5176\u4e2d\uff0c \u662f\u5305\u542b IDL \u5b9a\u4e49\u7684\u6587\u4ef6\u7684\u540d\u79f0\uff0c\u800c\n\
-[\u9009\u9879] \u662f\u4ee5\u4e0b\u6240\u5217\u9009\u9879\u7684\u4efb\u4e00\u7ec4\u5408\u3002\u8fd9\u4e9b\u9009\u9879\u662f\u53ef\u9009\u7684\n\
-\u5e76\u4e14\u53ef\u4ee5\u4ee5\u4efb\u610f\u987a\u5e8f\u663e\u793a\uff1b \u662f\u5fc5\u987b\u7684\u5e76\u4e14\n\
-\u5fc5\u987b\u663e\u793a\u5728\u6700\u540e\u3002\n\
-\ \n\
-\u9009\u9879\uff1a\n\
--d <\u7b26\u53f7> \u7b49\u4ef7\u4e8e IDL \u6587\u4ef6\u4e2d\u7684\u4ee5\u4e0b\u884c\uff1a\n\
-\ #define <\u7b26\u53f7>\n\
--emitAll \u53d1\u51fa\u6240\u6709\u7c7b\u578b\uff0c\u5305\u62ec\u5728 #included \u6587\u4ef6\u4e2d\u627e\u5230\u7684\u90a3\u4e9b\u7c7b\u578b\u3002\n\
--f<\u7aef> \u5b9a\u4e49\u8981\u53d1\u51fa\u7684\u7ed1\u5b9a\u3002 <\u7aef> \u662f client\u3001\n\
-\ server\u3001all\u3001serverTIE \u548c allTIE \u4e2d\u4e4b\u4e00\u3002 serverTIE \u548c allTIE\n\
-\ \u5c06\u5bfc\u81f4\u53d1\u51fa\u59d4\u6258\u6a21\u578b\u6846\u67b6\u3002\u5982\u679c\u672a\u4f7f\u7528\u6b64\n\
-\ \u6807\u5fd7\uff0c\u5219\u5047\u8bbe\u4e3a -fclient\u3002\n\
--i <\u5305\u62ec\u8def\u5f84> \u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0c\u641c\u7d22\u5f53\u524d\u76ee\u5f55\u4ee5\u83b7\u5f97\u5176\u6240\u5305\u542b\u7684\u6587\u4ef6\u3002\n\
-\ \u6b64\u9009\u9879\u5c06\u6dfb\u52a0\u5176\u4ed6\u76ee\u5f55\u3002\n\
--keep \u5982\u679c\u8981\u751f\u6210\u7684\u6587\u4ef6\u5df2\u5b58\u5728\uff0c\u5219\u4e0d\n\
-\ \u8986\u76d6\u5b83\u3002\u9ed8\u8ba4\u60c5\u51b5\u4e0b\u4f1a\u8986\u76d6\u8be5\u6587\u4ef6\u3002\n\
--noWarn \u6291\u5236\u8b66\u544a\u3002\n\
--oldImplBase \u751f\u6210\u4e0e\u65e7\uff081.4 \u7248\u4e4b\u524d\uff09JDK ORB \u517c\u5bb9\u7684\u6846\u67b6\u3002\n\
--pkgPrefix <\u524d\u7f00> \u5728\u6587\u4ef6\u8303\u56f4\u5185\u9047\u5230\u7c7b\u578b\u6216\u6a21\u5757\u540d\u79f0 \u65f6\uff0c\n\
-\ \u5c06\u4e3a\u9488\u5bf9 \u6240\u751f\u6210\u7684\u6240\u6709\u6587\u4ef6\u7684 Java \u8f6f\u4ef6\u5305\u540d\u79f0\n\
-\ \u9644\u52a0 <\u524d\u7f00>\u3002\n\
--pkgTranslate \u5728\u9047\u5230\u7c7b\u578b\u6216\u6a21\u5757\u540d\u79f0 \u65f6\uff0c\n\
-\ \u5219\u5728\u751f\u6210\u7684 java \u8f6f\u4ef6\u5305\u4e2d\u4ee5 \u5c06\u5176\u66ff\u6362\u3002\u8bf7\u6ce8\u610f\uff0c\n\
-\ \u9996\u5148\u8fdb\u884c pkgPrefix \u66f4\u6539\u3002 \u5fc5\u987b\u4e0e\u5b8c\u6574\u7684\n\
-\ \u7684\u8f6f\u4ef6\u5305\u540d\u79f0\u5b8c\u5168\u4e00\u81f4\u3002\u53e6\u5916\uff0c \u4e0d\u80fd\u4e3a\n\
-\ org\u3001org.omg \u6216 org.omg \u7684\u4efb\u4f55\u5b50\u5305\u3002\n\
--skeletonName \u6839\u636e\u6a21\u5f0f\u547d\u540d\u6846\u67b6\u3002\n\
-\ \u9ed8\u8ba4\u503c\u4e3a\uff1a\n\
-\ \u9002\u7528\u4e8e POA \u57fa\u7c7b\uff08-fserver \u6216 -fall\uff09\u7684 %POA\n\
-\ \u9002\u7528\u4e8e oldImplBase \u57fa\u7c7b\n\
-\ \uff08-oldImplBase \u548c [-fserver \u6216 -fall]\uff09\u7684 \uff05ImplBase\u3002\n\
--td <\u76ee\u5f55> \u5c06 <\u76ee\u5f55> \u800c\u975e\n\
-\ \u5f53\u524d\u76ee\u5f55\u7528\u4f5c\u8f93\u51fa\u76ee\u5f55\u3002\n\
--tieName \u6839\u636e\u6a21\u5f0f\u547d\u540d tie\u3002\u9ed8\u8ba4\u503c\u4e3a\uff1a\n\
-\ \u9002\u7528\u4e8e POA tie\uff08-fserverTie \u6216 -fallTie\uff09\u7684 %POATie\n\
-\ \u9002\u7528\u4e8e oldImplBase tie\n\
-\ \uff08-oldImplBase \u548c [-fserverTie \u6216 -fallTie]\uff09\u7684 \uff05_Tie\u3002\n\
--v, -verbose \u8be6\u7ec6\u6a21\u5f0f\u3002\n\
--version \u663e\u793a\u7248\u672c\u53f7\u5e76\u9000\u51fa\u3002\n
+usage=\u7F16\u8BD1\u5668\u7528\u6CD5:\n\n\ java com.sun.tools.corba.se.idl.toJavaPortable.Compile [\u9009\u9879] \n\n\u5176\u4E2D, \u662F\u5305\u542B IDL \u5B9A\u4E49\u7684\u6587\u4EF6\u7684\u540D\u79F0, \u800C\n[\u9009\u9879] \u662F\u4E0B\u5217\u9009\u9879\u7684\u4EFB\u610F\u7EC4\u5408\u3002\u9009\u9879\n\u662F\u53EF\u9009\u7684, \u5E76\u4E14\u663E\u793A\u987A\u5E8F\u5E76\u4E0D\u56FA\u5B9A; \u662F\u5FC5\u9700\u7684,\n\u5E76\u4E14\u5FC5\u987B\u663E\u793A\u5728\u6700\u540E\u3002\n\ \n\u9009\u9879:\n-d <\u7B26\u53F7> \u8FD9\u7B49\u540C\u4E8E IDL \u6587\u4EF6\u4E2D\u7684\n\ \u4E0B\u9762\u4E00\u884C: #define <\u7B26\u53F7>\n-emitAll \u53D1\u51FA\u6240\u6709\u7C7B\u578B, \u5305\u62EC\u5728 #included \u6587\u4EF6\u4E2D\u627E\u5230\u7684\u7C7B\u578B\u3002\n-f \u5B9A\u4E49\u8981\u53D1\u51FA\u54EA\u4E9B\u7ED1\u5B9A\u3002 \u662F client,\n\ server, all, serverTIE, allTIE \u4E4B\u4E00\u3002serverTIE \u548C allTIE\n\ \u5BFC\u81F4\u53D1\u51FA\u59D4\u6D3E\u6A21\u578B\u9AA8\u67B6\u3002\u5982\u679C\u672A\u4F7F\u7528\n\ \u6B64\u6807\u8BB0, \u5C06\u5047\u5B9A\u4E3A -fclient\u3002\n-i <\u5305\u542B\u8DEF\u5F84> \u9ED8\u8BA4\u60C5\u51B5\u4E0B, \u5C06\u5728\u5F53\u524D\u76EE\u5F55\u4E2D\u626B\u63CF\n\ \u5305\u542B\u7684\u6587\u4EF6\u3002\u6B64\u9009\u9879\u5C06\u6DFB\u52A0\u53E6\u4E00\u4E2A\u76EE\u5F55\u3002\n-keep \u5982\u679C\u8981\u751F\u6210\u7684\u6587\u4EF6\u5DF2\u5B58\u5728, \u8BF7\u4E0D\u8981\n\ \u8986\u76D6\u5B83\u3002\u9ED8\u8BA4\u60C5\u51B5\u4E0B\u4F1A\u8986\u76D6\u5B83\u3002\n-noWarn \u9690\u85CF\u8B66\u544A\u3002\n-oldImplBase \u751F\u6210\u4E0E\u65E7\u7248 (1.4 \u7248\u4E4B\u524D) JDK ORB \u517C\u5BB9\u7684\u9AA8\u67B6\u3002\n-pkgPrefix <\u524D\u7F00> \u5F53\u5728\u6587\u4EF6\u8303\u56F4\u5185\u9047\u5230\u7C7B\u578B\u6216\u6A21\u5757\u540D \u65F6,\n\ \u5728\u4E3A \u751F\u6210\u7684\u6240\u6709\u6587\u4EF6\u7684 Java \u7A0B\u5E8F\u5305\u540D\u524D\n\ \u6DFB\u52A0 <\u524D\u7F00>\u3002\n-pkgTranslate \u5F53\u9047\u5230\u7C7B\u578B\u6216\u6A21\u5757\u540D \u65F6, \u5728\n\ \u751F\u6210\u7684 Java \u7A0B\u5E8F\u5305\u4E2D\u5C06\u5176\u66FF\u6362\u4E3A \u3002\u8BF7\u6CE8\u610F, \n\ \u5C06\u9996\u5148\u8FDB\u884C pkgPrefix \u66F4\u6539\u3002 \u5FC5\u987B\u4E0E\n\ \u5B8C\u6574\u7A0B\u5E8F\u5305\u540D\u5B8C\u5168\u5339\u914D\u3002\u53E6\u5916, \u4E0D\u80FD\u4E3A\n\ org, org.omg \u6216 org.omg \u7684\u4EFB\u4F55\u5B50\u7A0B\u5E8F\u5305\u3002\n-skeletonName \u6839\u636E\u6A21\u5F0F\u547D\u540D\u9AA8\u67B6\u3002\n\ \u9ED8\u8BA4\u503C\u4E3A:\n\ %POA \u8868\u793A POA \u57FA\u7C7B (-fserver \u6216 -fall) \n\ _%ImplBase \u8868\u793A oldImplBase \u57FA\u7C7B\n\ (-oldImplBase \u548C (-fserver \u6216 -fall))\u3002\n-td \u4F7F\u7528 \u8868\u793A\u8F93\u51FA\u76EE\u5F55\u4EE5\u4EE3\u66FF\n\ \u5F53\u524D\u76EE\u5F55\u3002\n-tieName \u6839\u636E\u6A21\u5F0F\u547D\u540D tie\u3002\u9ED8\u8BA4\u503C\u4E3A:\n\ %POATie \u8868\u793A POA tie (-fserverTie \u6216 -fallTie) \n\ %_Tie \u8868\u793A oldImplBase tie\n\ (-oldImplBase \u548C (-fserverTie \u6216 -fallTie))\u3002\n-v, -verbose \u8BE6\u7EC6\u6A21\u5F0F\u3002\n-version \u663E\u793A\u7248\u672C\u53F7\u5E76\u9000\u51FA\u3002\n
diff --git a/hotspot/.hgtags b/hotspot/.hgtags
index ebe412158a5..cc91bc1d1a5 100644
--- a/hotspot/.hgtags
+++ b/hotspot/.hgtags
@@ -156,3 +156,9 @@ a8d643a4db47c7b58e0bcb49c77b5c3610de86a8 hs21-b03
1b3a350709e4325d759bb453ff3fb6a463270488 jdk7-b133
447e6faab4a8755d4860c2366630729dbaec111c jdk7-b134
3c76374706ea8a77e15aec8310e831e5734f8775 hs21-b04
+b898f0fc3cedc972d884d31a751afd75969531cf jdk7-b135
+b898f0fc3cedc972d884d31a751afd75969531cf hs21-b05
+bd586e392d93b7ed7a1636dcc8da2b6a4203a102 jdk7-b136
+bd586e392d93b7ed7a1636dcc8da2b6a4203a102 hs21-b06
+2dbcb4a4d8dace5fe78ceb563b134f1fb296cd8f jdk7-b137
+2dbcb4a4d8dace5fe78ceb563b134f1fb296cd8f hs21-b07
diff --git a/hotspot/agent/src/share/classes/sun/jvm/hotspot/CommandProcessor.java b/hotspot/agent/src/share/classes/sun/jvm/hotspot/CommandProcessor.java
index e4a6b6b9879..eacc59d8226 100644
--- a/hotspot/agent/src/share/classes/sun/jvm/hotspot/CommandProcessor.java
+++ b/hotspot/agent/src/share/classes/sun/jvm/hotspot/CommandProcessor.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2011, 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
diff --git a/hotspot/agent/src/share/classes/sun/jvm/hotspot/HotSpotTypeDataBase.java b/hotspot/agent/src/share/classes/sun/jvm/hotspot/HotSpotTypeDataBase.java
index fcaf4766811..fd35915831f 100644
--- a/hotspot/agent/src/share/classes/sun/jvm/hotspot/HotSpotTypeDataBase.java
+++ b/hotspot/agent/src/share/classes/sun/jvm/hotspot/HotSpotTypeDataBase.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2011, 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
diff --git a/hotspot/agent/src/share/classes/sun/jvm/hotspot/interpreter/BytecodeLoadConstant.java b/hotspot/agent/src/share/classes/sun/jvm/hotspot/interpreter/BytecodeLoadConstant.java
index 67962adefb6..d1f9f70dbec 100644
--- a/hotspot/agent/src/share/classes/sun/jvm/hotspot/interpreter/BytecodeLoadConstant.java
+++ b/hotspot/agent/src/share/classes/sun/jvm/hotspot/interpreter/BytecodeLoadConstant.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2002, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2002, 2011, 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
diff --git a/hotspot/agent/src/share/classes/sun/jvm/hotspot/interpreter/BytecodeWithKlass.java b/hotspot/agent/src/share/classes/sun/jvm/hotspot/interpreter/BytecodeWithKlass.java
index 3a62c2dad0c..dab8fc7cff4 100644
--- a/hotspot/agent/src/share/classes/sun/jvm/hotspot/interpreter/BytecodeWithKlass.java
+++ b/hotspot/agent/src/share/classes/sun/jvm/hotspot/interpreter/BytecodeWithKlass.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2002, 2003, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2002, 2011, 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
diff --git a/hotspot/agent/src/share/classes/sun/jvm/hotspot/jdi/ClassObjectReferenceImpl.java b/hotspot/agent/src/share/classes/sun/jvm/hotspot/jdi/ClassObjectReferenceImpl.java
index 469765d73be..41d926aec77 100644
--- a/hotspot/agent/src/share/classes/sun/jvm/hotspot/jdi/ClassObjectReferenceImpl.java
+++ b/hotspot/agent/src/share/classes/sun/jvm/hotspot/jdi/ClassObjectReferenceImpl.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2002, 2003, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2002, 2011, 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
@@ -27,7 +27,7 @@ package sun.jvm.hotspot.jdi;
import com.sun.jdi.*;
import sun.jvm.hotspot.oops.Instance;
import sun.jvm.hotspot.oops.Klass;
-import sun.jvm.hotspot.oops.OopUtilities;
+import sun.jvm.hotspot.oops.java_lang_Class;
public class ClassObjectReferenceImpl extends ObjectReferenceImpl
implements ClassObjectReference {
@@ -39,7 +39,7 @@ public class ClassObjectReferenceImpl extends ObjectReferenceImpl
public ReferenceType reflectedType() {
if (reflectedType == null) {
- Klass k = OopUtilities.classOopToKlass(ref());
+ Klass k = java_lang_Class.asKlass(ref());
reflectedType = vm.referenceType(k);
}
return reflectedType;
diff --git a/hotspot/agent/src/share/classes/sun/jvm/hotspot/memory/DictionaryEntry.java b/hotspot/agent/src/share/classes/sun/jvm/hotspot/memory/DictionaryEntry.java
index a42479d5385..14edf8f74ec 100644
--- a/hotspot/agent/src/share/classes/sun/jvm/hotspot/memory/DictionaryEntry.java
+++ b/hotspot/agent/src/share/classes/sun/jvm/hotspot/memory/DictionaryEntry.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2003, 2005, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2011, 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
diff --git a/hotspot/agent/src/share/classes/sun/jvm/hotspot/memory/LoaderConstraintEntry.java b/hotspot/agent/src/share/classes/sun/jvm/hotspot/memory/LoaderConstraintEntry.java
index a6b2a743ec2..248308baa7f 100644
--- a/hotspot/agent/src/share/classes/sun/jvm/hotspot/memory/LoaderConstraintEntry.java
+++ b/hotspot/agent/src/share/classes/sun/jvm/hotspot/memory/LoaderConstraintEntry.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2003, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2011, 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
diff --git a/hotspot/agent/src/share/classes/sun/jvm/hotspot/memory/PlaceholderEntry.java b/hotspot/agent/src/share/classes/sun/jvm/hotspot/memory/PlaceholderEntry.java
index 5574910a320..be9ee583868 100644
--- a/hotspot/agent/src/share/classes/sun/jvm/hotspot/memory/PlaceholderEntry.java
+++ b/hotspot/agent/src/share/classes/sun/jvm/hotspot/memory/PlaceholderEntry.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2003, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2011, 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
diff --git a/hotspot/agent/src/share/classes/sun/jvm/hotspot/memory/StringTable.java b/hotspot/agent/src/share/classes/sun/jvm/hotspot/memory/StringTable.java
index bfbeb26cc1a..8bf42f0415e 100644
--- a/hotspot/agent/src/share/classes/sun/jvm/hotspot/memory/StringTable.java
+++ b/hotspot/agent/src/share/classes/sun/jvm/hotspot/memory/StringTable.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2005, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2011, 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
diff --git a/hotspot/agent/src/share/classes/sun/jvm/hotspot/memory/SymbolTable.java b/hotspot/agent/src/share/classes/sun/jvm/hotspot/memory/SymbolTable.java
index cfee9fbe004..1c0a676810a 100644
--- a/hotspot/agent/src/share/classes/sun/jvm/hotspot/memory/SymbolTable.java
+++ b/hotspot/agent/src/share/classes/sun/jvm/hotspot/memory/SymbolTable.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2001, 2005, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 2011, 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
diff --git a/hotspot/agent/src/share/classes/sun/jvm/hotspot/oops/ConstantPool.java b/hotspot/agent/src/share/classes/sun/jvm/hotspot/oops/ConstantPool.java
index f1babff8cb6..f297e3281be 100644
--- a/hotspot/agent/src/share/classes/sun/jvm/hotspot/oops/ConstantPool.java
+++ b/hotspot/agent/src/share/classes/sun/jvm/hotspot/oops/ConstantPool.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2011, 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
@@ -331,8 +331,6 @@ public class ConstantPool extends Oop implements ClassConstants {
if (Assert.ASSERTS_ENABLED) {
Assert.that(getTagAt(i).isInvokeDynamic(), "Corrupted constant pool");
}
- if (getTagAt(i).value() == JVM_CONSTANT_InvokeDynamicTrans)
- return null;
int bsmSpec = extractLowShortFromInt(this.getIntAt(i));
TypeArray operands = getOperands();
if (operands == null) return null; // safety first
@@ -368,7 +366,6 @@ public class ConstantPool extends Oop implements ClassConstants {
case JVM_CONSTANT_MethodHandle: return "JVM_CONSTANT_MethodHandle";
case JVM_CONSTANT_MethodType: return "JVM_CONSTANT_MethodType";
case JVM_CONSTANT_InvokeDynamic: return "JVM_CONSTANT_InvokeDynamic";
- case JVM_CONSTANT_InvokeDynamicTrans: return "JVM_CONSTANT_InvokeDynamic/transitional";
case JVM_CONSTANT_Invalid: return "JVM_CONSTANT_Invalid";
case JVM_CONSTANT_UnresolvedClass: return "JVM_CONSTANT_UnresolvedClass";
case JVM_CONSTANT_UnresolvedClassInError: return "JVM_CONSTANT_UnresolvedClassInError";
@@ -428,7 +425,6 @@ public class ConstantPool extends Oop implements ClassConstants {
case JVM_CONSTANT_MethodHandle:
case JVM_CONSTANT_MethodType:
case JVM_CONSTANT_InvokeDynamic:
- case JVM_CONSTANT_InvokeDynamicTrans:
visitor.doInt(new IntField(new NamedFieldIdentifier(nameForTag(ctag)), indexOffset(index), true), true);
break;
}
@@ -592,7 +588,6 @@ public class ConstantPool extends Oop implements ClassConstants {
break;
}
- case JVM_CONSTANT_InvokeDynamicTrans:
case JVM_CONSTANT_InvokeDynamic: {
dos.writeByte(cpConstType);
int value = getIntAt(ci);
diff --git a/hotspot/agent/src/share/classes/sun/jvm/hotspot/oops/GenerateOopMap.java b/hotspot/agent/src/share/classes/sun/jvm/hotspot/oops/GenerateOopMap.java
index 35a9d194037..30f3497e53d 100644
--- a/hotspot/agent/src/share/classes/sun/jvm/hotspot/oops/GenerateOopMap.java
+++ b/hotspot/agent/src/share/classes/sun/jvm/hotspot/oops/GenerateOopMap.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2001, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 2011, 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
diff --git a/hotspot/agent/src/share/classes/sun/jvm/hotspot/oops/Instance.java b/hotspot/agent/src/share/classes/sun/jvm/hotspot/oops/Instance.java
index 3555285fefc..09c27f0fee0 100644
--- a/hotspot/agent/src/share/classes/sun/jvm/hotspot/oops/Instance.java
+++ b/hotspot/agent/src/share/classes/sun/jvm/hotspot/oops/Instance.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2000, 2008, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2011, 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
@@ -64,7 +64,7 @@ public class Instance extends Oop {
public void iterateFields(OopVisitor visitor, boolean doVMFields) {
super.iterateFields(visitor, doVMFields);
- ((InstanceKlass) getKlass()).iterateNonStaticFields(visitor);
+ ((InstanceKlass) getKlass()).iterateNonStaticFields(visitor, this);
}
public void printValueOn(PrintStream tty) {
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 c2756bb9e79..b1d6741ce63 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
@@ -241,6 +241,10 @@ public class InstanceKlass extends Klass {
// Byteside of the header
private static long headerSize;
+ public long getObjectSize(Oop object) {
+ return getSizeHelper() * VM.getVM().getAddressSize();
+ }
+
public static long getHeaderSize() { return headerSize; }
// Accessors for declared fields
@@ -459,7 +463,22 @@ public class InstanceKlass extends Klass {
visitor.doCInt(vtableLen, true);
visitor.doCInt(itableLen, true);
}
+ }
+ /*
+ * Visit the static fields of this InstanceKlass with the obj of
+ * the visitor set to the oop holding the fields, which is
+ * currently the java mirror.
+ */
+ public void iterateStaticFields(OopVisitor visitor) {
+ visitor.setObj(getJavaMirror());
+ visitor.prologue();
+ iterateStaticFieldsInternal(visitor);
+ visitor.epilogue();
+
+ }
+
+ void iterateStaticFieldsInternal(OopVisitor visitor) {
TypeArray fields = getFields();
int length = (int) fields.getLength();
for (int index = 0; index < length; index += NEXT_OFFSET) {
@@ -477,9 +496,9 @@ public class InstanceKlass extends Klass {
return getSuper();
}
- public void iterateNonStaticFields(OopVisitor visitor) {
+ public void iterateNonStaticFields(OopVisitor visitor, Oop obj) {
if (getSuper() != null) {
- ((InstanceKlass) getSuper()).iterateNonStaticFields(visitor);
+ ((InstanceKlass) getSuper()).iterateNonStaticFields(visitor, obj);
}
TypeArray fields = getFields();
diff --git a/hotspot/agent/src/share/classes/sun/jvm/hotspot/oops/InstanceMirrorKlass.java b/hotspot/agent/src/share/classes/sun/jvm/hotspot/oops/InstanceMirrorKlass.java
new file mode 100644
index 00000000000..53191c885f5
--- /dev/null
+++ b/hotspot/agent/src/share/classes/sun/jvm/hotspot/oops/InstanceMirrorKlass.java
@@ -0,0 +1,67 @@
+/*
+ * Copyright (c) 2011, 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.
+ *
+ */
+
+package sun.jvm.hotspot.oops;
+
+import java.io.*;
+import java.util.*;
+import sun.jvm.hotspot.debugger.*;
+import sun.jvm.hotspot.memory.*;
+import sun.jvm.hotspot.runtime.*;
+import sun.jvm.hotspot.types.*;
+import sun.jvm.hotspot.utilities.*;
+
+// An InstanceKlass is the VM level representation of a Java class.
+
+public class InstanceMirrorKlass extends InstanceKlass {
+ static {
+ VM.registerVMInitializedObserver(new Observer() {
+ public void update(Observable o, Object data) {
+ initialize(VM.getVM().getTypeDataBase());
+ }
+ });
+ }
+
+ private static synchronized void initialize(TypeDataBase db) throws WrongTypeException {
+ // Just make sure it's there for now
+ Type type = db.lookupType("instanceMirrorKlass");
+ }
+
+ InstanceMirrorKlass(OopHandle handle, ObjectHeap heap) {
+ super(handle, heap);
+ }
+
+ public long getObjectSize(Oop o) {
+ return java_lang_Class.getOopSize(o) * VM.getVM().getAddressSize();
+ }
+
+ public void iterateNonStaticFields(OopVisitor visitor, Oop obj) {
+ super.iterateNonStaticFields(visitor, obj);
+ // Fetch the real klass from the mirror object
+ Klass klass = java_lang_Class.asKlass(obj);
+ if (klass instanceof InstanceKlass) {
+ ((InstanceKlass)klass).iterateStaticFields(visitor);
+ }
+ }
+}
diff --git a/hotspot/agent/src/share/classes/sun/jvm/hotspot/oops/Klass.java b/hotspot/agent/src/share/classes/sun/jvm/hotspot/oops/Klass.java
index ccb5e5b46b0..506d4d3ae0c 100644
--- a/hotspot/agent/src/share/classes/sun/jvm/hotspot/oops/Klass.java
+++ b/hotspot/agent/src/share/classes/sun/jvm/hotspot/oops/Klass.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2000, 2008, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2011, 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
diff --git a/hotspot/agent/src/share/classes/sun/jvm/hotspot/oops/Method.java b/hotspot/agent/src/share/classes/sun/jvm/hotspot/oops/Method.java
index ed551bc74e4..3a4061937e1 100644
--- a/hotspot/agent/src/share/classes/sun/jvm/hotspot/oops/Method.java
+++ b/hotspot/agent/src/share/classes/sun/jvm/hotspot/oops/Method.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2000, 2004, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2011, 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
diff --git a/hotspot/agent/src/share/classes/sun/jvm/hotspot/oops/ObjectHeap.java b/hotspot/agent/src/share/classes/sun/jvm/hotspot/oops/ObjectHeap.java
index 08aa0143c8e..749c49d1b91 100644
--- a/hotspot/agent/src/share/classes/sun/jvm/hotspot/oops/ObjectHeap.java
+++ b/hotspot/agent/src/share/classes/sun/jvm/hotspot/oops/ObjectHeap.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2000, 2008, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2011, 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
@@ -362,7 +362,16 @@ public class ObjectHeap {
if (klass.equals(compiledICHolderKlassHandle)) return new CompiledICHolder(handle, this);
if (klass.equals(methodDataKlassHandle)) return new MethodData(handle, this);
}
- if (klass.equals(instanceKlassKlassHandle)) return new InstanceKlass(handle, this);
+ if (klass.equals(instanceKlassKlassHandle)) {
+ InstanceKlass ik = new InstanceKlass(handle, this);
+ if (ik.getName().asString().equals("java/lang/Class")) {
+ // We would normally do this using the vtable style
+ // lookup but since it's not used for these currently
+ // it's simpler to just check for the name.
+ return new InstanceMirrorKlass(handle, this);
+ }
+ return ik;
+ }
if (klass.equals(objArrayKlassKlassHandle)) return new ObjArrayKlass(handle, this);
if (klass.equals(typeArrayKlassKlassHandle)) return new TypeArrayKlass(handle, this);
diff --git a/hotspot/agent/src/share/classes/sun/jvm/hotspot/oops/Oop.java b/hotspot/agent/src/share/classes/sun/jvm/hotspot/oops/Oop.java
index 0e7e6fcce01..283e32d6619 100644
--- a/hotspot/agent/src/share/classes/sun/jvm/hotspot/oops/Oop.java
+++ b/hotspot/agent/src/share/classes/sun/jvm/hotspot/oops/Oop.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2011, 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
@@ -103,12 +103,8 @@ public class Oop {
// Returns the byte size of this object
public long getObjectSize() {
Klass k = getKlass();
- if (k instanceof InstanceKlass) {
- return ((InstanceKlass)k).getSizeHelper()
- * VM.getVM().getAddressSize();
- }
- // If it is not an instance, this method should be replaced.
- return getHeaderSize();
+ // All other types should be overriding getObjectSize directly
+ return ((InstanceKlass)k).getObjectSize(this);
}
// Type test operations
diff --git a/hotspot/agent/src/share/classes/sun/jvm/hotspot/oops/OopUtilities.java b/hotspot/agent/src/share/classes/sun/jvm/hotspot/oops/OopUtilities.java
index a51b9e9fc47..e6887b12b1a 100644
--- a/hotspot/agent/src/share/classes/sun/jvm/hotspot/oops/OopUtilities.java
+++ b/hotspot/agent/src/share/classes/sun/jvm/hotspot/oops/OopUtilities.java
@@ -74,9 +74,6 @@ public class OopUtilities implements /* imports */ JVMTIThreadState {
private static int THREAD_STATUS_TERMINATED;
*/
- // java.lang.Class fields
- private static OopField hcKlassField;
-
// java.util.concurrent.locks.AbstractOwnableSynchronizer fields
private static OopField absOwnSyncOwnerThreadField;
@@ -268,27 +265,6 @@ public class OopUtilities implements /* imports */ JVMTIThreadState {
return null;
}
- // initialize fields for java.lang.Class
- private static void initClassFields() {
- if (hcKlassField == null) {
- // hc_klass is a HotSpot magic field and hence we can't
- // find it from InstanceKlass for java.lang.Class.
- TypeDataBase db = VM.getVM().getTypeDataBase();
- int hcKlassOffset = (int) db.lookupType("java_lang_Class").getCIntegerField("klass_offset").getValue();
- if (VM.getVM().isCompressedOopsEnabled()) {
- hcKlassField = new NarrowOopField(new NamedFieldIdentifier("hc_klass"), hcKlassOffset, true);
- } else {
- hcKlassField = new OopField(new NamedFieldIdentifier("hc_klass"), hcKlassOffset, true);
- }
- }
- }
-
- /** get klassOop field at offset hc_klass_offset from a java.lang.Class object */
- public static Klass classOopToKlass(Oop aClass) {
- initClassFields();
- return (Klass) hcKlassField.getValue(aClass);
- }
-
// initialize fields for j.u.c.l AbstractOwnableSynchornizer class
private static void initAbsOwnSyncFields() {
if (absOwnSyncOwnerThreadField == null) {
diff --git a/hotspot/agent/src/share/classes/sun/jvm/hotspot/oops/Symbol.java b/hotspot/agent/src/share/classes/sun/jvm/hotspot/oops/Symbol.java
index 964e3a8de3f..ed4ea43d8a0 100644
--- a/hotspot/agent/src/share/classes/sun/jvm/hotspot/oops/Symbol.java
+++ b/hotspot/agent/src/share/classes/sun/jvm/hotspot/oops/Symbol.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2000, 2004, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2011, 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
diff --git a/hotspot/agent/src/share/classes/sun/jvm/hotspot/oops/java_lang_Class.java b/hotspot/agent/src/share/classes/sun/jvm/hotspot/oops/java_lang_Class.java
new file mode 100644
index 00000000000..b91eab3655a
--- /dev/null
+++ b/hotspot/agent/src/share/classes/sun/jvm/hotspot/oops/java_lang_Class.java
@@ -0,0 +1,77 @@
+/*
+ * Copyright (c) 2011, 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.
+ *
+ */
+
+package sun.jvm.hotspot.oops;
+
+import java.util.*;
+
+import sun.jvm.hotspot.debugger.*;
+import sun.jvm.hotspot.memory.*;
+import sun.jvm.hotspot.runtime.*;
+import sun.jvm.hotspot.types.Type;
+import sun.jvm.hotspot.types.TypeDataBase;
+import sun.jvm.hotspot.utilities.*;
+import sun.jvm.hotspot.jdi.JVMTIThreadState;
+
+/** A utility class encapsulating useful oop operations */
+
+// initialize fields for java.lang.Class
+public class java_lang_Class {
+
+ // java.lang.Class fields
+ static OopField klassField;
+ static IntField oopSizeField;
+
+ static {
+ VM.registerVMInitializedObserver(new Observer() {
+ public void update(Observable o, Object data) {
+ initialize(VM.getVM().getTypeDataBase());
+ }
+ });
+ }
+
+ private static synchronized void initialize(TypeDataBase db) {
+ // klass and oop_size are HotSpot magic fields and hence we can't
+ // find them from InstanceKlass for java.lang.Class.
+ Type jlc = db.lookupType("java_lang_Class");
+ int klassOffset = (int) jlc.getCIntegerField("klass_offset").getValue();
+ if (VM.getVM().isCompressedOopsEnabled()) {
+ klassField = new NarrowOopField(new NamedFieldIdentifier("klass"), klassOffset, true);
+ } else {
+ klassField = new OopField(new NamedFieldIdentifier("klass"), klassOffset, true);
+ }
+ int oopSizeOffset = (int) jlc.getCIntegerField("oop_size_offset").getValue();
+ oopSizeField = new IntField(new NamedFieldIdentifier("oop_size"), oopSizeOffset, true);
+ }
+
+ /** get klassOop field at offset hc_klass_offset from a java.lang.Class object */
+ public static Klass asKlass(Oop aClass) {
+ return (Klass) java_lang_Class.klassField.getValue(aClass);
+ }
+
+ /** get oop_size field at offset oop_size_offset from a java.lang.Class object */
+ public static long getOopSize(Oop aClass) {
+ return java_lang_Class.oopSizeField.getValue(aClass);
+ }
+}
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 3a008c0b059..722496e3c27 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
@@ -42,7 +42,7 @@ public interface ClassConstants
public static final int JVM_CONSTANT_NameAndType = 12;
public static final int JVM_CONSTANT_MethodHandle = 15;
public static final int JVM_CONSTANT_MethodType = 16;
- public static final int JVM_CONSTANT_InvokeDynamicTrans = 17; // only occurs in old class files
+ // static final int JVM_CONSTANT_(unused) = 17;
public static final int JVM_CONSTANT_InvokeDynamic = 18;
// JVM_CONSTANT_MethodHandle subtypes
diff --git a/hotspot/agent/src/share/classes/sun/jvm/hotspot/runtime/VM.java b/hotspot/agent/src/share/classes/sun/jvm/hotspot/runtime/VM.java
index 23b4ab9da5b..4d333baa9a6 100644
--- a/hotspot/agent/src/share/classes/sun/jvm/hotspot/runtime/VM.java
+++ b/hotspot/agent/src/share/classes/sun/jvm/hotspot/runtime/VM.java
@@ -839,20 +839,18 @@ public class VM {
}
private void readSystemProperties() {
- final InstanceKlass systemKls = getSystemDictionary().getSystemKlass();
- systemKls.iterate(new DefaultOopVisitor() {
- ObjectReader objReader = new ObjectReader();
- public void doOop(sun.jvm.hotspot.oops.OopField field, boolean isVMField) {
- if (field.getID().getName().equals("props")) {
- try {
- sysProps = (Properties) objReader.readObject(field.getValue(systemKls.getJavaMirror()));
- } catch (Exception e) {
- if (Assert.ASSERTS_ENABLED) {
- e.printStackTrace();
- }
- }
- }
- }
- }, false);
+ final InstanceKlass systemKls = getSystemDictionary().getSystemKlass();
+ systemKls.iterateStaticFields(new DefaultOopVisitor() {
+ ObjectReader objReader = new ObjectReader();
+ public void doOop(sun.jvm.hotspot.oops.OopField field, boolean isVMField) {
+ if (field.getID().getName().equals("props")) {
+ try {
+ sysProps = (Properties) objReader.readObject(field.getValue(getObj()));
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ }
+ }
+ });
}
}
diff --git a/hotspot/agent/src/share/classes/sun/jvm/hotspot/tools/FinalizerInfo.java b/hotspot/agent/src/share/classes/sun/jvm/hotspot/tools/FinalizerInfo.java
index ab81e8cfc1e..79e6784a63e 100644
--- a/hotspot/agent/src/share/classes/sun/jvm/hotspot/tools/FinalizerInfo.java
+++ b/hotspot/agent/src/share/classes/sun/jvm/hotspot/tools/FinalizerInfo.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2004, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2004, 2011, 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
@@ -64,16 +64,16 @@ public class FinalizerInfo extends Tool {
*/
InstanceKlass ik =
SystemDictionaryHelper.findInstanceKlass("java.lang.ref.Finalizer");
- final OopField queueField[] = new OopField[1];
- ik.iterateFields(new DefaultOopVisitor() {
+ final Oop[] queueref = new Oop[1];
+ ik.iterateStaticFields(new DefaultOopVisitor() {
public void doOop(OopField field, boolean isVMField) {
- String name = field.getID().getName();
- if (name.equals("queue")) {
- queueField[0] = field;
- }
+ String name = field.getID().getName();
+ if (name.equals("queue")) {
+ queueref[0] = field.getValue(getObj());
+ }
}
- }, false);
- Oop queue = queueField[0].getValue(ik);
+ });
+ Oop queue = queueref[0];
InstanceKlass k = (InstanceKlass) queue.getKlass();
diff --git a/hotspot/agent/src/share/classes/sun/jvm/hotspot/tools/jcore/ClassWriter.java b/hotspot/agent/src/share/classes/sun/jvm/hotspot/tools/jcore/ClassWriter.java
index 3896c67d77c..91739eff523 100644
--- a/hotspot/agent/src/share/classes/sun/jvm/hotspot/tools/jcore/ClassWriter.java
+++ b/hotspot/agent/src/share/classes/sun/jvm/hotspot/tools/jcore/ClassWriter.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2002, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2002, 2011, 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
@@ -321,7 +321,6 @@ public class ClassWriter implements /* imports */ ClassConstants
break;
}
- case JVM_CONSTANT_InvokeDynamicTrans:
case JVM_CONSTANT_InvokeDynamic: {
dos.writeByte(cpConstType);
int value = cpool.getIntAt(ci);
diff --git a/hotspot/agent/src/share/classes/sun/jvm/hotspot/types/Field.java b/hotspot/agent/src/share/classes/sun/jvm/hotspot/types/Field.java
index 2ef0e48c958..c6794b7f143 100644
--- a/hotspot/agent/src/share/classes/sun/jvm/hotspot/types/Field.java
+++ b/hotspot/agent/src/share/classes/sun/jvm/hotspot/types/Field.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2000, 2008, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2011, 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
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 147e3bd5590..8e3cbb7f8dd 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
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2002, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2002, 2011, 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
@@ -598,7 +598,6 @@ public class HTMLGenerator implements /* imports */ ClassConstants {
buf.cell(Integer.toString(cpool.getIntAt(index)));
break;
- case JVM_CONSTANT_InvokeDynamicTrans:
case JVM_CONSTANT_InvokeDynamic:
buf.cell("JVM_CONSTANT_InvokeDynamic");
buf.cell(genLowHighShort(cpool.getIntAt(index)) +
diff --git a/hotspot/agent/src/share/classes/sun/jvm/hotspot/utilities/ConstantTag.java b/hotspot/agent/src/share/classes/sun/jvm/hotspot/utilities/ConstantTag.java
index 1ee547be39c..60a2172a598 100644
--- a/hotspot/agent/src/share/classes/sun/jvm/hotspot/utilities/ConstantTag.java
+++ b/hotspot/agent/src/share/classes/sun/jvm/hotspot/utilities/ConstantTag.java
@@ -40,7 +40,7 @@ public class ConstantTag {
private static int JVM_CONSTANT_NameAndType = 12;
private static int JVM_CONSTANT_MethodHandle = 15; // JSR 292
private static int JVM_CONSTANT_MethodType = 16; // JSR 292
- private static int JVM_CONSTANT_InvokeDynamicTrans = 17; // JSR 292, only occurs in old class files
+ // static int JVM_CONSTANT_(unused) = 17; // JSR 292 early drafts only
private static int JVM_CONSTANT_InvokeDynamic = 18; // JSR 292
private static int JVM_CONSTANT_Invalid = 0; // For bad value initialization
private static int JVM_CONSTANT_UnresolvedClass = 100; // Temporary tag until actual use
@@ -83,7 +83,6 @@ public class ConstantTag {
public boolean isMethodHandle() { return tag == JVM_CONSTANT_MethodHandle; }
public boolean isMethodType() { return tag == JVM_CONSTANT_MethodType; }
public boolean isInvokeDynamic() { return tag == JVM_CONSTANT_InvokeDynamic; }
- public boolean isInvokeDynamicTrans() { return tag == JVM_CONSTANT_InvokeDynamicTrans; }
public boolean isInvalid() { return tag == JVM_CONSTANT_Invalid; }
diff --git a/hotspot/agent/src/share/classes/sun/jvm/hotspot/utilities/Hashtable.java b/hotspot/agent/src/share/classes/sun/jvm/hotspot/utilities/Hashtable.java
index 65437b7082f..3c2e0f965c2 100644
--- a/hotspot/agent/src/share/classes/sun/jvm/hotspot/utilities/Hashtable.java
+++ b/hotspot/agent/src/share/classes/sun/jvm/hotspot/utilities/Hashtable.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2003, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2011, 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
diff --git a/hotspot/agent/src/share/classes/sun/jvm/hotspot/utilities/HashtableEntry.java b/hotspot/agent/src/share/classes/sun/jvm/hotspot/utilities/HashtableEntry.java
index 1ae9dfaf48a..73932a43033 100644
--- a/hotspot/agent/src/share/classes/sun/jvm/hotspot/utilities/HashtableEntry.java
+++ b/hotspot/agent/src/share/classes/sun/jvm/hotspot/utilities/HashtableEntry.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2003, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2011, 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
diff --git a/hotspot/agent/src/share/classes/sun/jvm/hotspot/utilities/HeapGXLWriter.java b/hotspot/agent/src/share/classes/sun/jvm/hotspot/utilities/HeapGXLWriter.java
index 982a21192e2..5f5d17d3901 100644
--- a/hotspot/agent/src/share/classes/sun/jvm/hotspot/utilities/HeapGXLWriter.java
+++ b/hotspot/agent/src/share/classes/sun/jvm/hotspot/utilities/HeapGXLWriter.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2004, 2007, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2004, 2011, 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
@@ -164,7 +164,7 @@ public class HeapGXLWriter extends AbstractHeapGraphWriter {
protected void writeClass(Instance instance) throws IOException {
writeObjectHeader(instance);
- Klass reflectedType = OopUtilities.classOopToKlass(instance);
+ Klass reflectedType = java_lang_Class.asKlass(instance);
boolean isInstanceKlass = (reflectedType instanceof InstanceKlass);
// reflectedType is null for primitive types (int.class etc).
if (reflectedType != null) {
diff --git a/hotspot/agent/src/share/classes/sun/jvm/hotspot/utilities/HeapHprofBinWriter.java b/hotspot/agent/src/share/classes/sun/jvm/hotspot/utilities/HeapHprofBinWriter.java
index f1e9c5dd95f..68e5d1ba36f 100644
--- a/hotspot/agent/src/share/classes/sun/jvm/hotspot/utilities/HeapHprofBinWriter.java
+++ b/hotspot/agent/src/share/classes/sun/jvm/hotspot/utilities/HeapHprofBinWriter.java
@@ -455,7 +455,7 @@ public class HeapHprofBinWriter extends AbstractHeapGraphWriter {
}
protected void writeClass(Instance instance) throws IOException {
- Klass reflectedKlass = OopUtilities.classOopToKlass(instance);
+ Klass reflectedKlass = java_lang_Class.asKlass(instance);
// dump instance record only for primitive type Class objects.
// all other Class objects are covered by writeClassDumpRecords.
if (reflectedKlass == null) {
diff --git a/hotspot/agent/src/share/classes/sun/jvm/hotspot/utilities/ReversePtrsAnalysis.java b/hotspot/agent/src/share/classes/sun/jvm/hotspot/utilities/ReversePtrsAnalysis.java
index 3c34eaf3fcd..26eca405dba 100644
--- a/hotspot/agent/src/share/classes/sun/jvm/hotspot/utilities/ReversePtrsAnalysis.java
+++ b/hotspot/agent/src/share/classes/sun/jvm/hotspot/utilities/ReversePtrsAnalysis.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2002, 2008, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2002, 2011, 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
@@ -117,10 +117,10 @@ public class ReversePtrsAnalysis {
public boolean doObj(Oop obj) {
if (obj instanceof InstanceKlass) {
final InstanceKlass ik = (InstanceKlass) obj;
- ik.iterateFields(
+ ik.iterateStaticFields(
new DefaultOopVisitor() {
public void doOop(OopField field, boolean isVMField) {
- Oop next = field.getValue(ik);
+ Oop next = field.getValue(getObj());
LivenessPathElement lp = new LivenessPathElement(null,
new NamedFieldIdentifier("Static field \"" +
field.getID().getName() +
@@ -142,8 +142,7 @@ public class ReversePtrsAnalysis {
System.err.println();
}
}
- },
- false);
+ });
}
return false;
}
diff --git a/hotspot/agent/src/share/classes/sun/jvm/hotspot/utilities/soql/JSJavaFactoryImpl.java b/hotspot/agent/src/share/classes/sun/jvm/hotspot/utilities/soql/JSJavaFactoryImpl.java
index 80614f09a3f..d91379136bd 100644
--- a/hotspot/agent/src/share/classes/sun/jvm/hotspot/utilities/soql/JSJavaFactoryImpl.java
+++ b/hotspot/agent/src/share/classes/sun/jvm/hotspot/utilities/soql/JSJavaFactoryImpl.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2004, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2004, 2011, 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
@@ -158,7 +158,7 @@ public class JSJavaFactoryImpl implements JSJavaFactory {
} else if (className.equals(javaLangThread())) {
res = new JSJavaThread(instance, this);
} else if (className.equals(javaLangClass())) {
- Klass reflectedType = OopUtilities.classOopToKlass(instance);
+ Klass reflectedType = java_lang_Class.asKlass(instance);
if (reflectedType != null) {
JSJavaKlass jk = newJSJavaKlass(reflectedType);
// we don't support mirrors of VM internal Klasses
diff --git a/hotspot/make/hotspot_version b/hotspot/make/hotspot_version
index 16c201cc470..bd9d89e0bef 100644
--- a/hotspot/make/hotspot_version
+++ b/hotspot/make/hotspot_version
@@ -35,7 +35,7 @@ HOTSPOT_VM_COPYRIGHT=Copyright 2011
HS_MAJOR_VER=21
HS_MINOR_VER=0
-HS_BUILD_NUMBER=05
+HS_BUILD_NUMBER=08
JDK_MAJOR_VER=1
JDK_MINOR_VER=7
diff --git a/hotspot/make/linux/Makefile b/hotspot/make/linux/Makefile
index ec1e60b7c2d..49ac97c199e 100644
--- a/hotspot/make/linux/Makefile
+++ b/hotspot/make/linux/Makefile
@@ -1,5 +1,5 @@
#
-# Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 1999, 2011, 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
diff --git a/hotspot/make/linux/makefiles/adlc.make b/hotspot/make/linux/makefiles/adlc.make
index 84ff8f88c58..0c15c1c6589 100644
--- a/hotspot/make/linux/makefiles/adlc.make
+++ b/hotspot/make/linux/makefiles/adlc.make
@@ -102,7 +102,7 @@ all: $(EXEC)
$(EXEC) : $(OBJECTS)
@echo Making adlc
- $(QUIETLY) $(LINK_NOPROF.CC) -o $(EXEC) $(OBJECTS)
+ $(QUIETLY) $(HOST.LINK_NOPROF.CC) -o $(EXEC) $(OBJECTS)
# Random dependencies:
$(OBJECTS): opcodes.hpp classes.hpp adlc.hpp adlcVMDeps.hpp adlparse.hpp archDesc.hpp arena.hpp dict2.hpp filebuff.hpp forms.hpp formsopt.hpp formssel.hpp
@@ -204,14 +204,14 @@ PROCESS_AD_FILES = awk '{ \
$(OUTDIR)/%.o: %.cpp
@echo Compiling $<
$(QUIETLY) $(REMOVE_TARGET)
- $(QUIETLY) $(COMPILE.CC) -o $@ $< $(COMPILE_DONE)
+ $(QUIETLY) $(HOST.COMPILE.CC) -o $@ $< $(COMPILE_DONE)
# Some object files are given a prefix, to disambiguate
# them from objects of the same name built for the VM.
$(OUTDIR)/adlc-%.o: %.cpp
@echo Compiling $<
$(QUIETLY) $(REMOVE_TARGET)
- $(QUIETLY) $(COMPILE.CC) -o $@ $< $(COMPILE_DONE)
+ $(QUIETLY) $(HOST.COMPILE.CC) -o $@ $< $(COMPILE_DONE)
# #########################################################################
diff --git a/hotspot/make/linux/makefiles/arm.make b/hotspot/make/linux/makefiles/arm.make
index 3c5dc2ca151..e210303dc98 100644
--- a/hotspot/make/linux/makefiles/arm.make
+++ b/hotspot/make/linux/makefiles/arm.make
@@ -1,5 +1,5 @@
#
-# Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2008, 2011, Oracle and/or its affiliates. All rights reserved.
# ORACLE PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
#
diff --git a/hotspot/make/linux/makefiles/gcc.make b/hotspot/make/linux/makefiles/gcc.make
index 04c407bce9e..d7537331e4c 100644
--- a/hotspot/make/linux/makefiles/gcc.make
+++ b/hotspot/make/linux/makefiles/gcc.make
@@ -1,5 +1,5 @@
#
-# Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 1999, 2011, 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
@@ -30,9 +30,13 @@
ifdef CROSS_COMPILE_ARCH
CPP = $(ALT_COMPILER_PATH)/g++
CC = $(ALT_COMPILER_PATH)/gcc
+HOSTCPP = g++
+HOSTCC = gcc
else
CPP = g++
CC = gcc
+HOSTCPP = $(CPP)
+HOSTCC = $(CC)
endif
AS = $(CC) -c
diff --git a/hotspot/make/linux/makefiles/mapfile-vers-debug b/hotspot/make/linux/makefiles/mapfile-vers-debug
index 7022aba2e39..332c8af9329 100644
--- a/hotspot/make/linux/makefiles/mapfile-vers-debug
+++ b/hotspot/make/linux/makefiles/mapfile-vers-debug
@@ -3,7 +3,7 @@
#
#
-# Copyright (c) 2002, 2010, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2002, 2011, 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
diff --git a/hotspot/make/linux/makefiles/mapfile-vers-product b/hotspot/make/linux/makefiles/mapfile-vers-product
index 201252d2d29..052da7c3c7e 100644
--- a/hotspot/make/linux/makefiles/mapfile-vers-product
+++ b/hotspot/make/linux/makefiles/mapfile-vers-product
@@ -3,7 +3,7 @@
#
#
-# Copyright (c) 2002, 2010, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2002, 2011, 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
diff --git a/hotspot/make/linux/makefiles/ppc.make b/hotspot/make/linux/makefiles/ppc.make
index 50ac9fe0d8c..a3a19bc246a 100644
--- a/hotspot/make/linux/makefiles/ppc.make
+++ b/hotspot/make/linux/makefiles/ppc.make
@@ -1,5 +1,5 @@
#
-# Copyright (c) 2004, 2010, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2004, 2011, Oracle and/or its affiliates. All rights reserved.
# ORACLE PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
#
diff --git a/hotspot/make/linux/makefiles/rules.make b/hotspot/make/linux/makefiles/rules.make
index 4237597e986..12eafe8b3f4 100644
--- a/hotspot/make/linux/makefiles/rules.make
+++ b/hotspot/make/linux/makefiles/rules.make
@@ -55,6 +55,14 @@ LINK_NOPROF.CC = $(CCC) $(LFLAGS) $(AOUT_FLAGS)
LINK_LIB.CC = $(CCC) $(LFLAGS) $(SHARED_FLAG)
PREPROCESS.CC = $(CC_COMPILE) -E
+# cross compiling the jvm with c2 requires host compilers to build
+# adlc tool
+
+HOST.CC_COMPILE = $(HOSTCPP) $(CPPFLAGS) $(CFLAGS)
+HOST.COMPILE.CC = $(HOST.CC_COMPILE) -c
+HOST.LINK_NOPROF.CC = $(HOSTCPP) $(LFLAGS) $(AOUT_FLAGS)
+
+
# Effect of REMOVE_TARGET is to delete out-of-date files during "gnumake -k".
REMOVE_TARGET = rm -f $@
diff --git a/hotspot/make/linux/makefiles/sparcWorks.make b/hotspot/make/linux/makefiles/sparcWorks.make
index 77076fff16c..6e6c8418d6f 100644
--- a/hotspot/make/linux/makefiles/sparcWorks.make
+++ b/hotspot/make/linux/makefiles/sparcWorks.make
@@ -1,5 +1,5 @@
#
-# Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 1999, 2011, 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
@@ -29,6 +29,9 @@ CPP = CC
CC = cc
AS = $(CC) -c
+HOSTCPP = $(CPP)
+HOSTCC = $(CC)
+
ARCHFLAG = $(ARCHFLAG/$(BUILDARCH))
ARCHFLAG/i486 = -m32
ARCHFLAG/amd64 = -m64
diff --git a/hotspot/make/linux/makefiles/top.make b/hotspot/make/linux/makefiles/top.make
index 41c50940d25..1b674dce957 100644
--- a/hotspot/make/linux/makefiles/top.make
+++ b/hotspot/make/linux/makefiles/top.make
@@ -1,5 +1,5 @@
#
-# Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 1999, 2011, 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
diff --git a/hotspot/make/linux/makefiles/vm.make b/hotspot/make/linux/makefiles/vm.make
index cde41b5ca80..a987ec30aea 100644
--- a/hotspot/make/linux/makefiles/vm.make
+++ b/hotspot/make/linux/makefiles/vm.make
@@ -1,5 +1,5 @@
#
-# Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 1999, 2011, 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
diff --git a/hotspot/make/solaris/makefiles/adlc.make b/hotspot/make/solaris/makefiles/adlc.make
index 981e187f729..4bcecf607cd 100644
--- a/hotspot/make/solaris/makefiles/adlc.make
+++ b/hotspot/make/solaris/makefiles/adlc.make
@@ -1,5 +1,5 @@
#
-# Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 1997, 2011, 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
diff --git a/hotspot/make/solaris/makefiles/buildtree.make b/hotspot/make/solaris/makefiles/buildtree.make
index 8cca8a07ebb..591ae3c5855 100644
--- a/hotspot/make/solaris/makefiles/buildtree.make
+++ b/hotspot/make/solaris/makefiles/buildtree.make
@@ -1,5 +1,5 @@
#
-# Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2000, 2011, 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
diff --git a/hotspot/make/solaris/makefiles/rules.make b/hotspot/make/solaris/makefiles/rules.make
index 4f2cc860805..c5bd00f957c 100644
--- a/hotspot/make/solaris/makefiles/rules.make
+++ b/hotspot/make/solaris/makefiles/rules.make
@@ -1,5 +1,5 @@
#
-# Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2000, 2011, 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
diff --git a/hotspot/make/solaris/makefiles/top.make b/hotspot/make/solaris/makefiles/top.make
index 893e9c00cab..64797bbb2fd 100644
--- a/hotspot/make/solaris/makefiles/top.make
+++ b/hotspot/make/solaris/makefiles/top.make
@@ -1,5 +1,5 @@
#
-# Copyright (c) 1998, 2010, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 1998, 2011, 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
diff --git a/hotspot/make/solaris/makefiles/vm.make b/hotspot/make/solaris/makefiles/vm.make
index 5ad02c00c53..5db3daeda64 100644
--- a/hotspot/make/solaris/makefiles/vm.make
+++ b/hotspot/make/solaris/makefiles/vm.make
@@ -1,5 +1,5 @@
#
-# Copyright (c) 1998, 2010, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 1998, 2011, 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
diff --git a/hotspot/make/windows/create_obj_files.sh b/hotspot/make/windows/create_obj_files.sh
index 0c8276962e6..59fe3a6932c 100644
--- a/hotspot/make/windows/create_obj_files.sh
+++ b/hotspot/make/windows/create_obj_files.sh
@@ -1,5 +1,5 @@
#
-# Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2010, 2011, 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
diff --git a/hotspot/make/windows/makefiles/launcher.make b/hotspot/make/windows/makefiles/launcher.make
index 7868032d590..2a5df63bdac 100644
--- a/hotspot/make/windows/makefiles/launcher.make
+++ b/hotspot/make/windows/makefiles/launcher.make
@@ -1,5 +1,5 @@
#
-# Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2010, 2011, 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
diff --git a/hotspot/make/windows/makefiles/vm.make b/hotspot/make/windows/makefiles/vm.make
index 4bcdd4a3bbe..1ee86646137 100644
--- a/hotspot/make/windows/makefiles/vm.make
+++ b/hotspot/make/windows/makefiles/vm.make
@@ -1,5 +1,5 @@
#
-# Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 1997, 2011, 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
diff --git a/hotspot/src/cpu/sparc/vm/c1_LIRAssembler_sparc.cpp b/hotspot/src/cpu/sparc/vm/c1_LIRAssembler_sparc.cpp
index 89ec0ef20fc..b4504377643 100644
--- a/hotspot/src/cpu/sparc/vm/c1_LIRAssembler_sparc.cpp
+++ b/hotspot/src/cpu/sparc/vm/c1_LIRAssembler_sparc.cpp
@@ -2058,6 +2058,13 @@ void LIR_Assembler::emit_arraycopy(LIR_OpArrayCopy* op) {
BasicType basic_type = default_type != NULL ? default_type->element_type()->basic_type() : T_ILLEGAL;
if (basic_type == T_ARRAY) basic_type = T_OBJECT;
+#ifdef _LP64
+ // higher 32bits must be null
+ __ sra(dst_pos, 0, dst_pos);
+ __ sra(src_pos, 0, src_pos);
+ __ sra(length, 0, length);
+#endif
+
// set up the arraycopy stub information
ArrayCopyStub* stub = op->stub();
@@ -2065,20 +2072,36 @@ void LIR_Assembler::emit_arraycopy(LIR_OpArrayCopy* op) {
// the known type isn't loaded since the code sanity checks
// in debug mode and the type isn't required when we know the exact type
// also check that the type is an array type.
- // We also, for now, always call the stub if the barrier set requires a
- // write_ref_pre barrier (which the stub does, but none of the optimized
- // cases currently does).
- if (op->expected_type() == NULL ||
- Universe::heap()->barrier_set()->has_write_ref_pre_barrier()) {
+ if (op->expected_type() == NULL) {
__ mov(src, O0);
__ mov(src_pos, O1);
__ mov(dst, O2);
__ mov(dst_pos, O3);
__ mov(length, O4);
- __ call_VM_leaf(tmp, CAST_FROM_FN_PTR(address, Runtime1::arraycopy));
+ address copyfunc_addr = StubRoutines::generic_arraycopy();
- __ br_zero(Assembler::less, false, Assembler::pn, O0, *stub->entry());
- __ delayed()->nop();
+ if (copyfunc_addr == NULL) { // Use C version if stub was not generated
+ __ call_VM_leaf(tmp, CAST_FROM_FN_PTR(address, Runtime1::arraycopy));
+ } else {
+#ifndef PRODUCT
+ if (PrintC1Statistics) {
+ address counter = (address)&Runtime1::_generic_arraycopystub_cnt;
+ __ inc_counter(counter, G1, G3);
+ }
+#endif
+ __ call_VM_leaf(tmp, copyfunc_addr);
+ }
+
+ if (copyfunc_addr != NULL) {
+ __ xor3(O0, -1, tmp);
+ __ sub(length, tmp, length);
+ __ add(src_pos, tmp, src_pos);
+ __ br_zero(Assembler::less, false, Assembler::pn, O0, *stub->entry());
+ __ delayed()->add(dst_pos, tmp, dst_pos);
+ } else {
+ __ br_zero(Assembler::less, false, Assembler::pn, O0, *stub->entry());
+ __ delayed()->nop();
+ }
__ bind(*stub->continuation());
return;
}
@@ -2135,20 +2158,137 @@ void LIR_Assembler::emit_arraycopy(LIR_OpArrayCopy* op) {
__ delayed()->nop();
}
+ int shift = shift_amount(basic_type);
+
if (flags & LIR_OpArrayCopy::type_check) {
- if (UseCompressedOops) {
- // We don't need decode because we just need to compare
- __ lduw(src, oopDesc::klass_offset_in_bytes(), tmp);
- __ lduw(dst, oopDesc::klass_offset_in_bytes(), tmp2);
- __ cmp(tmp, tmp2);
- __ br(Assembler::notEqual, false, Assembler::pt, *stub->entry());
+ // We don't know the array types are compatible
+ if (basic_type != T_OBJECT) {
+ // Simple test for basic type arrays
+ if (UseCompressedOops) {
+ // We don't need decode because we just need to compare
+ __ lduw(src, oopDesc::klass_offset_in_bytes(), tmp);
+ __ lduw(dst, oopDesc::klass_offset_in_bytes(), tmp2);
+ __ cmp(tmp, tmp2);
+ __ br(Assembler::notEqual, false, Assembler::pt, *stub->entry());
+ } else {
+ __ ld_ptr(src, oopDesc::klass_offset_in_bytes(), tmp);
+ __ ld_ptr(dst, oopDesc::klass_offset_in_bytes(), tmp2);
+ __ cmp(tmp, tmp2);
+ __ brx(Assembler::notEqual, false, Assembler::pt, *stub->entry());
+ }
+ __ delayed()->nop();
} else {
- __ ld_ptr(src, oopDesc::klass_offset_in_bytes(), tmp);
- __ ld_ptr(dst, oopDesc::klass_offset_in_bytes(), tmp2);
- __ cmp(tmp, tmp2);
- __ brx(Assembler::notEqual, false, Assembler::pt, *stub->entry());
+ // For object arrays, if src is a sub class of dst then we can
+ // safely do the copy.
+ address copyfunc_addr = StubRoutines::checkcast_arraycopy();
+
+ Label cont, slow;
+ assert_different_registers(tmp, tmp2, G3, G1);
+
+ __ load_klass(src, G3);
+ __ load_klass(dst, G1);
+
+ __ check_klass_subtype_fast_path(G3, G1, tmp, tmp2, &cont, copyfunc_addr == NULL ? stub->entry() : &slow, NULL);
+
+ __ call(Runtime1::entry_for(Runtime1::slow_subtype_check_id), relocInfo::runtime_call_type);
+ __ delayed()->nop();
+
+ __ cmp(G3, 0);
+ if (copyfunc_addr != NULL) { // use stub if available
+ // src is not a sub class of dst so we have to do a
+ // per-element check.
+ __ br(Assembler::notEqual, false, Assembler::pt, cont);
+ __ delayed()->nop();
+
+ __ bind(slow);
+
+ int mask = LIR_OpArrayCopy::src_objarray|LIR_OpArrayCopy::dst_objarray;
+ if ((flags & mask) != mask) {
+ // Check that at least both of them object arrays.
+ assert(flags & mask, "one of the two should be known to be an object array");
+
+ if (!(flags & LIR_OpArrayCopy::src_objarray)) {
+ __ load_klass(src, tmp);
+ } else if (!(flags & LIR_OpArrayCopy::dst_objarray)) {
+ __ load_klass(dst, tmp);
+ }
+ int lh_offset = klassOopDesc::header_size() * HeapWordSize +
+ Klass::layout_helper_offset_in_bytes();
+
+ __ lduw(tmp, lh_offset, tmp2);
+
+ jint objArray_lh = Klass::array_layout_helper(T_OBJECT);
+ __ set(objArray_lh, tmp);
+ __ cmp(tmp, tmp2);
+ __ br(Assembler::notEqual, false, Assembler::pt, *stub->entry());
+ __ delayed()->nop();
+ }
+
+ Register src_ptr = O0;
+ Register dst_ptr = O1;
+ Register len = O2;
+ Register chk_off = O3;
+ Register super_k = O4;
+
+ __ add(src, arrayOopDesc::base_offset_in_bytes(basic_type), src_ptr);
+ if (shift == 0) {
+ __ add(src_ptr, src_pos, src_ptr);
+ } else {
+ __ sll(src_pos, shift, tmp);
+ __ add(src_ptr, tmp, src_ptr);
+ }
+
+ __ add(dst, arrayOopDesc::base_offset_in_bytes(basic_type), dst_ptr);
+ if (shift == 0) {
+ __ add(dst_ptr, dst_pos, dst_ptr);
+ } else {
+ __ sll(dst_pos, shift, tmp);
+ __ add(dst_ptr, tmp, dst_ptr);
+ }
+ __ mov(length, len);
+ __ load_klass(dst, tmp);
+
+ int ek_offset = (klassOopDesc::header_size() * HeapWordSize +
+ objArrayKlass::element_klass_offset_in_bytes());
+ __ ld_ptr(tmp, ek_offset, super_k);
+
+ int sco_offset = (klassOopDesc::header_size() * HeapWordSize +
+ Klass::super_check_offset_offset_in_bytes());
+ __ lduw(super_k, sco_offset, chk_off);
+
+ __ call_VM_leaf(tmp, copyfunc_addr);
+
+#ifndef PRODUCT
+ if (PrintC1Statistics) {
+ Label failed;
+ __ br_notnull(O0, false, Assembler::pn, failed);
+ __ delayed()->nop();
+ __ inc_counter((address)&Runtime1::_arraycopy_checkcast_cnt, G1, G3);
+ __ bind(failed);
+ }
+#endif
+
+ __ br_null(O0, false, Assembler::pt, *stub->continuation());
+ __ delayed()->xor3(O0, -1, tmp);
+
+#ifndef PRODUCT
+ if (PrintC1Statistics) {
+ __ inc_counter((address)&Runtime1::_arraycopy_checkcast_attempt_cnt, G1, G3);
+ }
+#endif
+
+ __ sub(length, tmp, length);
+ __ add(src_pos, tmp, src_pos);
+ __ br(Assembler::always, false, Assembler::pt, *stub->entry());
+ __ delayed()->add(dst_pos, tmp, dst_pos);
+
+ __ bind(cont);
+ } else {
+ __ br(Assembler::equal, false, Assembler::pn, *stub->entry());
+ __ delayed()->nop();
+ __ bind(cont);
+ }
}
- __ delayed()->nop();
}
#ifdef ASSERT
@@ -2207,14 +2347,18 @@ void LIR_Assembler::emit_arraycopy(LIR_OpArrayCopy* op) {
}
#endif
- int shift = shift_amount(basic_type);
+#ifndef PRODUCT
+ if (PrintC1Statistics) {
+ address counter = Runtime1::arraycopy_count_address(basic_type);
+ __ inc_counter(counter, G1, G3);
+ }
+#endif
Register src_ptr = O0;
Register dst_ptr = O1;
Register len = O2;
__ add(src, arrayOopDesc::base_offset_in_bytes(basic_type), src_ptr);
- LP64_ONLY(__ sra(src_pos, 0, src_pos);) //higher 32bits must be null
if (shift == 0) {
__ add(src_ptr, src_pos, src_ptr);
} else {
@@ -2223,7 +2367,6 @@ void LIR_Assembler::emit_arraycopy(LIR_OpArrayCopy* op) {
}
__ add(dst, arrayOopDesc::base_offset_in_bytes(basic_type), dst_ptr);
- LP64_ONLY(__ sra(dst_pos, 0, dst_pos);) //higher 32bits must be null
if (shift == 0) {
__ add(dst_ptr, dst_pos, dst_ptr);
} else {
@@ -2231,18 +2374,14 @@ void LIR_Assembler::emit_arraycopy(LIR_OpArrayCopy* op) {
__ add(dst_ptr, tmp, dst_ptr);
}
- if (basic_type != T_OBJECT) {
- if (shift == 0) {
- __ mov(length, len);
- } else {
- __ sll(length, shift, len);
- }
- __ call_VM_leaf(tmp, CAST_FROM_FN_PTR(address, Runtime1::primitive_arraycopy));
- } else {
- // oop_arraycopy takes a length in number of elements, so don't scale it.
- __ mov(length, len);
- __ call_VM_leaf(tmp, CAST_FROM_FN_PTR(address, Runtime1::oop_arraycopy));
- }
+ bool disjoint = (flags & LIR_OpArrayCopy::overlapping) == 0;
+ bool aligned = (flags & LIR_OpArrayCopy::unaligned) == 0;
+ const char *name;
+ address entry = StubRoutines::select_arraycopy_function(basic_type, aligned, disjoint, name, false);
+
+ // arraycopy stubs takes a length in number of elements, so don't scale it.
+ __ mov(length, len);
+ __ call_VM_leaf(tmp, entry);
__ bind(*stub->continuation());
}
diff --git a/hotspot/src/cpu/sparc/vm/c1_MacroAssembler_sparc.cpp b/hotspot/src/cpu/sparc/vm/c1_MacroAssembler_sparc.cpp
index c3556e2147e..35e70e99676 100644
--- a/hotspot/src/cpu/sparc/vm/c1_MacroAssembler_sparc.cpp
+++ b/hotspot/src/cpu/sparc/vm/c1_MacroAssembler_sparc.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2011, 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
@@ -387,7 +387,7 @@ void C1_MacroAssembler::verify_stack_oop(int stack_offset) {
void C1_MacroAssembler::verify_not_null_oop(Register r) {
Label not_null;
- br_zero(Assembler::notEqual, false, Assembler::pt, r, not_null);
+ br_notnull(r, false, Assembler::pt, not_null);
delayed()->nop();
stop("non-null oop required");
bind(not_null);
diff --git a/hotspot/src/cpu/sparc/vm/cppInterpreter_sparc.cpp b/hotspot/src/cpu/sparc/vm/cppInterpreter_sparc.cpp
index 1b25b2af831..479a99152cc 100644
--- a/hotspot/src/cpu/sparc/vm/cppInterpreter_sparc.cpp
+++ b/hotspot/src/cpu/sparc/vm/cppInterpreter_sparc.cpp
@@ -1188,8 +1188,8 @@ void CppInterpreterGenerator::generate_compute_interpreter_state(const Register
__ st_ptr(O2, XXX_STATE(_stack)); // PREPUSH
__ lduh(max_stack, O3); // Full size expression stack
- guarantee(!EnableMethodHandles, "no support yet for java.lang.invoke.MethodHandle"); //6815692
- //6815692//if (EnableMethodHandles)
+ guarantee(!EnableInvokeDynamic, "no support yet for java.lang.invoke.MethodHandle"); //6815692
+ //6815692//if (EnableInvokeDynamic)
//6815692// __ inc(O3, methodOopDesc::extra_stack_entries());
__ sll(O3, LogBytesPerWord, O3);
__ sub(O2, O3, O3);
diff --git a/hotspot/src/cpu/sparc/vm/dump_sparc.cpp b/hotspot/src/cpu/sparc/vm/dump_sparc.cpp
index afe0d4f5952..19929f52ba0 100644
--- a/hotspot/src/cpu/sparc/vm/dump_sparc.cpp
+++ b/hotspot/src/cpu/sparc/vm/dump_sparc.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2004, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2004, 2011, 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
diff --git a/hotspot/src/cpu/sparc/vm/interp_masm_sparc.cpp b/hotspot/src/cpu/sparc/vm/interp_masm_sparc.cpp
index c6b33222a6c..58c4c9451df 100644
--- a/hotspot/src/cpu/sparc/vm/interp_masm_sparc.cpp
+++ b/hotspot/src/cpu/sparc/vm/interp_masm_sparc.cpp
@@ -743,12 +743,12 @@ void InterpreterMacroAssembler::get_cache_index_at_bcp(Register cache, Register
if (index_size == sizeof(u2)) {
get_2_byte_integer_at_bcp(bcp_offset, cache, tmp, Unsigned);
} else if (index_size == sizeof(u4)) {
- assert(EnableInvokeDynamic, "giant index used only for EnableInvokeDynamic");
+ assert(EnableInvokeDynamic, "giant index used only for JSR 292");
get_4_byte_integer_at_bcp(bcp_offset, cache, tmp);
assert(constantPoolCacheOopDesc::decode_secondary_index(~123) == 123, "else change next line");
xor3(tmp, -1, tmp); // convert to plain index
} else if (index_size == sizeof(u1)) {
- assert(EnableMethodHandles, "tiny index used only for EnableMethodHandles");
+ assert(EnableInvokeDynamic, "tiny index used only for JSR 292");
ldub(Lbcp, bcp_offset, tmp);
} else {
ShouldNotReachHere();
diff --git a/hotspot/src/cpu/sparc/vm/interpreter_sparc.cpp b/hotspot/src/cpu/sparc/vm/interpreter_sparc.cpp
index 06375d0b0ad..0c84df6afe9 100644
--- a/hotspot/src/cpu/sparc/vm/interpreter_sparc.cpp
+++ b/hotspot/src/cpu/sparc/vm/interpreter_sparc.cpp
@@ -262,7 +262,7 @@ address InterpreterGenerator::generate_abstract_entry(void) {
// Method handle invoker
// Dispatch a method of the form java.lang.invoke.MethodHandles::invoke(...)
address InterpreterGenerator::generate_method_handle_entry(void) {
- if (!EnableMethodHandles) {
+ if (!EnableInvokeDynamic) {
return generate_abstract_entry();
}
diff --git a/hotspot/src/cpu/sparc/vm/jni_sparc.h b/hotspot/src/cpu/sparc/vm/jni_sparc.h
index 2e177a8692e..5cb443ba943 100644
--- a/hotspot/src/cpu/sparc/vm/jni_sparc.h
+++ b/hotspot/src/cpu/sparc/vm/jni_sparc.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2011, 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
diff --git a/hotspot/src/cpu/sparc/vm/nativeInst_sparc.cpp b/hotspot/src/cpu/sparc/vm/nativeInst_sparc.cpp
index a5bcc5e7738..93fa1fc87ca 100644
--- a/hotspot/src/cpu/sparc/vm/nativeInst_sparc.cpp
+++ b/hotspot/src/cpu/sparc/vm/nativeInst_sparc.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2011, 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
diff --git a/hotspot/src/cpu/sparc/vm/nativeInst_sparc.hpp b/hotspot/src/cpu/sparc/vm/nativeInst_sparc.hpp
index 7549281f0ba..6ee9c6239d5 100644
--- a/hotspot/src/cpu/sparc/vm/nativeInst_sparc.hpp
+++ b/hotspot/src/cpu/sparc/vm/nativeInst_sparc.hpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2011, 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
diff --git a/hotspot/src/cpu/sparc/vm/relocInfo_sparc.cpp b/hotspot/src/cpu/sparc/vm/relocInfo_sparc.cpp
index a2913f6f055..16196cd3609 100644
--- a/hotspot/src/cpu/sparc/vm/relocInfo_sparc.cpp
+++ b/hotspot/src/cpu/sparc/vm/relocInfo_sparc.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1998, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 2011, 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
diff --git a/hotspot/src/cpu/sparc/vm/sharedRuntime_sparc.cpp b/hotspot/src/cpu/sparc/vm/sharedRuntime_sparc.cpp
index df6aa841838..1dc9de76f60 100644
--- a/hotspot/src/cpu/sparc/vm/sharedRuntime_sparc.cpp
+++ b/hotspot/src/cpu/sparc/vm/sharedRuntime_sparc.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2011, 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
@@ -1769,6 +1769,7 @@ static void create_inner_frame(MacroAssembler* masm, bool* already_created) {
// returns.
nmethod *SharedRuntime::generate_native_wrapper(MacroAssembler* masm,
methodHandle method,
+ int compile_id,
int total_in_args,
int comp_args_on_stack, // in VMRegStackSlots
BasicType *in_sig_bt,
@@ -2462,6 +2463,7 @@ nmethod *SharedRuntime::generate_native_wrapper(MacroAssembler* masm,
__ flush();
nmethod *nm = nmethod::new_native_nmethod(method,
+ compile_id,
masm->code(),
vep_offset,
frame_complete,
diff --git a/hotspot/src/cpu/sparc/vm/sparc.ad b/hotspot/src/cpu/sparc/vm/sparc.ad
index cffc8fb5f7f..f2d7656d38c 100644
--- a/hotspot/src/cpu/sparc/vm/sparc.ad
+++ b/hotspot/src/cpu/sparc/vm/sparc.ad
@@ -1843,6 +1843,10 @@ const int Matcher::init_array_short_size = 8 * BytesPerLong;
// registers? True for Intel but false for most RISCs
const bool Matcher::clone_shift_expressions = false;
+// Do we need to mask the count passed to shift instructions or does
+// the cpu only look at the lower 5/6 bits anyway?
+const bool Matcher::need_masked_shift_count = false;
+
bool Matcher::narrow_oop_use_complex_address() {
NOT_LP64(ShouldNotCallThis());
assert(UseCompressedOops, "only for compressed oops code");
diff --git a/hotspot/src/cpu/sparc/vm/templateTable_sparc.cpp b/hotspot/src/cpu/sparc/vm/templateTable_sparc.cpp
index e590cb8235d..9f4bcc6b4d6 100644
--- a/hotspot/src/cpu/sparc/vm/templateTable_sparc.cpp
+++ b/hotspot/src/cpu/sparc/vm/templateTable_sparc.cpp
@@ -334,8 +334,8 @@ void TemplateTable::ldc(bool wide) {
void TemplateTable::fast_aldc(bool wide) {
transition(vtos, atos);
- if (!EnableMethodHandles) {
- // We should not encounter this bytecode if !EnableMethodHandles.
+ if (!EnableInvokeDynamic) {
+ // We should not encounter this bytecode if !EnableInvokeDynamic.
// The verifier will stop it. However, if we get past the verifier,
// this will stop the thread in a reasonable way, without crashing the JVM.
__ call_VM(noreg, CAST_FROM_FN_PTR(address,
diff --git a/hotspot/src/cpu/x86/vm/assembler_x86.cpp b/hotspot/src/cpu/x86/vm/assembler_x86.cpp
index d621a3cbff9..34b0fffdd21 100644
--- a/hotspot/src/cpu/x86/vm/assembler_x86.cpp
+++ b/hotspot/src/cpu/x86/vm/assembler_x86.cpp
@@ -3510,7 +3510,6 @@ bool Assembler::reachable(AddressLiteral adr) {
// anywhere in the codeCache then we are always reachable.
// This would have to change if we ever save/restore shared code
// to be more pessimistic.
-
disp = (int64_t)adr._target - ((int64_t)CodeCache::low_bound() + sizeof(int));
if (!is_simm32(disp)) return false;
disp = (int64_t)adr._target - ((int64_t)CodeCache::high_bound() + sizeof(int));
@@ -3534,6 +3533,14 @@ bool Assembler::reachable(AddressLiteral adr) {
return is_simm32(disp);
}
+// Check if the polling page is not reachable from the code cache using rip-relative
+// addressing.
+bool Assembler::is_polling_page_far() {
+ intptr_t addr = (intptr_t)os::get_polling_page();
+ return !is_simm32(addr - (intptr_t)CodeCache::low_bound()) ||
+ !is_simm32(addr - (intptr_t)CodeCache::high_bound());
+}
+
void Assembler::emit_data64(jlong data,
relocInfo::relocType rtype,
int format) {
@@ -6886,6 +6893,11 @@ void MacroAssembler::sign_extend_short(Register reg) {
}
}
+void MacroAssembler::testl(Register dst, AddressLiteral src) {
+ assert(reachable(src), "Address should be reachable");
+ testl(dst, as_Address(src));
+}
+
//////////////////////////////////////////////////////////////////////////////////
#ifndef SERIALGC
@@ -7121,17 +7133,6 @@ void MacroAssembler::subptr(Register dst, Register src) {
LP64_ONLY(subq(dst, src)) NOT_LP64(subl(dst, src));
}
-void MacroAssembler::test32(Register src1, AddressLiteral src2) {
- // src2 must be rval
-
- if (reachable(src2)) {
- testl(src1, as_Address(src2));
- } else {
- lea(rscratch1, src2);
- testl(src1, Address(rscratch1, 0));
- }
-}
-
// C++ bool manipulation
void MacroAssembler::testbool(Register dst) {
if(sizeof(bool) == 1)
@@ -7768,6 +7769,28 @@ void MacroAssembler::xorps(XMMRegister dst, AddressLiteral src) {
}
}
+void MacroAssembler::cmov32(Condition cc, Register dst, Address src) {
+ if (VM_Version::supports_cmov()) {
+ cmovl(cc, dst, src);
+ } else {
+ Label L;
+ jccb(negate_condition(cc), L);
+ movl(dst, src);
+ bind(L);
+ }
+}
+
+void MacroAssembler::cmov32(Condition cc, Register dst, Register src) {
+ if (VM_Version::supports_cmov()) {
+ cmovl(cc, dst, src);
+ } else {
+ Label L;
+ jccb(negate_condition(cc), L);
+ movl(dst, src);
+ bind(L);
+ }
+}
+
void MacroAssembler::verify_oop(Register reg, const char* s) {
if (!VerifyOops) return;
@@ -7918,12 +7941,12 @@ void MacroAssembler::verify_oop_addr(Address addr, const char* s) {
#endif
push(rax); // save rax,
// addr may contain rsp so we will have to adjust it based on the push
- // we just did
+ // we just did (and on 64 bit we do two pushes)
// NOTE: 64bit seemed to have had a bug in that it did movq(addr, rax); which
// stores rax into addr which is backwards of what was intended.
if (addr.uses(rsp)) {
lea(rax, addr);
- pushptr(Address(rax, BytesPerWord));
+ pushptr(Address(rax, LP64_ONLY(2 *) BytesPerWord));
} else {
pushptr(addr);
}
@@ -8373,6 +8396,17 @@ void MacroAssembler::load_heap_oop(Register dst, Address src) {
movptr(dst, src);
}
+// Doesn't do verfication, generates fixed size code
+void MacroAssembler::load_heap_oop_not_null(Register dst, Address src) {
+#ifdef _LP64
+ if (UseCompressedOops) {
+ movl(dst, src);
+ decode_heap_oop_not_null(dst);
+ } else
+#endif
+ movptr(dst, src);
+}
+
void MacroAssembler::store_heap_oop(Address dst, Register src) {
#ifdef _LP64
if (UseCompressedOops) {
@@ -9018,14 +9052,7 @@ void MacroAssembler::string_compare(Register str1, Register str2,
movl(result, cnt1);
subl(cnt1, cnt2);
push(cnt1);
- if (VM_Version::supports_cmov()) {
- cmovl(Assembler::lessEqual, cnt2, result);
- } else {
- Label GT_LABEL;
- jccb(Assembler::greater, GT_LABEL);
- movl(cnt2, result);
- bind(GT_LABEL);
- }
+ cmov32(Assembler::lessEqual, cnt2, result);
// Is the minimum length zero?
testl(cnt2, cnt2);
diff --git a/hotspot/src/cpu/x86/vm/assembler_x86.hpp b/hotspot/src/cpu/x86/vm/assembler_x86.hpp
index 807559e06d1..1407248b1b0 100644
--- a/hotspot/src/cpu/x86/vm/assembler_x86.hpp
+++ b/hotspot/src/cpu/x86/vm/assembler_x86.hpp
@@ -385,10 +385,18 @@ class OopAddress: public AddressLiteral {
};
class ExternalAddress: public AddressLiteral {
+ private:
+ static relocInfo::relocType reloc_for_target(address target) {
+ // Sometimes ExternalAddress is used for values which aren't
+ // exactly addresses, like the card table base.
+ // external_word_type can't be used for values in the first page
+ // so just skip the reloc in that case.
+ return external_word_Relocation::can_be_relocated(target) ? relocInfo::external_word_type : relocInfo::none;
+ }
- public:
+ public:
- ExternalAddress(address target) : AddressLiteral(target, relocInfo::external_word_type){}
+ ExternalAddress(address target) : AddressLiteral(target, reloc_for_target(target)) {}
};
@@ -580,7 +588,6 @@ private:
void emit_data64(jlong data, relocInfo::relocType rtype, int format = 0);
void emit_data64(jlong data, RelocationHolder const& rspec, int format = 0);
-
bool reachable(AddressLiteral adr) NOT_LP64({ return true;});
// These are all easily abused and hence protected
@@ -683,6 +690,8 @@ private:
static bool is_simm32(int32_t x) { return true; }
#endif // _LP64
+ static bool is_polling_page_far() NOT_LP64({ return false;});
+
// Generic instructions
// Does 32bit or 64bit as needed for the platform. In some sense these
// belong in macro assembler but there is no need for both varieties to exist
@@ -1700,6 +1709,7 @@ class MacroAssembler: public Assembler {
void store_klass(Register dst, Register src);
void load_heap_oop(Register dst, Address src);
+ void load_heap_oop_not_null(Register dst, Address src);
void store_heap_oop(Address dst, Register src);
// Used for storing NULL. All other oop constants should be
@@ -2094,7 +2104,10 @@ class MacroAssembler: public Assembler {
void leal32(Register dst, Address src) { leal(dst, src); }
- void test32(Register src1, AddressLiteral src2);
+ // Import other testl() methods from the parent class or else
+ // they will be hidden by the following overriding declaration.
+ using Assembler::testl;
+ void testl(Register dst, AddressLiteral src);
void orptr(Register dst, Address src) { LP64_ONLY(orq(dst, src)) NOT_LP64(orl(dst, src)); }
void orptr(Register dst, Register src) { LP64_ONLY(orq(dst, src)) NOT_LP64(orl(dst, src)); }
@@ -2240,10 +2253,13 @@ public:
// Data
- void cmov(Condition cc, Register dst, Register src) { LP64_ONLY(cmovq(cc, dst, src)) NOT_LP64(cmovl(cc, dst, src)); }
+ void cmov32( Condition cc, Register dst, Address src);
+ void cmov32( Condition cc, Register dst, Register src);
- void cmovptr(Condition cc, Register dst, Address src) { LP64_ONLY(cmovq(cc, dst, src)) NOT_LP64(cmovl(cc, dst, src)); }
- void cmovptr(Condition cc, Register dst, Register src) { LP64_ONLY(cmovq(cc, dst, src)) NOT_LP64(cmovl(cc, dst, src)); }
+ void cmov( Condition cc, Register dst, Register src) { cmovptr(cc, dst, src); }
+
+ void cmovptr(Condition cc, Register dst, Address src) { LP64_ONLY(cmovq(cc, dst, src)) NOT_LP64(cmov32(cc, dst, src)); }
+ void cmovptr(Condition cc, Register dst, Register src) { LP64_ONLY(cmovq(cc, dst, src)) NOT_LP64(cmov32(cc, dst, src)); }
void movoop(Register dst, jobject obj);
void movoop(Address dst, jobject obj);
diff --git a/hotspot/src/cpu/x86/vm/c1_CodeStubs_x86.cpp b/hotspot/src/cpu/x86/vm/c1_CodeStubs_x86.cpp
index 3603831155a..120570c64b2 100644
--- a/hotspot/src/cpu/x86/vm/c1_CodeStubs_x86.cpp
+++ b/hotspot/src/cpu/x86/vm/c1_CodeStubs_x86.cpp
@@ -316,7 +316,9 @@ void PatchingStub::emit_code(LIR_Assembler* ce) {
Register tmp2 = rbx;
__ push(tmp);
__ push(tmp2);
- __ load_heap_oop(tmp2, Address(_obj, java_lang_Class::klass_offset_in_bytes()));
+ // Load without verification to keep code size small. We need it because
+ // begin_initialized_entry_offset has to fit in a byte. Also, we know it's not null.
+ __ load_heap_oop_not_null(tmp2, Address(_obj, java_lang_Class::klass_offset_in_bytes()));
__ get_thread(tmp);
__ cmpptr(tmp, Address(tmp2, instanceKlass::init_thread_offset_in_bytes() + sizeof(klassOopDesc)));
__ pop(tmp2);
diff --git a/hotspot/src/cpu/x86/vm/c1_LIRAssembler_x86.cpp b/hotspot/src/cpu/x86/vm/c1_LIRAssembler_x86.cpp
index 206edd52b6f..bcec4d4d742 100644
--- a/hotspot/src/cpu/x86/vm/c1_LIRAssembler_x86.cpp
+++ b/hotspot/src/cpu/x86/vm/c1_LIRAssembler_x86.cpp
@@ -23,6 +23,7 @@
*/
#include "precompiled.hpp"
+#include "asm/assembler.hpp"
#include "c1/c1_Compilation.hpp"
#include "c1/c1_LIRAssembler.hpp"
#include "c1/c1_MacroAssembler.hpp"
@@ -569,24 +570,13 @@ void LIR_Assembler::emit_string_compare(LIR_Opr arg0, LIR_Opr arg1, LIR_Opr dst,
__ lea (rdi, Address(rdi, rcx, Address::times_2, arrayOopDesc::base_offset_in_bytes(T_CHAR)));
// compute minimum length (in rax) and difference of lengths (on top of stack)
- if (VM_Version::supports_cmov()) {
- __ 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
- __ cmov (Assembler::lessEqual, rax, rcx);
- } else {
- Label L;
- __ movl (rbx, Address(rbx, java_lang_String::count_offset_in_bytes()));
- __ movl (rcx, Address(rax, java_lang_String::count_offset_in_bytes()));
- __ mov (rax, rbx);
- __ subptr (rbx, rcx);
- __ push (rbx);
- __ jcc (Assembler::lessEqual, L);
- __ mov (rax, rcx);
- __ bind (L);
- }
+ __ 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
+ __ cmov (Assembler::lessEqual, rax, rcx);
+
// is minimum length 0?
Label noLoop, haveResult;
__ testptr (rax, rax);
@@ -648,12 +638,13 @@ void LIR_Assembler::return_op(LIR_Opr result) {
AddressLiteral polling_page(os::get_polling_page() + (SafepointPollOffset % os::vm_page_size()),
relocInfo::poll_return_type);
- // NOTE: the requires that the polling page be reachable else the reloc
- // goes to the movq that loads the address and not the faulting instruction
- // which breaks the signal handler code
-
- __ test32(rax, polling_page);
-
+ if (Assembler::is_polling_page_far()) {
+ __ lea(rscratch1, polling_page);
+ __ relocate(relocInfo::poll_return_type);
+ __ testl(rax, Address(rscratch1, 0));
+ } else {
+ __ testl(rax, polling_page);
+ }
__ ret(0);
}
@@ -661,20 +652,17 @@ void LIR_Assembler::return_op(LIR_Opr result) {
int LIR_Assembler::safepoint_poll(LIR_Opr tmp, CodeEmitInfo* info) {
AddressLiteral polling_page(os::get_polling_page() + (SafepointPollOffset % os::vm_page_size()),
relocInfo::poll_type);
-
- if (info != NULL) {
- add_debug_info_for_branch(info);
- } else {
- ShouldNotReachHere();
- }
-
+ guarantee(info != NULL, "Shouldn't be NULL");
int offset = __ offset();
-
- // NOTE: the requires that the polling page be reachable else the reloc
- // goes to the movq that loads the address and not the faulting instruction
- // which breaks the signal handler code
-
- __ test32(rax, polling_page);
+ if (Assembler::is_polling_page_far()) {
+ __ lea(rscratch1, polling_page);
+ offset = __ offset();
+ add_debug_info_for_branch(info);
+ __ testl(rax, Address(rscratch1, 0));
+ } else {
+ add_debug_info_for_branch(info);
+ __ testl(rax, polling_page);
+ }
return offset;
}
@@ -3114,7 +3102,7 @@ void LIR_Assembler::emit_arraycopy(LIR_OpArrayCopy* op) {
BasicType basic_type = default_type != NULL ? default_type->element_type()->basic_type() : T_ILLEGAL;
if (basic_type == T_ARRAY) basic_type = T_OBJECT;
- // if we don't know anything or it's an object array, just go through the generic arraycopy
+ // if we don't know anything, just go through the generic arraycopy
if (default_type == NULL) {
Label done;
// save outgoing arguments on stack in case call to System.arraycopy is needed
@@ -3135,7 +3123,9 @@ void LIR_Assembler::emit_arraycopy(LIR_OpArrayCopy* op) {
store_parameter(src, 4);
NOT_LP64(assert(src == rcx && src_pos == rdx, "mismatch in calling convention");)
- address entry = CAST_FROM_FN_PTR(address, Runtime1::arraycopy);
+ address C_entry = CAST_FROM_FN_PTR(address, Runtime1::arraycopy);
+
+ address copyfunc_addr = StubRoutines::generic_arraycopy();
// pass arguments: may push as this is not a safepoint; SP must be fix at each safepoint
#ifdef _LP64
@@ -3153,11 +3143,29 @@ void LIR_Assembler::emit_arraycopy(LIR_OpArrayCopy* op) {
// Allocate abi space for args but be sure to keep stack aligned
__ subptr(rsp, 6*wordSize);
store_parameter(j_rarg4, 4);
- __ call(RuntimeAddress(entry));
+ if (copyfunc_addr == NULL) { // Use C version if stub was not generated
+ __ call(RuntimeAddress(C_entry));
+ } else {
+#ifndef PRODUCT
+ if (PrintC1Statistics) {
+ __ incrementl(ExternalAddress((address)&Runtime1::_generic_arraycopystub_cnt));
+ }
+#endif
+ __ call(RuntimeAddress(copyfunc_addr));
+ }
__ addptr(rsp, 6*wordSize);
#else
__ mov(c_rarg4, j_rarg4);
- __ call(RuntimeAddress(entry));
+ if (copyfunc_addr == NULL) { // Use C version if stub was not generated
+ __ call(RuntimeAddress(C_entry));
+ } else {
+#ifndef PRODUCT
+ if (PrintC1Statistics) {
+ __ incrementl(ExternalAddress((address)&Runtime1::_generic_arraycopystub_cnt));
+ }
+#endif
+ __ call(RuntimeAddress(copyfunc_addr));
+ }
#endif // _WIN64
#else
__ push(length);
@@ -3165,13 +3173,28 @@ void LIR_Assembler::emit_arraycopy(LIR_OpArrayCopy* op) {
__ push(dst);
__ push(src_pos);
__ push(src);
- __ call_VM_leaf(entry, 5); // removes pushed parameter from the stack
+
+ if (copyfunc_addr == NULL) { // Use C version if stub was not generated
+ __ call_VM_leaf(C_entry, 5); // removes pushed parameter from the stack
+ } else {
+#ifndef PRODUCT
+ if (PrintC1Statistics) {
+ __ incrementl(ExternalAddress((address)&Runtime1::_generic_arraycopystub_cnt));
+ }
+#endif
+ __ call_VM_leaf(copyfunc_addr, 5); // removes pushed parameter from the stack
+ }
#endif // _LP64
__ cmpl(rax, 0);
__ jcc(Assembler::equal, *stub->continuation());
+ if (copyfunc_addr != NULL) {
+ __ mov(tmp, rax);
+ __ xorl(tmp, -1);
+ }
+
// Reload values from the stack so they are where the stub
// expects them.
__ movptr (dst, Address(rsp, 0*BytesPerWord));
@@ -3179,6 +3202,12 @@ void LIR_Assembler::emit_arraycopy(LIR_OpArrayCopy* op) {
__ movptr (length, Address(rsp, 2*BytesPerWord));
__ movptr (src_pos, Address(rsp, 3*BytesPerWord));
__ movptr (src, Address(rsp, 4*BytesPerWord));
+
+ if (copyfunc_addr != NULL) {
+ __ subl(length, tmp);
+ __ addl(src_pos, tmp);
+ __ addl(dst_pos, tmp);
+ }
__ jmp(*stub->entry());
__ bind(*stub->continuation());
@@ -3238,10 +3267,6 @@ void LIR_Assembler::emit_arraycopy(LIR_OpArrayCopy* op) {
__ testl(dst_pos, dst_pos);
__ jcc(Assembler::less, *stub->entry());
}
- if (flags & LIR_OpArrayCopy::length_positive_check) {
- __ testl(length, length);
- __ jcc(Assembler::less, *stub->entry());
- }
if (flags & LIR_OpArrayCopy::src_range_check) {
__ lea(tmp, Address(src_pos, length, Address::times_1, 0));
@@ -3254,15 +3279,190 @@ void LIR_Assembler::emit_arraycopy(LIR_OpArrayCopy* op) {
__ jcc(Assembler::above, *stub->entry());
}
+ if (flags & LIR_OpArrayCopy::length_positive_check) {
+ __ testl(length, length);
+ __ jcc(Assembler::less, *stub->entry());
+ __ jcc(Assembler::zero, *stub->continuation());
+ }
+
+#ifdef _LP64
+ __ movl2ptr(src_pos, src_pos); //higher 32bits must be null
+ __ movl2ptr(dst_pos, dst_pos); //higher 32bits must be null
+#endif
+
if (flags & LIR_OpArrayCopy::type_check) {
- if (UseCompressedOops) {
- __ movl(tmp, src_klass_addr);
- __ cmpl(tmp, dst_klass_addr);
+ // We don't know the array types are compatible
+ if (basic_type != T_OBJECT) {
+ // Simple test for basic type arrays
+ if (UseCompressedOops) {
+ __ movl(tmp, src_klass_addr);
+ __ cmpl(tmp, dst_klass_addr);
+ } else {
+ __ movptr(tmp, src_klass_addr);
+ __ cmpptr(tmp, dst_klass_addr);
+ }
+ __ jcc(Assembler::notEqual, *stub->entry());
} else {
- __ movptr(tmp, src_klass_addr);
- __ cmpptr(tmp, dst_klass_addr);
+ // For object arrays, if src is a sub class of dst then we can
+ // safely do the copy.
+ Label cont, slow;
+
+ __ push(src);
+ __ push(dst);
+
+ __ load_klass(src, src);
+ __ load_klass(dst, dst);
+
+ __ check_klass_subtype_fast_path(src, dst, tmp, &cont, &slow, NULL);
+
+ __ push(src);
+ __ push(dst);
+ __ call(RuntimeAddress(Runtime1::entry_for(Runtime1::slow_subtype_check_id)));
+ __ pop(dst);
+ __ pop(src);
+
+ __ cmpl(src, 0);
+ __ jcc(Assembler::notEqual, cont);
+
+ __ bind(slow);
+ __ pop(dst);
+ __ pop(src);
+
+ address copyfunc_addr = StubRoutines::checkcast_arraycopy();
+ if (copyfunc_addr != NULL) { // use stub if available
+ // src is not a sub class of dst so we have to do a
+ // per-element check.
+
+ int mask = LIR_OpArrayCopy::src_objarray|LIR_OpArrayCopy::dst_objarray;
+ if ((flags & mask) != mask) {
+ // Check that at least both of them object arrays.
+ assert(flags & mask, "one of the two should be known to be an object array");
+
+ if (!(flags & LIR_OpArrayCopy::src_objarray)) {
+ __ load_klass(tmp, src);
+ } else if (!(flags & LIR_OpArrayCopy::dst_objarray)) {
+ __ load_klass(tmp, dst);
+ }
+ int lh_offset = klassOopDesc::header_size() * HeapWordSize +
+ Klass::layout_helper_offset_in_bytes();
+ Address klass_lh_addr(tmp, lh_offset);
+ jint objArray_lh = Klass::array_layout_helper(T_OBJECT);
+ __ cmpl(klass_lh_addr, objArray_lh);
+ __ jcc(Assembler::notEqual, *stub->entry());
+ }
+
+#ifndef _LP64
+ // save caller save registers
+ store_parameter(rax, 2);
+ store_parameter(rcx, 1);
+ store_parameter(rdx, 0);
+
+ __ movptr(tmp, dst_klass_addr);
+ __ movptr(tmp, Address(tmp, objArrayKlass::element_klass_offset_in_bytes() + sizeof(oopDesc)));
+ __ push(tmp);
+ __ movl(tmp, Address(tmp, Klass::super_check_offset_offset_in_bytes() + sizeof(oopDesc)));
+ __ push(tmp);
+ __ push(length);
+ __ lea(tmp, Address(dst, dst_pos, scale, arrayOopDesc::base_offset_in_bytes(basic_type)));
+ __ push(tmp);
+ __ lea(tmp, Address(src, src_pos, scale, arrayOopDesc::base_offset_in_bytes(basic_type)));
+ __ push(tmp);
+
+ __ call_VM_leaf(copyfunc_addr, 5);
+#else
+ __ movl2ptr(length, length); //higher 32bits must be null
+
+ // save caller save registers: copy them to callee save registers
+ __ mov(rbx, rdx);
+ __ mov(r13, r8);
+ __ mov(r14, r9);
+#ifndef _WIN64
+ store_parameter(rsi, 1);
+ store_parameter(rcx, 0);
+ // on WIN64 other incoming parameters are in rdi and rsi saved
+ // across the call
+#endif
+
+ __ lea(c_rarg0, Address(src, src_pos, scale, arrayOopDesc::base_offset_in_bytes(basic_type)));
+ assert_different_registers(c_rarg0, dst, dst_pos, length);
+ __ lea(c_rarg1, Address(dst, dst_pos, scale, arrayOopDesc::base_offset_in_bytes(basic_type)));
+ assert_different_registers(c_rarg1, dst, length);
+
+ __ mov(c_rarg2, length);
+ assert_different_registers(c_rarg2, dst);
+
+#ifdef _WIN64
+ // Allocate abi space for args but be sure to keep stack aligned
+ __ subptr(rsp, 6*wordSize);
+ __ load_klass(c_rarg3, dst);
+ __ movptr(c_rarg3, Address(c_rarg3, objArrayKlass::element_klass_offset_in_bytes() + sizeof(oopDesc)));
+ store_parameter(c_rarg3, 4);
+ __ movl(c_rarg3, Address(c_rarg3, Klass::super_check_offset_offset_in_bytes() + sizeof(oopDesc)));
+ __ call(RuntimeAddress(copyfunc_addr));
+ __ addptr(rsp, 6*wordSize);
+#else
+ __ load_klass(c_rarg4, dst);
+ __ movptr(c_rarg4, Address(c_rarg4, objArrayKlass::element_klass_offset_in_bytes() + sizeof(oopDesc)));
+ __ movl(c_rarg3, Address(c_rarg4, Klass::super_check_offset_offset_in_bytes() + sizeof(oopDesc)));
+ __ call(RuntimeAddress(copyfunc_addr));
+#endif
+
+#endif
+
+#ifndef PRODUCT
+ if (PrintC1Statistics) {
+ Label failed;
+ __ testl(rax, rax);
+ __ jcc(Assembler::notZero, failed);
+ __ incrementl(ExternalAddress((address)&Runtime1::_arraycopy_checkcast_cnt));
+ __ bind(failed);
+ }
+#endif
+
+ __ testl(rax, rax);
+ __ jcc(Assembler::zero, *stub->continuation());
+
+#ifndef PRODUCT
+ if (PrintC1Statistics) {
+ __ incrementl(ExternalAddress((address)&Runtime1::_arraycopy_checkcast_attempt_cnt));
+ }
+#endif
+
+ __ mov(tmp, rax);
+
+ __ xorl(tmp, -1);
+
+#ifndef _LP64
+ // restore caller save registers
+ assert_different_registers(tmp, rdx, rcx, rax); // result of stub will be lost
+ __ movptr(rdx, Address(rsp, 0*BytesPerWord));
+ __ movptr(rcx, Address(rsp, 1*BytesPerWord));
+ __ movptr(rax, Address(rsp, 2*BytesPerWord));
+#else
+ // restore caller save registers
+ __ mov(rdx, rbx);
+ __ mov(r8, r13);
+ __ mov(r9, r14);
+#ifndef _WIN64
+ assert_different_registers(tmp, rdx, r8, r9, rcx, rsi); // result of stub will be lost
+ __ movptr(rcx, Address(rsp, 0*BytesPerWord));
+ __ movptr(rsi, Address(rsp, 1*BytesPerWord));
+#else
+ assert_different_registers(tmp, rdx, r8, r9); // result of stub will be lost
+#endif
+#endif
+
+ __ subl(length, tmp);
+ __ addl(src_pos, tmp);
+ __ addl(dst_pos, tmp);
+ }
+
+ __ jmp(*stub->entry());
+
+ __ bind(cont);
+ __ pop(dst);
+ __ pop(src);
}
- __ jcc(Assembler::notEqual, *stub->entry());
}
#ifdef ASSERT
@@ -3303,16 +3503,16 @@ void LIR_Assembler::emit_arraycopy(LIR_OpArrayCopy* op) {
}
#endif
- if (shift_amount > 0 && basic_type != T_OBJECT) {
- __ shlptr(length, shift_amount);
+#ifndef PRODUCT
+ if (PrintC1Statistics) {
+ __ incrementl(ExternalAddress(Runtime1::arraycopy_count_address(basic_type)));
}
+#endif
#ifdef _LP64
assert_different_registers(c_rarg0, dst, dst_pos, length);
- __ movl2ptr(src_pos, src_pos); //higher 32bits must be null
__ lea(c_rarg0, Address(src, src_pos, scale, arrayOopDesc::base_offset_in_bytes(basic_type)));
assert_different_registers(c_rarg1, length);
- __ movl2ptr(dst_pos, dst_pos); //higher 32bits must be null
__ lea(c_rarg1, Address(dst, dst_pos, scale, arrayOopDesc::base_offset_in_bytes(basic_type)));
__ mov(c_rarg2, length);
@@ -3323,11 +3523,12 @@ void LIR_Assembler::emit_arraycopy(LIR_OpArrayCopy* op) {
store_parameter(tmp, 1);
store_parameter(length, 2);
#endif // _LP64
- if (basic_type == T_OBJECT) {
- __ call_VM_leaf(CAST_FROM_FN_PTR(address, Runtime1::oop_arraycopy), 0);
- } else {
- __ call_VM_leaf(CAST_FROM_FN_PTR(address, Runtime1::primitive_arraycopy), 0);
- }
+
+ bool disjoint = (flags & LIR_OpArrayCopy::overlapping) == 0;
+ bool aligned = (flags & LIR_OpArrayCopy::unaligned) == 0;
+ const char *name;
+ address entry = StubRoutines::select_arraycopy_function(basic_type, aligned, disjoint, name, false);
+ __ call_VM_leaf(entry, 0);
__ bind(*stub->continuation());
}
diff --git a/hotspot/src/cpu/x86/vm/c1_Runtime1_x86.cpp b/hotspot/src/cpu/x86/vm/c1_Runtime1_x86.cpp
index 241e0899342..055bb93c4cd 100644
--- a/hotspot/src/cpu/x86/vm/c1_Runtime1_x86.cpp
+++ b/hotspot/src/cpu/x86/vm/c1_Runtime1_x86.cpp
@@ -23,6 +23,7 @@
*/
#include "precompiled.hpp"
+#include "asm/assembler.hpp"
#include "c1/c1_Defs.hpp"
#include "c1/c1_MacroAssembler.hpp"
#include "c1/c1_Runtime1.hpp"
diff --git a/hotspot/src/cpu/x86/vm/frame_x86.hpp b/hotspot/src/cpu/x86/vm/frame_x86.hpp
index d949e250c59..ea92dc518cc 100644
--- a/hotspot/src/cpu/x86/vm/frame_x86.hpp
+++ b/hotspot/src/cpu/x86/vm/frame_x86.hpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2011, 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
@@ -125,7 +125,7 @@
// Entry frames
#ifdef AMD64
#ifdef _WIN64
- entry_frame_after_call_words = 8,
+ entry_frame_after_call_words = 28,
entry_frame_call_wrapper_offset = 2,
arg_reg_save_area_bytes = 32, // Register argument save area
diff --git a/hotspot/src/cpu/x86/vm/interp_masm_x86_32.cpp b/hotspot/src/cpu/x86/vm/interp_masm_x86_32.cpp
index 33daeac2441..e0d5cf03ca5 100644
--- a/hotspot/src/cpu/x86/vm/interp_masm_x86_32.cpp
+++ b/hotspot/src/cpu/x86/vm/interp_masm_x86_32.cpp
@@ -215,7 +215,7 @@ void InterpreterMacroAssembler::get_cache_index_at_bcp(Register reg, int bcp_off
if (index_size == sizeof(u2)) {
load_unsigned_short(reg, Address(rsi, bcp_offset));
} else if (index_size == sizeof(u4)) {
- assert(EnableInvokeDynamic, "giant index used only for EnableInvokeDynamic");
+ assert(EnableInvokeDynamic, "giant index used only for JSR 292");
movl(reg, Address(rsi, bcp_offset));
// Check if the secondary index definition is still ~x, otherwise
// we have to change the following assembler code to calculate the
@@ -223,7 +223,7 @@ void InterpreterMacroAssembler::get_cache_index_at_bcp(Register reg, int bcp_off
assert(constantPoolCacheOopDesc::decode_secondary_index(~123) == 123, "else change next line");
notl(reg); // convert to plain index
} else if (index_size == sizeof(u1)) {
- assert(EnableMethodHandles, "tiny index used only for EnableMethodHandles");
+ assert(EnableInvokeDynamic, "tiny index used only for JSR 292");
load_unsigned_byte(reg, Address(rsi, bcp_offset));
} else {
ShouldNotReachHere();
diff --git a/hotspot/src/cpu/x86/vm/interp_masm_x86_64.cpp b/hotspot/src/cpu/x86/vm/interp_masm_x86_64.cpp
index 3c235ce2190..428281d00f7 100644
--- a/hotspot/src/cpu/x86/vm/interp_masm_x86_64.cpp
+++ b/hotspot/src/cpu/x86/vm/interp_masm_x86_64.cpp
@@ -213,7 +213,7 @@ void InterpreterMacroAssembler::get_cache_index_at_bcp(Register index,
if (index_size == sizeof(u2)) {
load_unsigned_short(index, Address(r13, bcp_offset));
} else if (index_size == sizeof(u4)) {
- assert(EnableInvokeDynamic, "giant index used only for EnableInvokeDynamic");
+ assert(EnableInvokeDynamic, "giant index used only for JSR 292");
movl(index, Address(r13, bcp_offset));
// Check if the secondary index definition is still ~x, otherwise
// we have to change the following assembler code to calculate the
@@ -221,7 +221,7 @@ void InterpreterMacroAssembler::get_cache_index_at_bcp(Register index,
assert(constantPoolCacheOopDesc::decode_secondary_index(~123) == 123, "else change next line");
notl(index); // convert to plain index
} else if (index_size == sizeof(u1)) {
- assert(EnableMethodHandles, "tiny index used only for EnableMethodHandles");
+ assert(EnableInvokeDynamic, "tiny index used only for JSR 292");
load_unsigned_byte(index, Address(r13, bcp_offset));
} else {
ShouldNotReachHere();
diff --git a/hotspot/src/cpu/x86/vm/interpreter_x86_32.cpp b/hotspot/src/cpu/x86/vm/interpreter_x86_32.cpp
index 6261c81cd64..cb2345a4183 100644
--- a/hotspot/src/cpu/x86/vm/interpreter_x86_32.cpp
+++ b/hotspot/src/cpu/x86/vm/interpreter_x86_32.cpp
@@ -233,7 +233,7 @@ address InterpreterGenerator::generate_abstract_entry(void) {
// Method handle invoker
// Dispatch a method of the form java.lang.invoke.MethodHandles::invoke(...)
address InterpreterGenerator::generate_method_handle_entry(void) {
- if (!EnableMethodHandles) {
+ if (!EnableInvokeDynamic) {
return generate_abstract_entry();
}
diff --git a/hotspot/src/cpu/x86/vm/interpreter_x86_64.cpp b/hotspot/src/cpu/x86/vm/interpreter_x86_64.cpp
index 8d46c93490c..3dbea5754dc 100644
--- a/hotspot/src/cpu/x86/vm/interpreter_x86_64.cpp
+++ b/hotspot/src/cpu/x86/vm/interpreter_x86_64.cpp
@@ -320,7 +320,7 @@ address InterpreterGenerator::generate_abstract_entry(void) {
// Method handle invoker
// Dispatch a method of the form java.lang.invoke.MethodHandles::invoke(...)
address InterpreterGenerator::generate_method_handle_entry(void) {
- if (!EnableMethodHandles) {
+ if (!EnableInvokeDynamic) {
return generate_abstract_entry();
}
diff --git a/hotspot/src/cpu/x86/vm/jni_x86.h b/hotspot/src/cpu/x86/vm/jni_x86.h
index 9715d0e3237..d06bb5ca247 100644
--- a/hotspot/src/cpu/x86/vm/jni_x86.h
+++ b/hotspot/src/cpu/x86/vm/jni_x86.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2011, 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
diff --git a/hotspot/src/cpu/x86/vm/nativeInst_x86.hpp b/hotspot/src/cpu/x86/vm/nativeInst_x86.hpp
index d41bcccdb31..fc7a1ab0753 100644
--- a/hotspot/src/cpu/x86/vm/nativeInst_x86.hpp
+++ b/hotspot/src/cpu/x86/vm/nativeInst_x86.hpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2011, 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
@@ -519,7 +519,11 @@ class NativeReturnX: public NativeInstruction {
class NativeTstRegMem: public NativeInstruction {
public:
enum Intel_specific_constants {
- instruction_code_memXregl = 0x85
+ instruction_rex_prefix_mask = 0xF0,
+ instruction_rex_prefix = Assembler::REX,
+ instruction_code_memXregl = 0x85,
+ modrm_mask = 0x38, // select reg from the ModRM byte
+ modrm_reg = 0x00 // rax
};
};
@@ -533,12 +537,25 @@ inline bool NativeInstruction::is_cond_jump() { return (int_at(0) & 0xF0FF) =
(ubyte_at(0) & 0xF0) == 0x70; /* short jump */ }
inline bool NativeInstruction::is_safepoint_poll() {
#ifdef AMD64
- if ( ubyte_at(0) == NativeTstRegMem::instruction_code_memXregl &&
- ubyte_at(1) == 0x05 ) { // 00 rax 101
- address fault = addr_at(6) + int_at(2);
- return os::is_poll_address(fault);
+ if (Assembler::is_polling_page_far()) {
+ // two cases, depending on the choice of the base register in the address.
+ if (((ubyte_at(0) & NativeTstRegMem::instruction_rex_prefix_mask) == NativeTstRegMem::instruction_rex_prefix &&
+ ubyte_at(1) == NativeTstRegMem::instruction_code_memXregl &&
+ (ubyte_at(2) & NativeTstRegMem::modrm_mask) == NativeTstRegMem::modrm_reg) ||
+ ubyte_at(0) == NativeTstRegMem::instruction_code_memXregl &&
+ (ubyte_at(1) & NativeTstRegMem::modrm_mask) == NativeTstRegMem::modrm_reg) {
+ return true;
+ } else {
+ return false;
+ }
} else {
- return false;
+ if (ubyte_at(0) == NativeTstRegMem::instruction_code_memXregl &&
+ ubyte_at(1) == 0x05) { // 00 rax 101
+ address fault = addr_at(6) + int_at(2);
+ return os::is_poll_address(fault);
+ } else {
+ return false;
+ }
}
#else
return ( ubyte_at(0) == NativeMovRegMem::instruction_code_mem2reg ||
diff --git a/hotspot/src/cpu/x86/vm/relocInfo_x86.cpp b/hotspot/src/cpu/x86/vm/relocInfo_x86.cpp
index 1f907533d48..67c98e26ce9 100644
--- a/hotspot/src/cpu/x86/vm/relocInfo_x86.cpp
+++ b/hotspot/src/cpu/x86/vm/relocInfo_x86.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1998, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 2011, 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
@@ -198,41 +198,44 @@ void Relocation::pd_swap_out_breakpoint(address x, short* instrs, int instrlen)
void poll_Relocation::fix_relocation_after_move(const CodeBuffer* src, CodeBuffer* dest) {
#ifdef _LP64
- typedef Assembler::WhichOperand WhichOperand;
- WhichOperand which = (WhichOperand) format();
- // This format is imm but it is really disp32
- which = Assembler::disp32_operand;
- address orig_addr = old_addr_for(addr(), src, dest);
- NativeInstruction* oni = nativeInstruction_at(orig_addr);
- int32_t* orig_disp = (int32_t*) Assembler::locate_operand(orig_addr, which);
- // This poll_addr is incorrect by the size of the instruction it is irrelevant
- intptr_t poll_addr = (intptr_t)oni + *orig_disp;
+ if (!Assembler::is_polling_page_far()) {
+ typedef Assembler::WhichOperand WhichOperand;
+ WhichOperand which = (WhichOperand) format();
+ // This format is imm but it is really disp32
+ which = Assembler::disp32_operand;
+ address orig_addr = old_addr_for(addr(), src, dest);
+ NativeInstruction* oni = nativeInstruction_at(orig_addr);
+ int32_t* orig_disp = (int32_t*) Assembler::locate_operand(orig_addr, which);
+ // This poll_addr is incorrect by the size of the instruction it is irrelevant
+ intptr_t poll_addr = (intptr_t)oni + *orig_disp;
- NativeInstruction* ni = nativeInstruction_at(addr());
- intptr_t new_disp = poll_addr - (intptr_t) ni;
-
- int32_t* disp = (int32_t*) Assembler::locate_operand(addr(), which);
- * disp = (int32_t)new_disp;
+ NativeInstruction* ni = nativeInstruction_at(addr());
+ intptr_t new_disp = poll_addr - (intptr_t) ni;
+ int32_t* disp = (int32_t*) Assembler::locate_operand(addr(), which);
+ * disp = (int32_t)new_disp;
+ }
#endif // _LP64
}
void poll_return_Relocation::fix_relocation_after_move(const CodeBuffer* src, CodeBuffer* dest) {
#ifdef _LP64
- typedef Assembler::WhichOperand WhichOperand;
- WhichOperand which = (WhichOperand) format();
- // This format is imm but it is really disp32
- which = Assembler::disp32_operand;
- address orig_addr = old_addr_for(addr(), src, dest);
- NativeInstruction* oni = nativeInstruction_at(orig_addr);
- int32_t* orig_disp = (int32_t*) Assembler::locate_operand(orig_addr, which);
- // This poll_addr is incorrect by the size of the instruction it is irrelevant
- intptr_t poll_addr = (intptr_t)oni + *orig_disp;
+ if (!Assembler::is_polling_page_far()) {
+ typedef Assembler::WhichOperand WhichOperand;
+ WhichOperand which = (WhichOperand) format();
+ // This format is imm but it is really disp32
+ which = Assembler::disp32_operand;
+ address orig_addr = old_addr_for(addr(), src, dest);
+ NativeInstruction* oni = nativeInstruction_at(orig_addr);
+ int32_t* orig_disp = (int32_t*) Assembler::locate_operand(orig_addr, which);
+ // This poll_addr is incorrect by the size of the instruction it is irrelevant
+ intptr_t poll_addr = (intptr_t)oni + *orig_disp;
- NativeInstruction* ni = nativeInstruction_at(addr());
- intptr_t new_disp = poll_addr - (intptr_t) ni;
+ NativeInstruction* ni = nativeInstruction_at(addr());
+ intptr_t new_disp = poll_addr - (intptr_t) ni;
- int32_t* disp = (int32_t*) Assembler::locate_operand(addr(), which);
- * disp = (int32_t)new_disp;
+ int32_t* disp = (int32_t*) Assembler::locate_operand(addr(), which);
+ * disp = (int32_t)new_disp;
+ }
#endif // _LP64
}
diff --git a/hotspot/src/cpu/x86/vm/sharedRuntime_x86_32.cpp b/hotspot/src/cpu/x86/vm/sharedRuntime_x86_32.cpp
index 181d4c2c62c..149bc7c9ea4 100644
--- a/hotspot/src/cpu/x86/vm/sharedRuntime_x86_32.cpp
+++ b/hotspot/src/cpu/x86/vm/sharedRuntime_x86_32.cpp
@@ -1111,6 +1111,7 @@ void SharedRuntime::restore_native_result(MacroAssembler *masm, BasicType ret_ty
// returns.
nmethod *SharedRuntime::generate_native_wrapper(MacroAssembler *masm,
methodHandle method,
+ int compile_id,
int total_in_args,
int comp_args_on_stack,
BasicType *in_sig_bt,
@@ -1854,6 +1855,7 @@ nmethod *SharedRuntime::generate_native_wrapper(MacroAssembler *masm,
__ flush();
nmethod *nm = nmethod::new_native_nmethod(method,
+ compile_id,
masm->code(),
vep_offset,
frame_complete,
diff --git a/hotspot/src/cpu/x86/vm/sharedRuntime_x86_64.cpp b/hotspot/src/cpu/x86/vm/sharedRuntime_x86_64.cpp
index dea7fb948da..c017cf86d47 100644
--- a/hotspot/src/cpu/x86/vm/sharedRuntime_x86_64.cpp
+++ b/hotspot/src/cpu/x86/vm/sharedRuntime_x86_64.cpp
@@ -1174,6 +1174,7 @@ static void restore_args(MacroAssembler *masm, int arg_count, int first_arg, VMR
// returns.
nmethod *SharedRuntime::generate_native_wrapper(MacroAssembler *masm,
methodHandle method,
+ int compile_id,
int total_in_args,
int comp_args_on_stack,
BasicType *in_sig_bt,
@@ -1881,6 +1882,7 @@ nmethod *SharedRuntime::generate_native_wrapper(MacroAssembler *masm,
__ flush();
nmethod *nm = nmethod::new_native_nmethod(method,
+ compile_id,
masm->code(),
vep_offset,
frame_complete,
diff --git a/hotspot/src/cpu/x86/vm/stubGenerator_x86_64.cpp b/hotspot/src/cpu/x86/vm/stubGenerator_x86_64.cpp
index 49181238c69..c16f642631c 100644
--- a/hotspot/src/cpu/x86/vm/stubGenerator_x86_64.cpp
+++ b/hotspot/src/cpu/x86/vm/stubGenerator_x86_64.cpp
@@ -144,8 +144,11 @@ class StubGenerator: public StubCodeGenerator {
// [ return_from_Java ] <--- rsp
// [ argument word n ]
// ...
- // -8 [ argument word 1 ]
- // -7 [ saved r15 ] <--- rsp_after_call
+ // -28 [ argument word 1 ]
+ // -27 [ saved xmm15 ] <--- rsp_after_call
+ // [ saved xmm7-xmm14 ]
+ // -9 [ saved xmm6 ] (each xmm register takes 2 slots)
+ // -7 [ saved r15 ]
// -6 [ saved r14 ]
// -5 [ saved r13 ]
// -4 [ saved r12 ]
@@ -169,8 +172,11 @@ class StubGenerator: public StubCodeGenerator {
// Call stub stack layout word offsets from rbp
enum call_stub_layout {
#ifdef _WIN64
- rsp_after_call_off = -7,
- r15_off = rsp_after_call_off,
+ xmm_save_first = 6, // save from xmm6
+ xmm_save_last = 15, // to xmm15
+ xmm_save_base = -9,
+ rsp_after_call_off = xmm_save_base - 2 * (xmm_save_last - xmm_save_first), // -27
+ r15_off = -7,
r14_off = -6,
r13_off = -5,
r12_off = -4,
@@ -208,6 +214,13 @@ class StubGenerator: public StubCodeGenerator {
#endif
};
+#ifdef _WIN64
+ Address xmm_save(int reg) {
+ assert(reg >= xmm_save_first && reg <= xmm_save_last, "XMM register number out of range");
+ return Address(rbp, (xmm_save_base - (reg - xmm_save_first) * 2) * wordSize);
+ }
+#endif
+
address generate_call_stub(address& return_address) {
assert((int)frame::entry_frame_after_call_words == -(int)rsp_after_call_off + 1 &&
(int)frame::entry_frame_call_wrapper_offset == (int)call_wrapper_off,
@@ -256,8 +269,11 @@ class StubGenerator: public StubCodeGenerator {
__ movptr(r13_save, r13);
__ movptr(r14_save, r14);
__ movptr(r15_save, r15);
-
#ifdef _WIN64
+ for (int i = 6; i <= 15; i++) {
+ __ movdqu(xmm_save(i), as_XMMRegister(i));
+ }
+
const Address rdi_save(rbp, rdi_off * wordSize);
const Address rsi_save(rbp, rsi_off * wordSize);
@@ -360,6 +376,11 @@ class StubGenerator: public StubCodeGenerator {
#endif
// restore regs belonging to calling function
+#ifdef _WIN64
+ for (int i = 15; i >= 6; i--) {
+ __ movdqu(as_XMMRegister(i), xmm_save(i));
+ }
+#endif
__ movptr(r15, r15_save);
__ movptr(r14, r14_save);
__ movptr(r13, r13_save);
@@ -2428,8 +2449,8 @@ class StubGenerator: public StubCodeGenerator {
//
address generate_generic_copy(const char *name,
address byte_copy_entry, address short_copy_entry,
- address int_copy_entry, address long_copy_entry,
- address oop_copy_entry, address checkcast_copy_entry) {
+ address int_copy_entry, address oop_copy_entry,
+ address long_copy_entry, address checkcast_copy_entry) {
Label L_failed, L_failed_0, L_objArray;
Label L_copy_bytes, L_copy_shorts, L_copy_ints, L_copy_longs;
diff --git a/hotspot/src/cpu/x86/vm/templateInterpreter_x86_32.cpp b/hotspot/src/cpu/x86/vm/templateInterpreter_x86_32.cpp
index c3f20290e2b..ecfe26e0031 100644
--- a/hotspot/src/cpu/x86/vm/templateInterpreter_x86_32.cpp
+++ b/hotspot/src/cpu/x86/vm/templateInterpreter_x86_32.cpp
@@ -1527,7 +1527,7 @@ int AbstractInterpreter::layout_activation(methodOop method,
if (interpreter_frame != NULL) {
#ifdef ASSERT
- if (!EnableMethodHandles)
+ if (!EnableInvokeDynamic)
// @@@ FIXME: Should we correct interpreter_frame_sender_sp in the calling sequences?
// Probably, since deoptimization doesn't work yet.
assert(caller->unextended_sp() == interpreter_frame->interpreter_frame_sender_sp(), "Frame not properly walkable");
diff --git a/hotspot/src/cpu/x86/vm/templateInterpreter_x86_64.cpp b/hotspot/src/cpu/x86/vm/templateInterpreter_x86_64.cpp
index 69ea49e8a88..6051aecb666 100644
--- a/hotspot/src/cpu/x86/vm/templateInterpreter_x86_64.cpp
+++ b/hotspot/src/cpu/x86/vm/templateInterpreter_x86_64.cpp
@@ -1541,7 +1541,7 @@ int AbstractInterpreter::layout_activation(methodOop method,
tempcount* Interpreter::stackElementWords + popframe_extra_args;
if (interpreter_frame != NULL) {
#ifdef ASSERT
- if (!EnableMethodHandles)
+ if (!EnableInvokeDynamic)
// @@@ FIXME: Should we correct interpreter_frame_sender_sp in the calling sequences?
// Probably, since deoptimization doesn't work yet.
assert(caller->unextended_sp() == interpreter_frame->interpreter_frame_sender_sp(), "Frame not properly walkable");
diff --git a/hotspot/src/cpu/x86/vm/templateTable_x86_32.cpp b/hotspot/src/cpu/x86/vm/templateTable_x86_32.cpp
index 73ed5182d8e..b152f698cfd 100644
--- a/hotspot/src/cpu/x86/vm/templateTable_x86_32.cpp
+++ b/hotspot/src/cpu/x86/vm/templateTable_x86_32.cpp
@@ -23,6 +23,7 @@
*/
#include "precompiled.hpp"
+#include "asm/assembler.hpp"
#include "interpreter/interpreter.hpp"
#include "interpreter/interpreterRuntime.hpp"
#include "interpreter/templateTable.hpp"
@@ -391,8 +392,8 @@ void TemplateTable::ldc(bool wide) {
void TemplateTable::fast_aldc(bool wide) {
transition(vtos, atos);
- if (!EnableMethodHandles) {
- // We should not encounter this bytecode if !EnableMethodHandles.
+ if (!EnableInvokeDynamic) {
+ // We should not encounter this bytecode if !EnableInvokeDynamic.
// The verifier will stop it. However, if we get past the verifier,
// this will stop the thread in a reasonable way, without crashing the JVM.
__ call_VM(noreg, CAST_FROM_FN_PTR(address,
@@ -1939,18 +1940,10 @@ void TemplateTable::fast_binaryswitch() {
__ movl(temp, Address(array, h, Address::times_8, 0*wordSize));
__ bswapl(temp);
__ cmpl(key, temp);
- if (VM_Version::supports_cmov()) {
- __ cmovl(Assembler::less , j, h); // j = h if (key < array[h].fast_match())
- __ cmovl(Assembler::greaterEqual, i, h); // i = h if (key >= array[h].fast_match())
- } else {
- Label set_i, end_of_if;
- __ jccb(Assembler::greaterEqual, set_i); // {
- __ mov(j, h); // j = h;
- __ jmp(end_of_if); // }
- __ bind(set_i); // else {
- __ mov(i, h); // i = h;
- __ bind(end_of_if); // }
- }
+ // j = h if (key < array[h].fast_match())
+ __ cmov32(Assembler::less , j, h);
+ // i = h if (key >= array[h].fast_match())
+ __ cmov32(Assembler::greaterEqual, i, h);
// while (i+1 < j)
__ bind(entry);
__ leal(h, Address(i, 1)); // i+1
@@ -3478,22 +3471,14 @@ void TemplateTable::monitorenter() {
// find a free slot in the monitor block (result in rdx)
{ Label entry, loop, exit;
- __ movptr(rcx, monitor_block_top); // points to current entry, starting with top-most entry
- __ lea(rbx, monitor_block_bot); // points to word before bottom of monitor block
+ __ movptr(rcx, monitor_block_top); // points to current entry, starting with top-most entry
+
+ __ lea(rbx, monitor_block_bot); // points to word before bottom of monitor block
__ jmpb(entry);
__ bind(loop);
__ cmpptr(Address(rcx, BasicObjectLock::obj_offset_in_bytes()), (int32_t)NULL_WORD); // check if current entry is used
-
-// TODO - need new func here - kbt
- if (VM_Version::supports_cmov()) {
- __ cmov(Assembler::equal, rdx, rcx); // if not used then remember entry in rdx
- } else {
- Label L;
- __ jccb(Assembler::notEqual, L);
- __ mov(rdx, rcx); // if not used then remember entry in rdx
- __ bind(L);
- }
+ __ cmovptr(Assembler::equal, rdx, rcx); // if not used then remember entry in rdx
__ cmpptr(rax, Address(rcx, BasicObjectLock::obj_offset_in_bytes())); // check if current entry is for same object
__ jccb(Assembler::equal, exit); // if same object then stop searching
__ addptr(rcx, entry_size); // otherwise advance to next entry
diff --git a/hotspot/src/cpu/x86/vm/templateTable_x86_64.cpp b/hotspot/src/cpu/x86/vm/templateTable_x86_64.cpp
index 2638cbc7d4c..64385a7d54c 100644
--- a/hotspot/src/cpu/x86/vm/templateTable_x86_64.cpp
+++ b/hotspot/src/cpu/x86/vm/templateTable_x86_64.cpp
@@ -405,8 +405,8 @@ void TemplateTable::ldc(bool wide) {
void TemplateTable::fast_aldc(bool wide) {
transition(vtos, atos);
- if (!EnableMethodHandles) {
- // We should not encounter this bytecode if !EnableMethodHandles.
+ if (!EnableInvokeDynamic) {
+ // We should not encounter this bytecode if !EnableInvokeDynamic.
// The verifier will stop it. However, if we get past the verifier,
// this will stop the thread in a reasonable way, without crashing the JVM.
__ call_VM(noreg, CAST_FROM_FN_PTR(address,
diff --git a/hotspot/src/cpu/x86/vm/vm_version_x86.cpp b/hotspot/src/cpu/x86/vm/vm_version_x86.cpp
index 3321d54860c..fa2084450ba 100644
--- a/hotspot/src/cpu/x86/vm/vm_version_x86.cpp
+++ b/hotspot/src/cpu/x86/vm/vm_version_x86.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All Rights Reserved.
+ * Copyright (c) 1997, 2011, 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
@@ -429,6 +429,11 @@ void VM_Version::get_processor_features() {
UseXmmI2D = false;
}
}
+ if( FLAG_IS_DEFAULT(UseSSE42Intrinsics) ) {
+ if( supports_sse4_2() && UseSSE >= 4 ) {
+ UseSSE42Intrinsics = true;
+ }
+ }
// Use count leading zeros count instruction if available.
if (supports_lzcnt()) {
diff --git a/hotspot/src/cpu/x86/vm/x86_32.ad b/hotspot/src/cpu/x86/vm/x86_32.ad
index 6fdb24f931e..e9cf81147b7 100644
--- a/hotspot/src/cpu/x86/vm/x86_32.ad
+++ b/hotspot/src/cpu/x86/vm/x86_32.ad
@@ -1393,6 +1393,10 @@ const int Matcher::init_array_short_size = 8 * BytesPerLong;
// registers? True for Intel but false for most RISCs
const bool Matcher::clone_shift_expressions = true;
+// Do we need to mask the count passed to shift instructions or does
+// the cpu only look at the lower 5/6 bits anyway?
+const bool Matcher::need_masked_shift_count = false;
+
bool Matcher::narrow_oop_use_complex_address() {
ShouldNotCallThis();
return true;
diff --git a/hotspot/src/cpu/x86/vm/x86_64.ad b/hotspot/src/cpu/x86/vm/x86_64.ad
index 2466269c6bd..a4ec7f6cfbf 100644
--- a/hotspot/src/cpu/x86/vm/x86_64.ad
+++ b/hotspot/src/cpu/x86/vm/x86_64.ad
@@ -574,12 +574,11 @@ int MachCallDynamicJavaNode::ret_addr_offset()
// In os_cpu .ad file
// int MachCallRuntimeNode::ret_addr_offset()
-// Indicate if the safepoint node needs the polling page as an input.
-// Since amd64 does not have absolute addressing but RIP-relative
-// addressing and the polling page is within 2G, it doesn't.
+// Indicate if the safepoint node needs the polling page as an input,
+// it does if the polling page is more than disp32 away.
bool SafePointNode::needs_polling_address_input()
{
- return false;
+ return Assembler::is_polling_page_far();
}
//
@@ -992,15 +991,21 @@ void MachEpilogNode::format(PhaseRegAlloc* ra_, outputStream* st) const
framesize -= 2*wordSize;
if (framesize) {
- st->print_cr("addq\trsp, %d\t# Destroy frame", framesize);
+ st->print_cr("addq rsp, %d\t# Destroy frame", framesize);
st->print("\t");
}
- st->print_cr("popq\trbp");
+ st->print_cr("popq rbp");
if (do_polling() && C->is_method_compilation()) {
- st->print_cr("\ttestl\trax, [rip + #offset_to_poll_page]\t"
- "# Safepoint: poll for GC");
st->print("\t");
+ if (Assembler::is_polling_page_far()) {
+ st->print_cr("movq rscratch1, #polling_page_address\n\t"
+ "testl rax, [rscratch1]\t"
+ "# Safepoint: poll for GC");
+ } else {
+ st->print_cr("testl rax, [rip + #offset_to_poll_page]\t"
+ "# Safepoint: poll for GC");
+ }
}
}
#endif
@@ -1033,45 +1038,22 @@ void MachEpilogNode::emit(CodeBuffer& cbuf, PhaseRegAlloc* ra_) const
emit_opcode(cbuf, 0x58 | RBP_enc);
if (do_polling() && C->is_method_compilation()) {
- // testl %rax, off(%rip) // Opcode + ModRM + Disp32 == 6 bytes
- // XXX reg_mem doesn't support RIP-relative addressing yet
- cbuf.set_insts_mark();
- cbuf.relocate(cbuf.insts_mark(), relocInfo::poll_return_type, 0); // XXX
- emit_opcode(cbuf, 0x85); // testl
- emit_rm(cbuf, 0x0, RAX_enc, 0x5); // 00 rax 101 == 0x5
- // cbuf.insts_mark() is beginning of instruction
- emit_d32_reloc(cbuf, os::get_polling_page());
-// relocInfo::poll_return_type,
+ MacroAssembler _masm(&cbuf);
+ AddressLiteral polling_page(os::get_polling_page(), relocInfo::poll_return_type);
+ if (Assembler::is_polling_page_far()) {
+ __ lea(rscratch1, polling_page);
+ __ relocate(relocInfo::poll_return_type);
+ __ testl(rax, Address(rscratch1, 0));
+ } else {
+ __ testl(rax, polling_page);
+ }
}
}
uint MachEpilogNode::size(PhaseRegAlloc* ra_) const
{
- Compile* C = ra_->C;
- int framesize = C->frame_slots() << LogBytesPerInt;
- assert((framesize & (StackAlignmentInBytes-1)) == 0, "frame size not aligned");
- // Remove word for return adr already pushed
- // and RBP
- framesize -= 2*wordSize;
-
- uint size = 0;
-
- if (do_polling() && C->is_method_compilation()) {
- size += 6;
- }
-
- // count popq rbp
- size++;
-
- if (framesize) {
- if (framesize < 0x80) {
- size += 4;
- } else if (framesize) {
- size += 7;
- }
- }
-
- return size;
+ return MachNode::size(ra_); // too many variables; just compute it
+ // the hard way
}
int MachEpilogNode::reloc() const
@@ -2000,6 +1982,10 @@ const int Matcher::init_array_short_size = 8 * BytesPerLong;
// into registers? True for Intel but false for most RISCs
const bool Matcher::clone_shift_expressions = true;
+// Do we need to mask the count passed to shift instructions or does
+// the cpu only look at the lower 5/6 bits anyway?
+const bool Matcher::need_masked_shift_count = false;
+
bool Matcher::narrow_oop_use_complex_address() {
assert(UseCompressedOops, "only for compressed oops code");
return (LogMinObjAlignmentInBytes <= 3);
@@ -3406,8 +3392,8 @@ encode %{
}
if (EmitSync & 1) {
// Without cast to int32_t a movptr will destroy r10 which is typically obj
- masm.movptr (Address(boxReg, 0), (int32_t)intptr_t(markOopDesc::unused_mark())) ;
- masm.cmpptr(rsp, (int32_t)NULL_WORD) ;
+ masm.movptr (Address(boxReg, 0), (int32_t)intptr_t(markOopDesc::unused_mark())) ;
+ masm.cmpptr(rsp, (int32_t)NULL_WORD) ;
} else
if (EmitSync & 2) {
Label DONE_LABEL;
@@ -3435,10 +3421,10 @@ encode %{
} else {
Label DONE_LABEL, IsInflated, Egress;
- masm.movptr(tmpReg, Address(objReg, 0)) ;
+ masm.movptr(tmpReg, Address(objReg, 0)) ;
masm.testl (tmpReg, 0x02) ; // inflated vs stack-locked|neutral|biased
- masm.jcc (Assembler::notZero, IsInflated) ;
-
+ masm.jcc (Assembler::notZero, IsInflated) ;
+
// it's stack-locked, biased or neutral
// TODO: optimize markword triage order to reduce the number of
// conditional branches in the most common cases.
@@ -3452,9 +3438,9 @@ encode %{
}
// was q will it destroy high?
- masm.orl (tmpReg, 1) ;
- masm.movptr(Address(boxReg, 0), tmpReg) ;
- if (os::is_MP()) { masm.lock(); }
+ masm.orl (tmpReg, 1) ;
+ masm.movptr(Address(boxReg, 0), tmpReg) ;
+ if (os::is_MP()) { masm.lock(); }
masm.cmpxchgptr(boxReg, Address(objReg, 0)); // Updates tmpReg
if (_counters != NULL) {
masm.cond_inc32(Assembler::equal,
@@ -3481,16 +3467,16 @@ encode %{
// fetched _owner. If the CAS is successful we may
// avoid an RTO->RTS upgrade on the $line.
// Without cast to int32_t a movptr will destroy r10 which is typically obj
- masm.movptr(Address(boxReg, 0), (int32_t)intptr_t(markOopDesc::unused_mark())) ;
+ masm.movptr(Address(boxReg, 0), (int32_t)intptr_t(markOopDesc::unused_mark())) ;
- masm.mov (boxReg, tmpReg) ;
- masm.movptr (tmpReg, Address(tmpReg, ObjectMonitor::owner_offset_in_bytes()-2)) ;
- masm.testptr(tmpReg, tmpReg) ;
- masm.jcc (Assembler::notZero, DONE_LABEL) ;
+ masm.mov (boxReg, tmpReg) ;
+ masm.movptr (tmpReg, Address(tmpReg, ObjectMonitor::owner_offset_in_bytes()-2)) ;
+ masm.testptr(tmpReg, tmpReg) ;
+ masm.jcc (Assembler::notZero, DONE_LABEL) ;
// It's inflated and appears unlocked
- if (os::is_MP()) { masm.lock(); }
- masm.cmpxchgptr(r15_thread, Address(boxReg, ObjectMonitor::owner_offset_in_bytes()-2)) ;
+ if (os::is_MP()) { masm.lock(); }
+ masm.cmpxchgptr(r15_thread, Address(boxReg, ObjectMonitor::owner_offset_in_bytes()-2)) ;
// Intentional fall-through into DONE_LABEL ...
masm.bind (DONE_LABEL) ;
@@ -3509,8 +3495,8 @@ encode %{
Register tmpReg = as_Register($tmp$$reg);
MacroAssembler masm(&cbuf);
- if (EmitSync & 4) {
- masm.cmpptr(rsp, 0) ;
+ if (EmitSync & 4) {
+ masm.cmpptr(rsp, 0) ;
} else
if (EmitSync & 8) {
Label DONE_LABEL;
@@ -3537,25 +3523,25 @@ encode %{
if (UseBiasedLocking && !UseOptoBiasInlining) {
masm.biased_locking_exit(objReg, tmpReg, DONE_LABEL);
}
-
- masm.movptr(tmpReg, Address(objReg, 0)) ;
- masm.cmpptr(Address(boxReg, 0), (int32_t)NULL_WORD) ;
- masm.jcc (Assembler::zero, DONE_LABEL) ;
- masm.testl (tmpReg, 0x02) ;
- masm.jcc (Assembler::zero, Stacked) ;
-
+
+ masm.movptr(tmpReg, Address(objReg, 0)) ;
+ masm.cmpptr(Address(boxReg, 0), (int32_t)NULL_WORD) ;
+ masm.jcc (Assembler::zero, DONE_LABEL) ;
+ masm.testl (tmpReg, 0x02) ;
+ masm.jcc (Assembler::zero, Stacked) ;
+
// It's inflated
- masm.movptr(boxReg, Address (tmpReg, ObjectMonitor::owner_offset_in_bytes()-2)) ;
- masm.xorptr(boxReg, r15_thread) ;
- masm.orptr (boxReg, Address (tmpReg, ObjectMonitor::recursions_offset_in_bytes()-2)) ;
- masm.jcc (Assembler::notZero, DONE_LABEL) ;
- masm.movptr(boxReg, Address (tmpReg, ObjectMonitor::cxq_offset_in_bytes()-2)) ;
- masm.orptr (boxReg, Address (tmpReg, ObjectMonitor::EntryList_offset_in_bytes()-2)) ;
- masm.jcc (Assembler::notZero, CheckSucc) ;
- masm.movptr(Address (tmpReg, ObjectMonitor::owner_offset_in_bytes()-2), (int32_t)NULL_WORD) ;
- masm.jmp (DONE_LABEL) ;
-
- if ((EmitSync & 65536) == 0) {
+ masm.movptr(boxReg, Address (tmpReg, ObjectMonitor::owner_offset_in_bytes()-2)) ;
+ masm.xorptr(boxReg, r15_thread) ;
+ masm.orptr (boxReg, Address (tmpReg, ObjectMonitor::recursions_offset_in_bytes()-2)) ;
+ masm.jcc (Assembler::notZero, DONE_LABEL) ;
+ masm.movptr(boxReg, Address (tmpReg, ObjectMonitor::cxq_offset_in_bytes()-2)) ;
+ masm.orptr (boxReg, Address (tmpReg, ObjectMonitor::EntryList_offset_in_bytes()-2)) ;
+ masm.jcc (Assembler::notZero, CheckSucc) ;
+ masm.movptr(Address (tmpReg, ObjectMonitor::owner_offset_in_bytes()-2), (int32_t)NULL_WORD) ;
+ masm.jmp (DONE_LABEL) ;
+
+ if ((EmitSync & 65536) == 0) {
Label LSuccess, LGoSlowPath ;
masm.bind (CheckSucc) ;
masm.cmpptr(Address (tmpReg, ObjectMonitor::succ_offset_in_bytes()-2), (int32_t)NULL_WORD) ;
@@ -3587,9 +3573,9 @@ encode %{
masm.jmp (DONE_LABEL) ;
}
- masm.bind (Stacked) ;
+ masm.bind (Stacked) ;
masm.movptr(tmpReg, Address (boxReg, 0)) ; // re-fetch
- if (os::is_MP()) { masm.lock(); }
+ if (os::is_MP()) { masm.lock(); }
masm.cmpxchgptr(tmpReg, Address(objReg, 0)); // Uses RAX which is box
if (EmitSync & 65536) {
@@ -3910,22 +3896,6 @@ encode %{
// done:
%}
-
- // Safepoint Poll. This polls the safepoint page, and causes an
- // exception if it is not readable. Unfortunately, it kills
- // RFLAGS in the process.
- enc_class enc_safepoint_poll
- %{
- // testl %rax, off(%rip) // Opcode + ModRM + Disp32 == 6 bytes
- // XXX reg_mem doesn't support RIP-relative addressing yet
- cbuf.set_insts_mark();
- cbuf.relocate(cbuf.insts_mark(), relocInfo::poll_type, 0); // XXX
- emit_opcode(cbuf, 0x85); // testl
- emit_rm(cbuf, 0x0, RAX_enc, 0x5); // 00 rax 101 == 0x5
- // cbuf.insts_mark() is beginning of instruction
- emit_d32_reloc(cbuf, os::get_polling_page());
-// relocInfo::poll_type,
- %}
%}
@@ -4229,6 +4199,15 @@ operand immP0()
interface(CONST_INTER);
%}
+operand immP_poll() %{
+ predicate(n->get_ptr() != 0 && n->get_ptr() == (intptr_t)os::get_polling_page());
+ match(ConP);
+
+ // formats are generated automatically for constants and base registers
+ format %{ %}
+ interface(CONST_INTER);
+%}
+
// Pointer Immediate
operand immN() %{
match(ConN);
@@ -4836,7 +4815,7 @@ operand regF()
%}
// Double register operands
-operand regD()
+operand regD()
%{
constraint(ALLOC_IN_RC(double_reg));
match(RegD);
@@ -6564,6 +6543,16 @@ instruct loadConP0(rRegP dst, immP0 src, rFlagsReg cr)
ins_pipe(ialu_reg);
%}
+instruct loadConP_poll(rRegP dst, immP_poll src) %{
+ match(Set dst src);
+ format %{ "movq $dst, $src\t!ptr" %}
+ ins_encode %{
+ AddressLiteral polling_page(os::get_polling_page(), relocInfo::poll_type);
+ __ lea($dst$$Register, polling_page);
+ %}
+ ins_pipe(ialu_reg_fat);
+%}
+
instruct loadConP31(rRegP dst, immP31 src, rFlagsReg cr)
%{
match(Set dst src);
@@ -7237,11 +7226,11 @@ instruct bytes_reverse_long(rRegL dst) %{
instruct bytes_reverse_unsigned_short(rRegI dst) %{
match(Set dst (ReverseBytesUS dst));
- format %{ "bswapl $dst\n\t"
+ format %{ "bswapl $dst\n\t"
"shrl $dst,16\n\t" %}
ins_encode %{
__ bswapl($dst$$Register);
- __ shrl($dst$$Register, 16);
+ __ shrl($dst$$Register, 16);
%}
ins_pipe( ialu_reg );
%}
@@ -7249,11 +7238,11 @@ instruct bytes_reverse_unsigned_short(rRegI dst) %{
instruct bytes_reverse_short(rRegI dst) %{
match(Set dst (ReverseBytesS dst));
- format %{ "bswapl $dst\n\t"
+ format %{ "bswapl $dst\n\t"
"sar $dst,16\n\t" %}
ins_encode %{
__ bswapl($dst$$Register);
- __ sarl($dst$$Register, 16);
+ __ sarl($dst$$Register, 16);
%}
ins_pipe( ialu_reg );
%}
@@ -7476,7 +7465,7 @@ instruct membar_volatile(rFlagsReg cr) %{
effect(KILL cr);
ins_cost(400);
- format %{
+ format %{
$$template
if (os::is_MP()) {
$$emit$$"lock addl [rsp + #0], 0\t! membar_volatile"
@@ -8287,7 +8276,7 @@ instruct storePConditional(memory heap_top_ptr,
rFlagsReg cr)
%{
match(Set cr (StorePConditional heap_top_ptr (Binary oldval newval)));
-
+
format %{ "cmpxchgq $heap_top_ptr, $newval\t# (ptr) "
"If rax == $heap_top_ptr then store $newval into $heap_top_ptr" %}
opcode(0x0F, 0xB1);
@@ -9850,9 +9839,9 @@ instruct xorI_rReg(rRegI dst, rRegI src, rFlagsReg cr)
// Xor Register with Immediate -1
instruct xorI_rReg_im1(rRegI dst, immI_M1 imm) %{
- match(Set dst (XorI dst imm));
+ match(Set dst (XorI dst imm));
- format %{ "not $dst" %}
+ format %{ "not $dst" %}
ins_encode %{
__ notl($dst$$Register);
%}
@@ -10093,9 +10082,9 @@ instruct xorL_rReg(rRegL dst, rRegL src, rFlagsReg cr)
// Xor Register with Immediate -1
instruct xorL_rReg_im1(rRegL dst, immL_M1 imm) %{
- match(Set dst (XorL dst imm));
+ match(Set dst (XorL dst imm));
- format %{ "notq $dst" %}
+ format %{ "notq $dst" %}
ins_encode %{
__ notq($dst$$Register);
%}
@@ -12469,14 +12458,33 @@ instruct cmpFastUnlock(rFlagsReg cr,
// Safepoint Instructions
instruct safePoint_poll(rFlagsReg cr)
%{
+ predicate(!Assembler::is_polling_page_far());
match(SafePoint);
effect(KILL cr);
- format %{ "testl rax, [rip + #offset_to_poll_page]\t"
+ format %{ "testl rax, [rip + #offset_to_poll_page]\t"
"# Safepoint: poll for GC" %}
- size(6); // Opcode + ModRM + Disp32 == 6 bytes
ins_cost(125);
- ins_encode(enc_safepoint_poll);
+ ins_encode %{
+ AddressLiteral addr(os::get_polling_page(), relocInfo::poll_type);
+ __ testl(rax, addr);
+ %}
+ ins_pipe(ialu_reg_mem);
+%}
+
+instruct safePoint_poll_far(rFlagsReg cr, rRegP poll)
+%{
+ predicate(Assembler::is_polling_page_far());
+ match(SafePoint poll);
+ effect(KILL cr, USE poll);
+
+ format %{ "testl rax, [$poll]\t"
+ "# Safepoint: poll for GC" %}
+ ins_cost(125);
+ ins_encode %{
+ __ relocate(relocInfo::poll_type);
+ __ testl(rax, Address($poll$$Register, 0));
+ %}
ins_pipe(ialu_reg_mem);
%}
diff --git a/hotspot/src/cpu/zero/vm/globals_zero.hpp b/hotspot/src/cpu/zero/vm/globals_zero.hpp
index 88c7d0888df..c45f1f5766a 100644
--- a/hotspot/src/cpu/zero/vm/globals_zero.hpp
+++ b/hotspot/src/cpu/zero/vm/globals_zero.hpp
@@ -1,6 +1,6 @@
/*
* Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved.
- * Copyright 2007, 2008, 2009, 2010 Red Hat, Inc.
+ * Copyright 2007, 2008, 2009, 2010, 2011 Red Hat, Inc.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -54,4 +54,6 @@ define_pd_global(bool, RewriteFrequentPairs, true);
define_pd_global(bool, UseMembar, false);
+// GC Ergo Flags
+define_pd_global(intx, CMSYoungGenPerWorker, 16*M); // default max size of CMS young gen, per GC worker thread
#endif // CPU_ZERO_VM_GLOBALS_ZERO_HPP
diff --git a/hotspot/src/cpu/zero/vm/jni_zero.h b/hotspot/src/cpu/zero/vm/jni_zero.h
index 132a6bbb60d..6ac4f63ead3 100644
--- a/hotspot/src/cpu/zero/vm/jni_zero.h
+++ b/hotspot/src/cpu/zero/vm/jni_zero.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved.
* Copyright 2009 Red Hat, Inc.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
diff --git a/hotspot/src/cpu/zero/vm/relocInfo_zero.cpp b/hotspot/src/cpu/zero/vm/relocInfo_zero.cpp
index e04acad8fd0..13f095e4746 100644
--- a/hotspot/src/cpu/zero/vm/relocInfo_zero.cpp
+++ b/hotspot/src/cpu/zero/vm/relocInfo_zero.cpp
@@ -1,6 +1,6 @@
/*
* Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved.
- * Copyright 2007, 2009 Red Hat, Inc.
+ * Copyright 2007, 2009, 2010, 2011 Red Hat, Inc.
* 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,7 +31,7 @@
#include "oops/oop.inline.hpp"
#include "runtime/safepoint.hpp"
-void Relocation::pd_set_data_value(address x, intptr_t o) {
+void Relocation::pd_set_data_value(address x, intptr_t o, bool verify_only) {
ShouldNotCallThis();
}
diff --git a/hotspot/src/cpu/zero/vm/sharedRuntime_zero.cpp b/hotspot/src/cpu/zero/vm/sharedRuntime_zero.cpp
index b88c5e810f6..6e7643ae59b 100644
--- a/hotspot/src/cpu/zero/vm/sharedRuntime_zero.cpp
+++ b/hotspot/src/cpu/zero/vm/sharedRuntime_zero.cpp
@@ -1,6 +1,6 @@
/*
* Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved.
- * Copyright 2007, 2008, 2009, 2010 Red Hat, Inc.
+ * Copyright 2007, 2008, 2009, 2010, 2011 Red Hat, Inc.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -78,15 +78,17 @@ AdapterHandlerEntry* SharedRuntime::generate_i2c2i_adapters(
nmethod *SharedRuntime::generate_native_wrapper(MacroAssembler *masm,
methodHandle method,
- int total_in_args,
- int comp_args_on_stack,
- BasicType *in_sig_bt,
- VMRegPair *in_regs,
+ int compile_id,
+ int total_args_passed,
+ int max_arg,
+ BasicType *sig_bt,
+ VMRegPair *regs,
BasicType ret_type) {
#ifdef SHARK
return SharkCompiler::compiler()->generate_native_wrapper(masm,
method,
- in_sig_bt,
+ compile_id,
+ sig_bt,
ret_type);
#else
ShouldNotCallThis();
diff --git a/hotspot/src/os/linux/vm/jvm_linux.cpp b/hotspot/src/os/linux/vm/jvm_linux.cpp
index 6e305b80211..ba84788a1b7 100644
--- a/hotspot/src/os/linux/vm/jvm_linux.cpp
+++ b/hotspot/src/os/linux/vm/jvm_linux.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2011, 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
diff --git a/hotspot/src/os/linux/vm/osThread_linux.cpp b/hotspot/src/os/linux/vm/osThread_linux.cpp
index bf454ff9003..8ff88a9e34f 100644
--- a/hotspot/src/os/linux/vm/osThread_linux.cpp
+++ b/hotspot/src/os/linux/vm/osThread_linux.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2011, 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
diff --git a/hotspot/src/os/linux/vm/os_linux.inline.hpp b/hotspot/src/os/linux/vm/os_linux.inline.hpp
index c2301be5052..0bddce86bcc 100644
--- a/hotspot/src/os/linux/vm/os_linux.inline.hpp
+++ b/hotspot/src/os/linux/vm/os_linux.inline.hpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2011, 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
diff --git a/hotspot/src/os/linux/vm/thread_linux.inline.hpp b/hotspot/src/os/linux/vm/thread_linux.inline.hpp
index 93e1d481ef7..2a5dcddb7ca 100644
--- a/hotspot/src/os/linux/vm/thread_linux.inline.hpp
+++ b/hotspot/src/os/linux/vm/thread_linux.inline.hpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2002, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2002, 2011, 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
diff --git a/hotspot/src/os/solaris/dtrace/generateJvmOffsets.cpp b/hotspot/src/os/solaris/dtrace/generateJvmOffsets.cpp
index adfd1718538..022643161a1 100644
--- a/hotspot/src/os/solaris/dtrace/generateJvmOffsets.cpp
+++ b/hotspot/src/os/solaris/dtrace/generateJvmOffsets.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2011, 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
diff --git a/hotspot/src/os/solaris/dtrace/jhelper.d b/hotspot/src/os/solaris/dtrace/jhelper.d
index 0a93d25cc35..75e74269576 100644
--- a/hotspot/src/os/solaris/dtrace/jhelper.d
+++ b/hotspot/src/os/solaris/dtrace/jhelper.d
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2003, 2009, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2011, 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
diff --git a/hotspot/src/os/solaris/dtrace/libjvm_db.c b/hotspot/src/os/solaris/dtrace/libjvm_db.c
index 82cef0912bc..8caac23e9e2 100644
--- a/hotspot/src/os/solaris/dtrace/libjvm_db.c
+++ b/hotspot/src/os/solaris/dtrace/libjvm_db.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2011, 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
diff --git a/hotspot/src/os/solaris/vm/dtraceJSDT_solaris.cpp b/hotspot/src/os/solaris/vm/dtraceJSDT_solaris.cpp
index c88d4fadea0..60baff5066c 100644
--- a/hotspot/src/os/solaris/vm/dtraceJSDT_solaris.cpp
+++ b/hotspot/src/os/solaris/vm/dtraceJSDT_solaris.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2011, 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
diff --git a/hotspot/src/os_cpu/linux_sparc/vm/os_linux_sparc.cpp b/hotspot/src/os_cpu/linux_sparc/vm/os_linux_sparc.cpp
index a9984d0e615..62131ee6f10 100644
--- a/hotspot/src/os_cpu/linux_sparc/vm/os_linux_sparc.cpp
+++ b/hotspot/src/os_cpu/linux_sparc/vm/os_linux_sparc.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2011, 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
diff --git a/hotspot/src/os_cpu/linux_x86/vm/os_linux_x86.cpp b/hotspot/src/os_cpu/linux_x86/vm/os_linux_x86.cpp
index b5e159076d5..ba484b9fde5 100644
--- a/hotspot/src/os_cpu/linux_x86/vm/os_linux_x86.cpp
+++ b/hotspot/src/os_cpu/linux_x86/vm/os_linux_x86.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2011, 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
diff --git a/hotspot/src/os_cpu/linux_zero/vm/os_linux_zero.cpp b/hotspot/src/os_cpu/linux_zero/vm/os_linux_zero.cpp
index afeb60a93f4..32c2d0a5191 100644
--- a/hotspot/src/os_cpu/linux_zero/vm/os_linux_zero.cpp
+++ b/hotspot/src/os_cpu/linux_zero/vm/os_linux_zero.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2011, Oracle and/or its affiliates. All rights reserved.
* Copyright 2007, 2008, 2009, 2010 Red Hat, Inc.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
diff --git a/hotspot/src/os_cpu/solaris_sparc/vm/os_solaris_sparc.cpp b/hotspot/src/os_cpu/solaris_sparc/vm/os_solaris_sparc.cpp
index e9724f1cd8e..971f600fe30 100644
--- a/hotspot/src/os_cpu/solaris_sparc/vm/os_solaris_sparc.cpp
+++ b/hotspot/src/os_cpu/solaris_sparc/vm/os_solaris_sparc.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2011, 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
diff --git a/hotspot/src/os_cpu/solaris_x86/vm/os_solaris_x86.cpp b/hotspot/src/os_cpu/solaris_x86/vm/os_solaris_x86.cpp
index 2de4d6969bd..78e93ea6652 100644
--- a/hotspot/src/os_cpu/solaris_x86/vm/os_solaris_x86.cpp
+++ b/hotspot/src/os_cpu/solaris_x86/vm/os_solaris_x86.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2011, 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
diff --git a/hotspot/src/share/tools/hsdis/hsdis-demo.c b/hotspot/src/share/tools/hsdis/hsdis-demo.c
index 9981a71e33a..e83a0425c50 100644
--- a/hotspot/src/share/tools/hsdis/hsdis-demo.c
+++ b/hotspot/src/share/tools/hsdis/hsdis-demo.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2008, 2011, 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
diff --git a/hotspot/src/share/tools/hsdis/hsdis.c b/hotspot/src/share/tools/hsdis/hsdis.c
index 189eecde3e1..daea404f955 100644
--- a/hotspot/src/share/tools/hsdis/hsdis.c
+++ b/hotspot/src/share/tools/hsdis/hsdis.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2008, 2011, 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
diff --git a/hotspot/src/share/vm/adlc/main.cpp b/hotspot/src/share/vm/adlc/main.cpp
index 3d74a4f02f9..47e207a4b13 100644
--- a/hotspot/src/share/vm/adlc/main.cpp
+++ b/hotspot/src/share/vm/adlc/main.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2011, 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
@@ -239,6 +239,11 @@ int main(int argc, char *argv[])
AD.addInclude(AD._CPP_file, "assembler_sparc.inline.hpp");
AD.addInclude(AD._CPP_file, "nativeInst_sparc.hpp");
AD.addInclude(AD._CPP_file, "vmreg_sparc.inline.hpp");
+#endif
+#ifdef TARGET_ARCH_arm
+ AD.addInclude(AD._CPP_file, "assembler_arm.inline.hpp");
+ AD.addInclude(AD._CPP_file, "nativeInst_arm.hpp");
+ AD.addInclude(AD._CPP_file, "vmreg_arm.inline.hpp");
#endif
AD.addInclude(AD._HPP_file, "memory/allocation.hpp");
AD.addInclude(AD._HPP_file, "opto/machnode.hpp");
diff --git a/hotspot/src/share/vm/adlc/output_c.cpp b/hotspot/src/share/vm/adlc/output_c.cpp
index ddf1f99343b..c0ef3894622 100644
--- a/hotspot/src/share/vm/adlc/output_c.cpp
+++ b/hotspot/src/share/vm/adlc/output_c.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1998, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 2011, 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
diff --git a/hotspot/src/share/vm/asm/assembler.cpp b/hotspot/src/share/vm/asm/assembler.cpp
index 2f739393f58..86011e97496 100644
--- a/hotspot/src/share/vm/asm/assembler.cpp
+++ b/hotspot/src/share/vm/asm/assembler.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2011, 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
diff --git a/hotspot/src/share/vm/asm/assembler.hpp b/hotspot/src/share/vm/asm/assembler.hpp
index db0fbadbd5c..829e5618413 100644
--- a/hotspot/src/share/vm/asm/assembler.hpp
+++ b/hotspot/src/share/vm/asm/assembler.hpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2011, 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
diff --git a/hotspot/src/share/vm/asm/codeBuffer.hpp b/hotspot/src/share/vm/asm/codeBuffer.hpp
index dfcd1cf0a27..e9b2950b98c 100644
--- a/hotspot/src/share/vm/asm/codeBuffer.hpp
+++ b/hotspot/src/share/vm/asm/codeBuffer.hpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2011, 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
diff --git a/hotspot/src/share/vm/c1/c1_Compilation.hpp b/hotspot/src/share/vm/c1/c1_Compilation.hpp
index 0d0fe1d3017..376b6f3372e 100644
--- a/hotspot/src/share/vm/c1/c1_Compilation.hpp
+++ b/hotspot/src/share/vm/c1/c1_Compilation.hpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2011, 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
diff --git a/hotspot/src/share/vm/c1/c1_Defs.hpp b/hotspot/src/share/vm/c1/c1_Defs.hpp
index 564e7b3cb5f..bebb3b0bebe 100644
--- a/hotspot/src/share/vm/c1/c1_Defs.hpp
+++ b/hotspot/src/share/vm/c1/c1_Defs.hpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2011, 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
diff --git a/hotspot/src/share/vm/c1/c1_FpuStackSim.hpp b/hotspot/src/share/vm/c1/c1_FpuStackSim.hpp
index 3e8adbe14c4..a1e4c383204 100644
--- a/hotspot/src/share/vm/c1/c1_FpuStackSim.hpp
+++ b/hotspot/src/share/vm/c1/c1_FpuStackSim.hpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2011, 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
diff --git a/hotspot/src/share/vm/c1/c1_FrameMap.cpp b/hotspot/src/share/vm/c1/c1_FrameMap.cpp
index 74eab9bd08e..ea50b276f44 100644
--- a/hotspot/src/share/vm/c1/c1_FrameMap.cpp
+++ b/hotspot/src/share/vm/c1/c1_FrameMap.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2011, 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
diff --git a/hotspot/src/share/vm/c1/c1_FrameMap.hpp b/hotspot/src/share/vm/c1/c1_FrameMap.hpp
index 266ae094057..288fc5c1bf4 100644
--- a/hotspot/src/share/vm/c1/c1_FrameMap.hpp
+++ b/hotspot/src/share/vm/c1/c1_FrameMap.hpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2011, 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
diff --git a/hotspot/src/share/vm/c1/c1_GraphBuilder.cpp b/hotspot/src/share/vm/c1/c1_GraphBuilder.cpp
index 4e5f4edf0e6..9bac474f5b9 100644
--- a/hotspot/src/share/vm/c1/c1_GraphBuilder.cpp
+++ b/hotspot/src/share/vm/c1/c1_GraphBuilder.cpp
@@ -30,6 +30,7 @@
#include "c1/c1_InstructionPrinter.hpp"
#include "ci/ciField.hpp"
#include "ci/ciKlass.hpp"
+#include "compiler/compileBroker.hpp"
#include "interpreter/bytecode.hpp"
#include "runtime/sharedRuntime.hpp"
#include "utilities/bitMap.inline.hpp"
@@ -2823,7 +2824,7 @@ ValueStack* GraphBuilder::state_at_entry() {
int idx = 0;
if (!method()->is_static()) {
// we should always see the receiver
- state->store_local(idx, new Local(objectType, idx));
+ state->store_local(idx, new Local(method()->holder(), objectType, idx));
idx = 1;
}
@@ -2835,7 +2836,7 @@ ValueStack* GraphBuilder::state_at_entry() {
// don't allow T_ARRAY to propagate into locals types
if (basic_type == T_ARRAY) basic_type = T_OBJECT;
ValueType* vt = as_ValueType(basic_type);
- state->store_local(idx, new Local(vt, idx));
+ state->store_local(idx, new Local(type, vt, idx));
idx += type->size();
}
@@ -3775,24 +3776,7 @@ void GraphBuilder::append_unsafe_CAS(ciMethod* callee) {
#ifndef PRODUCT
void GraphBuilder::print_inline_result(ciMethod* callee, bool res) {
- const char sync_char = callee->is_synchronized() ? 's' : ' ';
- const char exception_char = callee->has_exception_handlers() ? '!' : ' ';
- const char monitors_char = callee->has_monitor_bytecodes() ? 'm' : ' ';
- tty->print(" %c%c%c ", sync_char, exception_char, monitors_char);
- for (int i = 0; i < scope()->level(); i++) tty->print(" ");
- if (res) {
- tty->print(" ");
- } else {
- tty->print("- ");
- }
- tty->print("@ %d ", bci());
- callee->print_short_name();
- tty->print(" (%d bytes)", callee->code_size());
- if (_inline_bailout_msg) {
- tty->print(" %s", _inline_bailout_msg);
- }
- tty->cr();
-
+ CompileTask::print_inlining(callee, scope()->level(), bci(), _inline_bailout_msg);
if (res && CIPrintMethodCodes) {
callee->print_codes();
}
diff --git a/hotspot/src/share/vm/c1/c1_Instruction.cpp b/hotspot/src/share/vm/c1/c1_Instruction.cpp
index fdb0ce89cd2..46857e16cbb 100644
--- a/hotspot/src/share/vm/c1/c1_Instruction.cpp
+++ b/hotspot/src/share/vm/c1/c1_Instruction.cpp
@@ -135,6 +135,33 @@ bool AccessIndexed::compute_needs_range_check() {
}
+ciType* Local::exact_type() const {
+ ciType* type = declared_type();
+
+ // for primitive arrays, the declared type is the exact type
+ if (type->is_type_array_klass()) {
+ return type;
+ } else if (type->is_instance_klass()) {
+ ciInstanceKlass* ik = (ciInstanceKlass*)type;
+ if (ik->is_loaded() && ik->is_final() && !ik->is_interface()) {
+ return type;
+ }
+ } else if (type->is_obj_array_klass()) {
+ ciObjArrayKlass* oak = (ciObjArrayKlass*)type;
+ ciType* base = oak->base_element_type();
+ if (base->is_instance_klass()) {
+ ciInstanceKlass* ik = base->as_instance_klass();
+ if (ik->is_loaded() && ik->is_final()) {
+ return type;
+ }
+ } else if (base->is_primitive_type()) {
+ return type;
+ }
+ }
+ return NULL;
+}
+
+
ciType* LoadIndexed::exact_type() const {
ciType* array_type = array()->exact_type();
if (array_type == NULL) {
@@ -189,16 +216,21 @@ ciType* NewTypeArray::exact_type() const {
return ciTypeArrayKlass::make(elt_type());
}
-
ciType* NewObjectArray::exact_type() const {
return ciObjArrayKlass::make(klass());
}
+ciType* NewArray::declared_type() const {
+ return exact_type();
+}
ciType* NewInstance::exact_type() const {
return klass();
}
+ciType* NewInstance::declared_type() const {
+ return exact_type();
+}
ciType* CheckCast::declared_type() const {
return klass();
@@ -349,6 +381,11 @@ void Invoke::state_values_do(ValueVisitor* f) {
if (state() != NULL) state()->values_do(f);
}
+ciType* Invoke::declared_type() const {
+ ciType *t = _target->signature()->return_type();
+ assert(t->basic_type() != T_VOID, "need return value of void method?");
+ return t;
+}
// Implementation of Contant
intx Constant::hash() const {
diff --git a/hotspot/src/share/vm/c1/c1_Instruction.hpp b/hotspot/src/share/vm/c1/c1_Instruction.hpp
index d997c572c4e..719c1f2fb7c 100644
--- a/hotspot/src/share/vm/c1/c1_Instruction.hpp
+++ b/hotspot/src/share/vm/c1/c1_Instruction.hpp
@@ -621,16 +621,21 @@ LEAF(Phi, Instruction)
LEAF(Local, Instruction)
private:
int _java_index; // the local index within the method to which the local belongs
+ ciType* _declared_type;
public:
// creation
- Local(ValueType* type, int index)
+ Local(ciType* declared, ValueType* type, int index)
: Instruction(type)
, _java_index(index)
+ , _declared_type(declared)
{}
// accessors
int java_index() const { return _java_index; }
+ ciType* declared_type() const { return _declared_type; }
+ ciType* exact_type() const;
+
// generic
virtual void input_values_do(ValueVisitor* f) { /* no values */ }
};
@@ -1146,6 +1151,8 @@ LEAF(Invoke, StateSplit)
BasicTypeList* signature() const { return _signature; }
ciMethod* target() const { return _target; }
+ ciType* declared_type() const;
+
// Returns false if target is not loaded
bool target_is_final() const { return check_flag(TargetIsFinalFlag); }
bool target_is_loaded() const { return check_flag(TargetIsLoadedFlag); }
@@ -1187,6 +1194,7 @@ LEAF(NewInstance, StateSplit)
// generic
virtual bool can_trap() const { return true; }
ciType* exact_type() const;
+ ciType* declared_type() const;
};
@@ -1208,6 +1216,8 @@ BASE(NewArray, StateSplit)
virtual bool needs_exception_state() const { return false; }
+ ciType* declared_type() const;
+
// generic
virtual bool can_trap() const { return true; }
virtual void input_values_do(ValueVisitor* f) { StateSplit::input_values_do(f); f->visit(&_length); }
@@ -1397,6 +1407,7 @@ LEAF(Intrinsic, StateSplit)
vmIntrinsics::ID _id;
Values* _args;
Value _recv;
+ int _nonnull_state; // mask identifying which args are nonnull
public:
// preserves_state can be set to true for Intrinsics
@@ -1417,6 +1428,7 @@ LEAF(Intrinsic, StateSplit)
, _id(id)
, _args(args)
, _recv(NULL)
+ , _nonnull_state(AllBits)
{
assert(args != NULL, "args must exist");
ASSERT_VALUES
@@ -1442,6 +1454,23 @@ LEAF(Intrinsic, StateSplit)
Value receiver() const { assert(has_receiver(), "must have receiver"); return _recv; }
bool preserves_state() const { return check_flag(PreservesStateFlag); }
+ bool arg_needs_null_check(int i) {
+ if (i >= 0 && i < (int)sizeof(_nonnull_state) * BitsPerByte) {
+ return is_set_nth_bit(_nonnull_state, i);
+ }
+ return true;
+ }
+
+ void set_arg_needs_null_check(int i, bool check) {
+ if (i >= 0 && i < (int)sizeof(_nonnull_state) * BitsPerByte) {
+ if (check) {
+ _nonnull_state |= nth_bit(i);
+ } else {
+ _nonnull_state &= ~(nth_bit(i));
+ }
+ }
+ }
+
// generic
virtual bool can_trap() const { return check_flag(CanTrapFlag); }
virtual void input_values_do(ValueVisitor* f) {
diff --git a/hotspot/src/share/vm/c1/c1_LIR.hpp b/hotspot/src/share/vm/c1/c1_LIR.hpp
index c5c5d91c7ac..a2770e402df 100644
--- a/hotspot/src/share/vm/c1/c1_LIR.hpp
+++ b/hotspot/src/share/vm/c1/c1_LIR.hpp
@@ -1215,7 +1215,11 @@ public:
src_range_check = 1 << 5,
dst_range_check = 1 << 6,
type_check = 1 << 7,
- all_flags = (1 << 8) - 1
+ overlapping = 1 << 8,
+ unaligned = 1 << 9,
+ src_objarray = 1 << 10,
+ dst_objarray = 1 << 11,
+ all_flags = (1 << 12) - 1
};
LIR_OpArrayCopy(LIR_Opr src, LIR_Opr src_pos, LIR_Opr dst, LIR_Opr dst_pos, LIR_Opr length, LIR_Opr tmp,
diff --git a/hotspot/src/share/vm/c1/c1_LIRAssembler.cpp b/hotspot/src/share/vm/c1/c1_LIRAssembler.cpp
index 510bf2f92a5..d3b853bedca 100644
--- a/hotspot/src/share/vm/c1/c1_LIRAssembler.cpp
+++ b/hotspot/src/share/vm/c1/c1_LIRAssembler.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2011, 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
@@ -836,6 +836,9 @@ void LIR_Assembler::verify_oop_map(CodeEmitInfo* info) {
_masm->verify_stack_oop(r->reg2stack() * VMRegImpl::stack_slot_size);
}
}
+ check_codespace();
+ CHECK_BAILOUT();
+
s.next();
}
VerifyOops = v;
diff --git a/hotspot/src/share/vm/c1/c1_LIRAssembler.hpp b/hotspot/src/share/vm/c1/c1_LIRAssembler.hpp
index 074027a8719..857b663f7cf 100644
--- a/hotspot/src/share/vm/c1/c1_LIRAssembler.hpp
+++ b/hotspot/src/share/vm/c1/c1_LIRAssembler.hpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2011, 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
diff --git a/hotspot/src/share/vm/c1/c1_LIRGenerator.cpp b/hotspot/src/share/vm/c1/c1_LIRGenerator.cpp
index ae3773bcc29..33278ef5065 100644
--- a/hotspot/src/share/vm/c1/c1_LIRGenerator.cpp
+++ b/hotspot/src/share/vm/c1/c1_LIRGenerator.cpp
@@ -706,6 +706,38 @@ static ciArrayKlass* as_array_klass(ciType* type) {
}
}
+static Value maxvalue(IfOp* ifop) {
+ switch (ifop->cond()) {
+ case If::eql: return NULL;
+ case If::neq: return NULL;
+ case If::lss: // x < y ? x : y
+ case If::leq: // x <= y ? x : y
+ if (ifop->x() == ifop->tval() &&
+ ifop->y() == ifop->fval()) return ifop->y();
+ return NULL;
+
+ case If::gtr: // x > y ? y : x
+ case If::geq: // x >= y ? y : x
+ if (ifop->x() == ifop->tval() &&
+ ifop->y() == ifop->fval()) return ifop->y();
+ return NULL;
+
+ }
+}
+
+static ciType* phi_declared_type(Phi* phi) {
+ ciType* t = phi->operand_at(0)->declared_type();
+ if (t == NULL) {
+ return NULL;
+ }
+ for(int i = 1; i < phi->operand_count(); i++) {
+ if (t != phi->operand_at(i)->declared_type()) {
+ return NULL;
+ }
+ }
+ return t;
+}
+
void LIRGenerator::arraycopy_helper(Intrinsic* x, int* flagsp, ciArrayKlass** expected_typep) {
Instruction* src = x->argument_at(0);
Instruction* src_pos = x->argument_at(1);
@@ -715,12 +747,20 @@ void LIRGenerator::arraycopy_helper(Intrinsic* x, int* flagsp, ciArrayKlass** ex
// first try to identify the likely type of the arrays involved
ciArrayKlass* expected_type = NULL;
- bool is_exact = false;
+ bool is_exact = false, src_objarray = false, dst_objarray = false;
{
ciArrayKlass* src_exact_type = as_array_klass(src->exact_type());
ciArrayKlass* src_declared_type = as_array_klass(src->declared_type());
+ Phi* phi;
+ if (src_declared_type == NULL && (phi = src->as_Phi()) != NULL) {
+ src_declared_type = as_array_klass(phi_declared_type(phi));
+ }
ciArrayKlass* dst_exact_type = as_array_klass(dst->exact_type());
ciArrayKlass* dst_declared_type = as_array_klass(dst->declared_type());
+ if (dst_declared_type == NULL && (phi = dst->as_Phi()) != NULL) {
+ dst_declared_type = as_array_klass(phi_declared_type(phi));
+ }
+
if (src_exact_type != NULL && src_exact_type == dst_exact_type) {
// the types exactly match so the type is fully known
is_exact = true;
@@ -744,17 +784,60 @@ void LIRGenerator::arraycopy_helper(Intrinsic* x, int* flagsp, ciArrayKlass** ex
if (expected_type == NULL) expected_type = dst_exact_type;
if (expected_type == NULL) expected_type = src_declared_type;
if (expected_type == NULL) expected_type = dst_declared_type;
+
+ src_objarray = (src_exact_type && src_exact_type->is_obj_array_klass()) || (src_declared_type && src_declared_type->is_obj_array_klass());
+ dst_objarray = (dst_exact_type && dst_exact_type->is_obj_array_klass()) || (dst_declared_type && dst_declared_type->is_obj_array_klass());
}
// if a probable array type has been identified, figure out if any
// of the required checks for a fast case can be elided.
int flags = LIR_OpArrayCopy::all_flags;
+
+ if (!src_objarray)
+ flags &= ~LIR_OpArrayCopy::src_objarray;
+ if (!dst_objarray)
+ flags &= ~LIR_OpArrayCopy::dst_objarray;
+
+ if (!x->arg_needs_null_check(0))
+ flags &= ~LIR_OpArrayCopy::src_null_check;
+ if (!x->arg_needs_null_check(2))
+ flags &= ~LIR_OpArrayCopy::dst_null_check;
+
+
if (expected_type != NULL) {
- // try to skip null checks
- if (src->as_NewArray() != NULL)
+ Value length_limit = NULL;
+
+ IfOp* ifop = length->as_IfOp();
+ if (ifop != NULL) {
+ // look for expressions like min(v, a.length) which ends up as
+ // x > y ? y : x or x >= y ? y : x
+ if ((ifop->cond() == If::gtr || ifop->cond() == If::geq) &&
+ ifop->x() == ifop->fval() &&
+ ifop->y() == ifop->tval()) {
+ length_limit = ifop->y();
+ }
+ }
+
+ // try to skip null checks and range checks
+ NewArray* src_array = src->as_NewArray();
+ if (src_array != NULL) {
flags &= ~LIR_OpArrayCopy::src_null_check;
- if (dst->as_NewArray() != NULL)
+ if (length_limit != NULL &&
+ src_array->length() == length_limit &&
+ is_constant_zero(src_pos)) {
+ flags &= ~LIR_OpArrayCopy::src_range_check;
+ }
+ }
+
+ NewArray* dst_array = dst->as_NewArray();
+ if (dst_array != NULL) {
flags &= ~LIR_OpArrayCopy::dst_null_check;
+ if (length_limit != NULL &&
+ dst_array->length() == length_limit &&
+ is_constant_zero(dst_pos)) {
+ flags &= ~LIR_OpArrayCopy::dst_range_check;
+ }
+ }
// check from incoming constant values
if (positive_constant(src_pos))
@@ -788,6 +871,28 @@ void LIRGenerator::arraycopy_helper(Intrinsic* x, int* flagsp, ciArrayKlass** ex
}
}
+ IntConstant* src_int = src_pos->type()->as_IntConstant();
+ IntConstant* dst_int = dst_pos->type()->as_IntConstant();
+ if (src_int && dst_int) {
+ int s_offs = src_int->value();
+ int d_offs = dst_int->value();
+ if (src_int->value() >= dst_int->value()) {
+ flags &= ~LIR_OpArrayCopy::overlapping;
+ }
+ if (expected_type != NULL) {
+ BasicType t = expected_type->element_type()->basic_type();
+ int element_size = type2aelembytes(t);
+ if (((arrayOopDesc::base_offset_in_bytes(t) + s_offs * element_size) % HeapWordSize == 0) &&
+ ((arrayOopDesc::base_offset_in_bytes(t) + d_offs * element_size) % HeapWordSize == 0)) {
+ flags &= ~LIR_OpArrayCopy::unaligned;
+ }
+ }
+ } else if (src_pos == dst_pos || is_constant_zero(dst_pos)) {
+ // src and dest positions are the same, or dst is zero so assume
+ // nonoverlapping copy.
+ flags &= ~LIR_OpArrayCopy::overlapping;
+ }
+
if (src == dst) {
// moving within a single array so no type checks are needed
if (flags & LIR_OpArrayCopy::type_check) {
@@ -1351,7 +1456,7 @@ void LIRGenerator::G1SATBCardTableModRef_post_barrier(LIR_OprDesc* addr, LIR_Opr
if (addr->is_address()) {
LIR_Address* address = addr->as_address_ptr();
- LIR_Opr ptr = new_register(T_OBJECT);
+ LIR_Opr ptr = new_pointer_register();
if (!address->index()->is_valid() && address->disp() == 0) {
__ move(address->base(), ptr);
} else {
@@ -1403,7 +1508,9 @@ void LIRGenerator::CardTableModRef_post_barrier(LIR_OprDesc* addr, LIR_OprDesc*
LIR_Const* card_table_base = new LIR_Const(((CardTableModRefBS*)_bs)->byte_map_base);
if (addr->is_address()) {
LIR_Address* address = addr->as_address_ptr();
- LIR_Opr ptr = new_register(T_OBJECT);
+ // ptr cannot be an object because we use this barrier for array card marks
+ // and addr can point in the middle of an array.
+ LIR_Opr ptr = new_pointer_register();
if (!address->index()->is_valid() && address->disp() == 0) {
__ move(address->base(), ptr);
} else {
diff --git a/hotspot/src/share/vm/c1/c1_LinearScan.cpp b/hotspot/src/share/vm/c1/c1_LinearScan.cpp
index 043ea39cdb5..ef41cfd3224 100644
--- a/hotspot/src/share/vm/c1/c1_LinearScan.cpp
+++ b/hotspot/src/share/vm/c1/c1_LinearScan.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2011, 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
diff --git a/hotspot/src/share/vm/c1/c1_LinearScan.hpp b/hotspot/src/share/vm/c1/c1_LinearScan.hpp
index 3436cb5c2be..51789ebd85d 100644
--- a/hotspot/src/share/vm/c1/c1_LinearScan.hpp
+++ b/hotspot/src/share/vm/c1/c1_LinearScan.hpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2011, 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
diff --git a/hotspot/src/share/vm/c1/c1_MacroAssembler.hpp b/hotspot/src/share/vm/c1/c1_MacroAssembler.hpp
index 9887c2af61d..55d98035016 100644
--- a/hotspot/src/share/vm/c1/c1_MacroAssembler.hpp
+++ b/hotspot/src/share/vm/c1/c1_MacroAssembler.hpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2011, 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
diff --git a/hotspot/src/share/vm/c1/c1_Optimizer.cpp b/hotspot/src/share/vm/c1/c1_Optimizer.cpp
index 93d610e6245..f07494d379c 100644
--- a/hotspot/src/share/vm/c1/c1_Optimizer.cpp
+++ b/hotspot/src/share/vm/c1/c1_Optimizer.cpp
@@ -644,7 +644,7 @@ void NullCheckVisitor::do_CheckCast (CheckCast* x) {}
void NullCheckVisitor::do_InstanceOf (InstanceOf* x) {}
void NullCheckVisitor::do_MonitorEnter (MonitorEnter* x) { nce()->handle_AccessMonitor(x); }
void NullCheckVisitor::do_MonitorExit (MonitorExit* x) { nce()->handle_AccessMonitor(x); }
-void NullCheckVisitor::do_Intrinsic (Intrinsic* x) { nce()->clear_last_explicit_null_check(); }
+void NullCheckVisitor::do_Intrinsic (Intrinsic* x) { nce()->handle_Intrinsic(x); }
void NullCheckVisitor::do_BlockBegin (BlockBegin* x) {}
void NullCheckVisitor::do_Goto (Goto* x) {}
void NullCheckVisitor::do_If (If* x) {}
@@ -1023,6 +1023,12 @@ void NullCheckEliminator::handle_AccessMonitor(AccessMonitor* x) {
void NullCheckEliminator::handle_Intrinsic(Intrinsic* x) {
if (!x->has_receiver()) {
+ if (x->id() == vmIntrinsics::_arraycopy) {
+ for (int i = 0; i < x->number_of_arguments(); i++) {
+ x->set_arg_needs_null_check(i, !set_contains(x->argument_at(i)));
+ }
+ }
+
// Be conservative
clear_last_explicit_null_check();
return;
diff --git a/hotspot/src/share/vm/c1/c1_Runtime1.cpp b/hotspot/src/share/vm/c1/c1_Runtime1.cpp
index 63fe9c0a2a0..03e83420d45 100644
--- a/hotspot/src/share/vm/c1/c1_Runtime1.cpp
+++ b/hotspot/src/share/vm/c1/c1_Runtime1.cpp
@@ -103,7 +103,10 @@ const char *Runtime1::_blob_names[] = {
int Runtime1::_generic_arraycopy_cnt = 0;
int Runtime1::_primitive_arraycopy_cnt = 0;
int Runtime1::_oop_arraycopy_cnt = 0;
+int Runtime1::_generic_arraycopystub_cnt = 0;
int Runtime1::_arraycopy_slowcase_cnt = 0;
+int Runtime1::_arraycopy_checkcast_cnt = 0;
+int Runtime1::_arraycopy_checkcast_attempt_cnt = 0;
int Runtime1::_new_type_array_slowcase_cnt = 0;
int Runtime1::_new_object_array_slowcase_cnt = 0;
int Runtime1::_new_instance_slowcase_cnt = 0;
@@ -119,6 +122,32 @@ int Runtime1::_throw_class_cast_exception_count = 0;
int Runtime1::_throw_incompatible_class_change_error_count = 0;
int Runtime1::_throw_array_store_exception_count = 0;
int Runtime1::_throw_count = 0;
+
+static int _byte_arraycopy_cnt = 0;
+static int _short_arraycopy_cnt = 0;
+static int _int_arraycopy_cnt = 0;
+static int _long_arraycopy_cnt = 0;
+static int _oop_arraycopy_cnt = 0;
+
+address Runtime1::arraycopy_count_address(BasicType type) {
+ switch (type) {
+ case T_BOOLEAN:
+ case T_BYTE: return (address)&_byte_arraycopy_cnt;
+ case T_CHAR:
+ case T_SHORT: return (address)&_short_arraycopy_cnt;
+ case T_FLOAT:
+ case T_INT: return (address)&_int_arraycopy_cnt;
+ case T_DOUBLE:
+ case T_LONG: return (address)&_long_arraycopy_cnt;
+ case T_ARRAY:
+ case T_OBJECT: return (address)&_oop_arraycopy_cnt;
+ default:
+ ShouldNotReachHere();
+ return NULL;
+ }
+}
+
+
#endif
// Simple helper to see if the caller of a runtime stub which
@@ -1229,9 +1258,17 @@ void Runtime1::print_statistics() {
tty->print_cr(" _handle_wrong_method_cnt: %d", SharedRuntime::_wrong_method_ctr);
tty->print_cr(" _ic_miss_cnt: %d", SharedRuntime::_ic_miss_ctr);
tty->print_cr(" _generic_arraycopy_cnt: %d", _generic_arraycopy_cnt);
+ tty->print_cr(" _generic_arraycopystub_cnt: %d", _generic_arraycopystub_cnt);
+ tty->print_cr(" _byte_arraycopy_cnt: %d", _byte_arraycopy_cnt);
+ tty->print_cr(" _short_arraycopy_cnt: %d", _short_arraycopy_cnt);
+ tty->print_cr(" _int_arraycopy_cnt: %d", _int_arraycopy_cnt);
+ tty->print_cr(" _long_arraycopy_cnt: %d", _long_arraycopy_cnt);
tty->print_cr(" _primitive_arraycopy_cnt: %d", _primitive_arraycopy_cnt);
- tty->print_cr(" _oop_arraycopy_cnt: %d", _oop_arraycopy_cnt);
+ tty->print_cr(" _oop_arraycopy_cnt (C): %d", Runtime1::_oop_arraycopy_cnt);
+ tty->print_cr(" _oop_arraycopy_cnt (stub): %d", _oop_arraycopy_cnt);
tty->print_cr(" _arraycopy_slowcase_cnt: %d", _arraycopy_slowcase_cnt);
+ tty->print_cr(" _arraycopy_checkcast_cnt: %d", _arraycopy_checkcast_cnt);
+ tty->print_cr(" _arraycopy_checkcast_attempt_cnt:%d", _arraycopy_checkcast_attempt_cnt);
tty->print_cr(" _new_type_array_slowcase_cnt: %d", _new_type_array_slowcase_cnt);
tty->print_cr(" _new_object_array_slowcase_cnt: %d", _new_object_array_slowcase_cnt);
diff --git a/hotspot/src/share/vm/c1/c1_Runtime1.hpp b/hotspot/src/share/vm/c1/c1_Runtime1.hpp
index 1d6782c6ac4..78f73bf6209 100644
--- a/hotspot/src/share/vm/c1/c1_Runtime1.hpp
+++ b/hotspot/src/share/vm/c1/c1_Runtime1.hpp
@@ -94,7 +94,10 @@ class Runtime1: public AllStatic {
static int _generic_arraycopy_cnt;
static int _primitive_arraycopy_cnt;
static int _oop_arraycopy_cnt;
+ static int _generic_arraycopystub_cnt;
static int _arraycopy_slowcase_cnt;
+ static int _arraycopy_checkcast_cnt;
+ static int _arraycopy_checkcast_attempt_cnt;
static int _new_type_array_slowcase_cnt;
static int _new_object_array_slowcase_cnt;
static int _new_instance_slowcase_cnt;
@@ -174,7 +177,8 @@ class Runtime1: public AllStatic {
static void trace_block_entry(jint block_id);
#ifndef PRODUCT
- static address throw_count_address() { return (address)&_throw_count; }
+ static address throw_count_address() { return (address)&_throw_count; }
+ static address arraycopy_count_address(BasicType type);
#endif
// directly accessible leaf routine
diff --git a/hotspot/src/share/vm/c1/c1_globals.hpp b/hotspot/src/share/vm/c1/c1_globals.hpp
index fd890cf7e47..110371d19e2 100644
--- a/hotspot/src/share/vm/c1/c1_globals.hpp
+++ b/hotspot/src/share/vm/c1/c1_globals.hpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2011, 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
diff --git a/hotspot/src/share/vm/ci/ciClassList.hpp b/hotspot/src/share/vm/ci/ciClassList.hpp
index 01deadd7ef3..bc96594a3eb 100644
--- a/hotspot/src/share/vm/ci/ciClassList.hpp
+++ b/hotspot/src/share/vm/ci/ciClassList.hpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2011, 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
diff --git a/hotspot/src/share/vm/ci/ciEnv.cpp b/hotspot/src/share/vm/ci/ciEnv.cpp
index 14018b4729c..66e23490c09 100644
--- a/hotspot/src/share/vm/ci/ciEnv.cpp
+++ b/hotspot/src/share/vm/ci/ciEnv.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2011, 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
diff --git a/hotspot/src/share/vm/ci/ciEnv.hpp b/hotspot/src/share/vm/ci/ciEnv.hpp
index 53c3ee15d9d..17b556fc4b5 100644
--- a/hotspot/src/share/vm/ci/ciEnv.hpp
+++ b/hotspot/src/share/vm/ci/ciEnv.hpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2011, 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
diff --git a/hotspot/src/share/vm/ci/ciInstance.cpp b/hotspot/src/share/vm/ci/ciInstance.cpp
index d249caa2e0c..0c671082bf2 100644
--- a/hotspot/src/share/vm/ci/ciInstance.cpp
+++ b/hotspot/src/share/vm/ci/ciInstance.cpp
@@ -66,8 +66,8 @@ ciConstant ciInstance::field_value(ciField* field) {
"invalid access");
VM_ENTRY_MARK;
ciConstant result;
- oop obj = get_oop();
- assert(obj != NULL, "bad oop");
+ Handle obj = get_oop();
+ assert(!obj.is_null(), "bad oop");
BasicType field_btype = field->type()->basic_type();
int offset = field->offset();
diff --git a/hotspot/src/share/vm/ci/ciKlass.cpp b/hotspot/src/share/vm/ci/ciKlass.cpp
index 03aeff4f265..2169b376c51 100644
--- a/hotspot/src/share/vm/ci/ciKlass.cpp
+++ b/hotspot/src/share/vm/ci/ciKlass.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2011, 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
diff --git a/hotspot/src/share/vm/ci/ciMethodHandle.cpp b/hotspot/src/share/vm/ci/ciMethodHandle.cpp
index 1355b504c4c..ef57f800cab 100644
--- a/hotspot/src/share/vm/ci/ciMethodHandle.cpp
+++ b/hotspot/src/share/vm/ci/ciMethodHandle.cpp
@@ -42,9 +42,20 @@ ciMethod* ciMethodHandle::get_adapter(bool is_invokedynamic) const {
methodHandle callee(_callee->get_methodOop());
// We catch all exceptions here that could happen in the method
// handle compiler and stop the VM.
- MethodHandleCompiler mhc(h, callee, is_invokedynamic, CATCH);
- methodHandle m = mhc.compile(CATCH);
- return CURRENT_ENV->get_object(m())->as_method();
+ MethodHandleCompiler mhc(h, callee, is_invokedynamic, THREAD);
+ if (!HAS_PENDING_EXCEPTION) {
+ methodHandle m = mhc.compile(THREAD);
+ if (!HAS_PENDING_EXCEPTION) {
+ return CURRENT_ENV->get_object(m())->as_method();
+ }
+ }
+ if (PrintMiscellaneous && (Verbose || WizardMode)) {
+ tty->print("*** ciMethodHandle::get_adapter => ");
+ PENDING_EXCEPTION->print();
+ tty->print("*** get_adapter (%s): ", is_invokedynamic ? "indy" : "mh"); ((ciObject*)this)->print(); //@@
+ }
+ CLEAR_PENDING_EXCEPTION;
+ return NULL;
}
diff --git a/hotspot/src/share/vm/ci/ciObjArrayKlass.cpp b/hotspot/src/share/vm/ci/ciObjArrayKlass.cpp
index c5cd7009c47..2fcf2c9be6d 100644
--- a/hotspot/src/share/vm/ci/ciObjArrayKlass.cpp
+++ b/hotspot/src/share/vm/ci/ciObjArrayKlass.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2011, 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
diff --git a/hotspot/src/share/vm/ci/ciObject.hpp b/hotspot/src/share/vm/ci/ciObject.hpp
index 0a93d9f1149..2542d150b6b 100644
--- a/hotspot/src/share/vm/ci/ciObject.hpp
+++ b/hotspot/src/share/vm/ci/ciObject.hpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2011, 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
diff --git a/hotspot/src/share/vm/ci/ciObjectFactory.hpp b/hotspot/src/share/vm/ci/ciObjectFactory.hpp
index 50f585f47a9..12185f2262f 100644
--- a/hotspot/src/share/vm/ci/ciObjectFactory.hpp
+++ b/hotspot/src/share/vm/ci/ciObjectFactory.hpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2011, 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
diff --git a/hotspot/src/share/vm/ci/ciSignature.cpp b/hotspot/src/share/vm/ci/ciSignature.cpp
index b68f3f8caf2..037ba8a8fef 100644
--- a/hotspot/src/share/vm/ci/ciSignature.cpp
+++ b/hotspot/src/share/vm/ci/ciSignature.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2011, 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
diff --git a/hotspot/src/share/vm/ci/ciSignature.hpp b/hotspot/src/share/vm/ci/ciSignature.hpp
index 5ac1170eeee..f455600e7ac 100644
--- a/hotspot/src/share/vm/ci/ciSignature.hpp
+++ b/hotspot/src/share/vm/ci/ciSignature.hpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2011, 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
diff --git a/hotspot/src/share/vm/ci/ciSymbol.cpp b/hotspot/src/share/vm/ci/ciSymbol.cpp
index e1fe49f1e75..d253e596af3 100644
--- a/hotspot/src/share/vm/ci/ciSymbol.cpp
+++ b/hotspot/src/share/vm/ci/ciSymbol.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2011, 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
diff --git a/hotspot/src/share/vm/ci/ciSymbol.hpp b/hotspot/src/share/vm/ci/ciSymbol.hpp
index ec2a588cbf1..aae171a01d3 100644
--- a/hotspot/src/share/vm/ci/ciSymbol.hpp
+++ b/hotspot/src/share/vm/ci/ciSymbol.hpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2011, 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
diff --git a/hotspot/src/share/vm/ci/ciTypeFlow.cpp b/hotspot/src/share/vm/ci/ciTypeFlow.cpp
index 5986df0abaf..a5042d9676f 100644
--- a/hotspot/src/share/vm/ci/ciTypeFlow.cpp
+++ b/hotspot/src/share/vm/ci/ciTypeFlow.cpp
@@ -1871,7 +1871,8 @@ void ciTypeFlow::Block::print_value_on(outputStream* st) const {
// ------------------------------------------------------------------
// ciTypeFlow::Block::print_on
void ciTypeFlow::Block::print_on(outputStream* st) const {
- if ((Verbose || WizardMode)) {
+ if ((Verbose || WizardMode) && (limit() >= 0)) {
+ // Don't print 'dummy' blocks (i.e. blocks with limit() '-1')
outer()->method()->print_codes_on(start(), limit(), st);
}
st->print_cr(" ==================================================== ");
diff --git a/hotspot/src/share/vm/ci/ciTypeFlow.hpp b/hotspot/src/share/vm/ci/ciTypeFlow.hpp
index e83487d1937..5cc5c90c891 100644
--- a/hotspot/src/share/vm/ci/ciTypeFlow.hpp
+++ b/hotspot/src/share/vm/ci/ciTypeFlow.hpp
@@ -34,6 +34,7 @@
#include "ci/ciEnv.hpp"
#include "ci/ciKlass.hpp"
#include "ci/ciMethodBlocks.hpp"
+#include "shark/shark_globals.hpp"
#endif
diff --git a/hotspot/src/share/vm/ci/compilerInterface.hpp b/hotspot/src/share/vm/ci/compilerInterface.hpp
index b3a7d75fc08..66abdbdc513 100644
--- a/hotspot/src/share/vm/ci/compilerInterface.hpp
+++ b/hotspot/src/share/vm/ci/compilerInterface.hpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2011, 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
diff --git a/hotspot/src/share/vm/classfile/classFileError.cpp b/hotspot/src/share/vm/classfile/classFileError.cpp
index f72ec11996d..a9c55fb73a5 100644
--- a/hotspot/src/share/vm/classfile/classFileError.cpp
+++ b/hotspot/src/share/vm/classfile/classFileError.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2011, 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
diff --git a/hotspot/src/share/vm/classfile/classFileParser.cpp b/hotspot/src/share/vm/classfile/classFileParser.cpp
index 8056159b51a..cd4ef079faf 100644
--- a/hotspot/src/share/vm/classfile/classFileParser.cpp
+++ b/hotspot/src/share/vm/classfile/classFileParser.cpp
@@ -152,7 +152,7 @@ void ClassFileParser::parse_constant_pool_entries(constantPoolHandle cp, int len
"Class file version does not support constant tag %u in class file %s",
tag, CHECK);
}
- if (!EnableMethodHandles) {
+ if (!EnableInvokeDynamic) {
classfile_parse_error(
"This JVM does not support constant tag %u in class file %s",
tag, CHECK);
@@ -170,7 +170,6 @@ void ClassFileParser::parse_constant_pool_entries(constantPoolHandle cp, int len
ShouldNotReachHere();
}
break;
- case JVM_CONSTANT_InvokeDynamicTrans : // this tag appears only in old classfiles
case JVM_CONSTANT_InvokeDynamic :
{
if (_major_version < Verifier::INVOKEDYNAMIC_MAJOR_VERSION) {
@@ -186,14 +185,6 @@ void ClassFileParser::parse_constant_pool_entries(constantPoolHandle cp, int len
cfs->guarantee_more(5, CHECK); // bsm_index, nt, tag/access_flags
u2 bootstrap_specifier_index = cfs->get_u2_fast();
u2 name_and_type_index = cfs->get_u2_fast();
- if (tag == JVM_CONSTANT_InvokeDynamicTrans) {
- if (!AllowTransitionalJSR292)
- classfile_parse_error(
- "This JVM does not support transitional InvokeDynamic tag %u in class file %s",
- tag, CHECK);
- cp->invoke_dynamic_trans_at_put(index, bootstrap_specifier_index, name_and_type_index);
- break;
- }
if (_max_bootstrap_specifier_index < (int) bootstrap_specifier_index)
_max_bootstrap_specifier_index = (int) bootstrap_specifier_index; // collect for later
cp->invoke_dynamic_at_put(index, bootstrap_specifier_index, name_and_type_index);
@@ -260,7 +251,7 @@ void ClassFileParser::parse_constant_pool_entries(constantPoolHandle cp, int len
verify_legal_utf8((unsigned char*)utf8_buffer, utf8_length, CHECK);
}
- if (AnonymousClasses && has_cp_patch_at(index)) {
+ if (EnableInvokeDynamic && has_cp_patch_at(index)) {
Handle patch = clear_cp_patch_at(index);
guarantee_property(java_lang_String::is_instance(patch()),
"Illegal utf8 patch at %d in class file %s",
@@ -443,7 +434,7 @@ constantPoolHandle ClassFileParser::parse_constant_pool(TRAPS) {
int ref_index = cp->method_handle_index_at(index);
check_property(
valid_cp_range(ref_index, length) &&
- EnableMethodHandles,
+ EnableInvokeDynamic,
"Invalid constant pool index %u in class file %s",
ref_index, CHECK_(nullHandle));
constantTag tag = cp->tag_at(ref_index);
@@ -487,12 +478,11 @@ constantPoolHandle ClassFileParser::parse_constant_pool(TRAPS) {
check_property(
valid_cp_range(ref_index, length) &&
cp->tag_at(ref_index).is_utf8() &&
- EnableMethodHandles,
+ EnableInvokeDynamic,
"Invalid constant pool index %u in class file %s",
ref_index, CHECK_(nullHandle));
}
break;
- case JVM_CONSTANT_InvokeDynamicTrans :
case JVM_CONSTANT_InvokeDynamic :
{
int name_and_type_ref_index = cp->invoke_dynamic_name_and_type_ref_index_at(index);
@@ -501,14 +491,6 @@ constantPoolHandle ClassFileParser::parse_constant_pool(TRAPS) {
"Invalid constant pool index %u in class file %s",
name_and_type_ref_index,
CHECK_(nullHandle));
- if (tag == JVM_CONSTANT_InvokeDynamicTrans) {
- int bootstrap_method_ref_index = cp->invoke_dynamic_bootstrap_method_ref_index_at(index);
- check_property(valid_cp_range(bootstrap_method_ref_index, length) &&
- cp->tag_at(bootstrap_method_ref_index).is_method_handle(),
- "Invalid constant pool index %u in class file %s",
- bootstrap_method_ref_index,
- CHECK_(nullHandle));
- }
// bootstrap specifier index must be checked later, when BootstrapMethods attr is available
break;
}
@@ -522,7 +504,7 @@ constantPoolHandle ClassFileParser::parse_constant_pool(TRAPS) {
if (_cp_patches != NULL) {
// need to treat this_class specially...
- assert(AnonymousClasses, "");
+ assert(EnableInvokeDynamic, "");
int this_class_index;
{
cfs->guarantee_more(8, CHECK_(nullHandle)); // flags, this_class, super_class, infs_len
@@ -578,6 +560,7 @@ constantPoolHandle ClassFileParser::parse_constant_pool(TRAPS) {
}
break;
}
+ case JVM_CONSTANT_InvokeDynamic:
case JVM_CONSTANT_Fieldref:
case JVM_CONSTANT_Methodref:
case JVM_CONSTANT_InterfaceMethodref: {
@@ -677,7 +660,7 @@ constantPoolHandle ClassFileParser::parse_constant_pool(TRAPS) {
void ClassFileParser::patch_constant_pool(constantPoolHandle cp, int index, Handle patch, TRAPS) {
- assert(AnonymousClasses, "");
+ assert(EnableInvokeDynamic, "");
BasicType patch_type = T_VOID;
switch (cp->tag_at(index).value()) {
@@ -2103,7 +2086,7 @@ methodHandle ClassFileParser::parse_method(constantPoolHandle cp, bool is_interf
_has_vanilla_constructor = true;
}
- if (EnableMethodHandles && (m->is_method_handle_invoke() ||
+ if (EnableInvokeDynamic && (m->is_method_handle_invoke() ||
m->is_method_handle_adapter())) {
THROW_MSG_(vmSymbols::java_lang_VirtualMachineError(),
"Method handle invokers must be defined internally to the VM", nullHandle);
@@ -2771,7 +2754,7 @@ void ClassFileParser::java_lang_invoke_MethodHandle_fix_pre(constantPoolHandle c
// This is not particularly nice, but since there is no way to express
// a native wordSize field in Java, we must do it at this level.
- if (!EnableMethodHandles) return;
+ if (!EnableInvokeDynamic) return;
int word_sig_index = 0;
const int cp_size = cp->length();
@@ -2783,7 +2766,6 @@ void ClassFileParser::java_lang_invoke_MethodHandle_fix_pre(constantPoolHandle c
}
}
- if (AllowTransitionalJSR292 && word_sig_index == 0) return;
if (word_sig_index == 0)
THROW_MSG(vmSymbols::java_lang_VirtualMachineError(),
"missing I or J signature (for vmentry) in java.lang.invoke.MethodHandle");
@@ -2823,7 +2805,6 @@ void ClassFileParser::java_lang_invoke_MethodHandle_fix_pre(constantPoolHandle c
}
}
- if (AllowTransitionalJSR292 && !found_vmentry) return;
if (!found_vmentry)
THROW_MSG(vmSymbols::java_lang_VirtualMachineError(),
"missing vmentry byte field in java.lang.invoke.MethodHandle");
@@ -3191,16 +3172,7 @@ instanceKlassHandle ClassFileParser::parseClassFile(Symbol* name,
next_nonstatic_field_offset = first_nonstatic_field_offset;
// adjust the vmentry field declaration in java.lang.invoke.MethodHandle
- if (EnableMethodHandles && class_name == vmSymbols::java_lang_invoke_MethodHandle() && class_loader.is_null()) {
- java_lang_invoke_MethodHandle_fix_pre(cp, fields, &fac, CHECK_(nullHandle));
- }
- if (AllowTransitionalJSR292 &&
- EnableMethodHandles && class_name == vmSymbols::java_dyn_MethodHandle() && class_loader.is_null()) {
- java_lang_invoke_MethodHandle_fix_pre(cp, fields, &fac, CHECK_(nullHandle));
- }
- if (AllowTransitionalJSR292 &&
- EnableMethodHandles && class_name == vmSymbols::sun_dyn_MethodHandleImpl() && class_loader.is_null()) {
- // allow vmentry field in MethodHandleImpl also
+ if (EnableInvokeDynamic && class_name == vmSymbols::java_lang_invoke_MethodHandle() && class_loader.is_null()) {
java_lang_invoke_MethodHandle_fix_pre(cp, fields, &fac, CHECK_(nullHandle));
}
diff --git a/hotspot/src/share/vm/classfile/classFileParser.hpp b/hotspot/src/share/vm/classfile/classFileParser.hpp
index b48bd99d532..97ae755165f 100644
--- a/hotspot/src/share/vm/classfile/classFileParser.hpp
+++ b/hotspot/src/share/vm/classfile/classFileParser.hpp
@@ -231,11 +231,11 @@ class ClassFileParser VALUE_OBJ_CLASS_SPEC {
char* skip_over_field_signature(char* signature, bool void_ok, unsigned int length, TRAPS);
bool is_anonymous() {
- assert(AnonymousClasses || _host_klass.is_null(), "");
+ assert(EnableInvokeDynamic || _host_klass.is_null(), "");
return _host_klass.not_null();
}
bool has_cp_patch_at(int index) {
- assert(AnonymousClasses, "");
+ assert(EnableInvokeDynamic, "");
assert(index >= 0, "oob");
return (_cp_patches != NULL
&& index < _cp_patches->length()
@@ -258,7 +258,7 @@ class ClassFileParser VALUE_OBJ_CLASS_SPEC {
// constant pool construction, but in later versions they can.
// %%% Let's phase out the old is_klass_reference.
bool is_klass_reference(constantPoolHandle cp, int index) {
- return ((LinkWellKnownClasses || AnonymousClasses)
+ return ((LinkWellKnownClasses || EnableInvokeDynamic)
? cp->tag_at(index).is_klass_or_reference()
: cp->tag_at(index).is_klass_reference());
}
diff --git a/hotspot/src/share/vm/classfile/classFileStream.hpp b/hotspot/src/share/vm/classfile/classFileStream.hpp
index 3c94a1edf1e..cf6f0e5f3bf 100644
--- a/hotspot/src/share/vm/classfile/classFileStream.hpp
+++ b/hotspot/src/share/vm/classfile/classFileStream.hpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2011, 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
diff --git a/hotspot/src/share/vm/classfile/classLoader.cpp b/hotspot/src/share/vm/classfile/classLoader.cpp
index 3536352979c..88dd6166856 100644
--- a/hotspot/src/share/vm/classfile/classLoader.cpp
+++ b/hotspot/src/share/vm/classfile/classLoader.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2011, 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
diff --git a/hotspot/src/share/vm/classfile/classLoader.hpp b/hotspot/src/share/vm/classfile/classLoader.hpp
index 95c36bd87f1..6f816837ae7 100644
--- a/hotspot/src/share/vm/classfile/classLoader.hpp
+++ b/hotspot/src/share/vm/classfile/classLoader.hpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2011, 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
diff --git a/hotspot/src/share/vm/classfile/dictionary.cpp b/hotspot/src/share/vm/classfile/dictionary.cpp
index f3e8be25cfa..b15446c6f19 100644
--- a/hotspot/src/share/vm/classfile/dictionary.cpp
+++ b/hotspot/src/share/vm/classfile/dictionary.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2011, 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
diff --git a/hotspot/src/share/vm/classfile/dictionary.hpp b/hotspot/src/share/vm/classfile/dictionary.hpp
index 157ce15c0a6..98e01695001 100644
--- a/hotspot/src/share/vm/classfile/dictionary.hpp
+++ b/hotspot/src/share/vm/classfile/dictionary.hpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2011, 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
diff --git a/hotspot/src/share/vm/classfile/javaAssertions.cpp b/hotspot/src/share/vm/classfile/javaAssertions.cpp
index e56b617c53d..7884881dedc 100644
--- a/hotspot/src/share/vm/classfile/javaAssertions.cpp
+++ b/hotspot/src/share/vm/classfile/javaAssertions.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2011, 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
diff --git a/hotspot/src/share/vm/classfile/javaClasses.cpp b/hotspot/src/share/vm/classfile/javaClasses.cpp
index 58c3b54666d..81b3e65d4ee 100644
--- a/hotspot/src/share/vm/classfile/javaClasses.cpp
+++ b/hotspot/src/share/vm/classfile/javaClasses.cpp
@@ -67,28 +67,6 @@ static bool find_field(instanceKlass* ik,
return ik->find_local_field(name_symbol, signature_symbol, fd);
}
-static bool find_hacked_field(instanceKlass* ik,
- Symbol* name_symbol, Symbol* signature_symbol,
- fieldDescriptor* fd,
- bool allow_super = false) {
- bool found = find_field(ik, name_symbol, signature_symbol, fd, allow_super);
- if (!found && AllowTransitionalJSR292) {
- Symbol* backup_sig = SystemDictionary::find_backup_signature(signature_symbol);
- if (backup_sig != NULL) {
- found = find_field(ik, name_symbol, backup_sig, fd, allow_super);
- if (TraceMethodHandles) {
- ResourceMark rm;
- tty->print_cr("MethodHandles: %s.%s: backup for %s => %s%s",
- ik->name()->as_C_string(), name_symbol->as_C_string(),
- signature_symbol->as_C_string(), backup_sig->as_C_string(),
- (found ? "" : " (NOT FOUND)"));
- }
- }
- }
- return found;
-}
-#define find_field find_hacked_field /* remove after AllowTransitionalJSR292 */
-
// Helpful routine for computing field offsets at run time rather than hardcoding them
static void
compute_offset(int &dest_offset,
@@ -301,6 +279,15 @@ jchar* java_lang_String::as_unicode_string(oop java_string, int& length) {
return result;
}
+unsigned int java_lang_String::hash_string(oop java_string) {
+ typeArrayOop value = java_lang_String::value(java_string);
+ int offset = java_lang_String::offset(java_string);
+ int length = java_lang_String::length(java_string);
+
+ if (length == 0) return 0;
+ return hash_string(value->char_at_addr(offset), length);
+}
+
Symbol* java_lang_String::as_symbol(Handle java_string, TRAPS) {
oop obj = java_string();
typeArrayOop value = java_lang_String::value(obj);
@@ -2331,9 +2318,8 @@ int java_lang_invoke_AdapterMethodHandle::_conversion_offset;
void java_lang_invoke_MethodHandle::compute_offsets() {
klassOop k = SystemDictionary::MethodHandle_klass();
- if (k != NULL && EnableMethodHandles) {
+ if (k != NULL && EnableInvokeDynamic) {
bool allow_super = false;
- if (AllowTransitionalJSR292) allow_super = true; // temporary, to access java.dyn.MethodHandleImpl
compute_offset(_type_offset, k, vmSymbols::type_name(), vmSymbols::java_lang_invoke_MethodType_signature(), allow_super);
compute_offset(_vmtarget_offset, k, vmSymbols::vmtarget_name(), vmSymbols::object_signature(), allow_super);
compute_offset(_vmentry_offset, k, vmSymbols::vmentry_name(), vmSymbols::machine_word_signature(), allow_super);
@@ -2346,7 +2332,7 @@ void java_lang_invoke_MethodHandle::compute_offsets() {
void java_lang_invoke_MemberName::compute_offsets() {
klassOop k = SystemDictionary::MemberName_klass();
- if (k != NULL && EnableMethodHandles) {
+ if (k != NULL && EnableInvokeDynamic) {
compute_offset(_clazz_offset, k, vmSymbols::clazz_name(), vmSymbols::class_signature());
compute_offset(_name_offset, k, vmSymbols::name_name(), vmSymbols::string_signature());
compute_offset(_type_offset, k, vmSymbols::type_name(), vmSymbols::object_signature());
@@ -2358,14 +2344,14 @@ void java_lang_invoke_MemberName::compute_offsets() {
void java_lang_invoke_DirectMethodHandle::compute_offsets() {
klassOop k = SystemDictionary::DirectMethodHandle_klass();
- if (k != NULL && EnableMethodHandles) {
+ if (k != NULL && EnableInvokeDynamic) {
compute_offset(_vmindex_offset, k, vmSymbols::vmindex_name(), vmSymbols::int_signature(), true);
}
}
void java_lang_invoke_BoundMethodHandle::compute_offsets() {
klassOop k = SystemDictionary::BoundMethodHandle_klass();
- if (k != NULL && EnableMethodHandles) {
+ if (k != NULL && EnableInvokeDynamic) {
compute_offset(_vmargslot_offset, k, vmSymbols::vmargslot_name(), vmSymbols::int_signature(), true);
compute_offset(_argument_offset, k, vmSymbols::argument_name(), vmSymbols::object_signature(), true);
}
@@ -2373,7 +2359,7 @@ void java_lang_invoke_BoundMethodHandle::compute_offsets() {
void java_lang_invoke_AdapterMethodHandle::compute_offsets() {
klassOop k = SystemDictionary::AdapterMethodHandle_klass();
- if (k != NULL && EnableMethodHandles) {
+ if (k != NULL && EnableInvokeDynamic) {
compute_offset(_conversion_offset, k, vmSymbols::conversion_name(), vmSymbols::int_signature(), true);
}
}
@@ -2991,7 +2977,7 @@ void JavaClasses::compute_offsets() {
java_lang_Class::compute_offsets();
java_lang_Thread::compute_offsets();
java_lang_ThreadGroup::compute_offsets();
- if (EnableMethodHandles) {
+ if (EnableInvokeDynamic) {
java_lang_invoke_MethodHandle::compute_offsets();
java_lang_invoke_MemberName::compute_offsets();
java_lang_invoke_DirectMethodHandle::compute_offsets();
@@ -2999,8 +2985,6 @@ void JavaClasses::compute_offsets() {
java_lang_invoke_AdapterMethodHandle::compute_offsets();
java_lang_invoke_MethodType::compute_offsets();
java_lang_invoke_MethodTypeForm::compute_offsets();
- }
- if (EnableInvokeDynamic) {
java_lang_invoke_CallSite::compute_offsets();
}
java_security_AccessControlContext::compute_offsets();
diff --git a/hotspot/src/share/vm/classfile/javaClasses.hpp b/hotspot/src/share/vm/classfile/javaClasses.hpp
index db4af2e6871..bed2ad46ac2 100644
--- a/hotspot/src/share/vm/classfile/javaClasses.hpp
+++ b/hotspot/src/share/vm/classfile/javaClasses.hpp
@@ -109,6 +109,30 @@ class java_lang_String : AllStatic {
static char* as_platform_dependent_str(Handle java_string, TRAPS);
static jchar* as_unicode_string(oop java_string, int& length);
+ // Compute the hash value for a java.lang.String object which would
+ // contain the characters passed in. This hash value is used for at
+ // least two purposes.
+ //
+ // (a) As the hash value used by the StringTable for bucket selection
+ // and comparison (stored in the HashtableEntry structures). This
+ // is used in the String.intern() method.
+ //
+ // (b) As the hash value used by the String object itself, in
+ // String.hashCode(). This value is normally calculate in Java code
+ // in the String.hashCode method(), but is precomputed for String
+ // objects in the shared archive file.
+ //
+ // For this reason, THIS ALGORITHM MUST MATCH String.hashCode().
+ static unsigned int hash_string(jchar* s, int len) {
+ unsigned int h = 0;
+ while (len-- > 0) {
+ h = 31*h + (unsigned int) *s;
+ s++;
+ }
+ return h;
+ }
+ static unsigned int hash_string(oop java_string);
+
static bool equals(oop java_string, jchar* chars, int len);
// Conversion between '.' and '/' formats
diff --git a/hotspot/src/share/vm/classfile/loaderConstraints.cpp b/hotspot/src/share/vm/classfile/loaderConstraints.cpp
index 97ab80b3cae..5e25e4cbd02 100644
--- a/hotspot/src/share/vm/classfile/loaderConstraints.cpp
+++ b/hotspot/src/share/vm/classfile/loaderConstraints.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2011, 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
diff --git a/hotspot/src/share/vm/classfile/loaderConstraints.hpp b/hotspot/src/share/vm/classfile/loaderConstraints.hpp
index 1efec51d5d5..60612f5dba3 100644
--- a/hotspot/src/share/vm/classfile/loaderConstraints.hpp
+++ b/hotspot/src/share/vm/classfile/loaderConstraints.hpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2011, 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
diff --git a/hotspot/src/share/vm/classfile/placeholders.cpp b/hotspot/src/share/vm/classfile/placeholders.cpp
index 9099f28cb51..ef877b1033e 100644
--- a/hotspot/src/share/vm/classfile/placeholders.cpp
+++ b/hotspot/src/share/vm/classfile/placeholders.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2011, 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
diff --git a/hotspot/src/share/vm/classfile/placeholders.hpp b/hotspot/src/share/vm/classfile/placeholders.hpp
index 852bf769426..667c59b8c70 100644
--- a/hotspot/src/share/vm/classfile/placeholders.hpp
+++ b/hotspot/src/share/vm/classfile/placeholders.hpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2011, 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
diff --git a/hotspot/src/share/vm/classfile/resolutionErrors.cpp b/hotspot/src/share/vm/classfile/resolutionErrors.cpp
index c61c6689b39..ed31224e010 100644
--- a/hotspot/src/share/vm/classfile/resolutionErrors.cpp
+++ b/hotspot/src/share/vm/classfile/resolutionErrors.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2011, 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
diff --git a/hotspot/src/share/vm/classfile/resolutionErrors.hpp b/hotspot/src/share/vm/classfile/resolutionErrors.hpp
index fed9c083ddf..03fcf4957bb 100644
--- a/hotspot/src/share/vm/classfile/resolutionErrors.hpp
+++ b/hotspot/src/share/vm/classfile/resolutionErrors.hpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2011, 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
diff --git a/hotspot/src/share/vm/classfile/stackMapFrame.cpp b/hotspot/src/share/vm/classfile/stackMapFrame.cpp
index 864c2257fc8..01620c71848 100644
--- a/hotspot/src/share/vm/classfile/stackMapFrame.cpp
+++ b/hotspot/src/share/vm/classfile/stackMapFrame.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2011, 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
diff --git a/hotspot/src/share/vm/classfile/stackMapFrame.hpp b/hotspot/src/share/vm/classfile/stackMapFrame.hpp
index a6d6a2938b9..1e4c130d46c 100644
--- a/hotspot/src/share/vm/classfile/stackMapFrame.hpp
+++ b/hotspot/src/share/vm/classfile/stackMapFrame.hpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2011, 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
diff --git a/hotspot/src/share/vm/classfile/stackMapTable.cpp b/hotspot/src/share/vm/classfile/stackMapTable.cpp
index 97bf564f192..4d1f599577e 100644
--- a/hotspot/src/share/vm/classfile/stackMapTable.cpp
+++ b/hotspot/src/share/vm/classfile/stackMapTable.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2011, 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
diff --git a/hotspot/src/share/vm/classfile/stackMapTable.hpp b/hotspot/src/share/vm/classfile/stackMapTable.hpp
index 2d2798a717a..08e9bd25465 100644
--- a/hotspot/src/share/vm/classfile/stackMapTable.hpp
+++ b/hotspot/src/share/vm/classfile/stackMapTable.hpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2011, 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
diff --git a/hotspot/src/share/vm/classfile/symbolTable.cpp b/hotspot/src/share/vm/classfile/symbolTable.cpp
index 2ee98db4ef7..e3dd0862910 100644
--- a/hotspot/src/share/vm/classfile/symbolTable.cpp
+++ b/hotspot/src/share/vm/classfile/symbolTable.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2011, 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
@@ -480,33 +480,6 @@ class StableMemoryChecker : public StackObj {
// --------------------------------------------------------------------------
-
-
-// Compute the hash value for a java.lang.String object which would
-// contain the characters passed in. This hash value is used for at
-// least two purposes.
-//
-// (a) As the hash value used by the StringTable for bucket selection
-// and comparison (stored in the HashtableEntry structures). This
-// is used in the String.intern() method.
-//
-// (b) As the hash value used by the String object itself, in
-// String.hashCode(). This value is normally calculate in Java code
-// in the String.hashCode method(), but is precomputed for String
-// objects in the shared archive file.
-//
-// For this reason, THIS ALGORITHM MUST MATCH String.hashCode().
-
-int StringTable::hash_string(jchar* s, int len) {
- unsigned h = 0;
- while (len-- > 0) {
- h = 31*h + (unsigned) *s;
- s++;
- }
- return h;
-}
-
-
StringTable* StringTable::_the_table = NULL;
oop StringTable::lookup(int index, jchar* name,
@@ -561,7 +534,7 @@ oop StringTable::lookup(Symbol* symbol) {
ResourceMark rm;
int length;
jchar* chars = symbol->as_unicode(length);
- unsigned int hashValue = hash_string(chars, length);
+ unsigned int hashValue = java_lang_String::hash_string(chars, length);
int index = the_table()->hash_to_index(hashValue);
return the_table()->lookup(index, chars, length, hashValue);
}
@@ -569,7 +542,7 @@ oop StringTable::lookup(Symbol* symbol) {
oop StringTable::intern(Handle string_or_null, jchar* name,
int len, TRAPS) {
- unsigned int hashValue = hash_string(name, len);
+ unsigned int hashValue = java_lang_String::hash_string(name, len);
int index = the_table()->hash_to_index(hashValue);
oop string = the_table()->lookup(index, name, len, hashValue);
@@ -663,10 +636,7 @@ void StringTable::verify() {
oop s = p->literal();
guarantee(s != NULL, "interned string is NULL");
guarantee(s->is_perm() || !JavaObjectsInPerm, "interned string not in permspace");
-
- int length;
- jchar* chars = java_lang_String::as_unicode_string(s, length);
- unsigned int h = hash_string(chars, length);
+ unsigned int h = java_lang_String::hash_string(s);
guarantee(p->hash() == h, "broken hash in string table entry");
guarantee(the_table()->hash_to_index(h) == i,
"wrong index in string table");
diff --git a/hotspot/src/share/vm/classfile/symbolTable.hpp b/hotspot/src/share/vm/classfile/symbolTable.hpp
index 13aef77ad7f..ca0b07d7888 100644
--- a/hotspot/src/share/vm/classfile/symbolTable.hpp
+++ b/hotspot/src/share/vm/classfile/symbolTable.hpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2011, 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
@@ -242,8 +242,6 @@ public:
_the_table = new StringTable(t, number_of_entries);
}
- static int hash_string(jchar* s, int len);
-
// GC support
// Delete pointers to otherwise-unreachable objects.
static void unlink(BoolObjectClosure* cl);
diff --git a/hotspot/src/share/vm/classfile/systemDictionary.cpp b/hotspot/src/share/vm/classfile/systemDictionary.cpp
index ac935f90510..17a9f740685 100644
--- a/hotspot/src/share/vm/classfile/systemDictionary.cpp
+++ b/hotspot/src/share/vm/classfile/systemDictionary.cpp
@@ -1017,7 +1017,7 @@ klassOop SystemDictionary::parse_stream(Symbol* class_name,
}
if (host_klass.not_null() && k.not_null()) {
- assert(AnonymousClasses, "");
+ assert(EnableInvokeDynamic, "");
// If it's anonymous, initialize it now, since nobody else will.
k->set_host_klass(host_klass());
@@ -1887,99 +1887,27 @@ static const short wk_init_info[] = {
0
};
-Symbol* SystemDictionary::find_backup_symbol(Symbol* symbol,
- const char* from_prefix,
- const char* to_prefix) {
- assert(AllowTransitionalJSR292, ""); // delete this subroutine
- Symbol* backup_symbol = NULL;
- size_t from_len = strlen(from_prefix);
- if (strncmp((const char*) symbol->base(), from_prefix, from_len) != 0)
- return NULL;
- char buf[100];
- size_t to_len = strlen(to_prefix);
- size_t tail_len = symbol->utf8_length() - from_len;
- size_t new_len = to_len + tail_len;
- guarantee(new_len < sizeof(buf), "buf too small");
- memcpy(buf, to_prefix, to_len);
- memcpy(buf + to_len, symbol->base() + from_len, tail_len);
- buf[new_len] = '\0';
- vmSymbols::SID backup_sid = vmSymbols::find_sid(buf);
- if (backup_sid != vmSymbols::NO_SID) {
- backup_symbol = vmSymbols::symbol_at(backup_sid);
- }
- return backup_symbol;
-}
-
-Symbol* SystemDictionary::find_backup_class_name(Symbol* symbol) {
- assert(AllowTransitionalJSR292, ""); // delete this subroutine
- if (symbol == NULL) return NULL;
- Symbol* backup_symbol = find_backup_symbol(symbol, "java/lang/invoke/", "java/dyn/"); // AllowTransitionalJSR292 ONLY
- if (backup_symbol == NULL)
- backup_symbol = find_backup_symbol(symbol, "java/dyn/", "sun/dyn/"); // AllowTransitionalJSR292 ONLY
- return backup_symbol;
-}
-
-Symbol* SystemDictionary::find_backup_signature(Symbol* symbol) {
- assert(AllowTransitionalJSR292, ""); // delete this subroutine
- if (symbol == NULL) return NULL;
- return find_backup_symbol(symbol, "Ljava/lang/invoke/", "Ljava/dyn/");
-}
-
bool SystemDictionary::initialize_wk_klass(WKID id, int init_opt, TRAPS) {
assert(id >= (int)FIRST_WKID && id < (int)WKID_LIMIT, "oob");
int info = wk_init_info[id - FIRST_WKID];
int sid = (info >> CEIL_LG_OPTION_LIMIT);
Symbol* symbol = vmSymbols::symbol_at((vmSymbols::SID)sid);
klassOop* klassp = &_well_known_klasses[id];
- bool pre_load = (init_opt < SystemDictionary::Opt);
- bool try_load = true;
+ bool must_load = (init_opt < SystemDictionary::Opt);
+ bool try_load = true;
if (init_opt == SystemDictionary::Opt_Kernel) {
#ifndef KERNEL
try_load = false;
#endif //KERNEL
}
- Symbol* backup_symbol = NULL; // symbol to try if the current symbol fails
- if (init_opt == SystemDictionary::Pre_JSR292) {
- if (!EnableMethodHandles) try_load = false; // do not bother to load such classes
- if (AllowTransitionalJSR292) {
- backup_symbol = find_backup_class_name(symbol);
- if (try_load && PreferTransitionalJSR292) {
- while (backup_symbol != NULL) {
- (*klassp) = resolve_or_null(backup_symbol, CHECK_0); // try backup early
- if (TraceMethodHandles) {
- ResourceMark rm;
- tty->print_cr("MethodHandles: try backup first for %s => %s (%s)",
- symbol->as_C_string(), backup_symbol->as_C_string(),
- ((*klassp) == NULL) ? "no such class" : "backup load succeeded");
- }
- if ((*klassp) != NULL) return true;
- backup_symbol = find_backup_class_name(backup_symbol); // find next backup
- }
- }
- }
- }
- if ((*klassp) != NULL) return true;
- if (!try_load) return false;
- while (symbol != NULL) {
- bool must_load = (pre_load && (backup_symbol == NULL));
+ if ((*klassp) == NULL && try_load) {
if (must_load) {
(*klassp) = resolve_or_fail(symbol, true, CHECK_0); // load required class
} else {
(*klassp) = resolve_or_null(symbol, CHECK_0); // load optional klass
}
- if ((*klassp) != NULL) return true;
- // Go around again. Example of long backup sequence:
- // java.lang.invoke.MemberName, java.dyn.MemberName, sun.dyn.MemberName, ONLY if AllowTransitionalJSR292
- if (TraceMethodHandles && (backup_symbol != NULL)) {
- ResourceMark rm;
- tty->print_cr("MethodHandles: backup for %s => %s",
- symbol->as_C_string(), backup_symbol->as_C_string());
- }
- symbol = backup_symbol;
- if (AllowTransitionalJSR292)
- backup_symbol = find_backup_class_name(symbol);
}
- return false;
+ return ((*klassp) != NULL);
}
void SystemDictionary::initialize_wk_klasses_until(WKID limit_id, WKID &start_id, TRAPS) {
@@ -2038,25 +1966,15 @@ void SystemDictionary::initialize_preloaded_classes(TRAPS) {
instanceKlass::cast(WK_KLASS(FinalReference_klass))->set_reference_type(REF_FINAL);
instanceKlass::cast(WK_KLASS(PhantomReference_klass))->set_reference_type(REF_PHANTOM);
- WKID meth_group_start = WK_KLASS_ENUM_NAME(MethodHandle_klass);
- WKID meth_group_end = WK_KLASS_ENUM_NAME(WrongMethodTypeException_klass);
- initialize_wk_klasses_until(meth_group_start, scan, CHECK);
- if (EnableMethodHandles) {
- initialize_wk_klasses_through(meth_group_end, scan, CHECK);
- }
- if (_well_known_klasses[meth_group_start] == NULL) {
- // Skip the rest of the method handle classes, if MethodHandle is not loaded.
- scan = WKID(meth_group_end+1);
- }
- WKID indy_group_start = WK_KLASS_ENUM_NAME(Linkage_klass);
- WKID indy_group_end = WK_KLASS_ENUM_NAME(CallSite_klass);
- initialize_wk_klasses_until(indy_group_start, scan, CHECK);
+ // JSR 292 classes
+ WKID jsr292_group_start = WK_KLASS_ENUM_NAME(MethodHandle_klass);
+ WKID jsr292_group_end = WK_KLASS_ENUM_NAME(CallSite_klass);
+ initialize_wk_klasses_until(jsr292_group_start, scan, CHECK);
if (EnableInvokeDynamic) {
- initialize_wk_klasses_through(indy_group_end, scan, CHECK);
- }
- if (_well_known_klasses[indy_group_start] == NULL) {
- // Skip the rest of the dynamic typing classes, if Linkage is not loaded.
- scan = WKID(indy_group_end+1);
+ initialize_wk_klasses_through(jsr292_group_end, scan, CHECK);
+ } else {
+ // Skip the JSR 292 classes, if not enabled.
+ scan = WKID(jsr292_group_end + 1);
}
initialize_wk_klasses_until(WKID_LIMIT, scan, CHECK);
@@ -2407,7 +2325,7 @@ methodOop SystemDictionary::find_method_handle_invoke(Symbol* name,
Symbol* signature,
KlassHandle accessing_klass,
TRAPS) {
- if (!EnableMethodHandles) return NULL;
+ if (!EnableInvokeDynamic) return NULL;
vmSymbols::SID name_id = vmSymbols::find_sid(name);
assert(name_id != vmSymbols::NO_SID, "must be a known name");
unsigned int hash = invoke_method_table()->compute_hash(signature, name_id);
@@ -2419,9 +2337,7 @@ methodOop SystemDictionary::find_method_handle_invoke(Symbol* name,
// Must create lots of stuff here, but outside of the SystemDictionary lock.
if (THREAD->is_Compiler_thread())
return NULL; // do not attempt from within compiler
- bool for_invokeGeneric = (name_id == vmSymbols::VM_SYMBOL_ENUM_NAME(invokeGeneric_name));
- if (AllowInvokeForInvokeGeneric && name_id == vmSymbols::VM_SYMBOL_ENUM_NAME(invoke_name))
- for_invokeGeneric = true;
+ bool for_invokeGeneric = (name_id != vmSymbols::VM_SYMBOL_ENUM_NAME(invokeExact_name));
bool found_on_bcp = false;
Handle mt = find_method_handle_type(signature, accessing_klass,
for_invokeGeneric,
@@ -2508,14 +2424,10 @@ Handle SystemDictionary::find_method_handle_type(Symbol* signature,
JavaCallArguments args(Handle(THREAD, rt()));
args.push_oop(pts());
JavaValue result(T_OBJECT);
- Symbol* findMethodHandleType_signature = vmSymbols::findMethodHandleType_signature();
- if (AllowTransitionalJSR292 && SystemDictionaryHandles::MethodType_klass()->name() == vmSymbols::java_dyn_MethodType()) {
- findMethodHandleType_signature = vmSymbols::findMethodHandleType_TRANS_signature();
- }
JavaCalls::call_static(&result,
SystemDictionary::MethodHandleNatives_klass(),
vmSymbols::findMethodHandleType_name(),
- findMethodHandleType_signature,
+ vmSymbols::findMethodHandleType_signature(),
&args, CHECK_(empty));
Handle method_type(THREAD, (oop) result.get_jobject());
@@ -2523,14 +2435,10 @@ Handle SystemDictionary::find_method_handle_type(Symbol* signature,
// call java.lang.invoke.MethodHandleNatives::notifyGenericMethodType(MethodType) -> void
JavaCallArguments args(Handle(THREAD, method_type()));
JavaValue no_result(T_VOID);
- Symbol* notifyGenericMethodType_signature = vmSymbols::notifyGenericMethodType_signature();
- if (AllowTransitionalJSR292 && SystemDictionaryHandles::MethodType_klass()->name() == vmSymbols::java_dyn_MethodType()) {
- notifyGenericMethodType_signature = vmSymbols::notifyGenericMethodType_TRANS_signature();
- }
JavaCalls::call_static(&no_result,
SystemDictionary::MethodHandleNatives_klass(),
vmSymbols::notifyGenericMethodType_name(),
- notifyGenericMethodType_signature,
+ vmSymbols::notifyGenericMethodType_signature(),
&args, THREAD);
if (HAS_PENDING_EXCEPTION) {
// If the notification fails, just kill it.
@@ -2579,14 +2487,10 @@ Handle SystemDictionary::link_method_handle_constant(KlassHandle caller,
args.push_oop(name());
args.push_oop(type());
JavaValue result(T_OBJECT);
- Symbol* linkMethodHandleConstant_signature = vmSymbols::linkMethodHandleConstant_signature();
- if (AllowTransitionalJSR292 && SystemDictionaryHandles::MethodHandle_klass()->name() == vmSymbols::java_dyn_MethodHandle()) {
- linkMethodHandleConstant_signature = vmSymbols::linkMethodHandleConstant_TRANS_signature();
- }
JavaCalls::call_static(&result,
SystemDictionary::MethodHandleNatives_klass(),
vmSymbols::linkMethodHandleConstant_name(),
- linkMethodHandleConstant_signature,
+ vmSymbols::linkMethodHandleConstant_signature(),
&args, CHECK_(empty));
return Handle(THREAD, (oop) result.get_jobject());
}
@@ -2617,17 +2521,10 @@ Handle SystemDictionary::make_dynamic_call_site(Handle bootstrap_method,
args.push_oop(caller_mname());
args.push_int(caller_bci);
JavaValue result(T_OBJECT);
- Symbol* makeDynamicCallSite_signature = vmSymbols::makeDynamicCallSite_signature();
- if (AllowTransitionalJSR292 && SystemDictionaryHandles::MethodHandleNatives_klass()->name() == vmSymbols::sun_dyn_MethodHandleNatives()) {
- makeDynamicCallSite_signature = vmSymbols::makeDynamicCallSite_TRANS_signature();
- }
- if (AllowTransitionalJSR292 && SystemDictionaryHandles::MethodHandleNatives_klass()->name() == vmSymbols::java_dyn_MethodHandleNatives()) {
- makeDynamicCallSite_signature = vmSymbols::makeDynamicCallSite_TRANS2_signature();
- }
JavaCalls::call_static(&result,
SystemDictionary::MethodHandleNatives_klass(),
vmSymbols::makeDynamicCallSite_name(),
- makeDynamicCallSite_signature,
+ vmSymbols::makeDynamicCallSite_signature(),
&args, CHECK_(empty));
oop call_site_oop = (oop) result.get_jobject();
assert(call_site_oop->is_oop()
@@ -2708,28 +2605,10 @@ Handle SystemDictionary::find_bootstrap_method(methodHandle caller_method, int c
argument_info_result = argument_info; // return argument_info to caller
return bsm;
}
- // else null BSM; fall through
- } else if (tag.is_name_and_type()) {
- // JSR 292 EDR does not have JVM_CONSTANT_InvokeDynamic
- // a bare name&type defaults its BSM to null, so fall through...
} else {
ShouldNotReachHere(); // verifier does not allow this
}
- // Fall through to pick up the per-class bootstrap method.
- // This mechanism may go away in the PFD.
- assert(AllowTransitionalJSR292, "else the verifier should have stopped us already");
- argument_info_result = empty; // return no argument_info to caller
- oop bsm_oop = instanceKlass::cast(caller_method->method_holder())->bootstrap_method();
- if (bsm_oop != NULL) {
- if (TraceMethodHandles) {
- tty->print_cr("bootstrap method for "PTR_FORMAT" registered as "PTR_FORMAT":",
- (intptr_t) caller_method(), (intptr_t) bsm_oop);
- }
- assert(bsm_oop->is_oop(), "must be sane");
- return Handle(THREAD, bsm_oop);
- }
-
return empty;
}
diff --git a/hotspot/src/share/vm/classfile/systemDictionary.hpp b/hotspot/src/share/vm/classfile/systemDictionary.hpp
index 0719fc33b94..ab84ebf591e 100644
--- a/hotspot/src/share/vm/classfile/systemDictionary.hpp
+++ b/hotspot/src/share/vm/classfile/systemDictionary.hpp
@@ -146,7 +146,6 @@ class SymbolPropertyTable;
/* support for dynamic typing; it's OK if these are NULL in earlier JDKs */ \
template(MethodHandle_klass, java_lang_invoke_MethodHandle, Pre_JSR292) \
template(MemberName_klass, java_lang_invoke_MemberName, Pre_JSR292) \
- template(MethodHandleImpl_klass, sun_dyn_MethodHandleImpl, Opt) /* AllowTransitionalJSR292 ONLY */ \
template(MethodHandleNatives_klass, java_lang_invoke_MethodHandleNatives, Pre_JSR292) \
template(AdapterMethodHandle_klass, java_lang_invoke_AdapterMethodHandle, Pre_JSR292) \
template(BoundMethodHandle_klass, java_lang_invoke_BoundMethodHandle, Pre_JSR292) \
@@ -154,7 +153,6 @@ class SymbolPropertyTable;
template(MethodType_klass, java_lang_invoke_MethodType, Pre_JSR292) \
template(MethodTypeForm_klass, java_lang_invoke_MethodTypeForm, Pre_JSR292) \
template(WrongMethodTypeException_klass, java_lang_invoke_WrongMethodTypeException, Pre_JSR292) \
- template(Linkage_klass, java_lang_invoke_Linkage, Opt) /* AllowTransitionalJSR292 ONLY */ \
template(CallSite_klass, java_lang_invoke_CallSite, Pre_JSR292) \
/* Note: MethodHandle must be first, and CallSite last in group */ \
\
@@ -207,7 +205,7 @@ class SystemDictionary : AllStatic {
enum InitOption {
Pre, // preloaded; error if not present
- Pre_JSR292, // preloaded if EnableMethodHandles
+ Pre_JSR292, // preloaded if EnableInvokeDynamic
// Order is significant. Options before this point require resolve_or_fail.
// Options after this point will use resolve_or_null instead.
@@ -422,8 +420,6 @@ public:
initialize_wk_klasses_until((WKID) limit, start_id, THREAD);
}
- static Symbol* find_backup_symbol(Symbol* symbol, const char* from_prefix, const char* to_prefix);
-
public:
#define WK_KLASS_DECLARE(name, ignore_symbol, option) \
static klassOop name() { return check_klass_##option(_well_known_klasses[WK_KLASS_ENUM_NAME(name)]); }
@@ -445,9 +441,6 @@ public:
static void load_abstract_ownable_synchronizer_klass(TRAPS);
- static Symbol* find_backup_class_name(Symbol* class_name_symbol);
- static Symbol* find_backup_signature(Symbol* signature_symbol);
-
private:
// Tells whether ClassLoader.loadClassInternal is present
static bool has_loadClassInternal() { return _has_loadClassInternal; }
diff --git a/hotspot/src/share/vm/classfile/verificationType.cpp b/hotspot/src/share/vm/classfile/verificationType.cpp
index 0e994fcf4be..3e204f7940b 100644
--- a/hotspot/src/share/vm/classfile/verificationType.cpp
+++ b/hotspot/src/share/vm/classfile/verificationType.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2011, 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
diff --git a/hotspot/src/share/vm/classfile/verificationType.hpp b/hotspot/src/share/vm/classfile/verificationType.hpp
index dcf8927f9ef..260d8cea509 100644
--- a/hotspot/src/share/vm/classfile/verificationType.hpp
+++ b/hotspot/src/share/vm/classfile/verificationType.hpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2011, 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
diff --git a/hotspot/src/share/vm/classfile/verifier.cpp b/hotspot/src/share/vm/classfile/verifier.cpp
index 67a2a66dbe8..9ab47f7b664 100644
--- a/hotspot/src/share/vm/classfile/verifier.cpp
+++ b/hotspot/src/share/vm/classfile/verifier.cpp
@@ -1671,19 +1671,13 @@ void ClassVerifier::verify_ldc(
VerificationType::long_type(),
VerificationType::long2_type(), CHECK_VERIFY(this));
} else if (tag.is_method_handle()) {
- Symbol* methodHandle_name = vmSymbols::java_lang_invoke_MethodHandle();
- if (AllowTransitionalJSR292 && !Universe::is_bootstrapping())
- methodHandle_name = SystemDictionaryHandles::MethodHandle_klass()->name();
current_frame->push_stack(
VerificationType::reference_type(
- methodHandle_name), CHECK_VERIFY(this));
+ vmSymbols::java_lang_invoke_MethodHandle()), CHECK_VERIFY(this));
} else if (tag.is_method_type()) {
- Symbol* methodType_name = vmSymbols::java_lang_invoke_MethodType();
- if (AllowTransitionalJSR292 && !Universe::is_bootstrapping())
- methodType_name = SystemDictionaryHandles::MethodType_klass()->name();
current_frame->push_stack(
VerificationType::reference_type(
- methodType_name), CHECK_VERIFY(this));
+ vmSymbols::java_lang_invoke_MethodType()), CHECK_VERIFY(this));
} else {
verify_error(bci, "Invalid index in ldc");
return;
@@ -1950,8 +1944,7 @@ void ClassVerifier::verify_invoke_instructions(
unsigned int types = (opcode == Bytecodes::_invokeinterface
? 1 << JVM_CONSTANT_InterfaceMethodref
: opcode == Bytecodes::_invokedynamic
- ? ((AllowTransitionalJSR292 ? 1 << JVM_CONSTANT_NameAndType : 0)
- |1 << JVM_CONSTANT_InvokeDynamic)
+ ? 1 << JVM_CONSTANT_InvokeDynamic
: 1 << JVM_CONSTANT_Methodref);
verify_cp_type(index, cp, types, CHECK_VERIFY(this));
diff --git a/hotspot/src/share/vm/classfile/verifier.hpp b/hotspot/src/share/vm/classfile/verifier.hpp
index 97f51c9579f..66868587ea0 100644
--- a/hotspot/src/share/vm/classfile/verifier.hpp
+++ b/hotspot/src/share/vm/classfile/verifier.hpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1998, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 2011, 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
diff --git a/hotspot/src/share/vm/classfile/vmSymbols.hpp b/hotspot/src/share/vm/classfile/vmSymbols.hpp
index 47f5bca3346..cfe386b50b0 100644
--- a/hotspot/src/share/vm/classfile/vmSymbols.hpp
+++ b/hotspot/src/share/vm/classfile/vmSymbols.hpp
@@ -245,44 +245,15 @@
template(java_lang_invoke_AdapterMethodHandle, "java/lang/invoke/AdapterMethodHandle") \
template(java_lang_invoke_BoundMethodHandle, "java/lang/invoke/BoundMethodHandle") \
template(java_lang_invoke_DirectMethodHandle, "java/lang/invoke/DirectMethodHandle") \
- /* temporary transitional public names from 6839872: */ \
- template(java_dyn_InvokeDynamic, "java/dyn/InvokeDynamic") /* AllowTransitionalJSR292 ONLY */ \
- template(java_dyn_Linkage, "java/dyn/Linkage") /* AllowTransitionalJSR292 ONLY */ \
- template(java_dyn_CallSite, "java/dyn/CallSite") /* AllowTransitionalJSR292 ONLY */ \
- template(java_dyn_MethodHandle, "java/dyn/MethodHandle") /* AllowTransitionalJSR292 ONLY */ \
- template(java_dyn_MethodType, "java/dyn/MethodType") /* AllowTransitionalJSR292 ONLY */ \
- template(java_dyn_WrongMethodTypeException, "java/dyn/WrongMethodTypeException") /* AllowTransitionalJSR292 ONLY */ \
- template(java_dyn_MethodType_signature, "Ljava/dyn/MethodType;") /* AllowTransitionalJSR292 ONLY */ \
- template(java_dyn_MethodHandle_signature, "Ljava/dyn/MethodHandle;") /* AllowTransitionalJSR292 ONLY */ \
- /* temporary transitional internal names from 6839872: */ \
- template(java_dyn_MethodTypeForm, "java/dyn/MethodTypeForm") /* AllowTransitionalJSR292 ONLY */ \
- template(java_dyn_MethodTypeForm_signature, "Ljava/dyn/MethodTypeForm;") /* AllowTransitionalJSR292 ONLY */ \
- template(java_dyn_MemberName, "java/dyn/MemberName") /* AllowTransitionalJSR292 ONLY */ \
- template(java_dyn_MethodHandleNatives, "java/dyn/MethodHandleNatives") /* AllowTransitionalJSR292 ONLY */ \
- template(java_dyn_AdapterMethodHandle, "java/dyn/AdapterMethodHandle") /* AllowTransitionalJSR292 ONLY */ \
- template(java_dyn_BoundMethodHandle, "java/dyn/BoundMethodHandle") /* AllowTransitionalJSR292 ONLY */ \
- template(java_dyn_DirectMethodHandle, "java/dyn/DirectMethodHandle") /* AllowTransitionalJSR292 ONLY */ \
- /* temporary transitional internal names from EDR: */ \
- template(sun_dyn_MemberName, "sun/dyn/MemberName") /* AllowTransitionalJSR292 ONLY */ \
- template(sun_dyn_MethodHandleImpl, "sun/dyn/MethodHandleImpl") /* AllowTransitionalJSR292 ONLY */ \
- template(sun_dyn_MethodHandleNatives, "sun/dyn/MethodHandleNatives") /* AllowTransitionalJSR292 ONLY */ \
- template(sun_dyn_AdapterMethodHandle, "sun/dyn/AdapterMethodHandle") /* AllowTransitionalJSR292 ONLY */ \
- template(sun_dyn_BoundMethodHandle, "sun/dyn/BoundMethodHandle") /* AllowTransitionalJSR292 ONLY */ \
- template(sun_dyn_DirectMethodHandle, "sun/dyn/DirectMethodHandle") /* AllowTransitionalJSR292 ONLY */ \
/* internal up-calls made only by the JVM, via class sun.invoke.MethodHandleNatives: */ \
template(findMethodHandleType_name, "findMethodHandleType") \
template(findMethodHandleType_signature, "(Ljava/lang/Class;[Ljava/lang/Class;)Ljava/lang/invoke/MethodType;") \
- template(findMethodHandleType_TRANS_signature, "(Ljava/lang/Class;[Ljava/lang/Class;)Ljava/dyn/MethodType;") /* AllowTransitionalJSR292 ONLY */ \
template(notifyGenericMethodType_name, "notifyGenericMethodType") \
template(notifyGenericMethodType_signature, "(Ljava/lang/invoke/MethodType;)V") \
- template(notifyGenericMethodType_TRANS_signature, "(Ljava/dyn/MethodType;)V") /* AllowTransitionalJSR292 ONLY */ \
template(linkMethodHandleConstant_name, "linkMethodHandleConstant") \
template(linkMethodHandleConstant_signature, "(Ljava/lang/Class;ILjava/lang/Class;Ljava/lang/String;Ljava/lang/Object;)Ljava/lang/invoke/MethodHandle;") \
- template(linkMethodHandleConstant_TRANS_signature, "(Ljava/lang/Class;ILjava/lang/Class;Ljava/lang/String;Ljava/lang/Object;)Ljava/dyn/MethodHandle;") /* AllowTransitionalJSR292 ONLY */ \
template(makeDynamicCallSite_name, "makeDynamicCallSite") \
template(makeDynamicCallSite_signature, "(Ljava/lang/invoke/MethodHandle;Ljava/lang/String;Ljava/lang/invoke/MethodType;Ljava/lang/Object;Ljava/lang/invoke/MemberName;I)Ljava/lang/invoke/CallSite;") \
- template(makeDynamicCallSite_TRANS_signature, "(Ljava/dyn/MethodHandle;Ljava/lang/String;Ljava/dyn/MethodType;Ljava/lang/Object;Lsun/dyn/MemberName;I)Ljava/dyn/CallSite;") /* AllowTransitionalJSR292 ONLY */ \
- template(makeDynamicCallSite_TRANS2_signature, "(Ljava/dyn/MethodHandle;Ljava/lang/String;Ljava/dyn/MethodType;Ljava/lang/Object;Ljava/dyn/MemberName;I)Ljava/dyn/CallSite;") /* AllowTransitionalJSR292 ONLY */ \
NOT_LP64( do_alias(machine_word_signature, int_signature) ) \
LP64_ONLY( do_alias(machine_word_signature, long_signature) ) \
\
@@ -911,8 +882,6 @@
do_intrinsic(_invoke, java_lang_reflect_Method, invoke_name, object_object_array_object_signature, F_R) \
/* (symbols invoke_name and invoke_signature defined above) */ \
do_intrinsic(_checkSpreadArgument, java_lang_invoke_MethodHandleNatives, checkSpreadArgument_name, checkSpreadArgument_signature, F_S) \
- do_intrinsic(_checkSpreadArgument_TRANS,sun_dyn_MethodHandleImpl, checkSpreadArgument_name, checkSpreadArgument_signature, F_S) /* AllowTransitionalJSR292 ONLY */ \
- do_intrinsic(_checkSpreadArgument_TRANS2,java_dyn_MethodHandleNatives, checkSpreadArgument_name, checkSpreadArgument_signature, F_S) /* AllowTransitionalJSR292 ONLY */ \
do_name( checkSpreadArgument_name, "checkSpreadArgument") \
do_name( checkSpreadArgument_signature, "(Ljava/lang/Object;I)V") \
do_intrinsic(_invokeExact, java_lang_invoke_MethodHandle, invokeExact_name, object_array_object_signature, F_RN) \
diff --git a/hotspot/src/share/vm/code/codeBlob.cpp b/hotspot/src/share/vm/code/codeBlob.cpp
index b90ed8cbdda..dead37cc336 100644
--- a/hotspot/src/share/vm/code/codeBlob.cpp
+++ b/hotspot/src/share/vm/code/codeBlob.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1998, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 2011, 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
diff --git a/hotspot/src/share/vm/code/codeCache.cpp b/hotspot/src/share/vm/code/codeCache.cpp
index ce3b4dc9559..4dba8927b3e 100644
--- a/hotspot/src/share/vm/code/codeCache.cpp
+++ b/hotspot/src/share/vm/code/codeCache.cpp
@@ -964,3 +964,16 @@ void CodeCache::log_state(outputStream* st) {
nof_blobs(), nof_nmethods(), nof_adapters(),
unallocated_capacity(), largest_free_block());
}
+
+size_t CodeCache::largest_free_block() {
+ // This is called both with and without CodeCache_lock held so
+ // handle both cases.
+ if (CodeCache_lock->owned_by_self()) {
+ return _heap->largest_free_block();
+ } else {
+ // Avoid lock ordering problems with ttyLock.
+ ttyUnlocker ttyul;
+ MutexLockerEx mu(CodeCache_lock, Mutex::_no_safepoint_check_flag);
+ return _heap->largest_free_block();
+ }
+}
diff --git a/hotspot/src/share/vm/code/codeCache.hpp b/hotspot/src/share/vm/code/codeCache.hpp
index 42ea1b68940..bdd128e9813 100644
--- a/hotspot/src/share/vm/code/codeCache.hpp
+++ b/hotspot/src/share/vm/code/codeCache.hpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2011, 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 @@ class CodeCache : AllStatic {
static size_t capacity() { return _heap->capacity(); }
static size_t max_capacity() { return _heap->max_capacity(); }
static size_t unallocated_capacity() { return _heap->unallocated_capacity(); }
- static size_t largest_free_block() { return _heap->largest_free_block(); }
+ static size_t largest_free_block();
static bool needs_flushing() { return largest_free_block() < CodeCacheFlushingMinimumFreeSpace; }
static bool needs_cache_clean() { return _needs_cache_clean; }
diff --git a/hotspot/src/share/vm/code/compiledIC.cpp b/hotspot/src/share/vm/code/compiledIC.cpp
index b374257061e..3496f70debc 100644
--- a/hotspot/src/share/vm/code/compiledIC.cpp
+++ b/hotspot/src/share/vm/code/compiledIC.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2011, 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
diff --git a/hotspot/src/share/vm/code/compiledIC.hpp b/hotspot/src/share/vm/code/compiledIC.hpp
index 979dcd52300..fe1cfb30bf8 100644
--- a/hotspot/src/share/vm/code/compiledIC.hpp
+++ b/hotspot/src/share/vm/code/compiledIC.hpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2011, 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
diff --git a/hotspot/src/share/vm/code/dependencies.cpp b/hotspot/src/share/vm/code/dependencies.cpp
index fb0d1cf42ee..c1529652053 100644
--- a/hotspot/src/share/vm/code/dependencies.cpp
+++ b/hotspot/src/share/vm/code/dependencies.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2011, 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
diff --git a/hotspot/src/share/vm/code/icBuffer.cpp b/hotspot/src/share/vm/code/icBuffer.cpp
index 90dbf934a47..ed704575ede 100644
--- a/hotspot/src/share/vm/code/icBuffer.cpp
+++ b/hotspot/src/share/vm/code/icBuffer.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2011, 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
diff --git a/hotspot/src/share/vm/code/nmethod.cpp b/hotspot/src/share/vm/code/nmethod.cpp
index 40a1360c98e..6ba2cde5b00 100644
--- a/hotspot/src/share/vm/code/nmethod.cpp
+++ b/hotspot/src/share/vm/code/nmethod.cpp
@@ -28,6 +28,7 @@
#include "code/nmethod.hpp"
#include "code/scopeDesc.hpp"
#include "compiler/abstractCompiler.hpp"
+#include "compiler/compileBroker.hpp"
#include "compiler/compileLog.hpp"
#include "compiler/compilerOracle.hpp"
#include "compiler/disassembler.hpp"
@@ -469,6 +470,7 @@ void nmethod::init_defaults() {
nmethod* nmethod::new_native_nmethod(methodHandle method,
+ int compile_id,
CodeBuffer *code_buffer,
int vep_offset,
int frame_complete,
@@ -485,7 +487,7 @@ nmethod* nmethod::new_native_nmethod(methodHandle method,
offsets.set_value(CodeOffsets::Verified_Entry, vep_offset);
offsets.set_value(CodeOffsets::Frame_Complete, frame_complete);
nm = new (native_nmethod_size)
- nmethod(method(), native_nmethod_size, &offsets,
+ nmethod(method(), native_nmethod_size, compile_id, &offsets,
code_buffer, frame_size,
basic_lock_owner_sp_offset, basic_lock_sp_offset,
oop_maps);
@@ -610,6 +612,7 @@ nmethod* nmethod::new_nmethod(methodHandle method,
nmethod::nmethod(
methodOop method,
int nmethod_size,
+ int compile_id,
CodeOffsets* offsets,
CodeBuffer* code_buffer,
int frame_size,
@@ -644,7 +647,7 @@ nmethod::nmethod(
_handler_table_offset = _dependencies_offset;
_nul_chk_table_offset = _handler_table_offset;
_nmethod_end_offset = _nul_chk_table_offset;
- _compile_id = 0; // default
+ _compile_id = compile_id;
_comp_level = CompLevel_none;
_entry_point = code_begin() + offsets->value(CodeOffsets::Entry);
_verified_entry_point = code_begin() + offsets->value(CodeOffsets::Verified_Entry);
@@ -930,72 +933,11 @@ void nmethod::log_new_nmethod() const {
#undef LOG_OFFSET
-void nmethod::print_compilation(outputStream *st, const char *method_name, const char *title,
- methodOop method, bool is_blocking, int compile_id, int bci, int comp_level) {
- bool is_synchronized = false, has_xhandler = false, is_native = false;
- int code_size = -1;
- if (method != NULL) {
- is_synchronized = method->is_synchronized();
- has_xhandler = method->has_exception_handler();
- is_native = method->is_native();
- code_size = method->code_size();
- }
- // print compilation number
- st->print("%7d %3d", (int)tty->time_stamp().milliseconds(), compile_id);
-
- // print method attributes
- const bool is_osr = bci != InvocationEntryBci;
- const char blocking_char = is_blocking ? 'b' : ' ';
- const char compile_type = is_osr ? '%' : ' ';
- const char sync_char = is_synchronized ? 's' : ' ';
- const char exception_char = has_xhandler ? '!' : ' ';
- const char native_char = is_native ? 'n' : ' ';
- st->print("%c%c%c%c%c ", compile_type, sync_char, exception_char, blocking_char, native_char);
- if (TieredCompilation) {
- st->print("%d ", comp_level);
- }
-
- // print optional title
- bool do_nl = false;
- if (title != NULL) {
- int tlen = (int) strlen(title);
- bool do_nl = false;
- if (tlen > 0 && title[tlen-1] == '\n') { tlen--; do_nl = true; }
- st->print("%.*s", tlen, title);
- } else {
- do_nl = true;
- }
-
- // print method name string if given
- if (method_name != NULL) {
- st->print(method_name);
- } else {
- // otherwise as the method to print itself
- if (method != NULL && !Universe::heap()->is_gc_active()) {
- method->print_short_name(st);
- } else {
- st->print("(method)");
- }
- }
-
- if (method != NULL) {
- // print osr_bci if any
- if (is_osr) st->print(" @ %d", bci);
- // print method size
- st->print(" (%d bytes)", code_size);
- }
- if (do_nl) st->cr();
-}
-
// Print out more verbose output usually for a newly created nmethod.
-void nmethod::print_on(outputStream* st, const char* title) const {
+void nmethod::print_on(outputStream* st, const char* msg) const {
if (st != NULL) {
ttyLocker ttyl;
- print_compilation(st, /*method_name*/NULL, title,
- method(), /*is_blocking*/false,
- compile_id(),
- is_osr_method() ? osr_entry_bci() : InvocationEntryBci,
- comp_level());
+ CompileTask::print_compilation(st, this, msg);
if (WizardMode) st->print(" (" INTPTR_FORMAT ")", this);
}
}
@@ -1309,8 +1251,7 @@ void nmethod::log_state_change() const {
}
}
if (PrintCompilation && _state != unloaded) {
- print_on(tty, _state == zombie ? "made zombie " : "made not entrant ");
- tty->cr();
+ print_on(tty, _state == zombie ? "made zombie" : "made not entrant");
}
}
@@ -1816,7 +1757,7 @@ bool nmethod::test_set_oops_do_mark() {
break;
}
// Mark was clear when we first saw this guy.
- NOT_PRODUCT(if (TraceScavenge) print_on(tty, "oops_do, mark\n"));
+ NOT_PRODUCT(if (TraceScavenge) print_on(tty, "oops_do, mark"));
return false;
}
}
@@ -1841,7 +1782,7 @@ void nmethod::oops_do_marking_epilogue() {
nmethod* next = cur->_oops_do_mark_link;
cur->_oops_do_mark_link = NULL;
cur->fix_oop_relocations();
- NOT_PRODUCT(if (TraceScavenge) cur->print_on(tty, "oops_do, unmark\n"));
+ NOT_PRODUCT(if (TraceScavenge) cur->print_on(tty, "oops_do, unmark"));
cur = next;
}
void* required = _oops_do_mark_nmethods;
@@ -2396,7 +2337,7 @@ void nmethod::print() const {
ResourceMark rm;
ttyLocker ttyl; // keep the following output all in one block
- tty->print("Compiled ");
+ tty->print("Compiled method ");
if (is_compiled_by_c1()) {
tty->print("(c1) ");
@@ -2408,8 +2349,8 @@ void nmethod::print() const {
tty->print("(nm) ");
}
- print_on(tty, "nmethod");
- tty->cr();
+ print_on(tty, NULL);
+
if (WizardMode) {
tty->print("((nmethod*) "INTPTR_FORMAT ") ", this);
tty->print(" for method " INTPTR_FORMAT , (address)method());
@@ -2796,7 +2737,8 @@ void nmethod::print_code_comment_on(outputStream* st, int column, u_char* begin,
#ifndef PRODUCT
void nmethod::print_value_on(outputStream* st) const {
- print_on(st, "nmethod");
+ st->print("nmethod");
+ print_on(st, NULL);
}
void nmethod::print_calls(outputStream* st) {
diff --git a/hotspot/src/share/vm/code/nmethod.hpp b/hotspot/src/share/vm/code/nmethod.hpp
index 6bf5672eb37..36f51ed1264 100644
--- a/hotspot/src/share/vm/code/nmethod.hpp
+++ b/hotspot/src/share/vm/code/nmethod.hpp
@@ -229,6 +229,7 @@ class nmethod : public CodeBlob {
// For native wrappers
nmethod(methodOop method,
int nmethod_size,
+ int compile_id,
CodeOffsets* offsets,
CodeBuffer *code_buffer,
int frame_size,
@@ -299,6 +300,7 @@ class nmethod : public CodeBlob {
int comp_level);
static nmethod* new_native_nmethod(methodHandle method,
+ int compile_id,
CodeBuffer *code_buffer,
int vep_offset,
int frame_complete,
@@ -500,8 +502,8 @@ public:
address continuation_for_implicit_exception(address pc);
// On-stack replacement support
- int osr_entry_bci() const { assert(_entry_bci != InvocationEntryBci, "wrong kind of nmethod"); return _entry_bci; }
- address osr_entry() const { assert(_entry_bci != InvocationEntryBci, "wrong kind of nmethod"); return _osr_entry_point; }
+ int osr_entry_bci() const { assert(is_osr_method(), "wrong kind of nmethod"); return _entry_bci; }
+ address osr_entry() const { assert(is_osr_method(), "wrong kind of nmethod"); return _osr_entry_point; }
void invalidate_osr_method();
nmethod* osr_link() const { return _osr_link; }
void set_osr_link(nmethod *n) { _osr_link = n; }
@@ -608,10 +610,6 @@ public:
void verify_scopes();
void verify_interrupt_point(address interrupt_point);
- // print compilation helper
- static void print_compilation(outputStream *st, const char *method_name, const char *title,
- methodOop method, bool is_blocking, int compile_id, int bci, int comp_level);
-
// printing support
void print() const;
void print_code();
@@ -627,7 +625,7 @@ public:
// need to re-define this from CodeBlob else the overload hides it
virtual void print_on(outputStream* st) const { CodeBlob::print_on(st); }
- void print_on(outputStream* st, const char* title) const;
+ void print_on(outputStream* st, const char* msg) const;
// Logging
void log_identity(xmlStream* log) const;
diff --git a/hotspot/src/share/vm/code/relocInfo.cpp b/hotspot/src/share/vm/code/relocInfo.cpp
index 0264f20607f..4fd82dfaa1b 100644
--- a/hotspot/src/share/vm/code/relocInfo.cpp
+++ b/hotspot/src/share/vm/code/relocInfo.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2011, 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
@@ -472,20 +472,14 @@ RelocationHolder Relocation::spec_simple(relocInfo::relocType rtype) {
return itr._rh;
}
-
-static inline bool is_index(intptr_t index) {
- return 0 < index && index < os::vm_page_size();
-}
-
-
int32_t Relocation::runtime_address_to_index(address runtime_address) {
- assert(!is_index((intptr_t)runtime_address), "must not look like an index");
+ assert(!is_reloc_index((intptr_t)runtime_address), "must not look like an index");
if (runtime_address == NULL) return 0;
StubCodeDesc* p = StubCodeDesc::desc_for(runtime_address);
if (p != NULL && p->begin() == runtime_address) {
- assert(is_index(p->index()), "there must not be too many stubs");
+ assert(is_reloc_index(p->index()), "there must not be too many stubs");
return (int32_t)p->index();
} else {
// Known "miscellaneous" non-stub pointers:
@@ -506,7 +500,7 @@ int32_t Relocation::runtime_address_to_index(address runtime_address) {
address Relocation::index_to_runtime_address(int32_t index) {
if (index == 0) return NULL;
- if (is_index(index)) {
+ if (is_reloc_index(index)) {
StubCodeDesc* p = StubCodeDesc::desc_for_index(index);
assert(p != NULL, "there must be a stub for this index");
return p->begin();
@@ -634,7 +628,7 @@ void external_word_Relocation::pack_data_to(CodeSection* dest) {
#ifndef _LP64
p = pack_1_int_to(p, index);
#else
- if (is_index(index)) {
+ if (is_reloc_index(index)) {
p = pack_2_ints_to(p, index, 0);
} else {
jlong t = (jlong) _target;
@@ -642,7 +636,7 @@ void external_word_Relocation::pack_data_to(CodeSection* dest) {
int32_t hi = high(t);
p = pack_2_ints_to(p, lo, hi);
DEBUG_ONLY(jlong t1 = jlong_from(hi, lo));
- assert(!is_index(t1) && (address) t1 == _target, "not symmetric");
+ assert(!is_reloc_index(t1) && (address) t1 == _target, "not symmetric");
}
#endif /* _LP64 */
dest->set_locs_end((relocInfo*) p);
@@ -656,7 +650,7 @@ void external_word_Relocation::unpack_data() {
int32_t lo, hi;
unpack_2_ints(lo, hi);
jlong t = jlong_from(hi, lo);;
- if (is_index(t)) {
+ if (is_reloc_index(t)) {
_target = index_to_runtime_address(t);
} else {
_target = (address) t;
diff --git a/hotspot/src/share/vm/code/relocInfo.hpp b/hotspot/src/share/vm/code/relocInfo.hpp
index 7dc11fee084..1d14b445087 100644
--- a/hotspot/src/share/vm/code/relocInfo.hpp
+++ b/hotspot/src/share/vm/code/relocInfo.hpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2011, 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
@@ -703,6 +703,10 @@ class Relocation VALUE_OBJ_CLASS_SPEC {
assert(datalen()==0 || type()==relocInfo::none, "no data here");
}
+ static bool is_reloc_index(intptr_t index) {
+ return 0 < index && index < os::vm_page_size();
+ }
+
protected:
// Helper functions for pack_data_to() and unpack_data().
@@ -1127,6 +1131,12 @@ class external_word_Relocation : public DataRelocation {
return rh;
}
+ // Some address looking values aren't safe to treat as relocations
+ // and should just be treated as constants.
+ static bool can_be_relocated(address target) {
+ return target != NULL && !is_reloc_index((intptr_t)target);
+ }
+
private:
address _target; // address in runtime
diff --git a/hotspot/src/share/vm/code/vmreg.hpp b/hotspot/src/share/vm/code/vmreg.hpp
index cd00dd42836..d57e6f89bb0 100644
--- a/hotspot/src/share/vm/code/vmreg.hpp
+++ b/hotspot/src/share/vm/code/vmreg.hpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1998, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 2011, 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
diff --git a/hotspot/src/share/vm/compiler/compileBroker.cpp b/hotspot/src/share/vm/compiler/compileBroker.cpp
index 0d90e11d289..47def8af8f9 100644
--- a/hotspot/src/share/vm/compiler/compileBroker.cpp
+++ b/hotspot/src/share/vm/compiler/compileBroker.cpp
@@ -268,11 +268,6 @@ void CompileTask::print() {
}
-void CompileTask::print_compilation(outputStream *st, methodOop method, char* method_name) {
- nmethod::print_compilation(st, method_name,/*title*/ NULL, method,
- is_blocking(), compile_id(), osr_bci(), comp_level());
-}
-
// ------------------------------------------------------------------
// CompileTask::print_line_on_error
//
@@ -284,32 +279,116 @@ void CompileTask::print_compilation(outputStream *st, methodOop method, char* me
// Otherwise it's the same as CompileTask::print_line()
//
void CompileTask::print_line_on_error(outputStream* st, char* buf, int buflen) {
- methodOop method = (methodOop)JNIHandles::resolve(_method);
// print compiler name
st->print("%s:", CompileBroker::compiler(comp_level())->name());
- char* method_name = NULL;
- if (method != NULL) {
- method_name = method->name_and_sig_as_C_string(buf, buflen);
- }
- print_compilation(st, method, method_name);
+ print_compilation(st);
}
// ------------------------------------------------------------------
// CompileTask::print_line
void CompileTask::print_line() {
- Thread *thread = Thread::current();
- methodHandle method(thread,
- (methodOop)JNIHandles::resolve(method_handle()));
- ResourceMark rm(thread);
-
ttyLocker ttyl; // keep the following output all in one block
-
// print compiler name if requested
if (CIPrintCompilerName) tty->print("%s:", CompileBroker::compiler(comp_level())->name());
- print_compilation(tty, method(), NULL);
+ print_compilation();
}
+// ------------------------------------------------------------------
+// CompileTask::print_compilation_impl
+void CompileTask::print_compilation_impl(outputStream* st, methodOop method, int compile_id, int comp_level, bool is_osr_method, int osr_bci, bool is_blocking, const char* msg) {
+ st->print("%7d ", (int) st->time_stamp().milliseconds()); // print timestamp
+ st->print("%4d ", compile_id); // print compilation number
+
+ // method attributes
+ const char compile_type = is_osr_method ? '%' : ' ';
+ const char sync_char = method->is_synchronized() ? 's' : ' ';
+ const char exception_char = method->has_exception_handler() ? '!' : ' ';
+ const char blocking_char = is_blocking ? 'b' : ' ';
+ const char native_char = method->is_native() ? 'n' : ' ';
+
+ // print method attributes
+ st->print("%c%c%c%c%c ", compile_type, sync_char, exception_char, blocking_char, native_char);
+
+ if (TieredCompilation) {
+ if (comp_level != -1) st->print("%d ", comp_level);
+ else st->print("- ");
+ }
+ st->print(" "); // more indent
+
+ method->print_short_name(st);
+ if (is_osr_method) {
+ st->print(" @ %d", osr_bci);
+ }
+ st->print(" (%d bytes)", method->code_size());
+
+ if (msg != NULL) {
+ st->print(" %s", msg);
+ }
+ st->cr();
+}
+
+// ------------------------------------------------------------------
+// CompileTask::print_inlining
+void CompileTask::print_inlining(outputStream* st, ciMethod* method, int inline_level, int bci, const char* msg) {
+ // 1234567
+ st->print(" "); // print timestamp
+ // 1234
+ st->print(" "); // print compilation number
+
+ // method attributes
+ const char sync_char = method->is_synchronized() ? 's' : ' ';
+ const char exception_char = method->has_exception_handlers() ? '!' : ' ';
+ const char monitors_char = method->has_monitor_bytecodes() ? 'm' : ' ';
+
+ // print method attributes
+ st->print(" %c%c%c ", sync_char, exception_char, monitors_char);
+
+ if (TieredCompilation) {
+ st->print(" ");
+ }
+ st->print(" "); // more indent
+ st->print(" "); // initial inlining indent
+
+ for (int i = 0; i < inline_level; i++) st->print(" ");
+
+ st->print("@ %d ", bci); // print bci
+ method->print_short_name(st);
+ st->print(" (%d bytes)", method->code_size());
+
+ if (msg != NULL) {
+ st->print(" %s", msg);
+ }
+ st->cr();
+}
+
+// ------------------------------------------------------------------
+// CompileTask::print_inline_indent
+void CompileTask::print_inline_indent(int inline_level, outputStream* st) {
+ // 1234567
+ st->print(" "); // print timestamp
+ // 1234
+ st->print(" "); // print compilation number
+ // %s!bn
+ st->print(" "); // print method attributes
+ if (TieredCompilation) {
+ st->print(" ");
+ }
+ st->print(" "); // more indent
+ st->print(" "); // initial inlining indent
+ for (int i = 0; i < inline_level; i++) st->print(" ");
+}
+
+// ------------------------------------------------------------------
+// CompileTask::print_compilation
+void CompileTask::print_compilation(outputStream* st) {
+ oop rem = JNIHandles::resolve(method_handle());
+ assert(rem != NULL && rem->is_method(), "must be");
+ methodOop method = (methodOop) rem;
+ bool is_osr_method = osr_bci() != InvocationEntryBci;
+ print_compilation_impl(st, method, compile_id(), comp_level(), is_osr_method, osr_bci(), is_blocking());
+}
+
// ------------------------------------------------------------------
// CompileTask::log_task
void CompileTask::log_task(xmlStream* log) {
@@ -768,9 +847,9 @@ CompilerThread* CompileBroker::make_compiler_thread(const char* name, CompileQue
// Initialize the compilation queue
void CompileBroker::init_compiler_threads(int c1_compiler_count, int c2_compiler_count) {
EXCEPTION_MARK;
-#ifndef ZERO
+#if !defined(ZERO) && !defined(SHARK)
assert(c2_compiler_count > 0 || c1_compiler_count > 0, "No compilers?");
-#endif // !ZERO
+#endif // !ZERO && !SHARK
if (c2_compiler_count > 0) {
_c2_method_queue = new CompileQueue("C2MethodQueue", MethodCompileQueue_lock);
}
@@ -874,6 +953,14 @@ void CompileBroker::compile_method_base(methodHandle method,
return;
}
+#ifndef PRODUCT
+ if (osr_bci != -1 && !FLAG_IS_DEFAULT(OSROnlyBCI)) {
+ if ((OSROnlyBCI > 0) ? (OSROnlyBCI != osr_bci) : (-OSROnlyBCI == osr_bci)) {
+ // Positive OSROnlyBCI means only compile that bci. Negative means don't compile that BCI.
+ return;
+ }
+ }
+#endif
// If this method is already in the compile queue, then
// we do not block the current thread.
@@ -1031,7 +1118,7 @@ nmethod* CompileBroker::compile_method(methodHandle method, int osr_bci,
assert(!HAS_PENDING_EXCEPTION, "No exception should be present");
// some prerequisites that are compiler specific
- if (compiler(comp_level)->is_c2()) {
+ if (compiler(comp_level)->is_c2() || compiler(comp_level)->is_shark()) {
method->constants()->resolve_string_constants(CHECK_0);
// Resolve all classes seen in the signature of the method
// we are compiling.
@@ -1078,7 +1165,13 @@ nmethod* CompileBroker::compile_method(methodHandle method, int osr_bci,
// do the compilation
if (method->is_native()) {
if (!PreferInterpreterNativeStubs) {
- (void) AdapterHandlerLibrary::create_native_wrapper(method);
+ // Acquire our lock.
+ int compile_id;
+ {
+ MutexLocker locker(MethodCompileQueue_lock, THREAD);
+ compile_id = assign_compile_id(method, standard_entry_bci);
+ }
+ (void) AdapterHandlerLibrary::create_native_wrapper(method, compile_id);
} else {
return NULL;
}
@@ -1186,7 +1279,6 @@ uint CompileBroker::assign_compile_id(methodHandle method, int osr_bci) {
assert(MethodCompileQueue_lock->owner() == Thread::current(),
"must hold the compilation queue lock");
bool is_osr = (osr_bci != standard_entry_bci);
- assert(!method->is_native(), "no longer compile natives");
uint id;
if (CICountOSR && is_osr) {
id = ++_osr_compilation_id;
diff --git a/hotspot/src/share/vm/compiler/compileBroker.hpp b/hotspot/src/share/vm/compiler/compileBroker.hpp
index 515bfb4052e..eb571eebba3 100644
--- a/hotspot/src/share/vm/compiler/compileBroker.hpp
+++ b/hotspot/src/share/vm/compiler/compileBroker.hpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2011, 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
@@ -56,7 +56,6 @@ class CompileTask : public CHeapObj {
int _hot_count; // information about its invocation counter
const char* _comment; // more info about the task
- void print_compilation(outputStream *st, methodOop method, char* method_name);
public:
CompileTask() {
_lock = new Monitor(Mutex::nonleaf+2, "CompileTaskLock");
@@ -96,10 +95,26 @@ class CompileTask : public CHeapObj {
CompileTask* prev() const { return _prev; }
void set_prev(CompileTask* prev) { _prev = prev; }
+private:
+ static void print_compilation_impl(outputStream* st, methodOop method, int compile_id, int comp_level, bool is_osr_method = false, int osr_bci = -1, bool is_blocking = false, const char* msg = NULL);
+
+public:
+ void print_compilation(outputStream* st = tty);
+ static void print_compilation(outputStream* st, const nmethod* nm, const char* msg = NULL) {
+ print_compilation_impl(st, nm->method(), nm->compile_id(), nm->comp_level(), nm->is_osr_method(), nm->is_osr_method() ? nm->osr_entry_bci() : -1, /*is_blocking*/ false, msg);
+ }
+
+ static void print_inlining(outputStream* st, ciMethod* method, int inline_level, int bci, const char* msg = NULL);
+ static void print_inlining(ciMethod* method, int inline_level, int bci, const char* msg = NULL) {
+ print_inlining(tty, method, inline_level, bci, msg);
+ }
+
+ static void print_inline_indent(int inline_level, outputStream* st = tty);
+
void print();
void print_line();
-
void print_line_on_error(outputStream* st, char* buf, int buflen);
+
void log_task(xmlStream* log);
void log_task_queued();
void log_task_start(CompileLog* log);
diff --git a/hotspot/src/share/vm/compiler/compileLog.hpp b/hotspot/src/share/vm/compiler/compileLog.hpp
index ae7d01c724c..0c997cecc6c 100644
--- a/hotspot/src/share/vm/compiler/compileLog.hpp
+++ b/hotspot/src/share/vm/compiler/compileLog.hpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2002, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2002, 2011, 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
diff --git a/hotspot/src/share/vm/compiler/compilerOracle.cpp b/hotspot/src/share/vm/compiler/compilerOracle.cpp
index 178a045dcfd..6ac45b41345 100644
--- a/hotspot/src/share/vm/compiler/compilerOracle.cpp
+++ b/hotspot/src/share/vm/compiler/compilerOracle.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1998, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 2011, 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
diff --git a/hotspot/src/share/vm/compiler/compilerOracle.hpp b/hotspot/src/share/vm/compiler/compilerOracle.hpp
index 7e6b5cf09a6..7a32967b920 100644
--- a/hotspot/src/share/vm/compiler/compilerOracle.hpp
+++ b/hotspot/src/share/vm/compiler/compilerOracle.hpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1998, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 2011, 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
diff --git a/hotspot/src/share/vm/compiler/disassembler.cpp b/hotspot/src/share/vm/compiler/disassembler.cpp
index 4b1ad9ab8bf..48813b6cb89 100644
--- a/hotspot/src/share/vm/compiler/disassembler.cpp
+++ b/hotspot/src/share/vm/compiler/disassembler.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2008, 2011, 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
diff --git a/hotspot/src/share/vm/compiler/disassembler.hpp b/hotspot/src/share/vm/compiler/disassembler.hpp
index 03b377065b7..376154075bb 100644
--- a/hotspot/src/share/vm/compiler/disassembler.hpp
+++ b/hotspot/src/share/vm/compiler/disassembler.hpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2008, 2011, 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
diff --git a/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/compactibleFreeListSpace.cpp b/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/compactibleFreeListSpace.cpp
index 67cf3c70464..50e073d24aa 100644
--- a/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/compactibleFreeListSpace.cpp
+++ b/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/compactibleFreeListSpace.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2001, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 2011, 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
diff --git a/hotspot/src/share/vm/gc_implementation/g1/collectionSetChooser.cpp b/hotspot/src/share/vm/gc_implementation/g1/collectionSetChooser.cpp
index 585ff2d3468..7e18ec6376c 100644
--- a/hotspot/src/share/vm/gc_implementation/g1/collectionSetChooser.cpp
+++ b/hotspot/src/share/vm/gc_implementation/g1/collectionSetChooser.cpp
@@ -262,38 +262,17 @@ CollectionSetChooser::sortMarkedHeapRegions() {
for (int i = 0; i < _numMarkedRegions; i++) {
assert(_markedRegions.at(i) != NULL, "Should be true by sorting!");
_markedRegions.at(i)->set_sort_index(i);
- if (G1PrintRegionLivenessInfo > 0) {
- if (i == 0) gclog_or_tty->print_cr("Sorted marked regions:");
- if (i < G1PrintRegionLivenessInfo ||
- (_numMarkedRegions-i) < G1PrintRegionLivenessInfo) {
- HeapRegion* hr = _markedRegions.at(i);
- size_t u = hr->used();
- gclog_or_tty->print_cr(" Region %d: %d used, %d max live, %5.2f%%.",
- i, u, hr->max_live_bytes(),
- 100.0*(float)hr->max_live_bytes()/(float)u);
- }
+ }
+ if (G1PrintRegionLivenessInfo) {
+ G1PrintRegionLivenessInfoClosure cl(gclog_or_tty, "Post-Sorting");
+ for (int i = 0; i < _numMarkedRegions; ++i) {
+ HeapRegion* r = _markedRegions.at(i);
+ cl.doHeapRegion(r);
}
}
- if (G1PolicyVerbose > 1)
- printSortedHeapRegions();
assert(verify(), "should now be sorted");
}
-void
-printHeapRegion(HeapRegion *hr) {
- if (hr->isHumongous())
- gclog_or_tty->print("H: ");
- if (hr->in_collection_set())
- gclog_or_tty->print("CS: ");
- gclog_or_tty->print_cr("Region " PTR_FORMAT " (%s%s) "
- "[" PTR_FORMAT ", " PTR_FORMAT"] "
- "Used: " SIZE_FORMAT "K, garbage: " SIZE_FORMAT "K.",
- hr, hr->is_young() ? "Y " : " ",
- hr->is_marked()? "M1" : "M0",
- hr->bottom(), hr->end(),
- hr->used()/K, hr->garbage_bytes()/K);
-}
-
void
CollectionSetChooser::addMarkedHeapRegion(HeapRegion* hr) {
assert(!hr->isHumongous(),
@@ -351,27 +330,9 @@ CollectionSetChooser::clearMarkedHeapRegions(){
void
CollectionSetChooser::updateAfterFullCollection() {
- G1CollectedHeap* g1h = G1CollectedHeap::heap();
clearMarkedHeapRegions();
}
-void
-CollectionSetChooser::printSortedHeapRegions() {
- gclog_or_tty->print_cr("Printing %d Heap Regions sorted by amount of known garbage",
- _numMarkedRegions);
-
- DEBUG_ONLY(int marked_count = 0;)
- for (int i = 0; i < _markedRegions.length(); i++) {
- HeapRegion* r = _markedRegions.at(i);
- if (r != NULL) {
- printHeapRegion(r);
- DEBUG_ONLY(marked_count++;)
- }
- }
- assert(marked_count == _numMarkedRegions, "must be");
- gclog_or_tty->print_cr("Done sorted heap region print");
-}
-
void CollectionSetChooser::removeRegion(HeapRegion *hr) {
int si = hr->sort_index();
assert(si == -1 || hr->is_marked(), "Sort index not valid.");
diff --git a/hotspot/src/share/vm/gc_implementation/g1/collectionSetChooser.hpp b/hotspot/src/share/vm/gc_implementation/g1/collectionSetChooser.hpp
index 04ceba27921..c8e22339e35 100644
--- a/hotspot/src/share/vm/gc_implementation/g1/collectionSetChooser.hpp
+++ b/hotspot/src/share/vm/gc_implementation/g1/collectionSetChooser.hpp
@@ -100,8 +100,6 @@ public:
CollectionSetChooser();
- void printSortedHeapRegions();
-
void sortMarkedHeapRegions();
void fillCache();
bool addRegionToCache(void);
diff --git a/hotspot/src/share/vm/gc_implementation/g1/concurrentG1Refine.cpp b/hotspot/src/share/vm/gc_implementation/g1/concurrentG1Refine.cpp
index 09279048e90..a7b24607064 100644
--- a/hotspot/src/share/vm/gc_implementation/g1/concurrentG1Refine.cpp
+++ b/hotspot/src/share/vm/gc_implementation/g1/concurrentG1Refine.cpp
@@ -31,23 +31,31 @@
#include "gc_implementation/g1/heapRegionSeq.inline.hpp"
#include "memory/space.inline.hpp"
#include "runtime/atomic.hpp"
+#include "runtime/java.hpp"
#include "utilities/copy.hpp"
// Possible sizes for the card counts cache: odd primes that roughly double in size.
// (See jvmtiTagMap.cpp).
-int ConcurrentG1Refine::_cc_cache_sizes[] = {
- 16381, 32771, 76831, 150001, 307261,
- 614563, 1228891, 2457733, 4915219, 9830479,
- 19660831, 39321619, 78643219, 157286461, -1
+
+#define MAX_SIZE ((size_t) -1)
+
+size_t ConcurrentG1Refine::_cc_cache_sizes[] = {
+ 16381, 32771, 76831, 150001, 307261,
+ 614563, 1228891, 2457733, 4915219, 9830479,
+ 19660831, 39321619, 78643219, 157286461, MAX_SIZE
};
ConcurrentG1Refine::ConcurrentG1Refine() :
_card_counts(NULL), _card_epochs(NULL),
- _n_card_counts(0), _max_n_card_counts(0),
+ _n_card_counts(0), _max_cards(0), _max_n_card_counts(0),
_cache_size_index(0), _expand_card_counts(false),
_hot_cache(NULL),
_def_use_cache(false), _use_cache(false),
- _n_periods(0),
+ // We initialize the epochs of the array to 0. By initializing
+ // _n_periods to 1 and not 0 we automatically invalidate all the
+ // entries on the array. Otherwise we might accidentally think that
+ // we claimed a card that was in fact never set (see CR7033292).
+ _n_periods(1),
_threads(NULL), _n_threads(0)
{
@@ -98,27 +106,44 @@ int ConcurrentG1Refine::thread_num() {
void ConcurrentG1Refine::init() {
if (G1ConcRSLogCacheSize > 0) {
_g1h = G1CollectedHeap::heap();
- _max_n_card_counts =
- (unsigned) (_g1h->max_capacity() >> CardTableModRefBS::card_shift);
+
+ _max_cards = _g1h->max_capacity() >> CardTableModRefBS::card_shift;
+ _max_n_card_counts = _max_cards * G1MaxHotCardCountSizePercent / 100;
size_t max_card_num = ((size_t)1 << (sizeof(unsigned)*BitsPerByte-1)) - 1;
- guarantee(_max_n_card_counts < max_card_num, "card_num representation");
+ guarantee(_max_cards < max_card_num, "card_num representation");
- int desired = _max_n_card_counts / InitialCacheFraction;
- for (_cache_size_index = 0;
- _cc_cache_sizes[_cache_size_index] >= 0; _cache_size_index++) {
- if (_cc_cache_sizes[_cache_size_index] >= desired) break;
+ // We need _n_card_counts to be less than _max_n_card_counts here
+ // so that the expansion call (below) actually allocates the
+ // _counts and _epochs arrays.
+ assert(_n_card_counts == 0, "pre-condition");
+ assert(_max_n_card_counts > 0, "pre-condition");
+
+ // Find the index into cache size array that is of a size that's
+ // large enough to hold desired_sz.
+ size_t desired_sz = _max_cards / InitialCacheFraction;
+ int desired_sz_index = 0;
+ while (_cc_cache_sizes[desired_sz_index] < desired_sz) {
+ desired_sz_index += 1;
+ assert(desired_sz_index < MAX_CC_CACHE_INDEX, "invariant");
}
- _cache_size_index = MAX2(0, (_cache_size_index - 1));
+ assert(desired_sz_index < MAX_CC_CACHE_INDEX, "invariant");
- int initial_size = _cc_cache_sizes[_cache_size_index];
- if (initial_size < 0) initial_size = _max_n_card_counts;
+ // If the desired_sz value is between two sizes then
+ // _cc_cache_sizes[desired_sz_index-1] < desired_sz <= _cc_cache_sizes[desired_sz_index]
+ // we will start with the lower size in the optimistic expectation that
+ // we will not need to expand up. Note desired_sz_index could also be 0.
+ if (desired_sz_index > 0 &&
+ _cc_cache_sizes[desired_sz_index] > desired_sz) {
+ desired_sz_index -= 1;
+ }
- // Make sure we don't go bigger than we will ever need
- _n_card_counts = MIN2((unsigned) initial_size, _max_n_card_counts);
-
- _card_counts = NEW_C_HEAP_ARRAY(CardCountCacheEntry, _n_card_counts);
- _card_epochs = NEW_C_HEAP_ARRAY(CardEpochCacheEntry, _n_card_counts);
+ if (!expand_card_count_cache(desired_sz_index)) {
+ // Allocation was unsuccessful - exit
+ vm_exit_during_initialization("Could not reserve enough space for card count cache");
+ }
+ assert(_n_card_counts > 0, "post-condition");
+ assert(_cache_size_index == desired_sz_index, "post-condition");
Copy::fill_to_bytes(&_card_counts[0],
_n_card_counts * sizeof(CardCountCacheEntry));
@@ -163,10 +188,13 @@ void ConcurrentG1Refine::reinitialize_threads() {
ConcurrentG1Refine::~ConcurrentG1Refine() {
if (G1ConcRSLogCacheSize > 0) {
+ // Please see the comment in allocate_card_count_cache
+ // for why we call os::malloc() and os::free() directly.
assert(_card_counts != NULL, "Logic");
- FREE_C_HEAP_ARRAY(CardCountCacheEntry, _card_counts);
+ os::free(_card_counts);
assert(_card_epochs != NULL, "Logic");
- FREE_C_HEAP_ARRAY(CardEpochCacheEntry, _card_epochs);
+ os::free(_card_epochs);
+
assert(_hot_cache != NULL, "Logic");
FREE_C_HEAP_ARRAY(jbyte*, _hot_cache);
}
@@ -382,29 +410,93 @@ void ConcurrentG1Refine::clean_up_cache(int worker_i,
}
}
-void ConcurrentG1Refine::expand_card_count_cache() {
+// The arrays used to hold the card counts and the epochs must have
+// a 1:1 correspondence. Hence they are allocated and freed together
+// Returns true if the allocations of both the counts and epochs
+// were successful; false otherwise.
+bool ConcurrentG1Refine::allocate_card_count_cache(size_t n,
+ CardCountCacheEntry** counts,
+ CardEpochCacheEntry** epochs) {
+ // We call the allocation/free routines directly for the counts
+ // and epochs arrays. The NEW_C_HEAP_ARRAY/FREE_C_HEAP_ARRAY
+ // macros call AllocateHeap and FreeHeap respectively.
+ // AllocateHeap will call vm_exit_out_of_memory in the event
+ // of an allocation failure and abort the JVM. With the
+ // _counts/epochs arrays we only need to abort the JVM if the
+ // initial allocation of these arrays fails.
+ //
+ // Additionally AllocateHeap/FreeHeap do some tracing of
+ // allocate/free calls so calling one without calling the
+ // other can cause inconsistencies in the tracing. So we
+ // call neither.
+
+ assert(*counts == NULL, "out param");
+ assert(*epochs == NULL, "out param");
+
+ size_t counts_size = n * sizeof(CardCountCacheEntry);
+ size_t epochs_size = n * sizeof(CardEpochCacheEntry);
+
+ *counts = (CardCountCacheEntry*) os::malloc(counts_size);
+ if (*counts == NULL) {
+ // allocation was unsuccessful
+ return false;
+ }
+
+ *epochs = (CardEpochCacheEntry*) os::malloc(epochs_size);
+ if (*epochs == NULL) {
+ // allocation was unsuccessful - free counts array
+ assert(*counts != NULL, "must be");
+ os::free(*counts);
+ *counts = NULL;
+ return false;
+ }
+
+ // We successfully allocated both counts and epochs
+ return true;
+}
+
+// Returns true if the card counts/epochs cache was
+// successfully expanded; false otherwise.
+bool ConcurrentG1Refine::expand_card_count_cache(int cache_size_idx) {
+ // Can we expand the card count and epoch tables?
if (_n_card_counts < _max_n_card_counts) {
- int new_idx = _cache_size_index+1;
- int new_size = _cc_cache_sizes[new_idx];
- if (new_size < 0) new_size = _max_n_card_counts;
+ assert(cache_size_idx >= 0 && cache_size_idx < MAX_CC_CACHE_INDEX, "oob");
+ size_t cache_size = _cc_cache_sizes[cache_size_idx];
// Make sure we don't go bigger than we will ever need
- new_size = MIN2((unsigned) new_size, _max_n_card_counts);
+ cache_size = MIN2(cache_size, _max_n_card_counts);
- // Expand the card count and card epoch tables
- if (new_size > (int)_n_card_counts) {
- // We can just free and allocate a new array as we're
- // not interested in preserving the contents
- assert(_card_counts != NULL, "Logic!");
- assert(_card_epochs != NULL, "Logic!");
- FREE_C_HEAP_ARRAY(CardCountCacheEntry, _card_counts);
- FREE_C_HEAP_ARRAY(CardEpochCacheEntry, _card_epochs);
- _n_card_counts = new_size;
- _card_counts = NEW_C_HEAP_ARRAY(CardCountCacheEntry, _n_card_counts);
- _card_epochs = NEW_C_HEAP_ARRAY(CardEpochCacheEntry, _n_card_counts);
- _cache_size_index = new_idx;
+ // Should we expand the card count and card epoch tables?
+ if (cache_size > _n_card_counts) {
+ // We have been asked to allocate new, larger, arrays for
+ // the card counts and the epochs. Attempt the allocation
+ // of both before we free the existing arrays in case
+ // the allocation is unsuccessful...
+ CardCountCacheEntry* counts = NULL;
+ CardEpochCacheEntry* epochs = NULL;
+
+ if (allocate_card_count_cache(cache_size, &counts, &epochs)) {
+ // Allocation was successful.
+ // We can just free the old arrays; we're
+ // not interested in preserving the contents
+ if (_card_counts != NULL) os::free(_card_counts);
+ if (_card_epochs != NULL) os::free(_card_epochs);
+
+ // Cache the size of the arrays and the index that got us there.
+ _n_card_counts = cache_size;
+ _cache_size_index = cache_size_idx;
+
+ _card_counts = counts;
+ _card_epochs = epochs;
+
+ // We successfully allocated/expanded the caches.
+ return true;
+ }
}
}
+
+ // We did not successfully expand the caches.
+ return false;
}
void ConcurrentG1Refine::clear_and_record_card_counts() {
@@ -415,10 +507,16 @@ void ConcurrentG1Refine::clear_and_record_card_counts() {
#endif
if (_expand_card_counts) {
- expand_card_count_cache();
+ int new_idx = _cache_size_index + 1;
+
+ if (expand_card_count_cache(new_idx)) {
+ // Allocation was successful and _n_card_counts has
+ // been updated to the new size. We only need to clear
+ // the epochs so we don't read a bogus epoch value
+ // when inserting a card into the hot card cache.
+ Copy::fill_to_bytes(&_card_epochs[0], _n_card_counts * sizeof(CardEpochCacheEntry));
+ }
_expand_card_counts = false;
- // Only need to clear the epochs.
- Copy::fill_to_bytes(&_card_epochs[0], _n_card_counts * sizeof(CardEpochCacheEntry));
}
int this_epoch = (int) _n_periods;
diff --git a/hotspot/src/share/vm/gc_implementation/g1/concurrentG1Refine.hpp b/hotspot/src/share/vm/gc_implementation/g1/concurrentG1Refine.hpp
index 50ea5e9e6f6..68a9407a2f3 100644
--- a/hotspot/src/share/vm/gc_implementation/g1/concurrentG1Refine.hpp
+++ b/hotspot/src/share/vm/gc_implementation/g1/concurrentG1Refine.hpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2001, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 2011, 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
@@ -94,7 +94,7 @@ class ConcurrentG1Refine: public CHeapObj {
} CardEpochCacheEntry;
julong make_epoch_entry(unsigned int card_num, unsigned int epoch) {
- assert(0 <= card_num && card_num < _max_n_card_counts, "Bounds");
+ assert(0 <= card_num && card_num < _max_cards, "Bounds");
assert(0 <= epoch && epoch <= _n_periods, "must be");
return ((julong) card_num << card_num_shift) | epoch;
@@ -117,15 +117,24 @@ class ConcurrentG1Refine: public CHeapObj {
CardEpochCacheEntry* _card_epochs;
// The current number of buckets in the card count cache
- unsigned _n_card_counts;
+ size_t _n_card_counts;
- // The max number of buckets required for the number of
- // cards for the entire reserved heap
- unsigned _max_n_card_counts;
+ // The number of cards for the entire reserved heap
+ size_t _max_cards;
+
+ // The max number of buckets for the card counts and epochs caches.
+ // This is the maximum that the counts and epochs will grow to.
+ // It is specified as a fraction or percentage of _max_cards using
+ // G1MaxHotCardCountSizePercent.
+ size_t _max_n_card_counts;
// Possible sizes of the cache: odd primes that roughly double in size.
// (See jvmtiTagMap.cpp).
- static int _cc_cache_sizes[];
+ enum {
+ MAX_CC_CACHE_INDEX = 15 // maximum index into the cache size array.
+ };
+
+ static size_t _cc_cache_sizes[MAX_CC_CACHE_INDEX];
// The index in _cc_cache_sizes corresponding to the size of
// _card_counts.
@@ -147,11 +156,22 @@ class ConcurrentG1Refine: public CHeapObj {
CardTableModRefBS* _ct_bs;
G1CollectedHeap* _g1h;
- // Expands the array that holds the card counts to the next size up
- void expand_card_count_cache();
+ // Helper routine for expand_card_count_cache().
+ // The arrays used to hold the card counts and the epochs must have
+ // a 1:1 correspondence. Hence they are allocated and freed together.
+ // Returns true if the allocations of both the counts and epochs
+ // were successful; false otherwise.
+ bool allocate_card_count_cache(size_t n,
+ CardCountCacheEntry** counts,
+ CardEpochCacheEntry** epochs);
+
+ // Expands the arrays that hold the card counts and epochs
+ // to the cache size at index. Returns true if the expansion/
+ // allocation was successful; false otherwise.
+ bool expand_card_count_cache(int index);
// hash a given key (index of card_ptr) with the specified size
- static unsigned int hash(size_t key, int size) {
+ static unsigned int hash(size_t key, size_t size) {
return (unsigned int) key % size;
}
diff --git a/hotspot/src/share/vm/gc_implementation/g1/concurrentMark.cpp b/hotspot/src/share/vm/gc_implementation/g1/concurrentMark.cpp
index e453b91c35a..7cf1a9ddc39 100644
--- a/hotspot/src/share/vm/gc_implementation/g1/concurrentMark.cpp
+++ b/hotspot/src/share/vm/gc_implementation/g1/concurrentMark.cpp
@@ -1204,7 +1204,6 @@ void ConcurrentMark::checkpointRootsFinal(bool clear_all_soft_refs) {
g1p->record_concurrent_mark_remark_end();
}
-
#define CARD_BM_TEST_MODE 0
class CalcLiveObjectsClosure: public HeapRegionClosure {
@@ -1726,6 +1725,11 @@ void ConcurrentMark::cleanup() {
}
_total_counting_time += this_final_counting_time;
+ if (G1PrintRegionLivenessInfo) {
+ G1PrintRegionLivenessInfoClosure cl(gclog_or_tty, "Post-Marking");
+ _g1h->heap_region_iterate(&cl);
+ }
+
// Install newly created mark bitMap as "prev".
swapMarkBitMaps();
@@ -3199,8 +3203,12 @@ public:
CMTask* task)
: _g1h(g1h), _cm(cm), _task(task)
{
- _ref_processor = g1h->ref_processor();
- assert(_ref_processor != NULL, "should not be NULL");
+ assert(_ref_processor == NULL, "should be initialized to NULL");
+
+ if (G1UseConcMarkReferenceProcessing) {
+ _ref_processor = g1h->ref_processor();
+ assert(_ref_processor != NULL, "should not be NULL");
+ }
}
};
@@ -4423,3 +4431,175 @@ CMTask::CMTask(int task_id,
_marking_step_diffs_ms.add(0.5);
}
+
+// These are formatting macros that are used below to ensure
+// consistent formatting. The *_H_* versions are used to format the
+// header for a particular value and they should be kept consistent
+// with the corresponding macro. Also note that most of the macros add
+// the necessary white space (as a prefix) which makes them a bit
+// easier to compose.
+
+// All the output lines are prefixed with this string to be able to
+// identify them easily in a large log file.
+#define G1PPRL_LINE_PREFIX "###"
+
+#define G1PPRL_ADDR_BASE_FORMAT " "PTR_FORMAT"-"PTR_FORMAT
+#ifdef _LP64
+#define G1PPRL_ADDR_BASE_H_FORMAT " %37s"
+#else // _LP64
+#define G1PPRL_ADDR_BASE_H_FORMAT " %21s"
+#endif // _LP64
+
+// For per-region info
+#define G1PPRL_TYPE_FORMAT " %-4s"
+#define G1PPRL_TYPE_H_FORMAT " %4s"
+#define G1PPRL_BYTE_FORMAT " "SIZE_FORMAT_W(9)
+#define G1PPRL_BYTE_H_FORMAT " %9s"
+#define G1PPRL_DOUBLE_FORMAT " %14.1f"
+#define G1PPRL_DOUBLE_H_FORMAT " %14s"
+
+// For summary info
+#define G1PPRL_SUM_ADDR_FORMAT(tag) " "tag":"G1PPRL_ADDR_BASE_FORMAT
+#define G1PPRL_SUM_BYTE_FORMAT(tag) " "tag": "SIZE_FORMAT
+#define G1PPRL_SUM_MB_FORMAT(tag) " "tag": %1.2f MB"
+#define G1PPRL_SUM_MB_PERC_FORMAT(tag) G1PPRL_SUM_MB_FORMAT(tag)" / %1.2f %%"
+
+G1PrintRegionLivenessInfoClosure::
+G1PrintRegionLivenessInfoClosure(outputStream* out, const char* phase_name)
+ : _out(out),
+ _total_used_bytes(0), _total_capacity_bytes(0),
+ _total_prev_live_bytes(0), _total_next_live_bytes(0),
+ _hum_used_bytes(0), _hum_capacity_bytes(0),
+ _hum_prev_live_bytes(0), _hum_next_live_bytes(0) {
+ G1CollectedHeap* g1h = G1CollectedHeap::heap();
+ MemRegion g1_committed = g1h->g1_committed();
+ MemRegion g1_reserved = g1h->g1_reserved();
+ double now = os::elapsedTime();
+
+ // Print the header of the output.
+ _out->cr();
+ _out->print_cr(G1PPRL_LINE_PREFIX" PHASE %s @ %1.3f", phase_name, now);
+ _out->print_cr(G1PPRL_LINE_PREFIX" HEAP"
+ G1PPRL_SUM_ADDR_FORMAT("committed")
+ G1PPRL_SUM_ADDR_FORMAT("reserved")
+ G1PPRL_SUM_BYTE_FORMAT("region-size"),
+ g1_committed.start(), g1_committed.end(),
+ g1_reserved.start(), g1_reserved.end(),
+ HeapRegion::GrainBytes);
+ _out->print_cr(G1PPRL_LINE_PREFIX);
+ _out->print_cr(G1PPRL_LINE_PREFIX
+ G1PPRL_TYPE_H_FORMAT
+ G1PPRL_ADDR_BASE_H_FORMAT
+ G1PPRL_BYTE_H_FORMAT
+ G1PPRL_BYTE_H_FORMAT
+ G1PPRL_BYTE_H_FORMAT
+ G1PPRL_DOUBLE_H_FORMAT,
+ "type", "address-range",
+ "used", "prev-live", "next-live", "gc-eff");
+}
+
+// It takes as a parameter a reference to one of the _hum_* fields, it
+// deduces the corresponding value for a region in a humongous region
+// series (either the region size, or what's left if the _hum_* field
+// is < the region size), and updates the _hum_* field accordingly.
+size_t G1PrintRegionLivenessInfoClosure::get_hum_bytes(size_t* hum_bytes) {
+ size_t bytes = 0;
+ // The > 0 check is to deal with the prev and next live bytes which
+ // could be 0.
+ if (*hum_bytes > 0) {
+ bytes = MIN2((size_t) HeapRegion::GrainBytes, *hum_bytes);
+ *hum_bytes -= bytes;
+ }
+ return bytes;
+}
+
+// It deduces the values for a region in a humongous region series
+// from the _hum_* fields and updates those accordingly. It assumes
+// that that _hum_* fields have already been set up from the "starts
+// humongous" region and we visit the regions in address order.
+void G1PrintRegionLivenessInfoClosure::get_hum_bytes(size_t* used_bytes,
+ size_t* capacity_bytes,
+ size_t* prev_live_bytes,
+ size_t* next_live_bytes) {
+ assert(_hum_used_bytes > 0 && _hum_capacity_bytes > 0, "pre-condition");
+ *used_bytes = get_hum_bytes(&_hum_used_bytes);
+ *capacity_bytes = get_hum_bytes(&_hum_capacity_bytes);
+ *prev_live_bytes = get_hum_bytes(&_hum_prev_live_bytes);
+ *next_live_bytes = get_hum_bytes(&_hum_next_live_bytes);
+}
+
+bool G1PrintRegionLivenessInfoClosure::doHeapRegion(HeapRegion* r) {
+ const char* type = "";
+ HeapWord* bottom = r->bottom();
+ HeapWord* end = r->end();
+ size_t capacity_bytes = r->capacity();
+ size_t used_bytes = r->used();
+ size_t prev_live_bytes = r->live_bytes();
+ size_t next_live_bytes = r->next_live_bytes();
+ double gc_eff = r->gc_efficiency();
+ if (r->used() == 0) {
+ type = "FREE";
+ } else if (r->is_survivor()) {
+ type = "SURV";
+ } else if (r->is_young()) {
+ type = "EDEN";
+ } else if (r->startsHumongous()) {
+ type = "HUMS";
+
+ assert(_hum_used_bytes == 0 && _hum_capacity_bytes == 0 &&
+ _hum_prev_live_bytes == 0 && _hum_next_live_bytes == 0,
+ "they should have been zeroed after the last time we used them");
+ // Set up the _hum_* fields.
+ _hum_capacity_bytes = capacity_bytes;
+ _hum_used_bytes = used_bytes;
+ _hum_prev_live_bytes = prev_live_bytes;
+ _hum_next_live_bytes = next_live_bytes;
+ get_hum_bytes(&used_bytes, &capacity_bytes,
+ &prev_live_bytes, &next_live_bytes);
+ end = bottom + HeapRegion::GrainWords;
+ } else if (r->continuesHumongous()) {
+ type = "HUMC";
+ get_hum_bytes(&used_bytes, &capacity_bytes,
+ &prev_live_bytes, &next_live_bytes);
+ assert(end == bottom + HeapRegion::GrainWords, "invariant");
+ } else {
+ type = "OLD";
+ }
+
+ _total_used_bytes += used_bytes;
+ _total_capacity_bytes += capacity_bytes;
+ _total_prev_live_bytes += prev_live_bytes;
+ _total_next_live_bytes += next_live_bytes;
+
+ // Print a line for this particular region.
+ _out->print_cr(G1PPRL_LINE_PREFIX
+ G1PPRL_TYPE_FORMAT
+ G1PPRL_ADDR_BASE_FORMAT
+ G1PPRL_BYTE_FORMAT
+ G1PPRL_BYTE_FORMAT
+ G1PPRL_BYTE_FORMAT
+ G1PPRL_DOUBLE_FORMAT,
+ type, bottom, end,
+ used_bytes, prev_live_bytes, next_live_bytes, gc_eff);
+
+ return false;
+}
+
+G1PrintRegionLivenessInfoClosure::~G1PrintRegionLivenessInfoClosure() {
+ // Print the footer of the output.
+ _out->print_cr(G1PPRL_LINE_PREFIX);
+ _out->print_cr(G1PPRL_LINE_PREFIX
+ " SUMMARY"
+ G1PPRL_SUM_MB_FORMAT("capacity")
+ G1PPRL_SUM_MB_PERC_FORMAT("used")
+ G1PPRL_SUM_MB_PERC_FORMAT("prev-live")
+ G1PPRL_SUM_MB_PERC_FORMAT("next-live"),
+ bytes_to_mb(_total_capacity_bytes),
+ bytes_to_mb(_total_used_bytes),
+ perc(_total_used_bytes, _total_capacity_bytes),
+ bytes_to_mb(_total_prev_live_bytes),
+ perc(_total_prev_live_bytes, _total_capacity_bytes),
+ bytes_to_mb(_total_next_live_bytes),
+ perc(_total_next_live_bytes, _total_capacity_bytes));
+ _out->cr();
+}
diff --git a/hotspot/src/share/vm/gc_implementation/g1/concurrentMark.hpp b/hotspot/src/share/vm/gc_implementation/g1/concurrentMark.hpp
index e256d4e1f83..b85969786ac 100644
--- a/hotspot/src/share/vm/gc_implementation/g1/concurrentMark.hpp
+++ b/hotspot/src/share/vm/gc_implementation/g1/concurrentMark.hpp
@@ -1149,4 +1149,54 @@ public:
#endif // _MARKING_STATS_
};
+// Class that's used to to print out per-region liveness
+// information. It's currently used at the end of marking and also
+// after we sort the old regions at the end of the cleanup operation.
+class G1PrintRegionLivenessInfoClosure: public HeapRegionClosure {
+private:
+ outputStream* _out;
+
+ // Accumulators for these values.
+ size_t _total_used_bytes;
+ size_t _total_capacity_bytes;
+ size_t _total_prev_live_bytes;
+ size_t _total_next_live_bytes;
+
+ // These are set up when we come across a "stars humongous" region
+ // (as this is where most of this information is stored, not in the
+ // subsequent "continues humongous" regions). After that, for every
+ // region in a given humongous region series we deduce the right
+ // values for it by simply subtracting the appropriate amount from
+ // these fields. All these values should reach 0 after we've visited
+ // the last region in the series.
+ size_t _hum_used_bytes;
+ size_t _hum_capacity_bytes;
+ size_t _hum_prev_live_bytes;
+ size_t _hum_next_live_bytes;
+
+ static double perc(size_t val, size_t total) {
+ if (total == 0) {
+ return 0.0;
+ } else {
+ return 100.0 * ((double) val / (double) total);
+ }
+ }
+
+ static double bytes_to_mb(size_t val) {
+ return (double) val / (double) M;
+ }
+
+ // See the .cpp file.
+ size_t get_hum_bytes(size_t* hum_bytes);
+ void get_hum_bytes(size_t* used_bytes, size_t* capacity_bytes,
+ size_t* prev_live_bytes, size_t* next_live_bytes);
+
+public:
+ // The header and footer are printed in the constructor and
+ // destructor respectively.
+ G1PrintRegionLivenessInfoClosure(outputStream* out, const char* phase_name);
+ virtual bool doHeapRegion(HeapRegion* r);
+ ~G1PrintRegionLivenessInfoClosure();
+};
+
#endif // SHARE_VM_GC_IMPLEMENTATION_G1_CONCURRENTMARK_HPP
diff --git a/hotspot/src/share/vm/gc_implementation/g1/g1AllocRegion.cpp b/hotspot/src/share/vm/gc_implementation/g1/g1AllocRegion.cpp
new file mode 100644
index 00000000000..5d0d916c48d
--- /dev/null
+++ b/hotspot/src/share/vm/gc_implementation/g1/g1AllocRegion.cpp
@@ -0,0 +1,208 @@
+/*
+ * Copyright (c) 2011, 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.
+ *
+ */
+
+#include "precompiled.hpp"
+#include "gc_implementation/g1/g1AllocRegion.inline.hpp"
+#include "gc_implementation/g1/g1CollectedHeap.inline.hpp"
+
+G1CollectedHeap* G1AllocRegion::_g1h = NULL;
+HeapRegion* G1AllocRegion::_dummy_region = NULL;
+
+void G1AllocRegion::setup(G1CollectedHeap* g1h, HeapRegion* dummy_region) {
+ assert(_dummy_region == NULL, "should be set once");
+ assert(dummy_region != NULL, "pre-condition");
+ assert(dummy_region->free() == 0, "pre-condition");
+
+ // Make sure that any allocation attempt on this region will fail
+ // and will not trigger any asserts.
+ assert(allocate(dummy_region, 1, false) == NULL, "should fail");
+ assert(par_allocate(dummy_region, 1, false) == NULL, "should fail");
+ assert(allocate(dummy_region, 1, true) == NULL, "should fail");
+ assert(par_allocate(dummy_region, 1, true) == NULL, "should fail");
+
+ _g1h = g1h;
+ _dummy_region = dummy_region;
+}
+
+void G1AllocRegion::fill_up_remaining_space(HeapRegion* alloc_region,
+ bool bot_updates) {
+ assert(alloc_region != NULL && alloc_region != _dummy_region,
+ "pre-condition");
+
+ // Other threads might still be trying to allocate using a CAS out
+ // of the region we are trying to retire, as they can do so without
+ // holding the lock. So, we first have to make sure that noone else
+ // can allocate out of it by doing a maximal allocation. Even if our
+ // CAS attempt fails a few times, we'll succeed sooner or later
+ // given that failed CAS attempts mean that the region is getting
+ // closed to being full.
+ size_t free_word_size = alloc_region->free() / HeapWordSize;
+
+ // This is the minimum free chunk we can turn into a dummy
+ // object. If the free space falls below this, then noone can
+ // allocate in this region anyway (all allocation requests will be
+ // of a size larger than this) so we won't have to perform the dummy
+ // allocation.
+ size_t min_word_size_to_fill = CollectedHeap::min_fill_size();
+
+ while (free_word_size >= min_word_size_to_fill) {
+ HeapWord* dummy = par_allocate(alloc_region, free_word_size, bot_updates);
+ if (dummy != NULL) {
+ // If the allocation was successful we should fill in the space.
+ CollectedHeap::fill_with_object(dummy, free_word_size);
+ alloc_region->set_pre_dummy_top(dummy);
+ break;
+ }
+
+ free_word_size = alloc_region->free() / HeapWordSize;
+ // It's also possible that someone else beats us to the
+ // allocation and they fill up the region. In that case, we can
+ // just get out of the loop.
+ }
+ assert(alloc_region->free() / HeapWordSize < min_word_size_to_fill,
+ "post-condition");
+}
+
+void G1AllocRegion::retire(bool fill_up) {
+ assert(_alloc_region != NULL, ar_ext_msg(this, "not initialized properly"));
+
+ trace("retiring");
+ HeapRegion* alloc_region = _alloc_region;
+ if (alloc_region != _dummy_region) {
+ // We never have to check whether the active region is empty or not,
+ // and potentially free it if it is, given that it's guaranteed that
+ // it will never be empty.
+ assert(!alloc_region->is_empty(),
+ ar_ext_msg(this, "the alloc region should never be empty"));
+
+ if (fill_up) {
+ fill_up_remaining_space(alloc_region, _bot_updates);
+ }
+
+ assert(alloc_region->used() >= _used_bytes_before,
+ ar_ext_msg(this, "invariant"));
+ size_t allocated_bytes = alloc_region->used() - _used_bytes_before;
+ retire_region(alloc_region, allocated_bytes);
+ _used_bytes_before = 0;
+ _alloc_region = _dummy_region;
+ }
+ trace("retired");
+}
+
+HeapWord* G1AllocRegion::new_alloc_region_and_allocate(size_t word_size,
+ bool force) {
+ assert(_alloc_region == _dummy_region, ar_ext_msg(this, "pre-condition"));
+ assert(_used_bytes_before == 0, ar_ext_msg(this, "pre-condition"));
+
+ trace("attempting region allocation");
+ HeapRegion* new_alloc_region = allocate_new_region(word_size, force);
+ if (new_alloc_region != NULL) {
+ new_alloc_region->reset_pre_dummy_top();
+ // Need to do this before the allocation
+ _used_bytes_before = new_alloc_region->used();
+ HeapWord* result = allocate(new_alloc_region, word_size, _bot_updates);
+ assert(result != NULL, ar_ext_msg(this, "the allocation should succeeded"));
+
+ OrderAccess::storestore();
+ // Note that we first perform the allocation and then we store the
+ // region in _alloc_region. This is the reason why an active region
+ // can never be empty.
+ _alloc_region = new_alloc_region;
+ trace("region allocation successful");
+ return result;
+ } else {
+ trace("region allocation failed");
+ return NULL;
+ }
+ ShouldNotReachHere();
+}
+
+void G1AllocRegion::fill_in_ext_msg(ar_ext_msg* msg, const char* message) {
+ msg->append("[%s] %s b: %s r: "PTR_FORMAT" u: "SIZE_FORMAT,
+ _name, message, BOOL_TO_STR(_bot_updates),
+ _alloc_region, _used_bytes_before);
+}
+
+void G1AllocRegion::init() {
+ trace("initializing");
+ assert(_alloc_region == NULL && _used_bytes_before == 0,
+ ar_ext_msg(this, "pre-condition"));
+ assert(_dummy_region != NULL, "should have been set");
+ _alloc_region = _dummy_region;
+ trace("initialized");
+}
+
+HeapRegion* G1AllocRegion::release() {
+ trace("releasing");
+ HeapRegion* alloc_region = _alloc_region;
+ retire(false /* fill_up */);
+ assert(_alloc_region == _dummy_region, "post-condition of retire()");
+ _alloc_region = NULL;
+ trace("released");
+ return (alloc_region == _dummy_region) ? NULL : alloc_region;
+}
+
+#if G1_ALLOC_REGION_TRACING
+void G1AllocRegion::trace(const char* str, size_t word_size, HeapWord* result) {
+ // All the calls to trace that set either just the size or the size
+ // and the result are considered part of level 2 tracing and are
+ // skipped during level 1 tracing.
+ if ((word_size == 0 && result == NULL) || (G1_ALLOC_REGION_TRACING > 1)) {
+ const size_t buffer_length = 128;
+ char hr_buffer[buffer_length];
+ char rest_buffer[buffer_length];
+
+ HeapRegion* alloc_region = _alloc_region;
+ if (alloc_region == NULL) {
+ jio_snprintf(hr_buffer, buffer_length, "NULL");
+ } else if (alloc_region == _dummy_region) {
+ jio_snprintf(hr_buffer, buffer_length, "DUMMY");
+ } else {
+ jio_snprintf(hr_buffer, buffer_length,
+ HR_FORMAT, HR_FORMAT_PARAMS(alloc_region));
+ }
+
+ if (G1_ALLOC_REGION_TRACING > 1) {
+ if (result != NULL) {
+ jio_snprintf(rest_buffer, buffer_length, SIZE_FORMAT" "PTR_FORMAT,
+ word_size, result);
+ } else if (word_size != 0) {
+ jio_snprintf(rest_buffer, buffer_length, SIZE_FORMAT, word_size);
+ } else {
+ jio_snprintf(rest_buffer, buffer_length, "");
+ }
+ } else {
+ jio_snprintf(rest_buffer, buffer_length, "");
+ }
+
+ tty->print_cr("[%s] %s : %s %s", _name, hr_buffer, str, rest_buffer);
+ }
+}
+#endif // G1_ALLOC_REGION_TRACING
+
+G1AllocRegion::G1AllocRegion(const char* name,
+ bool bot_updates)
+ : _name(name), _bot_updates(bot_updates),
+ _alloc_region(NULL), _used_bytes_before(0) { }
+
diff --git a/hotspot/src/share/vm/gc_implementation/g1/g1AllocRegion.hpp b/hotspot/src/share/vm/gc_implementation/g1/g1AllocRegion.hpp
new file mode 100644
index 00000000000..d329d1ed543
--- /dev/null
+++ b/hotspot/src/share/vm/gc_implementation/g1/g1AllocRegion.hpp
@@ -0,0 +1,174 @@
+/*
+ * Copyright (c) 2011, 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 SHARE_VM_GC_IMPLEMENTATION_G1_G1ALLOCREGION_HPP
+#define SHARE_VM_GC_IMPLEMENTATION_G1_G1ALLOCREGION_HPP
+
+#include "gc_implementation/g1/heapRegion.hpp"
+
+class G1CollectedHeap;
+
+// 0 -> no tracing, 1 -> basic tracing, 2 -> basic + allocation tracing
+#define G1_ALLOC_REGION_TRACING 0
+
+class ar_ext_msg;
+
+// A class that holds a region that is active in satisfying allocation
+// requests, potentially issued in parallel. When the active region is
+// full it will be retired it replaced with a new one. The
+// implementation assumes that fast-path allocations will be lock-free
+// and a lock will need to be taken when the active region needs to be
+// replaced.
+
+class G1AllocRegion VALUE_OBJ_CLASS_SPEC {
+ friend class ar_ext_msg;
+
+private:
+ // The active allocating region we are currently allocating out
+ // of. The invariant is that if this object is initialized (i.e.,
+ // init() has been called and release() has not) then _alloc_region
+ // is either an active allocating region or the dummy region (i.e.,
+ // it can never be NULL) and this object can be used to satisfy
+ // allocation requests. If this object is not initialized
+ // (i.e. init() has not been called or release() has been called)
+ // then _alloc_region is NULL and this object should not be used to
+ // satisfy allocation requests (it was done this way to force the
+ // correct use of init() and release()).
+ HeapRegion* _alloc_region;
+
+ // When we set up a new active region we save its used bytes in this
+ // field so that, when we retire it, we can calculate how much space
+ // we allocated in it.
+ size_t _used_bytes_before;
+
+ // Specifies whether the allocate calls will do BOT updates or not.
+ bool _bot_updates;
+
+ // Useful for debugging and tracing.
+ const char* _name;
+
+ // A dummy region (i.e., it's been allocated specially for this
+ // purpose and it is not part of the heap) that is full (i.e., top()
+ // == end()). When we don't have a valid active region we make
+ // _alloc_region point to this. This allows us to skip checking
+ // whether the _alloc_region is NULL or not.
+ static HeapRegion* _dummy_region;
+
+ // Some of the methods below take a bot_updates parameter. Its value
+ // should be the same as the _bot_updates field. The idea is that
+ // the parameter will be a constant for a particular alloc region
+ // and, given that these methods will be hopefully inlined, the
+ // compiler should compile out the test.
+
+ // Perform a non-MT-safe allocation out of the given region.
+ static inline HeapWord* allocate(HeapRegion* alloc_region,
+ size_t word_size,
+ bool bot_updates);
+
+ // Perform a MT-safe allocation out of the given region.
+ static inline HeapWord* par_allocate(HeapRegion* alloc_region,
+ size_t word_size,
+ bool bot_updates);
+
+ // Ensure that the region passed as a parameter has been filled up
+ // so that noone else can allocate out of it any more.
+ static void fill_up_remaining_space(HeapRegion* alloc_region,
+ bool bot_updates);
+
+ // Retire the active allocating region. If fill_up is true then make
+ // sure that the region is full before we retire it so that noone
+ // else can allocate out of it.
+ void retire(bool fill_up);
+
+ // Allocate a new active region and use it to perform a word_size
+ // allocation. The force parameter will be passed on to
+ // G1CollectedHeap::allocate_new_alloc_region() and tells it to try
+ // to allocate a new region even if the max has been reached.
+ HeapWord* new_alloc_region_and_allocate(size_t word_size, bool force);
+
+ void fill_in_ext_msg(ar_ext_msg* msg, const char* message);
+
+protected:
+ // For convenience as subclasses use it.
+ static G1CollectedHeap* _g1h;
+
+ virtual HeapRegion* allocate_new_region(size_t word_size, bool force) = 0;
+ virtual void retire_region(HeapRegion* alloc_region,
+ size_t allocated_bytes) = 0;
+
+ G1AllocRegion(const char* name, bool bot_updates);
+
+public:
+ static void setup(G1CollectedHeap* g1h, HeapRegion* dummy_region);
+
+ HeapRegion* get() const {
+ // Make sure that the dummy region does not escape this class.
+ return (_alloc_region == _dummy_region) ? NULL : _alloc_region;
+ }
+
+ // The following two are the building blocks for the allocation method.
+
+ // First-level allocation: Should be called without holding a
+ // lock. It will try to allocate lock-free out of the active region,
+ // or return NULL if it was unable to.
+ inline HeapWord* attempt_allocation(size_t word_size, bool bot_updates);
+
+ // Second-level allocation: Should be called while holding a
+ // lock. It will try to first allocate lock-free out of the active
+ // region or, if it's unable to, it will try to replace the active
+ // alloc region with a new one. We require that the caller takes the
+ // appropriate lock before calling this so that it is easier to make
+ // it conform to its locking protocol.
+ inline HeapWord* attempt_allocation_locked(size_t word_size,
+ bool bot_updates);
+
+ // Should be called to allocate a new region even if the max of this
+ // type of regions has been reached. Should only be called if other
+ // allocation attempts have failed and we are not holding a valid
+ // active region.
+ inline HeapWord* attempt_allocation_force(size_t word_size,
+ bool bot_updates);
+
+ // Should be called before we start using this object.
+ void init();
+
+ // Should be called when we want to release the active region which
+ // is returned after it's been retired.
+ HeapRegion* release();
+
+#if G1_ALLOC_REGION_TRACING
+ void trace(const char* str, size_t word_size = 0, HeapWord* result = NULL);
+#else // G1_ALLOC_REGION_TRACING
+ void trace(const char* str, size_t word_size = 0, HeapWord* result = NULL) { }
+#endif // G1_ALLOC_REGION_TRACING
+};
+
+class ar_ext_msg : public err_msg {
+public:
+ ar_ext_msg(G1AllocRegion* alloc_region, const char *message) : err_msg("") {
+ alloc_region->fill_in_ext_msg(this, message);
+ }
+};
+
+#endif // SHARE_VM_GC_IMPLEMENTATION_G1_G1ALLOCREGION_HPP
diff --git a/hotspot/src/share/vm/gc_implementation/g1/g1AllocRegion.inline.hpp b/hotspot/src/share/vm/gc_implementation/g1/g1AllocRegion.inline.hpp
new file mode 100644
index 00000000000..c096de3837a
--- /dev/null
+++ b/hotspot/src/share/vm/gc_implementation/g1/g1AllocRegion.inline.hpp
@@ -0,0 +1,106 @@
+/*
+ * Copyright (c) 2011, 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 SHARE_VM_GC_IMPLEMENTATION_G1_G1ALLOCREGION_INLINE_HPP
+#define SHARE_VM_GC_IMPLEMENTATION_G1_G1ALLOCREGION_INLINE_HPP
+
+#include "gc_implementation/g1/g1AllocRegion.hpp"
+
+inline HeapWord* G1AllocRegion::allocate(HeapRegion* alloc_region,
+ size_t word_size,
+ bool bot_updates) {
+ assert(alloc_region != NULL, err_msg("pre-condition"));
+
+ if (!bot_updates) {
+ return alloc_region->allocate_no_bot_updates(word_size);
+ } else {
+ return alloc_region->allocate(word_size);
+ }
+}
+
+inline HeapWord* G1AllocRegion::par_allocate(HeapRegion* alloc_region,
+ size_t word_size,
+ bool bot_updates) {
+ assert(alloc_region != NULL, err_msg("pre-condition"));
+ assert(!alloc_region->is_empty(), err_msg("pre-condition"));
+
+ if (!bot_updates) {
+ return alloc_region->par_allocate_no_bot_updates(word_size);
+ } else {
+ return alloc_region->par_allocate(word_size);
+ }
+}
+
+inline HeapWord* G1AllocRegion::attempt_allocation(size_t word_size,
+ bool bot_updates) {
+ assert(bot_updates == _bot_updates, ar_ext_msg(this, "pre-condition"));
+
+ HeapRegion* alloc_region = _alloc_region;
+ assert(alloc_region != NULL, ar_ext_msg(this, "not initialized properly"));
+
+ HeapWord* result = par_allocate(alloc_region, word_size, bot_updates);
+ if (result != NULL) {
+ trace("alloc", word_size, result);
+ return result;
+ }
+ trace("alloc failed", word_size);
+ return NULL;
+}
+
+inline HeapWord* G1AllocRegion::attempt_allocation_locked(size_t word_size,
+ bool bot_updates) {
+ // First we have to tedo the allocation, assuming we're holding the
+ // appropriate lock, in case another thread changed the region while
+ // we were waiting to get the lock.
+ HeapWord* result = attempt_allocation(word_size, bot_updates);
+ if (result != NULL) {
+ return result;
+ }
+
+ retire(true /* fill_up */);
+ result = new_alloc_region_and_allocate(word_size, false /* force */);
+ if (result != NULL) {
+ trace("alloc locked (second attempt)", word_size, result);
+ return result;
+ }
+ trace("alloc locked failed", word_size);
+ return NULL;
+}
+
+inline HeapWord* G1AllocRegion::attempt_allocation_force(size_t word_size,
+ bool bot_updates) {
+ assert(bot_updates == _bot_updates, ar_ext_msg(this, "pre-condition"));
+ assert(_alloc_region != NULL, ar_ext_msg(this, "not initialized properly"));
+
+ trace("forcing alloc");
+ HeapWord* result = new_alloc_region_and_allocate(word_size, true /* force */);
+ if (result != NULL) {
+ trace("alloc forced", word_size, result);
+ return result;
+ }
+ trace("alloc forced failed", word_size);
+ return NULL;
+}
+
+#endif // SHARE_VM_GC_IMPLEMENTATION_G1_G1ALLOCREGION_INLINE_HPP
diff --git a/hotspot/src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp b/hotspot/src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp
index f82eec43b6c..1c2b116a5ba 100644
--- a/hotspot/src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp
+++ b/hotspot/src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp
@@ -28,6 +28,7 @@
#include "gc_implementation/g1/concurrentG1Refine.hpp"
#include "gc_implementation/g1/concurrentG1RefineThread.hpp"
#include "gc_implementation/g1/concurrentMarkThread.inline.hpp"
+#include "gc_implementation/g1/g1AllocRegion.inline.hpp"
#include "gc_implementation/g1/g1CollectedHeap.inline.hpp"
#include "gc_implementation/g1/g1CollectorPolicy.hpp"
#include "gc_implementation/g1/g1MarkSweep.hpp"
@@ -517,8 +518,7 @@ G1CollectedHeap::new_region_try_secondary_free_list() {
return NULL;
}
-HeapRegion* G1CollectedHeap::new_region_work(size_t word_size,
- bool do_expand) {
+HeapRegion* G1CollectedHeap::new_region(size_t word_size, bool do_expand) {
assert(!isHumongous(word_size) ||
word_size <= (size_t) HeapRegion::GrainWords,
"the only time we use this to allocate a humongous region is "
@@ -566,7 +566,7 @@ HeapRegion* G1CollectedHeap::new_gc_alloc_region(int purpose,
size_t word_size) {
HeapRegion* alloc_region = NULL;
if (_gc_alloc_region_counts[purpose] < g1_policy()->max_regions(purpose)) {
- alloc_region = new_region_work(word_size, true /* do_expand */);
+ alloc_region = new_region(word_size, true /* do_expand */);
if (purpose == GCAllocForSurvived && alloc_region != NULL) {
alloc_region->set_survivor();
}
@@ -587,7 +587,7 @@ int G1CollectedHeap::humongous_obj_allocate_find_first(size_t num_regions,
// Only one region to allocate, no need to go through the slower
// path. The caller will attempt the expasion if this fails, so
// let's not try to expand here too.
- HeapRegion* hr = new_region_work(word_size, false /* do_expand */);
+ HeapRegion* hr = new_region(word_size, false /* do_expand */);
if (hr != NULL) {
first = hr->hrs_index();
} else {
@@ -788,407 +788,12 @@ HeapWord* G1CollectedHeap::humongous_obj_allocate(size_t word_size) {
return result;
}
-void
-G1CollectedHeap::retire_cur_alloc_region(HeapRegion* cur_alloc_region) {
- // Other threads might still be trying to allocate using CASes out
- // of the region we are retiring, as they can do so without holding
- // the Heap_lock. So we first have to make sure that noone else can
- // allocate in it by doing a maximal allocation. Even if our CAS
- // attempt fails a few times, we'll succeed sooner or later given
- // that a failed CAS attempt mean that the region is getting closed
- // to being full (someone else succeeded in allocating into it).
- size_t free_word_size = cur_alloc_region->free() / HeapWordSize;
-
- // This is the minimum free chunk we can turn into a dummy
- // object. If the free space falls below this, then noone can
- // allocate in this region anyway (all allocation requests will be
- // of a size larger than this) so we won't have to perform the dummy
- // allocation.
- size_t min_word_size_to_fill = CollectedHeap::min_fill_size();
-
- while (free_word_size >= min_word_size_to_fill) {
- HeapWord* dummy =
- cur_alloc_region->par_allocate_no_bot_updates(free_word_size);
- if (dummy != NULL) {
- // If the allocation was successful we should fill in the space.
- CollectedHeap::fill_with_object(dummy, free_word_size);
- break;
- }
-
- free_word_size = cur_alloc_region->free() / HeapWordSize;
- // It's also possible that someone else beats us to the
- // allocation and they fill up the region. In that case, we can
- // just get out of the loop
- }
- assert(cur_alloc_region->free() / HeapWordSize < min_word_size_to_fill,
- "sanity");
-
- retire_cur_alloc_region_common(cur_alloc_region);
- assert(_cur_alloc_region == NULL, "post-condition");
-}
-
-// See the comment in the .hpp file about the locking protocol and
-// assumptions of this method (and other related ones).
-HeapWord*
-G1CollectedHeap::replace_cur_alloc_region_and_allocate(size_t word_size,
- bool at_safepoint,
- bool do_dirtying,
- bool can_expand) {
- assert_heap_locked_or_at_safepoint(true /* should_be_vm_thread */);
- assert(_cur_alloc_region == NULL,
- "replace_cur_alloc_region_and_allocate() should only be called "
- "after retiring the previous current alloc region");
- assert(SafepointSynchronize::is_at_safepoint() == at_safepoint,
- "at_safepoint and is_at_safepoint() should be a tautology");
- assert(!can_expand || g1_policy()->can_expand_young_list(),
- "we should not call this method with can_expand == true if "
- "we are not allowed to expand the young gen");
-
- if (can_expand || !g1_policy()->is_young_list_full()) {
- HeapRegion* new_cur_alloc_region = new_alloc_region(word_size);
- if (new_cur_alloc_region != NULL) {
- assert(new_cur_alloc_region->is_empty(),
- "the newly-allocated region should be empty, "
- "as right now we only allocate new regions out of the free list");
- g1_policy()->update_region_num(true /* next_is_young */);
- set_region_short_lived_locked(new_cur_alloc_region);
-
- assert(!new_cur_alloc_region->isHumongous(),
- "Catch a regression of this bug.");
-
- // We need to ensure that the stores to _cur_alloc_region and,
- // subsequently, to top do not float above the setting of the
- // young type.
- OrderAccess::storestore();
-
- // Now, perform the allocation out of the region we just
- // allocated. Note that noone else can access that region at
- // this point (as _cur_alloc_region has not been updated yet),
- // so we can just go ahead and do the allocation without any
- // atomics (and we expect this allocation attempt to
- // suceeded). Given that other threads can attempt an allocation
- // with a CAS and without needing the Heap_lock, if we assigned
- // the new region to _cur_alloc_region before first allocating
- // into it other threads might have filled up the new region
- // before we got a chance to do the allocation ourselves. In
- // that case, we would have needed to retire the region, grab a
- // new one, and go through all this again. Allocating out of the
- // new region before assigning it to _cur_alloc_region avoids
- // all this.
- HeapWord* result =
- new_cur_alloc_region->allocate_no_bot_updates(word_size);
- assert(result != NULL, "we just allocate out of an empty region "
- "so allocation should have been successful");
- assert(is_in(result), "result should be in the heap");
-
- // Now make sure that the store to _cur_alloc_region does not
- // float above the store to top.
- OrderAccess::storestore();
- _cur_alloc_region = new_cur_alloc_region;
-
- if (!at_safepoint) {
- Heap_lock->unlock();
- }
-
- // do the dirtying, if necessary, after we release the Heap_lock
- if (do_dirtying) {
- dirty_young_block(result, word_size);
- }
- return result;
- }
- }
-
- assert(_cur_alloc_region == NULL, "we failed to allocate a new current "
- "alloc region, it should still be NULL");
- assert_heap_locked_or_at_safepoint(true /* should_be_vm_thread */);
- return NULL;
-}
-
-// See the comment in the .hpp file about the locking protocol and
-// assumptions of this method (and other related ones).
-HeapWord*
-G1CollectedHeap::attempt_allocation_slow(size_t word_size) {
- assert_heap_locked_and_not_at_safepoint();
- assert(!isHumongous(word_size), "attempt_allocation_slow() should not be "
- "used for humongous allocations");
-
- // We should only reach here when we were unable to allocate
- // otherwise. So, we should have not active current alloc region.
- assert(_cur_alloc_region == NULL, "current alloc region should be NULL");
-
- // We will loop while succeeded is false, which means that we tried
- // to do a collection, but the VM op did not succeed. So, when we
- // exit the loop, either one of the allocation attempts was
- // successful, or we succeeded in doing the VM op but which was
- // unable to allocate after the collection.
- for (int try_count = 1; /* we'll return or break */; try_count += 1) {
- bool succeeded = true;
-
- // Every time we go round the loop we should be holding the Heap_lock.
- assert_heap_locked();
-
- if (GC_locker::is_active_and_needs_gc()) {
- // We are locked out of GC because of the GC locker. We can
- // allocate a new region only if we can expand the young gen.
-
- if (g1_policy()->can_expand_young_list()) {
- // Yes, we are allowed to expand the young gen. Let's try to
- // allocate a new current alloc region.
- HeapWord* result =
- replace_cur_alloc_region_and_allocate(word_size,
- false, /* at_safepoint */
- true, /* do_dirtying */
- true /* can_expand */);
- if (result != NULL) {
- assert_heap_not_locked();
- return result;
- }
- }
- // We could not expand the young gen further (or we could but we
- // failed to allocate a new region). We'll stall until the GC
- // locker forces a GC.
-
- // If this thread is not in a jni critical section, we stall
- // the requestor until the critical section has cleared and
- // GC allowed. When the critical section clears, a GC is
- // initiated by the last thread exiting the critical section; so
- // we retry the allocation sequence from the beginning of the loop,
- // rather than causing more, now probably unnecessary, GC attempts.
- JavaThread* jthr = JavaThread::current();
- assert(jthr != NULL, "sanity");
- if (jthr->in_critical()) {
- if (CheckJNICalls) {
- fatal("Possible deadlock due to allocating while"
- " in jni critical section");
- }
- // We are returning NULL so the protocol is that we're still
- // holding the Heap_lock.
- assert_heap_locked();
- return NULL;
- }
-
- Heap_lock->unlock();
- GC_locker::stall_until_clear();
-
- // No need to relock the Heap_lock. We'll fall off to the code
- // below the else-statement which assumes that we are not
- // holding the Heap_lock.
- } else {
- // We are not locked out. So, let's try to do a GC. The VM op
- // will retry the allocation before it completes.
-
- // Read the GC count while holding the Heap_lock
- unsigned int gc_count_before = SharedHeap::heap()->total_collections();
-
- Heap_lock->unlock();
-
- HeapWord* result =
- do_collection_pause(word_size, gc_count_before, &succeeded);
- assert_heap_not_locked();
- if (result != NULL) {
- assert(succeeded, "the VM op should have succeeded");
-
- // Allocations that take place on VM operations do not do any
- // card dirtying and we have to do it here.
- dirty_young_block(result, word_size);
- return result;
- }
- }
-
- // Both paths that get us here from above unlock the Heap_lock.
- assert_heap_not_locked();
-
- // We can reach here when we were unsuccessful in doing a GC,
- // because another thread beat us to it, or because we were locked
- // out of GC due to the GC locker. In either case a new alloc
- // region might be available so we will retry the allocation.
- HeapWord* result = attempt_allocation(word_size);
- if (result != NULL) {
- assert_heap_not_locked();
- return result;
- }
-
- // So far our attempts to allocate failed. The only time we'll go
- // around the loop and try again is if we tried to do a GC and the
- // VM op that we tried to schedule was not successful because
- // another thread beat us to it. If that happened it's possible
- // that by the time we grabbed the Heap_lock again and tried to
- // allocate other threads filled up the young generation, which
- // means that the allocation attempt after the GC also failed. So,
- // it's worth trying to schedule another GC pause.
- if (succeeded) {
- break;
- }
-
- // Give a warning if we seem to be looping forever.
- if ((QueuedAllocationWarningCount > 0) &&
- (try_count % QueuedAllocationWarningCount == 0)) {
- warning("G1CollectedHeap::attempt_allocation_slow() "
- "retries %d times", try_count);
- }
- }
-
- assert_heap_locked();
- return NULL;
-}
-
-// See the comment in the .hpp file about the locking protocol and
-// assumptions of this method (and other related ones).
-HeapWord*
-G1CollectedHeap::attempt_allocation_humongous(size_t word_size,
- bool at_safepoint) {
- // This is the method that will allocate a humongous object. All
- // allocation paths that attempt to allocate a humongous object
- // should eventually reach here. Currently, the only paths are from
- // mem_allocate() and attempt_allocation_at_safepoint().
- assert_heap_locked_or_at_safepoint(true /* should_be_vm_thread */);
- assert(isHumongous(word_size), "attempt_allocation_humongous() "
- "should only be used for humongous allocations");
- assert(SafepointSynchronize::is_at_safepoint() == at_safepoint,
- "at_safepoint and is_at_safepoint() should be a tautology");
-
- HeapWord* result = NULL;
-
- // We will loop while succeeded is false, which means that we tried
- // to do a collection, but the VM op did not succeed. So, when we
- // exit the loop, either one of the allocation attempts was
- // successful, or we succeeded in doing the VM op but which was
- // unable to allocate after the collection.
- for (int try_count = 1; /* we'll return or break */; try_count += 1) {
- bool succeeded = true;
-
- // Given that humongous objects are not allocated in young
- // regions, we'll first try to do the allocation without doing a
- // collection hoping that there's enough space in the heap.
- result = humongous_obj_allocate(word_size);
- assert(_cur_alloc_region == NULL || !_cur_alloc_region->isHumongous(),
- "catch a regression of this bug.");
- if (result != NULL) {
- if (!at_safepoint) {
- // If we're not at a safepoint, unlock the Heap_lock.
- Heap_lock->unlock();
- }
- return result;
- }
-
- // If we failed to allocate the humongous object, we should try to
- // do a collection pause (if we're allowed) in case it reclaims
- // enough space for the allocation to succeed after the pause.
- if (!at_safepoint) {
- // Read the GC count while holding the Heap_lock
- unsigned int gc_count_before = SharedHeap::heap()->total_collections();
-
- // If we're allowed to do a collection we're not at a
- // safepoint, so it is safe to unlock the Heap_lock.
- Heap_lock->unlock();
-
- result = do_collection_pause(word_size, gc_count_before, &succeeded);
- assert_heap_not_locked();
- if (result != NULL) {
- assert(succeeded, "the VM op should have succeeded");
- return result;
- }
-
- // If we get here, the VM operation either did not succeed
- // (i.e., another thread beat us to it) or it succeeded but
- // failed to allocate the object.
-
- // If we're allowed to do a collection we're not at a
- // safepoint, so it is safe to lock the Heap_lock.
- Heap_lock->lock();
- }
-
- assert(result == NULL, "otherwise we should have exited the loop earlier");
-
- // So far our attempts to allocate failed. The only time we'll go
- // around the loop and try again is if we tried to do a GC and the
- // VM op that we tried to schedule was not successful because
- // another thread beat us to it. That way it's possible that some
- // space was freed up by the thread that successfully scheduled a
- // GC. So it's worth trying to allocate again.
- if (succeeded) {
- break;
- }
-
- // Give a warning if we seem to be looping forever.
- if ((QueuedAllocationWarningCount > 0) &&
- (try_count % QueuedAllocationWarningCount == 0)) {
- warning("G1CollectedHeap::attempt_allocation_humongous "
- "retries %d times", try_count);
- }
- }
-
- assert_heap_locked_or_at_safepoint(true /* should_be_vm_thread */);
- return NULL;
-}
-
-HeapWord* G1CollectedHeap::attempt_allocation_at_safepoint(size_t word_size,
- bool expect_null_cur_alloc_region) {
- assert_at_safepoint(true /* should_be_vm_thread */);
- assert(_cur_alloc_region == NULL || !expect_null_cur_alloc_region,
- err_msg("the current alloc region was unexpectedly found "
- "to be non-NULL, cur alloc region: "PTR_FORMAT" "
- "expect_null_cur_alloc_region: %d word_size: "SIZE_FORMAT,
- _cur_alloc_region, expect_null_cur_alloc_region, word_size));
-
- if (!isHumongous(word_size)) {
- if (!expect_null_cur_alloc_region) {
- HeapRegion* cur_alloc_region = _cur_alloc_region;
- if (cur_alloc_region != NULL) {
- // We are at a safepoint so no reason to use the MT-safe version.
- HeapWord* result = cur_alloc_region->allocate_no_bot_updates(word_size);
- if (result != NULL) {
- assert(is_in(result), "result should be in the heap");
-
- // We will not do any dirtying here. This is guaranteed to be
- // called during a safepoint and the thread that scheduled the
- // pause will do the dirtying if we return a non-NULL result.
- return result;
- }
-
- retire_cur_alloc_region_common(cur_alloc_region);
- }
- }
-
- assert(_cur_alloc_region == NULL,
- "at this point we should have no cur alloc region");
- return replace_cur_alloc_region_and_allocate(word_size,
- true, /* at_safepoint */
- false /* do_dirtying */,
- false /* can_expand */);
- } else {
- return attempt_allocation_humongous(word_size,
- true /* at_safepoint */);
- }
-
- ShouldNotReachHere();
-}
-
HeapWord* G1CollectedHeap::allocate_new_tlab(size_t word_size) {
assert_heap_not_locked_and_not_at_safepoint();
- assert(!isHumongous(word_size), "we do not allow TLABs of humongous size");
+ assert(!isHumongous(word_size), "we do not allow humongous TLABs");
- // First attempt: Try allocating out of the current alloc region
- // using a CAS. If that fails, take the Heap_lock and retry the
- // allocation, potentially replacing the current alloc region.
- HeapWord* result = attempt_allocation(word_size);
- if (result != NULL) {
- assert_heap_not_locked();
- return result;
- }
-
- // Second attempt: Go to the slower path where we might try to
- // schedule a collection.
- result = attempt_allocation_slow(word_size);
- if (result != NULL) {
- assert_heap_not_locked();
- return result;
- }
-
- assert_heap_locked();
- // Need to unlock the Heap_lock before returning.
- Heap_lock->unlock();
- return NULL;
+ unsigned int dummy_gc_count_before;
+ return attempt_allocation(word_size, &dummy_gc_count_before);
}
HeapWord*
@@ -1200,48 +805,18 @@ G1CollectedHeap::mem_allocate(size_t word_size,
assert(!is_tlab, "mem_allocate() this should not be called directly "
"to allocate TLABs");
- // Loop until the allocation is satisified,
- // or unsatisfied after GC.
+ // Loop until the allocation is satisified, or unsatisfied after GC.
for (int try_count = 1; /* we'll return */; try_count += 1) {
unsigned int gc_count_before;
- {
- if (!isHumongous(word_size)) {
- // First attempt: Try allocating out of the current alloc region
- // using a CAS. If that fails, take the Heap_lock and retry the
- // allocation, potentially replacing the current alloc region.
- HeapWord* result = attempt_allocation(word_size);
- if (result != NULL) {
- assert_heap_not_locked();
- return result;
- }
- assert_heap_locked();
-
- // Second attempt: Go to the slower path where we might try to
- // schedule a collection.
- result = attempt_allocation_slow(word_size);
- if (result != NULL) {
- assert_heap_not_locked();
- return result;
- }
- } else {
- // attempt_allocation_humongous() requires the Heap_lock to be held.
- Heap_lock->lock();
-
- HeapWord* result = attempt_allocation_humongous(word_size,
- false /* at_safepoint */);
- if (result != NULL) {
- assert_heap_not_locked();
- return result;
- }
- }
-
- assert_heap_locked();
- // Read the gc count while the heap lock is held.
- gc_count_before = SharedHeap::heap()->total_collections();
-
- // Release the Heap_lock before attempting the collection.
- Heap_lock->unlock();
+ HeapWord* result = NULL;
+ if (!isHumongous(word_size)) {
+ result = attempt_allocation(word_size, &gc_count_before);
+ } else {
+ result = attempt_allocation_humongous(word_size, &gc_count_before);
+ }
+ if (result != NULL) {
+ return result;
}
// Create the garbage collection operation...
@@ -1249,7 +824,6 @@ G1CollectedHeap::mem_allocate(size_t word_size,
// ...and get the VM thread to execute it.
VMThread::execute(&op);
- assert_heap_not_locked();
if (op.prologue_succeeded() && op.pause_succeeded()) {
// If the operation was successful we'll return the result even
// if it is NULL. If the allocation attempt failed immediately
@@ -1275,21 +849,207 @@ G1CollectedHeap::mem_allocate(size_t word_size,
}
ShouldNotReachHere();
+ return NULL;
}
-void G1CollectedHeap::abandon_cur_alloc_region() {
- assert_at_safepoint(true /* should_be_vm_thread */);
+HeapWord* G1CollectedHeap::attempt_allocation_slow(size_t word_size,
+ unsigned int *gc_count_before_ret) {
+ // Make sure you read the note in attempt_allocation_humongous().
- HeapRegion* cur_alloc_region = _cur_alloc_region;
- if (cur_alloc_region != NULL) {
- assert(!cur_alloc_region->is_empty(),
- "the current alloc region can never be empty");
- assert(cur_alloc_region->is_young(),
- "the current alloc region should be young");
+ assert_heap_not_locked_and_not_at_safepoint();
+ assert(!isHumongous(word_size), "attempt_allocation_slow() should not "
+ "be called for humongous allocation requests");
- retire_cur_alloc_region_common(cur_alloc_region);
+ // We should only get here after the first-level allocation attempt
+ // (attempt_allocation()) failed to allocate.
+
+ // We will loop until a) we manage to successfully perform the
+ // allocation or b) we successfully schedule a collection which
+ // fails to perform the allocation. b) is the only case when we'll
+ // return NULL.
+ HeapWord* result = NULL;
+ for (int try_count = 1; /* we'll return */; try_count += 1) {
+ bool should_try_gc;
+ unsigned int gc_count_before;
+
+ {
+ MutexLockerEx x(Heap_lock);
+
+ result = _mutator_alloc_region.attempt_allocation_locked(word_size,
+ false /* bot_updates */);
+ if (result != NULL) {
+ return result;
+ }
+
+ // If we reach here, attempt_allocation_locked() above failed to
+ // allocate a new region. So the mutator alloc region should be NULL.
+ assert(_mutator_alloc_region.get() == NULL, "only way to get here");
+
+ if (GC_locker::is_active_and_needs_gc()) {
+ if (g1_policy()->can_expand_young_list()) {
+ result = _mutator_alloc_region.attempt_allocation_force(word_size,
+ false /* bot_updates */);
+ if (result != NULL) {
+ return result;
+ }
+ }
+ should_try_gc = false;
+ } else {
+ // Read the GC count while still holding the Heap_lock.
+ gc_count_before = SharedHeap::heap()->total_collections();
+ should_try_gc = true;
+ }
+ }
+
+ if (should_try_gc) {
+ bool succeeded;
+ result = do_collection_pause(word_size, gc_count_before, &succeeded);
+ if (result != NULL) {
+ assert(succeeded, "only way to get back a non-NULL result");
+ return result;
+ }
+
+ if (succeeded) {
+ // If we get here we successfully scheduled a collection which
+ // failed to allocate. No point in trying to allocate
+ // further. We'll just return NULL.
+ MutexLockerEx x(Heap_lock);
+ *gc_count_before_ret = SharedHeap::heap()->total_collections();
+ return NULL;
+ }
+ } else {
+ GC_locker::stall_until_clear();
+ }
+
+ // We can reach here if we were unsuccessul in scheduling a
+ // collection (because another thread beat us to it) or if we were
+ // stalled due to the GC locker. In either can we should retry the
+ // allocation attempt in case another thread successfully
+ // performed a collection and reclaimed enough space. We do the
+ // first attempt (without holding the Heap_lock) here and the
+ // follow-on attempt will be at the start of the next loop
+ // iteration (after taking the Heap_lock).
+ result = _mutator_alloc_region.attempt_allocation(word_size,
+ false /* bot_updates */);
+ if (result != NULL ){
+ return result;
+ }
+
+ // Give a warning if we seem to be looping forever.
+ if ((QueuedAllocationWarningCount > 0) &&
+ (try_count % QueuedAllocationWarningCount == 0)) {
+ warning("G1CollectedHeap::attempt_allocation_slow() "
+ "retries %d times", try_count);
+ }
}
- assert(_cur_alloc_region == NULL, "post-condition");
+
+ ShouldNotReachHere();
+ return NULL;
+}
+
+HeapWord* G1CollectedHeap::attempt_allocation_humongous(size_t word_size,
+ unsigned int * gc_count_before_ret) {
+ // The structure of this method has a lot of similarities to
+ // attempt_allocation_slow(). The reason these two were not merged
+ // into a single one is that such a method would require several "if
+ // allocation is not humongous do this, otherwise do that"
+ // conditional paths which would obscure its flow. In fact, an early
+ // version of this code did use a unified method which was harder to
+ // follow and, as a result, it had subtle bugs that were hard to
+ // track down. So keeping these two methods separate allows each to
+ // be more readable. It will be good to keep these two in sync as
+ // much as possible.
+
+ assert_heap_not_locked_and_not_at_safepoint();
+ assert(isHumongous(word_size), "attempt_allocation_humongous() "
+ "should only be called for humongous allocations");
+
+ // We will loop until a) we manage to successfully perform the
+ // allocation or b) we successfully schedule a collection which
+ // fails to perform the allocation. b) is the only case when we'll
+ // return NULL.
+ HeapWord* result = NULL;
+ for (int try_count = 1; /* we'll return */; try_count += 1) {
+ bool should_try_gc;
+ unsigned int gc_count_before;
+
+ {
+ MutexLockerEx x(Heap_lock);
+
+ // Given that humongous objects are not allocated in young
+ // regions, we'll first try to do the allocation without doing a
+ // collection hoping that there's enough space in the heap.
+ result = humongous_obj_allocate(word_size);
+ if (result != NULL) {
+ return result;
+ }
+
+ 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 = SharedHeap::heap()->total_collections();
+ should_try_gc = true;
+ }
+ }
+
+ if (should_try_gc) {
+ // If we failed to allocate the humongous object, we should try to
+ // do a collection pause (if we're allowed) in case it reclaims
+ // enough space for the allocation to succeed after the pause.
+
+ bool succeeded;
+ result = do_collection_pause(word_size, gc_count_before, &succeeded);
+ if (result != NULL) {
+ assert(succeeded, "only way to get back a non-NULL result");
+ return result;
+ }
+
+ if (succeeded) {
+ // If we get here we successfully scheduled a collection which
+ // failed to allocate. No point in trying to allocate
+ // further. We'll just return NULL.
+ MutexLockerEx x(Heap_lock);
+ *gc_count_before_ret = SharedHeap::heap()->total_collections();
+ return NULL;
+ }
+ } else {
+ GC_locker::stall_until_clear();
+ }
+
+ // We can reach here if we were unsuccessul in scheduling a
+ // collection (because another thread beat us to it) or if we were
+ // stalled due to the GC locker. In either can we should retry the
+ // allocation attempt in case another thread successfully
+ // performed a collection and reclaimed enough space. Give a
+ // warning if we seem to be looping forever.
+
+ if ((QueuedAllocationWarningCount > 0) &&
+ (try_count % QueuedAllocationWarningCount == 0)) {
+ warning("G1CollectedHeap::attempt_allocation_humongous() "
+ "retries %d times", try_count);
+ }
+ }
+
+ ShouldNotReachHere();
+ return NULL;
+}
+
+HeapWord* G1CollectedHeap::attempt_allocation_at_safepoint(size_t word_size,
+ bool expect_null_mutator_alloc_region) {
+ assert_at_safepoint(true /* should_be_vm_thread */);
+ assert(_mutator_alloc_region.get() == NULL ||
+ !expect_null_mutator_alloc_region,
+ "the current alloc region was unexpectedly found to be non-NULL");
+
+ if (!isHumongous(word_size)) {
+ return _mutator_alloc_region.attempt_allocation_locked(word_size,
+ false /* bot_updates */);
+ } else {
+ return humongous_obj_allocate(word_size);
+ }
+
+ ShouldNotReachHere();
}
void G1CollectedHeap::abandon_gc_alloc_regions() {
@@ -1417,8 +1177,8 @@ bool G1CollectedHeap::do_collection(bool explicit_gc,
if (VerifyBeforeGC && total_collections() >= VerifyGCStartAt) {
HandleMark hm; // Discard invalid handles created during verification
- prepare_for_verify();
gclog_or_tty->print(" VerifyBeforeGC:");
+ prepare_for_verify();
Universe::verify(true);
}
@@ -1439,9 +1199,8 @@ bool G1CollectedHeap::do_collection(bool explicit_gc,
concurrent_mark()->abort();
// Make sure we'll choose a new allocation region afterwards.
- abandon_cur_alloc_region();
+ release_mutator_alloc_region();
abandon_gc_alloc_regions();
- assert(_cur_alloc_region == NULL, "Invariant.");
g1_rem_set()->cleanupHRRS();
tear_down_region_lists();
@@ -1547,6 +1306,8 @@ bool G1CollectedHeap::do_collection(bool explicit_gc,
// evacuation pause.
clear_cset_fast_test();
+ init_mutator_alloc_region();
+
double end = os::elapsedTime();
g1_policy()->record_full_collection_end();
@@ -1720,8 +1481,9 @@ G1CollectedHeap::satisfy_failed_allocation(size_t word_size,
*succeeded = true;
// Let's attempt the allocation first.
- HeapWord* result = attempt_allocation_at_safepoint(word_size,
- false /* expect_null_cur_alloc_region */);
+ HeapWord* result =
+ attempt_allocation_at_safepoint(word_size,
+ false /* expect_null_mutator_alloc_region */);
if (result != NULL) {
assert(*succeeded, "sanity");
return result;
@@ -1748,7 +1510,7 @@ G1CollectedHeap::satisfy_failed_allocation(size_t word_size,
// Retry the allocation
result = attempt_allocation_at_safepoint(word_size,
- true /* expect_null_cur_alloc_region */);
+ true /* expect_null_mutator_alloc_region */);
if (result != NULL) {
assert(*succeeded, "sanity");
return result;
@@ -1765,7 +1527,7 @@ G1CollectedHeap::satisfy_failed_allocation(size_t word_size,
// Retry the allocation once more
result = attempt_allocation_at_safepoint(word_size,
- true /* expect_null_cur_alloc_region */);
+ true /* expect_null_mutator_alloc_region */);
if (result != NULL) {
assert(*succeeded, "sanity");
return result;
@@ -1796,7 +1558,7 @@ HeapWord* G1CollectedHeap::expand_and_allocate(size_t word_size) {
if (expand(expand_bytes)) {
verify_region_sets_optional();
return attempt_allocation_at_safepoint(word_size,
- false /* expect_null_cur_alloc_region */);
+ false /* expect_null_mutator_alloc_region */);
}
return NULL;
}
@@ -1940,7 +1702,6 @@ G1CollectedHeap::G1CollectedHeap(G1CollectorPolicy* policy_) :
_evac_failure_scan_stack(NULL) ,
_mark_in_progress(false),
_cg1r(NULL), _summary_bytes_used(0),
- _cur_alloc_region(NULL),
_refine_cte_cl(NULL),
_full_collection(false),
_free_list("Master Free List"),
@@ -2099,7 +1860,6 @@ jint G1CollectedHeap::initialize() {
_g1_max_committed = _g1_committed;
_hrs = new HeapRegionSeq(_expansion_regions);
guarantee(_hrs != NULL, "Couldn't allocate HeapRegionSeq");
- guarantee(_cur_alloc_region == NULL, "from constructor");
// 6843694 - ensure that the maximum region index can fit
// in the remembered set structures.
@@ -2195,6 +1955,22 @@ jint G1CollectedHeap::initialize() {
// Do later initialization work for concurrent refinement.
_cg1r->init();
+ // Here we allocate the dummy full region that is required by the
+ // G1AllocRegion class. If we don't pass an address in the reserved
+ // space here, lots of asserts fire.
+ MemRegion mr(_g1_reserved.start(), HeapRegion::GrainWords);
+ HeapRegion* dummy_region = new HeapRegion(_bot_shared, mr, true);
+ // We'll re-use the same region whether the alloc region will
+ // require BOT updates or not and, if it doesn't, then a non-young
+ // region will complain that it cannot support allocations without
+ // BOT updates. So we'll tag the dummy region as young to avoid that.
+ dummy_region->set_young();
+ // Make sure it's full.
+ dummy_region->set_top(dummy_region->end());
+ G1AllocRegion::setup(this, dummy_region);
+
+ init_mutator_alloc_region();
+
return JNI_OK;
}
@@ -2261,7 +2037,7 @@ size_t G1CollectedHeap::used() const {
"Should be owned on this thread's behalf.");
size_t result = _summary_bytes_used;
// Read only once in case it is set to NULL concurrently
- HeapRegion* hr = _cur_alloc_region;
+ HeapRegion* hr = _mutator_alloc_region.get();
if (hr != NULL)
result += hr->used();
return result;
@@ -2324,13 +2100,11 @@ size_t G1CollectedHeap::unsafe_max_alloc() {
// to free(), resulting in a SIGSEGV. Note that this doesn't appear
// to be a problem in the optimized build, since the two loads of the
// current allocation region field are optimized away.
- HeapRegion* car = _cur_alloc_region;
-
- // FIXME: should iterate over all regions?
- if (car == NULL) {
+ HeapRegion* hr = _mutator_alloc_region.get();
+ if (hr == NULL) {
return 0;
}
- return car->free();
+ return hr->free();
}
bool G1CollectedHeap::should_do_concurrent_full_gc(GCCause::Cause cause) {
@@ -2781,16 +2555,12 @@ size_t G1CollectedHeap::unsafe_max_tlab_alloc(Thread* ignored) const {
// since we can't allow tlabs to grow big enough to accomodate
// humongous objects.
- // We need to store the cur alloc region locally, since it might change
- // between when we test for NULL and when we use it later.
- ContiguousSpace* cur_alloc_space = _cur_alloc_region;
+ HeapRegion* hr = _mutator_alloc_region.get();
size_t max_tlab_size = _humongous_object_threshold_in_words * wordSize;
-
- if (cur_alloc_space == NULL) {
+ if (hr == NULL) {
return max_tlab_size;
} else {
- return MIN2(MAX2(cur_alloc_space->free(), (size_t)MinTLABSize),
- max_tlab_size);
+ return MIN2(MAX2(hr->free(), (size_t) MinTLABSize), max_tlab_size);
}
}
@@ -3364,6 +3134,7 @@ G1CollectedHeap::do_collection_pause_at_safepoint(double target_pause_time_ms) {
}
verify_region_sets_optional();
+ verify_dirty_young_regions();
{
// This call will decide whether this pause is an initial-mark
@@ -3425,8 +3196,8 @@ G1CollectedHeap::do_collection_pause_at_safepoint(double target_pause_time_ms) {
if (VerifyBeforeGC && total_collections() >= VerifyGCStartAt) {
HandleMark hm; // Discard invalid handles created during verification
- prepare_for_verify();
gclog_or_tty->print(" VerifyBeforeGC:");
+ prepare_for_verify();
Universe::verify(false);
}
@@ -3442,7 +3213,7 @@ G1CollectedHeap::do_collection_pause_at_safepoint(double target_pause_time_ms) {
// Forget the current alloc region (we might even choose it to be part
// of the collection set!).
- abandon_cur_alloc_region();
+ release_mutator_alloc_region();
// The elapsed time induced by the start time below deliberately elides
// the possible verification above.
@@ -3573,6 +3344,8 @@ G1CollectedHeap::do_collection_pause_at_safepoint(double target_pause_time_ms) {
g1_policy()->print_collection_set(g1_policy()->inc_cset_head(), gclog_or_tty);
#endif // YOUNG_LIST_VERBOSE
+ init_mutator_alloc_region();
+
double end_time_sec = os::elapsedTime();
double pause_time_ms = (end_time_sec - start_time_sec) * MILLIUNITS;
g1_policy()->record_pause_time_ms(pause_time_ms);
@@ -3655,6 +3428,15 @@ size_t G1CollectedHeap::desired_plab_sz(GCAllocPurpose purpose)
return gclab_word_size;
}
+void G1CollectedHeap::init_mutator_alloc_region() {
+ assert(_mutator_alloc_region.get() == NULL, "pre-condition");
+ _mutator_alloc_region.init();
+}
+
+void G1CollectedHeap::release_mutator_alloc_region() {
+ _mutator_alloc_region.release();
+ assert(_mutator_alloc_region.get() == NULL, "post-condition");
+}
void G1CollectedHeap::set_gc_alloc_region(int purpose, HeapRegion* r) {
assert(purpose >= 0 && purpose < GCAllocPurposeCount, "invalid purpose");
@@ -3879,7 +3661,7 @@ void G1CollectedHeap::release_gc_alloc_regions(bool totally) {
if (r->is_empty()) {
// We didn't actually allocate anything in it; let's just put
// it back on the free list.
- _free_list.add_as_tail(r);
+ _free_list.add_as_head(r);
} else if (_retain_gc_alloc_region[ap] && !totally) {
// retain it so that we can use it at the beginning of the next GC
_retained_gc_alloc_regions[ap] = r;
@@ -5013,7 +4795,7 @@ void G1CollectedHeap::free_region(HeapRegion* hr,
*pre_used += hr->used();
hr->hr_clear(par, true /* clear_space */);
- free_list->add_as_tail(hr);
+ free_list->add_as_head(hr);
}
void G1CollectedHeap::free_humongous_region(HeapRegion* hr,
@@ -5065,7 +4847,7 @@ void G1CollectedHeap::update_sets_after_freeing_regions(size_t pre_used,
}
if (free_list != NULL && !free_list->is_empty()) {
MutexLockerEx x(FreeList_lock, Mutex::_no_safepoint_check_flag);
- _free_list.add_as_tail(free_list);
+ _free_list.add_as_head(free_list);
}
if (humongous_proxy_set != NULL && !humongous_proxy_set->is_empty()) {
MutexLockerEx x(OldSets_lock, Mutex::_no_safepoint_check_flag);
@@ -5140,10 +4922,8 @@ class G1VerifyCardTableCleanup: public HeapRegionClosure {
CardTableModRefBS* _ct_bs;
public:
G1VerifyCardTableCleanup(CardTableModRefBS* ct_bs)
- : _ct_bs(ct_bs)
- { }
- virtual bool doHeapRegion(HeapRegion* r)
- {
+ : _ct_bs(ct_bs) { }
+ virtual bool doHeapRegion(HeapRegion* r) {
MemRegion mr(r->bottom(), r->end());
if (r->is_survivor()) {
_ct_bs->verify_dirty_region(mr);
@@ -5153,6 +4933,29 @@ public:
return false;
}
};
+
+void G1CollectedHeap::verify_dirty_young_list(HeapRegion* head) {
+ CardTableModRefBS* ct_bs = (CardTableModRefBS*) (barrier_set());
+ for (HeapRegion* hr = head; hr != NULL; hr = hr->get_next_young_region()) {
+ // We cannot guarantee that [bottom(),end()] is dirty. Threads
+ // dirty allocated blocks as they allocate them. The thread that
+ // retires each region and replaces it with a new one will do a
+ // maximal allocation to fill in [pre_dummy_top(),end()] but will
+ // not dirty that area (one less thing to have to do while holding
+ // a lock). So we can only verify that [bottom(),pre_dummy_top()]
+ // is dirty. Also note that verify_dirty_region() requires
+ // mr.start() and mr.end() to be card aligned and pre_dummy_top()
+ // is not guaranteed to be.
+ MemRegion mr(hr->bottom(),
+ ct_bs->align_to_card_boundary(hr->pre_dummy_top()));
+ ct_bs->verify_dirty_region(mr);
+ }
+}
+
+void G1CollectedHeap::verify_dirty_young_regions() {
+ verify_dirty_young_list(_young_list->first_region());
+ verify_dirty_young_list(_young_list->first_survivor_region());
+}
#endif
void G1CollectedHeap::cleanUpCardTable() {
@@ -5500,6 +5303,44 @@ bool G1CollectedHeap::is_in_closed_subset(const void* p) const {
}
}
+HeapRegion* G1CollectedHeap::new_mutator_alloc_region(size_t word_size,
+ bool force) {
+ assert_heap_locked_or_at_safepoint(true /* should_be_vm_thread */);
+ assert(!force || g1_policy()->can_expand_young_list(),
+ "if force is true we should be able to expand the young list");
+ if (force || !g1_policy()->is_young_list_full()) {
+ HeapRegion* new_alloc_region = new_region(word_size,
+ false /* do_expand */);
+ if (new_alloc_region != NULL) {
+ g1_policy()->update_region_num(true /* next_is_young */);
+ set_region_short_lived_locked(new_alloc_region);
+ return new_alloc_region;
+ }
+ }
+ return NULL;
+}
+
+void G1CollectedHeap::retire_mutator_alloc_region(HeapRegion* alloc_region,
+ size_t allocated_bytes) {
+ assert_heap_locked_or_at_safepoint(true /* should_be_vm_thread */);
+ assert(alloc_region->is_young(), "all mutator alloc regions should be young");
+
+ g1_policy()->add_region_to_incremental_cset_lhs(alloc_region);
+ _summary_bytes_used += allocated_bytes;
+}
+
+HeapRegion* MutatorAllocRegion::allocate_new_region(size_t word_size,
+ bool force) {
+ return _g1h->new_mutator_alloc_region(word_size, force);
+}
+
+void MutatorAllocRegion::retire_region(HeapRegion* alloc_region,
+ size_t allocated_bytes) {
+ _g1h->retire_mutator_alloc_region(alloc_region, allocated_bytes);
+}
+
+// Heap region set verification
+
class VerifyRegionListsClosure : public HeapRegionClosure {
private:
HumongousRegionSet* _humongous_set;
diff --git a/hotspot/src/share/vm/gc_implementation/g1/g1CollectedHeap.hpp b/hotspot/src/share/vm/gc_implementation/g1/g1CollectedHeap.hpp
index 5863e7c9860..a9412774486 100644
--- a/hotspot/src/share/vm/gc_implementation/g1/g1CollectedHeap.hpp
+++ b/hotspot/src/share/vm/gc_implementation/g1/g1CollectedHeap.hpp
@@ -26,6 +26,7 @@
#define SHARE_VM_GC_IMPLEMENTATION_G1_G1COLLECTEDHEAP_HPP
#include "gc_implementation/g1/concurrentMark.hpp"
+#include "gc_implementation/g1/g1AllocRegion.hpp"
#include "gc_implementation/g1/g1RemSet.hpp"
#include "gc_implementation/g1/heapRegionSets.hpp"
#include "gc_implementation/parNew/parGCAllocBuffer.hpp"
@@ -128,6 +129,15 @@ public:
void print();
};
+class MutatorAllocRegion : public G1AllocRegion {
+protected:
+ virtual HeapRegion* allocate_new_region(size_t word_size, bool force);
+ virtual void retire_region(HeapRegion* alloc_region, size_t allocated_bytes);
+public:
+ MutatorAllocRegion()
+ : G1AllocRegion("Mutator Alloc Region", false /* bot_updates */) { }
+};
+
class RefineCardTableEntryClosure;
class G1CollectedHeap : public SharedHeap {
friend class VM_G1CollectForAllocation;
@@ -135,6 +145,7 @@ class G1CollectedHeap : public SharedHeap {
friend class VM_G1CollectFull;
friend class VM_G1IncCollectionPause;
friend class VMStructs;
+ friend class MutatorAllocRegion;
// Closures used in implementation.
friend class G1ParCopyHelper;
@@ -197,12 +208,15 @@ private:
// The sequence of all heap regions in the heap.
HeapRegionSeq* _hrs;
- // The region from which normal-sized objects are currently being
- // allocated. May be NULL.
- HeapRegion* _cur_alloc_region;
+ // Alloc region used to satisfy mutator allocation requests.
+ MutatorAllocRegion _mutator_alloc_region;
+
+ // It resets the mutator alloc region before new allocations can take place.
+ void init_mutator_alloc_region();
+
+ // It releases the mutator alloc region.
+ void release_mutator_alloc_region();
- // Postcondition: cur_alloc_region == NULL.
- void abandon_cur_alloc_region();
void abandon_gc_alloc_regions();
// The to-space memory regions into which objects are being copied during
@@ -360,27 +374,21 @@ protected:
G1CollectorPolicy* _g1_policy;
// This is the second level of trying to allocate a new region. If
- // new_region_work didn't find a region in the free_list, this call
- // will check whether there's anything available in the
- // secondary_free_list and/or wait for more regions to appear in that
- // list, if _free_regions_coming is set.
+ // new_region() didn't find a region on the free_list, this call will
+ // check whether there's anything available on the
+ // secondary_free_list and/or wait for more regions to appear on
+ // that list, if _free_regions_coming is set.
HeapRegion* new_region_try_secondary_free_list();
// Try to allocate a single non-humongous HeapRegion sufficient for
// an allocation of the given word_size. If do_expand is true,
// attempt to expand the heap if necessary to satisfy the allocation
// request.
- HeapRegion* new_region_work(size_t word_size, bool do_expand);
+ HeapRegion* new_region(size_t word_size, bool do_expand);
- // Try to allocate a new region to be used for allocation by a
- // mutator thread. Attempt to expand the heap if no region is
+ // Try to allocate a new region to be used for allocation by
+ // a GC thread. It will try to expand the heap if no region is
// available.
- HeapRegion* new_alloc_region(size_t word_size) {
- return new_region_work(word_size, false /* do_expand */);
- }
-
- // Try to allocate a new region to be used for allocation by a GC
- // thread. Attempt to expand the heap if no region is available.
HeapRegion* new_gc_alloc_region(int purpose, size_t word_size);
// Attempt to satisfy a humongous allocation request of the given
@@ -415,10 +423,6 @@ protected:
// * All non-TLAB allocation requests should go to mem_allocate()
// and mem_allocate() should never be called with is_tlab == true.
//
- // * If the GC locker is active we currently stall until we can
- // allocate a new young region. This will be changed in the
- // near future (see CR 6994056).
- //
// * If either call cannot satisfy the allocation request using the
// current allocating region, they will try to get a new one. If
// this fails, they will attempt to do an evacuation pause and
@@ -441,122 +445,38 @@ protected:
bool is_tlab, /* expected to be false */
bool* gc_overhead_limit_was_exceeded);
- // The following methods, allocate_from_cur_allocation_region(),
- // attempt_allocation(), attempt_allocation_locked(),
- // replace_cur_alloc_region_and_allocate(),
- // attempt_allocation_slow(), and attempt_allocation_humongous()
- // have very awkward pre- and post-conditions with respect to
- // locking:
- //
- // If they are called outside a safepoint they assume the caller
- // holds the Heap_lock when it calls them. However, on exit they
- // will release the Heap_lock if they return a non-NULL result, but
- // keep holding the Heap_lock if they return a NULL result. The
- // reason for this is that we need to dirty the cards that span
- // allocated blocks on young regions to avoid having to take the
- // slow path of the write barrier (for performance reasons we don't
- // update RSets for references whose source is a young region, so we
- // don't need to look at dirty cards on young regions). But, doing
- // this card dirtying while holding the Heap_lock can be a
- // scalability bottleneck, especially given that some allocation
- // requests might be of non-trivial size (and the larger the region
- // size is, the fewer allocations requests will be considered
- // humongous, as the humongous size limit is a fraction of the
- // region size). So, when one of these calls succeeds in allocating
- // a block it does the card dirtying after it releases the Heap_lock
- // which is why it will return without holding it.
- //
- // The above assymetry is the reason why locking / unlocking is done
- // explicitly (i.e., with Heap_lock->lock() and
- // Heap_lock->unlocked()) instead of using MutexLocker and
- // MutexUnlocker objects. The latter would ensure that the lock is
- // unlocked / re-locked at every possible exit out of the basic
- // block. However, we only want that action to happen in selected
- // places.
- //
- // Further, if the above methods are called during a safepoint, then
- // naturally there's no assumption about the Heap_lock being held or
- // there's no attempt to unlock it. The parameter at_safepoint
- // indicates whether the call is made during a safepoint or not (as
- // an optimization, to avoid reading the global flag with
- // SafepointSynchronize::is_at_safepoint()).
- //
- // The methods share these parameters:
- //
- // * word_size : the size of the allocation request in words
- // * at_safepoint : whether the call is done at a safepoint; this
- // also determines whether a GC is permitted
- // (at_safepoint == false) or not (at_safepoint == true)
- // * do_dirtying : whether the method should dirty the allocated
- // block before returning
- //
- // They all return either the address of the block, if they
- // successfully manage to allocate it, or NULL.
+ // The following three methods take a gc_count_before_ret
+ // parameter which is used to return the GC count if the method
+ // returns NULL. Given that we are required to read the GC count
+ // while holding the Heap_lock, and these paths will take the
+ // Heap_lock at some point, it's easier to get them to read the GC
+ // count while holding the Heap_lock before they return NULL instead
+ // of the caller (namely: mem_allocate()) having to also take the
+ // Heap_lock just to read the GC count.
- // It tries to satisfy an allocation request out of the current
- // alloc region, which is passed as a parameter. It assumes that the
- // caller has checked that the current alloc region is not NULL.
- // Given that the caller has to check the current alloc region for
- // at least NULL, it might as well pass it as the first parameter so
- // that the method doesn't have to read it from the
- // _cur_alloc_region field again. It is called from both
- // attempt_allocation() and attempt_allocation_locked() and the
- // with_heap_lock parameter indicates whether the caller was holding
- // the heap lock when it called it or not.
- inline HeapWord* allocate_from_cur_alloc_region(HeapRegion* cur_alloc_region,
- size_t word_size,
- bool with_heap_lock);
+ // First-level mutator allocation attempt: try to allocate out of
+ // the mutator alloc region without taking the Heap_lock. This
+ // should only be used for non-humongous allocations.
+ inline HeapWord* attempt_allocation(size_t word_size,
+ unsigned int* gc_count_before_ret);
- // First-level of allocation slow path: it attempts to allocate out
- // of the current alloc region in a lock-free manner using a CAS. If
- // that fails it takes the Heap_lock and calls
- // attempt_allocation_locked() for the second-level slow path.
- inline HeapWord* attempt_allocation(size_t word_size);
+ // Second-level mutator allocation attempt: take the Heap_lock and
+ // retry the allocation attempt, potentially scheduling a GC
+ // pause. This should only be used for non-humongous allocations.
+ HeapWord* attempt_allocation_slow(size_t word_size,
+ unsigned int* gc_count_before_ret);
- // Second-level of allocation slow path: while holding the Heap_lock
- // it tries to allocate out of the current alloc region and, if that
- // fails, tries to allocate out of a new current alloc region.
- inline HeapWord* attempt_allocation_locked(size_t word_size);
-
- // It assumes that the current alloc region has been retired and
- // tries to allocate a new one. If it's successful, it performs the
- // allocation out of the new current alloc region and updates
- // _cur_alloc_region. Normally, it would try to allocate a new
- // region if the young gen is not full, unless can_expand is true in
- // which case it would always try to allocate a new region.
- HeapWord* replace_cur_alloc_region_and_allocate(size_t word_size,
- bool at_safepoint,
- bool do_dirtying,
- bool can_expand);
-
- // Third-level of allocation slow path: when we are unable to
- // allocate a new current alloc region to satisfy an allocation
- // request (i.e., when attempt_allocation_locked() fails). It will
- // try to do an evacuation pause, which might stall due to the GC
- // locker, and retry the allocation attempt when appropriate.
- HeapWord* attempt_allocation_slow(size_t word_size);
-
- // The method that tries to satisfy a humongous allocation
- // request. If it cannot satisfy it it will try to do an evacuation
- // pause to perhaps reclaim enough space to be able to satisfy the
- // allocation request afterwards.
+ // Takes the Heap_lock and attempts a humongous allocation. It can
+ // potentially schedule a GC pause.
HeapWord* attempt_allocation_humongous(size_t word_size,
- bool at_safepoint);
+ unsigned int* gc_count_before_ret);
- // It does the common work when we are retiring the current alloc region.
- inline void retire_cur_alloc_region_common(HeapRegion* cur_alloc_region);
-
- // It retires the current alloc region, which is passed as a
- // parameter (since, typically, the caller is already holding on to
- // it). It sets _cur_alloc_region to NULL.
- void retire_cur_alloc_region(HeapRegion* cur_alloc_region);
-
- // It attempts to do an allocation immediately before or after an
- // evacuation pause and can only be called by the VM thread. It has
- // slightly different assumptions that the ones before (i.e.,
- // assumes that the current alloc region has been retired).
+ // Allocation attempt that should be called during safepoints (e.g.,
+ // at the end of a successful GC). expect_null_mutator_alloc_region
+ // specifies whether the mutator alloc region is expected to be NULL
+ // or not.
HeapWord* attempt_allocation_at_safepoint(size_t word_size,
- bool expect_null_cur_alloc_region);
+ bool expect_null_mutator_alloc_region);
// It dirties the cards that cover the block so that so that the post
// write barrier never queues anything when updating objects on this
@@ -583,6 +503,12 @@ protected:
// GC pause.
void retire_alloc_region(HeapRegion* alloc_region, bool par);
+ // These two methods are the "callbacks" from the G1AllocRegion class.
+
+ HeapRegion* new_mutator_alloc_region(size_t word_size, bool force);
+ void retire_mutator_alloc_region(HeapRegion* alloc_region,
+ size_t allocated_bytes);
+
// - if explicit_gc is true, the GC is for a System.gc() or a heap
// inspection request and should collect the entire heap
// - if clear_all_soft_refs is true, all soft references should be
@@ -1027,6 +953,9 @@ public:
// The number of regions available for "regular" expansion.
size_t expansion_regions() { return _expansion_regions; }
+ void verify_dirty_young_list(HeapRegion* head) PRODUCT_RETURN;
+ void verify_dirty_young_regions() PRODUCT_RETURN;
+
// verify_region_sets() performs verification over the region
// lists. It will be compiled in the product code to be used when
// necessary (i.e., during heap verification).
@@ -1061,7 +990,7 @@ public:
}
void append_secondary_free_list() {
- _free_list.add_as_tail(&_secondary_free_list);
+ _free_list.add_as_head(&_secondary_free_list);
}
void append_secondary_free_list_if_not_empty_with_lock() {
@@ -1128,7 +1057,13 @@ public:
return _g1_reserved.contains(p);
}
- // Returns a MemRegion that corresponds to the space that has been
+ // Returns a MemRegion that corresponds to the space that has been
+ // reserved for the heap
+ MemRegion g1_reserved() {
+ return _g1_reserved;
+ }
+
+ // Returns a MemRegion that corresponds to the space that has been
// committed in the heap
MemRegion g1_committed() {
return _g1_committed;
diff --git a/hotspot/src/share/vm/gc_implementation/g1/g1CollectedHeap.inline.hpp b/hotspot/src/share/vm/gc_implementation/g1/g1CollectedHeap.inline.hpp
index 43c12272c7e..185d0a318cc 100644
--- a/hotspot/src/share/vm/gc_implementation/g1/g1CollectedHeap.inline.hpp
+++ b/hotspot/src/share/vm/gc_implementation/g1/g1CollectedHeap.inline.hpp
@@ -27,6 +27,7 @@
#include "gc_implementation/g1/concurrentMark.hpp"
#include "gc_implementation/g1/g1CollectedHeap.hpp"
+#include "gc_implementation/g1/g1AllocRegion.inline.hpp"
#include "gc_implementation/g1/g1CollectorPolicy.hpp"
#include "gc_implementation/g1/heapRegionSeq.inline.hpp"
#include "utilities/taskqueue.hpp"
@@ -59,131 +60,23 @@ inline bool G1CollectedHeap::obj_in_cs(oop obj) {
return r != NULL && r->in_collection_set();
}
-// See the comment in the .hpp file about the locking protocol and
-// assumptions of this method (and other related ones).
inline HeapWord*
-G1CollectedHeap::allocate_from_cur_alloc_region(HeapRegion* cur_alloc_region,
- size_t word_size,
- bool with_heap_lock) {
- assert_not_at_safepoint();
- assert(with_heap_lock == Heap_lock->owned_by_self(),
- "with_heap_lock and Heap_lock->owned_by_self() should be a tautology");
- assert(cur_alloc_region != NULL, "pre-condition of the method");
- assert(cur_alloc_region->is_young(),
- "we only support young current alloc regions");
- assert(!isHumongous(word_size), "allocate_from_cur_alloc_region() "
- "should not be used for humongous allocations");
- assert(!cur_alloc_region->isHumongous(), "Catch a regression of this bug.");
-
- assert(!cur_alloc_region->is_empty(),
- err_msg("region ["PTR_FORMAT","PTR_FORMAT"] should not be empty",
- cur_alloc_region->bottom(), cur_alloc_region->end()));
- HeapWord* result = cur_alloc_region->par_allocate_no_bot_updates(word_size);
- if (result != NULL) {
- assert(is_in(result), "result should be in the heap");
-
- if (with_heap_lock) {
- Heap_lock->unlock();
- }
- assert_heap_not_locked();
- // Do the dirtying after we release the Heap_lock.
- dirty_young_block(result, word_size);
- return result;
- }
-
- if (with_heap_lock) {
- assert_heap_locked();
- } else {
- assert_heap_not_locked();
- }
- return NULL;
-}
-
-// See the comment in the .hpp file about the locking protocol and
-// assumptions of this method (and other related ones).
-inline HeapWord*
-G1CollectedHeap::attempt_allocation(size_t word_size) {
+G1CollectedHeap::attempt_allocation(size_t word_size,
+ unsigned int* gc_count_before_ret) {
assert_heap_not_locked_and_not_at_safepoint();
- assert(!isHumongous(word_size), "attempt_allocation() should not be called "
- "for humongous allocation requests");
+ assert(!isHumongous(word_size), "attempt_allocation() should not "
+ "be called for humongous allocation requests");
- HeapRegion* cur_alloc_region = _cur_alloc_region;
- if (cur_alloc_region != NULL) {
- HeapWord* result = allocate_from_cur_alloc_region(cur_alloc_region,
- word_size,
- false /* with_heap_lock */);
- assert_heap_not_locked();
- if (result != NULL) {
- return result;
- }
+ HeapWord* result = _mutator_alloc_region.attempt_allocation(word_size,
+ false /* bot_updates */);
+ if (result == NULL) {
+ result = attempt_allocation_slow(word_size, gc_count_before_ret);
}
-
- // Our attempt to allocate lock-free failed as the current
- // allocation region is either NULL or full. So, we'll now take the
- // Heap_lock and retry.
- Heap_lock->lock();
-
- HeapWord* result = attempt_allocation_locked(word_size);
+ assert_heap_not_locked();
if (result != NULL) {
- assert_heap_not_locked();
- return result;
+ dirty_young_block(result, word_size);
}
-
- assert_heap_locked();
- return NULL;
-}
-
-inline void
-G1CollectedHeap::retire_cur_alloc_region_common(HeapRegion* cur_alloc_region) {
- assert_heap_locked_or_at_safepoint(true /* should_be_vm_thread */);
- assert(cur_alloc_region != NULL && cur_alloc_region == _cur_alloc_region,
- "pre-condition of the call");
- assert(cur_alloc_region->is_young(),
- "we only support young current alloc regions");
-
- // The region is guaranteed to be young
- g1_policy()->add_region_to_incremental_cset_lhs(cur_alloc_region);
- _summary_bytes_used += cur_alloc_region->used();
- _cur_alloc_region = NULL;
-}
-
-inline HeapWord*
-G1CollectedHeap::attempt_allocation_locked(size_t word_size) {
- assert_heap_locked_and_not_at_safepoint();
- assert(!isHumongous(word_size), "attempt_allocation_locked() "
- "should not be called for humongous allocation requests");
-
- // First, reread the current alloc region and retry the allocation
- // in case somebody replaced it while we were waiting to get the
- // Heap_lock.
- HeapRegion* cur_alloc_region = _cur_alloc_region;
- if (cur_alloc_region != NULL) {
- HeapWord* result = allocate_from_cur_alloc_region(
- cur_alloc_region, word_size,
- true /* with_heap_lock */);
- if (result != NULL) {
- assert_heap_not_locked();
- return result;
- }
-
- // We failed to allocate out of the current alloc region, so let's
- // retire it before getting a new one.
- retire_cur_alloc_region(cur_alloc_region);
- }
-
- assert_heap_locked();
- // Try to get a new region and allocate out of it
- HeapWord* result = replace_cur_alloc_region_and_allocate(word_size,
- false, /* at_safepoint */
- true, /* do_dirtying */
- false /* can_expand */);
- if (result != NULL) {
- assert_heap_not_locked();
- return result;
- }
-
- assert_heap_locked();
- return NULL;
+ return result;
}
// It dirties the cards that cover the block so that so that the post
diff --git a/hotspot/src/share/vm/gc_implementation/g1/g1CollectorPolicy.cpp b/hotspot/src/share/vm/gc_implementation/g1/g1CollectorPolicy.cpp
index 18f11076996..1421e2d2e57 100644
--- a/hotspot/src/share/vm/gc_implementation/g1/g1CollectorPolicy.cpp
+++ b/hotspot/src/share/vm/gc_implementation/g1/g1CollectorPolicy.cpp
@@ -307,6 +307,7 @@ G1CollectorPolicy::G1CollectorPolicy() :
_par_last_termination_times_ms = new double[_parallel_gc_threads];
_par_last_termination_attempts = new double[_parallel_gc_threads];
_par_last_gc_worker_end_times_ms = new double[_parallel_gc_threads];
+ _par_last_gc_worker_times_ms = new double[_parallel_gc_threads];
// start conservatively
_expensive_region_limit_ms = 0.5 * (double) MaxGCPauseMillis;
@@ -911,6 +912,7 @@ void G1CollectorPolicy::record_collection_pause_start(double start_time_sec,
_par_last_termination_times_ms[i] = -1234.0;
_par_last_termination_attempts[i] = -1234.0;
_par_last_gc_worker_end_times_ms[i] = -1234.0;
+ _par_last_gc_worker_times_ms[i] = -1234.0;
}
#endif
@@ -1063,8 +1065,7 @@ T sum_of(T* sum_arr, int start, int n, int N) {
void G1CollectorPolicy::print_par_stats(int level,
const char* str,
- double* data,
- bool summary) {
+ double* data) {
double min = data[0], max = data[0];
double total = 0.0;
LineBuffer buf(level);
@@ -1078,20 +1079,15 @@ void G1CollectorPolicy::print_par_stats(int level,
total += val;
buf.append(" %3.1lf", val);
}
- if (summary) {
- buf.append_and_print_cr("");
- double avg = total / (double) ParallelGCThreads;
- buf.append(" ");
- buf.append("Avg: %5.1lf, Min: %5.1lf, Max: %5.1lf",
- avg, min, max);
- }
- buf.append_and_print_cr("]");
+ buf.append_and_print_cr("");
+ double avg = total / (double) ParallelGCThreads;
+ buf.append_and_print_cr(" Avg: %5.1lf, Min: %5.1lf, Max: %5.1lf, Diff: %5.1lf]",
+ avg, min, max, max - min);
}
void G1CollectorPolicy::print_par_sizes(int level,
const char* str,
- double* data,
- bool summary) {
+ double* data) {
double min = data[0], max = data[0];
double total = 0.0;
LineBuffer buf(level);
@@ -1105,14 +1101,10 @@ void G1CollectorPolicy::print_par_sizes(int level,
total += val;
buf.append(" %d", (int) val);
}
- if (summary) {
- buf.append_and_print_cr("");
- double avg = total / (double) ParallelGCThreads;
- buf.append(" ");
- buf.append("Sum: %d, Avg: %d, Min: %d, Max: %d",
- (int)total, (int)avg, (int)min, (int)max);
- }
- buf.append_and_print_cr("]");
+ buf.append_and_print_cr("");
+ double avg = total / (double) ParallelGCThreads;
+ 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,
@@ -1421,22 +1413,22 @@ void G1CollectorPolicy::record_collection_pause_end() {
}
if (parallel) {
print_stats(1, "Parallel Time", _cur_collection_par_time_ms);
- print_par_stats(2, "GC Worker Start Time",
- _par_last_gc_worker_start_times_ms, false);
+ print_par_stats(2, "GC Worker Start Time", _par_last_gc_worker_start_times_ms);
print_par_stats(2, "Update RS", _par_last_update_rs_times_ms);
- print_par_sizes(3, "Processed Buffers",
- _par_last_update_rs_processed_buffers, true);
- print_par_stats(2, "Ext Root Scanning",
- _par_last_ext_root_scan_times_ms);
- print_par_stats(2, "Mark Stack Scanning",
- _par_last_mark_stack_scan_times_ms);
+ print_par_sizes(3, "Processed Buffers", _par_last_update_rs_processed_buffers);
+ print_par_stats(2, "Ext Root Scanning", _par_last_ext_root_scan_times_ms);
+ print_par_stats(2, "Mark Stack Scanning", _par_last_mark_stack_scan_times_ms);
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);
- print_par_sizes(3, "Termination Attempts",
- _par_last_termination_attempts, true);
- print_par_stats(2, "GC Worker End Time",
- _par_last_gc_worker_end_times_ms, false);
+ print_par_sizes(3, "Termination Attempts", _par_last_termination_attempts);
+ print_par_stats(2, "GC Worker End Time", _par_last_gc_worker_end_times_ms);
+
+ for (int i = 0; i < _parallel_gc_threads; i++) {
+ _par_last_gc_worker_times_ms[i] = _par_last_gc_worker_end_times_ms[i] - _par_last_gc_worker_start_times_ms[i];
+ }
+ print_par_stats(2, "GC Worker Times", _par_last_gc_worker_times_ms);
+
print_stats(2, "Other", parallel_other_time);
print_stats(1, "Clear CT", _cur_clear_ct_time_ms);
} else {
diff --git a/hotspot/src/share/vm/gc_implementation/g1/g1CollectorPolicy.hpp b/hotspot/src/share/vm/gc_implementation/g1/g1CollectorPolicy.hpp
index f7375d6a48e..79c5ee225db 100644
--- a/hotspot/src/share/vm/gc_implementation/g1/g1CollectorPolicy.hpp
+++ b/hotspot/src/share/vm/gc_implementation/g1/g1CollectorPolicy.hpp
@@ -182,6 +182,7 @@ protected:
double* _par_last_termination_times_ms;
double* _par_last_termination_attempts;
double* _par_last_gc_worker_end_times_ms;
+ double* _par_last_gc_worker_times_ms;
// indicates that we are in young GC mode
bool _in_young_gc_mode;
@@ -569,11 +570,8 @@ protected:
void print_stats(int level, const char* str, double value);
void print_stats(int level, const char* str, int value);
- void print_par_stats(int level, const char* str, double* data) {
- print_par_stats(level, str, data, true);
- }
- void print_par_stats(int level, const char* str, double* data, bool summary);
- void print_par_sizes(int level, const char* str, double* data, bool summary);
+ void print_par_stats(int level, const char* str, double* data);
+ void print_par_sizes(int level, const char* str, double* data);
void check_other_times(int level,
NumberSeq* other_times_ms,
diff --git a/hotspot/src/share/vm/gc_implementation/g1/g1SATBCardTableModRefBS.hpp b/hotspot/src/share/vm/gc_implementation/g1/g1SATBCardTableModRefBS.hpp
index a8c7e7e9a2e..50cc99d0994 100644
--- a/hotspot/src/share/vm/gc_implementation/g1/g1SATBCardTableModRefBS.hpp
+++ b/hotspot/src/share/vm/gc_implementation/g1/g1SATBCardTableModRefBS.hpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2001, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 2011, 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
diff --git a/hotspot/src/share/vm/gc_implementation/g1/g1_globals.hpp b/hotspot/src/share/vm/gc_implementation/g1/g1_globals.hpp
index 19a8338c6e6..b42949f22a1 100644
--- a/hotspot/src/share/vm/gc_implementation/g1/g1_globals.hpp
+++ b/hotspot/src/share/vm/gc_implementation/g1/g1_globals.hpp
@@ -89,6 +89,11 @@
"The number of discovered reference objects to process before " \
"draining concurrent marking work queues.") \
\
+ experimental(bool, G1UseConcMarkReferenceProcessing, false, \
+ "If true, enable reference discovery during concurrent " \
+ "marking and reference processing at the end of remark " \
+ "(unsafe).") \
+ \
develop(bool, G1SATBBarrierPrintNullPreVals, false, \
"If true, count frac of ptr writes with null pre-vals.") \
\
@@ -138,9 +143,9 @@
develop(bool, G1RSCountHisto, false, \
"If true, print a histogram of RS occupancies after each pause") \
\
- develop(intx, G1PrintRegionLivenessInfo, 0, \
- "When > 0, print the occupancies of the best and worst" \
- "regions.") \
+ product(bool, G1PrintRegionLivenessInfo, false, \
+ "Prints the liveness information for all regions in the heap " \
+ "at the end of a marking cycle.") \
\
develop(bool, G1PrintParCleanupStats, false, \
"When true, print extra stats about parallel cleanup.") \
@@ -193,6 +198,10 @@
develop(intx, G1ConcRSHotCardLimit, 4, \
"The threshold that defines (>=) a hot card.") \
\
+ develop(intx, G1MaxHotCardCountSizePercent, 25, \
+ "The maximum size of the hot card count cache as a " \
+ "percentage of the number of cards for the maximum heap.") \
+ \
develop(bool, G1PrintOopAppls, false, \
"When true, print applications of closures to external locs.") \
\
diff --git a/hotspot/src/share/vm/gc_implementation/g1/heapRegion.cpp b/hotspot/src/share/vm/gc_implementation/g1/heapRegion.cpp
index b25f7cf5290..65d9b7c4d97 100644
--- a/hotspot/src/share/vm/gc_implementation/g1/heapRegion.cpp
+++ b/hotspot/src/share/vm/gc_implementation/g1/heapRegion.cpp
@@ -360,6 +360,7 @@ void HeapRegion::hr_clear(bool par, bool clear_space) {
set_young_index_in_cset(-1);
uninstall_surv_rate_group();
set_young_type(NotYoung);
+ reset_pre_dummy_top();
if (!par) {
// If this is parallel, this will be done later.
@@ -923,11 +924,11 @@ void G1OffsetTableContigSpace::set_saved_mark() {
ContiguousSpace::set_saved_mark();
OrderAccess::storestore();
_gc_time_stamp = curr_gc_time_stamp;
- // The following fence is to force a flush of the writes above, but
- // is strictly not needed because when an allocating worker thread
- // calls set_saved_mark() it does so under the ParGCRareEvent_lock;
- // when the lock is released, the write will be flushed.
- // OrderAccess::fence();
+ // No need to do another barrier to flush the writes above. If
+ // this is called in parallel with other threads trying to
+ // allocate into the region, the caller should call this while
+ // holding a lock and when the lock is released the writes will be
+ // flushed.
}
}
diff --git a/hotspot/src/share/vm/gc_implementation/g1/heapRegion.hpp b/hotspot/src/share/vm/gc_implementation/g1/heapRegion.hpp
index 2d7385ef9b7..6c307f942de 100644
--- a/hotspot/src/share/vm/gc_implementation/g1/heapRegion.hpp
+++ b/hotspot/src/share/vm/gc_implementation/g1/heapRegion.hpp
@@ -149,6 +149,13 @@ class G1OffsetTableContigSpace: public ContiguousSpace {
G1BlockOffsetArrayContigSpace _offsets;
Mutex _par_alloc_lock;
volatile unsigned _gc_time_stamp;
+ // When we need to retire an allocation region, while other threads
+ // are also concurrently trying to allocate into it, we typically
+ // allocate a dummy object at the end of the region to ensure that
+ // no more allocations can take place in it. However, sometimes we
+ // want to know where the end of the last "real" object we allocated
+ // into the region was and this is what this keeps track.
+ HeapWord* _pre_dummy_top;
public:
// Constructor. If "is_zeroed" is true, the MemRegion "mr" may be
@@ -163,6 +170,17 @@ class G1OffsetTableContigSpace: public ContiguousSpace {
virtual void set_saved_mark();
void reset_gc_time_stamp() { _gc_time_stamp = 0; }
+ // See the comment above in the declaration of _pre_dummy_top for an
+ // explanation of what it is.
+ void set_pre_dummy_top(HeapWord* pre_dummy_top) {
+ assert(is_in(pre_dummy_top) && pre_dummy_top <= top(), "pre-condition");
+ _pre_dummy_top = pre_dummy_top;
+ }
+ HeapWord* pre_dummy_top() {
+ return (_pre_dummy_top == NULL) ? top() : _pre_dummy_top;
+ }
+ void reset_pre_dummy_top() { _pre_dummy_top = NULL; }
+
virtual void initialize(MemRegion mr, bool clear_space, bool mangle_space);
virtual void clear(bool mangle_space);
@@ -380,13 +398,16 @@ class HeapRegion: public G1OffsetTableContigSpace {
// The number of bytes marked live in the region in the last marking phase.
size_t marked_bytes() { return _prev_marked_bytes; }
+ size_t live_bytes() {
+ return (top() - prev_top_at_mark_start()) * HeapWordSize + marked_bytes();
+ }
+
// The number of bytes counted in the next marking.
size_t next_marked_bytes() { return _next_marked_bytes; }
// The number of bytes live wrt the next marking.
size_t next_live_bytes() {
- return (top() - next_top_at_mark_start())
- * HeapWordSize
- + next_marked_bytes();
+ return
+ (top() - next_top_at_mark_start()) * HeapWordSize + next_marked_bytes();
}
// A lower bound on the amount of garbage bytes in the region.
diff --git a/hotspot/src/share/vm/gc_implementation/g1/heapRegion.inline.hpp b/hotspot/src/share/vm/gc_implementation/g1/heapRegion.inline.hpp
index 3750bdae37c..93cad742435 100644
--- a/hotspot/src/share/vm/gc_implementation/g1/heapRegion.inline.hpp
+++ b/hotspot/src/share/vm/gc_implementation/g1/heapRegion.inline.hpp
@@ -38,15 +38,8 @@ inline HeapWord* G1OffsetTableContigSpace::allocate(size_t size) {
// this is used for larger LAB allocations only.
inline HeapWord* G1OffsetTableContigSpace::par_allocate(size_t size) {
MutexLocker x(&_par_alloc_lock);
- // This ought to be just "allocate", because of the lock above, but that
- // ContiguousSpace::allocate asserts that either the allocating thread
- // holds the heap lock or it is the VM thread and we're at a safepoint.
- // The best I (dld) could figure was to put a field in ContiguousSpace
- // meaning "locking at safepoint taken care of", and set/reset that
- // here. But this will do for now, especially in light of the comment
- // above. Perhaps in the future some lock-free manner of keeping the
- // coordination.
- HeapWord* res = ContiguousSpace::par_allocate(size);
+ // Given that we take the lock no need to use par_allocate() here.
+ HeapWord* res = ContiguousSpace::allocate(size);
if (res != NULL) {
_offsets.alloc_block(res, size);
}
diff --git a/hotspot/src/share/vm/gc_implementation/g1/heapRegionSet.cpp b/hotspot/src/share/vm/gc_implementation/g1/heapRegionSet.cpp
index be80cd2201a..5f35e2f0520 100644
--- a/hotspot/src/share/vm/gc_implementation/g1/heapRegionSet.cpp
+++ b/hotspot/src/share/vm/gc_implementation/g1/heapRegionSet.cpp
@@ -261,6 +261,45 @@ void HeapRegionLinkedList::fill_in_ext_msg_extra(hrs_ext_msg* msg) {
msg->append(" hd: "PTR_FORMAT" tl: "PTR_FORMAT, head(), tail());
}
+void HeapRegionLinkedList::add_as_head(HeapRegionLinkedList* from_list) {
+ hrs_assert_mt_safety_ok(this);
+ hrs_assert_mt_safety_ok(from_list);
+
+ verify_optional();
+ from_list->verify_optional();
+
+ if (from_list->is_empty()) return;
+
+#ifdef ASSERT
+ HeapRegionLinkedListIterator iter(from_list);
+ while (iter.more_available()) {
+ HeapRegion* hr = iter.get_next();
+ // In set_containing_set() we check that we either set the value
+ // from NULL to non-NULL or vice versa to catch bugs. So, we have
+ // to NULL it first before setting it to the value.
+ hr->set_containing_set(NULL);
+ hr->set_containing_set(this);
+ }
+#endif // ASSERT
+
+ if (_head != NULL) {
+ assert(length() > 0 && _tail != NULL, hrs_ext_msg(this, "invariant"));
+ from_list->_tail->set_next(_head);
+ } else {
+ assert(length() == 0 && _head == NULL, hrs_ext_msg(this, "invariant"));
+ _tail = from_list->_tail;
+ }
+ _head = from_list->_head;
+
+ _length += from_list->length();
+ _region_num += from_list->region_num();
+ _total_used_bytes += from_list->total_used_bytes();
+ from_list->clear();
+
+ verify_optional();
+ from_list->verify_optional();
+}
+
void HeapRegionLinkedList::add_as_tail(HeapRegionLinkedList* from_list) {
hrs_assert_mt_safety_ok(this);
hrs_assert_mt_safety_ok(from_list);
diff --git a/hotspot/src/share/vm/gc_implementation/g1/heapRegionSet.hpp b/hotspot/src/share/vm/gc_implementation/g1/heapRegionSet.hpp
index 5d53068ca88..ffb106f7946 100644
--- a/hotspot/src/share/vm/gc_implementation/g1/heapRegionSet.hpp
+++ b/hotspot/src/share/vm/gc_implementation/g1/heapRegionSet.hpp
@@ -277,6 +277,10 @@ protected:
}
public:
+ // It adds hr to the list as the new head. The region should not be
+ // a member of another set.
+ inline void add_as_head(HeapRegion* hr);
+
// It adds hr to the list as the new tail. The region should not be
// a member of another set.
inline void add_as_tail(HeapRegion* hr);
@@ -288,6 +292,11 @@ public:
// Convenience method.
inline HeapRegion* remove_head_or_null();
+ // It moves the regions from from_list to this list and empties
+ // from_list. The new regions will appear in the same order as they
+ // were in from_list and be linked in the beginning of this list.
+ void add_as_head(HeapRegionLinkedList* from_list);
+
// It moves the regions from from_list to this list and empties
// from_list. The new regions will appear in the same order as they
// were in from_list and be linked in the end of this list.
diff --git a/hotspot/src/share/vm/gc_implementation/g1/heapRegionSet.inline.hpp b/hotspot/src/share/vm/gc_implementation/g1/heapRegionSet.inline.hpp
index 501f5a7aef8..cd2fc29fb9c 100644
--- a/hotspot/src/share/vm/gc_implementation/g1/heapRegionSet.inline.hpp
+++ b/hotspot/src/share/vm/gc_implementation/g1/heapRegionSet.inline.hpp
@@ -110,6 +110,23 @@ inline void HeapRegionSet::remove_with_proxy(HeapRegion* hr,
//////////////////// HeapRegionLinkedList ////////////////////
+inline void HeapRegionLinkedList::add_as_head(HeapRegion* hr) {
+ hrs_assert_mt_safety_ok(this);
+ assert((length() == 0 && _head == NULL && _tail == NULL) ||
+ (length() > 0 && _head != NULL && _tail != NULL),
+ hrs_ext_msg(this, "invariant"));
+ // add_internal() will verify the region.
+ add_internal(hr);
+
+ // Now link the region.
+ if (_head != NULL) {
+ hr->set_next(_head);
+ } else {
+ _tail = hr;
+ }
+ _head = hr;
+}
+
inline void HeapRegionLinkedList::add_as_tail(HeapRegion* hr) {
hrs_assert_mt_safety_ok(this);
assert((length() == 0 && _head == NULL && _tail == NULL) ||
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 aaf44b02d3f..d9b41613444 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
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2001, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 2011, 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
diff --git a/hotspot/src/share/vm/gc_implementation/parallelScavenge/pcTasks.cpp b/hotspot/src/share/vm/gc_implementation/parallelScavenge/pcTasks.cpp
index b081ad09f4d..c7a651f03fe 100644
--- a/hotspot/src/share/vm/gc_implementation/parallelScavenge/pcTasks.cpp
+++ b/hotspot/src/share/vm/gc_implementation/parallelScavenge/pcTasks.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2011, 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
diff --git a/hotspot/src/share/vm/gc_implementation/parallelScavenge/pcTasks.hpp b/hotspot/src/share/vm/gc_implementation/parallelScavenge/pcTasks.hpp
index 2a35caccdf1..4c8b1159526 100644
--- a/hotspot/src/share/vm/gc_implementation/parallelScavenge/pcTasks.hpp
+++ b/hotspot/src/share/vm/gc_implementation/parallelScavenge/pcTasks.hpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2011, 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
diff --git a/hotspot/src/share/vm/gc_implementation/parallelScavenge/psPromotionManager.cpp b/hotspot/src/share/vm/gc_implementation/parallelScavenge/psPromotionManager.cpp
index 39f7f6a3e12..ad58a90fcd8 100644
--- a/hotspot/src/share/vm/gc_implementation/parallelScavenge/psPromotionManager.cpp
+++ b/hotspot/src/share/vm/gc_implementation/parallelScavenge/psPromotionManager.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2002, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2002, 2011, 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
diff --git a/hotspot/src/share/vm/gc_implementation/parallelScavenge/psScavenge.inline.hpp b/hotspot/src/share/vm/gc_implementation/parallelScavenge/psScavenge.inline.hpp
index 1848a1db281..880f0678904 100644
--- a/hotspot/src/share/vm/gc_implementation/parallelScavenge/psScavenge.inline.hpp
+++ b/hotspot/src/share/vm/gc_implementation/parallelScavenge/psScavenge.inline.hpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2002, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2002, 2011, 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
diff --git a/hotspot/src/share/vm/gc_implementation/parallelScavenge/psTasks.cpp b/hotspot/src/share/vm/gc_implementation/parallelScavenge/psTasks.cpp
index de44096c1f3..c297477fd60 100644
--- a/hotspot/src/share/vm/gc_implementation/parallelScavenge/psTasks.cpp
+++ b/hotspot/src/share/vm/gc_implementation/parallelScavenge/psTasks.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2002, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2002, 2011, 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
diff --git a/hotspot/src/share/vm/gc_implementation/shared/allocationStats.hpp b/hotspot/src/share/vm/gc_implementation/shared/allocationStats.hpp
index 4e089c14cde..104ff1954fe 100644
--- a/hotspot/src/share/vm/gc_implementation/shared/allocationStats.hpp
+++ b/hotspot/src/share/vm/gc_implementation/shared/allocationStats.hpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2001, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 2011, 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
diff --git a/hotspot/src/share/vm/gc_implementation/shared/concurrentGCThread.cpp b/hotspot/src/share/vm/gc_implementation/shared/concurrentGCThread.cpp
index c16ec595cef..262d35065d2 100644
--- a/hotspot/src/share/vm/gc_implementation/shared/concurrentGCThread.cpp
+++ b/hotspot/src/share/vm/gc_implementation/shared/concurrentGCThread.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2001, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 2011, 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
diff --git a/hotspot/src/share/vm/gc_implementation/shared/gcUtil.cpp b/hotspot/src/share/vm/gc_implementation/shared/gcUtil.cpp
index caa6efed1c8..5325fee218b 100644
--- a/hotspot/src/share/vm/gc_implementation/shared/gcUtil.cpp
+++ b/hotspot/src/share/vm/gc_implementation/shared/gcUtil.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2002, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2002, 2011, 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
diff --git a/hotspot/src/share/vm/gc_implementation/shared/markSweep.cpp b/hotspot/src/share/vm/gc_implementation/shared/markSweep.cpp
index 3ddcda650dd..584c24c821a 100644
--- a/hotspot/src/share/vm/gc_implementation/shared/markSweep.cpp
+++ b/hotspot/src/share/vm/gc_implementation/shared/markSweep.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2011, 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
diff --git a/hotspot/src/share/vm/gc_interface/collectedHeap.cpp b/hotspot/src/share/vm/gc_interface/collectedHeap.cpp
index 6ffd07c97cb..6b99a8f6298 100644
--- a/hotspot/src/share/vm/gc_interface/collectedHeap.cpp
+++ b/hotspot/src/share/vm/gc_interface/collectedHeap.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2001, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 2011, 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
diff --git a/hotspot/src/share/vm/interpreter/bytecodeInterpreter.cpp b/hotspot/src/share/vm/interpreter/bytecodeInterpreter.cpp
index 6713e014387..2826809f5b0 100644
--- a/hotspot/src/share/vm/interpreter/bytecodeInterpreter.cpp
+++ b/hotspot/src/share/vm/interpreter/bytecodeInterpreter.cpp
@@ -568,7 +568,7 @@ BytecodeInterpreter::run(interpreterState istate) {
/* 0xDC */ &&opc_default, &&opc_default, &&opc_default, &&opc_default,
/* 0xE0 */ &&opc_default, &&opc_default, &&opc_default, &&opc_default,
-/* 0xE4 */ &&opc_default, &&opc_return_register_finalizer, &&opc_default, &&opc_default,
+/* 0xE4 */ &&opc_default, &&opc_default, &&opc_default, &&opc_return_register_finalizer,
/* 0xE8 */ &&opc_default, &&opc_default, &&opc_default, &&opc_default,
/* 0xEC */ &&opc_default, &&opc_default, &&opc_default, &&opc_default,
@@ -2383,17 +2383,6 @@ run:
}
DEFAULT:
-#ifdef ZERO
- // Some zero configurations use the C++ interpreter as a
- // fallback interpreter and have support for platform
- // specific fast bytecodes which aren't supported here, so
- // redispatch to the equivalent non-fast bytecode when they
- // are encountered.
- if (Bytecodes::is_defined((Bytecodes::Code)opcode)) {
- opcode = (jubyte)Bytecodes::java_code((Bytecodes::Code)opcode);
- goto opcode_switch;
- }
-#endif
fatal(err_msg("Unimplemented opcode %d = %s", opcode,
Bytecodes::name((Bytecodes::Code)opcode)));
goto finish;
diff --git a/hotspot/src/share/vm/interpreter/bytecodeInterpreter.hpp b/hotspot/src/share/vm/interpreter/bytecodeInterpreter.hpp
index 1f59ee47ceb..599fd188cb4 100644
--- a/hotspot/src/share/vm/interpreter/bytecodeInterpreter.hpp
+++ b/hotspot/src/share/vm/interpreter/bytecodeInterpreter.hpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2002, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2002, 2011, 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
diff --git a/hotspot/src/share/vm/interpreter/bytecodeInterpreter.inline.hpp b/hotspot/src/share/vm/interpreter/bytecodeInterpreter.inline.hpp
index c0dc4b61b40..3715a521204 100644
--- a/hotspot/src/share/vm/interpreter/bytecodeInterpreter.inline.hpp
+++ b/hotspot/src/share/vm/interpreter/bytecodeInterpreter.inline.hpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2002, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2002, 2011, 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
diff --git a/hotspot/src/share/vm/interpreter/bytecodeTracer.cpp b/hotspot/src/share/vm/interpreter/bytecodeTracer.cpp
index ff28656b3cd..1309d0cf9a2 100644
--- a/hotspot/src/share/vm/interpreter/bytecodeTracer.cpp
+++ b/hotspot/src/share/vm/interpreter/bytecodeTracer.cpp
@@ -345,7 +345,6 @@ void BytecodePrinter::print_field_or_method(int orig_i, int i, outputStream* st)
break;
case JVM_CONSTANT_NameAndType:
case JVM_CONSTANT_InvokeDynamic:
- case JVM_CONSTANT_InvokeDynamicTrans:
has_klass = false;
break;
default:
diff --git a/hotspot/src/share/vm/interpreter/cppInterpreter.hpp b/hotspot/src/share/vm/interpreter/cppInterpreter.hpp
index 45d7921c07f..4997a443257 100644
--- a/hotspot/src/share/vm/interpreter/cppInterpreter.hpp
+++ b/hotspot/src/share/vm/interpreter/cppInterpreter.hpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2011, 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
diff --git a/hotspot/src/share/vm/interpreter/cppInterpreterGenerator.hpp b/hotspot/src/share/vm/interpreter/cppInterpreterGenerator.hpp
index b324f953e30..c27805e3ec9 100644
--- a/hotspot/src/share/vm/interpreter/cppInterpreterGenerator.hpp
+++ b/hotspot/src/share/vm/interpreter/cppInterpreterGenerator.hpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2011, 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
diff --git a/hotspot/src/share/vm/interpreter/interpreter.hpp b/hotspot/src/share/vm/interpreter/interpreter.hpp
index 698a2edcd8f..0ab0be74770 100644
--- a/hotspot/src/share/vm/interpreter/interpreter.hpp
+++ b/hotspot/src/share/vm/interpreter/interpreter.hpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2011, 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
diff --git a/hotspot/src/share/vm/interpreter/interpreterGenerator.hpp b/hotspot/src/share/vm/interpreter/interpreterGenerator.hpp
index 1a228e20795..7bc43eccb21 100644
--- a/hotspot/src/share/vm/interpreter/interpreterGenerator.hpp
+++ b/hotspot/src/share/vm/interpreter/interpreterGenerator.hpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2011, 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
diff --git a/hotspot/src/share/vm/interpreter/interpreterRuntime.cpp b/hotspot/src/share/vm/interpreter/interpreterRuntime.cpp
index 66cb27edf1f..499a66046a8 100644
--- a/hotspot/src/share/vm/interpreter/interpreterRuntime.cpp
+++ b/hotspot/src/share/vm/interpreter/interpreterRuntime.cpp
@@ -369,10 +369,7 @@ IRT_ENTRY(void, InterpreterRuntime::throw_WrongMethodTypeException(JavaThread* t
}
// create exception
- Symbol* java_lang_invoke_WrongMethodTypeException = vmSymbols::java_lang_invoke_WrongMethodTypeException();
- if (AllowTransitionalJSR292)
- java_lang_invoke_WrongMethodTypeException = SystemDictionaryHandles::WrongMethodTypeException_klass()->name();
- THROW_MSG(java_lang_invoke_WrongMethodTypeException, message);
+ THROW_MSG(vmSymbols::java_lang_invoke_WrongMethodTypeException(), message);
}
IRT_END
diff --git a/hotspot/src/share/vm/interpreter/linkResolver.cpp b/hotspot/src/share/vm/interpreter/linkResolver.cpp
index 4ed4ac17f11..ee61e5795cf 100644
--- a/hotspot/src/share/vm/interpreter/linkResolver.cpp
+++ b/hotspot/src/share/vm/interpreter/linkResolver.cpp
@@ -176,7 +176,7 @@ void LinkResolver::resolve_klass_no_update(KlassHandle& result, constantPoolHand
void LinkResolver::lookup_method_in_klasses(methodHandle& result, KlassHandle klass, Symbol* name, Symbol* signature, TRAPS) {
methodOop result_oop = klass->uncached_lookup_method(name, signature);
- if (EnableMethodHandles && result_oop != NULL) {
+ if (EnableInvokeDynamic && result_oop != NULL) {
switch (result_oop->intrinsic_id()) {
case vmIntrinsics::_invokeExact:
case vmIntrinsics::_invokeGeneric:
@@ -214,16 +214,14 @@ void LinkResolver::lookup_implicit_method(methodHandle& result,
KlassHandle klass, Symbol* name, Symbol* signature,
KlassHandle current_klass,
TRAPS) {
- if (EnableMethodHandles &&
+ if (EnableInvokeDynamic &&
klass() == SystemDictionary::MethodHandle_klass() &&
methodOopDesc::is_method_handle_invoke_name(name)) {
if (!THREAD->is_Compiler_thread() && !MethodHandles::enabled()) {
// Make sure the Java part of the runtime has been booted up.
klassOop natives = SystemDictionary::MethodHandleNatives_klass();
if (natives == NULL || instanceKlass::cast(natives)->is_not_initialized()) {
- Symbol* natives_name = vmSymbols::java_lang_invoke_MethodHandleNatives();
- if (natives != NULL && AllowTransitionalJSR292) natives_name = Klass::cast(natives)->name();
- SystemDictionary::resolve_or_fail(natives_name,
+ SystemDictionary::resolve_or_fail(vmSymbols::java_lang_invoke_MethodHandleNatives(),
Handle(),
Handle(),
true,
diff --git a/hotspot/src/share/vm/interpreter/linkResolver.hpp b/hotspot/src/share/vm/interpreter/linkResolver.hpp
index 9d2bd57965d..3d4c6f40e2a 100644
--- a/hotspot/src/share/vm/interpreter/linkResolver.hpp
+++ b/hotspot/src/share/vm/interpreter/linkResolver.hpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2011, 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
diff --git a/hotspot/src/share/vm/interpreter/rewriter.cpp b/hotspot/src/share/vm/interpreter/rewriter.cpp
index 3bdebda0941..5be2df24baa 100644
--- a/hotspot/src/share/vm/interpreter/rewriter.cpp
+++ b/hotspot/src/share/vm/interpreter/rewriter.cpp
@@ -52,7 +52,6 @@ void Rewriter::compute_index_maps() {
case JVM_CONSTANT_MethodHandle : // fall through
case JVM_CONSTANT_MethodType : // fall through
case JVM_CONSTANT_InvokeDynamic : // fall through
- case JVM_CONSTANT_InvokeDynamicTrans: // fall through
add_cp_cache_entry(i);
break;
}
@@ -62,7 +61,6 @@ void Rewriter::compute_index_maps() {
"all cp cache indexes fit in a u2");
_have_invoke_dynamic = ((tag_mask & (1 << JVM_CONSTANT_InvokeDynamic)) != 0);
- _have_invoke_dynamic |= ((tag_mask & (1 << JVM_CONSTANT_InvokeDynamicTrans)) != 0);
}
@@ -81,16 +79,10 @@ void Rewriter::make_constant_pool_cache(TRAPS) {
if (pool_index >= 0 &&
_pool->tag_at(pool_index).is_invoke_dynamic()) {
int bsm_index = _pool->invoke_dynamic_bootstrap_method_ref_index_at(pool_index);
- if (bsm_index != 0) {
- assert(_pool->tag_at(bsm_index).is_method_handle(), "must be a MH constant");
- // There is a CP cache entry holding the BSM for these calls.
- int bsm_cache_index = cp_entry_to_cp_cache(bsm_index);
- cache->entry_at(i)->initialize_bootstrap_method_index_in_cache(bsm_cache_index);
- } else {
- // There is no CP cache entry holding the BSM for these calls.
- // We will need to look for a class-global BSM, later.
- guarantee(AllowTransitionalJSR292, "");
- }
+ assert(_pool->tag_at(bsm_index).is_method_handle(), "must be a MH constant");
+ // There is a CP cache entry holding the BSM for these calls.
+ int bsm_cache_index = cp_entry_to_cp_cache(bsm_index);
+ cache->entry_at(i)->initialize_bootstrap_method_index_in_cache(bsm_cache_index);
}
}
}
diff --git a/hotspot/src/share/vm/interpreter/templateInterpreter.hpp b/hotspot/src/share/vm/interpreter/templateInterpreter.hpp
index 40717ec5677..4db0a419ca8 100644
--- a/hotspot/src/share/vm/interpreter/templateInterpreter.hpp
+++ b/hotspot/src/share/vm/interpreter/templateInterpreter.hpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2011, 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
diff --git a/hotspot/src/share/vm/interpreter/templateInterpreterGenerator.hpp b/hotspot/src/share/vm/interpreter/templateInterpreterGenerator.hpp
index dc63589ed42..3e1615e7a22 100644
--- a/hotspot/src/share/vm/interpreter/templateInterpreterGenerator.hpp
+++ b/hotspot/src/share/vm/interpreter/templateInterpreterGenerator.hpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2011, 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
diff --git a/hotspot/src/share/vm/interpreter/templateTable.hpp b/hotspot/src/share/vm/interpreter/templateTable.hpp
index d38623247e4..f91ecc70213 100644
--- a/hotspot/src/share/vm/interpreter/templateTable.hpp
+++ b/hotspot/src/share/vm/interpreter/templateTable.hpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2011, 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
diff --git a/hotspot/src/share/vm/memory/barrierSet.cpp b/hotspot/src/share/vm/memory/barrierSet.cpp
index 1209764d452..8cd966f5fc9 100644
--- a/hotspot/src/share/vm/memory/barrierSet.cpp
+++ b/hotspot/src/share/vm/memory/barrierSet.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2011, 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
diff --git a/hotspot/src/share/vm/memory/cardTableModRefBS.hpp b/hotspot/src/share/vm/memory/cardTableModRefBS.hpp
index da1166ae718..34a924ef36e 100644
--- a/hotspot/src/share/vm/memory/cardTableModRefBS.hpp
+++ b/hotspot/src/share/vm/memory/cardTableModRefBS.hpp
@@ -382,6 +382,11 @@ public:
return (addr_for(pcard) == p);
}
+ HeapWord* align_to_card_boundary(HeapWord* p) {
+ jbyte* pcard = byte_for(p + card_size_in_words - 1);
+ return addr_for(pcard);
+ }
+
// The kinds of precision a CardTableModRefBS may offer.
enum PrecisionStyle {
Precise,
diff --git a/hotspot/src/share/vm/memory/cardTableRS.cpp b/hotspot/src/share/vm/memory/cardTableRS.cpp
index afc166615ab..dcaa7c682f5 100644
--- a/hotspot/src/share/vm/memory/cardTableRS.cpp
+++ b/hotspot/src/share/vm/memory/cardTableRS.cpp
@@ -318,17 +318,28 @@ private:
protected:
template void do_oop_work(T* p) {
HeapWord* jp = (HeapWord*)p;
- if (jp >= _begin && jp < _end) {
- oop obj = oopDesc::load_decode_heap_oop(p);
- guarantee(obj == NULL ||
- (HeapWord*)p < _boundary ||
- (HeapWord*)obj >= _boundary,
- "pointer on clean card crosses boundary");
- }
+ assert(jp >= _begin && jp < _end,
+ err_msg("Error: jp " PTR_FORMAT " should be within "
+ "[_begin, _end) = [" PTR_FORMAT "," PTR_FORMAT ")",
+ _begin, _end));
+ oop obj = oopDesc::load_decode_heap_oop(p);
+ guarantee(obj == NULL || (HeapWord*)obj >= _boundary,
+ err_msg("pointer " PTR_FORMAT " at " PTR_FORMAT " on "
+ "clean card crosses boundary" PTR_FORMAT,
+ (HeapWord*)obj, jp, _boundary));
}
+
public:
VerifyCleanCardClosure(HeapWord* b, HeapWord* begin, HeapWord* end) :
- _boundary(b), _begin(begin), _end(end) {}
+ _boundary(b), _begin(begin), _end(end) {
+ assert(b <= begin,
+ err_msg("Error: boundary " PTR_FORMAT " should be at or below begin " PTR_FORMAT,
+ b, begin));
+ assert(begin <= end,
+ err_msg("Error: begin " PTR_FORMAT " should be strictly below end " PTR_FORMAT,
+ begin, end));
+ }
+
virtual void do_oop(oop* p) { VerifyCleanCardClosure::do_oop_work(p); }
virtual void do_oop(narrowOop* p) { VerifyCleanCardClosure::do_oop_work(p); }
};
@@ -392,13 +403,14 @@ void CardTableRS::verify_space(Space* s, HeapWord* gen_boundary) {
}
}
// Now traverse objects until end.
- HeapWord* cur = start_block;
- VerifyCleanCardClosure verify_blk(gen_boundary, begin, end);
- while (cur < end) {
- if (s->block_is_obj(cur) && s->obj_is_alive(cur)) {
- oop(cur)->oop_iterate(&verify_blk);
+ if (begin < end) {
+ MemRegion mr(begin, end);
+ VerifyCleanCardClosure verify_blk(gen_boundary, begin, end);
+ for (HeapWord* cur = start_block; cur < end; cur += s->block_size(cur)) {
+ if (s->block_is_obj(cur) && s->obj_is_alive(cur)) {
+ oop(cur)->oop_iterate(&verify_blk, mr);
+ }
}
- cur += s->block_size(cur);
}
cur_entry = first_dirty;
} else {
diff --git a/hotspot/src/share/vm/memory/classify.cpp b/hotspot/src/share/vm/memory/classify.cpp
index afd534d3194..c7beddeef03 100644
--- a/hotspot/src/share/vm/memory/classify.cpp
+++ b/hotspot/src/share/vm/memory/classify.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2011, 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
diff --git a/hotspot/src/share/vm/memory/compactingPermGenGen.cpp b/hotspot/src/share/vm/memory/compactingPermGenGen.cpp
index a57994c0f0d..3754628b852 100644
--- a/hotspot/src/share/vm/memory/compactingPermGenGen.cpp
+++ b/hotspot/src/share/vm/memory/compactingPermGenGen.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2011, 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
diff --git a/hotspot/src/share/vm/memory/dump.cpp b/hotspot/src/share/vm/memory/dump.cpp
index 3e34118fc91..1c88bb70fd8 100644
--- a/hotspot/src/share/vm/memory/dump.cpp
+++ b/hotspot/src/share/vm/memory/dump.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2011, 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,16 +80,7 @@ public:
oop obj = *p;
if (obj->klass() == SystemDictionary::String_klass()) {
- int hash;
- typeArrayOop value = java_lang_String::value(obj);
- int length = java_lang_String::length(obj);
- if (length == 0) {
- hash = 0;
- } else {
- int offset = java_lang_String::offset(obj);
- jchar* s = value->char_at_addr(offset);
- hash = StringTable::hash_string(s, length);
- }
+ int hash = java_lang_String::hash_string(obj);
obj->int_field_put(hash_offset, hash);
}
}
diff --git a/hotspot/src/share/vm/memory/genCollectedHeap.cpp b/hotspot/src/share/vm/memory/genCollectedHeap.cpp
index 84551154a7d..2165c21dfa7 100644
--- a/hotspot/src/share/vm/memory/genCollectedHeap.cpp
+++ b/hotspot/src/share/vm/memory/genCollectedHeap.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2011, 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
diff --git a/hotspot/src/share/vm/memory/genMarkSweep.cpp b/hotspot/src/share/vm/memory/genMarkSweep.cpp
index 8d67a7988b1..802c646e1d9 100644
--- a/hotspot/src/share/vm/memory/genMarkSweep.cpp
+++ b/hotspot/src/share/vm/memory/genMarkSweep.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2001, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 2011, 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
diff --git a/hotspot/src/share/vm/memory/heap.cpp b/hotspot/src/share/vm/memory/heap.cpp
index 2d46b611241..dcf1e41e0e4 100644
--- a/hotspot/src/share/vm/memory/heap.cpp
+++ b/hotspot/src/share/vm/memory/heap.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2011, 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
diff --git a/hotspot/src/share/vm/memory/heapInspection.cpp b/hotspot/src/share/vm/memory/heapInspection.cpp
index 545a580c6cf..1042ff43b94 100644
--- a/hotspot/src/share/vm/memory/heapInspection.cpp
+++ b/hotspot/src/share/vm/memory/heapInspection.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2002, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2002, 2011, 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
diff --git a/hotspot/src/share/vm/memory/iterator.hpp b/hotspot/src/share/vm/memory/iterator.hpp
index ca36ab4dee9..b5f8e0ef639 100644
--- a/hotspot/src/share/vm/memory/iterator.hpp
+++ b/hotspot/src/share/vm/memory/iterator.hpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2011, 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
diff --git a/hotspot/src/share/vm/memory/restore.cpp b/hotspot/src/share/vm/memory/restore.cpp
index db7f9e9eb84..263867e6fff 100644
--- a/hotspot/src/share/vm/memory/restore.cpp
+++ b/hotspot/src/share/vm/memory/restore.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2011, 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
diff --git a/hotspot/src/share/vm/memory/serialize.cpp b/hotspot/src/share/vm/memory/serialize.cpp
index 629620c8357..65f05bdf846 100644
--- a/hotspot/src/share/vm/memory/serialize.cpp
+++ b/hotspot/src/share/vm/memory/serialize.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2011, 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
diff --git a/hotspot/src/share/vm/memory/sharedHeap.cpp b/hotspot/src/share/vm/memory/sharedHeap.cpp
index c346995f71b..37c17b03861 100644
--- a/hotspot/src/share/vm/memory/sharedHeap.cpp
+++ b/hotspot/src/share/vm/memory/sharedHeap.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2011, 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
diff --git a/hotspot/src/share/vm/memory/space.cpp b/hotspot/src/share/vm/memory/space.cpp
index 65afc7b4a14..1971332cd06 100644
--- a/hotspot/src/share/vm/memory/space.cpp
+++ b/hotspot/src/share/vm/memory/space.cpp
@@ -818,9 +818,14 @@ size_t ContiguousSpace::block_size(const HeapWord* p) const {
// This version requires locking.
inline HeapWord* ContiguousSpace::allocate_impl(size_t size,
HeapWord* const end_value) {
+ // In G1 there are places where a GC worker can allocates into a
+ // region using this serial allocation code without being prone to a
+ // race with other GC workers (we ensure that no other GC worker can
+ // access the same region at the same time). So the assert below is
+ // too strong in the case of G1.
assert(Heap_lock->owned_by_self() ||
(SafepointSynchronize::is_at_safepoint() &&
- Thread::current()->is_VM_thread()),
+ (Thread::current()->is_VM_thread() || UseG1GC)),
"not locked");
HeapWord* obj = top();
if (pointer_delta(end_value, obj) >= size) {
diff --git a/hotspot/src/share/vm/memory/universe.hpp b/hotspot/src/share/vm/memory/universe.hpp
index df2b15b4223..86682682ffb 100644
--- a/hotspot/src/share/vm/memory/universe.hpp
+++ b/hotspot/src/share/vm/memory/universe.hpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2011, 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
diff --git a/hotspot/src/share/vm/oops/arrayKlass.cpp b/hotspot/src/share/vm/oops/arrayKlass.cpp
index b17a30570a7..5693f8eb869 100644
--- a/hotspot/src/share/vm/oops/arrayKlass.cpp
+++ b/hotspot/src/share/vm/oops/arrayKlass.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2011, 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
diff --git a/hotspot/src/share/vm/oops/arrayOop.cpp b/hotspot/src/share/vm/oops/arrayOop.cpp
index 896b7bff5e5..62a971a6182 100644
--- a/hotspot/src/share/vm/oops/arrayOop.cpp
+++ b/hotspot/src/share/vm/oops/arrayOop.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2011, 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
diff --git a/hotspot/src/share/vm/oops/constantPoolKlass.cpp b/hotspot/src/share/vm/oops/constantPoolKlass.cpp
index 367530717d6..627a2017ebe 100644
--- a/hotspot/src/share/vm/oops/constantPoolKlass.cpp
+++ b/hotspot/src/share/vm/oops/constantPoolKlass.cpp
@@ -245,13 +245,13 @@ int constantPoolKlass::oop_oop_iterate_m(oop obj, OopClosure* blk, MemRegion mr)
}
oop* addr;
addr = cp->tags_addr();
- blk->do_oop(addr);
+ if (mr.contains(addr)) blk->do_oop(addr);
addr = cp->cache_addr();
- blk->do_oop(addr);
+ if (mr.contains(addr)) blk->do_oop(addr);
addr = cp->operands_addr();
- blk->do_oop(addr);
+ if (mr.contains(addr)) blk->do_oop(addr);
addr = cp->pool_holder_addr();
- blk->do_oop(addr);
+ if (mr.contains(addr)) blk->do_oop(addr);
return size;
}
@@ -286,7 +286,7 @@ void constantPoolKlass::oop_push_contents(PSPromotionManager* pm, oop obj) {
assert(obj->is_constantPool(), "should be constant pool");
constantPoolOop cp = (constantPoolOop) obj;
if (cp->tags() != NULL &&
- (!JavaObjectsInPerm || (AnonymousClasses && cp->has_pseudo_string()))) {
+ (!JavaObjectsInPerm || (EnableInvokeDynamic && cp->has_pseudo_string()))) {
for (int i = 1; i < cp->length(); ++i) {
if (cp->tag_at(i).is_string()) {
oop* base = cp->obj_at_addr_raw(i);
@@ -381,7 +381,6 @@ void constantPoolKlass::oop_print_on(oop obj, outputStream* st) {
case JVM_CONSTANT_MethodType :
st->print("signature_index=%d", cp->method_type_index_at(index));
break;
- case JVM_CONSTANT_InvokeDynamicTrans :
case JVM_CONSTANT_InvokeDynamic :
{
st->print("bootstrap_method_index=%d", cp->invoke_dynamic_bootstrap_method_ref_index_at(index));
diff --git a/hotspot/src/share/vm/oops/constantPoolOop.cpp b/hotspot/src/share/vm/oops/constantPoolOop.cpp
index 91ab822d096..00aa94f20bd 100644
--- a/hotspot/src/share/vm/oops/constantPoolOop.cpp
+++ b/hotspot/src/share/vm/oops/constantPoolOop.cpp
@@ -284,17 +284,13 @@ int constantPoolOopDesc::impl_name_and_type_ref_index_at(int which, bool uncache
if (constantPoolCacheOopDesc::is_secondary_index(which)) {
// Invokedynamic index.
int pool_index = cache()->main_entry_at(which)->constant_pool_index();
- if (!AllowTransitionalJSR292 || tag_at(pool_index).is_invoke_dynamic())
- pool_index = invoke_dynamic_name_and_type_ref_index_at(pool_index);
+ pool_index = invoke_dynamic_name_and_type_ref_index_at(pool_index);
assert(tag_at(pool_index).is_name_and_type(), "");
return pool_index;
}
// change byte-ordering and go via cache
i = remap_instruction_operand_from_cache(which);
} else {
- if (AllowTransitionalJSR292 && tag_at(which).is_name_and_type())
- // invokedynamic index is a simple name-and-type
- return which;
if (tag_at(which).is_invoke_dynamic()) {
int pool_index = invoke_dynamic_name_and_type_ref_index_at(which);
assert(tag_at(pool_index).is_name_and_type(), "");
@@ -953,7 +949,6 @@ bool constantPoolOopDesc::compare_entry_to(int index1, constantPoolHandle cp2,
} break;
case JVM_CONSTANT_InvokeDynamic:
- case JVM_CONSTANT_InvokeDynamicTrans:
{
int k1 = invoke_dynamic_bootstrap_method_ref_index_at(index1);
int k2 = cp2->invoke_dynamic_bootstrap_method_ref_index_at(index2);
@@ -1227,13 +1222,6 @@ void constantPoolOopDesc::copy_entry_to(constantPoolHandle from_cp, int from_i,
to_cp->method_handle_index_at_put(to_i, k1, k2);
} break;
- case JVM_CONSTANT_InvokeDynamicTrans:
- {
- int k1 = from_cp->invoke_dynamic_bootstrap_method_ref_index_at(from_i);
- int k2 = from_cp->invoke_dynamic_name_and_type_ref_index_at(from_i);
- to_cp->invoke_dynamic_trans_at_put(to_i, k1, k2);
- } break;
-
case JVM_CONSTANT_InvokeDynamic:
{
int k1 = from_cp->invoke_dynamic_bootstrap_specifier_index(from_i);
@@ -1459,7 +1447,6 @@ jint constantPoolOopDesc::cpool_entry_size(jint idx) {
return 5;
case JVM_CONSTANT_InvokeDynamic:
- case JVM_CONSTANT_InvokeDynamicTrans:
// u1 tag, u2 bsm, u2 nt
return 5;
@@ -1674,7 +1661,6 @@ int constantPoolOopDesc::copy_cpool_bytes(int cpool_size,
DBG(printf("JVM_CONSTANT_MethodType: %hd", idx1));
break;
}
- case JVM_CONSTANT_InvokeDynamicTrans:
case JVM_CONSTANT_InvokeDynamic: {
*bytes = tag;
idx1 = extract_low_short_from_int(*int_at_addr(idx));
diff --git a/hotspot/src/share/vm/oops/constantPoolOop.hpp b/hotspot/src/share/vm/oops/constantPoolOop.hpp
index fa482a5c4da..d8dd7844d6e 100644
--- a/hotspot/src/share/vm/oops/constantPoolOop.hpp
+++ b/hotspot/src/share/vm/oops/constantPoolOop.hpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2011, 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
@@ -244,12 +244,6 @@ class constantPoolOopDesc : public oopDesc {
*int_at_addr(which) = ((jint) name_and_type_index<<16) | bootstrap_specifier_index;
}
- void invoke_dynamic_trans_at_put(int which, int bootstrap_method_index, int name_and_type_index) {
- tag_at_put(which, JVM_CONSTANT_InvokeDynamicTrans);
- *int_at_addr(which) = ((jint) name_and_type_index<<16) | bootstrap_method_index;
- assert(AllowTransitionalJSR292, "");
- }
-
// Temporary until actual use
void unresolved_string_at_put(int which, Symbol* s) {
release_tag_at_put(which, JVM_CONSTANT_UnresolvedString);
@@ -429,7 +423,7 @@ class constantPoolOopDesc : public oopDesc {
// A "pseudo-string" is an non-string oop that has found is way into
// a String entry.
- // Under AnonymousClasses this can happen if the user patches a live
+ // Under EnableInvokeDynamic this can happen if the user patches a live
// object into a CONSTANT_String entry of an anonymous class.
// Method oops internally created for method handles may also
// use pseudo-strings to link themselves to related metaobjects.
@@ -442,7 +436,7 @@ class constantPoolOopDesc : public oopDesc {
}
void pseudo_string_at_put(int which, oop x) {
- assert(AnonymousClasses, "");
+ assert(EnableInvokeDynamic, "");
set_pseudo_string(); // mark header
assert(tag_at(which).is_string() || tag_at(which).is_unresolved_string(), "Corrupted constant pool");
string_at_put(which, x); // this works just fine
@@ -570,15 +564,11 @@ class constantPoolOopDesc : public oopDesc {
};
int invoke_dynamic_bootstrap_method_ref_index_at(int which) {
assert(tag_at(which).is_invoke_dynamic(), "Corrupted constant pool");
- if (tag_at(which).value() == JVM_CONSTANT_InvokeDynamicTrans)
- return extract_low_short_from_int(*int_at_addr(which));
int op_base = invoke_dynamic_operand_base(which);
return operands()->short_at(op_base + _indy_bsm_offset);
}
int invoke_dynamic_argument_count_at(int which) {
assert(tag_at(which).is_invoke_dynamic(), "Corrupted constant pool");
- if (tag_at(which).value() == JVM_CONSTANT_InvokeDynamicTrans)
- return 0;
int op_base = invoke_dynamic_operand_base(which);
int argc = operands()->short_at(op_base + _indy_argc_offset);
DEBUG_ONLY(int end_offset = op_base + _indy_argv_offset + argc;
diff --git a/hotspot/src/share/vm/oops/cpCacheKlass.hpp b/hotspot/src/share/vm/oops/cpCacheKlass.hpp
index 4a1532cffef..9a784fd21a7 100644
--- a/hotspot/src/share/vm/oops/cpCacheKlass.hpp
+++ b/hotspot/src/share/vm/oops/cpCacheKlass.hpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1998, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 2011, 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
diff --git a/hotspot/src/share/vm/oops/cpCacheOop.cpp b/hotspot/src/share/vm/oops/cpCacheOop.cpp
index 24855ce75cf..953ac789fee 100644
--- a/hotspot/src/share/vm/oops/cpCacheOop.cpp
+++ b/hotspot/src/share/vm/oops/cpCacheOop.cpp
@@ -185,7 +185,7 @@ void ConstantPoolCacheEntry::set_method(Bytecodes::Code invoke_code,
this->print(tty, 0);
}
assert(method->can_be_statically_bound(), "must be a MH invoker method");
- assert(AllowTransitionalJSR292 || _f2 >= constantPoolOopDesc::CPCACHE_INDEX_TAG, "BSM index initialized");
+ assert(_f2 >= constantPoolOopDesc::CPCACHE_INDEX_TAG, "BSM index initialized");
// SystemDictionary::find_method_handle_invoke only caches
// methods which signature classes are on the boot classpath,
// otherwise the newly created method is returned. To avoid
diff --git a/hotspot/src/share/vm/oops/generateOopMap.hpp b/hotspot/src/share/vm/oops/generateOopMap.hpp
index 92437407d3c..a635e2abdee 100644
--- a/hotspot/src/share/vm/oops/generateOopMap.hpp
+++ b/hotspot/src/share/vm/oops/generateOopMap.hpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2011, 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
diff --git a/hotspot/src/share/vm/oops/instanceKlass.cpp b/hotspot/src/share/vm/oops/instanceKlass.cpp
index 840ae03d09e..a99ecd4114d 100644
--- a/hotspot/src/share/vm/oops/instanceKlass.cpp
+++ b/hotspot/src/share/vm/oops/instanceKlass.cpp
@@ -2337,7 +2337,7 @@ void instanceKlass::oop_print_on(oop obj, outputStream* st) {
st->print_cr(BULLET"fake entry for oop_size: %d", java_lang_Class::oop_size(obj));
st->print_cr(BULLET"fake entry for static_oop_field_count: %d", java_lang_Class::static_oop_field_count(obj));
klassOop real_klass = java_lang_Class::as_klassOop(obj);
- if (real_klass && real_klass->klass_part()->oop_is_instance()) {
+ if (real_klass != NULL && real_klass->klass_part()->oop_is_instance()) {
instanceKlass::cast(real_klass)->do_local_static_fields(&print_field);
}
} else if (as_klassOop() == SystemDictionary::MethodType_klass()) {
diff --git a/hotspot/src/share/vm/oops/instanceKlass.hpp b/hotspot/src/share/vm/oops/instanceKlass.hpp
index 07acfc358c0..e0d70ae6812 100644
--- a/hotspot/src/share/vm/oops/instanceKlass.hpp
+++ b/hotspot/src/share/vm/oops/instanceKlass.hpp
@@ -182,7 +182,7 @@ class instanceKlass: public Klass {
// Protection domain.
oop _protection_domain;
// Host class, which grants its access privileges to this class also.
- // This is only non-null for an anonymous class (AnonymousClasses enabled).
+ // This is only non-null for an anonymous class (JSR 292 enabled).
// The host class is either named, or a previously loaded anonymous class.
klassOop _host_klass;
// Class signers.
@@ -191,8 +191,6 @@ class instanceKlass: public Klass {
typeArrayOop _inner_classes;
// Implementors of this interface (not valid if it overflows)
klassOop _implementors[implementors_limit];
- // invokedynamic bootstrap method (a java.lang.invoke.MethodHandle)
- oop _bootstrap_method; // AllowTransitionalJSR292 ONLY
// Annotations for this class, or null if none.
typeArrayOop _class_annotations;
// Annotation objects (byte arrays) for fields, or null if no annotations.
@@ -526,10 +524,6 @@ class instanceKlass: public Klass {
u2 method_index) { _enclosing_method_class_index = class_index;
_enclosing_method_method_index = method_index; }
- // JSR 292 support
- oop bootstrap_method() const { return _bootstrap_method; } // AllowTransitionalJSR292 ONLY
- void set_bootstrap_method(oop mh) { oop_store(&_bootstrap_method, mh); }
-
// jmethodID support
static jmethodID get_jmethod_id(instanceKlassHandle ik_h,
methodHandle method_h);
@@ -793,7 +787,6 @@ private:
oop* adr_signers() const { return (oop*)&this->_signers;}
oop* adr_inner_classes() const { return (oop*)&this->_inner_classes;}
oop* adr_implementors() const { return (oop*)&this->_implementors[0];}
- oop* adr_bootstrap_method() const { return (oop*)&this->_bootstrap_method;} // AllowTransitionalJSR292 ONLY
oop* adr_methods_jmethod_ids() const { return (oop*)&this->_methods_jmethod_ids;}
oop* adr_methods_cached_itable_indices() const { return (oop*)&this->_methods_cached_itable_indices;}
oop* adr_class_annotations() const { return (oop*)&this->_class_annotations;}
diff --git a/hotspot/src/share/vm/oops/instanceKlassKlass.cpp b/hotspot/src/share/vm/oops/instanceKlassKlass.cpp
index 897c5157c36..aa12d13a8c9 100644
--- a/hotspot/src/share/vm/oops/instanceKlassKlass.cpp
+++ b/hotspot/src/share/vm/oops/instanceKlassKlass.cpp
@@ -105,7 +105,6 @@ void instanceKlassKlass::oop_follow_contents(oop obj) {
MarkSweep::mark_and_push(ik->adr_protection_domain());
MarkSweep::mark_and_push(ik->adr_host_klass());
MarkSweep::mark_and_push(ik->adr_signers());
- MarkSweep::mark_and_push(ik->adr_bootstrap_method());
MarkSweep::mark_and_push(ik->adr_class_annotations());
MarkSweep::mark_and_push(ik->adr_fields_annotations());
MarkSweep::mark_and_push(ik->adr_methods_annotations());
@@ -142,7 +141,6 @@ void instanceKlassKlass::oop_follow_contents(ParCompactionManager* cm,
PSParallelCompact::mark_and_push(cm, ik->adr_protection_domain());
PSParallelCompact::mark_and_push(cm, ik->adr_host_klass());
PSParallelCompact::mark_and_push(cm, ik->adr_signers());
- PSParallelCompact::mark_and_push(cm, ik->adr_bootstrap_method());
PSParallelCompact::mark_and_push(cm, ik->adr_class_annotations());
PSParallelCompact::mark_and_push(cm, ik->adr_fields_annotations());
PSParallelCompact::mark_and_push(cm, ik->adr_methods_annotations());
@@ -185,7 +183,6 @@ int instanceKlassKlass::oop_oop_iterate(oop obj, OopClosure* blk) {
for (int i = 0; i < instanceKlass::implementors_limit; i++) {
blk->do_oop(&ik->adr_implementors()[i]);
}
- blk->do_oop(ik->adr_bootstrap_method());
blk->do_oop(ik->adr_class_annotations());
blk->do_oop(ik->adr_fields_annotations());
blk->do_oop(ik->adr_methods_annotations());
@@ -239,8 +236,6 @@ int instanceKlassKlass::oop_oop_iterate_m(oop obj, OopClosure* blk,
for (int i = 0; i < instanceKlass::implementors_limit; i++) {
if (mr.contains(&adr[i])) blk->do_oop(&adr[i]);
}
- adr = ik->adr_bootstrap_method();
- if (mr.contains(adr)) blk->do_oop(adr);
adr = ik->adr_class_annotations();
if (mr.contains(adr)) blk->do_oop(adr);
adr = ik->adr_fields_annotations();
@@ -281,7 +276,6 @@ int instanceKlassKlass::oop_adjust_pointers(oop obj) {
for (int i = 0; i < instanceKlass::implementors_limit; i++) {
MarkSweep::adjust_pointer(&ik->adr_implementors()[i]);
}
- MarkSweep::adjust_pointer(ik->adr_bootstrap_method());
MarkSweep::adjust_pointer(ik->adr_class_annotations());
MarkSweep::adjust_pointer(ik->adr_fields_annotations());
MarkSweep::adjust_pointer(ik->adr_methods_annotations());
@@ -317,11 +311,6 @@ void instanceKlassKlass::oop_push_contents(PSPromotionManager* pm, oop obj) {
pm->claim_or_forward_depth(sg_addr);
}
- oop* bsm_addr = ik->adr_bootstrap_method();
- if (PSScavenge::should_scavenge(bsm_addr)) {
- pm->claim_or_forward_depth(bsm_addr);
- }
-
klassKlass::oop_push_contents(pm, obj);
}
@@ -420,7 +409,6 @@ instanceKlassKlass::allocate_instance_klass(Symbol* name, int vtable_len, int it
ik->set_breakpoints(NULL);
ik->init_previous_versions();
ik->set_generic_signature(NULL);
- ik->set_bootstrap_method(NULL);
ik->release_set_methods_jmethod_ids(NULL);
ik->release_set_methods_cached_itable_indices(NULL);
ik->set_class_annotations(NULL);
@@ -542,11 +530,6 @@ void instanceKlassKlass::oop_print_on(oop obj, outputStream* st) {
} // pvw is cleaned up
} // rm is cleaned up
- if (ik->bootstrap_method() != NULL) {
- st->print(BULLET"bootstrap method: ");
- ik->bootstrap_method()->print_value_on(st);
- st->cr();
- }
if (ik->generic_signature() != NULL) {
st->print(BULLET"generic signature: ");
ik->generic_signature()->print_value_on(st);
diff --git a/hotspot/src/share/vm/oops/instanceMirrorKlass.hpp b/hotspot/src/share/vm/oops/instanceMirrorKlass.hpp
index 0556dc5abd4..2b8b2f460c4 100644
--- a/hotspot/src/share/vm/oops/instanceMirrorKlass.hpp
+++ b/hotspot/src/share/vm/oops/instanceMirrorKlass.hpp
@@ -36,6 +36,8 @@
class instanceMirrorKlass: public instanceKlass {
+ friend class VMStructs;
+
private:
static int _offset_of_static_fields;
diff --git a/hotspot/src/share/vm/oops/klass.cpp b/hotspot/src/share/vm/oops/klass.cpp
index 294830c17f2..499bf53a96f 100644
--- a/hotspot/src/share/vm/oops/klass.cpp
+++ b/hotspot/src/share/vm/oops/klass.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2011, 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
@@ -500,7 +500,7 @@ const char* Klass::external_name() const {
if (oop_is_instance()) {
instanceKlass* ik = (instanceKlass*) this;
if (ik->is_anonymous()) {
- assert(AnonymousClasses, "");
+ assert(EnableInvokeDynamic, "");
intptr_t hash = ik->java_mirror()->identity_hash();
char hash_buf[40];
sprintf(hash_buf, "/" UINTX_FORMAT, (uintx)hash);
diff --git a/hotspot/src/share/vm/oops/markOop.hpp b/hotspot/src/share/vm/oops/markOop.hpp
index 0dca58494ec..9501c1ed642 100644
--- a/hotspot/src/share/vm/oops/markOop.hpp
+++ b/hotspot/src/share/vm/oops/markOop.hpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2011, 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
diff --git a/hotspot/src/share/vm/oops/methodOop.cpp b/hotspot/src/share/vm/oops/methodOop.cpp
index 16d42b0262b..5e470ac35c0 100644
--- a/hotspot/src/share/vm/oops/methodOop.cpp
+++ b/hotspot/src/share/vm/oops/methodOop.cpp
@@ -852,11 +852,11 @@ bool methodOopDesc::should_not_be_cached() const {
bool methodOopDesc::is_method_handle_invoke_name(vmSymbols::SID name_sid) {
switch (name_sid) {
case vmSymbols::VM_SYMBOL_ENUM_NAME(invokeExact_name):
- case vmSymbols::VM_SYMBOL_ENUM_NAME(invokeGeneric_name):
+ case vmSymbols::VM_SYMBOL_ENUM_NAME(invoke_name):
return true;
}
- if ((AllowTransitionalJSR292 || AllowInvokeForInvokeGeneric)
- && name_sid == vmSymbols::VM_SYMBOL_ENUM_NAME(invoke_name))
+ if (AllowInvokeGeneric
+ && name_sid == vmSymbols::VM_SYMBOL_ENUM_NAME(invokeGeneric_name))
return true;
return false;
}
@@ -1092,7 +1092,6 @@ void methodOopDesc::init_intrinsic_id() {
if (name_id == vmSymbols::NO_SID) return;
vmSymbols::SID sig_id = vmSymbols::find_sid(signature());
if (klass_id != vmSymbols::VM_SYMBOL_ENUM_NAME(java_lang_invoke_MethodHandle)
- && !(klass_id == vmSymbols::VM_SYMBOL_ENUM_NAME(java_dyn_MethodHandle) && AllowTransitionalJSR292)
&& sig_id == vmSymbols::NO_SID) return;
jshort flags = access_flags().as_short();
@@ -1118,20 +1117,17 @@ void methodOopDesc::init_intrinsic_id() {
break;
// Signature-polymorphic methods: MethodHandle.invoke*, InvokeDynamic.*.
- case vmSymbols::VM_SYMBOL_ENUM_NAME(java_dyn_MethodHandle): // AllowTransitionalJSR292 ONLY
case vmSymbols::VM_SYMBOL_ENUM_NAME(java_lang_invoke_MethodHandle):
if (is_static() || !is_native()) break;
switch (name_id) {
case vmSymbols::VM_SYMBOL_ENUM_NAME(invokeGeneric_name):
+ if (!AllowInvokeGeneric) break;
+ case vmSymbols::VM_SYMBOL_ENUM_NAME(invoke_name):
id = vmIntrinsics::_invokeGeneric;
break;
case vmSymbols::VM_SYMBOL_ENUM_NAME(invokeExact_name):
id = vmIntrinsics::_invokeExact;
break;
- case vmSymbols::VM_SYMBOL_ENUM_NAME(invoke_name):
- if (AllowInvokeForInvokeGeneric) id = vmIntrinsics::_invokeGeneric;
- else if (AllowTransitionalJSR292) id = vmIntrinsics::_invokeExact;
- break;
}
break;
case vmSymbols::VM_SYMBOL_ENUM_NAME(java_lang_invoke_InvokeDynamic):
diff --git a/hotspot/src/share/vm/oops/methodOop.hpp b/hotspot/src/share/vm/oops/methodOop.hpp
index bf3f8528e13..bace4defe3c 100644
--- a/hotspot/src/share/vm/oops/methodOop.hpp
+++ b/hotspot/src/share/vm/oops/methodOop.hpp
@@ -607,7 +607,7 @@ class methodOopDesc : public oopDesc {
// method handles want to be able to push a few extra values (e.g., a bound receiver), and
// invokedynamic sometimes needs to push a bootstrap method, call site, and arglist,
// all without checking for a stack overflow
- static int extra_stack_entries() { return (EnableMethodHandles ? (int)MethodHandlePushLimit : 0) + (EnableInvokeDynamic ? 3 : 0); }
+ static int extra_stack_entries() { return EnableInvokeDynamic ? (int) MethodHandlePushLimit + 3 : 0; }
static int extra_stack_words(); // = extra_stack_entries() * Interpreter::stackElementSize()
// RedefineClasses() support:
diff --git a/hotspot/src/share/vm/oops/symbol.cpp b/hotspot/src/share/vm/oops/symbol.cpp
index ef2040ae051..4c508475064 100644
--- a/hotspot/src/share/vm/oops/symbol.cpp
+++ b/hotspot/src/share/vm/oops/symbol.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2009, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2011, 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
diff --git a/hotspot/src/share/vm/oops/symbol.hpp b/hotspot/src/share/vm/oops/symbol.hpp
index 63c1df4f126..269c2b72128 100644
--- a/hotspot/src/share/vm/oops/symbol.hpp
+++ b/hotspot/src/share/vm/oops/symbol.hpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2009, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2011, 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
diff --git a/hotspot/src/share/vm/oops/typeArrayOop.hpp b/hotspot/src/share/vm/oops/typeArrayOop.hpp
index c39987be5c7..e0133fd9dbc 100644
--- a/hotspot/src/share/vm/oops/typeArrayOop.hpp
+++ b/hotspot/src/share/vm/oops/typeArrayOop.hpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2011, 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
diff --git a/hotspot/src/share/vm/opto/buildOopMap.cpp b/hotspot/src/share/vm/opto/buildOopMap.cpp
index 32a174729c7..fc731604eaa 100644
--- a/hotspot/src/share/vm/opto/buildOopMap.cpp
+++ b/hotspot/src/share/vm/opto/buildOopMap.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2002, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2002, 2011, 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
diff --git a/hotspot/src/share/vm/opto/bytecodeInfo.cpp b/hotspot/src/share/vm/opto/bytecodeInfo.cpp
index 6443bc16bf9..3ab401de6d7 100644
--- a/hotspot/src/share/vm/opto/bytecodeInfo.cpp
+++ b/hotspot/src/share/vm/opto/bytecodeInfo.cpp
@@ -25,6 +25,7 @@
#include "precompiled.hpp"
#include "classfile/systemDictionary.hpp"
#include "classfile/vmSymbols.hpp"
+#include "compiler/compileBroker.hpp"
#include "compiler/compileLog.hpp"
#include "interpreter/linkResolver.hpp"
#include "oops/objArrayKlass.hpp"
@@ -75,13 +76,6 @@ InlineTree::InlineTree(Compile* c, ciMethod* callee_method, JVMState* caller_jvm
assert(!UseOldInlining, "do not use for old stuff");
}
-
-
-static void print_indent(int depth) {
- tty->print(" ");
- for (int i = depth; i != 0; --i) tty->print(" ");
-}
-
static bool is_init_with_ea(ciMethod* callee_method,
ciMethod* caller_method, Compile* C) {
// True when EA is ON and a java constructor is called or
@@ -100,7 +94,7 @@ const char* InlineTree::shouldInline(ciMethod* callee_method, ciMethod* caller_m
if(callee_method->should_inline()) {
*wci_result = *(WarmCallInfo::always_hot());
if (PrintInlining && Verbose) {
- print_indent(inline_depth());
+ CompileTask::print_inline_indent(inline_depth());
tty->print_cr("Inlined method is hot: ");
}
return NULL;
@@ -116,7 +110,7 @@ const char* InlineTree::shouldInline(ciMethod* callee_method, ciMethod* caller_m
size < InlineThrowMaxSize ) {
wci_result->set_profit(wci_result->profit() * 100);
if (PrintInlining && Verbose) {
- print_indent(inline_depth());
+ CompileTask::print_inline_indent(inline_depth());
tty->print_cr("Inlined method with many throws (throws=%d):", callee_method->interpreter_throwout_count());
}
return NULL;
@@ -138,9 +132,9 @@ const char* InlineTree::shouldInline(ciMethod* callee_method, ciMethod* caller_m
max_size = C->freq_inline_size();
if (size <= max_size && TraceFrequencyInlining) {
- print_indent(inline_depth());
+ CompileTask::print_inline_indent(inline_depth());
tty->print_cr("Inlined frequent method (freq=%d count=%d):", freq, call_site_count);
- print_indent(inline_depth());
+ CompileTask::print_inline_indent(inline_depth());
callee_method->print();
tty->cr();
}
@@ -315,8 +309,25 @@ const char* InlineTree::try_to_inline(ciMethod* callee_method, ciMethod* caller_
if( inline_depth() > MaxInlineLevel ) {
return "inlining too deep";
}
- if( method() == callee_method &&
- inline_depth() > MaxRecursiveInlineLevel ) {
+
+ // We need to detect recursive inlining of method handle targets: if
+ // the current method is a method handle adapter and one of the
+ // callers is the same method as the callee, we bail out if
+ // MaxRecursiveInlineLevel is hit.
+ if (method()->is_method_handle_adapter()) {
+ JVMState* jvms = caller_jvms();
+ int inline_level = 0;
+ while (jvms != NULL && jvms->has_method()) {
+ if (jvms->method() == callee_method) {
+ inline_level++;
+ if (inline_level > MaxRecursiveInlineLevel)
+ return "recursively inlining too deep";
+ }
+ jvms = jvms->caller();
+ }
+ }
+
+ if (method() == callee_method && inline_depth() > MaxRecursiveInlineLevel) {
return "recursively inlining too deep";
}
@@ -368,18 +379,14 @@ bool pass_initial_checks(ciMethod* caller_method, int caller_bci, ciMethod* call
#ifndef PRODUCT
//------------------------------print_inlining---------------------------------
// Really, the failure_msg can be a success message also.
-void InlineTree::print_inlining(ciMethod *callee_method, int caller_bci, const char *failure_msg) const {
- print_indent(inline_depth());
- tty->print("@ %d ", caller_bci);
- if( callee_method ) callee_method->print_short_name();
- else tty->print(" callee not monotonic or profiled");
- tty->print(" %s", (failure_msg ? failure_msg : "inline"));
- if( Verbose && callee_method ) {
+void InlineTree::print_inlining(ciMethod* callee_method, int caller_bci, const char* failure_msg) const {
+ CompileTask::print_inlining(callee_method, inline_depth(), caller_bci, failure_msg ? failure_msg : "inline");
+ if (callee_method == NULL) tty->print(" callee not monotonic or profiled");
+ if (Verbose && callee_method) {
const InlineTree *top = this;
while( top->caller_tree() != NULL ) { top = top->caller_tree(); }
tty->print(" bcs: %d+%d invoked: %d", top->count_inline_bcs(), callee_method->code_size(), callee_method->interpreter_invocation_count());
}
- tty->cr();
}
#endif
diff --git a/hotspot/src/share/vm/opto/c2_globals.hpp b/hotspot/src/share/vm/opto/c2_globals.hpp
index 033074dadf6..a23c13d3fac 100644
--- a/hotspot/src/share/vm/opto/c2_globals.hpp
+++ b/hotspot/src/share/vm/opto/c2_globals.hpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2011, 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
diff --git a/hotspot/src/share/vm/opto/c2compiler.cpp b/hotspot/src/share/vm/opto/c2compiler.cpp
index 7b0b9be59a6..713e3f1d1a1 100644
--- a/hotspot/src/share/vm/opto/c2compiler.cpp
+++ b/hotspot/src/share/vm/opto/c2compiler.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2011, 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
diff --git a/hotspot/src/share/vm/opto/callGenerator.cpp b/hotspot/src/share/vm/opto/callGenerator.cpp
index 6d201139e80..ed02629d6b3 100644
--- a/hotspot/src/share/vm/opto/callGenerator.cpp
+++ b/hotspot/src/share/vm/opto/callGenerator.cpp
@@ -978,31 +978,19 @@ WarmCallInfo* WarmCallInfo::remove_from(WarmCallInfo* head) {
return head;
}
-WarmCallInfo* WarmCallInfo::_always_hot = NULL;
-WarmCallInfo* WarmCallInfo::_always_cold = NULL;
+WarmCallInfo WarmCallInfo::_always_hot(WarmCallInfo::MAX_VALUE(), WarmCallInfo::MAX_VALUE(),
+ WarmCallInfo::MIN_VALUE(), WarmCallInfo::MIN_VALUE());
+WarmCallInfo WarmCallInfo::_always_cold(WarmCallInfo::MIN_VALUE(), WarmCallInfo::MIN_VALUE(),
+ WarmCallInfo::MAX_VALUE(), WarmCallInfo::MAX_VALUE());
WarmCallInfo* WarmCallInfo::always_hot() {
- if (_always_hot == NULL) {
- static double bits[sizeof(WarmCallInfo) / sizeof(double) + 1] = {0};
- WarmCallInfo* ci = (WarmCallInfo*) bits;
- ci->_profit = ci->_count = MAX_VALUE();
- ci->_work = ci->_size = MIN_VALUE();
- _always_hot = ci;
- }
- assert(_always_hot->is_hot(), "must always be hot");
- return _always_hot;
+ assert(_always_hot.is_hot(), "must always be hot");
+ return &_always_hot;
}
WarmCallInfo* WarmCallInfo::always_cold() {
- if (_always_cold == NULL) {
- static double bits[sizeof(WarmCallInfo) / sizeof(double) + 1] = {0};
- WarmCallInfo* ci = (WarmCallInfo*) bits;
- ci->_profit = ci->_count = MIN_VALUE();
- ci->_work = ci->_size = MAX_VALUE();
- _always_cold = ci;
- }
- assert(_always_cold->is_cold(), "must always be cold");
- return _always_cold;
+ assert(_always_cold.is_cold(), "must always be cold");
+ return &_always_cold;
}
diff --git a/hotspot/src/share/vm/opto/callGenerator.hpp b/hotspot/src/share/vm/opto/callGenerator.hpp
index 75e8ba004ad..4a50f990e6d 100644
--- a/hotspot/src/share/vm/opto/callGenerator.hpp
+++ b/hotspot/src/share/vm/opto/callGenerator.hpp
@@ -215,8 +215,20 @@ class WarmCallInfo : public ResourceObj {
WarmCallInfo* next() const { return _next; }
void set_next(WarmCallInfo* n) { _next = n; }
- static WarmCallInfo* _always_hot;
- static WarmCallInfo* _always_cold;
+ static WarmCallInfo _always_hot;
+ static WarmCallInfo _always_cold;
+
+ // Constructor intitialization of always_hot and always_cold
+ WarmCallInfo(float c, float p, float w, float s) {
+ _call = NULL;
+ _hot_cg = NULL;
+ _next = NULL;
+ _count = c;
+ _profit = p;
+ _work = w;
+ _size = s;
+ _heat = 0;
+ }
public:
// Because WarmInfo objects live over the entire lifetime of the
diff --git a/hotspot/src/share/vm/opto/cfgnode.cpp b/hotspot/src/share/vm/opto/cfgnode.cpp
index f6ca3ce7f90..90f0234f089 100644
--- a/hotspot/src/share/vm/opto/cfgnode.cpp
+++ b/hotspot/src/share/vm/opto/cfgnode.cpp
@@ -1349,9 +1349,17 @@ static Node* is_absolute( PhaseGVN *phase, PhiNode *phi_root, int true_path) {
static void split_once(PhaseIterGVN *igvn, Node *phi, Node *val, Node *n, Node *newn) {
igvn->hash_delete(n); // Remove from hash before hacking edges
+ Node* predicate_proj = NULL;
uint j = 1;
- for( uint i = phi->req()-1; i > 0; i-- ) {
- if( phi->in(i) == val ) { // Found a path with val?
+ for (uint i = phi->req()-1; i > 0; i--) {
+ if (phi->in(i) == val) { // Found a path with val?
+ if (n->is_Region()) {
+ Node* proj = PhaseIdealLoop::find_predicate(n->in(i));
+ if (proj != NULL) {
+ assert(predicate_proj == NULL, "only one predicate entry expected");
+ predicate_proj = proj;
+ }
+ }
// Add to NEW Region/Phi, no DU info
newn->set_req( j++, n->in(i) );
// Remove from OLD Region/Phi
@@ -1362,6 +1370,12 @@ static void split_once(PhaseIterGVN *igvn, Node *phi, Node *val, Node *n, Node *
// Register the new node but do not transform it. Cannot transform until the
// entire Region/Phi conglomerate has been hacked as a single huge transform.
igvn->register_new_node_with_optimizer( newn );
+
+ // Clone loop predicates
+ if (predicate_proj != NULL) {
+ newn = igvn->clone_loop_predicates(predicate_proj, newn);
+ }
+
// Now I can point to the new node.
n->add_req(newn);
igvn->_worklist.push(n);
diff --git a/hotspot/src/share/vm/opto/chaitin.cpp b/hotspot/src/share/vm/opto/chaitin.cpp
index 6108084f9d0..21b4716b39d 100644
--- a/hotspot/src/share/vm/opto/chaitin.cpp
+++ b/hotspot/src/share/vm/opto/chaitin.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2011, 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
@@ -673,7 +673,7 @@ void PhaseChaitin::gather_lrg_masks( bool after_aggressive ) {
case Op_RegD:
lrg.set_num_regs(2);
// Define platform specific register pressure
-#ifdef SPARC
+#if defined(SPARC) || defined(ARM)
lrg.set_reg_pressure(2);
#elif defined(IA32)
if( ireg == Op_RegL ) {
diff --git a/hotspot/src/share/vm/opto/compile.cpp b/hotspot/src/share/vm/opto/compile.cpp
index c9e04bb7a3e..e6084be0e0c 100644
--- a/hotspot/src/share/vm/opto/compile.cpp
+++ b/hotspot/src/share/vm/opto/compile.cpp
@@ -1632,7 +1632,6 @@ void Compile::cleanup_loop_predicates(PhaseIterGVN &igvn) {
igvn.replace_node(n, n->in(1));
}
assert(predicate_count()==0, "should be clean!");
- igvn.optimize();
}
//------------------------------Optimize---------------------------------------
@@ -1689,7 +1688,7 @@ void Compile::Optimize() {
if((loop_opts_cnt > 0) && (has_loops() || has_split_ifs())) {
{
TracePhase t2("idealLoop", &_t_idealLoop, true);
- PhaseIdealLoop ideal_loop( igvn, true, UseLoopPredicate);
+ PhaseIdealLoop ideal_loop( igvn, true );
loop_opts_cnt--;
if (major_progress()) print_method("PhaseIdealLoop 1", 2);
if (failing()) return;
@@ -1697,7 +1696,7 @@ void Compile::Optimize() {
// Loop opts pass if partial peeling occurred in previous pass
if(PartialPeelLoop && major_progress() && (loop_opts_cnt > 0)) {
TracePhase t3("idealLoop", &_t_idealLoop, true);
- PhaseIdealLoop ideal_loop( igvn, false, UseLoopPredicate);
+ PhaseIdealLoop ideal_loop( igvn, false );
loop_opts_cnt--;
if (major_progress()) print_method("PhaseIdealLoop 2", 2);
if (failing()) return;
@@ -1705,7 +1704,7 @@ void Compile::Optimize() {
// Loop opts pass for loop-unrolling before CCP
if(major_progress() && (loop_opts_cnt > 0)) {
TracePhase t4("idealLoop", &_t_idealLoop, true);
- PhaseIdealLoop ideal_loop( igvn, false, UseLoopPredicate);
+ PhaseIdealLoop ideal_loop( igvn, false );
loop_opts_cnt--;
if (major_progress()) print_method("PhaseIdealLoop 3", 2);
}
@@ -1743,21 +1742,13 @@ void Compile::Optimize() {
// peeling, unrolling, etc.
if(loop_opts_cnt > 0) {
debug_only( int cnt = 0; );
- bool loop_predication = UseLoopPredicate;
while(major_progress() && (loop_opts_cnt > 0)) {
TracePhase t2("idealLoop", &_t_idealLoop, true);
assert( cnt++ < 40, "infinite cycle in loop optimization" );
- PhaseIdealLoop ideal_loop( igvn, true, loop_predication);
+ PhaseIdealLoop ideal_loop( igvn, true);
loop_opts_cnt--;
if (major_progress()) print_method("PhaseIdealLoop iterations", 2);
if (failing()) return;
- // Perform loop predication optimization during first iteration after CCP.
- // After that switch it off and cleanup unused loop predicates.
- if (loop_predication) {
- loop_predication = false;
- cleanup_loop_predicates(igvn);
- if (failing()) return;
- }
}
}
@@ -2544,6 +2535,36 @@ static void final_graph_reshaping_impl( Node *n, Final_Reshape_Counts &frc ) {
frc.inc_inner_loop_count();
}
break;
+ case Op_LShiftI:
+ case Op_RShiftI:
+ case Op_URShiftI:
+ case Op_LShiftL:
+ case Op_RShiftL:
+ case Op_URShiftL:
+ if (Matcher::need_masked_shift_count) {
+ // The cpu's shift instructions don't restrict the count to the
+ // lower 5/6 bits. We need to do the masking ourselves.
+ Node* in2 = n->in(2);
+ juint mask = (n->bottom_type() == TypeInt::INT) ? (BitsPerInt - 1) : (BitsPerLong - 1);
+ const TypeInt* t = in2->find_int_type();
+ if (t != NULL && t->is_con()) {
+ juint shift = t->get_con();
+ if (shift > mask) { // Unsigned cmp
+ Compile* C = Compile::current();
+ n->set_req(2, ConNode::make(C, TypeInt::make(shift & mask)));
+ }
+ } else {
+ if (t == NULL || t->_lo < 0 || t->_hi > (int)mask) {
+ Compile* C = Compile::current();
+ Node* shift = new (C, 3) AndINode(in2, ConNode::make(C, TypeInt::make(mask)));
+ n->set_req(2, shift);
+ }
+ }
+ if (in2->outcnt() == 0) { // Remove dead node
+ in2->disconnect_inputs(NULL);
+ }
+ }
+ break;
default:
assert( !n->is_Call(), "" );
assert( !n->is_Mem(), "" );
diff --git a/hotspot/src/share/vm/opto/compile.hpp b/hotspot/src/share/vm/opto/compile.hpp
index 5b562ecee44..b2d81897ac0 100644
--- a/hotspot/src/share/vm/opto/compile.hpp
+++ b/hotspot/src/share/vm/opto/compile.hpp
@@ -489,6 +489,9 @@ class Compile : public Phase {
// remove the opaque nodes that protect the predicates so that the unused checks and
// uncommon traps will be eliminated from the graph.
void cleanup_loop_predicates(PhaseIterGVN &igvn);
+ bool is_predicate_opaq(Node * n) {
+ return _predicate_opaqs->contains(n);
+ }
// Compilation environment.
Arena* comp_arena() { return &_comp_arena; }
diff --git a/hotspot/src/share/vm/opto/doCall.cpp b/hotspot/src/share/vm/opto/doCall.cpp
index 4c19678ea24..de066e992a3 100644
--- a/hotspot/src/share/vm/opto/doCall.cpp
+++ b/hotspot/src/share/vm/opto/doCall.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1998, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 2011, 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
@@ -27,6 +27,7 @@
#include "ci/ciCallSite.hpp"
#include "ci/ciMethodHandle.hpp"
#include "classfile/vmSymbols.hpp"
+#include "compiler/compileBroker.hpp"
#include "compiler/compileLog.hpp"
#include "interpreter/linkResolver.hpp"
#include "opto/addnode.hpp"
@@ -43,17 +44,17 @@
#ifndef PRODUCT
void trace_type_profile(ciMethod *method, int depth, int bci, ciMethod *prof_method, ciKlass *prof_klass, int site_count, int receiver_count) {
if (TraceTypeProfile || PrintInlining || PrintOptoInlining) {
- tty->print(" ");
- for( int i = 0; i < depth; i++ ) tty->print(" ");
- if (!PrintOpto) {
- method->print_short_name();
- tty->print(" ->");
+ if (!PrintInlining) {
+ if (!PrintOpto && !PrintCompilation) {
+ method->print_short_name();
+ tty->cr();
+ }
+ CompileTask::print_inlining(prof_method, depth, bci);
}
- tty->print(" @ %d ", bci);
- prof_method->print_short_name();
- tty->print(" >>TypeProfile (%d/%d counts) = ", receiver_count, site_count);
+ CompileTask::print_inline_indent(depth);
+ tty->print(" \\-> TypeProfile (%d/%d counts) = ", receiver_count, site_count);
prof_klass->name()->print_symbol();
- tty->print_cr(" (%d bytes)", prof_method->code_size());
+ tty->cr();
}
}
#endif
@@ -62,6 +63,7 @@ CallGenerator* Compile::call_generator(ciMethod* call_method, int vtable_index,
JVMState* jvms, bool allow_inline,
float prof_factor) {
CallGenerator* cg;
+ guarantee(call_method != NULL, "failed method resolution");
// Dtrace currently doesn't work unless all calls are vanilla
if (env()->dtrace_method_probes()) {
@@ -129,8 +131,9 @@ CallGenerator* Compile::call_generator(ciMethod* call_method, int vtable_index,
// Get an adapter for the MethodHandle.
ciMethod* target_method = method_handle->get_method_handle_adapter();
-
- CallGenerator* hit_cg = this->call_generator(target_method, vtable_index, false, jvms, true, prof_factor);
+ CallGenerator* hit_cg = NULL;
+ if (target_method != NULL)
+ hit_cg = this->call_generator(target_method, vtable_index, false, jvms, true, prof_factor);
if (hit_cg != NULL && hit_cg->is_inline())
return hit_cg;
}
@@ -151,8 +154,9 @@ CallGenerator* Compile::call_generator(ciMethod* call_method, int vtable_index,
// Get an adapter for the MethodHandle.
ciMethod* target_method = method_handle->get_invokedynamic_adapter();
-
- CallGenerator* hit_cg = this->call_generator(target_method, vtable_index, false, jvms, true, prof_factor);
+ CallGenerator* hit_cg = NULL;
+ if (target_method != NULL)
+ hit_cg = this->call_generator(target_method, vtable_index, false, jvms, true, prof_factor);
if (hit_cg != NULL && hit_cg->is_inline()) {
CallGenerator* miss_cg = CallGenerator::for_dynamic_call(call_method);
return CallGenerator::for_predicted_dynamic_call(method_handle, miss_cg, hit_cg, prof_factor);
@@ -269,13 +273,13 @@ CallGenerator* Compile::call_generator(ciMethod* call_method, int vtable_index,
}
if (miss_cg != NULL) {
if (next_hit_cg != NULL) {
- NOT_PRODUCT(trace_type_profile(jvms->method(), jvms->depth(), jvms->bci(), next_receiver_method, profile.receiver(1), site_count, profile.receiver_count(1)));
+ NOT_PRODUCT(trace_type_profile(jvms->method(), jvms->depth() - 1, jvms->bci(), next_receiver_method, profile.receiver(1), site_count, profile.receiver_count(1)));
// We don't need to record dependency on a receiver here and below.
// Whenever we inline, the dependency is added by Parse::Parse().
miss_cg = CallGenerator::for_predicted_call(profile.receiver(1), miss_cg, next_hit_cg, PROB_MAX);
}
if (miss_cg != NULL) {
- NOT_PRODUCT(trace_type_profile(jvms->method(), jvms->depth(), jvms->bci(), receiver_method, profile.receiver(0), site_count, receiver_count));
+ NOT_PRODUCT(trace_type_profile(jvms->method(), jvms->depth() - 1, jvms->bci(), receiver_method, profile.receiver(0), site_count, receiver_count));
cg = CallGenerator::for_predicted_call(profile.receiver(0), miss_cg, hit_cg, profile.receiver_prob(0));
if (cg != NULL) return cg;
}
diff --git a/hotspot/src/share/vm/opto/escape.cpp b/hotspot/src/share/vm/opto/escape.cpp
index 788a79785bb..a7b509e34c5 100644
--- a/hotspot/src/share/vm/opto/escape.cpp
+++ b/hotspot/src/share/vm/opto/escape.cpp
@@ -594,7 +594,7 @@ bool ConnectionGraph::split_AddP(Node *addp, Node *base, PhaseGVN *igvn) {
//
// Create a new version of orig_phi if necessary. Returns either the newly
-// created phi or an existing phi. Sets create_new to indicate wheter a new
+// created phi or an existing phi. Sets create_new to indicate whether a new
// phi was created. Cache the last newly created phi in the node map.
//
PhiNode *ConnectionGraph::create_split_phi(PhiNode *orig_phi, int alias_idx, GrowableArray &orig_phi_worklist, PhaseGVN *igvn, bool &new_created) {
@@ -649,7 +649,7 @@ PhiNode *ConnectionGraph::create_split_phi(PhiNode *orig_phi, int alias_idx, Gro
}
//
-// Return a new version of Memory Phi "orig_phi" with the inputs having the
+// Return a new version of Memory Phi "orig_phi" with the inputs having the
// specified alias index.
//
PhiNode *ConnectionGraph::split_memory_phi(PhiNode *orig_phi, int alias_idx, GrowableArray &orig_phi_worklist, PhaseGVN *igvn) {
@@ -828,11 +828,15 @@ Node* ConnectionGraph::find_inst_mem(Node *orig_mem, int alias_idx, GrowableArra
break; // hit one of our sentinels
if (result->is_Mem()) {
const Type *at = phase->type(result->in(MemNode::Address));
- if (at != Type::TOP) {
- assert (at->isa_ptr() != NULL, "pointer type required.");
- int idx = C->get_alias_index(at->is_ptr());
- if (idx == alias_idx)
- break;
+ if (at == Type::TOP)
+ break; // Dead
+ assert (at->isa_ptr() != NULL, "pointer type required.");
+ int idx = C->get_alias_index(at->is_ptr());
+ if (idx == alias_idx)
+ break; // Found
+ if (!is_instance && (at->isa_oopptr() == NULL ||
+ !at->is_oopptr()->is_known_instance())) {
+ break; // Do not skip store to general memory slice.
}
result = result->in(MemNode::Memory);
}
@@ -902,13 +906,13 @@ Node* ConnectionGraph::find_inst_mem(Node *orig_mem, int alias_idx, GrowableArra
PhiNode *mphi = result->as_Phi();
assert(mphi->bottom_type() == Type::MEMORY, "memory phi required");
const TypePtr *t = mphi->adr_type();
- if (C->get_alias_index(t) != alias_idx) {
- // Create a new Phi with the specified alias index type.
- result = split_memory_phi(mphi, alias_idx, orig_phis, phase);
- } else if (!is_instance) {
+ if (!is_instance) {
// Push all non-instance Phis on the orig_phis worklist to update inputs
// during Phase 4 if needed.
orig_phis.append_if_missing(mphi);
+ } else if (C->get_alias_index(t) != alias_idx) {
+ // Create a new Phi with the specified alias index type.
+ result = split_memory_phi(mphi, alias_idx, orig_phis, phase);
}
}
// the result is either MemNode, PhiNode, InitializeNode.
diff --git a/hotspot/src/share/vm/opto/gcm.cpp b/hotspot/src/share/vm/opto/gcm.cpp
index 2122f7ca733..f714d01f03c 100644
--- a/hotspot/src/share/vm/opto/gcm.cpp
+++ b/hotspot/src/share/vm/opto/gcm.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2011, 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
diff --git a/hotspot/src/share/vm/opto/graphKit.cpp b/hotspot/src/share/vm/opto/graphKit.cpp
index b20513e67c1..afa2efff986 100644
--- a/hotspot/src/share/vm/opto/graphKit.cpp
+++ b/hotspot/src/share/vm/opto/graphKit.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2001, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 2011, 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
@@ -3385,10 +3385,15 @@ void GraphKit::add_predicate(int nargs) {
#define __ ideal.
void GraphKit::sync_kit(IdealKit& ideal) {
+ set_all_memory(__ merged_memory());
+ set_i_o(__ i_o());
+ set_control(__ ctrl());
+}
+
+void GraphKit::final_sync(IdealKit& ideal) {
// Final sync IdealKit and graphKit.
__ drain_delay_transform();
- set_all_memory(__ merged_memory());
- set_control(__ ctrl());
+ sync_kit(ideal);
}
// vanilla/CMS post barrier
@@ -3435,7 +3440,7 @@ void GraphKit::write_barrier_post(Node* oop_store,
// (Else it's an array (or unknown), and we want more precise card marks.)
assert(adr != NULL, "");
- IdealKit ideal(gvn(), control(), merged_memory(), true);
+ IdealKit ideal(this, true);
// Convert the pointer to an int prior to doing math on it
Node* cast = __ CastPX(__ ctrl(), adr);
@@ -3461,7 +3466,7 @@ void GraphKit::write_barrier_post(Node* oop_store,
}
// Final sync IdealKit and GraphKit.
- sync_kit(ideal);
+ final_sync(ideal);
}
// G1 pre/post barriers
@@ -3471,7 +3476,7 @@ void GraphKit::g1_write_barrier_pre(Node* obj,
Node* val,
const TypeOopPtr* val_type,
BasicType bt) {
- IdealKit ideal(gvn(), control(), merged_memory(), true);
+ IdealKit ideal(this, true);
Node* tls = __ thread(); // ThreadLocalStorage
@@ -3548,7 +3553,7 @@ void GraphKit::g1_write_barrier_pre(Node* obj,
} __ end_if(); // (!marking)
// Final sync IdealKit and GraphKit.
- sync_kit(ideal);
+ final_sync(ideal);
}
//
@@ -3614,7 +3619,7 @@ void GraphKit::g1_write_barrier_post(Node* oop_store,
// (Else it's an array (or unknown), and we want more precise card marks.)
assert(adr != NULL, "");
- IdealKit ideal(gvn(), control(), merged_memory(), true);
+ IdealKit ideal(this, true);
Node* tls = __ thread(); // ThreadLocalStorage
@@ -3688,6 +3693,6 @@ void GraphKit::g1_write_barrier_post(Node* oop_store,
}
// Final sync IdealKit and GraphKit.
- sync_kit(ideal);
+ final_sync(ideal);
}
#undef __
diff --git a/hotspot/src/share/vm/opto/graphKit.hpp b/hotspot/src/share/vm/opto/graphKit.hpp
index 2f7a7d5ab05..4523326dbaf 100644
--- a/hotspot/src/share/vm/opto/graphKit.hpp
+++ b/hotspot/src/share/vm/opto/graphKit.hpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2001, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 2011, 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
@@ -662,7 +662,9 @@ class GraphKit : public Phase {
&& Universe::heap()->can_elide_tlab_store_barriers());
}
+ // Sync Ideal and Graph kits.
void sync_kit(IdealKit& ideal);
+ void final_sync(IdealKit& ideal);
// vanilla/CMS post barrier
void write_barrier_post(Node *store, Node* obj,
diff --git a/hotspot/src/share/vm/opto/idealGraphPrinter.cpp b/hotspot/src/share/vm/opto/idealGraphPrinter.cpp
index 212880c0718..40874ba7ded 100644
--- a/hotspot/src/share/vm/opto/idealGraphPrinter.cpp
+++ b/hotspot/src/share/vm/opto/idealGraphPrinter.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2007, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2007, 2011, 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
@@ -599,11 +599,35 @@ void IdealGraphPrinter::visit_node(Node *n, void *param) {
if (caller != NULL) {
stringStream bciStream;
+ ciMethod* last = NULL;
+ int last_bci;
while(caller) {
+ if (caller->has_method()) {
+ last = caller->method();
+ last_bci = caller->bci();
+ }
bciStream.print("%d ", caller->bci());
caller = caller->caller();
}
print_prop("bci", bciStream.as_string());
+ if (last != NULL && last->has_linenumber_table() && last_bci >= 0) {
+ print_prop("line", last->line_number_from_bci(last_bci));
+ }
+ }
+
+ if (node->debug_orig() != NULL) {
+ stringStream dorigStream;
+ Node* dorig = node->debug_orig();
+ if (dorig) {
+ dorigStream.print("%d ", dorig->_idx);
+ Node* first = dorig;
+ dorig = first->debug_orig();
+ while (dorig && dorig != first) {
+ dorigStream.print("%d ", dorig->_idx);
+ dorig = dorig->debug_orig();
+ }
+ }
+ print_prop("debug_orig", dorigStream.as_string());
}
if (_chaitin && _chaitin != (PhaseChaitin *)0xdeadbeef) {
@@ -628,6 +652,17 @@ void IdealGraphPrinter::walk_nodes(Node *start, void *param) {
GrowableArray nodeStack(Thread::current()->resource_area(), 0, 0, NULL);
nodeStack.push(start);
visited.test_set(start->_idx);
+ if (C->cfg() != NULL) {
+ // once we have a CFG there are some nodes that aren't really
+ // reachable but are in the CFG so add them here.
+ for (uint i = 0; i < C->cfg()->_blocks.size(); i++) {
+ Block *b = C->cfg()->_blocks[i];
+ for (uint s = 0; s < b->_nodes.size(); s++) {
+ nodeStack.push(b->_nodes[s]);
+ }
+ }
+ }
+
while(nodeStack.length() > 0) {
Node *n = nodeStack.pop();
@@ -686,16 +721,23 @@ void IdealGraphPrinter::print(Compile* compile, const char *name, Node *node, in
end_head();
head(SUCCESSORS_ELEMENT);
- for (uint s = 0; s < C->cfg()->_blocks[i]->_num_succs; s++) {
+ for (uint s = 0; s < b->_num_succs; s++) {
begin_elem(SUCCESSOR_ELEMENT);
print_attr(BLOCK_NAME_PROPERTY, b->_succs[s]->_pre_order);
end_elem();
}
tail(SUCCESSORS_ELEMENT);
+ head(NODES_ELEMENT);
+ for (uint s = 0; s < b->_nodes.size(); s++) {
+ begin_elem(NODE_ELEMENT);
+ print_attr(NODE_ID_PROPERTY, get_node_id(b->_nodes[s]));
+ end_elem();
+ }
+ tail(NODES_ELEMENT);
+
tail(BLOCK_ELEMENT);
}
-
tail(CONTROL_FLOW_ELEMENT);
}
tail(GRAPH_ELEMENT);
diff --git a/hotspot/src/share/vm/opto/idealGraphPrinter.hpp b/hotspot/src/share/vm/opto/idealGraphPrinter.hpp
index 9c8807a4721..6115e6d385c 100644
--- a/hotspot/src/share/vm/opto/idealGraphPrinter.hpp
+++ b/hotspot/src/share/vm/opto/idealGraphPrinter.hpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2007, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2007, 2011, 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,15 +43,6 @@ class ciMethod;
class IdealGraphPrinter
{
-private:
-
- enum State
- {
- Invalid,
- Valid,
- New
- };
-
private:
static const char *INDENT;
diff --git a/hotspot/src/share/vm/opto/idealKit.cpp b/hotspot/src/share/vm/opto/idealKit.cpp
index bc7aaaa6a9a..c9cb0f85578 100644
--- a/hotspot/src/share/vm/opto/idealKit.cpp
+++ b/hotspot/src/share/vm/opto/idealKit.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2011, 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,15 +38,16 @@
const uint IdealKit::first_var = TypeFunc::Parms + 1;
//----------------------------IdealKit-----------------------------------------
-IdealKit::IdealKit(PhaseGVN &gvn, Node* control, Node* mem, bool delay_all_transforms, bool has_declarations) :
- _gvn(gvn), C(gvn.C) {
- _initial_ctrl = control;
- _initial_memory = mem;
+IdealKit::IdealKit(GraphKit* gkit, bool delay_all_transforms, bool has_declarations) :
+ _gvn(gkit->gvn()), C(gkit->C) {
+ _initial_ctrl = gkit->control();
+ _initial_memory = gkit->merged_memory();
+ _initial_i_o = gkit->i_o();
_delay_all_transforms = delay_all_transforms;
_var_ct = 0;
_cvstate = NULL;
// We can go memory state free or else we need the entire memory state
- assert(mem == NULL || mem->Opcode() == Op_MergeMem, "memory must be pre-split");
+ assert(_initial_memory == NULL || _initial_memory->Opcode() == Op_MergeMem, "memory must be pre-split");
int init_size = 5;
_pending_cvstates = new (C->node_arena()) GrowableArray(C->node_arena(), init_size, 0, 0);
_delay_transform = new (C->node_arena()) GrowableArray(C->node_arena(), init_size, 0, 0);
@@ -56,6 +57,13 @@ IdealKit::IdealKit(PhaseGVN &gvn, Node* control, Node* mem, bool delay_all_trans
}
}
+//----------------------------sync_kit-----------------------------------------
+void IdealKit::sync_kit(GraphKit* gkit) {
+ set_all_memory(gkit->merged_memory());
+ set_i_o(gkit->i_o());
+ set_ctrl(gkit->control());
+}
+
//-------------------------------if_then-------------------------------------
// Create: if(left relop right)
// / \
@@ -156,16 +164,14 @@ void IdealKit::end_if() {
// onto the stack.
void IdealKit::loop(GraphKit* gkit, int nargs, IdealVariable& iv, Node* init, BoolTest::mask relop, Node* limit, float prob, float cnt) {
assert((state() & (BlockS|LoopS|IfThenS|ElseS)), "bad state for new loop");
-
- // Sync IdealKit and graphKit.
- gkit->set_all_memory(this->merged_memory());
- gkit->set_control(this->ctrl());
- // Add loop predicate.
- gkit->add_predicate(nargs);
- // Update IdealKit memory.
- this->set_all_memory(gkit->merged_memory());
- this->set_ctrl(gkit->control());
-
+ if (UseLoopPredicate) {
+ // Sync IdealKit and graphKit.
+ gkit->sync_kit(*this);
+ // Add loop predicate.
+ gkit->add_predicate(nargs);
+ // Update IdealKit memory.
+ sync_kit(gkit);
+ }
set(iv, init);
Node* head = make_label(1);
bind(head);
@@ -280,6 +286,7 @@ void IdealKit::declarations_done() {
_cvstate = new_cvstate(); // initialize current cvstate
set_ctrl(_initial_ctrl); // initialize control in current cvstate
set_all_memory(_initial_memory);// initialize memory in current cvstate
+ set_i_o(_initial_i_o); // initialize i_o in current cvstate
DEBUG_ONLY(_state->push(BlockS));
}
@@ -421,6 +428,9 @@ void IdealKit::do_memory_merge(Node* merging, Node* join) {
// Get the region for the join state
Node* join_region = join->in(TypeFunc::Control);
assert(join_region != NULL, "join region must exist");
+ if (join->in(TypeFunc::I_O) == NULL ) {
+ join->set_req(TypeFunc::I_O, merging->in(TypeFunc::I_O));
+ }
if (join->in(TypeFunc::Memory) == NULL ) {
join->set_req(TypeFunc::Memory, merging->in(TypeFunc::Memory));
return;
@@ -467,6 +477,20 @@ void IdealKit::do_memory_merge(Node* merging, Node* join) {
mms.set_memory(phi);
}
}
+
+ Node* join_io = join->in(TypeFunc::I_O);
+ Node* merging_io = merging->in(TypeFunc::I_O);
+ if (join_io != merging_io) {
+ PhiNode* phi;
+ if (join_io->is_Phi() && join_io->as_Phi()->region() == join_region) {
+ phi = join_io->as_Phi();
+ } else {
+ phi = PhiNode::make(join_region, join_io, Type::ABIO);
+ phi = (PhiNode*) delay_transform(phi);
+ join->set_req(TypeFunc::I_O, phi);
+ }
+ phi->set_req(slot, merging_io);
+ }
}
@@ -477,7 +501,8 @@ void IdealKit::make_leaf_call(const TypeFunc *slow_call_type,
const char *leaf_name,
Node* parm0,
Node* parm1,
- Node* parm2) {
+ Node* parm2,
+ Node* parm3) {
// We only handle taking in RawMem and modifying RawMem
const TypePtr* adr_type = TypeRawPtr::BOTTOM;
@@ -498,6 +523,55 @@ void IdealKit::make_leaf_call(const TypeFunc *slow_call_type,
if (parm0 != NULL) call->init_req(TypeFunc::Parms+0, parm0);
if (parm1 != NULL) call->init_req(TypeFunc::Parms+1, parm1);
if (parm2 != NULL) call->init_req(TypeFunc::Parms+2, parm2);
+ if (parm3 != NULL) call->init_req(TypeFunc::Parms+3, parm3);
+
+ // Node *c = _gvn.transform(call);
+ call = (CallNode *) _gvn.transform(call);
+ Node *c = call; // dbx gets confused with call call->dump()
+
+ // Slow leaf call has no side-effects, sets few values
+
+ set_ctrl(transform( new (C, 1) ProjNode(call,TypeFunc::Control) ));
+
+ // Make memory for the call
+ Node* mem = _gvn.transform( new (C, 1) ProjNode(call, TypeFunc::Memory) );
+
+ // Set the RawPtr memory state only.
+ set_memory(mem, adr_idx);
+
+ assert(C->alias_type(call->adr_type()) == C->alias_type(adr_type),
+ "call node must be constructed correctly");
+}
+
+
+void IdealKit::make_leaf_call_no_fp(const TypeFunc *slow_call_type,
+ address slow_call,
+ const char *leaf_name,
+ const TypePtr* adr_type,
+ Node* parm0,
+ Node* parm1,
+ Node* parm2,
+ Node* parm3) {
+
+ // We only handle taking in RawMem and modifying RawMem
+ uint adr_idx = C->get_alias_index(adr_type);
+
+ // Slow-path leaf call
+ int size = slow_call_type->domain()->cnt();
+ CallNode *call = (CallNode*)new (C, size) CallLeafNoFPNode( slow_call_type, slow_call, leaf_name, adr_type);
+
+ // Set fixed predefined input arguments
+ call->init_req( TypeFunc::Control, ctrl() );
+ call->init_req( TypeFunc::I_O , top() ) ; // does no i/o
+ // Narrow memory as only memory input
+ call->init_req( TypeFunc::Memory , memory(adr_idx));
+ call->init_req( TypeFunc::FramePtr, top() /* frameptr() */ );
+ call->init_req( TypeFunc::ReturnAdr, top() );
+
+ if (parm0 != NULL) call->init_req(TypeFunc::Parms+0, parm0);
+ if (parm1 != NULL) call->init_req(TypeFunc::Parms+1, parm1);
+ if (parm2 != NULL) call->init_req(TypeFunc::Parms+2, parm2);
+ if (parm3 != NULL) call->init_req(TypeFunc::Parms+3, parm3);
// Node *c = _gvn.transform(call);
call = (CallNode *) _gvn.transform(call);
diff --git a/hotspot/src/share/vm/opto/idealKit.hpp b/hotspot/src/share/vm/opto/idealKit.hpp
index 8192a446288..6787e533a64 100644
--- a/hotspot/src/share/vm/opto/idealKit.hpp
+++ b/hotspot/src/share/vm/opto/idealKit.hpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2011, 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,7 @@ class IdealKit: public StackObj {
bool _delay_all_transforms; // flag forcing all transforms to be delayed
Node* _initial_ctrl; // saves initial control until variables declared
Node* _initial_memory; // saves initial memory until variables declared
+ Node* _initial_i_o; // saves initial i_o until variables declared
PhaseGVN& gvn() const { return _gvn; }
// Create a new cvstate filled with nulls
@@ -142,17 +143,21 @@ class IdealKit: public StackObj {
Node* memory(uint alias_idx);
public:
- IdealKit(PhaseGVN &gvn, Node* control, Node* memory, bool delay_all_transforms = false, bool has_declarations = false);
+ IdealKit(GraphKit* gkit, bool delay_all_transforms = false, bool has_declarations = false);
~IdealKit() {
stop();
drain_delay_transform();
}
+ void sync_kit(GraphKit* gkit);
+
// Control
Node* ctrl() { return _cvstate->in(TypeFunc::Control); }
void set_ctrl(Node* ctrl) { _cvstate->set_req(TypeFunc::Control, ctrl); }
Node* top() { return C->top(); }
MergeMemNode* merged_memory() { return _cvstate->in(TypeFunc::Memory)->as_MergeMem(); }
void set_all_memory(Node* mem) { _cvstate->set_req(TypeFunc::Memory, mem); }
+ Node* i_o() { return _cvstate->in(TypeFunc::I_O); }
+ void set_i_o(Node* c) { _cvstate->set_req(TypeFunc::I_O, c); }
void set(IdealVariable& v, Node* rhs) { _cvstate->set_req(first_var + v.id(), rhs); }
Node* value(IdealVariable& v) { return _cvstate->in(first_var + v.id()); }
void dead(IdealVariable& v) { set(v, (Node*)NULL); }
@@ -239,7 +244,18 @@ class IdealKit: public StackObj {
const char *leaf_name,
Node* parm0,
Node* parm1 = NULL,
- Node* parm2 = NULL);
+ Node* parm2 = NULL,
+ Node* parm3 = NULL);
+
+ void make_leaf_call_no_fp(const TypeFunc *slow_call_type,
+ address slow_call,
+ const char *leaf_name,
+ const TypePtr* adr_type,
+ Node* parm0,
+ Node* parm1,
+ Node* parm2,
+ Node* parm3);
+
};
#endif // SHARE_VM_OPTO_IDEALKIT_HPP
diff --git a/hotspot/src/share/vm/opto/ifnode.cpp b/hotspot/src/share/vm/opto/ifnode.cpp
index 25f2e315190..bcdf5ad640d 100644
--- a/hotspot/src/share/vm/opto/ifnode.cpp
+++ b/hotspot/src/share/vm/opto/ifnode.cpp
@@ -27,6 +27,7 @@
#include "opto/addnode.hpp"
#include "opto/cfgnode.hpp"
#include "opto/connode.hpp"
+#include "opto/loopnode.hpp"
#include "opto/phaseX.hpp"
#include "opto/runtime.hpp"
#include "opto/subnode.hpp"
@@ -222,22 +223,35 @@ static Node* split_if(IfNode *iff, PhaseIterGVN *igvn) {
// Make a region merging constants and a region merging the rest
uint req_c = 0;
+ Node* predicate_proj = NULL;
for (uint ii = 1; ii < r->req(); ii++) {
- if( phi->in(ii) == con1 ) {
+ if (phi->in(ii) == con1) {
req_c++;
}
+ Node* proj = PhaseIdealLoop::find_predicate(r->in(ii));
+ if (proj != NULL) {
+ assert(predicate_proj == NULL, "only one predicate entry expected");
+ predicate_proj = proj;
+ }
}
+ Node* predicate_c = NULL;
+ Node* predicate_x = NULL;
+
Node *region_c = new (igvn->C, req_c + 1) RegionNode(req_c + 1);
Node *phi_c = con1;
uint len = r->req();
- Node *region_x = new (igvn->C, len - req_c + 1) RegionNode(len - req_c + 1);
+ Node *region_x = new (igvn->C, len - req_c) RegionNode(len - req_c);
Node *phi_x = PhiNode::make_blank(region_x, phi);
for (uint i = 1, i_c = 1, i_x = 1; i < len; i++) {
- if( phi->in(i) == con1 ) {
+ if (phi->in(i) == con1) {
region_c->init_req( i_c++, r ->in(i) );
+ if (r->in(i) == predicate_proj)
+ predicate_c = predicate_proj;
} else {
region_x->init_req( i_x, r ->in(i) );
phi_x ->init_req( i_x++, phi->in(i) );
+ if (r->in(i) == predicate_proj)
+ predicate_x = predicate_proj;
}
}
@@ -277,8 +291,20 @@ static Node* split_if(IfNode *iff, PhaseIterGVN *igvn) {
// Make the true/false arms
Node *iff_c_t = phase->transform(new (igvn->C, 1) IfTrueNode (iff_c));
Node *iff_c_f = phase->transform(new (igvn->C, 1) IfFalseNode(iff_c));
+ if (predicate_c != NULL) {
+ assert(predicate_x == NULL, "only one predicate entry expected");
+ // Clone loop predicates to each path
+ iff_c_t = igvn->clone_loop_predicates(predicate_c, iff_c_t);
+ iff_c_f = igvn->clone_loop_predicates(predicate_c, iff_c_f);
+ }
Node *iff_x_t = phase->transform(new (igvn->C, 1) IfTrueNode (iff_x));
Node *iff_x_f = phase->transform(new (igvn->C, 1) IfFalseNode(iff_x));
+ if (predicate_x != NULL) {
+ assert(predicate_c == NULL, "only one predicate entry expected");
+ // Clone loop predicates to each path
+ iff_x_t = igvn->clone_loop_predicates(predicate_x, iff_x_t);
+ iff_x_f = igvn->clone_loop_predicates(predicate_x, iff_x_f);
+ }
// Merge the TRUE paths
Node *region_s = new (igvn->C, 3) RegionNode(3);
diff --git a/hotspot/src/share/vm/opto/lcm.cpp b/hotspot/src/share/vm/opto/lcm.cpp
index 3d84f6baf76..1767bce2d00 100644
--- a/hotspot/src/share/vm/opto/lcm.cpp
+++ b/hotspot/src/share/vm/opto/lcm.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1998, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 2011, 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,9 @@
#ifdef TARGET_ARCH_MODEL_zero
# include "adfiles/ad_zero.hpp"
#endif
+#ifdef TARGET_ARCH_MODEL_arm
+# include "adfiles/ad_arm.hpp"
+#endif
// Optimization - Graph Style
diff --git a/hotspot/src/share/vm/opto/library_call.cpp b/hotspot/src/share/vm/opto/library_call.cpp
index 024955215e6..0f73e144d17 100644
--- a/hotspot/src/share/vm/opto/library_call.cpp
+++ b/hotspot/src/share/vm/opto/library_call.cpp
@@ -25,6 +25,7 @@
#include "precompiled.hpp"
#include "classfile/systemDictionary.hpp"
#include "classfile/vmSymbols.hpp"
+#include "compiler/compileBroker.hpp"
#include "compiler/compileLog.hpp"
#include "oops/objArrayKlass.hpp"
#include "opto/addnode.hpp"
@@ -388,11 +389,7 @@ JVMState* LibraryIntrinsic::generate(JVMState* jvms) {
#endif
if (kit.try_to_inline()) {
if (PrintIntrinsics || PrintInlining NOT_PRODUCT( || PrintOptoInlining) ) {
- tty->print("Inlining intrinsic %s%s at bci:%d in",
- vmIntrinsics::name_at(intrinsic_id()),
- (is_virtual() ? " (virtual)" : ""), kit.bci());
- kit.caller()->print_short_name(tty);
- tty->print_cr(" (%d bytes)", kit.caller()->code_size());
+ CompileTask::print_inlining(kit.callee(), jvms->depth() - 1, kit.bci(), is_virtual() ? "(intrinsic, virtual)" : "(intrinsic)");
}
C->gather_intrinsic_statistics(intrinsic_id(), is_virtual(), Compile::_intrinsic_worked);
if (C->log()) {
@@ -1123,7 +1120,7 @@ Node* LibraryCallKit::string_indexOf(Node* string_object, ciTypeArray* target_ar
const TypeAry* target_array_type = TypeAry::make(TypeInt::CHAR, TypeInt::make(0, target_length, Type::WidenMin));
const TypeAryPtr* target_type = TypeAryPtr::make(TypePtr::BotPTR, target_array_type, target_array->klass(), true, Type::OffsetBot);
- IdealKit kit(gvn(), control(), merged_memory(), false, true);
+ IdealKit kit(this, false, true);
#define __ kit.
Node* zero = __ ConI(0);
Node* one = __ ConI(1);
@@ -1174,7 +1171,7 @@ Node* LibraryCallKit::string_indexOf(Node* string_object, ciTypeArray* target_ar
__ bind(return_);
// Final sync IdealKit and GraphKit.
- sync_kit(kit);
+ final_sync(kit);
Node* result = __ value(rtn);
#undef __
C->set_has_loops(true);
@@ -2321,22 +2318,20 @@ bool LibraryCallKit::inline_unsafe_access(bool is_native_ptr, bool is_store, Bas
// of it. So we need to emit code to conditionally do the proper type of
// store.
- IdealKit ideal(gvn(), control(), merged_memory());
+ IdealKit ideal(this);
#define __ ideal.
// QQQ who knows what probability is here??
__ if_then(heap_base_oop, BoolTest::ne, null(), PROB_UNLIKELY(0.999)); {
// Sync IdealKit and graphKit.
- set_all_memory( __ merged_memory());
- set_control(__ ctrl());
+ sync_kit(ideal);
Node* st = store_oop_to_unknown(control(), heap_base_oop, adr, adr_type, val, type);
// Update IdealKit memory.
- __ set_all_memory(merged_memory());
- __ set_ctrl(control());
+ __ sync_kit(this);
} __ else_(); {
__ store(__ ctrl(), adr, val, type, alias_type->index(), is_volatile);
} __ end_if();
// Final sync IdealKit and GraphKit.
- sync_kit(ideal);
+ final_sync(ideal);
#undef __
}
}
@@ -4297,81 +4292,6 @@ bool LibraryCallKit::inline_native_clone(bool is_virtual) {
return true;
}
-
-// constants for computing the copy function
-enum {
- COPYFUNC_UNALIGNED = 0,
- COPYFUNC_ALIGNED = 1, // src, dest aligned to HeapWordSize
- COPYFUNC_CONJOINT = 0,
- COPYFUNC_DISJOINT = 2 // src != dest, or transfer can descend
-};
-
-// Note: The condition "disjoint" applies also for overlapping copies
-// where an descending copy is permitted (i.e., dest_offset <= src_offset).
-static address
-select_arraycopy_function(BasicType t, bool aligned, bool disjoint, const char* &name, bool dest_uninitialized) {
- int selector =
- (aligned ? COPYFUNC_ALIGNED : COPYFUNC_UNALIGNED) +
- (disjoint ? COPYFUNC_DISJOINT : COPYFUNC_CONJOINT);
-
-#define RETURN_STUB(xxx_arraycopy) { \
- name = #xxx_arraycopy; \
- return StubRoutines::xxx_arraycopy(); }
-
-#define RETURN_STUB_PARM(xxx_arraycopy, parm) { \
- name = #xxx_arraycopy; \
- return StubRoutines::xxx_arraycopy(parm); }
-
- switch (t) {
- case T_BYTE:
- case T_BOOLEAN:
- switch (selector) {
- case COPYFUNC_CONJOINT | COPYFUNC_UNALIGNED: RETURN_STUB(jbyte_arraycopy);
- case COPYFUNC_CONJOINT | COPYFUNC_ALIGNED: RETURN_STUB(arrayof_jbyte_arraycopy);
- case COPYFUNC_DISJOINT | COPYFUNC_UNALIGNED: RETURN_STUB(jbyte_disjoint_arraycopy);
- case COPYFUNC_DISJOINT | COPYFUNC_ALIGNED: RETURN_STUB(arrayof_jbyte_disjoint_arraycopy);
- }
- case T_CHAR:
- case T_SHORT:
- switch (selector) {
- case COPYFUNC_CONJOINT | COPYFUNC_UNALIGNED: RETURN_STUB(jshort_arraycopy);
- case COPYFUNC_CONJOINT | COPYFUNC_ALIGNED: RETURN_STUB(arrayof_jshort_arraycopy);
- case COPYFUNC_DISJOINT | COPYFUNC_UNALIGNED: RETURN_STUB(jshort_disjoint_arraycopy);
- case COPYFUNC_DISJOINT | COPYFUNC_ALIGNED: RETURN_STUB(arrayof_jshort_disjoint_arraycopy);
- }
- case T_INT:
- case T_FLOAT:
- switch (selector) {
- case COPYFUNC_CONJOINT | COPYFUNC_UNALIGNED: RETURN_STUB(jint_arraycopy);
- case COPYFUNC_CONJOINT | COPYFUNC_ALIGNED: RETURN_STUB(arrayof_jint_arraycopy);
- case COPYFUNC_DISJOINT | COPYFUNC_UNALIGNED: RETURN_STUB(jint_disjoint_arraycopy);
- case COPYFUNC_DISJOINT | COPYFUNC_ALIGNED: RETURN_STUB(arrayof_jint_disjoint_arraycopy);
- }
- case T_DOUBLE:
- case T_LONG:
- switch (selector) {
- case COPYFUNC_CONJOINT | COPYFUNC_UNALIGNED: RETURN_STUB(jlong_arraycopy);
- case COPYFUNC_CONJOINT | COPYFUNC_ALIGNED: RETURN_STUB(arrayof_jlong_arraycopy);
- case COPYFUNC_DISJOINT | COPYFUNC_UNALIGNED: RETURN_STUB(jlong_disjoint_arraycopy);
- case COPYFUNC_DISJOINT | COPYFUNC_ALIGNED: RETURN_STUB(arrayof_jlong_disjoint_arraycopy);
- }
- case T_ARRAY:
- case T_OBJECT:
- switch (selector) {
- case COPYFUNC_CONJOINT | COPYFUNC_UNALIGNED: RETURN_STUB_PARM(oop_arraycopy, dest_uninitialized);
- case COPYFUNC_CONJOINT | COPYFUNC_ALIGNED: RETURN_STUB_PARM(arrayof_oop_arraycopy, dest_uninitialized);
- case COPYFUNC_DISJOINT | COPYFUNC_UNALIGNED: RETURN_STUB_PARM(oop_disjoint_arraycopy, dest_uninitialized);
- case COPYFUNC_DISJOINT | COPYFUNC_ALIGNED: RETURN_STUB_PARM(arrayof_oop_disjoint_arraycopy, dest_uninitialized);
- }
- default:
- ShouldNotReachHere();
- return NULL;
- }
-
-#undef RETURN_STUB
-#undef RETURN_STUB_PARM
-}
-
//------------------------------basictype2arraycopy----------------------------
address LibraryCallKit::basictype2arraycopy(BasicType t,
Node* src_offset,
@@ -4404,7 +4324,7 @@ address LibraryCallKit::basictype2arraycopy(BasicType t,
disjoint = true;
}
- return select_arraycopy_function(t, aligned, disjoint, name, dest_uninitialized);
+ return StubRoutines::select_arraycopy_function(t, aligned, disjoint, name, dest_uninitialized);
}
diff --git a/hotspot/src/share/vm/opto/locknode.hpp b/hotspot/src/share/vm/opto/locknode.hpp
index 64a1027a73c..05630e22d4a 100644
--- a/hotspot/src/share/vm/opto/locknode.hpp
+++ b/hotspot/src/share/vm/opto/locknode.hpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2011, 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
diff --git a/hotspot/src/share/vm/opto/loopPredicate.cpp b/hotspot/src/share/vm/opto/loopPredicate.cpp
new file mode 100644
index 00000000000..c5ac2c68200
--- /dev/null
+++ b/hotspot/src/share/vm/opto/loopPredicate.cpp
@@ -0,0 +1,960 @@
+/*
+ * Copyright (c) 2011, 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.
+ *
+ */
+
+#include "precompiled.hpp"
+#include "opto/loopnode.hpp"
+#include "opto/addnode.hpp"
+#include "opto/callnode.hpp"
+#include "opto/connode.hpp"
+#include "opto/loopnode.hpp"
+#include "opto/mulnode.hpp"
+#include "opto/rootnode.hpp"
+#include "opto/subnode.hpp"
+
+/*
+ * The general idea of Loop Predication is to insert a predicate on the entry
+ * path to a loop, and raise a uncommon trap if the check of the condition fails.
+ * The condition checks are promoted from inside the loop body, and thus
+ * the checks inside the loop could be eliminated. Currently, loop predication
+ * optimization has been applied to remove array range check and loop invariant
+ * checks (such as null checks).
+*/
+
+//-------------------------------is_uncommon_trap_proj----------------------------
+// Return true if proj is the form of "proj->[region->..]call_uct"
+bool PhaseIdealLoop::is_uncommon_trap_proj(ProjNode* proj, Deoptimization::DeoptReason reason) {
+ int path_limit = 10;
+ assert(proj, "invalid argument");
+ Node* out = proj;
+ for (int ct = 0; ct < path_limit; ct++) {
+ out = out->unique_ctrl_out();
+ if (out == NULL)
+ return false;
+ if (out->is_CallStaticJava()) {
+ int req = out->as_CallStaticJava()->uncommon_trap_request();
+ if (req != 0) {
+ Deoptimization::DeoptReason trap_reason = Deoptimization::trap_request_reason(req);
+ if (trap_reason == reason || reason == Deoptimization::Reason_none) {
+ return true;
+ }
+ }
+ return false; // don't do further after call
+ }
+ if (out->Opcode() != Op_Region)
+ return false;
+ }
+ return false;
+}
+
+//-------------------------------is_uncommon_trap_if_pattern-------------------------
+// Return true for "if(test)-> proj -> ...
+// |
+// V
+// other_proj->[region->..]call_uct"
+//
+// "must_reason_predicate" means the uct reason must be Reason_predicate
+bool PhaseIdealLoop::is_uncommon_trap_if_pattern(ProjNode *proj, Deoptimization::DeoptReason reason) {
+ Node *in0 = proj->in(0);
+ if (!in0->is_If()) return false;
+ // Variation of a dead If node.
+ if (in0->outcnt() < 2) return false;
+ IfNode* iff = in0->as_If();
+
+ // we need "If(Conv2B(Opaque1(...)))" pattern for reason_predicate
+ if (reason != Deoptimization::Reason_none) {
+ if (iff->in(1)->Opcode() != Op_Conv2B ||
+ iff->in(1)->in(1)->Opcode() != Op_Opaque1) {
+ return false;
+ }
+ }
+
+ ProjNode* other_proj = iff->proj_out(1-proj->_con)->as_Proj();
+ if (is_uncommon_trap_proj(other_proj, reason)) {
+ assert(reason == Deoptimization::Reason_none ||
+ Compile::current()->is_predicate_opaq(iff->in(1)->in(1)), "should be on the list");
+ return true;
+ }
+ return false;
+}
+
+//-------------------------------register_control-------------------------
+void PhaseIdealLoop::register_control(Node* n, IdealLoopTree *loop, Node* pred) {
+ assert(n->is_CFG(), "must be control node");
+ _igvn.register_new_node_with_optimizer(n);
+ loop->_body.push(n);
+ set_loop(n, loop);
+ // When called from beautify_loops() idom is not constructed yet.
+ if (_idom != NULL) {
+ set_idom(n, pred, dom_depth(pred));
+ }
+}
+
+//------------------------------create_new_if_for_predicate------------------------
+// create a new if above the uct_if_pattern for the predicate to be promoted.
+//
+// before after
+// ---------- ----------
+// ctrl ctrl
+// | |
+// | |
+// v v
+// iff new_iff
+// / \ / \
+// / \ / \
+// v v v v
+// uncommon_proj cont_proj if_uct if_cont
+// \ | | | |
+// \ | | | |
+// v v v | v
+// rgn loop | iff
+// | | / \
+// | | / \
+// v | v v
+// uncommon_trap | uncommon_proj cont_proj
+// \ \ | |
+// \ \ | |
+// v v v v
+// rgn loop
+// |
+// |
+// v
+// uncommon_trap
+//
+//
+// We will create a region to guard the uct call if there is no one there.
+// The true projecttion (if_cont) of the new_iff is returned.
+// This code is also used to clone predicates to clonned loops.
+ProjNode* PhaseIdealLoop::create_new_if_for_predicate(ProjNode* cont_proj, Node* new_entry,
+ Deoptimization::DeoptReason reason) {
+ assert(is_uncommon_trap_if_pattern(cont_proj, reason), "must be a uct if pattern!");
+ IfNode* iff = cont_proj->in(0)->as_If();
+
+ ProjNode *uncommon_proj = iff->proj_out(1 - cont_proj->_con);
+ Node *rgn = uncommon_proj->unique_ctrl_out();
+ assert(rgn->is_Region() || rgn->is_Call(), "must be a region or call uct");
+
+ uint proj_index = 1; // region's edge corresponding to uncommon_proj
+ if (!rgn->is_Region()) { // create a region to guard the call
+ assert(rgn->is_Call(), "must be call uct");
+ CallNode* call = rgn->as_Call();
+ IdealLoopTree* loop = get_loop(call);
+ rgn = new (C, 1) RegionNode(1);
+ rgn->add_req(uncommon_proj);
+ register_control(rgn, loop, uncommon_proj);
+ _igvn.hash_delete(call);
+ call->set_req(0, rgn);
+ // When called from beautify_loops() idom is not constructed yet.
+ if (_idom != NULL) {
+ set_idom(call, rgn, dom_depth(rgn));
+ }
+ } else {
+ // Find region's edge corresponding to uncommon_proj
+ for (; proj_index < rgn->req(); proj_index++)
+ if (rgn->in(proj_index) == uncommon_proj) break;
+ assert(proj_index < rgn->req(), "sanity");
+ }
+
+ Node* entry = iff->in(0);
+ if (new_entry != NULL) {
+ // Clonning the predicate to new location.
+ entry = new_entry;
+ }
+ // Create new_iff
+ IdealLoopTree* lp = get_loop(entry);
+ IfNode *new_iff = iff->clone()->as_If();
+ new_iff->set_req(0, entry);
+ register_control(new_iff, lp, entry);
+ Node *if_cont = new (C, 1) IfTrueNode(new_iff);
+ Node *if_uct = new (C, 1) IfFalseNode(new_iff);
+ if (cont_proj->is_IfFalse()) {
+ // Swap
+ Node* tmp = if_uct; if_uct = if_cont; if_cont = tmp;
+ }
+ register_control(if_cont, lp, new_iff);
+ register_control(if_uct, get_loop(rgn), new_iff);
+
+ // if_uct to rgn
+ _igvn.hash_delete(rgn);
+ rgn->add_req(if_uct);
+ // When called from beautify_loops() idom is not constructed yet.
+ if (_idom != NULL) {
+ Node* ridom = idom(rgn);
+ Node* nrdom = dom_lca(ridom, new_iff);
+ set_idom(rgn, nrdom, dom_depth(rgn));
+ }
+
+ // If rgn has phis add new edges which has the same
+ // value as on original uncommon_proj pass.
+ assert(rgn->in(rgn->req() -1) == if_uct, "new edge should be last");
+ bool has_phi = false;
+ for (DUIterator_Fast imax, i = rgn->fast_outs(imax); i < imax; i++) {
+ Node* use = rgn->fast_out(i);
+ if (use->is_Phi() && use->outcnt() > 0) {
+ assert(use->in(0) == rgn, "");
+ _igvn.hash_delete(use);
+ use->add_req(use->in(proj_index));
+ _igvn._worklist.push(use);
+ has_phi = true;
+ }
+ }
+ assert(!has_phi || rgn->req() > 3, "no phis when region is created");
+
+ if (new_entry == NULL) {
+ // Attach if_cont to iff
+ _igvn.hash_delete(iff);
+ iff->set_req(0, if_cont);
+ if (_idom != NULL) {
+ set_idom(iff, if_cont, dom_depth(iff));
+ }
+ }
+ return if_cont->as_Proj();
+}
+
+//------------------------------create_new_if_for_predicate------------------------
+// Create a new if below new_entry for the predicate to be cloned (IGVN optimization)
+ProjNode* PhaseIterGVN::create_new_if_for_predicate(ProjNode* cont_proj, Node* new_entry,
+ Deoptimization::DeoptReason reason) {
+ assert(new_entry != 0, "only used for clone predicate");
+ assert(PhaseIdealLoop::is_uncommon_trap_if_pattern(cont_proj, reason), "must be a uct if pattern!");
+ IfNode* iff = cont_proj->in(0)->as_If();
+
+ ProjNode *uncommon_proj = iff->proj_out(1 - cont_proj->_con);
+ Node *rgn = uncommon_proj->unique_ctrl_out();
+ assert(rgn->is_Region() || rgn->is_Call(), "must be a region or call uct");
+
+ uint proj_index = 1; // region's edge corresponding to uncommon_proj
+ if (!rgn->is_Region()) { // create a region to guard the call
+ assert(rgn->is_Call(), "must be call uct");
+ CallNode* call = rgn->as_Call();
+ rgn = new (C, 1) RegionNode(1);
+ register_new_node_with_optimizer(rgn);
+ rgn->add_req(uncommon_proj);
+ hash_delete(call);
+ call->set_req(0, rgn);
+ } else {
+ // Find region's edge corresponding to uncommon_proj
+ for (; proj_index < rgn->req(); proj_index++)
+ if (rgn->in(proj_index) == uncommon_proj) break;
+ assert(proj_index < rgn->req(), "sanity");
+ }
+
+ // Create new_iff in new location.
+ IfNode *new_iff = iff->clone()->as_If();
+ new_iff->set_req(0, new_entry);
+
+ register_new_node_with_optimizer(new_iff);
+ Node *if_cont = new (C, 1) IfTrueNode(new_iff);
+ Node *if_uct = new (C, 1) IfFalseNode(new_iff);
+ if (cont_proj->is_IfFalse()) {
+ // Swap
+ Node* tmp = if_uct; if_uct = if_cont; if_cont = tmp;
+ }
+ register_new_node_with_optimizer(if_cont);
+ register_new_node_with_optimizer(if_uct);
+
+ // if_uct to rgn
+ hash_delete(rgn);
+ rgn->add_req(if_uct);
+
+ // If rgn has phis add corresponding new edges which has the same
+ // value as on original uncommon_proj pass.
+ assert(rgn->in(rgn->req() -1) == if_uct, "new edge should be last");
+ bool has_phi = false;
+ for (DUIterator_Fast imax, i = rgn->fast_outs(imax); i < imax; i++) {
+ Node* use = rgn->fast_out(i);
+ if (use->is_Phi() && use->outcnt() > 0) {
+ hash_delete(use);
+ use->add_req(use->in(proj_index));
+ _worklist.push(use);
+ has_phi = true;
+ }
+ }
+ assert(!has_phi || rgn->req() > 3, "no phis when region is created");
+
+ return if_cont->as_Proj();
+}
+
+//--------------------------clone_predicate-----------------------
+ProjNode* PhaseIdealLoop::clone_predicate(ProjNode* predicate_proj, Node* new_entry,
+ Deoptimization::DeoptReason reason,
+ PhaseIdealLoop* loop_phase,
+ PhaseIterGVN* igvn) {
+ ProjNode* new_predicate_proj;
+ if (loop_phase != NULL) {
+ new_predicate_proj = loop_phase->create_new_if_for_predicate(predicate_proj, new_entry, reason);
+ } else {
+ new_predicate_proj = igvn->create_new_if_for_predicate(predicate_proj, new_entry, reason);
+ }
+ IfNode* iff = new_predicate_proj->in(0)->as_If();
+ Node* ctrl = iff->in(0);
+
+ // Match original condition since predicate's projections could be swapped.
+ assert(predicate_proj->in(0)->in(1)->in(1)->Opcode()==Op_Opaque1, "must be");
+ Node* opq = new (igvn->C, 2) Opaque1Node(igvn->C, predicate_proj->in(0)->in(1)->in(1)->in(1));
+ igvn->C->add_predicate_opaq(opq);
+
+ Node* bol = new (igvn->C, 2) Conv2BNode(opq);
+ if (loop_phase != NULL) {
+ loop_phase->register_new_node(opq, ctrl);
+ loop_phase->register_new_node(bol, ctrl);
+ } else {
+ igvn->register_new_node_with_optimizer(opq);
+ igvn->register_new_node_with_optimizer(bol);
+ }
+ igvn->hash_delete(iff);
+ iff->set_req(1, bol);
+ return new_predicate_proj;
+}
+
+//--------------------------move_predicate-----------------------
+// Cut predicate from old place and move it to new.
+ProjNode* PhaseIdealLoop::move_predicate(ProjNode* predicate_proj, Node* new_entry,
+ Deoptimization::DeoptReason reason,
+ PhaseIdealLoop* loop_phase,
+ PhaseIterGVN* igvn) {
+ assert(new_entry != NULL, "must be");
+ assert(predicate_proj->in(0)->in(1)->in(1)->Opcode()==Op_Opaque1, "must be");
+ IfNode* iff = predicate_proj->in(0)->as_If();
+ Node* old_entry = iff->in(0);
+
+ // Cut predicate from old place.
+ Node* old = predicate_proj;
+ igvn->_worklist.push(old);
+ for (DUIterator_Last imin, i = old->last_outs(imin); i >= imin; ) {
+ Node* use = old->last_out(i); // for each use...
+ igvn->hash_delete(use);
+ igvn->_worklist.push(use);
+ // Update use-def info
+ uint uses_found = 0;
+ for (uint j = 0; j < use->req(); j++) {
+ if (use->in(j) == old) {
+ use->set_req(j, old_entry);
+ uses_found++;
+ if (loop_phase != NULL) {
+ if (use->is_CFG()) {
+ // When called from beautify_loops() idom is not constructed yet.
+ if (loop_phase->_idom != NULL)
+ loop_phase->set_idom(use, old_entry, loop_phase->dom_depth(use));
+ } else {
+ loop_phase->set_ctrl(use, old_entry);
+ }
+ }
+ }
+ }
+ i -= uses_found; // we deleted 1 or more copies of this edge
+ }
+
+ // Move predicate.
+ igvn->hash_delete(iff);
+ iff->set_req(0, new_entry);
+ igvn->_worklist.push(iff);
+
+ if (loop_phase != NULL) {
+ // Fix up idom and ctrl.
+ loop_phase->set_ctrl(iff->in(1), new_entry);
+ loop_phase->set_ctrl(iff->in(1)->in(1), new_entry);
+ // When called from beautify_loops() idom is not constructed yet.
+ if (loop_phase->_idom != NULL)
+ loop_phase->set_idom(iff, new_entry, loop_phase->dom_depth(iff));
+ }
+
+ return predicate_proj;
+}
+
+//--------------------------clone_loop_predicates-----------------------
+// Interface from IGVN
+Node* PhaseIterGVN::clone_loop_predicates(Node* old_entry, Node* new_entry) {
+ return PhaseIdealLoop::clone_loop_predicates(old_entry, new_entry, false, NULL, this);
+}
+Node* PhaseIterGVN::move_loop_predicates(Node* old_entry, Node* new_entry) {
+ return PhaseIdealLoop::clone_loop_predicates(old_entry, new_entry, true, NULL, this);
+}
+
+// Interface from PhaseIdealLoop
+Node* PhaseIdealLoop::clone_loop_predicates(Node* old_entry, Node* new_entry) {
+ return clone_loop_predicates(old_entry, new_entry, false, this, &this->_igvn);
+}
+Node* PhaseIdealLoop::move_loop_predicates(Node* old_entry, Node* new_entry) {
+ return clone_loop_predicates(old_entry, new_entry, true, this, &this->_igvn);
+}
+
+// Clone loop predicates to cloned loops (peeled, unswitched, split_if).
+Node* PhaseIdealLoop::clone_loop_predicates(Node* old_entry, Node* new_entry,
+ bool move_predicates,
+ PhaseIdealLoop* loop_phase,
+ PhaseIterGVN* igvn) {
+#ifdef ASSERT
+ if (new_entry == NULL || !(new_entry->is_Proj() || new_entry->is_Region() || new_entry->is_SafePoint())) {
+ if (new_entry != NULL)
+ new_entry->dump();
+ assert(false, "not IfTrue, IfFalse, Region or SafePoint");
+ }
+#endif
+ // Search original predicates
+ Node* entry = old_entry;
+ if (UseLoopPredicate) {
+ ProjNode* predicate_proj = find_predicate_insertion_point(entry, Deoptimization::Reason_predicate);
+ if (predicate_proj != NULL) { // right pattern that can be used by loop predication
+ assert(entry->in(0)->in(1)->in(1)->Opcode()==Op_Opaque1, "must be");
+ if (move_predicates) {
+ new_entry = move_predicate(predicate_proj, new_entry,
+ Deoptimization::Reason_predicate,
+ loop_phase, igvn);
+ assert(new_entry == predicate_proj, "old predicate fall through projection");
+ } else {
+ // clone predicate
+ new_entry = clone_predicate(predicate_proj, new_entry,
+ Deoptimization::Reason_predicate,
+ loop_phase, igvn);
+ assert(new_entry != NULL && new_entry->is_Proj(), "IfTrue or IfFalse after clone predicate");
+ }
+ if (TraceLoopPredicate) {
+ tty->print_cr("Loop Predicate %s: ", move_predicates ? "moved" : "cloned");
+ debug_only( new_entry->in(0)->dump(); )
+ }
+ }
+ }
+ return new_entry;
+}
+
+//--------------------------eliminate_loop_predicates-----------------------
+void PhaseIdealLoop::eliminate_loop_predicates(Node* entry) {
+ if (UseLoopPredicate) {
+ ProjNode* predicate_proj = find_predicate_insertion_point(entry, Deoptimization::Reason_predicate);
+ if (predicate_proj != NULL) { // right pattern that can be used by loop predication
+ Node* n = entry->in(0)->in(1)->in(1);
+ assert(n->Opcode()==Op_Opaque1, "must be");
+ // Remove Opaque1 node from predicates list.
+ // IGVN will remove this predicate check.
+ _igvn.replace_node(n, n->in(1));
+ }
+ }
+}
+
+//--------------------------skip_loop_predicates------------------------------
+// Skip related predicates.
+Node* PhaseIdealLoop::skip_loop_predicates(Node* entry) {
+ Node* predicate = NULL;
+ if (UseLoopPredicate) {
+ predicate = find_predicate_insertion_point(entry, Deoptimization::Reason_predicate);
+ if (predicate != NULL) { // right pattern that can be used by loop predication
+ assert(entry->is_Proj() && entry->in(0)->in(1)->in(1)->Opcode()==Op_Opaque1, "must be");
+ IfNode* iff = entry->in(0)->as_If();
+ ProjNode* uncommon_proj = iff->proj_out(1 - entry->as_Proj()->_con);
+ Node* rgn = uncommon_proj->unique_ctrl_out();
+ assert(rgn->is_Region() || rgn->is_Call(), "must be a region or call uct");
+ entry = entry->in(0)->in(0);
+ while (entry != NULL && entry->is_Proj() && entry->in(0)->is_If()) {
+ uncommon_proj = entry->in(0)->as_If()->proj_out(1 - entry->as_Proj()->_con);
+ if (uncommon_proj->unique_ctrl_out() != rgn)
+ break;
+ entry = entry->in(0)->in(0);
+ }
+ }
+ }
+ return entry;
+}
+
+//--------------------------find_predicate_insertion_point-------------------
+// Find a good location to insert a predicate
+ProjNode* PhaseIdealLoop::find_predicate_insertion_point(Node* start_c, Deoptimization::DeoptReason reason) {
+ if (start_c == NULL || !start_c->is_Proj())
+ return NULL;
+ if (is_uncommon_trap_if_pattern(start_c->as_Proj(), reason)) {
+ return start_c->as_Proj();
+ }
+ return NULL;
+}
+
+//--------------------------find_predicate------------------------------------
+// Find a predicate
+Node* PhaseIdealLoop::find_predicate(Node* entry) {
+ Node* predicate = NULL;
+ if (UseLoopPredicate) {
+ predicate = find_predicate_insertion_point(entry, Deoptimization::Reason_predicate);
+ if (predicate != NULL) { // right pattern that can be used by loop predication
+ assert(entry->in(0)->in(1)->in(1)->Opcode()==Op_Opaque1, "must be");
+ return entry;
+ }
+ }
+ return NULL;
+}
+
+//------------------------------Invariance-----------------------------------
+// Helper class for loop_predication_impl to compute invariance on the fly and
+// clone invariants.
+class Invariance : public StackObj {
+ VectorSet _visited, _invariant;
+ Node_Stack _stack;
+ VectorSet _clone_visited;
+ Node_List _old_new; // map of old to new (clone)
+ IdealLoopTree* _lpt;
+ PhaseIdealLoop* _phase;
+
+ // Helper function to set up the invariance for invariance computation
+ // If n is a known invariant, set up directly. Otherwise, look up the
+ // the possibility to push n onto the stack for further processing.
+ void visit(Node* use, Node* n) {
+ if (_lpt->is_invariant(n)) { // known invariant
+ _invariant.set(n->_idx);
+ } else if (!n->is_CFG()) {
+ Node *n_ctrl = _phase->ctrl_or_self(n);
+ Node *u_ctrl = _phase->ctrl_or_self(use); // self if use is a CFG
+ if (_phase->is_dominator(n_ctrl, u_ctrl)) {
+ _stack.push(n, n->in(0) == NULL ? 1 : 0);
+ }
+ }
+ }
+
+ // Compute invariance for "the_node" and (possibly) all its inputs recursively
+ // on the fly
+ void compute_invariance(Node* n) {
+ assert(_visited.test(n->_idx), "must be");
+ visit(n, n);
+ while (_stack.is_nonempty()) {
+ Node* n = _stack.node();
+ uint idx = _stack.index();
+ if (idx == n->req()) { // all inputs are processed
+ _stack.pop();
+ // n is invariant if it's inputs are all invariant
+ bool all_inputs_invariant = true;
+ for (uint i = 0; i < n->req(); i++) {
+ Node* in = n->in(i);
+ if (in == NULL) continue;
+ assert(_visited.test(in->_idx), "must have visited input");
+ if (!_invariant.test(in->_idx)) { // bad guy
+ all_inputs_invariant = false;
+ break;
+ }
+ }
+ if (all_inputs_invariant) {
+ _invariant.set(n->_idx); // I am a invariant too
+ }
+ } else { // process next input
+ _stack.set_index(idx + 1);
+ Node* m = n->in(idx);
+ if (m != NULL && !_visited.test_set(m->_idx)) {
+ visit(n, m);
+ }
+ }
+ }
+ }
+
+ // Helper function to set up _old_new map for clone_nodes.
+ // If n is a known invariant, set up directly ("clone" of n == n).
+ // Otherwise, push n onto the stack for real cloning.
+ void clone_visit(Node* n) {
+ assert(_invariant.test(n->_idx), "must be invariant");
+ if (_lpt->is_invariant(n)) { // known invariant
+ _old_new.map(n->_idx, n);
+ } else { // to be cloned
+ assert(!n->is_CFG(), "should not see CFG here");
+ _stack.push(n, n->in(0) == NULL ? 1 : 0);
+ }
+ }
+
+ // Clone "n" and (possibly) all its inputs recursively
+ void clone_nodes(Node* n, Node* ctrl) {
+ clone_visit(n);
+ while (_stack.is_nonempty()) {
+ Node* n = _stack.node();
+ uint idx = _stack.index();
+ if (idx == n->req()) { // all inputs processed, clone n!
+ _stack.pop();
+ // clone invariant node
+ Node* n_cl = n->clone();
+ _old_new.map(n->_idx, n_cl);
+ _phase->register_new_node(n_cl, ctrl);
+ for (uint i = 0; i < n->req(); i++) {
+ Node* in = n_cl->in(i);
+ if (in == NULL) continue;
+ n_cl->set_req(i, _old_new[in->_idx]);
+ }
+ } else { // process next input
+ _stack.set_index(idx + 1);
+ Node* m = n->in(idx);
+ if (m != NULL && !_clone_visited.test_set(m->_idx)) {
+ clone_visit(m); // visit the input
+ }
+ }
+ }
+ }
+
+ public:
+ Invariance(Arena* area, IdealLoopTree* lpt) :
+ _lpt(lpt), _phase(lpt->_phase),
+ _visited(area), _invariant(area), _stack(area, 10 /* guess */),
+ _clone_visited(area), _old_new(area)
+ {}
+
+ // Map old to n for invariance computation and clone
+ void map_ctrl(Node* old, Node* n) {
+ assert(old->is_CFG() && n->is_CFG(), "must be");
+ _old_new.map(old->_idx, n); // "clone" of old is n
+ _invariant.set(old->_idx); // old is invariant
+ _clone_visited.set(old->_idx);
+ }
+
+ // Driver function to compute invariance
+ bool is_invariant(Node* n) {
+ if (!_visited.test_set(n->_idx))
+ compute_invariance(n);
+ return (_invariant.test(n->_idx) != 0);
+ }
+
+ // Driver function to clone invariant
+ Node* clone(Node* n, Node* ctrl) {
+ assert(ctrl->is_CFG(), "must be");
+ assert(_invariant.test(n->_idx), "must be an invariant");
+ if (!_clone_visited.test(n->_idx))
+ clone_nodes(n, ctrl);
+ return _old_new[n->_idx];
+ }
+};
+
+//------------------------------is_range_check_if -----------------------------------
+// Returns true if the predicate of iff is in "scale*iv + offset u< load_range(ptr)" format
+// Note: this function is particularly designed for loop predication. We require load_range
+// and offset to be loop invariant computed on the fly by "invar"
+bool IdealLoopTree::is_range_check_if(IfNode *iff, PhaseIdealLoop *phase, Invariance& invar) const {
+ if (!is_loop_exit(iff)) {
+ return false;
+ }
+ if (!iff->in(1)->is_Bool()) {
+ return false;
+ }
+ const BoolNode *bol = iff->in(1)->as_Bool();
+ if (bol->_test._test != BoolTest::lt) {
+ return false;
+ }
+ if (!bol->in(1)->is_Cmp()) {
+ return false;
+ }
+ const CmpNode *cmp = bol->in(1)->as_Cmp();
+ if (cmp->Opcode() != Op_CmpU) {
+ return false;
+ }
+ Node* range = cmp->in(2);
+ if (range->Opcode() != Op_LoadRange) {
+ const TypeInt* tint = phase->_igvn.type(range)->isa_int();
+ if (!OptimizeFill || tint == NULL || tint->empty() || tint->_lo < 0) {
+ // Allow predication on positive values that aren't LoadRanges.
+ // This allows optimization of loops where the length of the
+ // array is a known value and doesn't need to be loaded back
+ // from the array.
+ return false;
+ }
+ }
+ if (!invar.is_invariant(range)) {
+ return false;
+ }
+ Node *iv = _head->as_CountedLoop()->phi();
+ int scale = 0;
+ Node *offset = NULL;
+ if (!phase->is_scaled_iv_plus_offset(cmp->in(1), iv, &scale, &offset)) {
+ return false;
+ }
+ if (offset && !invar.is_invariant(offset)) { // offset must be invariant
+ return false;
+ }
+ return true;
+}
+
+//------------------------------rc_predicate-----------------------------------
+// Create a range check predicate
+//
+// for (i = init; i < limit; i += stride) {
+// a[scale*i+offset]
+// }
+//
+// Compute max(scale*i + offset) for init <= i < limit and build the predicate
+// as "max(scale*i + offset) u< a.length".
+//
+// There are two cases for max(scale*i + offset):
+// (1) stride*scale > 0
+// max(scale*i + offset) = scale*(limit-stride) + offset
+// (2) stride*scale < 0
+// max(scale*i + offset) = scale*init + offset
+BoolNode* PhaseIdealLoop::rc_predicate(Node* ctrl,
+ int scale, Node* offset,
+ Node* init, Node* limit, Node* stride,
+ Node* range, bool upper) {
+ DEBUG_ONLY(ttyLocker ttyl);
+ if (TraceLoopPredicate) tty->print("rc_predicate ");
+
+ Node* max_idx_expr = init;
+ int stride_con = stride->get_int();
+ if ((stride_con > 0) == (scale > 0) == upper) {
+ max_idx_expr = new (C, 3) SubINode(limit, stride);
+ register_new_node(max_idx_expr, ctrl);
+ if (TraceLoopPredicate) tty->print("(limit - stride) ");
+ } else {
+ if (TraceLoopPredicate) tty->print("init ");
+ }
+
+ if (scale != 1) {
+ ConNode* con_scale = _igvn.intcon(scale);
+ max_idx_expr = new (C, 3) MulINode(max_idx_expr, con_scale);
+ register_new_node(max_idx_expr, ctrl);
+ if (TraceLoopPredicate) tty->print("* %d ", scale);
+ }
+
+ if (offset && (!offset->is_Con() || offset->get_int() != 0)){
+ max_idx_expr = new (C, 3) AddINode(max_idx_expr, offset);
+ register_new_node(max_idx_expr, ctrl);
+ if (TraceLoopPredicate)
+ if (offset->is_Con()) tty->print("+ %d ", offset->get_int());
+ else tty->print("+ offset ");
+ }
+
+ CmpUNode* cmp = new (C, 3) CmpUNode(max_idx_expr, range);
+ register_new_node(cmp, ctrl);
+ BoolNode* bol = new (C, 2) BoolNode(cmp, BoolTest::lt);
+ register_new_node(bol, ctrl);
+
+ if (TraceLoopPredicate) tty->print_cr("_head->is_Loop()) {
+ // Could be a simple region when irreducible loops are present.
+ return false;
+ }
+
+ if (loop->_head->unique_ctrl_out()->Opcode() == Op_NeverBranch) {
+ // do nothing for infinite loops
+ return false;
+ }
+
+ CountedLoopNode *cl = NULL;
+ if (loop->_head->is_CountedLoop()) {
+ cl = loop->_head->as_CountedLoop();
+ // do nothing for iteration-splitted loops
+ if (!cl->is_normal_loop()) return false;
+ }
+
+ LoopNode *lpn = loop->_head->as_Loop();
+ Node* entry = lpn->in(LoopNode::EntryControl);
+
+ ProjNode *predicate_proj = find_predicate_insertion_point(entry, Deoptimization::Reason_predicate);
+ if (!predicate_proj) {
+#ifndef PRODUCT
+ if (TraceLoopPredicate) {
+ tty->print("missing predicate:");
+ loop->dump_head();
+ lpn->dump(1);
+ }
+#endif
+ return false;
+ }
+ ConNode* zero = _igvn.intcon(0);
+ set_ctrl(zero, C->root());
+
+ ResourceArea *area = Thread::current()->resource_area();
+ Invariance invar(area, loop);
+
+ // Create list of if-projs such that a newer proj dominates all older
+ // projs in the list, and they all dominate loop->tail()
+ Node_List if_proj_list(area);
+ LoopNode *head = loop->_head->as_Loop();
+ Node *current_proj = loop->tail(); //start from tail
+ while (current_proj != head) {
+ if (loop == get_loop(current_proj) && // still in the loop ?
+ current_proj->is_Proj() && // is a projection ?
+ current_proj->in(0)->Opcode() == Op_If) { // is a if projection ?
+ if_proj_list.push(current_proj);
+ }
+ current_proj = idom(current_proj);
+ }
+
+ bool hoisted = false; // true if at least one proj is promoted
+ while (if_proj_list.size() > 0) {
+ // Following are changed to nonnull when a predicate can be hoisted
+ ProjNode* new_predicate_proj = NULL;
+
+ ProjNode* proj = if_proj_list.pop()->as_Proj();
+ IfNode* iff = proj->in(0)->as_If();
+
+ if (!is_uncommon_trap_if_pattern(proj, Deoptimization::Reason_none)) {
+ if (loop->is_loop_exit(iff)) {
+ // stop processing the remaining projs in the list because the execution of them
+ // depends on the condition of "iff" (iff->in(1)).
+ break;
+ } else {
+ // Both arms are inside the loop. There are two cases:
+ // (1) there is one backward branch. In this case, any remaining proj
+ // in the if_proj list post-dominates "iff". So, the condition of "iff"
+ // does not determine the execution the remining projs directly, and we
+ // can safely continue.
+ // (2) both arms are forwarded, i.e. a diamond shape. In this case, "proj"
+ // does not dominate loop->tail(), so it can not be in the if_proj list.
+ continue;
+ }
+ }
+
+ Node* test = iff->in(1);
+ if (!test->is_Bool()){ //Conv2B, ...
+ continue;
+ }
+ BoolNode* bol = test->as_Bool();
+ if (invar.is_invariant(bol)) {
+ // Invariant test
+ new_predicate_proj = create_new_if_for_predicate(predicate_proj, NULL,
+ Deoptimization::Reason_predicate);
+ Node* ctrl = new_predicate_proj->in(0)->as_If()->in(0);
+ BoolNode* new_predicate_bol = invar.clone(bol, ctrl)->as_Bool();
+
+ // Negate test if necessary
+ bool negated = false;
+ if (proj->_con != predicate_proj->_con) {
+ new_predicate_bol = new (C, 2) BoolNode(new_predicate_bol->in(1), new_predicate_bol->_test.negate());
+ register_new_node(new_predicate_bol, ctrl);
+ negated = true;
+ }
+ IfNode* new_predicate_iff = new_predicate_proj->in(0)->as_If();
+ _igvn.hash_delete(new_predicate_iff);
+ new_predicate_iff->set_req(1, new_predicate_bol);
+#ifndef PRODUCT
+ if (TraceLoopPredicate) {
+ tty->print("Predicate invariant if%s: %d ", negated ? " negated" : "", new_predicate_iff->_idx);
+ loop->dump_head();
+ } else if (TraceLoopOpts) {
+ tty->print("Predicate IC ");
+ loop->dump_head();
+ }
+#endif
+ } else if (cl != NULL && loop->is_range_check_if(iff, this, invar)) {
+ assert(proj->_con == predicate_proj->_con, "must match");
+
+ // Range check for counted loops
+ const Node* cmp = bol->in(1)->as_Cmp();
+ Node* idx = cmp->in(1);
+ assert(!invar.is_invariant(idx), "index is variant");
+ assert(cmp->in(2)->Opcode() == Op_LoadRange || OptimizeFill, "must be");
+ Node* rng = cmp->in(2);
+ assert(invar.is_invariant(rng), "range must be invariant");
+ int scale = 1;
+ Node* offset = zero;
+ bool ok = is_scaled_iv_plus_offset(idx, cl->phi(), &scale, &offset);
+ assert(ok, "must be index expression");
+
+ Node* init = cl->init_trip();
+ Node* limit = cl->limit();
+ Node* stride = cl->stride();
+
+ // Build if's for the upper and lower bound tests. The
+ // lower_bound test will dominate the upper bound test and all
+ // cloned or created nodes will use the lower bound test as
+ // their declared control.
+ ProjNode* lower_bound_proj = create_new_if_for_predicate(predicate_proj, NULL, Deoptimization::Reason_predicate);
+ ProjNode* upper_bound_proj = create_new_if_for_predicate(predicate_proj, NULL, Deoptimization::Reason_predicate);
+ assert(upper_bound_proj->in(0)->as_If()->in(0) == lower_bound_proj, "should dominate");
+ Node *ctrl = lower_bound_proj->in(0)->as_If()->in(0);
+
+ // Perform cloning to keep Invariance state correct since the
+ // late schedule will place invariant things in the loop.
+ rng = invar.clone(rng, ctrl);
+ if (offset && offset != zero) {
+ assert(invar.is_invariant(offset), "offset must be loop invariant");
+ offset = invar.clone(offset, ctrl);
+ }
+
+ // Test the lower bound
+ Node* lower_bound_bol = rc_predicate(ctrl, scale, offset, init, limit, stride, rng, false);
+ IfNode* lower_bound_iff = lower_bound_proj->in(0)->as_If();
+ _igvn.hash_delete(lower_bound_iff);
+ lower_bound_iff->set_req(1, lower_bound_bol);
+ if (TraceLoopPredicate) tty->print_cr("lower bound check if: %d", lower_bound_iff->_idx);
+
+ // Test the upper bound
+ Node* upper_bound_bol = rc_predicate(ctrl, scale, offset, init, limit, stride, rng, true);
+ IfNode* upper_bound_iff = upper_bound_proj->in(0)->as_If();
+ _igvn.hash_delete(upper_bound_iff);
+ upper_bound_iff->set_req(1, upper_bound_bol);
+ if (TraceLoopPredicate) tty->print_cr("upper bound check if: %d", lower_bound_iff->_idx);
+
+ // Fall through into rest of the clean up code which will move
+ // any dependent nodes onto the upper bound test.
+ new_predicate_proj = upper_bound_proj;
+
+#ifndef PRODUCT
+ if (TraceLoopOpts && !TraceLoopPredicate) {
+ tty->print("Predicate RC ");
+ loop->dump_head();
+ }
+#endif
+ } else {
+ // Loop variant check (for example, range check in non-counted loop)
+ // with uncommon trap.
+ continue;
+ }
+ assert(new_predicate_proj != NULL, "sanity");
+ // Success - attach condition (new_predicate_bol) to predicate if
+ invar.map_ctrl(proj, new_predicate_proj); // so that invariance test can be appropriate
+
+ // Eliminate the old If in the loop body
+ dominated_by( new_predicate_proj, iff, proj->_con != new_predicate_proj->_con );
+
+ hoisted = true;
+ C->set_major_progress();
+ } // end while
+
+#ifndef PRODUCT
+ // report that the loop predication has been actually performed
+ // for this loop
+ if (TraceLoopPredicate && hoisted) {
+ tty->print("Loop Predication Performed:");
+ loop->dump_head();
+ }
+#endif
+
+ return hoisted;
+}
+
+//------------------------------loop_predication--------------------------------
+// driver routine for loop predication optimization
+bool IdealLoopTree::loop_predication( PhaseIdealLoop *phase) {
+ bool hoisted = false;
+ // Recursively promote predicates
+ if (_child) {
+ hoisted = _child->loop_predication( phase);
+ }
+
+ // self
+ if (!_irreducible && !tail()->is_top()) {
+ hoisted |= phase->loop_predication_impl(this);
+ }
+
+ if (_next) { //sibling
+ hoisted |= _next->loop_predication( phase);
+ }
+
+ return hoisted;
+}
+
diff --git a/hotspot/src/share/vm/opto/loopTransform.cpp b/hotspot/src/share/vm/opto/loopTransform.cpp
index dfccee43d48..b182f4e4f07 100644
--- a/hotspot/src/share/vm/opto/loopTransform.cpp
+++ b/hotspot/src/share/vm/opto/loopTransform.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2011, 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
@@ -63,6 +63,46 @@ void IdealLoopTree::record_for_igvn() {
}
}
+//------------------------------compute_exact_trip_count-----------------------
+// Compute loop exact trip count if possible. Do not recalculate trip count for
+// split loops (pre-main-post) which have their limits and inits behind Opaque node.
+void IdealLoopTree::compute_exact_trip_count( PhaseIdealLoop *phase ) {
+ if (!_head->as_Loop()->is_valid_counted_loop()) {
+ return;
+ }
+ CountedLoopNode* cl = _head->as_CountedLoop();
+ // Trip count may become nonexact for iteration split loops since
+ // RCE modifies limits. Note, _trip_count value is not reset since
+ // it is used to limit unrolling of main loop.
+ cl->set_nonexact_trip_count();
+
+ // Loop's test should be part of loop.
+ if (!phase->is_member(this, phase->get_ctrl(cl->loopexit()->in(CountedLoopEndNode::TestValue))))
+ return; // Infinite loop
+
+#ifdef ASSERT
+ BoolTest::mask bt = cl->loopexit()->test_trip();
+ assert(bt == BoolTest::lt || bt == BoolTest::gt ||
+ bt == BoolTest::ne, "canonical test is expected");
+#endif
+
+ Node* init_n = cl->init_trip();
+ Node* limit_n = cl->limit();
+ if (init_n != NULL && init_n->is_Con() &&
+ limit_n != NULL && limit_n->is_Con()) {
+ // Use longs to avoid integer overflow.
+ int stride_con = cl->stride_con();
+ long init_con = cl->init_trip()->get_int();
+ long limit_con = cl->limit()->get_int();
+ int stride_m = stride_con - (stride_con > 0 ? 1 : -1);
+ long trip_count = (limit_con - init_con + stride_m)/stride_con;
+ if (trip_count > 0 && (julong)trip_count < (julong)max_juint) {
+ // Set exact trip count.
+ cl->set_exact_trip_count((uint)trip_count);
+ }
+ }
+}
+
//------------------------------compute_profile_trip_cnt----------------------------
// Compute loop trip count from profile data as
// (backedge_count + loop_exit_count) / loop_exit_count
@@ -301,6 +341,132 @@ void PhaseIdealLoop::peeled_dom_test_elim( IdealLoopTree *loop, Node_List &old_n
// peeled-loop backedge has 2 users.
// Step 3: Cut the backedge on the clone (so its not a loop) and remove the
// extra backedge user.
+//
+// orig
+//
+// stmt1
+// |
+// v
+// loop predicate
+// |
+// v
+// loop<----+
+// | |
+// stmt2 |
+// | |
+// v |
+// if ^
+// / \ |
+// / \ |
+// v v |
+// false true |
+// / \ |
+// / ----+
+// |
+// v
+// exit
+//
+//
+// after clone loop
+//
+// stmt1
+// |
+// v
+// loop predicate
+// / \
+// clone / \ orig
+// / \
+// / \
+// v v
+// +---->loop clone loop<----+
+// | | | |
+// | stmt2 clone stmt2 |
+// | | | |
+// | v v |
+// ^ if clone If ^
+// | / \ / \ |
+// | / \ / \ |
+// | v v v v |
+// | true false false true |
+// | / \ / \ |
+// +---- \ / ----+
+// \ /
+// 1v v2
+// region
+// |
+// v
+// exit
+//
+//
+// after peel and predicate move
+//
+// stmt1
+// /
+// /
+// clone / orig
+// /
+// / +----------+
+// / | |
+// / loop predicate |
+// / | |
+// v v |
+// TOP-->loop clone loop<----+ |
+// | | | |
+// stmt2 clone stmt2 | |
+// | | | ^
+// v v | |
+// if clone If ^ |
+// / \ / \ | |
+// / \ / \ | |
+// v v v v | |
+// true false false true | |
+// | \ / \ | |
+// | \ / ----+ ^
+// | \ / |
+// | 1v v2 |
+// v region |
+// | | |
+// | v |
+// | exit |
+// | |
+// +--------------->-----------------+
+//
+//
+// final graph
+//
+// stmt1
+// |
+// v
+// stmt2 clone
+// |
+// v
+// if clone
+// / |
+// / |
+// v v
+// false true
+// | |
+// | v
+// | loop predicate
+// | |
+// | v
+// | loop<----+
+// | | |
+// | stmt2 |
+// | | |
+// | v |
+// v if ^
+// | / \ |
+// | / \ |
+// | v v |
+// | false true |
+// | | \ |
+// v v --+
+// region
+// |
+// v
+// exit
+//
void PhaseIdealLoop::do_peeling( IdealLoopTree *loop, Node_List &old_new ) {
C->set_major_progress();
@@ -315,9 +481,10 @@ void PhaseIdealLoop::do_peeling( IdealLoopTree *loop, Node_List &old_new ) {
loop->dump_head();
}
#endif
- Node *h = loop->_head;
- if (h->is_CountedLoop()) {
- CountedLoopNode *cl = h->as_CountedLoop();
+ Node* head = loop->_head;
+ bool counted_loop = head->is_CountedLoop();
+ if (counted_loop) {
+ CountedLoopNode *cl = head->as_CountedLoop();
assert(cl->trip_count() > 0, "peeling a fully unrolled loop");
cl->set_trip_count(cl->trip_count() - 1);
if (cl->is_main_loop()) {
@@ -330,11 +497,11 @@ void PhaseIdealLoop::do_peeling( IdealLoopTree *loop, Node_List &old_new ) {
#endif
}
}
+ Node* entry = head->in(LoopNode::EntryControl);
// Step 1: Clone the loop body. The clone becomes the peeled iteration.
// The pre-loop illegally has 2 control users (old & new loops).
- clone_loop( loop, old_new, dom_depth(loop->_head) );
-
+ clone_loop( loop, old_new, dom_depth(head) );
// Step 2: Make the old-loop fall-in edges point to the peeled iteration.
// Do this by making the old-loop fall-in edges act as if they came
@@ -342,12 +509,15 @@ void PhaseIdealLoop::do_peeling( IdealLoopTree *loop, Node_List &old_new ) {
// backedges) and then map to the new peeled iteration. This leaves
// the pre-loop with only 1 user (the new peeled iteration), but the
// peeled-loop backedge has 2 users.
- for (DUIterator_Fast jmax, j = loop->_head->fast_outs(jmax); j < jmax; j++) {
- Node* old = loop->_head->fast_out(j);
- if( old->in(0) == loop->_head && old->req() == 3 &&
- (old->is_Loop() || old->is_Phi()) ) {
- Node *new_exit_value = old_new[old->in(LoopNode::LoopBackControl)->_idx];
- if( !new_exit_value ) // Backedge value is ALSO loop invariant?
+ Node* new_exit_value = old_new[head->in(LoopNode::LoopBackControl)->_idx];
+ new_exit_value = move_loop_predicates(entry, new_exit_value);
+ _igvn.hash_delete(head);
+ head->set_req(LoopNode::EntryControl, new_exit_value);
+ for (DUIterator_Fast jmax, j = head->fast_outs(jmax); j < jmax; j++) {
+ Node* old = head->fast_out(j);
+ if (old->in(0) == loop->_head && old->req() == 3 && old->is_Phi()) {
+ new_exit_value = old_new[old->in(LoopNode::LoopBackControl)->_idx];
+ if (!new_exit_value ) // Backedge value is ALSO loop invariant?
// Then loop body backedge value remains the same.
new_exit_value = old->in(LoopNode::LoopBackControl);
_igvn.hash_delete(old);
@@ -358,12 +528,12 @@ void PhaseIdealLoop::do_peeling( IdealLoopTree *loop, Node_List &old_new ) {
// Step 3: Cut the backedge on the clone (so its not a loop) and remove the
// extra backedge user.
- Node *nnn = old_new[loop->_head->_idx];
- _igvn.hash_delete(nnn);
- nnn->set_req(LoopNode::LoopBackControl, C->top());
- for (DUIterator_Fast j2max, j2 = nnn->fast_outs(j2max); j2 < j2max; j2++) {
- Node* use = nnn->fast_out(j2);
- if( use->in(0) == nnn && use->req() == 3 && use->is_Phi() ) {
+ Node* new_head = old_new[head->_idx];
+ _igvn.hash_delete(new_head);
+ new_head->set_req(LoopNode::LoopBackControl, C->top());
+ for (DUIterator_Fast j2max, j2 = new_head->fast_outs(j2max); j2 < j2max; j2++) {
+ Node* use = new_head->fast_out(j2);
+ if (use->in(0) == new_head && use->req() == 3 && use->is_Phi()) {
_igvn.hash_delete(use);
use->set_req(LoopNode::LoopBackControl, C->top());
}
@@ -371,15 +541,15 @@ void PhaseIdealLoop::do_peeling( IdealLoopTree *loop, Node_List &old_new ) {
// Step 4: Correct dom-depth info. Set to loop-head depth.
- int dd = dom_depth(loop->_head);
- set_idom(loop->_head, loop->_head->in(1), dd);
+ int dd = dom_depth(head);
+ set_idom(head, head->in(1), dd);
for (uint j3 = 0; j3 < loop->_body.size(); j3++) {
Node *old = loop->_body.at(j3);
Node *nnn = old_new[old->_idx];
if (!has_ctrl(nnn))
set_idom(nnn, idom(nnn), dd-1);
// While we're at it, remove any SafePoints from the peeled code
- if( old->Opcode() == Op_SafePoint ) {
+ if (old->Opcode() == Op_SafePoint) {
Node *nnn = old_new[old->_idx];
lazy_replace(nnn,nnn->in(TypeFunc::Control));
}
@@ -392,34 +562,26 @@ void PhaseIdealLoop::do_peeling( IdealLoopTree *loop, Node_List &old_new ) {
loop->record_for_igvn();
}
+#define EMPTY_LOOP_SIZE 7 // number of nodes in an empty loop
+
//------------------------------policy_maximally_unroll------------------------
-// Return exact loop trip count, or 0 if not maximally unrolling
+// Calculate exact loop trip count and return true if loop can be maximally
+// unrolled.
bool IdealLoopTree::policy_maximally_unroll( PhaseIdealLoop *phase ) const {
CountedLoopNode *cl = _head->as_CountedLoop();
- assert( cl->is_normal_loop(), "" );
+ assert(cl->is_normal_loop(), "");
+ if (!cl->is_valid_counted_loop())
+ return false; // Malformed counted loop
- Node *init_n = cl->init_trip();
- Node *limit_n = cl->limit();
-
- // Non-constant bounds
- if( init_n == NULL || !init_n->is_Con() ||
- limit_n == NULL || !limit_n->is_Con() ||
- // protect against stride not being a constant
- !cl->stride_is_con() ) {
+ if (!cl->has_exact_trip_count()) {
+ // Trip count is not exact.
return false;
}
- int init = init_n->get_int();
- int limit = limit_n->get_int();
- int span = limit - init;
- int stride = cl->stride_con();
- if (init >= limit || stride > span) {
- // return a false (no maximally unroll) and the regular unroll/peel
- // route will make a small mess which CCP will fold away.
- return false;
- }
- uint trip_count = span/stride; // trip_count can be greater than 2 Gig.
- assert( (int)trip_count*stride == span, "must divide evenly" );
+ uint trip_count = cl->trip_count();
+ // Note, max_juint is used to indicate unknown trip count.
+ assert(trip_count > 1, "one iteration loop should be optimized out already");
+ assert(trip_count < max_juint, "exact trip_count should be less than max_uint.");
// Real policy: if we maximally unroll, does it get too big?
// Allow the unrolled mess to get larger than standard loop
@@ -427,18 +589,46 @@ bool IdealLoopTree::policy_maximally_unroll( PhaseIdealLoop *phase ) const {
uint body_size = _body.size();
uint unroll_limit = (uint)LoopUnrollLimit * 4;
assert( (intx)unroll_limit == LoopUnrollLimit * 4, "LoopUnrollLimit must fit in 32bits");
- cl->set_trip_count(trip_count);
- if( trip_count <= unroll_limit && body_size <= unroll_limit ) {
- uint new_body_size = body_size * trip_count;
- if (new_body_size <= unroll_limit &&
- body_size == new_body_size / trip_count &&
- // Unrolling can result in a large amount of node construction
- new_body_size < MaxNodeLimit - phase->C->unique()) {
- return true; // maximally unroll
- }
+ if (trip_count > unroll_limit || body_size > unroll_limit) {
+ return false;
}
- return false; // Do not maximally unroll
+ // Take into account that after unroll conjoined heads and tails will fold,
+ // otherwise policy_unroll() may allow more unrolling than max unrolling.
+ uint new_body_size = EMPTY_LOOP_SIZE + (body_size - EMPTY_LOOP_SIZE) * trip_count;
+ uint tst_body_size = (new_body_size - EMPTY_LOOP_SIZE) / trip_count + EMPTY_LOOP_SIZE;
+ if (body_size != tst_body_size) // Check for int overflow
+ return false;
+ if (new_body_size > unroll_limit ||
+ // Unrolling can result in a large amount of node construction
+ new_body_size >= MaxNodeLimit - phase->C->unique()) {
+ return false;
+ }
+
+ // Currently we don't have policy to optimize one iteration loops.
+ // Maximally unrolling transformation is used for that:
+ // it is peeled and the original loop become non reachable (dead).
+ // Also fully unroll a loop with few iterations regardless next
+ // conditions since following loop optimizations will split
+ // such loop anyway (pre-main-post).
+ if (trip_count <= 3)
+ return true;
+
+ // Do not unroll a loop with String intrinsics code.
+ // String intrinsics are large and have loops.
+ for (uint k = 0; k < _body.size(); k++) {
+ Node* n = _body.at(k);
+ switch (n->Opcode()) {
+ case Op_StrComp:
+ case Op_StrEquals:
+ case Op_StrIndexOf:
+ case Op_AryEq: {
+ return false;
+ }
+ } // switch
+ }
+
+ return true; // Do maximally unroll
}
@@ -448,13 +638,16 @@ bool IdealLoopTree::policy_maximally_unroll( PhaseIdealLoop *phase ) const {
bool IdealLoopTree::policy_unroll( PhaseIdealLoop *phase ) const {
CountedLoopNode *cl = _head->as_CountedLoop();
- assert( cl->is_normal_loop() || cl->is_main_loop(), "" );
+ assert(cl->is_normal_loop() || cl->is_main_loop(), "");
- // protect against stride not being a constant
- if( !cl->stride_is_con() ) return false;
+ if (!cl->is_valid_counted_loop())
+ return false; // Malformed counted loop
// protect against over-unrolling
- if( cl->trip_count() <= 1 ) return false;
+ if (cl->trip_count() <= 1) return false;
+
+ // Check for stride being a small enough constant
+ if (abs(cl->stride_con()) > (1<<3)) return false;
int future_unroll_ct = cl->unrolled_count() * 2;
@@ -485,21 +678,21 @@ bool IdealLoopTree::policy_unroll( PhaseIdealLoop *phase ) const {
// Non-constant bounds.
// Protect against over-unrolling when init or/and limit are not constant
// (so that trip_count's init value is maxint) but iv range is known.
- if( init_n == NULL || !init_n->is_Con() ||
- limit_n == NULL || !limit_n->is_Con() ) {
+ if (init_n == NULL || !init_n->is_Con() ||
+ limit_n == NULL || !limit_n->is_Con()) {
Node* phi = cl->phi();
- if( phi != NULL ) {
+ if (phi != NULL) {
assert(phi->is_Phi() && phi->in(0) == _head, "Counted loop should have iv phi.");
const TypeInt* iv_type = phase->_igvn.type(phi)->is_int();
int next_stride = cl->stride_con() * 2; // stride after this unroll
- if( next_stride > 0 ) {
- if( iv_type->_lo + next_stride <= iv_type->_lo || // overflow
- iv_type->_lo + next_stride > iv_type->_hi ) {
+ if (next_stride > 0) {
+ if (iv_type->_lo + next_stride <= iv_type->_lo || // overflow
+ iv_type->_lo + next_stride > iv_type->_hi) {
return false; // over-unrolling
}
- } else if( next_stride < 0 ) {
- if( iv_type->_hi + next_stride >= iv_type->_hi || // overflow
- iv_type->_hi + next_stride < iv_type->_lo ) {
+ } else if (next_stride < 0) {
+ if (iv_type->_hi + next_stride >= iv_type->_hi || // overflow
+ iv_type->_hi + next_stride < iv_type->_lo) {
return false; // over-unrolling
}
}
@@ -511,25 +704,31 @@ bool IdealLoopTree::policy_unroll( PhaseIdealLoop *phase ) const {
// Key test to unroll CaffeineMark's Logic test
int xors_in_loop = 0;
// Also count ModL, DivL and MulL which expand mightly
- for( uint k = 0; k < _body.size(); k++ ) {
- switch( _body.at(k)->Opcode() ) {
- case Op_XorI: xors_in_loop++; break; // CaffeineMark's Logic test
- case Op_ModL: body_size += 30; break;
- case Op_DivL: body_size += 30; break;
- case Op_MulL: body_size += 10; break;
- }
+ for (uint k = 0; k < _body.size(); k++) {
+ Node* n = _body.at(k);
+ switch (n->Opcode()) {
+ case Op_XorI: xors_in_loop++; break; // CaffeineMark's Logic test
+ case Op_ModL: body_size += 30; break;
+ case Op_DivL: body_size += 30; break;
+ case Op_MulL: body_size += 10; break;
+ case Op_StrComp:
+ case Op_StrEquals:
+ case Op_StrIndexOf:
+ case Op_AryEq: {
+ // Do not unroll a loop with String intrinsics code.
+ // String intrinsics are large and have loops.
+ return false;
+ }
+ } // switch
}
// Check for being too big
- if( body_size > (uint)LoopUnrollLimit ) {
- if( xors_in_loop >= 4 && body_size < (uint)LoopUnrollLimit*4) return true;
+ if (body_size > (uint)LoopUnrollLimit) {
+ if (xors_in_loop >= 4 && body_size < (uint)LoopUnrollLimit*4) return true;
// Normal case: loop too big
return false;
}
- // Check for stride being a small enough constant
- if( abs(cl->stride_con()) > (1<<3) ) return false;
-
// Unroll once! (Each trip will soon do double iterations)
return true;
}
@@ -923,7 +1122,11 @@ void PhaseIdealLoop::do_unroll( IdealLoopTree *loop, Node_List &old_new, bool ad
tty->print("Unrolling ");
loop->dump_head();
} else if (TraceLoopOpts) {
- tty->print("Unroll %d ", loop_head->unrolled_count()*2);
+ if (loop_head->trip_count() < (uint)LoopUnrollLimit) {
+ tty->print("Unroll %d(%2d) ", loop_head->unrolled_count()*2, loop_head->trip_count());
+ } else {
+ tty->print("Unroll %d ", loop_head->unrolled_count()*2);
+ }
loop->dump_head();
}
#endif
@@ -1598,7 +1801,7 @@ void IdealLoopTree::adjust_loop_exit_prob( PhaseIdealLoop *phase ) {
// have on the last iteration. This will break the loop.
bool IdealLoopTree::policy_do_remove_empty_loop( PhaseIdealLoop *phase ) {
// Minimum size must be empty loop
- if (_body.size() > 7/*number of nodes in an empty loop*/)
+ if (_body.size() > EMPTY_LOOP_SIZE)
return false;
if (!_head->is_CountedLoop())
@@ -1608,15 +1811,7 @@ bool IdealLoopTree::policy_do_remove_empty_loop( PhaseIdealLoop *phase ) {
return false; // Malformed loop
if (!phase->is_member(this, phase->get_ctrl(cl->loopexit()->in(CountedLoopEndNode::TestValue))))
return false; // Infinite loop
-#ifndef PRODUCT
- if (PrintOpto) {
- tty->print("Removing empty loop");
- this->dump_head();
- } else if (TraceLoopOpts) {
- tty->print("Empty ");
- this->dump_head();
- }
-#endif
+
#ifdef ASSERT
// Ensure only one phi which is the iv.
Node* iv = NULL;
@@ -1629,6 +1824,54 @@ bool IdealLoopTree::policy_do_remove_empty_loop( PhaseIdealLoop *phase ) {
}
assert(iv == cl->phi(), "Wrong phi" );
#endif
+
+ // main and post loops have explicitly created zero trip guard
+ bool needs_guard = !cl->is_main_loop() && !cl->is_post_loop();
+ if (needs_guard) {
+ // Skip guard if values not overlap.
+ const TypeInt* init_t = phase->_igvn.type(cl->init_trip())->is_int();
+ const TypeInt* limit_t = phase->_igvn.type(cl->limit())->is_int();
+ int stride_con = cl->stride_con();
+ if (stride_con > 0) {
+ needs_guard = (init_t->_hi >= limit_t->_lo);
+ } else {
+ needs_guard = (init_t->_lo <= limit_t->_hi);
+ }
+ }
+ if (needs_guard) {
+ // Check for an obvious zero trip guard.
+ Node* inctrl = PhaseIdealLoop::skip_loop_predicates(cl->in(LoopNode::EntryControl));
+ if (inctrl->Opcode() == Op_IfTrue) {
+ // The test should look like just the backedge of a CountedLoop
+ Node* iff = inctrl->in(0);
+ if (iff->is_If()) {
+ Node* bol = iff->in(1);
+ if (bol->is_Bool() && bol->as_Bool()->_test._test == cl->loopexit()->test_trip()) {
+ Node* cmp = bol->in(1);
+ if (cmp->is_Cmp() && cmp->in(1) == cl->init_trip() && cmp->in(2) == cl->limit()) {
+ needs_guard = false;
+ }
+ }
+ }
+ }
+ }
+
+#ifndef PRODUCT
+ if (PrintOpto) {
+ tty->print("Removing empty loop with%s zero trip guard", needs_guard ? "out" : "");
+ this->dump_head();
+ } else if (TraceLoopOpts) {
+ tty->print("Empty with%s zero trip guard ", needs_guard ? "out" : "");
+ this->dump_head();
+ }
+#endif
+
+ if (needs_guard) {
+ // Peel the loop to ensure there's a zero trip guard
+ Node_List old_new;
+ phase->do_peeling(this, old_new);
+ }
+
// Replace the phi at loop head with the final value of the last
// iteration. Then the CountedLoopEnd will collapse (backedge never
// taken) and all loop-invariant uses of the exit values will be correct.
@@ -1640,12 +1883,49 @@ bool IdealLoopTree::policy_do_remove_empty_loop( PhaseIdealLoop *phase ) {
return true;
}
+//------------------------------policy_do_one_iteration_loop-------------------
+// Convert one iteration loop into normal code.
+bool IdealLoopTree::policy_do_one_iteration_loop( PhaseIdealLoop *phase ) {
+ if (!_head->as_Loop()->is_valid_counted_loop())
+ return false; // Only for counted loop
+
+ CountedLoopNode *cl = _head->as_CountedLoop();
+ if (!cl->has_exact_trip_count() || cl->trip_count() != 1) {
+ return false;
+ }
+
+#ifndef PRODUCT
+ if(TraceLoopOpts) {
+ tty->print("OneIteration ");
+ this->dump_head();
+ }
+#endif
+
+ Node *init_n = cl->init_trip();
+#ifdef ASSERT
+ // Loop boundaries should be constant since trip count is exact.
+ assert(init_n->get_int() + cl->stride_con() >= cl->limit()->get_int(), "should be one iteration");
+#endif
+ // Replace the phi at loop head with the value of the init_trip.
+ // Then the CountedLoopEnd will collapse (backedge will not be taken)
+ // and all loop-invariant uses of the exit values will be correct.
+ phase->_igvn.replace_node(cl->phi(), cl->init_trip());
+ phase->C->set_major_progress();
+ return true;
+}
//=============================================================================
//------------------------------iteration_split_impl---------------------------
bool IdealLoopTree::iteration_split_impl( PhaseIdealLoop *phase, Node_List &old_new ) {
+ // Compute exact loop trip count if possible.
+ compute_exact_trip_count(phase);
+
+ // Convert one iteration loop into normal code.
+ if (policy_do_one_iteration_loop(phase))
+ return true;
+
// Check and remove empty loops (spam micro-benchmarks)
- if( policy_do_remove_empty_loop(phase) )
+ if (policy_do_remove_empty_loop(phase))
return true; // Here we removed an empty loop
bool should_peel = policy_peeling(phase); // Should we peel?
@@ -1654,40 +1934,40 @@ bool IdealLoopTree::iteration_split_impl( PhaseIdealLoop *phase, Node_List &old_
// Non-counted loops may be peeled; exactly 1 iteration is peeled.
// This removes loop-invariant tests (usually null checks).
- if( !_head->is_CountedLoop() ) { // Non-counted loop
+ if (!_head->is_CountedLoop()) { // Non-counted loop
if (PartialPeelLoop && phase->partial_peel(this, old_new)) {
// Partial peel succeeded so terminate this round of loop opts
return false;
}
- if( should_peel ) { // Should we peel?
+ if (should_peel) { // Should we peel?
#ifndef PRODUCT
if (PrintOpto) tty->print_cr("should_peel");
#endif
phase->do_peeling(this,old_new);
- } else if( should_unswitch ) {
+ } else if (should_unswitch) {
phase->do_unswitching(this, old_new);
}
return true;
}
CountedLoopNode *cl = _head->as_CountedLoop();
- if( !cl->loopexit() ) return true; // Ignore various kinds of broken loops
+ if (!cl->loopexit()) return true; // Ignore various kinds of broken loops
// Do nothing special to pre- and post- loops
- if( cl->is_pre_loop() || cl->is_post_loop() ) return true;
+ if (cl->is_pre_loop() || cl->is_post_loop()) return true;
// Compute loop trip count from profile data
compute_profile_trip_cnt(phase);
// Before attempting fancy unrolling, RCE or alignment, see if we want
// to completely unroll this loop or do loop unswitching.
- if( cl->is_normal_loop() ) {
+ if (cl->is_normal_loop()) {
if (should_unswitch) {
phase->do_unswitching(this, old_new);
return true;
}
bool should_maximally_unroll = policy_maximally_unroll(phase);
- if( should_maximally_unroll ) {
+ if (should_maximally_unroll) {
// Here we did some unrolling and peeling. Eventually we will
// completely unroll this loop and it will no longer be a loop.
phase->do_maximally_unroll(this,old_new);
@@ -1695,6 +1975,12 @@ bool IdealLoopTree::iteration_split_impl( PhaseIdealLoop *phase, Node_List &old_
}
}
+ // Skip next optimizations if running low on nodes. Note that
+ // policy_unswitching and policy_maximally_unroll have this check.
+ uint nodes_left = MaxNodeLimit - phase->C->unique();
+ if ((2 * _body.size()) > nodes_left) {
+ return true;
+ }
// Counted loops may be peeled, may need some iterations run up
// front for RCE, and may want to align loop refs to a cache
@@ -1725,14 +2011,14 @@ bool IdealLoopTree::iteration_split_impl( PhaseIdealLoop *phase, Node_List &old_
// If we have any of these conditions (RCE, alignment, unrolling) met, then
// we switch to the pre-/main-/post-loop model. This model also covers
// peeling.
- if( should_rce || should_align || should_unroll ) {
- if( cl->is_normal_loop() ) // Convert to 'pre/main/post' loops
+ if (should_rce || should_align || should_unroll) {
+ if (cl->is_normal_loop()) // Convert to 'pre/main/post' loops
phase->insert_pre_post_loops(this,old_new, !may_rce_align);
// Adjust the pre- and main-loop limits to let the pre and post loops run
// with full checks, but the main-loop with no checks. Remove said
// checks from the main body.
- if( should_rce )
+ if (should_rce)
phase->do_range_check(this,old_new);
// Double loop body for unrolling. Adjust the minimum-trip test (will do
@@ -1740,16 +2026,16 @@ bool IdealLoopTree::iteration_split_impl( PhaseIdealLoop *phase, Node_List &old_
// an even number of trips). If we are peeling, we might enable some RCE
// and we'd rather unroll the post-RCE'd loop SO... do not unroll if
// peeling.
- if( should_unroll && !should_peel )
- phase->do_unroll(this,old_new, true);
+ if (should_unroll && !should_peel)
+ phase->do_unroll(this,old_new, true);
// Adjust the pre-loop limits to align the main body
// iterations.
- if( should_align )
+ if (should_align)
Unimplemented();
} else { // Else we have an unchanged counted loop
- if( should_peel ) // Might want to peel but do nothing else
+ if (should_peel) // Might want to peel but do nothing else
phase->do_peeling(this,old_new);
}
return true;
@@ -1799,651 +2085,8 @@ bool IdealLoopTree::iteration_split( PhaseIdealLoop *phase, Node_List &old_new )
return true;
}
-//-------------------------------is_uncommon_trap_proj----------------------------
-// Return true if proj is the form of "proj->[region->..]call_uct"
-bool PhaseIdealLoop::is_uncommon_trap_proj(ProjNode* proj, Deoptimization::DeoptReason reason) {
- int path_limit = 10;
- assert(proj, "invalid argument");
- Node* out = proj;
- for (int ct = 0; ct < path_limit; ct++) {
- out = out->unique_ctrl_out();
- if (out == NULL || out->is_Root() || out->is_Start())
- return false;
- if (out->is_CallStaticJava()) {
- int req = out->as_CallStaticJava()->uncommon_trap_request();
- if (req != 0) {
- Deoptimization::DeoptReason trap_reason = Deoptimization::trap_request_reason(req);
- if (trap_reason == reason || reason == Deoptimization::Reason_none) {
- return true;
- }
- }
- return false; // don't do further after call
- }
- }
- return false;
-}
-
-//-------------------------------is_uncommon_trap_if_pattern-------------------------
-// Return true for "if(test)-> proj -> ...
-// |
-// V
-// other_proj->[region->..]call_uct"
-//
-// "must_reason_predicate" means the uct reason must be Reason_predicate
-bool PhaseIdealLoop::is_uncommon_trap_if_pattern(ProjNode *proj, Deoptimization::DeoptReason reason) {
- Node *in0 = proj->in(0);
- if (!in0->is_If()) return false;
- // Variation of a dead If node.
- if (in0->outcnt() < 2) return false;
- IfNode* iff = in0->as_If();
-
- // we need "If(Conv2B(Opaque1(...)))" pattern for reason_predicate
- if (reason != Deoptimization::Reason_none) {
- if (iff->in(1)->Opcode() != Op_Conv2B ||
- iff->in(1)->in(1)->Opcode() != Op_Opaque1) {
- return false;
- }
- }
-
- ProjNode* other_proj = iff->proj_out(1-proj->_con)->as_Proj();
- return is_uncommon_trap_proj(other_proj, reason);
-}
-
-//-------------------------------register_control-------------------------
-void PhaseIdealLoop::register_control(Node* n, IdealLoopTree *loop, Node* pred) {
- assert(n->is_CFG(), "must be control node");
- _igvn.register_new_node_with_optimizer(n);
- loop->_body.push(n);
- set_loop(n, loop);
- // When called from beautify_loops() idom is not constructed yet.
- if (_idom != NULL) {
- set_idom(n, pred, dom_depth(pred));
- }
-}
-
-//------------------------------create_new_if_for_predicate------------------------
-// create a new if above the uct_if_pattern for the predicate to be promoted.
-//
-// before after
-// ---------- ----------
-// ctrl ctrl
-// | |
-// | |
-// v v
-// iff new_iff
-// / \ / \
-// / \ / \
-// v v v v
-// uncommon_proj cont_proj if_uct if_cont
-// \ | | | |
-// \ | | | |
-// v v v | v
-// rgn loop | iff
-// | | / \
-// | | / \
-// v | v v
-// uncommon_trap | uncommon_proj cont_proj
-// \ \ | |
-// \ \ | |
-// v v v v
-// rgn loop
-// |
-// |
-// v
-// uncommon_trap
-//
-//
-// We will create a region to guard the uct call if there is no one there.
-// The true projecttion (if_cont) of the new_iff is returned.
-// This code is also used to clone predicates to clonned loops.
-ProjNode* PhaseIdealLoop::create_new_if_for_predicate(ProjNode* cont_proj, Node* new_entry,
- Deoptimization::DeoptReason reason) {
- assert(is_uncommon_trap_if_pattern(cont_proj, reason), "must be a uct if pattern!");
- IfNode* iff = cont_proj->in(0)->as_If();
-
- ProjNode *uncommon_proj = iff->proj_out(1 - cont_proj->_con);
- Node *rgn = uncommon_proj->unique_ctrl_out();
- assert(rgn->is_Region() || rgn->is_Call(), "must be a region or call uct");
-
- if (!rgn->is_Region()) { // create a region to guard the call
- assert(rgn->is_Call(), "must be call uct");
- CallNode* call = rgn->as_Call();
- IdealLoopTree* loop = get_loop(call);
- rgn = new (C, 1) RegionNode(1);
- rgn->add_req(uncommon_proj);
- register_control(rgn, loop, uncommon_proj);
- _igvn.hash_delete(call);
- call->set_req(0, rgn);
- // When called from beautify_loops() idom is not constructed yet.
- if (_idom != NULL) {
- set_idom(call, rgn, dom_depth(rgn));
- }
- }
-
- Node* entry = iff->in(0);
- if (new_entry != NULL) {
- // Clonning the predicate to new location.
- entry = new_entry;
- }
- // Create new_iff
- IdealLoopTree* lp = get_loop(entry);
- IfNode *new_iff = new (C, 2) IfNode(entry, NULL, iff->_prob, iff->_fcnt);
- register_control(new_iff, lp, entry);
- Node *if_cont = new (C, 1) IfTrueNode(new_iff);
- Node *if_uct = new (C, 1) IfFalseNode(new_iff);
- if (cont_proj->is_IfFalse()) {
- // Swap
- Node* tmp = if_uct; if_uct = if_cont; if_cont = tmp;
- }
- register_control(if_cont, lp, new_iff);
- register_control(if_uct, get_loop(rgn), new_iff);
-
- // if_uct to rgn
- _igvn.hash_delete(rgn);
- rgn->add_req(if_uct);
- // When called from beautify_loops() idom is not constructed yet.
- if (_idom != NULL) {
- Node* ridom = idom(rgn);
- Node* nrdom = dom_lca(ridom, new_iff);
- set_idom(rgn, nrdom, dom_depth(rgn));
- }
- // rgn must have no phis
- assert(!rgn->as_Region()->has_phi(), "region must have no phis");
-
- if (new_entry == NULL) {
- // Attach if_cont to iff
- _igvn.hash_delete(iff);
- iff->set_req(0, if_cont);
- if (_idom != NULL) {
- set_idom(iff, if_cont, dom_depth(iff));
- }
- }
- return if_cont->as_Proj();
-}
-
-//--------------------------find_predicate_insertion_point-------------------
-// Find a good location to insert a predicate
-ProjNode* PhaseIdealLoop::find_predicate_insertion_point(Node* start_c, Deoptimization::DeoptReason reason) {
- if (start_c == NULL || !start_c->is_Proj())
- return NULL;
- if (is_uncommon_trap_if_pattern(start_c->as_Proj(), reason)) {
- return start_c->as_Proj();
- }
- return NULL;
-}
-
-//--------------------------find_predicate------------------------------------
-// Find a predicate
-Node* PhaseIdealLoop::find_predicate(Node* entry) {
- Node* predicate = NULL;
- if (UseLoopPredicate) {
- predicate = find_predicate_insertion_point(entry, Deoptimization::Reason_predicate);
- if (predicate != NULL) { // right pattern that can be used by loop predication
- assert(entry->in(0)->in(1)->in(1)->Opcode()==Op_Opaque1, "must be");
- return entry;
- }
- }
- return NULL;
-}
-
-//------------------------------Invariance-----------------------------------
-// Helper class for loop_predication_impl to compute invariance on the fly and
-// clone invariants.
-class Invariance : public StackObj {
- VectorSet _visited, _invariant;
- Node_Stack _stack;
- VectorSet _clone_visited;
- Node_List _old_new; // map of old to new (clone)
- IdealLoopTree* _lpt;
- PhaseIdealLoop* _phase;
-
- // Helper function to set up the invariance for invariance computation
- // If n is a known invariant, set up directly. Otherwise, look up the
- // the possibility to push n onto the stack for further processing.
- void visit(Node* use, Node* n) {
- if (_lpt->is_invariant(n)) { // known invariant
- _invariant.set(n->_idx);
- } else if (!n->is_CFG()) {
- Node *n_ctrl = _phase->ctrl_or_self(n);
- Node *u_ctrl = _phase->ctrl_or_self(use); // self if use is a CFG
- if (_phase->is_dominator(n_ctrl, u_ctrl)) {
- _stack.push(n, n->in(0) == NULL ? 1 : 0);
- }
- }
- }
-
- // Compute invariance for "the_node" and (possibly) all its inputs recursively
- // on the fly
- void compute_invariance(Node* n) {
- assert(_visited.test(n->_idx), "must be");
- visit(n, n);
- while (_stack.is_nonempty()) {
- Node* n = _stack.node();
- uint idx = _stack.index();
- if (idx == n->req()) { // all inputs are processed
- _stack.pop();
- // n is invariant if it's inputs are all invariant
- bool all_inputs_invariant = true;
- for (uint i = 0; i < n->req(); i++) {
- Node* in = n->in(i);
- if (in == NULL) continue;
- assert(_visited.test(in->_idx), "must have visited input");
- if (!_invariant.test(in->_idx)) { // bad guy
- all_inputs_invariant = false;
- break;
- }
- }
- if (all_inputs_invariant) {
- _invariant.set(n->_idx); // I am a invariant too
- }
- } else { // process next input
- _stack.set_index(idx + 1);
- Node* m = n->in(idx);
- if (m != NULL && !_visited.test_set(m->_idx)) {
- visit(n, m);
- }
- }
- }
- }
-
- // Helper function to set up _old_new map for clone_nodes.
- // If n is a known invariant, set up directly ("clone" of n == n).
- // Otherwise, push n onto the stack for real cloning.
- void clone_visit(Node* n) {
- assert(_invariant.test(n->_idx), "must be invariant");
- if (_lpt->is_invariant(n)) { // known invariant
- _old_new.map(n->_idx, n);
- } else{ // to be cloned
- assert (!n->is_CFG(), "should not see CFG here");
- _stack.push(n, n->in(0) == NULL ? 1 : 0);
- }
- }
-
- // Clone "n" and (possibly) all its inputs recursively
- void clone_nodes(Node* n, Node* ctrl) {
- clone_visit(n);
- while (_stack.is_nonempty()) {
- Node* n = _stack.node();
- uint idx = _stack.index();
- if (idx == n->req()) { // all inputs processed, clone n!
- _stack.pop();
- // clone invariant node
- Node* n_cl = n->clone();
- _old_new.map(n->_idx, n_cl);
- _phase->register_new_node(n_cl, ctrl);
- for (uint i = 0; i < n->req(); i++) {
- Node* in = n_cl->in(i);
- if (in == NULL) continue;
- n_cl->set_req(i, _old_new[in->_idx]);
- }
- } else { // process next input
- _stack.set_index(idx + 1);
- Node* m = n->in(idx);
- if (m != NULL && !_clone_visited.test_set(m->_idx)) {
- clone_visit(m); // visit the input
- }
- }
- }
- }
-
- public:
- Invariance(Arena* area, IdealLoopTree* lpt) :
- _lpt(lpt), _phase(lpt->_phase),
- _visited(area), _invariant(area), _stack(area, 10 /* guess */),
- _clone_visited(area), _old_new(area)
- {}
-
- // Map old to n for invariance computation and clone
- void map_ctrl(Node* old, Node* n) {
- assert(old->is_CFG() && n->is_CFG(), "must be");
- _old_new.map(old->_idx, n); // "clone" of old is n
- _invariant.set(old->_idx); // old is invariant
- _clone_visited.set(old->_idx);
- }
-
- // Driver function to compute invariance
- bool is_invariant(Node* n) {
- if (!_visited.test_set(n->_idx))
- compute_invariance(n);
- return (_invariant.test(n->_idx) != 0);
- }
-
- // Driver function to clone invariant
- Node* clone(Node* n, Node* ctrl) {
- assert(ctrl->is_CFG(), "must be");
- assert(_invariant.test(n->_idx), "must be an invariant");
- if (!_clone_visited.test(n->_idx))
- clone_nodes(n, ctrl);
- return _old_new[n->_idx];
- }
-};
-
-//------------------------------is_range_check_if -----------------------------------
-// Returns true if the predicate of iff is in "scale*iv + offset u< load_range(ptr)" format
-// Note: this function is particularly designed for loop predication. We require load_range
-// and offset to be loop invariant computed on the fly by "invar"
-bool IdealLoopTree::is_range_check_if(IfNode *iff, PhaseIdealLoop *phase, Invariance& invar) const {
- if (!is_loop_exit(iff)) {
- return false;
- }
- if (!iff->in(1)->is_Bool()) {
- return false;
- }
- const BoolNode *bol = iff->in(1)->as_Bool();
- if (bol->_test._test != BoolTest::lt) {
- return false;
- }
- if (!bol->in(1)->is_Cmp()) {
- return false;
- }
- const CmpNode *cmp = bol->in(1)->as_Cmp();
- if (cmp->Opcode() != Op_CmpU ) {
- return false;
- }
- Node* range = cmp->in(2);
- if (range->Opcode() != Op_LoadRange) {
- const TypeInt* tint = phase->_igvn.type(range)->isa_int();
- if (!OptimizeFill || tint == NULL || tint->empty() || tint->_lo < 0) {
- // Allow predication on positive values that aren't LoadRanges.
- // This allows optimization of loops where the length of the
- // array is a known value and doesn't need to be loaded back
- // from the array.
- return false;
- }
- }
- if (!invar.is_invariant(range)) {
- return false;
- }
- Node *iv = _head->as_CountedLoop()->phi();
- int scale = 0;
- Node *offset = NULL;
- if (!phase->is_scaled_iv_plus_offset(cmp->in(1), iv, &scale, &offset)) {
- return false;
- }
- if(offset && !invar.is_invariant(offset)) { // offset must be invariant
- return false;
- }
- return true;
-}
-
-//------------------------------rc_predicate-----------------------------------
-// Create a range check predicate
-//
-// for (i = init; i < limit; i += stride) {
-// a[scale*i+offset]
-// }
-//
-// Compute max(scale*i + offset) for init <= i < limit and build the predicate
-// as "max(scale*i + offset) u< a.length".
-//
-// There are two cases for max(scale*i + offset):
-// (1) stride*scale > 0
-// max(scale*i + offset) = scale*(limit-stride) + offset
-// (2) stride*scale < 0
-// max(scale*i + offset) = scale*init + offset
-BoolNode* PhaseIdealLoop::rc_predicate(Node* ctrl,
- int scale, Node* offset,
- Node* init, Node* limit, Node* stride,
- Node* range, bool upper) {
- DEBUG_ONLY(ttyLocker ttyl);
- if (TraceLoopPredicate) tty->print("rc_predicate ");
-
- Node* max_idx_expr = init;
- int stride_con = stride->get_int();
- if ((stride_con > 0) == (scale > 0) == upper) {
- max_idx_expr = new (C, 3) SubINode(limit, stride);
- register_new_node(max_idx_expr, ctrl);
- if (TraceLoopPredicate) tty->print("(limit - stride) ");
- } else {
- if (TraceLoopPredicate) tty->print("init ");
- }
-
- if (scale != 1) {
- ConNode* con_scale = _igvn.intcon(scale);
- max_idx_expr = new (C, 3) MulINode(max_idx_expr, con_scale);
- register_new_node(max_idx_expr, ctrl);
- if (TraceLoopPredicate) tty->print("* %d ", scale);
- }
-
- if (offset && (!offset->is_Con() || offset->get_int() != 0)){
- max_idx_expr = new (C, 3) AddINode(max_idx_expr, offset);
- register_new_node(max_idx_expr, ctrl);
- if (TraceLoopPredicate)
- if (offset->is_Con()) tty->print("+ %d ", offset->get_int());
- else tty->print("+ offset ");
- }
-
- CmpUNode* cmp = new (C, 3) CmpUNode(max_idx_expr, range);
- register_new_node(cmp, ctrl);
- BoolNode* bol = new (C, 2) BoolNode(cmp, BoolTest::lt);
- register_new_node(bol, ctrl);
-
- if (TraceLoopPredicate) tty->print_cr("_head->is_Loop()) {
- // Could be a simple region when irreducible loops are present.
- return false;
- }
-
- if (loop->_head->unique_ctrl_out()->Opcode() == Op_NeverBranch) {
- // do nothing for infinite loops
- return false;
- }
-
- CountedLoopNode *cl = NULL;
- if (loop->_head->is_CountedLoop()) {
- cl = loop->_head->as_CountedLoop();
- // do nothing for iteration-splitted loops
- if (!cl->is_normal_loop()) return false;
- }
-
- LoopNode *lpn = loop->_head->as_Loop();
- Node* entry = lpn->in(LoopNode::EntryControl);
-
- ProjNode *predicate_proj = find_predicate_insertion_point(entry, Deoptimization::Reason_predicate);
- if (!predicate_proj) {
-#ifndef PRODUCT
- if (TraceLoopPredicate) {
- tty->print("missing predicate:");
- loop->dump_head();
- lpn->dump(1);
- }
-#endif
- return false;
- }
- ConNode* zero = _igvn.intcon(0);
- set_ctrl(zero, C->root());
-
- ResourceArea *area = Thread::current()->resource_area();
- Invariance invar(area, loop);
-
- // Create list of if-projs such that a newer proj dominates all older
- // projs in the list, and they all dominate loop->tail()
- Node_List if_proj_list(area);
- LoopNode *head = loop->_head->as_Loop();
- Node *current_proj = loop->tail(); //start from tail
- while ( current_proj != head ) {
- if (loop == get_loop(current_proj) && // still in the loop ?
- current_proj->is_Proj() && // is a projection ?
- current_proj->in(0)->Opcode() == Op_If) { // is a if projection ?
- if_proj_list.push(current_proj);
- }
- current_proj = idom(current_proj);
- }
-
- bool hoisted = false; // true if at least one proj is promoted
- while (if_proj_list.size() > 0) {
- // Following are changed to nonnull when a predicate can be hoisted
- ProjNode* new_predicate_proj = NULL;
-
- ProjNode* proj = if_proj_list.pop()->as_Proj();
- IfNode* iff = proj->in(0)->as_If();
-
- if (!is_uncommon_trap_if_pattern(proj, Deoptimization::Reason_none)) {
- if (loop->is_loop_exit(iff)) {
- // stop processing the remaining projs in the list because the execution of them
- // depends on the condition of "iff" (iff->in(1)).
- break;
- } else {
- // Both arms are inside the loop. There are two cases:
- // (1) there is one backward branch. In this case, any remaining proj
- // in the if_proj list post-dominates "iff". So, the condition of "iff"
- // does not determine the execution the remining projs directly, and we
- // can safely continue.
- // (2) both arms are forwarded, i.e. a diamond shape. In this case, "proj"
- // does not dominate loop->tail(), so it can not be in the if_proj list.
- continue;
- }
- }
-
- Node* test = iff->in(1);
- if (!test->is_Bool()){ //Conv2B, ...
- continue;
- }
- BoolNode* bol = test->as_Bool();
- if (invar.is_invariant(bol)) {
- // Invariant test
- new_predicate_proj = create_new_if_for_predicate(predicate_proj, NULL,
- Deoptimization::Reason_predicate);
- Node* ctrl = new_predicate_proj->in(0)->as_If()->in(0);
- BoolNode* new_predicate_bol = invar.clone(bol, ctrl)->as_Bool();
-
- // Negate test if necessary
- bool negated = false;
- if (proj->_con != predicate_proj->_con) {
- new_predicate_bol = new (C, 2) BoolNode(new_predicate_bol->in(1), new_predicate_bol->_test.negate());
- register_new_node(new_predicate_bol, ctrl);
- negated = true;
- }
- IfNode* new_predicate_iff = new_predicate_proj->in(0)->as_If();
- _igvn.hash_delete(new_predicate_iff);
- new_predicate_iff->set_req(1, new_predicate_bol);
-#ifndef PRODUCT
- if (TraceLoopPredicate) {
- tty->print("Predicate invariant if%s: %d ", negated ? " negated" : "", new_predicate_iff->_idx);
- loop->dump_head();
- } else if (TraceLoopOpts) {
- tty->print("Predicate IC ");
- loop->dump_head();
- }
-#endif
- } else if (cl != NULL && loop->is_range_check_if(iff, this, invar)) {
- assert(proj->_con == predicate_proj->_con, "must match");
-
- // Range check for counted loops
- const Node* cmp = bol->in(1)->as_Cmp();
- Node* idx = cmp->in(1);
- assert(!invar.is_invariant(idx), "index is variant");
- assert(cmp->in(2)->Opcode() == Op_LoadRange || OptimizeFill, "must be");
- Node* rng = cmp->in(2);
- assert(invar.is_invariant(rng), "range must be invariant");
- int scale = 1;
- Node* offset = zero;
- bool ok = is_scaled_iv_plus_offset(idx, cl->phi(), &scale, &offset);
- assert(ok, "must be index expression");
-
- Node* init = cl->init_trip();
- Node* limit = cl->limit();
- Node* stride = cl->stride();
-
- // Build if's for the upper and lower bound tests. The
- // lower_bound test will dominate the upper bound test and all
- // cloned or created nodes will use the lower bound test as
- // their declared control.
- ProjNode* lower_bound_proj = create_new_if_for_predicate(predicate_proj, NULL, Deoptimization::Reason_predicate);
- ProjNode* upper_bound_proj = create_new_if_for_predicate(predicate_proj, NULL, Deoptimization::Reason_predicate);
- assert(upper_bound_proj->in(0)->as_If()->in(0) == lower_bound_proj, "should dominate");
- Node *ctrl = lower_bound_proj->in(0)->as_If()->in(0);
-
- // Perform cloning to keep Invariance state correct since the
- // late schedule will place invariant things in the loop.
- rng = invar.clone(rng, ctrl);
- if (offset && offset != zero) {
- assert(invar.is_invariant(offset), "offset must be loop invariant");
- offset = invar.clone(offset, ctrl);
- }
-
- // Test the lower bound
- Node* lower_bound_bol = rc_predicate(ctrl, scale, offset, init, limit, stride, rng, false);
- IfNode* lower_bound_iff = lower_bound_proj->in(0)->as_If();
- _igvn.hash_delete(lower_bound_iff);
- lower_bound_iff->set_req(1, lower_bound_bol);
- if (TraceLoopPredicate) tty->print_cr("lower bound check if: %d", lower_bound_iff->_idx);
-
- // Test the upper bound
- Node* upper_bound_bol = rc_predicate(ctrl, scale, offset, init, limit, stride, rng, true);
- IfNode* upper_bound_iff = upper_bound_proj->in(0)->as_If();
- _igvn.hash_delete(upper_bound_iff);
- upper_bound_iff->set_req(1, upper_bound_bol);
- if (TraceLoopPredicate) tty->print_cr("upper bound check if: %d", lower_bound_iff->_idx);
-
- // Fall through into rest of the clean up code which will move
- // any dependent nodes onto the upper bound test.
- new_predicate_proj = upper_bound_proj;
-
-#ifndef PRODUCT
- if (TraceLoopOpts && !TraceLoopPredicate) {
- tty->print("Predicate RC ");
- loop->dump_head();
- }
-#endif
- } else {
- // Loop variant check (for example, range check in non-counted loop)
- // with uncommon trap.
- continue;
- }
- assert(new_predicate_proj != NULL, "sanity");
- // Success - attach condition (new_predicate_bol) to predicate if
- invar.map_ctrl(proj, new_predicate_proj); // so that invariance test can be appropriate
-
- // Eliminate the old If in the loop body
- dominated_by( new_predicate_proj, iff, proj->_con != new_predicate_proj->_con );
-
- hoisted = true;
- C->set_major_progress();
- } // end while
-
-#ifndef PRODUCT
- // report that the loop predication has been actually performed
- // for this loop
- if (TraceLoopPredicate && hoisted) {
- tty->print("Loop Predication Performed:");
- loop->dump_head();
- }
-#endif
-
- return hoisted;
-}
-
-//------------------------------loop_predication--------------------------------
-// driver routine for loop predication optimization
-bool IdealLoopTree::loop_predication( PhaseIdealLoop *phase) {
- bool hoisted = false;
- // Recursively promote predicates
- if ( _child ) {
- hoisted = _child->loop_predication( phase);
- }
-
- // self
- if (!_irreducible && !tail()->is_top()) {
- hoisted |= phase->loop_predication_impl(this);
- }
-
- if ( _next ) { //sibling
- hoisted |= _next->loop_predication( phase);
- }
-
- return hoisted;
-}
-
+//=============================================================================
// Process all the loops in the loop tree and replace any fill
// patterns with an intrisc version.
bool PhaseIdealLoop::do_intrinsify_fill() {
@@ -2563,9 +2206,12 @@ bool PhaseIdealLoop::match_fill_loop(IdealLoopTree* lpt, Node*& store, Node*& st
if (value != head->phi()) {
msg = "unhandled shift in address";
} else {
- found_index = true;
- shift = n;
- assert(type2aelembytes(store->as_Mem()->memory_type(), true) == 1 << shift->in(2)->get_int(), "scale should match");
+ if (type2aelembytes(store->as_Mem()->memory_type(), true) != (1 << n->in(2)->get_int())) {
+ msg = "scale doesn't match";
+ } else {
+ found_index = true;
+ shift = n;
+ }
}
} else if (n->Opcode() == Op_ConvI2L && conv == NULL) {
if (n->in(1) == head->phi()) {
@@ -2700,6 +2346,13 @@ bool PhaseIdealLoop::intrinsify_fill(IdealLoopTree* lpt) {
return false;
}
+#ifndef PRODUCT
+ if (TraceLoopOpts) {
+ tty->print("ArrayFill ");
+ lpt->dump_head();
+ }
+#endif
+
// Now replace the whole loop body by a call to a fill routine that
// covers the same region as the loop.
Node* base = store->in(MemNode::Address)->as_AddP()->in(AddPNode::Base);
diff --git a/hotspot/src/share/vm/opto/loopUnswitch.cpp b/hotspot/src/share/vm/opto/loopUnswitch.cpp
index fa8e58a44c8..8a103b228ef 100644
--- a/hotspot/src/share/vm/opto/loopUnswitch.cpp
+++ b/hotspot/src/share/vm/opto/loopUnswitch.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2006, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2006, 2011, 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
@@ -32,15 +32,17 @@
//
// orig: transformed:
// if (invariant-test) then
+// predicate predicate
// loop loop
// stmt1 stmt1
// if (invariant-test) then stmt2
// stmt2 stmt4
// else endloop
// stmt3 else
-// endif loop [clone]
-// stmt4 stmt1 [clone]
-// endloop stmt3
+// endif predicate [clone]
+// stmt4 loop [clone]
+// endloop stmt1 [clone]
+// stmt3
// stmt4 [clone]
// endloop
// endif
@@ -124,8 +126,15 @@ void PhaseIdealLoop::do_unswitching (IdealLoopTree *loop, Node_List &old_new) {
ProjNode* proj_true = create_slow_version_of_loop(loop, old_new);
- assert(proj_true->is_IfTrue() && proj_true->unique_ctrl_out() == head, "by construction");
-
+#ifdef ASSERT
+ Node* uniqc = proj_true->unique_ctrl_out();
+ Node* entry = head->in(LoopNode::EntryControl);
+ Node* predicate = find_predicate(entry);
+ if (predicate != NULL) predicate = predicate->in(0);
+ assert(proj_true->is_IfTrue() &&
+ (predicate == NULL && uniqc == head ||
+ predicate != NULL && uniqc == predicate), "by construction");
+#endif
// Increment unswitch count
LoopNode* head_clone = old_new[head->_idx]->as_Loop();
int nct = head->unswitch_count() + 1;
@@ -227,21 +236,24 @@ ProjNode* PhaseIdealLoop::create_slow_version_of_loop(IdealLoopTree *loop,
register_node(ifslow, outer_loop, iff, dom_depth(iff));
// Clone the loop body. The clone becomes the fast loop. The
- // original pre-header will (illegally) have 2 control users (old & new loops).
+ // original pre-header will (illegally) have 3 control users
+ // (old & new loops & new if).
clone_loop(loop, old_new, dom_depth(head), iff);
assert(old_new[head->_idx]->is_Loop(), "" );
// Fast (true) control
+ Node* iffast_pred = clone_loop_predicates(entry, iffast);
_igvn.hash_delete(head);
- head->set_req(LoopNode::EntryControl, iffast);
- set_idom(head, iffast, dom_depth(head));
+ head->set_req(LoopNode::EntryControl, iffast_pred);
+ set_idom(head, iffast_pred, dom_depth(head));
_igvn._worklist.push(head);
// Slow (false) control
+ Node* ifslow_pred = move_loop_predicates(entry, ifslow);
LoopNode* slow_head = old_new[head->_idx]->as_Loop();
_igvn.hash_delete(slow_head);
- slow_head->set_req(LoopNode::EntryControl, ifslow);
- set_idom(slow_head, ifslow, dom_depth(slow_head));
+ slow_head->set_req(LoopNode::EntryControl, ifslow_pred);
+ set_idom(slow_head, ifslow_pred, dom_depth(slow_head));
_igvn._worklist.push(slow_head);
recompute_dom_depth();
diff --git a/hotspot/src/share/vm/opto/loopnode.cpp b/hotspot/src/share/vm/opto/loopnode.cpp
index cfcea4c6f09..cd694871233 100644
--- a/hotspot/src/share/vm/opto/loopnode.cpp
+++ b/hotspot/src/share/vm/opto/loopnode.cpp
@@ -341,7 +341,12 @@ bool PhaseIdealLoop::is_counted_loop( Node *x, IdealLoopTree *loop ) {
//
assert(x->Opcode() == Op_Loop, "regular loops only");
C->print_method("Before CountedLoop", 3);
-
+#ifndef PRODUCT
+ if (TraceLoopOpts) {
+ tty->print("Counted ");
+ loop->dump_head();
+ }
+#endif
// If compare points to incr, we are ok. Otherwise the compare
// can directly point to the phi; in this case adjust the compare so that
// it points to the incr by adjusting the limit.
@@ -864,8 +869,10 @@ void IdealLoopTree::split_outer_loop( PhaseIdealLoop *phase ) {
Node *outer = new (phase->C, 3) LoopNode( ctl, _head->in(outer_idx) );
outer = igvn.register_new_node_with_optimizer(outer, _head);
phase->set_created_loop_node();
+
+ Node* pred = phase->clone_loop_predicates(ctl, outer);
// Outermost loop falls into '_head' loop
- _head->set_req(LoopNode::EntryControl, outer);
+ _head->set_req(LoopNode::EntryControl, pred);
_head->del_req(outer_idx);
// Split all the Phis up between '_head' loop and 'outer' loop.
for (DUIterator_Fast jmax, j = _head->fast_outs(jmax); j < jmax; j++) {
@@ -1064,8 +1071,6 @@ bool IdealLoopTree::beautify_loops( PhaseIdealLoop *phase ) {
// Cache parts in locals for easy
PhaseIterGVN &igvn = phase->_igvn;
- phase->C->print_method("Before beautify loops", 3);
-
igvn.hash_delete(_head); // Yank from hash before hacking edges
// Check for multiple fall-in paths. Peel off a landing pad if need be.
@@ -1105,12 +1110,13 @@ bool IdealLoopTree::beautify_loops( PhaseIdealLoop *phase ) {
// backedges into a private merge point and use the merge point as
// the one true backedge.
if( _head->req() > 3 ) {
- // Merge the many backedges into a single backedge.
+ // Merge the many backedges into a single backedge but leave
+ // the hottest backedge as separate edge for the following peel.
merge_many_backedges( phase );
result = true;
}
- // If I am a shared header (multiple backedges), peel off myself loop.
+ // If I have one hot backedge, peel off myself loop.
// I better be the outermost loop.
if( _head->req() > 3 ) {
split_outer_loop( phase );
@@ -1435,15 +1441,30 @@ void IdealLoopTree::dump_head( ) const {
tty->print("Loop: N%d/N%d ",_head->_idx,_tail->_idx);
if (_irreducible) tty->print(" IRREDUCIBLE");
if (UseLoopPredicate) {
- Node* entry = _head->in(LoopNode::EntryControl);
- if (entry != NULL && entry->is_Proj() &&
- PhaseIdealLoop::is_uncommon_trap_if_pattern(entry->as_Proj(), Deoptimization::Reason_predicate)) {
+ Node* entry = PhaseIdealLoop::find_predicate_insertion_point(_head->in(LoopNode::EntryControl),
+ Deoptimization::Reason_predicate);
+ if (entry != NULL) {
tty->print(" predicated");
}
}
if (_head->is_CountedLoop()) {
CountedLoopNode *cl = _head->as_CountedLoop();
tty->print(" counted");
+
+ Node* init_n = cl->init_trip();
+ if (init_n != NULL && init_n->is_Con())
+ tty->print(" [%d,", cl->init_trip()->get_int());
+ else
+ tty->print(" [int,");
+ Node* limit_n = cl->limit();
+ if (limit_n != NULL && limit_n->is_Con())
+ tty->print("%d),", cl->limit()->get_int());
+ else
+ tty->print("int),");
+ int stride_con = cl->stride_con();
+ if (stride_con > 0) tty->print("+");
+ tty->print("%d", stride_con);
+
if (cl->is_pre_loop ()) tty->print(" pre" );
if (cl->is_main_loop()) tty->print(" main");
if (cl->is_post_loop()) tty->print(" post");
@@ -1543,10 +1564,11 @@ void PhaseIdealLoop::eliminate_useless_predicates() {
//----------------------------build_and_optimize-------------------------------
// Create a PhaseLoop. Build the ideal Loop tree. Map each Ideal Node to
// its corresponding LoopNode. If 'optimize' is true, do some loop cleanups.
-void PhaseIdealLoop::build_and_optimize(bool do_split_ifs, bool do_loop_pred) {
+void PhaseIdealLoop::build_and_optimize(bool do_split_ifs) {
ResourceMark rm;
int old_progress = C->major_progress();
+ uint orig_worklist_size = _igvn._worklist.size();
// Reset major-progress flag for the driver's heuristics
C->clear_major_progress();
@@ -1574,6 +1596,13 @@ void PhaseIdealLoop::build_and_optimize(bool do_split_ifs, bool do_loop_pred) {
// Do not need a safepoint at the top level
_ltree_root->_has_sfpt = 1;
+ // Initialize Dominators.
+ // Checked in clone_loop_predicate() during beautify_loops().
+ _idom_size = 0;
+ _idom = NULL;
+ _dom_depth = NULL;
+ _dom_stk = NULL;
+
// Empty pre-order array
allocate_preorders();
@@ -1610,6 +1639,7 @@ void PhaseIdealLoop::build_and_optimize(bool do_split_ifs, bool do_loop_pred) {
// Split shared headers and insert loop landing pads.
// Do not bother doing this on the Root loop of course.
if( !_verify_me && !_verify_only && _ltree_root->_child ) {
+ C->print_method("Before beautify loops", 3);
if( _ltree_root->_child->beautify_loops( this ) ) {
// Re-build loop tree!
_ltree_root->_child = NULL;
@@ -1694,12 +1724,13 @@ void PhaseIdealLoop::build_and_optimize(bool do_split_ifs, bool do_loop_pred) {
for (int i = 0; i < old_progress; i++)
C->set_major_progress();
assert(C->unique() == unique, "verification mode made Nodes? ? ?");
- assert(_igvn._worklist.size() == 0, "shouldn't push anything");
+ assert(_igvn._worklist.size() == orig_worklist_size, "shouldn't push anything");
return;
}
- // some parser-inserted loop predicates could never be used by loop
- // predication. Eliminate them before loop optimization
+ // Some parser-inserted loop predicates could never be used by loop
+ // predication or they were moved away from loop during some optimizations.
+ // For example, peeling. Eliminate them before next loop optimizations.
if (UseLoopPredicate) {
eliminate_useless_predicates();
}
@@ -1750,7 +1781,7 @@ void PhaseIdealLoop::build_and_optimize(bool do_split_ifs, bool do_loop_pred) {
}
// Perform loop predication before iteration splitting
- if (do_loop_pred && C->has_loops() && !C->major_progress()) {
+ if (C->has_loops() && !C->major_progress() && (C->predicate_count() > 0)) {
_ltree_root->_child->loop_predication(this);
}
@@ -1793,8 +1824,20 @@ void PhaseIdealLoop::build_and_optimize(bool do_split_ifs, bool do_loop_pred) {
C->set_major_progress();
}
- // Convert scalar to superword operations
+ // Keep loop predicates and perform optimizations with them
+ // until no more loop optimizations could be done.
+ // After that switch predicates off and do more loop optimizations.
+ if (!C->major_progress() && (C->predicate_count() > 0)) {
+ C->cleanup_loop_predicates(_igvn);
+#ifndef PRODUCT
+ if (TraceLoopOpts) {
+ tty->print_cr("PredicatesOff");
+ }
+#endif
+ C->set_major_progress();
+ }
+ // Convert scalar to superword operations at the end of all loop opts.
if (UseSuperWord && C->has_loops() && !C->major_progress()) {
// SuperWord transform
SuperWord sw(this);
diff --git a/hotspot/src/share/vm/opto/loopnode.hpp b/hotspot/src/share/vm/opto/loopnode.hpp
index 9edcdf2922a..2b6ea369a67 100644
--- a/hotspot/src/share/vm/opto/loopnode.hpp
+++ b/hotspot/src/share/vm/opto/loopnode.hpp
@@ -57,7 +57,12 @@ class LoopNode : public RegionNode {
protected:
short _loop_flags;
// Names for flag bitfields
- enum { pre_post_main=0, inner_loop=8, partial_peel_loop=16, partial_peel_failed=32 };
+ enum { Normal=0, Pre=1, Main=2, Post=3, PreMainPostFlagsMask=3,
+ MainHasNoPreLoop=4,
+ HasExactTripCount=8,
+ InnerLoop=16,
+ PartialPeelLoop=32,
+ PartialPeelFailed=64 };
char _unswitch_count;
enum { _unswitch_max=3 };
@@ -65,13 +70,13 @@ public:
// Names for edge indices
enum { Self=0, EntryControl, LoopBackControl };
- int is_inner_loop() const { return _loop_flags & inner_loop; }
- void set_inner_loop() { _loop_flags |= inner_loop; }
+ int is_inner_loop() const { return _loop_flags & InnerLoop; }
+ void set_inner_loop() { _loop_flags |= InnerLoop; }
- int is_partial_peel_loop() const { return _loop_flags & partial_peel_loop; }
- void set_partial_peel_loop() { _loop_flags |= partial_peel_loop; }
- int partial_peel_has_failed() const { return _loop_flags & partial_peel_failed; }
- void mark_partial_peel_failed() { _loop_flags |= partial_peel_failed; }
+ int is_partial_peel_loop() const { return _loop_flags & PartialPeelLoop; }
+ void set_partial_peel_loop() { _loop_flags |= PartialPeelLoop; }
+ int partial_peel_has_failed() const { return _loop_flags & PartialPeelFailed; }
+ void mark_partial_peel_failed() { _loop_flags |= PartialPeelFailed; }
int unswitch_max() { return _unswitch_max; }
int unswitch_count() { return _unswitch_count; }
@@ -137,8 +142,8 @@ class CountedLoopNode : public LoopNode {
// the Main CountedLoop. Used to assert that we understand the graph shape.
node_idx_t _main_idx;
- // Known trip count calculated by policy_maximally_unroll
- int _trip_count;
+ // Known trip count calculated by compute_exact_trip_count()
+ uint _trip_count;
// Expected trip count from profile data
float _profile_trip_cnt;
@@ -152,7 +157,7 @@ class CountedLoopNode : public LoopNode {
public:
CountedLoopNode( Node *entry, Node *backedge )
- : LoopNode(entry, backedge), _trip_count(max_jint),
+ : LoopNode(entry, backedge), _main_idx(0), _trip_count(max_juint),
_profile_trip_cnt(COUNT_UNKNOWN), _unrolled_count_log2(0),
_node_count_before_unroll(0) {
init_class_id(Class_CountedLoop);
@@ -194,13 +199,12 @@ public:
// A 'main' loop that is ONLY unrolled or peeled, never RCE'd or
// Aligned, may be missing it's pre-loop.
- enum { Normal=0, Pre=1, Main=2, Post=3, PrePostFlagsMask=3, Main_Has_No_Pre_Loop=4 };
- int is_normal_loop() const { return (_loop_flags&PrePostFlagsMask) == Normal; }
- int is_pre_loop () const { return (_loop_flags&PrePostFlagsMask) == Pre; }
- int is_main_loop () const { return (_loop_flags&PrePostFlagsMask) == Main; }
- int is_post_loop () const { return (_loop_flags&PrePostFlagsMask) == Post; }
- int is_main_no_pre_loop() const { return _loop_flags & Main_Has_No_Pre_Loop; }
- void set_main_no_pre_loop() { _loop_flags |= Main_Has_No_Pre_Loop; }
+ int is_normal_loop() const { return (_loop_flags&PreMainPostFlagsMask) == Normal; }
+ int is_pre_loop () const { return (_loop_flags&PreMainPostFlagsMask) == Pre; }
+ int is_main_loop () const { return (_loop_flags&PreMainPostFlagsMask) == Main; }
+ int is_post_loop () const { return (_loop_flags&PreMainPostFlagsMask) == Post; }
+ int is_main_no_pre_loop() const { return _loop_flags & MainHasNoPreLoop; }
+ void set_main_no_pre_loop() { _loop_flags |= MainHasNoPreLoop; }
int main_idx() const { return _main_idx; }
@@ -208,10 +212,19 @@ public:
void set_pre_loop (CountedLoopNode *main) { assert(is_normal_loop(),""); _loop_flags |= Pre ; _main_idx = main->_idx; }
void set_main_loop ( ) { assert(is_normal_loop(),""); _loop_flags |= Main; }
void set_post_loop (CountedLoopNode *main) { assert(is_normal_loop(),""); _loop_flags |= Post; _main_idx = main->_idx; }
- void set_normal_loop( ) { _loop_flags &= ~PrePostFlagsMask; }
+ void set_normal_loop( ) { _loop_flags &= ~PreMainPostFlagsMask; }
- void set_trip_count(int tc) { _trip_count = tc; }
- int trip_count() { return _trip_count; }
+ void set_trip_count(uint tc) { _trip_count = tc; }
+ uint trip_count() { return _trip_count; }
+
+ bool has_exact_trip_count() const { return (_loop_flags & HasExactTripCount) != 0; }
+ void set_exact_trip_count(uint tc) {
+ _trip_count = tc;
+ _loop_flags |= HasExactTripCount;
+ }
+ void set_nonexact_trip_count() {
+ _loop_flags &= ~HasExactTripCount;
+ }
void set_profile_trip_cnt(float ptc) { _profile_trip_cnt = ptc; }
float profile_trip_cnt() { return _profile_trip_cnt; }
@@ -384,6 +397,9 @@ public:
// Micro-benchmark spamming. Remove empty loops.
bool policy_do_remove_empty_loop( PhaseIdealLoop *phase );
+ // Convert one iteration loop into normal code.
+ bool policy_do_one_iteration_loop( PhaseIdealLoop *phase );
+
// Return TRUE or FALSE if the loop should be peeled or not. Peel if we can
// make some loop-invariant test (usually a null-check) happen before the
// loop.
@@ -412,6 +428,9 @@ public:
// Return TRUE if "iff" is a range check.
bool is_range_check_if(IfNode *iff, PhaseIdealLoop *phase, Invariance& invar) const;
+ // Compute loop exact trip count if possible
+ void compute_exact_trip_count( PhaseIdealLoop *phase );
+
// Compute loop trip count from profile data
void compute_profile_trip_cnt( PhaseIdealLoop *phase );
@@ -706,11 +725,11 @@ private:
_dom_lca_tags(arena()), // Thread::resource_area
_verify_me(NULL),
_verify_only(true) {
- build_and_optimize(false, false);
+ build_and_optimize(false);
}
// build the loop tree and perform any requested optimizations
- void build_and_optimize(bool do_split_if, bool do_loop_pred);
+ void build_and_optimize(bool do_split_if);
public:
// Dominators for the sea of nodes
@@ -721,13 +740,13 @@ public:
Node *dom_lca_internal( Node *n1, Node *n2 ) const;
// Compute the Ideal Node to Loop mapping
- PhaseIdealLoop( PhaseIterGVN &igvn, bool do_split_ifs, bool do_loop_pred) :
+ PhaseIdealLoop( PhaseIterGVN &igvn, bool do_split_ifs) :
PhaseTransform(Ideal_Loop),
_igvn(igvn),
_dom_lca_tags(arena()), // Thread::resource_area
_verify_me(NULL),
_verify_only(false) {
- build_and_optimize(do_split_ifs, do_loop_pred);
+ build_and_optimize(do_split_ifs);
}
// Verify that verify_me made the same decisions as a fresh run.
@@ -737,7 +756,7 @@ public:
_dom_lca_tags(arena()), // Thread::resource_area
_verify_me(verify_me),
_verify_only(false) {
- build_and_optimize(false, false);
+ build_and_optimize(false);
}
// Build and verify the loop tree without modifying the graph. This
@@ -830,7 +849,26 @@ public:
Deoptimization::DeoptReason reason);
void register_control(Node* n, IdealLoopTree *loop, Node* pred);
- // Find a good location to insert a predicate
+ // Clone loop predicates to cloned loops (peeled, unswitched)
+ static ProjNode* clone_predicate(ProjNode* predicate_proj, Node* new_entry,
+ Deoptimization::DeoptReason reason,
+ PhaseIdealLoop* loop_phase,
+ PhaseIterGVN* igvn);
+ static ProjNode* move_predicate(ProjNode* predicate_proj, Node* new_entry,
+ Deoptimization::DeoptReason reason,
+ PhaseIdealLoop* loop_phase,
+ PhaseIterGVN* igvn);
+ static Node* clone_loop_predicates(Node* old_entry, Node* new_entry,
+ bool move_predicates,
+ PhaseIdealLoop* loop_phase,
+ PhaseIterGVN* igvn);
+ Node* clone_loop_predicates(Node* old_entry, Node* new_entry);
+ Node* move_loop_predicates(Node* old_entry, Node* new_entry);
+
+ void eliminate_loop_predicates(Node* entry);
+ static Node* skip_loop_predicates(Node* entry);
+
+ // Find a good location to insert a predicate
static ProjNode* find_predicate_insertion_point(Node* start_c, Deoptimization::DeoptReason reason);
// Find a predicate
static Node* find_predicate(Node* entry);
diff --git a/hotspot/src/share/vm/opto/loopopts.cpp b/hotspot/src/share/vm/opto/loopopts.cpp
index ae62e609f3f..1be37420607 100644
--- a/hotspot/src/share/vm/opto/loopopts.cpp
+++ b/hotspot/src/share/vm/opto/loopopts.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2011, 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
@@ -2139,9 +2139,12 @@ bool PhaseIdealLoop::is_valid_clone_loop_form( IdealLoopTree *loop, Node_List& p
//
// orig
//
-// stmt1
-// |
-// v
+// stmt1
+// |
+// v
+// loop predicate
+// |
+// v
// loop<----+
// | |
// stmt2 |
@@ -2172,6 +2175,9 @@ bool PhaseIdealLoop::is_valid_clone_loop_form( IdealLoopTree *loop, Node_List& p
// after clone loop
//
// stmt1
+// |
+// v
+// loop predicate
// / \
// clone / \ orig
// / \
@@ -2210,12 +2216,15 @@ bool PhaseIdealLoop::is_valid_clone_loop_form( IdealLoopTree *loop, Node_List& p
// after partial peel
//
// stmt1
+// |
+// v
+// loop predicate
// /
// clone / orig
// / TOP
// / \
// v v
-// TOP->region region----+
+// TOP->loop loop----+
// | | |
// stmt2 stmt2 |
// | | |
@@ -2253,13 +2262,17 @@ bool PhaseIdealLoop::is_valid_clone_loop_form( IdealLoopTree *loop, Node_List& p
// stmt1
// |
// v
+// stmt2 clone
+// |
+// v
// ........> ifA clone
// : / |
// dom / |
// : v v
// : false true
// : | |
-// : | stmt2 clone
+// : | v
+// : | loop predicate
// : | |
// : | v
// : | newloop<-----+
@@ -2289,6 +2302,7 @@ bool PhaseIdealLoop::is_valid_clone_loop_form( IdealLoopTree *loop, Node_List& p
//
bool PhaseIdealLoop::partial_peel( IdealLoopTree *loop, Node_List &old_new ) {
+ assert(!loop->_head->is_CountedLoop(), "Non-counted loop only");
if (!loop->_head->is_Loop()) {
return false; }
@@ -2316,6 +2330,7 @@ bool PhaseIdealLoop::partial_peel( IdealLoopTree *loop, Node_List &old_new ) {
}
}
+ Node* entry = head->in(LoopNode::EntryControl);
int dd = dom_depth(head);
// Step 1: find cut point
@@ -2612,6 +2627,8 @@ bool PhaseIdealLoop::partial_peel( IdealLoopTree *loop, Node_List &old_new ) {
// Backedge of the surviving new_head (the clone) is original last_peel
_igvn.hash_delete(new_head_clone);
+ Node* new_entry = move_loop_predicates(entry, new_head_clone->in(LoopNode::EntryControl));
+ new_head_clone->set_req(LoopNode::EntryControl, new_entry);
new_head_clone->set_req(LoopNode::LoopBackControl, last_peel);
_igvn._worklist.push(new_head_clone);
diff --git a/hotspot/src/share/vm/opto/matcher.cpp b/hotspot/src/share/vm/opto/matcher.cpp
index 2bd3acd6f15..08a04198477 100644
--- a/hotspot/src/share/vm/opto/matcher.cpp
+++ b/hotspot/src/share/vm/opto/matcher.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2011, 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
@@ -49,6 +49,9 @@
#ifdef TARGET_ARCH_MODEL_zero
# include "adfiles/ad_zero.hpp"
#endif
+#ifdef TARGET_ARCH_MODEL_arm
+# include "adfiles/ad_arm.hpp"
+#endif
OptoReg::Name OptoReg::c_frame_pointer;
diff --git a/hotspot/src/share/vm/opto/matcher.hpp b/hotspot/src/share/vm/opto/matcher.hpp
index c1627c60f50..5a34bea6478 100644
--- a/hotspot/src/share/vm/opto/matcher.hpp
+++ b/hotspot/src/share/vm/opto/matcher.hpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2011, 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
@@ -427,6 +427,11 @@ public:
// Do ints take an entire long register or just half?
static const bool int_in_long;
+ // Do the processor's shift instructions only use the low 5/6 bits
+ // of the count for 32/64 bit ints? If not we need to do the masking
+ // ourselves.
+ static const bool need_masked_shift_count;
+
// This routine is run whenever a graph fails to match.
// If it returns, the compiler should bailout to interpreter without error.
// In non-product mode, SoftMatchFailure is false to detect non-canonical
diff --git a/hotspot/src/share/vm/opto/memnode.cpp b/hotspot/src/share/vm/opto/memnode.cpp
index b9ff98ff76d..d5d53132a3a 100644
--- a/hotspot/src/share/vm/opto/memnode.cpp
+++ b/hotspot/src/share/vm/opto/memnode.cpp
@@ -2617,54 +2617,28 @@ Node* ClearArrayNode::clear_memory(Node* ctl, Node* mem, Node* dest,
}
//=============================================================================
-// Do we match on this edge? No memory edges
-uint StrCompNode::match_edge(uint idx) const {
- return idx == 2 || idx == 3; // StrComp (Binary str1 cnt1) (Binary str2 cnt2)
+// Do not match memory edge.
+uint StrIntrinsicNode::match_edge(uint idx) const {
+ return idx == 2 || idx == 3;
}
//------------------------------Ideal------------------------------------------
// Return a node which is more "ideal" than the current node. Strip out
// control copies
-Node *StrCompNode::Ideal(PhaseGVN *phase, bool can_reshape){
- return remove_dead_region(phase, can_reshape) ? this : NULL;
-}
+Node *StrIntrinsicNode::Ideal(PhaseGVN *phase, bool can_reshape) {
+ if (remove_dead_region(phase, can_reshape)) return this;
-//=============================================================================
-// Do we match on this edge? No memory edges
-uint StrEqualsNode::match_edge(uint idx) const {
- return idx == 2 || idx == 3; // StrEquals (Binary str1 str2) cnt
-}
-
-//------------------------------Ideal------------------------------------------
-// Return a node which is more "ideal" than the current node. Strip out
-// control copies
-Node *StrEqualsNode::Ideal(PhaseGVN *phase, bool can_reshape){
- return remove_dead_region(phase, can_reshape) ? this : NULL;
-}
-
-//=============================================================================
-// Do we match on this edge? No memory edges
-uint StrIndexOfNode::match_edge(uint idx) const {
- return idx == 2 || idx == 3; // StrIndexOf (Binary str1 cnt1) (Binary str2 cnt2)
-}
-
-//------------------------------Ideal------------------------------------------
-// Return a node which is more "ideal" than the current node. Strip out
-// control copies
-Node *StrIndexOfNode::Ideal(PhaseGVN *phase, bool can_reshape){
- return remove_dead_region(phase, can_reshape) ? this : NULL;
-}
-
-//=============================================================================
-// Do we match on this edge? No memory edges
-uint AryEqNode::match_edge(uint idx) const {
- return idx == 2 || idx == 3; // StrEquals ary1 ary2
-}
-//------------------------------Ideal------------------------------------------
-// Return a node which is more "ideal" than the current node. Strip out
-// control copies
-Node *AryEqNode::Ideal(PhaseGVN *phase, bool can_reshape){
- return remove_dead_region(phase, can_reshape) ? this : NULL;
+ if (can_reshape) {
+ Node* mem = phase->transform(in(MemNode::Memory));
+ // If transformed to a MergeMem, get the desired slice
+ uint alias_idx = phase->C->get_alias_index(adr_type());
+ mem = mem->is_MergeMem() ? mem->as_MergeMem()->memory_at(alias_idx) : mem;
+ if (mem != in(MemNode::Memory)) {
+ set_req(MemNode::Memory, mem);
+ return this;
+ }
+ }
+ return NULL;
}
//=============================================================================
diff --git a/hotspot/src/share/vm/opto/memnode.hpp b/hotspot/src/share/vm/opto/memnode.hpp
index dec1b0ab1fb..9608b3382d3 100644
--- a/hotspot/src/share/vm/opto/memnode.hpp
+++ b/hotspot/src/share/vm/opto/memnode.hpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2011, 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
@@ -776,67 +776,69 @@ public:
static bool step_through(Node** np, uint instance_id, PhaseTransform* phase);
};
-//------------------------------StrComp-------------------------------------
-class StrCompNode: public Node {
+//------------------------------StrIntrinsic-------------------------------
+// Base class for Ideal nodes used in String instrinsic code.
+class StrIntrinsicNode: public Node {
public:
- StrCompNode(Node* control, Node* char_array_mem,
- Node* s1, Node* c1,
- Node* s2, Node* c2): Node(control, char_array_mem,
- s1, c1,
- s2, c2) {};
- virtual int Opcode() const;
+ StrIntrinsicNode(Node* control, Node* char_array_mem,
+ Node* s1, Node* c1, Node* s2, Node* c2):
+ Node(control, char_array_mem, s1, c1, s2, c2) {
+ }
+
+ StrIntrinsicNode(Node* control, Node* char_array_mem,
+ Node* s1, Node* s2, Node* c):
+ Node(control, char_array_mem, s1, s2, c) {
+ }
+
+ StrIntrinsicNode(Node* control, Node* char_array_mem,
+ Node* s1, Node* s2):
+ Node(control, char_array_mem, s1, s2) {
+ }
+
virtual bool depends_only_on_test() const { return false; }
- virtual const Type* bottom_type() const { return TypeInt::INT; }
virtual const TypePtr* adr_type() const { return TypeAryPtr::CHARS; }
virtual uint match_edge(uint idx) const;
virtual uint ideal_reg() const { return Op_RegI; }
virtual Node *Ideal(PhaseGVN *phase, bool can_reshape);
};
+//------------------------------StrComp-------------------------------------
+class StrCompNode: public StrIntrinsicNode {
+public:
+ StrCompNode(Node* control, Node* char_array_mem,
+ Node* s1, Node* c1, Node* s2, Node* c2):
+ StrIntrinsicNode(control, char_array_mem, s1, c1, s2, c2) {};
+ virtual int Opcode() const;
+ virtual const Type* bottom_type() const { return TypeInt::INT; }
+};
+
//------------------------------StrEquals-------------------------------------
-class StrEqualsNode: public Node {
+class StrEqualsNode: public StrIntrinsicNode {
public:
StrEqualsNode(Node* control, Node* char_array_mem,
- Node* s1, Node* s2, Node* c): Node(control, char_array_mem,
- s1, s2, c) {};
+ Node* s1, Node* s2, Node* c):
+ StrIntrinsicNode(control, char_array_mem, s1, s2, c) {};
virtual int Opcode() const;
- virtual bool depends_only_on_test() const { return false; }
virtual const Type* bottom_type() const { return TypeInt::BOOL; }
- virtual const TypePtr* adr_type() const { return TypeAryPtr::CHARS; }
- virtual uint match_edge(uint idx) const;
- virtual uint ideal_reg() const { return Op_RegI; }
- virtual Node *Ideal(PhaseGVN *phase, bool can_reshape);
};
//------------------------------StrIndexOf-------------------------------------
-class StrIndexOfNode: public Node {
+class StrIndexOfNode: public StrIntrinsicNode {
public:
StrIndexOfNode(Node* control, Node* char_array_mem,
- Node* s1, Node* c1,
- Node* s2, Node* c2): Node(control, char_array_mem,
- s1, c1,
- s2, c2) {};
+ Node* s1, Node* c1, Node* s2, Node* c2):
+ StrIntrinsicNode(control, char_array_mem, s1, c1, s2, c2) {};
virtual int Opcode() const;
- virtual bool depends_only_on_test() const { return false; }
virtual const Type* bottom_type() const { return TypeInt::INT; }
- virtual const TypePtr* adr_type() const { return TypeAryPtr::CHARS; }
- virtual uint match_edge(uint idx) const;
- virtual uint ideal_reg() const { return Op_RegI; }
- virtual Node *Ideal(PhaseGVN *phase, bool can_reshape);
};
//------------------------------AryEq---------------------------------------
-class AryEqNode: public Node {
+class AryEqNode: public StrIntrinsicNode {
public:
- AryEqNode(Node* control, Node* char_array_mem,
- Node* s1, Node* s2): Node(control, char_array_mem, s1, s2) {};
+ AryEqNode(Node* control, Node* char_array_mem, Node* s1, Node* s2):
+ StrIntrinsicNode(control, char_array_mem, s1, s2) {};
virtual int Opcode() const;
- virtual bool depends_only_on_test() const { return false; }
virtual const Type* bottom_type() const { return TypeInt::BOOL; }
- virtual const TypePtr* adr_type() const { return TypeAryPtr::CHARS; }
- virtual uint match_edge(uint idx) const;
- virtual uint ideal_reg() const { return Op_RegI; }
- virtual Node *Ideal(PhaseGVN *phase, bool can_reshape);
};
//------------------------------MemBar-----------------------------------------
diff --git a/hotspot/src/share/vm/opto/node.cpp b/hotspot/src/share/vm/opto/node.cpp
index 8174605f4e5..33bfeb68214 100644
--- a/hotspot/src/share/vm/opto/node.cpp
+++ b/hotspot/src/share/vm/opto/node.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2011, 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
@@ -1373,12 +1373,12 @@ static inline bool NotANode(const Node* n) {
//------------------------------find------------------------------------------
// Find a neighbor of this Node with the given _idx
// If idx is negative, find its absolute value, following both _in and _out.
-static void find_recur( Node* &result, Node *n, int idx, bool only_ctrl,
- VectorSet &old_space, VectorSet &new_space ) {
+static void find_recur(Compile* C, Node* &result, Node *n, int idx, bool only_ctrl,
+ VectorSet* old_space, VectorSet* new_space ) {
int node_idx = (idx >= 0) ? idx : -idx;
if (NotANode(n)) return; // Gracefully handle NULL, -1, 0xabababab, etc.
- // Contained in new_space or old_space?
- VectorSet *v = Compile::current()->node_arena()->contains(n) ? &new_space : &old_space;
+ // Contained in new_space or old_space? Check old_arena first since it's mostly empty.
+ VectorSet *v = C->old_arena()->contains(n) ? old_space : new_space;
if( v->test(n->_idx) ) return;
if( (int)n->_idx == node_idx
debug_only(|| n->debug_idx() == node_idx) ) {
@@ -1390,19 +1390,23 @@ static void find_recur( Node* &result, Node *n, int idx, bool only_ctrl,
v->set(n->_idx);
for( uint i=0; ilen(); i++ ) {
if( only_ctrl && !(n->is_Region()) && (n->Opcode() != Op_Root) && (i != TypeFunc::Control) ) continue;
- find_recur( result, n->in(i), idx, only_ctrl, old_space, new_space );
+ find_recur(C, result, n->in(i), idx, only_ctrl, old_space, new_space );
}
// Search along forward edges also:
if (idx < 0 && !only_ctrl) {
for( uint j=0; joutcnt(); j++ ) {
- find_recur( result, n->raw_out(j), idx, only_ctrl, old_space, new_space );
+ find_recur(C, result, n->raw_out(j), idx, only_ctrl, old_space, new_space );
}
}
#ifdef ASSERT
- // Search along debug_orig edges last:
- for (Node* orig = n->debug_orig(); orig != NULL && n != orig; orig = orig->debug_orig()) {
- if (NotANode(orig)) break;
- find_recur( result, orig, idx, only_ctrl, old_space, new_space );
+ // Search along debug_orig edges last, checking for cycles
+ Node* orig = n->debug_orig();
+ if (orig != NULL) {
+ do {
+ if (NotANode(orig)) break;
+ find_recur(C, result, orig, idx, only_ctrl, old_space, new_space );
+ orig = orig->debug_orig();
+ } while (orig != NULL && orig != n->debug_orig());
}
#endif //ASSERT
}
@@ -1417,7 +1421,7 @@ Node* Node::find(int idx) const {
ResourceArea *area = Thread::current()->resource_area();
VectorSet old_space(area), new_space(area);
Node* result = NULL;
- find_recur( result, (Node*) this, idx, false, old_space, new_space );
+ find_recur(Compile::current(), result, (Node*) this, idx, false, &old_space, &new_space );
return result;
}
@@ -1427,7 +1431,7 @@ Node* Node::find_ctrl(int idx) const {
ResourceArea *area = Thread::current()->resource_area();
VectorSet old_space(area), new_space(area);
Node* result = NULL;
- find_recur( result, (Node*) this, idx, true, old_space, new_space );
+ find_recur(Compile::current(), result, (Node*) this, idx, true, &old_space, &new_space );
return result;
}
#endif
diff --git a/hotspot/src/share/vm/opto/output.cpp b/hotspot/src/share/vm/opto/output.cpp
index a57508b418e..1205cc2639d 100644
--- a/hotspot/src/share/vm/opto/output.cpp
+++ b/hotspot/src/share/vm/opto/output.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1998, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 2011, 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
diff --git a/hotspot/src/share/vm/opto/output.hpp b/hotspot/src/share/vm/opto/output.hpp
index 51eaa5c5e2b..50b6e76035e 100644
--- a/hotspot/src/share/vm/opto/output.hpp
+++ b/hotspot/src/share/vm/opto/output.hpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2011, 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
diff --git a/hotspot/src/share/vm/opto/parse1.cpp b/hotspot/src/share/vm/opto/parse1.cpp
index 589a541048e..497042c1f03 100644
--- a/hotspot/src/share/vm/opto/parse1.cpp
+++ b/hotspot/src/share/vm/opto/parse1.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2011, 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
diff --git a/hotspot/src/share/vm/opto/parse2.cpp b/hotspot/src/share/vm/opto/parse2.cpp
index 162878e6aa8..808a2bdeb3a 100644
--- a/hotspot/src/share/vm/opto/parse2.cpp
+++ b/hotspot/src/share/vm/opto/parse2.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1998, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 2011, 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
diff --git a/hotspot/src/share/vm/opto/phaseX.hpp b/hotspot/src/share/vm/opto/phaseX.hpp
index 7f1060c05cd..4d19708ede8 100644
--- a/hotspot/src/share/vm/opto/phaseX.hpp
+++ b/hotspot/src/share/vm/opto/phaseX.hpp
@@ -471,6 +471,13 @@ public:
_delay_transform = delay;
}
+ // Clone loop predicates. Defined in loopTransform.cpp.
+ Node* clone_loop_predicates(Node* old_entry, Node* new_entry);
+ Node* move_loop_predicates(Node* old_entry, Node* new_entry);
+ // Create a new if below new_entry for the predicate to be cloned
+ ProjNode* create_new_if_for_predicate(ProjNode* cont_proj, Node* new_entry,
+ Deoptimization::DeoptReason reason);
+
#ifndef PRODUCT
protected:
// Sub-quadratic implementation of VerifyIterativeGVN.
diff --git a/hotspot/src/share/vm/opto/regmask.cpp b/hotspot/src/share/vm/opto/regmask.cpp
index 3841a42fc53..ce220f01be9 100644
--- a/hotspot/src/share/vm/opto/regmask.cpp
+++ b/hotspot/src/share/vm/opto/regmask.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2011, 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
diff --git a/hotspot/src/share/vm/opto/regmask.hpp b/hotspot/src/share/vm/opto/regmask.hpp
index 7c3e7182580..e50ff84ca16 100644
--- a/hotspot/src/share/vm/opto/regmask.hpp
+++ b/hotspot/src/share/vm/opto/regmask.hpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2011, 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
diff --git a/hotspot/src/share/vm/opto/runtime.cpp b/hotspot/src/share/vm/opto/runtime.cpp
index b0544fef2ec..c2ddea145d1 100644
--- a/hotspot/src/share/vm/opto/runtime.cpp
+++ b/hotspot/src/share/vm/opto/runtime.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1998, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 2011, 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
diff --git a/hotspot/src/share/vm/opto/split_if.cpp b/hotspot/src/share/vm/opto/split_if.cpp
index 91792368f04..dba6ed1f29a 100644
--- a/hotspot/src/share/vm/opto/split_if.cpp
+++ b/hotspot/src/share/vm/opto/split_if.cpp
@@ -399,6 +399,9 @@ void PhaseIdealLoop::do_split_if( Node *iff ) {
#ifndef PRODUCT
if( PrintOpto && VerifyLoopOptimizations )
tty->print_cr("Split-if");
+ if (TraceLoopOpts) {
+ tty->print_cr("SplitIf");
+ }
#endif
C->set_major_progress();
Node *region = iff->in(0);
diff --git a/hotspot/src/share/vm/opto/stringopts.cpp b/hotspot/src/share/vm/opto/stringopts.cpp
index c039480118f..7f5f318dbf7 100644
--- a/hotspot/src/share/vm/opto/stringopts.cpp
+++ b/hotspot/src/share/vm/opto/stringopts.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2009, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2009, 2011, 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
diff --git a/hotspot/src/share/vm/opto/superword.cpp b/hotspot/src/share/vm/opto/superword.cpp
index 1230ebe51fc..6e1be24ddfe 100644
--- a/hotspot/src/share/vm/opto/superword.cpp
+++ b/hotspot/src/share/vm/opto/superword.cpp
@@ -1132,6 +1132,13 @@ void SuperWord::co_locate_pack(Node_List* pk) {
void SuperWord::output() {
if (_packset.length() == 0) return;
+#ifndef PRODUCT
+ if (TraceLoopOpts) {
+ tty->print("SuperWord ");
+ lpt()->dump_head();
+ }
+#endif
+
// MUST ENSURE main loop's initial value is properly aligned:
// (iv_initial_value + min_iv_offset) % vector_width_in_bytes() == 0
diff --git a/hotspot/src/share/vm/opto/type.hpp b/hotspot/src/share/vm/opto/type.hpp
index 56ea820a734..4d08d50d542 100644
--- a/hotspot/src/share/vm/opto/type.hpp
+++ b/hotspot/src/share/vm/opto/type.hpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2011, 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
diff --git a/hotspot/src/share/vm/opto/vectornode.hpp b/hotspot/src/share/vm/opto/vectornode.hpp
index b4915ddfdda..4d28703c885 100644
--- a/hotspot/src/share/vm/opto/vectornode.hpp
+++ b/hotspot/src/share/vm/opto/vectornode.hpp
@@ -32,6 +32,7 @@
//------------------------------VectorNode--------------------------------------
// Vector Operation
class VectorNode : public Node {
+ virtual uint size_of() const { return sizeof(*this); }
protected:
uint _length; // vector length
virtual BasicType elt_basic_type() const = 0; // Vector element basic type
diff --git a/hotspot/src/share/vm/precompiled.hpp b/hotspot/src/share/vm/precompiled.hpp
index 1b804cbf215..87129d11847 100644
--- a/hotspot/src/share/vm/precompiled.hpp
+++ b/hotspot/src/share/vm/precompiled.hpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2010, 2011, 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
diff --git a/hotspot/src/share/vm/prims/forte.cpp b/hotspot/src/share/vm/prims/forte.cpp
index 3c48f01d245..023921c33b6 100644
--- a/hotspot/src/share/vm/prims/forte.cpp
+++ b/hotspot/src/share/vm/prims/forte.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2011, 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
diff --git a/hotspot/src/share/vm/prims/jni_md.h b/hotspot/src/share/vm/prims/jni_md.h
index 72aa1dc3977..7fa58291109 100644
--- a/hotspot/src/share/vm/prims/jni_md.h
+++ b/hotspot/src/share/vm/prims/jni_md.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2011, 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
diff --git a/hotspot/src/share/vm/prims/jvm.h b/hotspot/src/share/vm/prims/jvm.h
index 07097af3cc5..f37d83342f8 100644
--- a/hotspot/src/share/vm/prims/jvm.h
+++ b/hotspot/src/share/vm/prims/jvm.h
@@ -1062,7 +1062,7 @@ enum {
JVM_CONSTANT_NameAndType,
JVM_CONSTANT_MethodHandle = 15, // JSR 292
JVM_CONSTANT_MethodType = 16, // JSR 292
- JVM_CONSTANT_InvokeDynamicTrans = 17, // JSR 292, only occurs in old class files
+ //JVM_CONSTANT_(unused) = 17, // JSR 292 early drafts only
JVM_CONSTANT_InvokeDynamic = 18, // JSR 292
JVM_CONSTANT_ExternalMax = 18 // Last tag found in classfiles
};
diff --git a/hotspot/src/share/vm/prims/jvm_misc.hpp b/hotspot/src/share/vm/prims/jvm_misc.hpp
index 18795124660..2b46e362393 100644
--- a/hotspot/src/share/vm/prims/jvm_misc.hpp
+++ b/hotspot/src/share/vm/prims/jvm_misc.hpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1998, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 2011, 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
diff --git a/hotspot/src/share/vm/prims/jvmtiClassFileReconstituter.cpp b/hotspot/src/share/vm/prims/jvmtiClassFileReconstituter.cpp
index fa08cf712d0..d12d69cee71 100644
--- a/hotspot/src/share/vm/prims/jvmtiClassFileReconstituter.cpp
+++ b/hotspot/src/share/vm/prims/jvmtiClassFileReconstituter.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2011, 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
diff --git a/hotspot/src/share/vm/prims/jvmtiClassFileReconstituter.hpp b/hotspot/src/share/vm/prims/jvmtiClassFileReconstituter.hpp
index 42cb9f23986..60a5ffb0956 100644
--- a/hotspot/src/share/vm/prims/jvmtiClassFileReconstituter.hpp
+++ b/hotspot/src/share/vm/prims/jvmtiClassFileReconstituter.hpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2011, 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
diff --git a/hotspot/src/share/vm/prims/jvmtiEventController.cpp b/hotspot/src/share/vm/prims/jvmtiEventController.cpp
index ccb22b550b8..6b7b72b7ae6 100644
--- a/hotspot/src/share/vm/prims/jvmtiEventController.cpp
+++ b/hotspot/src/share/vm/prims/jvmtiEventController.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2011, 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
diff --git a/hotspot/src/share/vm/prims/jvmtiManageCapabilities.cpp b/hotspot/src/share/vm/prims/jvmtiManageCapabilities.cpp
index cca51ef2bfd..cd18199aa69 100644
--- a/hotspot/src/share/vm/prims/jvmtiManageCapabilities.cpp
+++ b/hotspot/src/share/vm/prims/jvmtiManageCapabilities.cpp
@@ -319,8 +319,11 @@ void JvmtiManageCapabilities::update() {
bool enter_all_methods =
interp_events ||
avail.can_generate_breakpoint_events;
- UseFastEmptyMethods = !enter_all_methods;
- UseFastAccessorMethods = !enter_all_methods;
+ if (enter_all_methods) {
+ // Disable these when tracking the bytecodes
+ UseFastEmptyMethods = false;
+ UseFastAccessorMethods = false;
+ }
if (avail.can_generate_breakpoint_events) {
RewriteFrequentPairs = false;
diff --git a/hotspot/src/share/vm/prims/jvmtiRedefineClasses.hpp b/hotspot/src/share/vm/prims/jvmtiRedefineClasses.hpp
index bf0778b535a..c5f4bdd4b84 100644
--- a/hotspot/src/share/vm/prims/jvmtiRedefineClasses.hpp
+++ b/hotspot/src/share/vm/prims/jvmtiRedefineClasses.hpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2011, 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
diff --git a/hotspot/src/share/vm/prims/jvmtiTagMap.hpp b/hotspot/src/share/vm/prims/jvmtiTagMap.hpp
index 9abdd9b37a1..2a460edc1e0 100644
--- a/hotspot/src/share/vm/prims/jvmtiTagMap.hpp
+++ b/hotspot/src/share/vm/prims/jvmtiTagMap.hpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2011, 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
diff --git a/hotspot/src/share/vm/prims/methodHandleWalk.cpp b/hotspot/src/share/vm/prims/methodHandleWalk.cpp
index 915cf35995c..3570d2db403 100644
--- a/hotspot/src/share/vm/prims/methodHandleWalk.cpp
+++ b/hotspot/src/share/vm/prims/methodHandleWalk.cpp
@@ -959,12 +959,6 @@ MethodHandleCompiler::make_invoke(methodOop m, vmIntrinsics::ID iid,
if (m == NULL) {
// Get the intrinsic methodOop.
m = vmIntrinsics::method_for(iid);
- if (m == NULL && iid == vmIntrinsics::_checkSpreadArgument && AllowTransitionalJSR292) {
- m = vmIntrinsics::method_for(vmIntrinsics::_checkSpreadArgument_TRANS);
- if (m == NULL)
- // sun.dyn.MethodHandleImpl not found, look for java.dyn.MethodHandleNatives:
- m = vmIntrinsics::method_for(vmIntrinsics::_checkSpreadArgument_TRANS2);
- }
if (m == NULL) {
ArgToken zero;
lose(vmIntrinsics::name_at(iid), CHECK_(zero));
diff --git a/hotspot/src/share/vm/prims/methodHandles.cpp b/hotspot/src/share/vm/prims/methodHandles.cpp
index 6da4b969615..e882c85627d 100644
--- a/hotspot/src/share/vm/prims/methodHandles.cpp
+++ b/hotspot/src/share/vm/prims/methodHandles.cpp
@@ -112,7 +112,7 @@ bool MethodHandles::spot_check_entry_names() {
// MethodHandles::generate_adapters
//
void MethodHandles::generate_adapters() {
- if (!EnableMethodHandles || SystemDictionary::MethodHandle_klass() == NULL) return;
+ if (!EnableInvokeDynamic || SystemDictionary::MethodHandle_klass() == NULL) return;
assert(_adapter_code == NULL, "generate only once");
@@ -143,7 +143,7 @@ void MethodHandlesAdapterGenerator::generate() {
void MethodHandles::set_enabled(bool z) {
if (_enabled != z) {
- guarantee(z && EnableMethodHandles, "can only enable once, and only if -XX:+EnableMethodHandles");
+ guarantee(z && EnableInvokeDynamic, "can only enable once, and only if -XX:+EnableInvokeDynamic");
_enabled = z;
}
}
@@ -2488,74 +2488,21 @@ JVM_ENTRY(jint, MHN_getMembers(JNIEnv *env, jobject igcls,
}
JVM_END
-JVM_ENTRY(void, MHN_registerBootstrap(JNIEnv *env, jobject igcls, jclass caller_jh, jobject bsm_jh)) {
- instanceKlassHandle ik = MethodHandles::resolve_instance_klass(caller_jh, THREAD);
- if (!AllowTransitionalJSR292) {
- THROW_MSG(vmSymbols::java_lang_IllegalArgumentException(),
- "registerBootstrapMethod is only supported in JSR 292 EDR");
- }
- ik->link_class(CHECK);
- if (!java_lang_invoke_MethodHandle::is_instance(JNIHandles::resolve(bsm_jh))) {
- THROW_MSG(vmSymbols::java_lang_IllegalArgumentException(), "method handle");
- }
- const char* err = NULL;
- if (ik->is_initialized() || ik->is_in_error_state()) {
- err = "too late: class is already initialized";
- } else {
- ObjectLocker ol(ik, THREAD); // note: this should be a recursive lock
- if (ik->is_not_initialized() ||
- (ik->is_being_initialized() && ik->is_reentrant_initialization(THREAD))) {
- if (ik->bootstrap_method() != NULL) {
- err = "class is already equipped with a bootstrap method";
- } else {
- ik->set_bootstrap_method(JNIHandles::resolve_non_null(bsm_jh));
- err = NULL;
- }
- } else {
- err = "class is already initialized";
- if (ik->is_being_initialized())
- err = "class is already being initialized in a different thread";
- }
- }
- if (err != NULL) {
- THROW_MSG(vmSymbols::java_lang_IllegalStateException(), err);
- }
-}
-JVM_END
-
-JVM_ENTRY(jobject, MHN_getBootstrap(JNIEnv *env, jobject igcls, jclass caller_jh)) {
- if (!AllowTransitionalJSR292)
- THROW_MSG_NULL(vmSymbols::java_lang_IllegalArgumentException(), "getBootstrap: transitional only");
- instanceKlassHandle ik = MethodHandles::resolve_instance_klass(caller_jh, THREAD);
- return JNIHandles::make_local(THREAD, ik->bootstrap_method());
-}
-JVM_END
-
-JVM_ENTRY(void, MHN_setCallSiteTarget(JNIEnv *env, jobject igcls, jobject site_jh, jobject target_jh)) {
- if (!AllowTransitionalJSR292)
- THROW_MSG(vmSymbols::java_lang_IllegalArgumentException(), "setCallSite: transitional only");
-}
-JVM_END
-
/// JVM_RegisterMethodHandleMethods
#define LANG "Ljava/lang/"
-#define JLINV "Ljava/lang/invoke/" /* standard package */
-#define JDYN "Ljava/dyn/" /* alternative package to JLINV if AllowTransitionalJSR292 */
-#define IDYN "Lsun/dyn/" /* alternative package to JDYN if AllowTransitionalJSR292 */
-// FIXME: After AllowTransitionalJSR292 is removed, replace JDYN and IDYN by JLINV.
+#define JLINV "Ljava/lang/invoke/"
#define OBJ LANG"Object;"
#define CLS LANG"Class;"
#define STRG LANG"String;"
-#define CST JDYN"CallSite;"
-#define MT JDYN"MethodType;"
-#define MH JDYN"MethodHandle;"
-#define MEM IDYN"MemberName;"
-#define AMH IDYN"AdapterMethodHandle;"
-#define BMH IDYN"BoundMethodHandle;"
-#define DMH IDYN"DirectMethodHandle;"
+#define MT JLINV"MethodType;"
+#define MH JLINV"MethodHandle;"
+#define MEM JLINV"MemberName;"
+#define AMH JLINV"AdapterMethodHandle;"
+#define BMH JLINV"BoundMethodHandle;"
+#define DMH JLINV"DirectMethodHandle;"
#define CC (char*) /*cast a literal from (const char*)*/
#define FN_PTR(f) CAST_FROM_FN_PTR(void*, &f)
@@ -2579,143 +2526,51 @@ static JNINativeMethod methods[] = {
{CC"getMembers", CC"("CLS""STRG""STRG"I"CLS"I["MEM")I", FN_PTR(MHN_getMembers)}
};
-// More entry points specifically for EnableInvokeDynamic.
-// FIXME: Remove methods2 after AllowTransitionalJSR292 is removed.
-static JNINativeMethod methods2[] = {
- {CC"registerBootstrap", CC"("CLS MH")V", FN_PTR(MHN_registerBootstrap)},
- {CC"getBootstrap", CC"("CLS")"MH, FN_PTR(MHN_getBootstrap)},
- {CC"setCallSiteTarget", CC"("CST MH")V", FN_PTR(MHN_setCallSiteTarget)}
-};
-
-static void hack_signatures(JNINativeMethod* methods, jint num_methods, const char* from_sig, const char* to_sig) {
- for (int i = 0; i < num_methods; i++) {
- const char* sig = methods[i].signature;
- if (!strstr(sig, from_sig)) continue;
- size_t buflen = strlen(sig) + 100;
- char* buf = NEW_C_HEAP_ARRAY(char, buflen);
- char* bufp = buf;
- const char* sigp = sig;
- size_t from_len = strlen(from_sig), to_len = strlen(to_sig);
- while (*sigp != '\0') {
- assert(bufp < buf + buflen - to_len - 1, "oob");
- if (strncmp(sigp, from_sig, from_len) != 0) {
- *bufp++ = *sigp++;
- } else {
- strcpy(bufp, to_sig);
- bufp += to_len;
- sigp += from_len;
- }
- }
- *bufp = '\0';
- methods[i].signature = buf; // replace with new signature
- if (TraceMethodHandles)
- tty->print_cr("MethodHandleNatives: %s: change signature %s => %s", methods[i].name, sig, buf);
- }
-}
-
// This one function is exported, used by NativeLookup.
JVM_ENTRY(void, JVM_RegisterMethodHandleMethods(JNIEnv *env, jclass MHN_class)) {
assert(MethodHandles::spot_check_entry_names(), "entry enum is OK");
- // note: this explicit warning-producing stuff will be replaced by auto-detection of the JSR 292 classes
-
- if (!EnableMethodHandles) {
- warning("JSR 292 method handles are disabled in this JVM. Use -XX:+UnlockExperimentalVMOptions -XX:+EnableMethodHandles to enable.");
+ if (!EnableInvokeDynamic) {
+ warning("JSR 292 is disabled in this JVM. Use -XX:+UnlockDiagnosticVMOptions -XX:+EnableInvokeDynamic to enable.");
return; // bind nothing
}
- if (SystemDictionary::MethodHandleNatives_klass() != NULL &&
- SystemDictionary::MethodHandleNatives_klass() != java_lang_Class::as_klassOop(JNIHandles::resolve(MHN_class))) {
- warning("multiple versions of MethodHandleNatives in boot classpath; consider using -XX:+PreferTransitionalJSR292");
- THROW_MSG(vmSymbols::java_lang_InternalError(), "multiple versions of MethodHandleNatives in boot classpath; consider using -XX:+PreferTransitionalJSR292");
- }
-
bool enable_MH = true;
- // Loop control. FIXME: Replace by dead reckoning after AllowTransitionalJSR292 is removed.
- bool registered_natives = false;
- bool try_plain = true, try_JDYN = true, try_IDYN = true;
- for (;;) {
+ {
ThreadToNativeFromVM ttnfv(thread);
- if (try_plain) { try_plain = false; }
- else if (try_JDYN) { try_JDYN = false; hack_signatures(methods, sizeof(methods)/sizeof(JNINativeMethod), IDYN, JDYN); }
- else if (try_IDYN) { try_IDYN = false; hack_signatures(methods, sizeof(methods)/sizeof(JNINativeMethod), JDYN, JLINV); }
- else { break; }
int status = env->RegisterNatives(MHN_class, methods, sizeof(methods)/sizeof(JNINativeMethod));
if (env->ExceptionOccurred()) {
+ MethodHandles::set_enabled(false);
+ warning("JSR 292 method handle code is mismatched to this JVM. Disabling support.");
+ enable_MH = false;
env->ExceptionClear();
- // and try again...
- } else {
- registered_natives = true;
- break;
}
}
- if (!registered_natives) {
- MethodHandles::set_enabled(false);
- warning("JSR 292 method handle code is mismatched to this JVM. Disabling support.");
- enable_MH = false;
- }
if (enable_MH) {
- bool found_raise_exception = false;
KlassHandle MHN_klass = SystemDictionaryHandles::MethodHandleNatives_klass();
- KlassHandle MHI_klass = SystemDictionaryHandles::MethodHandleImpl_klass();
- // Loop control. FIXME: Replace by dead reckoning after AllowTransitionalJSR292 is removed.
- bool try_MHN = true, try_MHI = AllowTransitionalJSR292;
- for (;;) {
- KlassHandle try_klass;
- if (try_MHN) { try_MHN = false; try_klass = MHN_klass; }
- else if (try_MHI) { try_MHI = false; try_klass = MHI_klass; }
- else { break; }
- if (try_klass.is_null()) continue;
+ if (MHN_klass.not_null()) {
TempNewSymbol raiseException_name = SymbolTable::new_symbol("raiseException", CHECK);
TempNewSymbol raiseException_sig = SymbolTable::new_symbol("(ILjava/lang/Object;Ljava/lang/Object;)V", CHECK);
- methodOop raiseException_method = instanceKlass::cast(try_klass->as_klassOop())
+ methodOop raiseException_method = instanceKlass::cast(MHN_klass->as_klassOop())
->find_method(raiseException_name, raiseException_sig);
if (raiseException_method != NULL && raiseException_method->is_static()) {
MethodHandles::set_raise_exception_method(raiseException_method);
- found_raise_exception = true;
- break;
+ } else {
+ warning("JSR 292 method handle code is mismatched to this JVM. Disabling support.");
+ enable_MH = false;
}
- }
- if (!found_raise_exception) {
- warning("JSR 292 method handle code is mismatched to this JVM. Disabling support.");
+ } else {
enable_MH = false;
}
}
if (enable_MH) {
- if (AllowTransitionalJSR292) {
- // We need to link the MethodHandleImpl klass before we generate
- // the method handle adapters as the _raise_exception adapter uses
- // one of its methods (and its c2i-adapter).
- klassOop k = SystemDictionary::MethodHandleImpl_klass();
- if (k != NULL) {
- instanceKlass* ik = instanceKlass::cast(k);
- ik->link_class(CHECK);
- }
- }
-
MethodHandles::generate_adapters();
MethodHandles::set_enabled(true);
}
-
- if (!EnableInvokeDynamic) {
- warning("JSR 292 invokedynamic is disabled in this JVM. Use -XX:+UnlockExperimentalVMOptions -XX:+EnableInvokeDynamic to enable.");
- return; // bind nothing
- }
-
- if (AllowTransitionalJSR292) {
- ThreadToNativeFromVM ttnfv(thread);
-
- int status = env->RegisterNatives(MHN_class, methods2, sizeof(methods2)/sizeof(JNINativeMethod));
- if (env->ExceptionOccurred()) {
- // Don't do this, since it's too late:
- // MethodHandles::set_enabled(false)
- env->ExceptionClear();
- }
- }
}
JVM_END
diff --git a/hotspot/src/share/vm/prims/nativeLookup.cpp b/hotspot/src/share/vm/prims/nativeLookup.cpp
index f05061bd0c0..af625937e63 100644
--- a/hotspot/src/share/vm/prims/nativeLookup.cpp
+++ b/hotspot/src/share/vm/prims/nativeLookup.cpp
@@ -117,8 +117,6 @@ static JNINativeMethod lookup_special_native_methods[] = {
{ CC"Java_sun_misc_Unsafe_registerNatives", NULL, FN_PTR(JVM_RegisterUnsafeMethods) },
{ CC"Java_java_lang_invoke_MethodHandleNatives_registerNatives", NULL, FN_PTR(JVM_RegisterMethodHandleMethods) },
- { CC"Java_sun_dyn_MethodHandleNatives_registerNatives", NULL, FN_PTR(JVM_RegisterMethodHandleMethods) }, // AllowTransitionalJSR292
- { CC"Java_java_dyn_MethodHandleNatives_registerNatives", NULL, FN_PTR(JVM_RegisterMethodHandleMethods) }, // AllowTransitionalJSR292
{ CC"Java_sun_misc_Perf_registerNatives", NULL, FN_PTR(JVM_RegisterPerfMethods) }
};
diff --git a/hotspot/src/share/vm/prims/unsafe.cpp b/hotspot/src/share/vm/prims/unsafe.cpp
index a4531e948a0..5458bf70e54 100644
--- a/hotspot/src/share/vm/prims/unsafe.cpp
+++ b/hotspot/src/share/vm/prims/unsafe.cpp
@@ -1560,7 +1560,7 @@ JVM_ENTRY(void, JVM_RegisterUnsafeMethods(JNIEnv *env, jclass unsafecls))
}
}
}
- if (AnonymousClasses) {
+ if (EnableInvokeDynamic) {
env->RegisterNatives(unsafecls, anonk_methods, sizeof(anonk_methods)/sizeof(JNINativeMethod));
if (env->ExceptionOccurred()) {
if (PrintMiscellaneous && (Verbose || WizardMode)) {
diff --git a/hotspot/src/share/vm/runtime/arguments.cpp b/hotspot/src/share/vm/runtime/arguments.cpp
index 72bae90fd0c..76cad564f2e 100644
--- a/hotspot/src/share/vm/runtime/arguments.cpp
+++ b/hotspot/src/share/vm/runtime/arguments.cpp
@@ -244,6 +244,7 @@ static ObsoleteFlag obsolete_jvm_flags[] = {
{ "MaxLiveObjectEvacuationRatio",
JDK_Version::jdk_update(6,24), JDK_Version::jdk(8) },
{ "ForceSharedSpaces", JDK_Version::jdk_update(6,25), JDK_Version::jdk(8) },
+ { "AllowTransitionalJSR292", JDK_Version::jdk(7), JDK_Version::jdk(8) },
{ NULL, JDK_Version(0), JDK_Version(0) }
};
@@ -963,6 +964,16 @@ void Arguments::set_mode_flags(Mode mode) {
UseCompiler = true;
UseLoopCounter = true;
+#ifndef ZERO
+ // Turn these off for mixed and comp. Leave them on for Zero.
+ if (FLAG_IS_DEFAULT(UseFastAccessorMethods)) {
+ UseFastAccessorMethods = mode == _int;
+ }
+ if (FLAG_IS_DEFAULT(UseFastEmptyMethods)) {
+ UseFastEmptyMethods = mode == _int;
+ }
+#endif
+
// Default values may be platform/compiler dependent -
// use the saved values
ClipInlining = Arguments::_ClipInlining;
@@ -2975,21 +2986,28 @@ jint Arguments::parse(const JavaVMInitArgs* args) {
}
#endif // PRODUCT
- if (EnableInvokeDynamic && !EnableMethodHandles) {
- if (!FLAG_IS_DEFAULT(EnableMethodHandles)) {
- warning("forcing EnableMethodHandles true because EnableInvokeDynamic is true");
+ // Transitional
+ if (EnableMethodHandles || AnonymousClasses) {
+ if (!EnableInvokeDynamic && !FLAG_IS_DEFAULT(EnableInvokeDynamic)) {
+ warning("EnableMethodHandles and AnonymousClasses are obsolete. Keeping EnableInvokeDynamic disabled.");
+ } else {
+ EnableInvokeDynamic = true;
}
- EnableMethodHandles = true;
}
- if (EnableMethodHandles && !AnonymousClasses) {
- if (!FLAG_IS_DEFAULT(AnonymousClasses)) {
- warning("forcing AnonymousClasses true because EnableMethodHandles is true");
+
+ // JSR 292 is not supported before 1.7
+ if (!JDK_Version::is_gte_jdk17x_version()) {
+ if (EnableInvokeDynamic) {
+ if (!FLAG_IS_DEFAULT(EnableInvokeDynamic)) {
+ warning("JSR 292 is not supported before 1.7. Disabling support.");
+ }
+ EnableInvokeDynamic = false;
}
- AnonymousClasses = true;
}
- if ((EnableMethodHandles || AnonymousClasses) && ScavengeRootsInCode == 0) {
+
+ if (EnableInvokeDynamic && ScavengeRootsInCode == 0) {
if (!FLAG_IS_DEFAULT(ScavengeRootsInCode)) {
- warning("forcing ScavengeRootsInCode non-zero because EnableMethodHandles or AnonymousClasses is true");
+ warning("forcing ScavengeRootsInCode non-zero because EnableInvokeDynamic is true");
}
ScavengeRootsInCode = 1;
}
diff --git a/hotspot/src/share/vm/runtime/compilationPolicy.cpp b/hotspot/src/share/vm/runtime/compilationPolicy.cpp
index e5f1bf64b67..eac4426f845 100644
--- a/hotspot/src/share/vm/runtime/compilationPolicy.cpp
+++ b/hotspot/src/share/vm/runtime/compilationPolicy.cpp
@@ -396,8 +396,6 @@ void NonTieredCompPolicy::trace_osr_request(methodHandle method, nmethod* osr, i
// SimpleCompPolicy - compile current method
void SimpleCompPolicy::method_invocation_event( methodHandle m, TRAPS) {
- assert(UseCompiler || CompileTheWorld, "UseCompiler should be set by now.");
-
int hot_count = m->invocation_count();
reset_counter_for_invocation_event(m);
const char* comment = "count";
@@ -413,8 +411,6 @@ void SimpleCompPolicy::method_invocation_event( methodHandle m, TRAPS) {
}
void SimpleCompPolicy::method_back_branch_event(methodHandle m, int bci, TRAPS) {
- assert(UseCompiler || CompileTheWorld, "UseCompiler should be set by now.");
-
int hot_count = m->backedge_count();
const char* comment = "backedge_count";
@@ -432,8 +428,6 @@ const char* StackWalkCompPolicy::_msg = NULL;
// Consider m for compilation
void StackWalkCompPolicy::method_invocation_event(methodHandle m, TRAPS) {
- assert(UseCompiler || CompileTheWorld, "UseCompiler should be set by now.");
-
int hot_count = m->invocation_count();
reset_counter_for_invocation_event(m);
const char* comment = "count";
@@ -473,8 +467,6 @@ void StackWalkCompPolicy::method_invocation_event(methodHandle m, TRAPS) {
}
void StackWalkCompPolicy::method_back_branch_event(methodHandle m, int bci, TRAPS) {
- assert(UseCompiler || CompileTheWorld, "UseCompiler should be set by now.");
-
int hot_count = m->backedge_count();
const char* comment = "backedge_count";
diff --git a/hotspot/src/share/vm/runtime/deoptimization.hpp b/hotspot/src/share/vm/runtime/deoptimization.hpp
index c62616fcb74..d515339d64e 100644
--- a/hotspot/src/share/vm/runtime/deoptimization.hpp
+++ b/hotspot/src/share/vm/runtime/deoptimization.hpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2011, 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
diff --git a/hotspot/src/share/vm/runtime/dtraceJSDT.hpp b/hotspot/src/share/vm/runtime/dtraceJSDT.hpp
index d6c80c7374a..bff43108439 100644
--- a/hotspot/src/share/vm/runtime/dtraceJSDT.hpp
+++ b/hotspot/src/share/vm/runtime/dtraceJSDT.hpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2011, 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
diff --git a/hotspot/src/share/vm/runtime/fieldDescriptor.hpp b/hotspot/src/share/vm/runtime/fieldDescriptor.hpp
index ced38aed21c..00f8864a807 100644
--- a/hotspot/src/share/vm/runtime/fieldDescriptor.hpp
+++ b/hotspot/src/share/vm/runtime/fieldDescriptor.hpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2011, 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
diff --git a/hotspot/src/share/vm/runtime/fieldType.cpp b/hotspot/src/share/vm/runtime/fieldType.cpp
index 00247f1723e..ef929b9c559 100644
--- a/hotspot/src/share/vm/runtime/fieldType.cpp
+++ b/hotspot/src/share/vm/runtime/fieldType.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2011, 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
diff --git a/hotspot/src/share/vm/runtime/fieldType.hpp b/hotspot/src/share/vm/runtime/fieldType.hpp
index 13ecf15a643..0da4f370622 100644
--- a/hotspot/src/share/vm/runtime/fieldType.hpp
+++ b/hotspot/src/share/vm/runtime/fieldType.hpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2011, 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
diff --git a/hotspot/src/share/vm/runtime/fprofiler.cpp b/hotspot/src/share/vm/runtime/fprofiler.cpp
index 4efc3a936d1..3c100aa4c98 100644
--- a/hotspot/src/share/vm/runtime/fprofiler.cpp
+++ b/hotspot/src/share/vm/runtime/fprofiler.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2011, 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
diff --git a/hotspot/src/share/vm/runtime/fprofiler.hpp b/hotspot/src/share/vm/runtime/fprofiler.hpp
index 2731dea7b6b..60e51d2eb2f 100644
--- a/hotspot/src/share/vm/runtime/fprofiler.hpp
+++ b/hotspot/src/share/vm/runtime/fprofiler.hpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2011, 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
diff --git a/hotspot/src/share/vm/runtime/frame.hpp b/hotspot/src/share/vm/runtime/frame.hpp
index 4750f3a5a69..a48c2af37ea 100644
--- a/hotspot/src/share/vm/runtime/frame.hpp
+++ b/hotspot/src/share/vm/runtime/frame.hpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2011, 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
diff --git a/hotspot/src/share/vm/runtime/frame.inline.hpp b/hotspot/src/share/vm/runtime/frame.inline.hpp
index 739a50b9a25..b80b042dcbe 100644
--- a/hotspot/src/share/vm/runtime/frame.inline.hpp
+++ b/hotspot/src/share/vm/runtime/frame.inline.hpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2011, 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
diff --git a/hotspot/src/share/vm/runtime/globals.cpp b/hotspot/src/share/vm/runtime/globals.cpp
index e0f99c300a2..efce31ac0fb 100644
--- a/hotspot/src/share/vm/runtime/globals.cpp
+++ b/hotspot/src/share/vm/runtime/globals.cpp
@@ -63,6 +63,12 @@ bool Flag::is_unlocker() const {
bool Flag::is_unlocked() const {
if (strcmp(kind, "{diagnostic}") == 0) {
+ if (strcmp(name, "EnableInvokeDynamic") == 0 && UnlockExperimentalVMOptions && !UnlockDiagnosticVMOptions) {
+ // transitional logic to allow tests to run until they are changed
+ static int warned;
+ if (++warned == 1) warning("Use -XX:+UnlockDiagnosticVMOptions before EnableInvokeDynamic flag");
+ return true;
+ }
return UnlockDiagnosticVMOptions;
} else if (strcmp(kind, "{experimental}") == 0 ||
strcmp(kind, "{C2 experimental}") == 0) {
diff --git a/hotspot/src/share/vm/runtime/globals.hpp b/hotspot/src/share/vm/runtime/globals.hpp
index cd320ba6fc8..96f0abbb061 100644
--- a/hotspot/src/share/vm/runtime/globals.hpp
+++ b/hotspot/src/share/vm/runtime/globals.hpp
@@ -1924,7 +1924,7 @@ class CommandLineFlags {
experimental(intx, WorkStealingSleepMillis, 1, \
"Sleep time when sleep is used for yields") \
\
- experimental(uintx, WorkStealingYieldsBeforeSleep, 1000, \
+ experimental(uintx, WorkStealingYieldsBeforeSleep, 5000, \
"Number of yields before a sleep is done during workstealing") \
\
experimental(uintx, WorkStealingHardSpins, 4096, \
@@ -2377,6 +2377,9 @@ class CommandLineFlags {
develop(intx, CICloneLoopTestLimit, 100, \
"size limit for blocks heuristically cloned in ciTypeFlow") \
\
+ develop(intx, OSROnlyBCI, -1, \
+ "OSR only at this bci. Negative values mean exclude that bci") \
+ \
/* temp diagnostics */ \
\
diagnostic(bool, TraceRedundantCompiles, false, \
@@ -3690,11 +3693,15 @@ class CommandLineFlags {
"Skip assert() and verify() which page-in unwanted shared " \
"objects. ") \
\
+ diagnostic(bool, EnableInvokeDynamic, true, \
+ "support JSR 292 (method handles, invokedynamic, " \
+ "anonymous classes") \
+ \
product(bool, AnonymousClasses, false, \
- "support sun.misc.Unsafe.defineAnonymousClass") \
+ "support sun.misc.Unsafe.defineAnonymousClass (deprecated)") \
\
experimental(bool, EnableMethodHandles, false, \
- "support method handles (true by default under JSR 292)") \
+ "support method handles (deprecated)") \
\
diagnostic(intx, MethodHandlePushLimit, 3, \
"number of additional stack slots a method handle may push") \
@@ -3711,16 +3718,7 @@ class CommandLineFlags {
experimental(bool, TrustFinalNonStaticFields, false, \
"trust final non-static declarations for constant folding") \
\
- experimental(bool, EnableInvokeDynamic, false, \
- "recognize the invokedynamic instruction") \
- \
- experimental(bool, AllowTransitionalJSR292, true, \
- "recognize pre-PFD formats of invokedynamic") \
- \
- experimental(bool, PreferTransitionalJSR292, false, \
- "prefer pre-PFD APIs on boot class path, if they exist") \
- \
- experimental(bool, AllowInvokeForInvokeGeneric, false, \
+ experimental(bool, AllowInvokeGeneric, true, \
"accept MethodHandle.invoke and MethodHandle.invokeGeneric " \
"as equivalent methods") \
\
diff --git a/hotspot/src/share/vm/runtime/handles.hpp b/hotspot/src/share/vm/runtime/handles.hpp
index de069d34acc..d9d71e67010 100644
--- a/hotspot/src/share/vm/runtime/handles.hpp
+++ b/hotspot/src/share/vm/runtime/handles.hpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2011, 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
diff --git a/hotspot/src/share/vm/runtime/icache.hpp b/hotspot/src/share/vm/runtime/icache.hpp
index 7ffce5b140d..d460a0ffba6 100644
--- a/hotspot/src/share/vm/runtime/icache.hpp
+++ b/hotspot/src/share/vm/runtime/icache.hpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2011, 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
diff --git a/hotspot/src/share/vm/runtime/interfaceSupport.cpp b/hotspot/src/share/vm/runtime/interfaceSupport.cpp
index 33c6b3eb8c3..cec374fa69d 100644
--- a/hotspot/src/share/vm/runtime/interfaceSupport.cpp
+++ b/hotspot/src/share/vm/runtime/interfaceSupport.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2011, 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
diff --git a/hotspot/src/share/vm/runtime/interfaceSupport.hpp b/hotspot/src/share/vm/runtime/interfaceSupport.hpp
index 02e8e7bc5f1..b119006035d 100644
--- a/hotspot/src/share/vm/runtime/interfaceSupport.hpp
+++ b/hotspot/src/share/vm/runtime/interfaceSupport.hpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2011, 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
diff --git a/hotspot/src/share/vm/runtime/javaCalls.cpp b/hotspot/src/share/vm/runtime/javaCalls.cpp
index 79ecaa480c8..aaa2805e7e7 100644
--- a/hotspot/src/share/vm/runtime/javaCalls.cpp
+++ b/hotspot/src/share/vm/runtime/javaCalls.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2011, 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
diff --git a/hotspot/src/share/vm/runtime/javaCalls.hpp b/hotspot/src/share/vm/runtime/javaCalls.hpp
index 535bcc15957..af29462dd9f 100644
--- a/hotspot/src/share/vm/runtime/javaCalls.hpp
+++ b/hotspot/src/share/vm/runtime/javaCalls.hpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2011, 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
diff --git a/hotspot/src/share/vm/runtime/javaFrameAnchor.hpp b/hotspot/src/share/vm/runtime/javaFrameAnchor.hpp
index af5d7728411..501e59e1c60 100644
--- a/hotspot/src/share/vm/runtime/javaFrameAnchor.hpp
+++ b/hotspot/src/share/vm/runtime/javaFrameAnchor.hpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2002, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2002, 2011, 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
diff --git a/hotspot/src/share/vm/runtime/jniHandles.cpp b/hotspot/src/share/vm/runtime/jniHandles.cpp
index 31595688fe5..e9c791d51dd 100644
--- a/hotspot/src/share/vm/runtime/jniHandles.cpp
+++ b/hotspot/src/share/vm/runtime/jniHandles.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1998, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 2011, 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
diff --git a/hotspot/src/share/vm/runtime/objectMonitor.cpp b/hotspot/src/share/vm/runtime/objectMonitor.cpp
index 2aade711829..e2b4bf2d760 100644
--- a/hotspot/src/share/vm/runtime/objectMonitor.cpp
+++ b/hotspot/src/share/vm/runtime/objectMonitor.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1998, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 2011, 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
diff --git a/hotspot/src/share/vm/runtime/reflection.hpp b/hotspot/src/share/vm/runtime/reflection.hpp
index 1f669349543..90a3c0c0e3c 100644
--- a/hotspot/src/share/vm/runtime/reflection.hpp
+++ b/hotspot/src/share/vm/runtime/reflection.hpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2011, 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
diff --git a/hotspot/src/share/vm/runtime/reflectionUtils.hpp b/hotspot/src/share/vm/runtime/reflectionUtils.hpp
index 712aa51fb3c..c9eecaa2324 100644
--- a/hotspot/src/share/vm/runtime/reflectionUtils.hpp
+++ b/hotspot/src/share/vm/runtime/reflectionUtils.hpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2011, 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
diff --git a/hotspot/src/share/vm/runtime/registerMap.hpp b/hotspot/src/share/vm/runtime/registerMap.hpp
index da597d40ed4..5dd677ac4e1 100644
--- a/hotspot/src/share/vm/runtime/registerMap.hpp
+++ b/hotspot/src/share/vm/runtime/registerMap.hpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2002, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2002, 2011, 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
diff --git a/hotspot/src/share/vm/runtime/rframe.cpp b/hotspot/src/share/vm/runtime/rframe.cpp
index f99d4d1a237..c52d16ff3d5 100644
--- a/hotspot/src/share/vm/runtime/rframe.cpp
+++ b/hotspot/src/share/vm/runtime/rframe.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2011, 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
diff --git a/hotspot/src/share/vm/runtime/safepoint.cpp b/hotspot/src/share/vm/runtime/safepoint.cpp
index bd9a9e6eb32..bc729c4cd43 100644
--- a/hotspot/src/share/vm/runtime/safepoint.cpp
+++ b/hotspot/src/share/vm/runtime/safepoint.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2011, 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
diff --git a/hotspot/src/share/vm/runtime/sharedRuntime.cpp b/hotspot/src/share/vm/runtime/sharedRuntime.cpp
index 4d21ca0b1e5..820678701f4 100644
--- a/hotspot/src/share/vm/runtime/sharedRuntime.cpp
+++ b/hotspot/src/share/vm/runtime/sharedRuntime.cpp
@@ -1682,7 +1682,7 @@ char* SharedRuntime::generate_wrong_method_type_message(JavaThread* thread,
tty->print_cr("WrongMethodType thread="PTR_FORMAT" req="PTR_FORMAT" act="PTR_FORMAT"",
thread, required, actual);
}
- assert(EnableMethodHandles, "");
+ assert(EnableInvokeDynamic, "");
oop singleKlass = wrong_method_type_is_for_single_argument(thread, required);
char* message = NULL;
if (singleKlass != NULL) {
@@ -1700,9 +1700,11 @@ char* SharedRuntime::generate_wrong_method_type_message(JavaThread* thread,
message = generate_class_cast_message(objName, targetKlass->external_name());
} else {
// %%% need to get the MethodType string, without messing around too much
+ const char* desc = NULL;
// Get a signature from the invoke instruction
const char* mhName = "method handle";
const char* targetType = "the required signature";
+ int targetArity = -1, mhArity = -1;
vframeStream vfst(thread, true);
if (!vfst.at_end()) {
Bytecode_invoke call(vfst.method(), vfst.bci());
@@ -1716,20 +1718,35 @@ char* SharedRuntime::generate_wrong_method_type_message(JavaThread* thread,
&& target->is_method_handle_invoke()
&& required == target->method_handle_type()) {
targetType = target->signature()->as_C_string();
+ targetArity = ArgumentCount(target->signature()).size();
}
}
- klassOop kignore; int fignore;
- methodOop actual_method = MethodHandles::decode_method(actual,
- kignore, fignore);
+ klassOop kignore; int dmf_flags = 0;
+ methodOop actual_method = MethodHandles::decode_method(actual, kignore, dmf_flags);
+ if ((dmf_flags & ~(MethodHandles::_dmf_has_receiver |
+ MethodHandles::_dmf_does_dispatch |
+ MethodHandles::_dmf_from_interface)) != 0)
+ actual_method = NULL; // MH does extra binds, drops, etc.
+ bool has_receiver = ((dmf_flags & MethodHandles::_dmf_has_receiver) != 0);
if (actual_method != NULL) {
- if (methodOopDesc::is_method_handle_invoke_name(actual_method->name()))
- mhName = "$";
+ mhName = actual_method->signature()->as_C_string();
+ mhArity = ArgumentCount(actual_method->signature()).size();
+ if (!actual_method->is_static()) mhArity += 1;
+ } else if (java_lang_invoke_MethodHandle::is_instance(actual)) {
+ oopDesc* mhType = java_lang_invoke_MethodHandle::type(actual);
+ mhArity = java_lang_invoke_MethodType::ptype_count(mhType);
+ stringStream st;
+ java_lang_invoke_MethodType::print_signature(mhType, &st);
+ mhName = st.as_string();
+ }
+ if (targetArity != -1 && targetArity != mhArity) {
+ if (has_receiver && targetArity == mhArity-1)
+ desc = " cannot be called without a receiver argument as ";
else
- mhName = actual_method->signature()->as_C_string();
- if (mhName[0] == '$')
- mhName = actual_method->signature()->as_C_string();
+ desc = " cannot be called with a different arity as ";
}
message = generate_class_cast_message(mhName, targetType,
+ desc != NULL ? desc :
" cannot be called as ");
}
if (TraceMethodHandles) {
@@ -2479,20 +2496,10 @@ bool AdapterHandlerEntry::compare_code(unsigned char* buffer, int length, int to
// java compiled calling convention to the native convention, handlizes
// arguments, and transitions to native. On return from the native we transition
// back to java blocking if a safepoint is in progress.
-nmethod *AdapterHandlerLibrary::create_native_wrapper(methodHandle method) {
+nmethod *AdapterHandlerLibrary::create_native_wrapper(methodHandle method, int compile_id) {
ResourceMark rm;
nmethod* nm = NULL;
- if (PrintCompilation) {
- ttyLocker ttyl;
- tty->print("--- n%s ", (method->is_synchronized() ? "s" : " "));
- method->print_short_name(tty);
- if (method->is_static()) {
- tty->print(" (static)");
- }
- tty->cr();
- }
-
assert(method->has_native_function(), "must have something valid to call!");
{
@@ -2537,6 +2544,7 @@ nmethod *AdapterHandlerLibrary::create_native_wrapper(methodHandle method) {
// Generate the compiled-to-native wrapper code
nm = SharedRuntime::generate_native_wrapper(&_masm,
method,
+ compile_id,
total_args_passed,
comp_args_on_stack,
sig_bt,regs,
@@ -2548,6 +2556,10 @@ nmethod *AdapterHandlerLibrary::create_native_wrapper(methodHandle method) {
// Install the generated code.
if (nm != NULL) {
+ if (PrintCompilation) {
+ ttyLocker ttyl;
+ CompileTask::print_compilation(tty, nm, method->is_static() ? "(static)" : "");
+ }
method->set_code(method, nm);
nm->post_compiled_method_load_event();
} else {
diff --git a/hotspot/src/share/vm/runtime/sharedRuntime.hpp b/hotspot/src/share/vm/runtime/sharedRuntime.hpp
index 57ee0966182..268bd3a2f4e 100644
--- a/hotspot/src/share/vm/runtime/sharedRuntime.hpp
+++ b/hotspot/src/share/vm/runtime/sharedRuntime.hpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2011, 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
@@ -438,6 +438,7 @@ class SharedRuntime: AllStatic {
// returns.
static nmethod *generate_native_wrapper(MacroAssembler* masm,
methodHandle method,
+ int compile_id,
int total_args_passed,
int max_arg,
BasicType *sig_bt,
@@ -659,7 +660,7 @@ class AdapterHandlerLibrary: public AllStatic {
static AdapterHandlerEntry* new_entry(AdapterFingerPrint* fingerprint,
address i2c_entry, address c2i_entry, address c2i_unverified_entry);
- static nmethod* create_native_wrapper(methodHandle method);
+ static nmethod* create_native_wrapper(methodHandle method, int compile_id);
static AdapterHandlerEntry* get_adapter(methodHandle method);
#ifdef HAVE_DTRACE_H
diff --git a/hotspot/src/share/vm/runtime/signature.cpp b/hotspot/src/share/vm/runtime/signature.cpp
index d13d3e10e10..cb4af90385f 100644
--- a/hotspot/src/share/vm/runtime/signature.cpp
+++ b/hotspot/src/share/vm/runtime/signature.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2011, 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
diff --git a/hotspot/src/share/vm/runtime/signature.hpp b/hotspot/src/share/vm/runtime/signature.hpp
index 11ab3e2d1e4..2d7a35dd03d 100644
--- a/hotspot/src/share/vm/runtime/signature.hpp
+++ b/hotspot/src/share/vm/runtime/signature.hpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2011, 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
diff --git a/hotspot/src/share/vm/runtime/stackValueCollection.cpp b/hotspot/src/share/vm/runtime/stackValueCollection.cpp
index bc391e599aa..110f7120d4f 100644
--- a/hotspot/src/share/vm/runtime/stackValueCollection.cpp
+++ b/hotspot/src/share/vm/runtime/stackValueCollection.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2001, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 2011, 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
diff --git a/hotspot/src/share/vm/runtime/statSampler.cpp b/hotspot/src/share/vm/runtime/statSampler.cpp
index bbb947737be..0b24def2497 100644
--- a/hotspot/src/share/vm/runtime/statSampler.cpp
+++ b/hotspot/src/share/vm/runtime/statSampler.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2001, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 2011, 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
diff --git a/hotspot/src/share/vm/runtime/stubCodeGenerator.cpp b/hotspot/src/share/vm/runtime/stubCodeGenerator.cpp
index ba395194f7f..63fa6730f2c 100644
--- a/hotspot/src/share/vm/runtime/stubCodeGenerator.cpp
+++ b/hotspot/src/share/vm/runtime/stubCodeGenerator.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2011, 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
diff --git a/hotspot/src/share/vm/runtime/stubRoutines.cpp b/hotspot/src/share/vm/runtime/stubRoutines.cpp
index 69aee24e022..6511ce31f37 100644
--- a/hotspot/src/share/vm/runtime/stubRoutines.cpp
+++ b/hotspot/src/share/vm/runtime/stubRoutines.cpp
@@ -433,3 +433,77 @@ address StubRoutines::select_fill_function(BasicType t, bool aligned, const char
#undef RETURN_STUB
}
+
+// constants for computing the copy function
+enum {
+ COPYFUNC_UNALIGNED = 0,
+ COPYFUNC_ALIGNED = 1, // src, dest aligned to HeapWordSize
+ COPYFUNC_CONJOINT = 0,
+ COPYFUNC_DISJOINT = 2 // src != dest, or transfer can descend
+};
+
+// Note: The condition "disjoint" applies also for overlapping copies
+// where an descending copy is permitted (i.e., dest_offset <= src_offset).
+address
+StubRoutines::select_arraycopy_function(BasicType t, bool aligned, bool disjoint, const char* &name, bool dest_uninitialized) {
+ int selector =
+ (aligned ? COPYFUNC_ALIGNED : COPYFUNC_UNALIGNED) +
+ (disjoint ? COPYFUNC_DISJOINT : COPYFUNC_CONJOINT);
+
+#define RETURN_STUB(xxx_arraycopy) { \
+ name = #xxx_arraycopy; \
+ return StubRoutines::xxx_arraycopy(); }
+
+#define RETURN_STUB_PARM(xxx_arraycopy, parm) { \
+ name = #xxx_arraycopy; \
+ return StubRoutines::xxx_arraycopy(parm); }
+
+ switch (t) {
+ case T_BYTE:
+ case T_BOOLEAN:
+ switch (selector) {
+ case COPYFUNC_CONJOINT | COPYFUNC_UNALIGNED: RETURN_STUB(jbyte_arraycopy);
+ case COPYFUNC_CONJOINT | COPYFUNC_ALIGNED: RETURN_STUB(arrayof_jbyte_arraycopy);
+ case COPYFUNC_DISJOINT | COPYFUNC_UNALIGNED: RETURN_STUB(jbyte_disjoint_arraycopy);
+ case COPYFUNC_DISJOINT | COPYFUNC_ALIGNED: RETURN_STUB(arrayof_jbyte_disjoint_arraycopy);
+ }
+ case T_CHAR:
+ case T_SHORT:
+ switch (selector) {
+ case COPYFUNC_CONJOINT | COPYFUNC_UNALIGNED: RETURN_STUB(jshort_arraycopy);
+ case COPYFUNC_CONJOINT | COPYFUNC_ALIGNED: RETURN_STUB(arrayof_jshort_arraycopy);
+ case COPYFUNC_DISJOINT | COPYFUNC_UNALIGNED: RETURN_STUB(jshort_disjoint_arraycopy);
+ case COPYFUNC_DISJOINT | COPYFUNC_ALIGNED: RETURN_STUB(arrayof_jshort_disjoint_arraycopy);
+ }
+ case T_INT:
+ case T_FLOAT:
+ switch (selector) {
+ case COPYFUNC_CONJOINT | COPYFUNC_UNALIGNED: RETURN_STUB(jint_arraycopy);
+ case COPYFUNC_CONJOINT | COPYFUNC_ALIGNED: RETURN_STUB(arrayof_jint_arraycopy);
+ case COPYFUNC_DISJOINT | COPYFUNC_UNALIGNED: RETURN_STUB(jint_disjoint_arraycopy);
+ case COPYFUNC_DISJOINT | COPYFUNC_ALIGNED: RETURN_STUB(arrayof_jint_disjoint_arraycopy);
+ }
+ case T_DOUBLE:
+ case T_LONG:
+ switch (selector) {
+ case COPYFUNC_CONJOINT | COPYFUNC_UNALIGNED: RETURN_STUB(jlong_arraycopy);
+ case COPYFUNC_CONJOINT | COPYFUNC_ALIGNED: RETURN_STUB(arrayof_jlong_arraycopy);
+ case COPYFUNC_DISJOINT | COPYFUNC_UNALIGNED: RETURN_STUB(jlong_disjoint_arraycopy);
+ case COPYFUNC_DISJOINT | COPYFUNC_ALIGNED: RETURN_STUB(arrayof_jlong_disjoint_arraycopy);
+ }
+ case T_ARRAY:
+ case T_OBJECT:
+ switch (selector) {
+ case COPYFUNC_CONJOINT | COPYFUNC_UNALIGNED: RETURN_STUB_PARM(oop_arraycopy, dest_uninitialized);
+ case COPYFUNC_CONJOINT | COPYFUNC_ALIGNED: RETURN_STUB_PARM(arrayof_oop_arraycopy, dest_uninitialized);
+ case COPYFUNC_DISJOINT | COPYFUNC_UNALIGNED: RETURN_STUB_PARM(oop_disjoint_arraycopy, dest_uninitialized);
+ case COPYFUNC_DISJOINT | COPYFUNC_ALIGNED: RETURN_STUB_PARM(arrayof_oop_disjoint_arraycopy, dest_uninitialized);
+ }
+ default:
+ ShouldNotReachHere();
+ return NULL;
+ }
+
+#undef RETURN_STUB
+#undef RETURN_STUB_PARM
+}
diff --git a/hotspot/src/share/vm/runtime/stubRoutines.hpp b/hotspot/src/share/vm/runtime/stubRoutines.hpp
index 4f3a770eb92..b62727d8294 100644
--- a/hotspot/src/share/vm/runtime/stubRoutines.hpp
+++ b/hotspot/src/share/vm/runtime/stubRoutines.hpp
@@ -282,6 +282,8 @@ class StubRoutines: AllStatic {
static address addr_fpu_subnormal_bias2() { return (address)&_fpu_subnormal_bias2; }
+ static address select_arraycopy_function(BasicType t, bool aligned, bool disjoint, const char* &name, bool dest_uninitialized);
+
static address jbyte_arraycopy() { return _jbyte_arraycopy; }
static address jshort_arraycopy() { return _jshort_arraycopy; }
static address jint_arraycopy() { return _jint_arraycopy; }
diff --git a/hotspot/src/share/vm/runtime/sweeper.cpp b/hotspot/src/share/vm/runtime/sweeper.cpp
index c845b1761b6..535e337f378 100644
--- a/hotspot/src/share/vm/runtime/sweeper.cpp
+++ b/hotspot/src/share/vm/runtime/sweeper.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2011, 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
diff --git a/hotspot/src/share/vm/runtime/synchronizer.cpp b/hotspot/src/share/vm/runtime/synchronizer.cpp
index fd0b3da40ec..d51be5c2b57 100644
--- a/hotspot/src/share/vm/runtime/synchronizer.cpp
+++ b/hotspot/src/share/vm/runtime/synchronizer.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1998, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 2011, 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
diff --git a/hotspot/src/share/vm/runtime/thread.cpp b/hotspot/src/share/vm/runtime/thread.cpp
index 817a80170b4..6cb2deeb428 100644
--- a/hotspot/src/share/vm/runtime/thread.cpp
+++ b/hotspot/src/share/vm/runtime/thread.cpp
@@ -3229,7 +3229,7 @@ jint Threads::create_vm(JavaVMInitArgs* args, bool* canTryAgain) {
warning("java.lang.ArithmeticException has not been initialized");
warning("java.lang.StackOverflowError has not been initialized");
}
- }
+ }
// See : bugid 4211085.
// Background : the static initializer of java.lang.Compiler tries to read
diff --git a/hotspot/src/share/vm/runtime/threadLocalStorage.hpp b/hotspot/src/share/vm/runtime/threadLocalStorage.hpp
index 2ca4260d902..c936216871b 100644
--- a/hotspot/src/share/vm/runtime/threadLocalStorage.hpp
+++ b/hotspot/src/share/vm/runtime/threadLocalStorage.hpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2011, 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
diff --git a/hotspot/src/share/vm/runtime/vframe.cpp b/hotspot/src/share/vm/runtime/vframe.cpp
index 9624c4983e1..323d7359847 100644
--- a/hotspot/src/share/vm/runtime/vframe.cpp
+++ b/hotspot/src/share/vm/runtime/vframe.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2011, 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
diff --git a/hotspot/src/share/vm/runtime/vmStructs.cpp b/hotspot/src/share/vm/runtime/vmStructs.cpp
index 2d5cd6dcf66..9f577dd9bbe 100644
--- a/hotspot/src/share/vm/runtime/vmStructs.cpp
+++ b/hotspot/src/share/vm/runtime/vmStructs.cpp
@@ -70,6 +70,7 @@
#include "oops/cpCacheKlass.hpp"
#include "oops/cpCacheOop.hpp"
#include "oops/instanceKlass.hpp"
+#include "oops/instanceMirrorKlass.hpp"
#include "oops/instanceKlassKlass.hpp"
#include "oops/instanceOop.hpp"
#include "oops/klass.hpp"
@@ -1101,6 +1102,7 @@ static inline uint64_t cast_uint64_t(size_t x)
declare_type(instanceKlass, Klass) \
declare_type(instanceKlassKlass, klassKlass) \
declare_type(instanceOopDesc, oopDesc) \
+ declare_type(instanceMirrorKlass, instanceKlass) \
declare_type(instanceRefKlass, instanceKlass) \
declare_type(klassKlass, Klass) \
declare_type(klassOopDesc, oopDesc) \
diff --git a/hotspot/src/share/vm/runtime/vmStructs.hpp b/hotspot/src/share/vm/runtime/vmStructs.hpp
index 7bf6d93d064..355746eb420 100644
--- a/hotspot/src/share/vm/runtime/vmStructs.hpp
+++ b/hotspot/src/share/vm/runtime/vmStructs.hpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2011, 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
diff --git a/hotspot/src/share/vm/runtime/vm_operations.cpp b/hotspot/src/share/vm/runtime/vm_operations.cpp
index 8a0cbe785b3..cb5d1381480 100644
--- a/hotspot/src/share/vm/runtime/vm_operations.cpp
+++ b/hotspot/src/share/vm/runtime/vm_operations.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2011, 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
diff --git a/hotspot/src/share/vm/runtime/vm_operations.hpp b/hotspot/src/share/vm/runtime/vm_operations.hpp
index 77ffeb3bc63..77f262f6eda 100644
--- a/hotspot/src/share/vm/runtime/vm_operations.hpp
+++ b/hotspot/src/share/vm/runtime/vm_operations.hpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2011, 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
diff --git a/hotspot/src/share/vm/runtime/vm_version.cpp b/hotspot/src/share/vm/runtime/vm_version.cpp
index 4afc8cea3b9..cd44c03da26 100644
--- a/hotspot/src/share/vm/runtime/vm_version.cpp
+++ b/hotspot/src/share/vm/runtime/vm_version.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1998, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 2011, 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
diff --git a/hotspot/src/share/vm/runtime/vm_version.hpp b/hotspot/src/share/vm/runtime/vm_version.hpp
index 28b243f41ba..6fcbb6ac4df 100644
--- a/hotspot/src/share/vm/runtime/vm_version.hpp
+++ b/hotspot/src/share/vm/runtime/vm_version.hpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2011, 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
diff --git a/hotspot/src/share/vm/services/attachListener.cpp b/hotspot/src/share/vm/services/attachListener.cpp
index 6ebafe96509..71d107d8046 100644
--- a/hotspot/src/share/vm/services/attachListener.cpp
+++ b/hotspot/src/share/vm/services/attachListener.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2011, 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
diff --git a/hotspot/src/share/vm/services/attachListener.hpp b/hotspot/src/share/vm/services/attachListener.hpp
index 68cd834fe65..ba8fb93227b 100644
--- a/hotspot/src/share/vm/services/attachListener.hpp
+++ b/hotspot/src/share/vm/services/attachListener.hpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2011, 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
diff --git a/hotspot/src/share/vm/services/classLoadingService.cpp b/hotspot/src/share/vm/services/classLoadingService.cpp
index 83979a8e57d..0f3ad684cbe 100644
--- a/hotspot/src/share/vm/services/classLoadingService.cpp
+++ b/hotspot/src/share/vm/services/classLoadingService.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2011, 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
diff --git a/hotspot/src/share/vm/services/management.hpp b/hotspot/src/share/vm/services/management.hpp
index ec2d77ce088..1598f2261e4 100644
--- a/hotspot/src/share/vm/services/management.hpp
+++ b/hotspot/src/share/vm/services/management.hpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2011, 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
diff --git a/hotspot/src/share/vm/services/memoryManager.cpp b/hotspot/src/share/vm/services/memoryManager.cpp
index 41b8d82f84b..e13b6437645 100644
--- a/hotspot/src/share/vm/services/memoryManager.cpp
+++ b/hotspot/src/share/vm/services/memoryManager.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2011, 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
diff --git a/hotspot/src/share/vm/services/memoryPool.cpp b/hotspot/src/share/vm/services/memoryPool.cpp
index 6036bbe70b5..8a83606b026 100644
--- a/hotspot/src/share/vm/services/memoryPool.cpp
+++ b/hotspot/src/share/vm/services/memoryPool.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2011, 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
diff --git a/hotspot/src/share/vm/services/memoryService.cpp b/hotspot/src/share/vm/services/memoryService.cpp
index ee9471083a9..eca4d6418b7 100644
--- a/hotspot/src/share/vm/services/memoryService.cpp
+++ b/hotspot/src/share/vm/services/memoryService.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2011, 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
diff --git a/hotspot/src/share/vm/shark/sharkCompiler.cpp b/hotspot/src/share/vm/shark/sharkCompiler.cpp
index 97ec78c49a8..53851770fc7 100644
--- a/hotspot/src/share/vm/shark/sharkCompiler.cpp
+++ b/hotspot/src/share/vm/shark/sharkCompiler.cpp
@@ -1,6 +1,6 @@
/*
* Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved.
- * Copyright 2008, 2009, 2010 Red Hat, Inc.
+ * Copyright 2008, 2009, 2010, 2011 Red Hat, Inc.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -218,6 +218,7 @@ void SharkCompiler::compile_method(ciEnv* env,
nmethod* SharkCompiler::generate_native_wrapper(MacroAssembler* masm,
methodHandle target,
+ int compile_id,
BasicType* arg_types,
BasicType return_type) {
assert(is_initialized(), "should be");
@@ -241,6 +242,7 @@ nmethod* SharkCompiler::generate_native_wrapper(MacroAssembler* masm,
// Return the nmethod for installation in the VM
return nmethod::new_native_nmethod(target,
+ compile_id,
masm->code(),
0,
0,
diff --git a/hotspot/src/share/vm/shark/sharkCompiler.hpp b/hotspot/src/share/vm/shark/sharkCompiler.hpp
index d6ddd3d6004..828a783a80d 100644
--- a/hotspot/src/share/vm/shark/sharkCompiler.hpp
+++ b/hotspot/src/share/vm/shark/sharkCompiler.hpp
@@ -1,6 +1,6 @@
/*
* Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved.
- * Copyright 2008, 2009 Red Hat, Inc.
+ * Copyright 2008, 2009, 2010, 2011 Red Hat, Inc.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -60,6 +60,7 @@ class SharkCompiler : public AbstractCompiler {
// Generate a wrapper for a native (JNI) method
nmethod* generate_native_wrapper(MacroAssembler* masm,
methodHandle target,
+ int compile_id,
BasicType* arg_types,
BasicType return_type);
@@ -113,7 +114,8 @@ class SharkCompiler : public AbstractCompiler {
// Global access
public:
static SharkCompiler* compiler() {
- AbstractCompiler *compiler = CompileBroker::compiler(CompLevel_simple);
+ AbstractCompiler *compiler =
+ CompileBroker::compiler(CompLevel_full_optimization);
assert(compiler->is_shark() && compiler->is_initialized(), "should be");
return (SharkCompiler *) compiler;
}
diff --git a/hotspot/src/share/vm/shark/sharkNativeWrapper.cpp b/hotspot/src/share/vm/shark/sharkNativeWrapper.cpp
index e4b3347c5c9..ef4337233f5 100644
--- a/hotspot/src/share/vm/shark/sharkNativeWrapper.cpp
+++ b/hotspot/src/share/vm/shark/sharkNativeWrapper.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2011, Oracle and/or its affiliates. All rights reserved.
* Copyright 2009, 2010 Red Hat, Inc.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
diff --git a/hotspot/src/share/vm/utilities/constantTag.cpp b/hotspot/src/share/vm/utilities/constantTag.cpp
index 0d2744666c4..49e374e89eb 100644
--- a/hotspot/src/share/vm/utilities/constantTag.cpp
+++ b/hotspot/src/share/vm/utilities/constantTag.cpp
@@ -93,8 +93,6 @@ const char* constantTag::internal_name() const {
return "MethodType";
case JVM_CONSTANT_InvokeDynamic :
return "InvokeDynamic";
- case JVM_CONSTANT_InvokeDynamicTrans :
- return "InvokeDynamic/transitional";
case JVM_CONSTANT_Object :
return "Object";
case JVM_CONSTANT_Utf8 :
diff --git a/hotspot/src/share/vm/utilities/constantTag.hpp b/hotspot/src/share/vm/utilities/constantTag.hpp
index 43f5a8218b1..bbd02462e21 100644
--- a/hotspot/src/share/vm/utilities/constantTag.hpp
+++ b/hotspot/src/share/vm/utilities/constantTag.hpp
@@ -86,8 +86,7 @@ class constantTag VALUE_OBJ_CLASS_SPEC {
bool is_method_type() const { return _tag == JVM_CONSTANT_MethodType; }
bool is_method_handle() const { return _tag == JVM_CONSTANT_MethodHandle; }
- bool is_invoke_dynamic() const { return (_tag == JVM_CONSTANT_InvokeDynamic ||
- _tag == JVM_CONSTANT_InvokeDynamicTrans); }
+ bool is_invoke_dynamic() const { return _tag == JVM_CONSTANT_InvokeDynamic; }
bool is_loadable_constant() const {
return ((_tag >= JVM_CONSTANT_Integer && _tag <= JVM_CONSTANT_String) ||
diff --git a/hotspot/src/share/vm/utilities/copy.hpp b/hotspot/src/share/vm/utilities/copy.hpp
index 8772fe44f06..3dcbfeee2ce 100644
--- a/hotspot/src/share/vm/utilities/copy.hpp
+++ b/hotspot/src/share/vm/utilities/copy.hpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2011, 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
diff --git a/hotspot/src/share/vm/utilities/debug.cpp b/hotspot/src/share/vm/utilities/debug.cpp
index 204b360b15b..cb5efc08d07 100644
--- a/hotspot/src/share/vm/utilities/debug.cpp
+++ b/hotspot/src/share/vm/utilities/debug.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2011, 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
diff --git a/hotspot/src/share/vm/utilities/debug.hpp b/hotspot/src/share/vm/utilities/debug.hpp
index 75a9a27bd6b..63c69e63f64 100644
--- a/hotspot/src/share/vm/utilities/debug.hpp
+++ b/hotspot/src/share/vm/utilities/debug.hpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2011, 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
diff --git a/hotspot/src/share/vm/utilities/elfSymbolTable.cpp b/hotspot/src/share/vm/utilities/elfSymbolTable.cpp
index 22773aa546b..0fa039c4fbf 100644
--- a/hotspot/src/share/vm/utilities/elfSymbolTable.cpp
+++ b/hotspot/src/share/vm/utilities/elfSymbolTable.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2011, 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
diff --git a/hotspot/src/share/vm/utilities/exceptions.cpp b/hotspot/src/share/vm/utilities/exceptions.cpp
index 1d6ab0835ca..5d8a33b4d2e 100644
--- a/hotspot/src/share/vm/utilities/exceptions.cpp
+++ b/hotspot/src/share/vm/utilities/exceptions.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1998, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 2011, 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
diff --git a/hotspot/src/share/vm/utilities/exceptions.hpp b/hotspot/src/share/vm/utilities/exceptions.hpp
index 8651604be5c..5649f4e600d 100644
--- a/hotspot/src/share/vm/utilities/exceptions.hpp
+++ b/hotspot/src/share/vm/utilities/exceptions.hpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1998, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 2011, 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
diff --git a/hotspot/src/share/vm/utilities/globalDefinitions.hpp b/hotspot/src/share/vm/utilities/globalDefinitions.hpp
index a742d221486..8607a3e03e8 100644
--- a/hotspot/src/share/vm/utilities/globalDefinitions.hpp
+++ b/hotspot/src/share/vm/utilities/globalDefinitions.hpp
@@ -746,9 +746,9 @@ enum CompLevel {
CompLevel_simple = 1, // C1
CompLevel_limited_profile = 2, // C1, invocation & backedge counters
CompLevel_full_profile = 3, // C1, invocation & backedge counters + mdo
- CompLevel_full_optimization = 4, // C2
+ CompLevel_full_optimization = 4, // C2 or Shark
-#if defined(COMPILER2)
+#if defined(COMPILER2) || defined(SHARK)
CompLevel_highest_tier = CompLevel_full_optimization, // pure C2 and tiered
#elif defined(COMPILER1)
CompLevel_highest_tier = CompLevel_simple, // pure C1
@@ -760,7 +760,7 @@ enum CompLevel {
CompLevel_initial_compile = CompLevel_full_profile // tiered
#elif defined(COMPILER1)
CompLevel_initial_compile = CompLevel_simple // pure C1
-#elif defined(COMPILER2)
+#elif defined(COMPILER2) || defined(SHARK)
CompLevel_initial_compile = CompLevel_full_optimization // pure C2
#else
CompLevel_initial_compile = CompLevel_none
diff --git a/hotspot/src/share/vm/utilities/globalDefinitions_gcc.hpp b/hotspot/src/share/vm/utilities/globalDefinitions_gcc.hpp
index cc244b4a78d..ac7fdf878f0 100644
--- a/hotspot/src/share/vm/utilities/globalDefinitions_gcc.hpp
+++ b/hotspot/src/share/vm/utilities/globalDefinitions_gcc.hpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1998, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 2011, 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
@@ -77,7 +77,9 @@
# endif
#ifdef LINUX
+#ifndef __STDC_LIMIT_MACROS
#define __STDC_LIMIT_MACROS
+#endif // __STDC_LIMIT_MACROS
#include
#include
#include
diff --git a/hotspot/src/share/vm/utilities/globalDefinitions_sparcWorks.hpp b/hotspot/src/share/vm/utilities/globalDefinitions_sparcWorks.hpp
index e11fa58fa90..fca43e0d787 100644
--- a/hotspot/src/share/vm/utilities/globalDefinitions_sparcWorks.hpp
+++ b/hotspot/src/share/vm/utilities/globalDefinitions_sparcWorks.hpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2011, 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
diff --git a/hotspot/src/share/vm/utilities/globalDefinitions_visCPP.hpp b/hotspot/src/share/vm/utilities/globalDefinitions_visCPP.hpp
index 2d6d7daf853..36549993a9e 100644
--- a/hotspot/src/share/vm/utilities/globalDefinitions_visCPP.hpp
+++ b/hotspot/src/share/vm/utilities/globalDefinitions_visCPP.hpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2011, 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
diff --git a/hotspot/src/share/vm/utilities/hashtable.cpp b/hotspot/src/share/vm/utilities/hashtable.cpp
index aad68f13760..7e937966c8d 100644
--- a/hotspot/src/share/vm/utilities/hashtable.cpp
+++ b/hotspot/src/share/vm/utilities/hashtable.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2011, 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
diff --git a/hotspot/src/share/vm/utilities/hashtable.hpp b/hotspot/src/share/vm/utilities/hashtable.hpp
index 21747e6855b..a4f0e9012d4 100644
--- a/hotspot/src/share/vm/utilities/hashtable.hpp
+++ b/hotspot/src/share/vm/utilities/hashtable.hpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2011, 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
diff --git a/hotspot/src/share/vm/utilities/hashtable.inline.hpp b/hotspot/src/share/vm/utilities/hashtable.inline.hpp
index 09995537b2b..8cd2f89d0c8 100644
--- a/hotspot/src/share/vm/utilities/hashtable.inline.hpp
+++ b/hotspot/src/share/vm/utilities/hashtable.inline.hpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2011, 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
diff --git a/hotspot/src/share/vm/utilities/ostream.cpp b/hotspot/src/share/vm/utilities/ostream.cpp
index 26e630a187c..2bdade8b109 100644
--- a/hotspot/src/share/vm/utilities/ostream.cpp
+++ b/hotspot/src/share/vm/utilities/ostream.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2011, 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
@@ -424,6 +424,15 @@ static const char* make_log_name(const char* log_name, const char* force_directo
const char* star = strchr(basename, '*');
int star_pos = (star == NULL) ? -1 : (star - nametail);
+ int skip = 1;
+ if (star == NULL) {
+ // Try %p
+ star = strstr(basename, "%p");
+ if (star != NULL) {
+ skip = 2;
+ }
+ }
+ star_pos = (star == NULL) ? -1 : (star - nametail);
char pid[32];
if (star_pos >= 0) {
@@ -442,11 +451,11 @@ static const char* make_log_name(const char* log_name, const char* force_directo
}
if (star_pos >= 0) {
- // convert foo*bar.log to foo123bar.log
+ // convert foo*bar.log or foo%pbar.log to foo123bar.log
int buf_pos = (int) strlen(buf);
strncpy(&buf[buf_pos], nametail, star_pos);
strcpy(&buf[buf_pos + star_pos], pid);
- nametail += star_pos + 1; // skip prefix and star
+ nametail += star_pos + skip; // skip prefix and pid format
}
strcat(buf, nametail); // append rest of name, or all of name
@@ -466,7 +475,7 @@ void defaultStream::init_log() {
// Note: This feature is for maintainer use only. No need for L10N.
jio_print(warnbuf);
FREE_C_HEAP_ARRAY(char, try_name);
- try_name = make_log_name("hs_pid*.log", os::get_temp_directory());
+ try_name = make_log_name("hs_pid%p.log", os::get_temp_directory());
jio_snprintf(warnbuf, sizeof(warnbuf),
"Warning: Forcing option -XX:LogFile=%s\n", try_name);
jio_print(warnbuf);
@@ -801,6 +810,8 @@ staticBufferStream::staticBufferStream(char* buffer, size_t buflen,
_buffer = buffer;
_buflen = buflen;
_outer_stream = outer_stream;
+ // compile task prints time stamp relative to VM start
+ _stamp.update_to(1);
}
void staticBufferStream::write(const char* c, size_t len) {
diff --git a/hotspot/src/share/vm/utilities/ostream.hpp b/hotspot/src/share/vm/utilities/ostream.hpp
index 047cdac5821..b5eeb2a8307 100644
--- a/hotspot/src/share/vm/utilities/ostream.hpp
+++ b/hotspot/src/share/vm/utilities/ostream.hpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2011, 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
diff --git a/hotspot/src/share/vm/utilities/taskqueue.hpp b/hotspot/src/share/vm/utilities/taskqueue.hpp
index 79f293444d9..5527e2fb62c 100644
--- a/hotspot/src/share/vm/utilities/taskqueue.hpp
+++ b/hotspot/src/share/vm/utilities/taskqueue.hpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2001, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 2011, 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
diff --git a/hotspot/src/share/vm/utilities/utf8.cpp b/hotspot/src/share/vm/utilities/utf8.cpp
index c8c630032b9..be7d1881546 100644
--- a/hotspot/src/share/vm/utilities/utf8.cpp
+++ b/hotspot/src/share/vm/utilities/utf8.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2011, 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
diff --git a/hotspot/src/share/vm/utilities/utf8.hpp b/hotspot/src/share/vm/utilities/utf8.hpp
index 182b6335e1e..c56d550ec9d 100644
--- a/hotspot/src/share/vm/utilities/utf8.hpp
+++ b/hotspot/src/share/vm/utilities/utf8.hpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2011, 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
diff --git a/hotspot/src/share/vm/utilities/xmlstream.cpp b/hotspot/src/share/vm/utilities/xmlstream.cpp
index 8d6a0483970..c82010c1ba9 100644
--- a/hotspot/src/share/vm/utilities/xmlstream.cpp
+++ b/hotspot/src/share/vm/utilities/xmlstream.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2002, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2002, 2011, 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
diff --git a/hotspot/src/share/vm/utilities/xmlstream.hpp b/hotspot/src/share/vm/utilities/xmlstream.hpp
index a2f39317a4a..98fec3c427f 100644
--- a/hotspot/src/share/vm/utilities/xmlstream.hpp
+++ b/hotspot/src/share/vm/utilities/xmlstream.hpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2002, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2002, 2011, 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
diff --git a/hotspot/test/compiler/7024475/Test7024475.java b/hotspot/test/compiler/7024475/Test7024475.java
new file mode 100644
index 00000000000..2f3b2e06c9f
--- /dev/null
+++ b/hotspot/test/compiler/7024475/Test7024475.java
@@ -0,0 +1,71 @@
+/*
+ * Copyright (c) 2011, 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 7024475
+ * @summary loop doesn't terminate when compiled
+ *
+ * @run main Test7024475
+ */
+
+public class Test7024475 {
+
+ static int i;
+ static int x1;
+ static int[] bucket_B;
+
+ static void test(Test7024475 test, int i, int c0, int j, int c1) {
+ for (;;) {
+ if (c1 > c0) {
+ if (c0 > 253) {
+ throw new InternalError("c0 = " + c0);
+ }
+ int index = c0 * 256 + c1;
+ if (index == -1) return;
+ i = bucket_B[index];
+ if (1 < j - i && test != null)
+ x1 = 0;
+ j = i;
+ c1--;
+ } else {
+ c0--;
+ if (j <= 0)
+ break;
+ c1 = 255;
+ }
+ }
+ }
+
+ public static void main(String args[]) {
+ Test7024475 t = new Test7024475();
+ bucket_B = new int[256*256];
+ for (int i = 1; i < 256*256; i++) {
+ bucket_B[i] = 1;
+ }
+ for (int n = 0; n < 100000; n++) {
+ test(t, 2, 85, 1, 134);
+ }
+ }
+}
diff --git a/hotspot/test/compiler/7029152/Test.java b/hotspot/test/compiler/7029152/Test.java
new file mode 100644
index 00000000000..edc7fd9432b
--- /dev/null
+++ b/hotspot/test/compiler/7029152/Test.java
@@ -0,0 +1,49 @@
+/*
+ * Copyright (c) 2011, 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 7029152
+ * @summary Ideal nodes for String intrinsics miss memory edge optimization
+ *
+ * @run main/othervm -Xbatch Test
+ */
+
+public class Test {
+
+ static final String str = "11111xx11111xx1x";
+ static int idx = 0;
+
+ static int IndexOfTest(String str) {
+ return str.indexOf("11111xx1x");
+ }
+
+ public static void main(String args[]) {
+ final int ITERS=2000000;
+
+ for (int i=0; i
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Must set property 'main.class' (e.g. in build.properties)
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/jdk/src/share/demo/nbproject/jfc/TransparentRuler/nbproject/file-targets.xml b/jdk/src/share/demo/nbproject/jfc/TransparentRuler/nbproject/file-targets.xml
new file mode 100644
index 00000000000..9d750841e3b
--- /dev/null
+++ b/jdk/src/share/demo/nbproject/jfc/TransparentRuler/nbproject/file-targets.xml
@@ -0,0 +1,46 @@
+
+
+
+
+
+
+
+
+
+ Must set property 'includes'
+
+
+
+
+
+
+
diff --git a/jdk/src/share/demo/nbproject/jfc/TransparentRuler/nbproject/jdk.xml b/jdk/src/share/demo/nbproject/jfc/TransparentRuler/nbproject/jdk.xml
new file mode 100644
index 00000000000..3690ef0e8f8
--- /dev/null
+++ b/jdk/src/share/demo/nbproject/jfc/TransparentRuler/nbproject/jdk.xml
@@ -0,0 +1,98 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/jdk/src/share/demo/nbproject/jfc/TransparentRuler/nbproject/netbeans-targets.xml b/jdk/src/share/demo/nbproject/jfc/TransparentRuler/nbproject/netbeans-targets.xml
new file mode 100644
index 00000000000..84a0e9b3c5e
--- /dev/null
+++ b/jdk/src/share/demo/nbproject/jfc/TransparentRuler/nbproject/netbeans-targets.xml
@@ -0,0 +1,81 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/jdk/src/share/demo/nbproject/jfc/TransparentRuler/nbproject/project.xml b/jdk/src/share/demo/nbproject/jfc/TransparentRuler/nbproject/project.xml
new file mode 100644
index 00000000000..ecc07bc52b9
--- /dev/null
+++ b/jdk/src/share/demo/nbproject/jfc/TransparentRuler/nbproject/project.xml
@@ -0,0 +1,173 @@
+
+
+
+
+
+ org.netbeans.modules.ant.freeform
+
+
+ TransparentRuler
+
+ user.build.properties
+ build.properties
+ ${nbjdk.home}/jre/lib/rt.jar
+
+
+
+
+ ${main.dir}
+
+
+
+ java
+ ${src.dir}
+
+
+ ${build.dir}
+
+
+
+
+ jar
+
+
+ clean
+
+
+ clean
+ jar
+
+
+ run
+
+
+
+ show-javadoc
+
+
+
+ debug
+
+
+
+ compile-selected
+
+ includes
+ ${src.dir}
+ \.java$
+ relative-path
+
+ ,
+
+
+
+
+ run
+
+ main.class
+ ${src.dir}
+ \.java$
+ java-name
+
+
+
+
+
+
+
+ debug
+
+ main.class
+ ${src.dir}
+ \.java$
+ java-name
+
+
+
+
+
+
+
+ debug-fix
+
+ class
+ ${src.dir}
+ \.java$
+ relative-path-noext
+
+
+
+
+
+
+
+ jar
+ ${jar}
+ jar
+ clean
+
+
+
+
+
+ ${src.dir}
+
+
+ ${main.dir}/README.txt
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ ${src.dir}
+ ${cp}
+ ${run.cp}
+ ${nbjdk.bootclasspath}
+ ${classes.dir}
+ ${jar}
+ ${javadoc.dir}
+ 1.5
+
+
+
+
diff --git a/jdk/src/share/demo/nbproject/project.xml b/jdk/src/share/demo/nbproject/project.xml
index 585faf33b00..43667547ddf 100644
--- a/jdk/src/share/demo/nbproject/project.xml
+++ b/jdk/src/share/demo/nbproject/project.xml
@@ -50,6 +50,7 @@
nbproject/jfc/Stylepadnbproject/jfc/SwingAppletnbproject/jfc/TableExample
+ nbproject/jfc/TransparentRulernbproject/scripting/jconsole-pluginnbproject/management/FullThreadDumpnbproject/management/JTop
diff --git a/jdk/src/share/demo/nio/zipfs/src/com/sun/nio/zipfs/JarFileSystemProvider.java b/jdk/src/share/demo/nio/zipfs/src/com/sun/nio/zipfs/JarFileSystemProvider.java
index dddf69e4dee..b9ea826ab11 100644
--- a/jdk/src/share/demo/nio/zipfs/src/com/sun/nio/zipfs/JarFileSystemProvider.java
+++ b/jdk/src/share/demo/nio/zipfs/src/com/sun/nio/zipfs/JarFileSystemProvider.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2007-2008 Sun Microsystems, Inc. All Rights Reserved.
+ * Copyright (c) 2007, 2008, Oracle and/or its affiliates. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -12,7 +12,7 @@
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
- * - Neither the name of Sun Microsystems nor the names of its
+ * - Neither the name of Oracle nor the names of its
* contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
diff --git a/jdk/src/share/demo/nio/zipfs/src/com/sun/nio/zipfs/ZipFileAttributeView.java b/jdk/src/share/demo/nio/zipfs/src/com/sun/nio/zipfs/ZipFileAttributeView.java
index 22b183d97a7..c646a09e5e3 100644
--- a/jdk/src/share/demo/nio/zipfs/src/com/sun/nio/zipfs/ZipFileAttributeView.java
+++ b/jdk/src/share/demo/nio/zipfs/src/com/sun/nio/zipfs/ZipFileAttributeView.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2009, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2009, 2011, Oracle and/or its affiliates. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
diff --git a/jdk/src/share/demo/nio/zipfs/src/com/sun/nio/zipfs/ZipFileStore.java b/jdk/src/share/demo/nio/zipfs/src/com/sun/nio/zipfs/ZipFileStore.java
index 05719072de3..94ec0307dd9 100644
--- a/jdk/src/share/demo/nio/zipfs/src/com/sun/nio/zipfs/ZipFileStore.java
+++ b/jdk/src/share/demo/nio/zipfs/src/com/sun/nio/zipfs/ZipFileStore.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2009, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2009, 2011, Oracle and/or its affiliates. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
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 fc43fd87ccf..39945358fc6 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
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2009, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2009, 2011, Oracle and/or its affiliates. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
diff --git a/jdk/src/share/demo/nio/zipfs/src/com/sun/nio/zipfs/ZipFileSystemProvider.java b/jdk/src/share/demo/nio/zipfs/src/com/sun/nio/zipfs/ZipFileSystemProvider.java
index d8aa305d29b..c6dd243815e 100644
--- a/jdk/src/share/demo/nio/zipfs/src/com/sun/nio/zipfs/ZipFileSystemProvider.java
+++ b/jdk/src/share/demo/nio/zipfs/src/com/sun/nio/zipfs/ZipFileSystemProvider.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2009, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2009, 2011, Oracle and/or its affiliates. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -99,7 +99,7 @@ public class ZipFileSystemProvider extends FileSystemProvider {
synchronized(filesystems) {
Path realPath = null;
if (ensureFile(path)) {
- realPath = path.toRealPath(true);
+ realPath = path.toRealPath();
if (filesystems.containsKey(realPath))
throw new FileSystemAlreadyExistsException();
}
@@ -154,7 +154,7 @@ public class ZipFileSystemProvider extends FileSystemProvider {
synchronized (filesystems) {
ZipFileSystem zipfs = null;
try {
- zipfs = filesystems.get(uriToPath(uri).toRealPath(true));
+ zipfs = filesystems.get(uriToPath(uri).toRealPath());
} catch (IOException x) {
// ignore the ioe from toRealPath(), return FSNFE
}
@@ -310,7 +310,7 @@ public class ZipFileSystemProvider extends FileSystemProvider {
//////////////////////////////////////////////////////////////
void removeFileSystem(Path zfpath, ZipFileSystem zfs) throws IOException {
synchronized (filesystems) {
- zfpath = zfpath.toRealPath(true);
+ zfpath = zfpath.toRealPath();
if (filesystems.get(zfpath) == zfs)
filesystems.remove(zfpath);
}
diff --git a/jdk/src/share/demo/nio/zipfs/src/com/sun/nio/zipfs/ZipPath.java b/jdk/src/share/demo/nio/zipfs/src/com/sun/nio/zipfs/ZipPath.java
index 1232a27ff1f..8c97818b244 100644
--- a/jdk/src/share/demo/nio/zipfs/src/com/sun/nio/zipfs/ZipPath.java
+++ b/jdk/src/share/demo/nio/zipfs/src/com/sun/nio/zipfs/ZipPath.java
@@ -150,7 +150,7 @@ public class ZipPath implements Path {
}
@Override
- public ZipPath toRealPath(boolean resolveLinks) throws IOException {
+ public ZipPath toRealPath(LinkOption... options) throws IOException {
ZipPath realPath = new ZipPath(zfs, getResolvedPath()).toAbsolutePath();
realPath.checkAccess();
return realPath;
diff --git a/jdk/src/share/instrument/JPLISAgent.c b/jdk/src/share/instrument/JPLISAgent.c
index 7f6b2a0b67c..7494c814189 100644
--- a/jdk/src/share/instrument/JPLISAgent.c
+++ b/jdk/src/share/instrument/JPLISAgent.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2003, 2008, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2011, 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
diff --git a/jdk/src/share/javavm/export/jvmti.h b/jdk/src/share/javavm/export/jvmti.h
index 7e9f2216b55..ee708cb193b 100644
--- a/jdk/src/share/javavm/export/jvmti.h
+++ b/jdk/src/share/javavm/export/jvmti.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2011, 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
diff --git a/jdk/src/share/lib/logging.properties b/jdk/src/share/lib/logging.properties
index 4f7f6dcfd41..65cf1b1b7dc 100644
--- a/jdk/src/share/lib/logging.properties
+++ b/jdk/src/share/lib/logging.properties
@@ -43,6 +43,11 @@ java.util.logging.FileHandler.formatter = java.util.logging.XMLFormatter
java.util.logging.ConsoleHandler.level = INFO
java.util.logging.ConsoleHandler.formatter = java.util.logging.SimpleFormatter
+# Example to customize the SimpleFormatter output format
+# to print one-line log message like this:
+# : []
+#
+# java.util.logging.SimpleFormatter.format=%4$s: %5$s [%1$tc]%n
############################################################
# Facility specific properties.
diff --git a/jdk/src/share/lib/security/java.security b/jdk/src/share/lib/security/java.security
index 5a0726de0a7..a89d40e194b 100644
--- a/jdk/src/share/lib/security/java.security
+++ b/jdk/src/share/lib/security/java.security
@@ -123,7 +123,7 @@ keystore.type=jks
# passed to checkPackageAccess unless the
# corresponding RuntimePermission ("accessClassInPackage."+package) has
# been granted.
-package.access=sun.,com.sun.imageio.
+package.access=sun.,com.sun.xml.internal.ws.,com.sun.xml.internal.bind.,com.sun.imageio.
#
# List of comma-separated packages that start with or equal this string
diff --git a/jdk/src/share/lib/security/java.security-solaris b/jdk/src/share/lib/security/java.security-solaris
index 8e9b1ffd791..1a19f44d231 100644
--- a/jdk/src/share/lib/security/java.security-solaris
+++ b/jdk/src/share/lib/security/java.security-solaris
@@ -124,7 +124,7 @@ keystore.type=jks
# passed to checkPackageAccess unless the
# corresponding RuntimePermission ("accessClassInPackage."+package) has
# been granted.
-package.access=sun.,com.sun.imageio.
+package.access=sun.,com.sun.xml.internal.ws.,com.sun.xml.internal.bind.,com.sun.imageio.
#
# List of comma-separated packages that start with or equal this string
diff --git a/jdk/src/share/lib/security/java.security-windows b/jdk/src/share/lib/security/java.security-windows
index 99eda51b910..3db627a4f32 100644
--- a/jdk/src/share/lib/security/java.security-windows
+++ b/jdk/src/share/lib/security/java.security-windows
@@ -124,7 +124,7 @@ keystore.type=jks
# passed to checkPackageAccess unless the
# corresponding RuntimePermission ("accessClassInPackage."+package) has
# been granted.
-package.access=sun.,com.sun.imageio.
+package.access=sun.,com.sun.xml.internal.ws.,com.sun.xml.internal.bind.,com.sun.imageio.
#
# List of comma-separated packages that start with or equal this string
diff --git a/jdk/src/share/native/com/sun/java/util/jar/pack/unpack.cpp b/jdk/src/share/native/com/sun/java/util/jar/pack/unpack.cpp
index b53b14ed87b..17c48a4ceac 100644
--- a/jdk/src/share/native/com/sun/java/util/jar/pack/unpack.cpp
+++ b/jdk/src/share/native/com/sun/java/util/jar/pack/unpack.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2001, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 2011, 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
@@ -489,7 +489,6 @@ enum { CHUNK = (1 << 14), SMALL = (1 << 9) };
// Call malloc. Try to combine small blocks and free much later.
void* unpacker::alloc_heap(size_t size, bool smallOK, bool temp) {
- CHECK_0;
if (!smallOK || size > SMALL) {
void* res = must_malloc((int)size);
(temp ? &tmallocs : &mallocs)->add(res);
@@ -2560,6 +2559,10 @@ void unpacker::putlayout(band** body) {
int i;
int prevBII = -1;
int prevBCI = -1;
+ if (body == NULL) {
+ abort("putlayout: unexpected NULL for body");
+ return;
+ }
for (i = 0; body[i] != null; i++) {
band& b = *body[i];
byte le_kind = b.le_kind;
@@ -4767,7 +4770,9 @@ void unpacker::redirect_stdio() {
}
char *tname = tempnam(tmpdir,"#upkg");
+ if (tname == NULL) return;
sprintf(log_file_name, "%s", tname);
+ ::free(tname);
if ((errstrm = fopen(log_file_name, "a+")) != NULL) {
log_file = errstrm_name = saveStr(log_file_name);
return ;
diff --git a/jdk/src/share/native/com/sun/media/sound/SoundDefs.h b/jdk/src/share/native/com/sun/media/sound/SoundDefs.h
index 5ac73451681..f141ea62ac2 100644
--- a/jdk/src/share/native/com/sun/media/sound/SoundDefs.h
+++ b/jdk/src/share/native/com/sun/media/sound/SoundDefs.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2007, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2007, 2011, 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,6 +39,8 @@
#define X_IA64 4
#define X_AMD64 5
#define X_ZERO 6
+#define X_ARM 7
+#define X_PPC 8
// **********************************
// Make sure you set X_PLATFORM and X_ARCH defines correctly.
diff --git a/jdk/src/share/native/common/check_code.c b/jdk/src/share/native/common/check_code.c
index 00dcdf163b3..c8787b3612b 100644
--- a/jdk/src/share/native/common/check_code.c
+++ b/jdk/src/share/native/common/check_code.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1994, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1994, 2011, 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
@@ -2685,11 +2685,11 @@ push_stack(context_type *context, unsigned int inumber, stack_info_type *new_sta
switch (type_table[operand]) {
case JVM_CONSTANT_MethodType:
full_info = make_class_info_from_name(context,
- "java/dyn/MethodType");
+ "java/lang/invoke/MethodType");
break;
default: //JVM_CONSTANT_MethodHandle
full_info = make_class_info_from_name(context,
- "java/dyn/MethodHandle");
+ "java/lang/invoke/MethodHandle");
break;
}
break;
diff --git a/jdk/src/share/native/java/io/io_util.c b/jdk/src/share/native/java/io/io_util.c
index 68a24bbab53..e17652a69b5 100644
--- a/jdk/src/share/native/java/io/io_util.c
+++ b/jdk/src/share/native/java/io/io_util.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1994, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1994, 2011, 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
diff --git a/jdk/src/share/native/java/lang/System.c b/jdk/src/share/native/java/lang/System.c
index f2b81a069b5..86ad8f6ce2f 100644
--- a/jdk/src/share/native/java/lang/System.c
+++ b/jdk/src/share/native/java/lang/System.c
@@ -99,7 +99,7 @@ Java_java_lang_System_identityHashCode(JNIEnv *env, jobject this, jobject x)
#ifndef VENDOR /* Third party may overwrite this. */
#define VENDOR "Oracle Corporation"
#define VENDOR_URL "http://java.oracle.com/"
-#define VENDOR_URL_BUG "http://java.sun.com/cgi-bin/bugreport.cgi"
+#define VENDOR_URL_BUG "http://bugreport.sun.com/bugreport/"
#endif
#define JAVA_MAX_SUPPORTED_VERSION 51
diff --git a/jdk/src/share/native/java/lang/fdlibm/include/fdlibm.h b/jdk/src/share/native/java/lang/fdlibm/include/fdlibm.h
index 2b3592dc143..196bb0d8e02 100644
--- a/jdk/src/share/native/java/lang/fdlibm/include/fdlibm.h
+++ b/jdk/src/share/native/java/lang/fdlibm/include/fdlibm.h
@@ -1,6 +1,6 @@
/*
- * Copyright (c) 1998, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 2011, 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
@@ -28,8 +28,8 @@
#ifdef __NEWVALID /* special setup for Sun test regime */
#if defined(i386) || defined(i486) || \
- defined(intel) || defined(x86) || \
- defined(i86pc) || defined(_M_IA64) || defined(ia64)
+ defined(intel) || defined(x86) || defined(arm) || \
+ defined(i86pc) || defined(_M_IA64) || defined(ia64)
#define _LITTLE_ENDIAN
#endif
#endif
diff --git a/jdk/src/share/native/java/util/zip/Deflater.c b/jdk/src/share/native/java/util/zip/Deflater.c
index 3b32750a298..6cad24e480a 100644
--- a/jdk/src/share/native/java/util/zip/Deflater.c
+++ b/jdk/src/share/native/java/util/zip/Deflater.c
@@ -129,34 +129,28 @@ Java_java_util_zip_Deflater_deflateBytes(JNIEnv *env, jobject this, jlong addr,
if ((*env)->GetBooleanField(env, this, setParamsID)) {
int level = (*env)->GetIntField(env, this, levelID);
int strategy = (*env)->GetIntField(env, this, strategyID);
-
- in_buf = (jbyte *) malloc(this_len);
- if (in_buf == 0) {
+ in_buf = (*env)->GetPrimitiveArrayCritical(env, this_buf, 0);
+ if (in_buf == NULL) {
// Throw OOME only when length is not zero
if (this_len != 0)
JNU_ThrowOutOfMemoryError(env, 0);
return 0;
}
- (*env)->GetByteArrayRegion(env, this_buf, this_off, this_len, in_buf);
- out_buf = (jbyte *) malloc(len);
- if (out_buf == 0) {
- free(in_buf);
+ out_buf = (*env)->GetPrimitiveArrayCritical(env, b, 0);
+ if (out_buf == NULL) {
+ (*env)->ReleasePrimitiveArrayCritical(env, this_buf, in_buf, 0);
if (len != 0)
JNU_ThrowOutOfMemoryError(env, 0);
return 0;
}
- strm->next_in = (Bytef *) in_buf;
- strm->next_out = (Bytef *) out_buf;
+ strm->next_in = (Bytef *) (in_buf + this_off);
+ strm->next_out = (Bytef *) (out_buf + off);
strm->avail_in = this_len;
strm->avail_out = len;
res = deflateParams(strm, level, strategy);
-
- if (res == Z_OK) {
- (*env)->SetByteArrayRegion(env, b, off, len - strm->avail_out, out_buf);
- }
- free(out_buf);
- free(in_buf);
+ (*env)->ReleasePrimitiveArrayCritical(env, b, out_buf, 0);
+ (*env)->ReleasePrimitiveArrayCritical(env, this_buf, in_buf, 0);
switch (res) {
case Z_OK:
@@ -174,33 +168,28 @@ Java_java_util_zip_Deflater_deflateBytes(JNIEnv *env, jobject this, jlong addr,
}
} else {
jboolean finish = (*env)->GetBooleanField(env, this, finishID);
- in_buf = (jbyte *) malloc(this_len);
- if (in_buf == 0) {
+ in_buf = (*env)->GetPrimitiveArrayCritical(env, this_buf, 0);
+ if (in_buf == NULL) {
if (this_len != 0)
JNU_ThrowOutOfMemoryError(env, 0);
return 0;
}
- (*env)->GetByteArrayRegion(env, this_buf, this_off, this_len, in_buf);
-
- out_buf = (jbyte *) malloc(len);
- if (out_buf == 0) {
- free(in_buf);
+ out_buf = (*env)->GetPrimitiveArrayCritical(env, b, 0);
+ if (out_buf == NULL) {
+ (*env)->ReleasePrimitiveArrayCritical(env, this_buf, in_buf, 0);
if (len != 0)
JNU_ThrowOutOfMemoryError(env, 0);
+
return 0;
}
- strm->next_in = (Bytef *) in_buf;
- strm->next_out = (Bytef *) out_buf;
+ strm->next_in = (Bytef *) (in_buf + this_off);
+ strm->next_out = (Bytef *) (out_buf + off);
strm->avail_in = this_len;
strm->avail_out = len;
res = deflate(strm, finish ? Z_FINISH : flush);
-
- if (res == Z_STREAM_END || res == Z_OK) {
- (*env)->SetByteArrayRegion(env, b, off, len - strm->avail_out, out_buf);
- }
- free(out_buf);
- free(in_buf);
+ (*env)->ReleasePrimitiveArrayCritical(env, b, out_buf, 0);
+ (*env)->ReleasePrimitiveArrayCritical(env, this_buf, in_buf, 0);
switch (res) {
case Z_STREAM_END:
diff --git a/jdk/src/share/native/java/util/zip/Inflater.c b/jdk/src/share/native/java/util/zip/Inflater.c
index dbf9a1357ae..e5296fcf4c6 100644
--- a/jdk/src/share/native/java/util/zip/Inflater.c
+++ b/jdk/src/share/native/java/util/zip/Inflater.c
@@ -38,8 +38,6 @@
#include "zlib.h"
#include "java_util_zip_Inflater.h"
-#define MIN2(x, y) ((x) < (y) ? (x) : (y))
-
#define ThrowDataFormatException(env, msg) \
JNU_ThrowByName(env, "java/util/zip/DataFormatException", msg)
@@ -111,71 +109,50 @@ Java_java_util_zip_Inflater_inflateBytes(JNIEnv *env, jobject this, jlong addr,
jarray b, jint off, jint len)
{
z_stream *strm = jlong_to_ptr(addr);
-
jarray this_buf = (jarray)(*env)->GetObjectField(env, this, bufID);
jint this_off = (*env)->GetIntField(env, this, offID);
jint this_len = (*env)->GetIntField(env, this, lenID);
+
jbyte *in_buf;
jbyte *out_buf;
int ret;
- /*
- * Avoid excess copying.
- * zlib stream usually has a few bytes of overhead for header info
- * (depends on the underlying data)
- *
- * (a) 5 bytes per 16KB
- * (b) 6 bytes for entire stream
- * (c) 4 bytes for gzip header
- * (d) 2 bytes for crc
- *
- * Use 20 bytes as the "safe cutoff" number.
- */
- jint in_len = MIN2(this_len, len + 20);
- jint consumed;
- in_buf = (jbyte *) malloc(in_len);
- if (in_buf == 0) {
- if (in_len != 0)
+ in_buf = (*env)->GetPrimitiveArrayCritical(env, this_buf, 0);
+ if (in_buf == NULL) {
+ if (this_len != 0)
JNU_ThrowOutOfMemoryError(env, 0);
return 0;
}
- (*env)->GetByteArrayRegion(env, this_buf, this_off, in_len, in_buf);
-
- out_buf = (jbyte *) malloc(len);
- if (out_buf == 0) {
- free(in_buf);
+ out_buf = (*env)->GetPrimitiveArrayCritical(env, b, 0);
+ if (out_buf == NULL) {
+ (*env)->ReleasePrimitiveArrayCritical(env, this_buf, in_buf, 0);
if (len != 0)
JNU_ThrowOutOfMemoryError(env, 0);
return 0;
}
-
- strm->next_in = (Bytef *) in_buf;
- strm->next_out = (Bytef *) out_buf;
- strm->avail_in = in_len;
+ strm->next_in = (Bytef *) (in_buf + this_off);
+ strm->next_out = (Bytef *) (out_buf + off);
+ strm->avail_in = this_len;
strm->avail_out = len;
ret = inflate(strm, Z_PARTIAL_FLUSH);
-
- if (ret == Z_STREAM_END || ret == Z_OK) {
- (*env)->SetByteArrayRegion(env, b, off, len - strm->avail_out, out_buf);
- }
- free(out_buf);
- free(in_buf);
+ (*env)->ReleasePrimitiveArrayCritical(env, b, out_buf, 0);
+ (*env)->ReleasePrimitiveArrayCritical(env, this_buf, in_buf, 0);
switch (ret) {
case Z_STREAM_END:
(*env)->SetBooleanField(env, this, finishedID, JNI_TRUE);
/* fall through */
case Z_OK:
- consumed = in_len - strm->avail_in;
- (*env)->SetIntField(env, this, offID, this_off + consumed);
- (*env)->SetIntField(env, this, lenID, this_len - consumed);
+ this_off += this_len - strm->avail_in;
+ (*env)->SetIntField(env, this, offID, this_off);
+ (*env)->SetIntField(env, this, lenID, strm->avail_in);
return len - strm->avail_out;
case Z_NEED_DICT:
(*env)->SetBooleanField(env, this, needDictID, JNI_TRUE);
/* Might have consumed some input here! */
- consumed = in_len - strm->avail_in;
- (*env)->SetIntField(env, this, offID, this_off + consumed);
- (*env)->SetIntField(env, this, lenID, this_len - consumed);
+ this_off += this_len - strm->avail_in;
+ (*env)->SetIntField(env, this, offID, this_off);
+ (*env)->SetIntField(env, this, lenID, strm->avail_in);
return 0;
case Z_BUF_ERROR:
return 0;
diff --git a/jdk/src/share/native/sun/awt/image/awt_parseImage.c b/jdk/src/share/native/sun/awt/image/awt_parseImage.c
index b569828f5f6..264a02f1642 100644
--- a/jdk/src/share/native/sun/awt/image/awt_parseImage.c
+++ b/jdk/src/share/native/sun/awt/image/awt_parseImage.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2006, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 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
diff --git a/jdk/src/share/native/sun/awt/image/jpeg/imageioJPEG.c b/jdk/src/share/native/sun/awt/image/jpeg/imageioJPEG.c
index 04a87fd1cac..28af8316204 100644
--- a/jdk/src/share/native/sun/awt/image/jpeg/imageioJPEG.c
+++ b/jdk/src/share/native/sun/awt/image/jpeg/imageioJPEG.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2011, 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 @@
#include
#include
#include
-
+#include
/* java native interface headers */
#include "jni.h"
@@ -2657,7 +2657,7 @@ Java_com_sun_imageio_plugins_jpeg_JPEGImageWriter_writeImage
(destWidth < 0) || (destWidth > srcWidth) ||
(destHeight < 0) ||
(stepX < 0) || (stepY < 0) ||
- ((scanLineSize / numBands) < destWidth)) /* destWidth causes an integer overflow */
+ ((INT_MAX / numBands) < destWidth)) /* destWidth causes an integer overflow */
{
JNU_ThrowByName(env, "javax/imageio/IIOException",
"Invalid argument to native writeImage");
diff --git a/jdk/src/share/native/sun/awt/image/jpeg/jpegdecoder.c b/jdk/src/share/native/sun/awt/image/jpeg/jpegdecoder.c
index 2b0992b5151..1879c35ced3 100644
--- a/jdk/src/share/native/sun/awt/image/jpeg/jpegdecoder.c
+++ b/jdk/src/share/native/sun/awt/image/jpeg/jpegdecoder.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1995, 2007, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1995, 2011, 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
diff --git a/jdk/src/share/native/sun/awt/medialib/mlib_ImageAffine.c b/jdk/src/share/native/sun/awt/medialib/mlib_ImageAffine.c
index e0f47978490..18f997325ee 100644
--- a/jdk/src/share/native/sun/awt/medialib/mlib_ImageAffine.c
+++ b/jdk/src/share/native/sun/awt/medialib/mlib_ImageAffine.c
@@ -210,6 +210,8 @@ mlib_status mlib_ImageAffine_alltypes(mlib_image *dst,
t_ind = 4;
else if (type == MLIB_DOUBLE)
t_ind = 5;
+ else
+ return MLIB_FAILURE; /* unknown image type */
if (colormap != NULL && filter != MLIB_NEAREST) {
if (t_ind != 0 && t_ind != 1)
@@ -318,6 +320,10 @@ mlib_status mlib_ImageAffine_alltypes(mlib_image *dst,
}
break;
+
+ default:
+ /* nothing to do for other edge types. */
+ break;
}
if (param_e->buff_malloc != NULL)
diff --git a/jdk/src/share/native/sun/awt/medialib/mlib_ImageAffineEdge.c b/jdk/src/share/native/sun/awt/medialib/mlib_ImageAffineEdge.c
index 5a8e209a0e0..cb06dee4d12 100644
--- a/jdk/src/share/native/sun/awt/medialib/mlib_ImageAffineEdge.c
+++ b/jdk/src/share/native/sun/awt/medialib/mlib_ImageAffineEdge.c
@@ -616,6 +616,9 @@ void mlib_ImageAffineEdgeZero(mlib_affine_param *param,
MLIB_PROCESS_EDGES_ZERO(mlib_d64);
break;
}
+ default:
+ /* Image type MLIB_BIT is not used in java, so we can ignore it. */
+ break;
}
}
@@ -643,6 +646,9 @@ void mlib_ImageAffineEdgeNearest(mlib_affine_param *param,
case MLIB_DOUBLE:
MLIB_PROCESS_EDGES(MLIB_EDGE_NEAREST_LINE, mlib_d64);
break;
+ default:
+ /* Image type MLIB_BIT is not used in java, so we can ignore it. */
+ break;
}
}
@@ -673,8 +679,11 @@ mlib_status mlib_ImageAffineEdgeExtend_BL(mlib_affine_param *param,
if (ltype == MLIB_BYTE) {
buff = mlib_malloc(channels * max_xsize);
}
- else {
+ else if (ltype == MLIB_SHORT) {
buff = mlib_malloc(channels * max_xsize * sizeof(mlib_s16));
+ } else {
+ /* Unsupported type of lookup table. Report a failure */
+ return MLIB_FAILURE;
}
if (buff == NULL)
@@ -691,6 +700,9 @@ mlib_status mlib_ImageAffineEdgeExtend_BL(mlib_affine_param *param,
srcStride >>= 1;
MLIB_PROCESS_EDGES(MLIB_EDGE_INDEX_u8i, mlib_s16);
break;
+ default:
+ /* Incompatible image type. Ignore it for now. */
+ break;
}
break;
@@ -705,9 +717,18 @@ mlib_status mlib_ImageAffineEdgeExtend_BL(mlib_affine_param *param,
srcStride >>= 1;
MLIB_PROCESS_EDGES(MLIB_EDGE_INDEX_s16i, mlib_s16);
break;
+ default:
+ /* Incompatible image type. Ignore it for now. */
+ break;
}
break;
+ default:
+ /* Unsupported type of lookup table.
+ * Can not be here due to check on line 685,
+ * so just ignore it.
+ */
+ break;
}
mlib_free(buff);
@@ -744,6 +765,10 @@ mlib_status mlib_ImageAffineEdgeExtend_BL(mlib_affine_param *param,
srcStride >>= 3;
MLIB_PROCESS_EDGES(MLIB_EDGE_BL, mlib_d64);
break;
+
+ default:
+ /* Image type MLIB_BIT is not supported, ignore it. */
+ break;
}
return MLIB_SUCCESS;
@@ -803,8 +828,11 @@ mlib_status mlib_ImageAffineEdgeExtend_BC(mlib_affine_param *param,
if (ltype == MLIB_BYTE) {
buff = mlib_malloc(channels * max_xsize);
}
- else {
+ else if (ltype == MLIB_SHORT) {
buff = mlib_malloc(channels * max_xsize * sizeof(mlib_s16));
+ } else {
+ /* Unsupported type of lookup table. */
+ return MLIB_FAILURE;
}
if (buff == NULL)
@@ -821,6 +849,9 @@ mlib_status mlib_ImageAffineEdgeExtend_BC(mlib_affine_param *param,
srcStride >>= 1;
MLIB_PROCESS_EDGES(MLIB_EDGE_INDEX_u8i, mlib_s16);
break;
+ default:
+ /* Ignore incomatible image type. */
+ break;
}
break;
@@ -835,9 +866,19 @@ mlib_status mlib_ImageAffineEdgeExtend_BC(mlib_affine_param *param,
srcStride >>= 1;
MLIB_PROCESS_EDGES(MLIB_EDGE_INDEX_s16i, mlib_s16);
break;
+ default:
+ /* Ignore incomatible image type. */
+ break;
}
break;
+
+ default:
+ /* Unsupported type of lookup table.
+ * Can not be here due to check on line 836,
+ * so just ignore it.
+ */
+ break;
}
mlib_free(buff);
@@ -895,6 +936,10 @@ mlib_status mlib_ImageAffineEdgeExtend_BC(mlib_affine_param *param,
}
break;
+
+ default:
+ /* Ignore unsupported image type MLIB_BIT */
+ break;
}
return MLIB_SUCCESS;
diff --git a/jdk/src/share/native/sun/awt/medialib/mlib_ImageColorTrue2Index.c b/jdk/src/share/native/sun/awt/medialib/mlib_ImageColorTrue2Index.c
index dfe13e20362..375008197e4 100644
--- a/jdk/src/share/native/sun/awt/medialib/mlib_ImageColorTrue2Index.c
+++ b/jdk/src/share/native/sun/awt/medialib/mlib_ImageColorTrue2Index.c
@@ -2623,9 +2623,10 @@ mlib_status mlib_ImageColorTrue2Index(mlib_image *dst,
return MLIB_FAILURE;
}
}
+ default:
+ /* Unsupported type of destination image */
+ return MLIB_FAILURE;
}
-
- break;
}
case MLIB_SHORT:
@@ -2678,18 +2679,15 @@ mlib_status mlib_ImageColorTrue2Index(mlib_image *dst,
return MLIB_FAILURE;
}
}
+ default:
+ /* Unsupported type of destination image */
+ return MLIB_FAILURE;
}
-
- break;
}
default:
return MLIB_FAILURE;
}
-
- /* we need to return something to make Microsoft VC happy.
- Return FAILURE because on success we likely to return earlier. */
- return MLIB_FAILURE;
}
/***************************************************************/
diff --git a/jdk/src/share/native/sun/awt/medialib/mlib_ImageConvMxN.c b/jdk/src/share/native/sun/awt/medialib/mlib_ImageConvMxN.c
index baf3c70fc18..c149d42de70 100644
--- a/jdk/src/share/native/sun/awt/medialib/mlib_ImageConvMxN.c
+++ b/jdk/src/share/native/sun/awt/medialib/mlib_ImageConvMxN.c
@@ -211,6 +211,13 @@ mlib_status mlib_ImageConvMxN_f(mlib_image *dst,
case MLIB_DOUBLE:
ret = mlib_convMxNnw_d64(dst_i, src_i, kernel, m, n, dm, dn, cmask);
break;
+
+ default:
+ /* For some reasons, there is no convolution routine for type MLIB_BIT.
+ * For now, we silently ignore it (because this image type is not used by java),
+ * but probably we have to report an error.
+ */
+ break;
}
}
@@ -221,6 +228,11 @@ mlib_status mlib_ImageConvMxN_f(mlib_image *dst,
case MLIB_EDGE_DST_COPY_SRC:
mlib_ImageConvCopyEdge(dst_e, src_e, dx_l, dx_r, dy_t, dy_b, cmask);
break;
+ default:
+ /* Other edge conditions do not need additional handling.
+ * Note also that they are not exposed in public Java API
+ */
+ break;
}
}
else { /* MLIB_EDGE_SRC_EXTEND */
@@ -279,6 +291,12 @@ mlib_status mlib_ImageConvMxN_f(mlib_image *dst,
case MLIB_DOUBLE:
mlib_convMxNext_d64(dst_e, src_e, kernel, m, n, dx_l, dx_r, dy_t, dy_b, cmask);
break;
+ default:
+ /* For some reasons, there is no convolution routine for type MLIB_BIT.
+ * For now, we silently ignore it (because this image type is not used by java),
+ * but probably we have to report an error.
+ */
+ break;
}
}
diff --git a/jdk/src/share/native/sun/awt/medialib/mlib_ImageConv_16ext.c b/jdk/src/share/native/sun/awt/medialib/mlib_ImageConv_16ext.c
index 796063b0284..5ddcbb3e9b4 100644
--- a/jdk/src/share/native/sun/awt/medialib/mlib_ImageConv_16ext.c
+++ b/jdk/src/share/native/sun/awt/medialib/mlib_ImageConv_16ext.c
@@ -1869,8 +1869,8 @@ static mlib_status mlib_ImageConv1xN_ext(mlib_image *dst,
/***************************************************************/
mlib_status CONV_FUNC_MxN
{
- DTYPE *adr_src, *sl, *sp;
- DTYPE *adr_dst, *dl, *dp;
+ DTYPE *adr_src, *sl, *sp = NULL;
+ DTYPE *adr_dst, *dl, *dp = NULL;
FTYPE buff[BUFF_SIZE], *buffs_arr[2*(MAX_N + 1)];
FTYPE **buffs = buffs_arr, *buffd;
FTYPE akernel[256], *k = akernel, fscale = DSCALE;
@@ -2332,8 +2332,8 @@ mlib_status CONV_FUNC_MxN
mlib_status CONV_FUNC_MxN_I
{
- DTYPE *adr_src, *sl, *sp;
- DTYPE *adr_dst, *dl, *dp;
+ DTYPE *adr_src, *sl, *sp = NULL;
+ DTYPE *adr_dst, *dl, *dp = NULL;
mlib_s32 buff[BUFF_SIZE], *buffs_arr[2*(MAX_N + 1)];
mlib_s32 *pbuff = buff;
mlib_s32 **buffs = buffs_arr, *buffd;
diff --git a/jdk/src/share/native/sun/awt/medialib/mlib_ImageConv_16nw.c b/jdk/src/share/native/sun/awt/medialib/mlib_ImageConv_16nw.c
index 53e1d8a793c..8c5ada353bd 100644
--- a/jdk/src/share/native/sun/awt/medialib/mlib_ImageConv_16nw.c
+++ b/jdk/src/share/native/sun/awt/medialib/mlib_ImageConv_16nw.c
@@ -148,8 +148,8 @@ typedef union {
/***************************************************************/
#define DEF_VARS(type) \
- type *adr_src, *sl, *sp; \
- type *adr_dst, *dl, *dp; \
+ type *adr_src, *sl, *sp = NULL; \
+ type *adr_dst, *dl, *dp = NULL; \
FTYPE *pbuff = buff; \
mlib_s32 wid, hgt, sll, dll; \
mlib_s32 nchannel, chan1; \
@@ -2060,8 +2060,8 @@ mlib_status CONV_FUNC_I(MxN)(mlib_image *dst,
mlib_s32 d0, d1, shift1, shift2;
mlib_s32 k0, k1, k2, k3, k4, k5, k6;
mlib_s32 p0, p1, p2, p3, p4, p5, p6, p7;
- DTYPE *adr_src, *sl, *sp;
- DTYPE *adr_dst, *dl, *dp;
+ DTYPE *adr_src, *sl, *sp = NULL;
+ DTYPE *adr_dst, *dl, *dp = NULL;
mlib_s32 wid, hgt, sll, dll;
mlib_s32 nchannel, chan1;
mlib_s32 i, j, c;
diff --git a/jdk/src/share/native/sun/awt/medialib/mlib_ImageConv_32nw.c b/jdk/src/share/native/sun/awt/medialib/mlib_ImageConv_32nw.c
index 5a74988ce34..eb7037307ca 100644
--- a/jdk/src/share/native/sun/awt/medialib/mlib_ImageConv_32nw.c
+++ b/jdk/src/share/native/sun/awt/medialib/mlib_ImageConv_32nw.c
@@ -78,7 +78,7 @@
/***************************************************************/
#define DEF_VARS_MxN(type) \
GET_SRC_DST_PARAMETERS(type); \
- type *sl, *sp, *dl, *dp; \
+ type *sl, *sp = NULL, *dl, *dp = NULL; \
mlib_d64 *pbuff = buff; \
mlib_s32 i, j, c
diff --git a/jdk/src/share/native/sun/awt/medialib/mlib_ImageConv_8ext.c b/jdk/src/share/native/sun/awt/medialib/mlib_ImageConv_8ext.c
index 53d54990deb..3a006ed5f83 100644
--- a/jdk/src/share/native/sun/awt/medialib/mlib_ImageConv_8ext.c
+++ b/jdk/src/share/native/sun/awt/medialib/mlib_ImageConv_8ext.c
@@ -1869,8 +1869,8 @@ static mlib_status mlib_ImageConv1xN_ext(mlib_image *dst,
/***************************************************************/
mlib_status CONV_FUNC_MxN
{
- DTYPE *adr_src, *sl, *sp;
- DTYPE *adr_dst, *dl, *dp;
+ DTYPE *adr_src, *sl, *sp = NULL;
+ DTYPE *adr_dst, *dl, *dp = NULL;
FTYPE buff[BUFF_SIZE], *buffs_arr[2*(MAX_N + 1)];
FTYPE **buffs = buffs_arr, *buffd;
FTYPE akernel[256], *k = akernel, fscale = DSCALE;
@@ -2332,8 +2332,8 @@ mlib_status CONV_FUNC_MxN
mlib_status CONV_FUNC_MxN_I
{
- DTYPE *adr_src, *sl, *sp;
- DTYPE *adr_dst, *dl, *dp;
+ DTYPE *adr_src, *sl, *sp = NULL;
+ DTYPE *adr_dst, *dl, *dp = NULL;
mlib_s32 buff[BUFF_SIZE], *buffs_arr[2*(MAX_N + 1)];
mlib_s32 *pbuff = buff;
mlib_s32 **buffs = buffs_arr, *buffd;
diff --git a/jdk/src/share/native/sun/awt/medialib/mlib_ImageConv_8nw.c b/jdk/src/share/native/sun/awt/medialib/mlib_ImageConv_8nw.c
index 1b09b1bcade..ce337534c6f 100644
--- a/jdk/src/share/native/sun/awt/medialib/mlib_ImageConv_8nw.c
+++ b/jdk/src/share/native/sun/awt/medialib/mlib_ImageConv_8nw.c
@@ -149,8 +149,8 @@ typedef union {
/***************************************************************/
#define DEF_VARS(type) \
- type *adr_src, *sl, *sp; \
- type *adr_dst, *dl, *dp; \
+ type *adr_src, *sl, *sp = NULL; \
+ type *adr_dst, *dl, *dp = NULL; \
FTYPE *pbuff = buff; \
mlib_s32 wid, hgt, sll, dll; \
mlib_s32 nchannel, chan1; \
@@ -2061,8 +2061,8 @@ mlib_status CONV_FUNC_I(MxN)(mlib_image *dst,
mlib_s32 d0, d1, shift1, shift2;
mlib_s32 k0, k1, k2, k3, k4, k5, k6;
mlib_s32 p0, p1, p2, p3, p4, p5, p6, p7;
- DTYPE *adr_src, *sl, *sp;
- DTYPE *adr_dst, *dl, *dp;
+ DTYPE *adr_src, *sl, *sp = NULL;
+ DTYPE *adr_dst, *dl, *dp = NULL;
mlib_s32 wid, hgt, sll, dll;
mlib_s32 nchannel, chan1;
mlib_s32 i, j, c;
diff --git a/jdk/src/share/native/sun/awt/medialib/mlib_ImageConv_D64nw.c b/jdk/src/share/native/sun/awt/medialib/mlib_ImageConv_D64nw.c
index cb08ae2ae80..2e84957bdf1 100644
--- a/jdk/src/share/native/sun/awt/medialib/mlib_ImageConv_D64nw.c
+++ b/jdk/src/share/native/sun/awt/medialib/mlib_ImageConv_D64nw.c
@@ -71,8 +71,8 @@
#define DEF_VARS(type) \
GET_SRC_DST_PARAMETERS(type); \
type *sl; \
- type *dl, *dp; \
- mlib_s32 i, j, c
+ type *dl, *dp = NULL; \
+ mlib_s32 i = 0, j, c
/***************************************************************/
#undef KSIZE
diff --git a/jdk/src/share/native/sun/awt/medialib/mlib_ImageConv_F32nw.c b/jdk/src/share/native/sun/awt/medialib/mlib_ImageConv_F32nw.c
index c78615fd718..d19448d936c 100644
--- a/jdk/src/share/native/sun/awt/medialib/mlib_ImageConv_F32nw.c
+++ b/jdk/src/share/native/sun/awt/medialib/mlib_ImageConv_F32nw.c
@@ -71,7 +71,7 @@
#define DEF_VARS(type) \
GET_SRC_DST_PARAMETERS(type); \
type *sl; \
- type *dl, *dp; \
+ type *dl, *dp = NULL; \
mlib_s32 i, j, c
/***************************************************************/
diff --git a/jdk/src/share/native/sun/awt/medialib/mlib_ImageConv_u16ext.c b/jdk/src/share/native/sun/awt/medialib/mlib_ImageConv_u16ext.c
index a3f79ffb564..f412112b168 100644
--- a/jdk/src/share/native/sun/awt/medialib/mlib_ImageConv_u16ext.c
+++ b/jdk/src/share/native/sun/awt/medialib/mlib_ImageConv_u16ext.c
@@ -1869,8 +1869,8 @@ static mlib_status mlib_ImageConv1xN_ext(mlib_image *dst,
/***************************************************************/
mlib_status CONV_FUNC_MxN
{
- DTYPE *adr_src, *sl, *sp;
- DTYPE *adr_dst, *dl, *dp;
+ DTYPE *adr_src, *sl, *sp = NULL;
+ DTYPE *adr_dst, *dl, *dp = NULL;
FTYPE buff[BUFF_SIZE], *buffs_arr[2*(MAX_N + 1)];
FTYPE **buffs = buffs_arr, *buffd;
FTYPE akernel[256], *k = akernel, fscale = DSCALE;
@@ -2332,8 +2332,8 @@ mlib_status CONV_FUNC_MxN
mlib_status CONV_FUNC_MxN_I
{
- DTYPE *adr_src, *sl, *sp;
- DTYPE *adr_dst, *dl, *dp;
+ DTYPE *adr_src, *sl, *sp = NULL;
+ DTYPE *adr_dst, *dl, *dp = NULL;
mlib_s32 buff[BUFF_SIZE], *buffs_arr[2*(MAX_N + 1)];
mlib_s32 *pbuff = buff;
mlib_s32 **buffs = buffs_arr, *buffd;
diff --git a/jdk/src/share/native/sun/awt/medialib/mlib_ImageConv_u16nw.c b/jdk/src/share/native/sun/awt/medialib/mlib_ImageConv_u16nw.c
index 2f017c6f8d0..eb68aeff7dd 100644
--- a/jdk/src/share/native/sun/awt/medialib/mlib_ImageConv_u16nw.c
+++ b/jdk/src/share/native/sun/awt/medialib/mlib_ImageConv_u16nw.c
@@ -148,8 +148,8 @@ typedef union {
/***************************************************************/
#define DEF_VARS(type) \
- type *adr_src, *sl, *sp; \
- type *adr_dst, *dl, *dp; \
+ type *adr_src, *sl, *sp = NULL; \
+ type *adr_dst, *dl, *dp = NULL; \
FTYPE *pbuff = buff; \
mlib_s32 wid, hgt, sll, dll; \
mlib_s32 nchannel, chan1; \
@@ -2060,8 +2060,8 @@ mlib_status CONV_FUNC_I(MxN)(mlib_image *dst,
mlib_s32 d0, d1, shift1, shift2;
mlib_s32 k0, k1, k2, k3, k4, k5, k6;
mlib_s32 p0, p1, p2, p3, p4, p5, p6, p7;
- DTYPE *adr_src, *sl, *sp;
- DTYPE *adr_dst, *dl, *dp;
+ DTYPE *adr_src, *sl, *sp = NULL;
+ DTYPE *adr_dst, *dl, *dp = NULL;
mlib_s32 wid, hgt, sll, dll;
mlib_s32 nchannel, chan1;
mlib_s32 i, j, c;
diff --git a/jdk/src/share/native/sun/awt/medialib/mlib_ImageCopy_Bit.c b/jdk/src/share/native/sun/awt/medialib/mlib_ImageCopy_Bit.c
index 503883e1866..a5fdb06cd2a 100644
--- a/jdk/src/share/native/sun/awt/medialib/mlib_ImageCopy_Bit.c
+++ b/jdk/src/share/native/sun/awt/medialib/mlib_ImageCopy_Bit.c
@@ -204,9 +204,9 @@ void mlib_ImageCopy_bit_na(const mlib_u8 *sa,
mlib_u64 *dp; /* 8-byte aligned start points in dst */
mlib_u64 *sp; /* 8-byte aligned start point in src */
mlib_s32 j; /* offset of address in dst */
- mlib_u64 lmask0 = 0xFFFFFFFFFFFFFFFF;
+ mlib_u64 lmask0 = 0xFFFFFFFFFFFFFFFFULL;
mlib_u64 dmask;
- mlib_u64 lsrc, lsrc0, lsrc1, ldst;
+ mlib_u64 lsrc, lsrc0, lsrc1 = 0ULL, ldst;
mlib_s32 ls_offset, ld_offset, shift;
if (size <= 0) return;
@@ -427,9 +427,9 @@ void mlib_ImageCopy_bit_na_r(const mlib_u8 *sa,
mlib_u64 *dp; /* 8-byte aligned start points in dst */
mlib_u64 *sp; /* 8-byte aligned start point in src */
mlib_s32 j; /* offset of address in dst */
- mlib_u64 lmask0 = 0xFFFFFFFFFFFFFFFF;
+ mlib_u64 lmask0 = 0xFFFFFFFFFFFFFFFFULL;
mlib_u64 dmask;
- mlib_u64 lsrc, lsrc0, lsrc1, ldst;
+ mlib_u64 lsrc, lsrc0, lsrc1 = 0ULL, ldst;
mlib_s32 ls_offset, ld_offset, shift;
if (size <= 0) return;
diff --git a/jdk/src/share/native/sun/awt/medialib/mlib_ImageCreate.c b/jdk/src/share/native/sun/awt/medialib/mlib_ImageCreate.c
index ba1a2b47fb0..fe065b35df3 100644
--- a/jdk/src/share/native/sun/awt/medialib/mlib_ImageCreate.c
+++ b/jdk/src/share/native/sun/awt/medialib/mlib_ImageCreate.c
@@ -334,7 +334,7 @@ mlib_image *mlib_ImageCreateSubimage(mlib_image *img,
mlib_s32 width; /* for parent image */
mlib_s32 height; /* for parent image */
mlib_s32 stride;
- mlib_s32 bitoffset;
+ mlib_s32 bitoffset = 0;
void *data;
/* sanity check */
@@ -423,7 +423,7 @@ mlib_image *mlib_ImageSetSubimage(mlib_image *dst,
mlib_s32 channels = src -> channels;
mlib_s32 stride = src -> stride;
mlib_u8 *data = src -> data;
- mlib_s32 bitoffset;
+ mlib_s32 bitoffset = 0;
data += y * stride;
diff --git a/jdk/src/share/native/sun/awt/splashscreen/splashscreen_gfx_impl.h b/jdk/src/share/native/sun/awt/splashscreen/splashscreen_gfx_impl.h
index a0fd446e94a..10574adba21 100644
--- a/jdk/src/share/native/sun/awt/splashscreen/splashscreen_gfx_impl.h
+++ b/jdk/src/share/native/sun/awt/splashscreen/splashscreen_gfx_impl.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2005, 2006, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 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
diff --git a/jdk/src/share/native/sun/font/FontInstanceAdapter.cpp b/jdk/src/share/native/sun/font/FontInstanceAdapter.cpp
index 952523105c1..824f296cc5c 100644
--- a/jdk/src/share/native/sun/font/FontInstanceAdapter.cpp
+++ b/jdk/src/share/native/sun/font/FontInstanceAdapter.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1999, 2007, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2011, 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
diff --git a/jdk/src/share/native/sun/font/layout/KernTable.cpp b/jdk/src/share/native/sun/font/layout/KernTable.cpp
index 8d368211309..3a9987eb6b9 100644
--- a/jdk/src/share/native/sun/font/layout/KernTable.cpp
+++ b/jdk/src/share/native/sun/font/layout/KernTable.cpp
@@ -210,7 +210,7 @@ void KernTable::process(LEGlyphStorage& storage)
// all the elements ahead of time and store them in the font
const PairInfo* p = pairs;
- const PairInfo* tp = (const PairInfo*)(p + rangeShift);
+ const PairInfo* tp = (const PairInfo*)(p + (rangeShift/KERN_PAIRINFO_SIZE)); /* rangeshift is in original table bytes */
if (key > tp->key) {
p = tp;
}
@@ -222,7 +222,7 @@ void KernTable::process(LEGlyphStorage& storage)
le_uint32 probe = searchRange;
while (probe > 1) {
probe >>= 1;
- tp = (const PairInfo*)(p + probe);
+ tp = (const PairInfo*)(p + (probe/KERN_PAIRINFO_SIZE));
le_uint32 tkey = tp->key;
#if DEBUG
fprintf(stdout, " %.3d (%0.8x)\n", (tp - pairs), tkey);
diff --git a/jdk/src/share/native/sun/font/layout/LayoutEngine.cpp b/jdk/src/share/native/sun/font/layout/LayoutEngine.cpp
index 6b0aa1baa58..90aafde2a80 100644
--- a/jdk/src/share/native/sun/font/layout/LayoutEngine.cpp
+++ b/jdk/src/share/native/sun/font/layout/LayoutEngine.cpp
@@ -251,6 +251,10 @@ le_int32 LayoutEngine::characterProcessing(const LEUnicode chars[], le_int32 off
return 0;
}
+ if ((fTypoFlags & 0x4) == 0) { // no canonical processing
+ return count;
+ }
+
const GlyphSubstitutionTableHeader *canonGSUBTable = (GlyphSubstitutionTableHeader *) CanonShaping::glyphSubstitutionTable;
LETag scriptTag = OpenTypeLayoutEngine::getScriptTag(fScriptCode);
LETag langSysTag = OpenTypeLayoutEngine::getLangSysTag(fLanguageCode);
diff --git a/jdk/src/share/native/sun/java2d/cmm/lcms/LCMS.c b/jdk/src/share/native/sun/java2d/cmm/lcms/LCMS.c
index bd2c03c1ac6..8ac40e4b1d1 100644
--- a/jdk/src/share/native/sun/java2d/cmm/lcms/LCMS.c
+++ b/jdk/src/share/native/sun/java2d/cmm/lcms/LCMS.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2007, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2007, 2011, 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
diff --git a/jdk/src/share/native/sun/java2d/loops/MaskFill.c b/jdk/src/share/native/sun/java2d/loops/MaskFill.c
index 6691ede7a35..0003675d43c 100644
--- a/jdk/src/share/native/sun/java2d/loops/MaskFill.c
+++ b/jdk/src/share/native/sun/java2d/loops/MaskFill.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2000, 2005, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 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
diff --git a/jdk/src/share/native/sun/java2d/loops/ParallelogramUtils.h b/jdk/src/share/native/sun/java2d/loops/ParallelogramUtils.h
index 3691abad25c..117d32e2daa 100644
--- a/jdk/src/share/native/sun/java2d/loops/ParallelogramUtils.h
+++ b/jdk/src/share/native/sun/java2d/loops/ParallelogramUtils.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2008, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2008, 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
diff --git a/jdk/src/share/native/sun/java2d/loops/ProcessPath.c b/jdk/src/share/native/sun/java2d/loops/ProcessPath.c
index b4f724752dc..c6c643219a4 100644
--- a/jdk/src/share/native/sun/java2d/loops/ProcessPath.c
+++ b/jdk/src/share/native/sun/java2d/loops/ProcessPath.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2011, 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
@@ -118,19 +118,25 @@
jint Y1 = (fY1) >> MDP_PREC; \
jint res; \
\
- /* Checking bounds and clipping if necessary */ \
+ /* Checking bounds and clipping if necessary. \
+ * REMIND: It's temporary solution to avoid OOB in rendering code. \
+ * Current approach uses float equations which are unreliable for \
+ * clipping and makes assumptions about the line biases of the \
+ * rendering algorithm. Also, clipping code should be moved down \
+ * into only those output renderers that need it. \
+ */ \
if (checkBounds) { \
- TESTANDCLIP(hnd->dhnd->yMin, hnd->dhnd->yMax, Y0, X0, Y1, X1, \
- jint, res); \
+ jfloat xMinf = hnd->dhnd->xMinf + 0.5f; \
+ jfloat yMinf = hnd->dhnd->yMinf + 0.5f; \
+ jfloat xMaxf = hnd->dhnd->xMaxf + 0.5f; \
+ jfloat yMaxf = hnd->dhnd->yMaxf + 0.5f; \
+ TESTANDCLIP(yMinf, yMaxf, Y0, X0, Y1, X1, jint, res); \
if (res == CRES_INVISIBLE) break; \
- TESTANDCLIP(hnd->dhnd->yMin, hnd->dhnd->yMax, Y1, X1, Y0, X0, \
- jint, res); \
+ TESTANDCLIP(yMinf, yMaxf, Y1, X1, Y0, X0, jint, res); \
if (res == CRES_INVISIBLE) break; \
- TESTANDCLIP(hnd->dhnd->xMin, hnd->dhnd->xMax, X0, Y0, X1, Y1, \
- jint, res); \
+ TESTANDCLIP(xMinf, xMaxf, X0, Y0, X1, Y1, jint, res); \
if (res == CRES_INVISIBLE) break; \
- TESTANDCLIP(hnd->dhnd->xMin, hnd->dhnd->xMax, X1, Y1, X0, Y0, \
- jint, res); \
+ TESTANDCLIP(xMinf, xMaxf, X1, Y1, X0, Y0, jint, res); \
if (res == CRES_INVISIBLE) break; \
} \
\
diff --git a/jdk/src/share/native/sun/java2d/pipe/BufferedMaskBlit.c b/jdk/src/share/native/sun/java2d/pipe/BufferedMaskBlit.c
index ccfeab5cafd..b5ba039a237 100644
--- a/jdk/src/share/native/sun/java2d/pipe/BufferedMaskBlit.c
+++ b/jdk/src/share/native/sun/java2d/pipe/BufferedMaskBlit.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2007, 2008, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2007, 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
diff --git a/jdk/src/share/native/sun/security/ec/ECC_JNI.cpp b/jdk/src/share/native/sun/security/ec/ECC_JNI.cpp
index 249d2e74ed1..dff675f9500 100644
--- a/jdk/src/share/native/sun/security/ec/ECC_JNI.cpp
+++ b/jdk/src/share/native/sun/security/ec/ECC_JNI.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2009, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2009, 2011, 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
diff --git a/jdk/src/share/native/sun/security/ec/impl/ec.c b/jdk/src/share/native/sun/security/ec/impl/ec.c
index 11777de8746..de357229046 100644
--- a/jdk/src/share/native/sun/security/ec/impl/ec.c
+++ b/jdk/src/share/native/sun/security/ec/impl/ec.c
@@ -51,7 +51,7 @@
*
*********************************************************************** */
/*
- * Copyright (c) 2007, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2007, 2011, Oracle and/or its affiliates. All rights reserved.
* Use is subject to license terms.
*/
diff --git a/jdk/src/share/native/sun/security/ec/impl/ec.h b/jdk/src/share/native/sun/security/ec/impl/ec.h
index f5f3d356e26..96d25f2a47a 100644
--- a/jdk/src/share/native/sun/security/ec/impl/ec.h
+++ b/jdk/src/share/native/sun/security/ec/impl/ec.h
@@ -50,7 +50,7 @@
*
*********************************************************************** */
/*
- * Copyright (c) 2007, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2007, 2011, Oracle and/or its affiliates. All rights reserved.
* Use is subject to license terms.
*/
diff --git a/jdk/src/share/native/sun/security/ec/impl/ec2.h b/jdk/src/share/native/sun/security/ec/impl/ec2.h
index e297a309218..b0ad53e9ee1 100644
--- a/jdk/src/share/native/sun/security/ec/impl/ec2.h
+++ b/jdk/src/share/native/sun/security/ec/impl/ec2.h
@@ -50,7 +50,7 @@
*
*********************************************************************** */
/*
- * Copyright (c) 2007, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2007, 2011, Oracle and/or its affiliates. All rights reserved.
* Use is subject to license terms.
*/
diff --git a/jdk/src/share/native/sun/security/ec/impl/ec2_163.c b/jdk/src/share/native/sun/security/ec/impl/ec2_163.c
index c1dc55dea35..45023bfb92b 100644
--- a/jdk/src/share/native/sun/security/ec/impl/ec2_163.c
+++ b/jdk/src/share/native/sun/security/ec/impl/ec2_163.c
@@ -52,7 +52,7 @@
*
*********************************************************************** */
/*
- * Copyright (c) 2007, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2007, 2011, Oracle and/or its affiliates. All rights reserved.
* Use is subject to license terms.
*/
diff --git a/jdk/src/share/native/sun/security/ec/impl/ec2_193.c b/jdk/src/share/native/sun/security/ec/impl/ec2_193.c
index aa7f29f0823..7bb7a947ac9 100644
--- a/jdk/src/share/native/sun/security/ec/impl/ec2_193.c
+++ b/jdk/src/share/native/sun/security/ec/impl/ec2_193.c
@@ -52,7 +52,7 @@
*
*********************************************************************** */
/*
- * Copyright (c) 2007, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2007, 2011, Oracle and/or its affiliates. All rights reserved.
* Use is subject to license terms.
*/
diff --git a/jdk/src/share/native/sun/security/ec/impl/ec2_233.c b/jdk/src/share/native/sun/security/ec/impl/ec2_233.c
index 485b104ce2a..d8fa9b36ed8 100644
--- a/jdk/src/share/native/sun/security/ec/impl/ec2_233.c
+++ b/jdk/src/share/native/sun/security/ec/impl/ec2_233.c
@@ -52,7 +52,7 @@
*
*********************************************************************** */
/*
- * Copyright (c) 2007, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2007, 2011, Oracle and/or its affiliates. All rights reserved.
* Use is subject to license terms.
*/
diff --git a/jdk/src/share/native/sun/security/ec/impl/ec2_aff.c b/jdk/src/share/native/sun/security/ec/impl/ec2_aff.c
index f77eba3f499..aff4da37d63 100644
--- a/jdk/src/share/native/sun/security/ec/impl/ec2_aff.c
+++ b/jdk/src/share/native/sun/security/ec/impl/ec2_aff.c
@@ -50,7 +50,7 @@
*
*********************************************************************** */
/*
- * Copyright (c) 2007, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2007, 2011, Oracle and/or its affiliates. All rights reserved.
* Use is subject to license terms.
*/
diff --git a/jdk/src/share/native/sun/security/ec/impl/ec2_mont.c b/jdk/src/share/native/sun/security/ec/impl/ec2_mont.c
index eda921f3ff6..d000a1ab6df 100644
--- a/jdk/src/share/native/sun/security/ec/impl/ec2_mont.c
+++ b/jdk/src/share/native/sun/security/ec/impl/ec2_mont.c
@@ -52,7 +52,7 @@
*
*********************************************************************** */
/*
- * Copyright (c) 2007, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2007, 2011, Oracle and/or its affiliates. All rights reserved.
* Use is subject to license terms.
*/
diff --git a/jdk/src/share/native/sun/security/ec/impl/ec_naf.c b/jdk/src/share/native/sun/security/ec/impl/ec_naf.c
index e6307f0d108..c9e4aa4abb9 100644
--- a/jdk/src/share/native/sun/security/ec/impl/ec_naf.c
+++ b/jdk/src/share/native/sun/security/ec/impl/ec_naf.c
@@ -50,7 +50,7 @@
*
*********************************************************************** */
/*
- * Copyright (c) 2007, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2007, 2011, Oracle and/or its affiliates. All rights reserved.
* Use is subject to license terms.
*/
diff --git a/jdk/src/share/native/sun/security/ec/impl/ecc_impl.h b/jdk/src/share/native/sun/security/ec/impl/ecc_impl.h
index 23357ae8c42..9e5b0f951c9 100644
--- a/jdk/src/share/native/sun/security/ec/impl/ecc_impl.h
+++ b/jdk/src/share/native/sun/security/ec/impl/ecc_impl.h
@@ -51,7 +51,7 @@
*
*********************************************************************** */
/*
- * Copyright (c) 2007, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2007, 2011, Oracle and/or its affiliates. All rights reserved.
* Use is subject to license terms.
*/
diff --git a/jdk/src/share/native/sun/security/ec/impl/ecdecode.c b/jdk/src/share/native/sun/security/ec/impl/ecdecode.c
index 826192161ee..639035c4652 100644
--- a/jdk/src/share/native/sun/security/ec/impl/ecdecode.c
+++ b/jdk/src/share/native/sun/security/ec/impl/ecdecode.c
@@ -51,7 +51,7 @@
*
*********************************************************************** */
/*
- * Copyright (c) 2007, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2007, 2011, Oracle and/or its affiliates. All rights reserved.
* Use is subject to license terms.
*/
diff --git a/jdk/src/share/native/sun/security/ec/impl/ecl-curve.h b/jdk/src/share/native/sun/security/ec/impl/ecl-curve.h
index 865c3d49feb..7f8ad1a7f9b 100644
--- a/jdk/src/share/native/sun/security/ec/impl/ecl-curve.h
+++ b/jdk/src/share/native/sun/security/ec/impl/ecl-curve.h
@@ -50,7 +50,7 @@
*
*********************************************************************** */
/*
- * Copyright (c) 2007, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2007, 2011, Oracle and/or its affiliates. All rights reserved.
* Use is subject to license terms.
*/
diff --git a/jdk/src/share/native/sun/security/ec/impl/ecl-exp.h b/jdk/src/share/native/sun/security/ec/impl/ecl-exp.h
index 51ed43fdbc2..434df45af67 100644
--- a/jdk/src/share/native/sun/security/ec/impl/ecl-exp.h
+++ b/jdk/src/share/native/sun/security/ec/impl/ecl-exp.h
@@ -50,7 +50,7 @@
*
*********************************************************************** */
/*
- * Copyright (c) 2007, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2007, 2011, Oracle and/or its affiliates. All rights reserved.
* Use is subject to license terms.
*/
diff --git a/jdk/src/share/native/sun/security/ec/impl/ecl-priv.h b/jdk/src/share/native/sun/security/ec/impl/ecl-priv.h
index 6b032eabecc..c99b3e21bb7 100644
--- a/jdk/src/share/native/sun/security/ec/impl/ecl-priv.h
+++ b/jdk/src/share/native/sun/security/ec/impl/ecl-priv.h
@@ -51,7 +51,7 @@
*
*********************************************************************** */
/*
- * Copyright (c) 2007, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2007, 2011, Oracle and/or its affiliates. All rights reserved.
* Use is subject to license terms.
*/
diff --git a/jdk/src/share/native/sun/security/ec/impl/ecl.c b/jdk/src/share/native/sun/security/ec/impl/ecl.c
index 79c5467cf07..a379d28e0d9 100644
--- a/jdk/src/share/native/sun/security/ec/impl/ecl.c
+++ b/jdk/src/share/native/sun/security/ec/impl/ecl.c
@@ -50,7 +50,7 @@
*
*********************************************************************** */
/*
- * Copyright (c) 2007, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2007, 2011, Oracle and/or its affiliates. All rights reserved.
* Use is subject to license terms.
*/
diff --git a/jdk/src/share/native/sun/security/ec/impl/ecl.h b/jdk/src/share/native/sun/security/ec/impl/ecl.h
index ab956d89fbc..80c32659858 100644
--- a/jdk/src/share/native/sun/security/ec/impl/ecl.h
+++ b/jdk/src/share/native/sun/security/ec/impl/ecl.h
@@ -50,7 +50,7 @@
*
*********************************************************************** */
/*
- * Copyright (c) 2007, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2007, 2011, Oracle and/or its affiliates. All rights reserved.
* Use is subject to license terms.
*/
diff --git a/jdk/src/share/native/sun/security/ec/impl/ecl_curve.c b/jdk/src/share/native/sun/security/ec/impl/ecl_curve.c
index a253a363f6a..c315625f771 100644
--- a/jdk/src/share/native/sun/security/ec/impl/ecl_curve.c
+++ b/jdk/src/share/native/sun/security/ec/impl/ecl_curve.c
@@ -50,7 +50,7 @@
*
*********************************************************************** */
/*
- * Copyright (c) 2007, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2007, 2011, Oracle and/or its affiliates. All rights reserved.
* Use is subject to license terms.
*/
diff --git a/jdk/src/share/native/sun/security/ec/impl/ecl_gf.c b/jdk/src/share/native/sun/security/ec/impl/ecl_gf.c
index 46b8dff0295..bd4c10c7218 100644
--- a/jdk/src/share/native/sun/security/ec/impl/ecl_gf.c
+++ b/jdk/src/share/native/sun/security/ec/impl/ecl_gf.c
@@ -51,7 +51,7 @@
*
*********************************************************************** */
/*
- * Copyright (c) 2007, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2007, 2011, Oracle and/or its affiliates. All rights reserved.
* Use is subject to license terms.
*/
diff --git a/jdk/src/share/native/sun/security/ec/impl/ecl_mult.c b/jdk/src/share/native/sun/security/ec/impl/ecl_mult.c
index 5c43ae8cf0e..55ad75f293b 100644
--- a/jdk/src/share/native/sun/security/ec/impl/ecl_mult.c
+++ b/jdk/src/share/native/sun/security/ec/impl/ecl_mult.c
@@ -50,7 +50,7 @@
*
*********************************************************************** */
/*
- * Copyright (c) 2007, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2007, 2011, Oracle and/or its affiliates. All rights reserved.
* Use is subject to license terms.
*/
diff --git a/jdk/src/share/native/sun/security/ec/impl/ecp.h b/jdk/src/share/native/sun/security/ec/impl/ecp.h
index 97220f3d39f..989c4359b2c 100644
--- a/jdk/src/share/native/sun/security/ec/impl/ecp.h
+++ b/jdk/src/share/native/sun/security/ec/impl/ecp.h
@@ -50,7 +50,7 @@
*
*********************************************************************** */
/*
- * Copyright (c) 2007, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2007, 2011, Oracle and/or its affiliates. All rights reserved.
* Use is subject to license terms.
*/
diff --git a/jdk/src/share/native/sun/security/ec/impl/ecp_192.c b/jdk/src/share/native/sun/security/ec/impl/ecp_192.c
index dcdd9dbe618..c58474dd60b 100644
--- a/jdk/src/share/native/sun/security/ec/impl/ecp_192.c
+++ b/jdk/src/share/native/sun/security/ec/impl/ecp_192.c
@@ -50,7 +50,7 @@
*
*********************************************************************** */
/*
- * Copyright (c) 2007, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2007, 2011, Oracle and/or its affiliates. All rights reserved.
* Use is subject to license terms.
*/
diff --git a/jdk/src/share/native/sun/security/ec/impl/ecp_224.c b/jdk/src/share/native/sun/security/ec/impl/ecp_224.c
index 96d775f9e87..573a9f43b59 100644
--- a/jdk/src/share/native/sun/security/ec/impl/ecp_224.c
+++ b/jdk/src/share/native/sun/security/ec/impl/ecp_224.c
@@ -50,7 +50,7 @@
*
*********************************************************************** */
/*
- * Copyright (c) 2007, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2007, 2011, Oracle and/or its affiliates. All rights reserved.
* Use is subject to license terms.
*/
diff --git a/jdk/src/share/native/sun/security/ec/impl/ecp_256.c b/jdk/src/share/native/sun/security/ec/impl/ecp_256.c
index ef829085663..2ce46e5b935 100644
--- a/jdk/src/share/native/sun/security/ec/impl/ecp_256.c
+++ b/jdk/src/share/native/sun/security/ec/impl/ecp_256.c
@@ -50,7 +50,7 @@
*
*********************************************************************** */
/*
- * Copyright (c) 2007, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2007, 2011, Oracle and/or its affiliates. All rights reserved.
* Use is subject to license terms.
*/
diff --git a/jdk/src/share/native/sun/security/ec/impl/ecp_384.c b/jdk/src/share/native/sun/security/ec/impl/ecp_384.c
index 263fecb888f..74f8e342c00 100644
--- a/jdk/src/share/native/sun/security/ec/impl/ecp_384.c
+++ b/jdk/src/share/native/sun/security/ec/impl/ecp_384.c
@@ -50,7 +50,7 @@
*
*********************************************************************** */
/*
- * Copyright (c) 2007, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2007, 2011, Oracle and/or its affiliates. All rights reserved.
* Use is subject to license terms.
*/
diff --git a/jdk/src/share/native/sun/security/ec/impl/ecp_521.c b/jdk/src/share/native/sun/security/ec/impl/ecp_521.c
index 239b1289372..62c0bc41d58 100644
--- a/jdk/src/share/native/sun/security/ec/impl/ecp_521.c
+++ b/jdk/src/share/native/sun/security/ec/impl/ecp_521.c
@@ -50,7 +50,7 @@
*
*********************************************************************** */
/*
- * Copyright (c) 2007, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2007, 2011, Oracle and/or its affiliates. All rights reserved.
* Use is subject to license terms.
*/
diff --git a/jdk/src/share/native/sun/security/ec/impl/ecp_aff.c b/jdk/src/share/native/sun/security/ec/impl/ecp_aff.c
index a3a97f62570..4f9b0d1daeb 100644
--- a/jdk/src/share/native/sun/security/ec/impl/ecp_aff.c
+++ b/jdk/src/share/native/sun/security/ec/impl/ecp_aff.c
@@ -55,7 +55,7 @@
*
*********************************************************************** */
/*
- * Copyright (c) 2007, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2007, 2011, Oracle and/or its affiliates. All rights reserved.
* Use is subject to license terms.
*/
diff --git a/jdk/src/share/native/sun/security/ec/impl/ecp_jac.c b/jdk/src/share/native/sun/security/ec/impl/ecp_jac.c
index 8b35dae8e99..779b82f75cb 100644
--- a/jdk/src/share/native/sun/security/ec/impl/ecp_jac.c
+++ b/jdk/src/share/native/sun/security/ec/impl/ecp_jac.c
@@ -55,7 +55,7 @@
*
*********************************************************************** */
/*
- * Copyright (c) 2007, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2007, 2011, Oracle and/or its affiliates. All rights reserved.
* Use is subject to license terms.
*/
diff --git a/jdk/src/share/native/sun/security/ec/impl/ecp_jm.c b/jdk/src/share/native/sun/security/ec/impl/ecp_jm.c
index b85615be7ad..2f1c42aa001 100644
--- a/jdk/src/share/native/sun/security/ec/impl/ecp_jm.c
+++ b/jdk/src/share/native/sun/security/ec/impl/ecp_jm.c
@@ -50,7 +50,7 @@
*
*********************************************************************** */
/*
- * Copyright (c) 2007, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2007, 2011, Oracle and/or its affiliates. All rights reserved.
* Use is subject to license terms.
*/
diff --git a/jdk/src/share/native/sun/security/ec/impl/ecp_mont.c b/jdk/src/share/native/sun/security/ec/impl/ecp_mont.c
index 6519eda7bc0..9a9ce1e4cb2 100644
--- a/jdk/src/share/native/sun/security/ec/impl/ecp_mont.c
+++ b/jdk/src/share/native/sun/security/ec/impl/ecp_mont.c
@@ -50,7 +50,7 @@
*
*********************************************************************** */
/*
- * Copyright (c) 2007, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2007, 2011, Oracle and/or its affiliates. All rights reserved.
* Use is subject to license terms.
*/
diff --git a/jdk/src/share/native/sun/security/ec/impl/logtab.h b/jdk/src/share/native/sun/security/ec/impl/logtab.h
index f4b40008b4a..a6314ff76e1 100644
--- a/jdk/src/share/native/sun/security/ec/impl/logtab.h
+++ b/jdk/src/share/native/sun/security/ec/impl/logtab.h
@@ -50,7 +50,7 @@
*
*********************************************************************** */
/*
- * Copyright (c) 2007, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2007, 2011, Oracle and/or its affiliates. All rights reserved.
* Use is subject to license terms.
*/
diff --git a/jdk/src/share/native/sun/security/ec/impl/mp_gf2m-priv.h b/jdk/src/share/native/sun/security/ec/impl/mp_gf2m-priv.h
index 889bfd1bed0..d4f81cee045 100644
--- a/jdk/src/share/native/sun/security/ec/impl/mp_gf2m-priv.h
+++ b/jdk/src/share/native/sun/security/ec/impl/mp_gf2m-priv.h
@@ -51,7 +51,7 @@
*
*********************************************************************** */
/*
- * Copyright (c) 2007, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2007, 2011, Oracle and/or its affiliates. All rights reserved.
* Use is subject to license terms.
*/
diff --git a/jdk/src/share/native/sun/security/ec/impl/mp_gf2m.c b/jdk/src/share/native/sun/security/ec/impl/mp_gf2m.c
index 2c021c88a24..06e557af127 100644
--- a/jdk/src/share/native/sun/security/ec/impl/mp_gf2m.c
+++ b/jdk/src/share/native/sun/security/ec/impl/mp_gf2m.c
@@ -51,7 +51,7 @@
*
*********************************************************************** */
/*
- * Copyright (c) 2007, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2007, 2011, Oracle and/or its affiliates. All rights reserved.
* Use is subject to license terms.
*/
diff --git a/jdk/src/share/native/sun/security/ec/impl/mp_gf2m.h b/jdk/src/share/native/sun/security/ec/impl/mp_gf2m.h
index f689ba35358..90c3bffdf0b 100644
--- a/jdk/src/share/native/sun/security/ec/impl/mp_gf2m.h
+++ b/jdk/src/share/native/sun/security/ec/impl/mp_gf2m.h
@@ -51,7 +51,7 @@
*
*********************************************************************** */
/*
- * Copyright (c) 2007, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2007, 2011, Oracle and/or its affiliates. All rights reserved.
* Use is subject to license terms.
*/
diff --git a/jdk/src/share/native/sun/security/ec/impl/mpi-config.h b/jdk/src/share/native/sun/security/ec/impl/mpi-config.h
index 4c2b22b9f12..1e4216c3baa 100644
--- a/jdk/src/share/native/sun/security/ec/impl/mpi-config.h
+++ b/jdk/src/share/native/sun/security/ec/impl/mpi-config.h
@@ -50,7 +50,7 @@
*
*********************************************************************** */
/*
- * Copyright (c) 2007, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2007, 2011, Oracle and/or its affiliates. All rights reserved.
* Use is subject to license terms.
*/
diff --git a/jdk/src/share/native/sun/security/ec/impl/mpi-priv.h b/jdk/src/share/native/sun/security/ec/impl/mpi-priv.h
index 9a80f23d02f..2cec62c254a 100644
--- a/jdk/src/share/native/sun/security/ec/impl/mpi-priv.h
+++ b/jdk/src/share/native/sun/security/ec/impl/mpi-priv.h
@@ -56,7 +56,7 @@
*
*********************************************************************** */
/*
- * Copyright (c) 2007, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2007, 2011, Oracle and/or its affiliates. All rights reserved.
* Use is subject to license terms.
*/
diff --git a/jdk/src/share/native/sun/security/ec/impl/mpi.c b/jdk/src/share/native/sun/security/ec/impl/mpi.c
index a495b998598..c33bc19160a 100644
--- a/jdk/src/share/native/sun/security/ec/impl/mpi.c
+++ b/jdk/src/share/native/sun/security/ec/impl/mpi.c
@@ -54,7 +54,7 @@
*
*********************************************************************** */
/*
- * Copyright (c) 2007, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2007, 2011, Oracle and/or its affiliates. All rights reserved.
* Use is subject to license terms.
*/
diff --git a/jdk/src/share/native/sun/security/ec/impl/mpi.h b/jdk/src/share/native/sun/security/ec/impl/mpi.h
index d80657e5657..87ba0856192 100644
--- a/jdk/src/share/native/sun/security/ec/impl/mpi.h
+++ b/jdk/src/share/native/sun/security/ec/impl/mpi.h
@@ -53,7 +53,7 @@
*
*********************************************************************** */
/*
- * Copyright (c) 2007, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2007, 2011, Oracle and/or its affiliates. All rights reserved.
* Use is subject to license terms.
*/
diff --git a/jdk/src/share/native/sun/security/ec/impl/mplogic.c b/jdk/src/share/native/sun/security/ec/impl/mplogic.c
index 8de8306ea9e..30b5b42c27d 100644
--- a/jdk/src/share/native/sun/security/ec/impl/mplogic.c
+++ b/jdk/src/share/native/sun/security/ec/impl/mplogic.c
@@ -52,7 +52,7 @@
*
*********************************************************************** */
/*
- * Copyright (c) 2007, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2007, 2011, Oracle and/or its affiliates. All rights reserved.
* Use is subject to license terms.
*/
diff --git a/jdk/src/share/native/sun/security/ec/impl/mplogic.h b/jdk/src/share/native/sun/security/ec/impl/mplogic.h
index a2f7714bffb..abc94c0c1a9 100644
--- a/jdk/src/share/native/sun/security/ec/impl/mplogic.h
+++ b/jdk/src/share/native/sun/security/ec/impl/mplogic.h
@@ -52,7 +52,7 @@
*
*********************************************************************** */
/*
- * Copyright (c) 2007, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2007, 2011, Oracle and/or its affiliates. All rights reserved.
* Use is subject to license terms.
*/
diff --git a/jdk/src/share/native/sun/security/ec/impl/mpmontg.c b/jdk/src/share/native/sun/security/ec/impl/mpmontg.c
index c1762847a5e..04dfe9b62d7 100644
--- a/jdk/src/share/native/sun/security/ec/impl/mpmontg.c
+++ b/jdk/src/share/native/sun/security/ec/impl/mpmontg.c
@@ -52,7 +52,7 @@
*
*********************************************************************** */
/*
- * Copyright (c) 2007, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2007, 2011, Oracle and/or its affiliates. All rights reserved.
* Use is subject to license terms.
*/
diff --git a/jdk/src/share/native/sun/security/ec/impl/mpprime.h b/jdk/src/share/native/sun/security/ec/impl/mpprime.h
index b9012af4b31..a741d418d63 100644
--- a/jdk/src/share/native/sun/security/ec/impl/mpprime.h
+++ b/jdk/src/share/native/sun/security/ec/impl/mpprime.h
@@ -53,7 +53,7 @@
*
*********************************************************************** */
/*
- * Copyright (c) 2007, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2007, 2011, Oracle and/or its affiliates. All rights reserved.
* Use is subject to license terms.
*/
diff --git a/jdk/src/share/native/sun/security/ec/impl/oid.c b/jdk/src/share/native/sun/security/ec/impl/oid.c
index e5a76992bf9..252491b3331 100644
--- a/jdk/src/share/native/sun/security/ec/impl/oid.c
+++ b/jdk/src/share/native/sun/security/ec/impl/oid.c
@@ -50,7 +50,7 @@
*
*********************************************************************** */
/*
- * Copyright (c) 2007, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2007, 2011, Oracle and/or its affiliates. All rights reserved.
* Use is subject to license terms.
*/
diff --git a/jdk/src/share/native/sun/security/ec/impl/secitem.c b/jdk/src/share/native/sun/security/ec/impl/secitem.c
index 6cfa5dea4b2..3db3027afa2 100644
--- a/jdk/src/share/native/sun/security/ec/impl/secitem.c
+++ b/jdk/src/share/native/sun/security/ec/impl/secitem.c
@@ -49,7 +49,7 @@
*
*********************************************************************** */
/*
- * Copyright (c) 2007, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2007, 2011, Oracle and/or its affiliates. All rights reserved.
* Use is subject to license terms.
*/
diff --git a/jdk/src/share/native/sun/security/ec/impl/secoidt.h b/jdk/src/share/native/sun/security/ec/impl/secoidt.h
index ea5da257ad7..5ad9a67415a 100644
--- a/jdk/src/share/native/sun/security/ec/impl/secoidt.h
+++ b/jdk/src/share/native/sun/security/ec/impl/secoidt.h
@@ -50,7 +50,7 @@
*
*********************************************************************** */
/*
- * Copyright (c) 2007, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2007, 2011, Oracle and/or its affiliates. All rights reserved.
* Use is subject to license terms.
*/
diff --git a/jdk/src/share/sample/nio/file/AclEdit.java b/jdk/src/share/sample/nio/file/AclEdit.java
index 0910e888a70..02b6ae78aa3 100644
--- a/jdk/src/share/sample/nio/file/AclEdit.java
+++ b/jdk/src/share/sample/nio/file/AclEdit.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2008, 2009, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2008, 2011, Oracle and/or its affiliates. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
diff --git a/jdk/src/share/sample/nio/file/Chmod.java b/jdk/src/share/sample/nio/file/Chmod.java
index 7c4d50e93ef..321f4552551 100644
--- a/jdk/src/share/sample/nio/file/Chmod.java
+++ b/jdk/src/share/sample/nio/file/Chmod.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2008, 2011, Oracle and/or its affiliates. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
diff --git a/jdk/src/share/sample/nio/file/Copy.java b/jdk/src/share/sample/nio/file/Copy.java
index 38062c4b875..7cb684183aa 100644
--- a/jdk/src/share/sample/nio/file/Copy.java
+++ b/jdk/src/share/sample/nio/file/Copy.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2008, 2011, Oracle and/or its affiliates. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
diff --git a/jdk/src/share/sample/nio/file/DiskUsage.java b/jdk/src/share/sample/nio/file/DiskUsage.java
index fb2a164bf32..8d6bbb674d1 100644
--- a/jdk/src/share/sample/nio/file/DiskUsage.java
+++ b/jdk/src/share/sample/nio/file/DiskUsage.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2008, 2009, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2008, 2011, Oracle and/or its affiliates. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
diff --git a/jdk/src/share/sample/nio/file/FileType.java b/jdk/src/share/sample/nio/file/FileType.java
index 71451614b07..dc754b5f895 100644
--- a/jdk/src/share/sample/nio/file/FileType.java
+++ b/jdk/src/share/sample/nio/file/FileType.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2008, 2009, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2008, 2011, Oracle and/or its affiliates. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
diff --git a/jdk/src/share/sample/nio/file/WatchDir.java b/jdk/src/share/sample/nio/file/WatchDir.java
index 33c15dd0c04..9b9d2ece052 100644
--- a/jdk/src/share/sample/nio/file/WatchDir.java
+++ b/jdk/src/share/sample/nio/file/WatchDir.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2008, 2011, Oracle and/or its affiliates. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -33,8 +33,7 @@ import java.nio.file.*;
import static java.nio.file.StandardWatchEventKind.*;
import static java.nio.file.LinkOption.*;
import java.nio.file.attribute.*;
-import java.io.*;
-import java.util.*;
+import java.io.IOException;
/**
* Example to watch a directory (or tree) for changes to files.
@@ -43,9 +42,9 @@ import java.util.*;
public class WatchDir {
private final WatchService watcher;
- private final Map keys;
private final boolean recursive;
private boolean trace = false;
+ private int count;
@SuppressWarnings("unchecked")
static WatchEvent cast(WatchEvent> event) {
@@ -57,17 +56,9 @@ public class WatchDir {
*/
private void register(Path dir) throws IOException {
WatchKey key = dir.register(watcher, ENTRY_CREATE, ENTRY_DELETE, ENTRY_MODIFY);
- if (trace) {
- Path prev = keys.get(key);
- if (prev == null) {
- System.out.format("register: %s\n", dir);
- } else {
- if (!dir.equals(prev)) {
- System.out.format("update: %s -> %s\n", prev, dir);
- }
- }
- }
- keys.put(key, dir);
+ count++;
+ if (trace)
+ System.out.format("register: %s\n", dir);
}
/**
@@ -92,7 +83,6 @@ public class WatchDir {
*/
WatchDir(Path dir, boolean recursive) throws IOException {
this.watcher = FileSystems.getDefault().newWatchService();
- this.keys = new HashMap();
this.recursive = recursive;
if (recursive) {
@@ -121,12 +111,6 @@ public class WatchDir {
return;
}
- Path dir = keys.get(key);
- if (dir == null) {
- System.err.println("WatchKey not recognized!!");
- continue;
- }
-
for (WatchEvent> event: key.pollEvents()) {
WatchEvent.Kind kind = event.kind();
@@ -138,7 +122,7 @@ public class WatchDir {
// Context for directory entry event is the file name of entry
WatchEvent ev = cast(event);
Path name = ev.context();
- Path child = dir.resolve(name);
+ Path child = ((Path)key.watchable()).resolve(name);
// print out event
System.out.format("%s: %s\n", event.kind().name(), child);
@@ -156,15 +140,13 @@ public class WatchDir {
}
}
- // reset key and remove from set if directory no longer accessible
+ // reset key
boolean valid = key.reset();
if (!valid) {
- keys.remove(key);
-
- // all directories are inaccessible
- if (keys.isEmpty()) {
+ // directory no longer accessible
+ count--;
+ if (count == 0)
break;
- }
}
}
}
diff --git a/jdk/src/share/sample/nio/file/Xdd.java b/jdk/src/share/sample/nio/file/Xdd.java
index 7551121a924..f07802f264a 100644
--- a/jdk/src/share/sample/nio/file/Xdd.java
+++ b/jdk/src/share/sample/nio/file/Xdd.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2008, 2009, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2008, 2011, Oracle and/or its affiliates. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
diff --git a/jdk/src/solaris/bin/arm/jvm.cfg b/jdk/src/solaris/bin/arm/jvm.cfg
new file mode 100644
index 00000000000..0262ebda2e3
--- /dev/null
+++ b/jdk/src/solaris/bin/arm/jvm.cfg
@@ -0,0 +1,38 @@
+# Copyright (c) 2011, 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.
+#
+# List of JVMs that can be used as an option to java, javac, etc.
+# Order is important -- first in this list is the default JVM.
+# NOTE that this both this file and its format are UNSUPPORTED and
+# WILL GO AWAY in a future release.
+#
+# You may also select a JVM in an arbitrary location with the
+# "-XXaltjvm=" option, but that too is unsupported
+# and may not be available in a future release.
+#
+-client KNOWN
+-server KNOWN
+-hotspot ERROR
+-classic WARN
+-native ERROR
+-green ERROR
diff --git a/jdk/src/solaris/bin/ergo.c b/jdk/src/solaris/bin/ergo.c
index e9e863e9ce5..2047087e7c5 100644
--- a/jdk/src/solaris/bin/ergo.c
+++ b/jdk/src/solaris/bin/ergo.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1998, 2007, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 2011, 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
@@ -67,6 +67,35 @@ ServerClassMachine(void) {
}
}
+#ifdef USE_GENERIC_ERGO
+/* Ask the OS how many processors there are. */
+static unsigned long
+physical_processors(void) {
+ const unsigned long sys_processors = sysconf(_SC_NPROCESSORS_CONF);
+ JLI_TraceLauncher("sysconf(_SC_NPROCESSORS_CONF): %lu\n", sys_processors);
+ return sys_processors;
+}
+
+jboolean
+ServerClassMachineImpl(void) {
+ jboolean result = JNI_FALSE;
+ /* How big is a server class machine? */
+ const unsigned long server_processors = 2UL;
+ const uint64_t server_memory = 2UL * GB;
+ const uint64_t actual_memory = physical_memory();
+
+ /* Is this a server class machine? */
+ if (actual_memory >= server_memory) {
+ const unsigned long actual_processors = physical_processors();
+ if (actual_processors >= server_processors) {
+ result = JNI_TRUE;
+ }
+ }
+ JLI_TraceLauncher("unix_" LIBARCHNAME "_ServerClassMachine: %s\n",
+ (result == JNI_TRUE ? "JNI_TRUE" : "JNI_FALSE"));
+ return result;
+}
+#endif
/* Compute physical memory by asking the OS */
uint64_t
diff --git a/jdk/src/solaris/bin/ergo_sparc.c b/jdk/src/solaris/bin/ergo_sparc.c
deleted file mode 100644
index 9261a423de6..00000000000
--- a/jdk/src/solaris/bin/ergo_sparc.c
+++ /dev/null
@@ -1,58 +0,0 @@
-/*
- * Copyright (c) 1998, 2007, 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.
- */
-#include "ergo.h"
-
-
-/* Methods for solaris-sparc and linux-sparc: these are easy. */
-
-/* Ask the OS how many processors there are. */
-static unsigned long
-physical_processors(void) {
- const unsigned long sys_processors = sysconf(_SC_NPROCESSORS_CONF);
-
- JLI_TraceLauncher("sysconf(_SC_NPROCESSORS_CONF): %lu\n", sys_processors);
- return sys_processors;
-}
-
-/* The sparc version of the "server-class" predicate. */
-jboolean
-ServerClassMachineImpl(void) {
- jboolean result = JNI_FALSE;
- /* How big is a server class machine? */
- const unsigned long server_processors = 2UL;
- const uint64_t server_memory = 2UL * GB;
- const uint64_t actual_memory = physical_memory();
-
- /* Is this a server class machine? */
- if (actual_memory >= server_memory) {
- const unsigned long actual_processors = physical_processors();
- if (actual_processors >= server_processors) {
- result = JNI_TRUE;
- }
- }
- JLI_TraceLauncher("unix_" LIBARCHNAME "_ServerClassMachine: %s\n",
- (result == JNI_TRUE ? "JNI_TRUE" : "JNI_FALSE"));
- return result;
-}
diff --git a/jdk/src/solaris/bin/ergo_zero.c b/jdk/src/solaris/bin/ergo_zero.c
deleted file mode 100644
index 9261a423de6..00000000000
--- a/jdk/src/solaris/bin/ergo_zero.c
+++ /dev/null
@@ -1,58 +0,0 @@
-/*
- * Copyright (c) 1998, 2007, 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.
- */
-#include "ergo.h"
-
-
-/* Methods for solaris-sparc and linux-sparc: these are easy. */
-
-/* Ask the OS how many processors there are. */
-static unsigned long
-physical_processors(void) {
- const unsigned long sys_processors = sysconf(_SC_NPROCESSORS_CONF);
-
- JLI_TraceLauncher("sysconf(_SC_NPROCESSORS_CONF): %lu\n", sys_processors);
- return sys_processors;
-}
-
-/* The sparc version of the "server-class" predicate. */
-jboolean
-ServerClassMachineImpl(void) {
- jboolean result = JNI_FALSE;
- /* How big is a server class machine? */
- const unsigned long server_processors = 2UL;
- const uint64_t server_memory = 2UL * GB;
- const uint64_t actual_memory = physical_memory();
-
- /* Is this a server class machine? */
- if (actual_memory >= server_memory) {
- const unsigned long actual_processors = physical_processors();
- if (actual_processors >= server_processors) {
- result = JNI_TRUE;
- }
- }
- JLI_TraceLauncher("unix_" LIBARCHNAME "_ServerClassMachine: %s\n",
- (result == JNI_TRUE ? "JNI_TRUE" : "JNI_FALSE"));
- return result;
-}
diff --git a/jdk/src/solaris/bin/ppc/jvm.cfg b/jdk/src/solaris/bin/ppc/jvm.cfg
new file mode 100644
index 00000000000..0262ebda2e3
--- /dev/null
+++ b/jdk/src/solaris/bin/ppc/jvm.cfg
@@ -0,0 +1,38 @@
+# Copyright (c) 2011, 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.
+#
+# List of JVMs that can be used as an option to java, javac, etc.
+# Order is important -- first in this list is the default JVM.
+# NOTE that this both this file and its format are UNSUPPORTED and
+# WILL GO AWAY in a future release.
+#
+# You may also select a JVM in an arbitrary location with the
+# "-XXaltjvm=" option, but that too is unsupported
+# and may not be available in a future release.
+#
+-client KNOWN
+-server KNOWN
+-hotspot ERROR
+-classic WARN
+-native ERROR
+-green ERROR
diff --git a/jdk/src/solaris/classes/java/lang/ProcessEnvironment.java b/jdk/src/solaris/classes/java/lang/ProcessEnvironment.java
index a08a291c937..bb60c71b604 100644
--- a/jdk/src/solaris/classes/java/lang/ProcessEnvironment.java
+++ b/jdk/src/solaris/classes/java/lang/ProcessEnvironment.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2003, 2004, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 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
diff --git a/jdk/src/solaris/classes/java/util/prefs/FileSystemPreferences.java b/jdk/src/solaris/classes/java/util/prefs/FileSystemPreferences.java
index 53a19b5f5bd..166fcd97d69 100644
--- a/jdk/src/solaris/classes/java/util/prefs/FileSystemPreferences.java
+++ b/jdk/src/solaris/classes/java/util/prefs/FileSystemPreferences.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2000, 2008, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2011, 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
diff --git a/jdk/src/solaris/classes/sun/awt/X11/GtkFileDialogPeer.java b/jdk/src/solaris/classes/sun/awt/X11/GtkFileDialogPeer.java
index e41bbb65dfb..02be75b6ca5 100644
--- a/jdk/src/solaris/classes/sun/awt/X11/GtkFileDialogPeer.java
+++ b/jdk/src/solaris/classes/sun/awt/X11/GtkFileDialogPeer.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2010, 2011, 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
diff --git a/jdk/src/solaris/classes/sun/awt/X11/XComponentPeer.java b/jdk/src/solaris/classes/sun/awt/X11/XComponentPeer.java
index 6e425513c1c..37126c71654 100644
--- a/jdk/src/solaris/classes/sun/awt/X11/XComponentPeer.java
+++ b/jdk/src/solaris/classes/sun/awt/X11/XComponentPeer.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2002, 2008, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2002, 2011, 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
diff --git a/jdk/src/solaris/classes/sun/awt/X11/XDesktopPeer.java b/jdk/src/solaris/classes/sun/awt/X11/XDesktopPeer.java
index 740eabac485..94ba7529a54 100644
--- a/jdk/src/solaris/classes/sun/awt/X11/XDesktopPeer.java
+++ b/jdk/src/solaris/classes/sun/awt/X11/XDesktopPeer.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2005, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2011, 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
diff --git a/jdk/src/solaris/classes/sun/awt/X11/XGlobalCursorManager.java b/jdk/src/solaris/classes/sun/awt/X11/XGlobalCursorManager.java
index c28d9d03e11..a8703cb7877 100644
--- a/jdk/src/solaris/classes/sun/awt/X11/XGlobalCursorManager.java
+++ b/jdk/src/solaris/classes/sun/awt/X11/XGlobalCursorManager.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2003, 2008, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2011, 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
diff --git a/jdk/src/solaris/classes/sun/awt/X11/XRobotPeer.java b/jdk/src/solaris/classes/sun/awt/X11/XRobotPeer.java
index a6acd8eb5f5..1463f283f0b 100644
--- a/jdk/src/solaris/classes/sun/awt/X11/XRobotPeer.java
+++ b/jdk/src/solaris/classes/sun/awt/X11/XRobotPeer.java
@@ -48,7 +48,7 @@ class XRobotPeer implements RobotPeer {
}
public void dispose() {
- // does nothing
+ _dispose();
}
public void mouseMove(int x, int y) {
@@ -88,6 +88,7 @@ class XRobotPeer implements RobotPeer {
}
private static native synchronized void setup(int numberOfButtons, int[] buttonDownMasks);
+ private static native synchronized void _dispose();
private static native synchronized void mouseMoveImpl(X11GraphicsConfig xgc, int x, int y);
private static native synchronized void mousePressImpl(int buttons);
diff --git a/jdk/src/solaris/classes/sun/awt/X11/XSelection.java b/jdk/src/solaris/classes/sun/awt/X11/XSelection.java
index 1ffd1346361..f19ad2ffb67 100644
--- a/jdk/src/solaris/classes/sun/awt/X11/XSelection.java
+++ b/jdk/src/solaris/classes/sun/awt/X11/XSelection.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2003, 2008, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2011, 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
diff --git a/jdk/src/solaris/classes/sun/awt/X11/XTextAreaPeer.java b/jdk/src/solaris/classes/sun/awt/X11/XTextAreaPeer.java
index d9cc3033a3b..3f63391473d 100644
--- a/jdk/src/solaris/classes/sun/awt/X11/XTextAreaPeer.java
+++ b/jdk/src/solaris/classes/sun/awt/X11/XTextAreaPeer.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2011, 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
diff --git a/jdk/src/solaris/classes/sun/awt/X11/XToolkit.java b/jdk/src/solaris/classes/sun/awt/X11/XToolkit.java
index ad92d2e9c00..641d82180a9 100644
--- a/jdk/src/solaris/classes/sun/awt/X11/XToolkit.java
+++ b/jdk/src/solaris/classes/sun/awt/X11/XToolkit.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2002, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2002, 2011, 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
@@ -135,6 +135,12 @@ public final class XToolkit extends UNIXToolkit implements Runnable {
noisyAwtHandler = AccessController.doPrivileged(new GetBooleanAction("sun.awt.noisyerrorhandler"));
}
+ /*
+ * Return (potentially) platform specific display timeout for the
+ * tray icon
+ */
+ static native long getTrayIconDisplayTimeout();
+
//---- ERROR HANDLER CODE ----//
/*
@@ -1222,8 +1228,8 @@ public final class XToolkit extends UNIXToolkit implements Runnable {
public PrintJob getPrintJob(final Frame frame, final String doctitle,
final Properties props) {
- if (GraphicsEnvironment.isHeadless()) {
- throw new IllegalArgumentException();
+ if (frame == null) {
+ throw new NullPointerException("frame must not be null");
}
PrintJob2D printJob = new PrintJob2D(frame, doctitle, props);
@@ -1236,11 +1242,10 @@ public final class XToolkit extends UNIXToolkit implements Runnable {
public PrintJob getPrintJob(final Frame frame, final String doctitle,
final JobAttributes jobAttributes,
- final PageAttributes pageAttributes) {
-
-
- if (GraphicsEnvironment.isHeadless()) {
- throw new IllegalArgumentException();
+ final PageAttributes pageAttributes)
+ {
+ if (frame == null) {
+ throw new NullPointerException("frame must not be null");
}
PrintJob2D printJob = new PrintJob2D(frame, doctitle,
diff --git a/jdk/src/solaris/classes/sun/awt/X11/XTrayIconPeer.java b/jdk/src/solaris/classes/sun/awt/X11/XTrayIconPeer.java
index ff7b78e2c13..7bc452c968e 100644
--- a/jdk/src/solaris/classes/sun/awt/X11/XTrayIconPeer.java
+++ b/jdk/src/solaris/classes/sun/awt/X11/XTrayIconPeer.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2011, 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
@@ -230,7 +230,7 @@ public class XTrayIconPeer implements TrayIconPeer,
// Wait till the EmbeddedFrame is reparented
long start = System.currentTimeMillis();
- final long PERIOD = 2000L;
+ final long PERIOD = XToolkit.getTrayIconDisplayTimeout();
XToolkit.awtLock();
try {
while (!isTrayIconDisplayed) {
diff --git a/jdk/src/solaris/classes/sun/awt/motif/MFontConfiguration.java b/jdk/src/solaris/classes/sun/awt/motif/MFontConfiguration.java
index 4e42db8d557..25e676eda53 100644
--- a/jdk/src/solaris/classes/sun/awt/motif/MFontConfiguration.java
+++ b/jdk/src/solaris/classes/sun/awt/motif/MFontConfiguration.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2000, 2007, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2011, 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
diff --git a/jdk/src/solaris/classes/sun/awt/motif/MToolkit.java b/jdk/src/solaris/classes/sun/awt/motif/MToolkit.java
index a4148a7b047..44108be3cf1 100644
--- a/jdk/src/solaris/classes/sun/awt/motif/MToolkit.java
+++ b/jdk/src/solaris/classes/sun/awt/motif/MToolkit.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1995, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1995, 2011, 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
diff --git a/jdk/src/solaris/classes/sun/font/FcFontConfiguration.java b/jdk/src/solaris/classes/sun/font/FcFontConfiguration.java
index 3ce3ce9e264..ce2c935ba71 100644
--- a/jdk/src/solaris/classes/sun/font/FcFontConfiguration.java
+++ b/jdk/src/solaris/classes/sun/font/FcFontConfiguration.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2008, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2008, 2011, 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
diff --git a/jdk/src/solaris/classes/sun/font/FontConfigManager.java b/jdk/src/solaris/classes/sun/font/FontConfigManager.java
index 5832683c04e..41c1a5d8cbb 100644
--- a/jdk/src/solaris/classes/sun/font/FontConfigManager.java
+++ b/jdk/src/solaris/classes/sun/font/FontConfigManager.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2008, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2008, 2011, 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
diff --git a/jdk/src/solaris/classes/sun/font/XRGlyphCache.java b/jdk/src/solaris/classes/sun/font/XRGlyphCache.java
index 7dbb23a774f..74ac140a787 100644
--- a/jdk/src/solaris/classes/sun/font/XRGlyphCache.java
+++ b/jdk/src/solaris/classes/sun/font/XRGlyphCache.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2010, 2011, 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
diff --git a/jdk/src/solaris/classes/sun/java2d/xr/XRPMBlitLoops.java b/jdk/src/solaris/classes/sun/java2d/xr/XRPMBlitLoops.java
index 7b5d37d95d4..aaa48af2e16 100644
--- a/jdk/src/solaris/classes/sun/java2d/xr/XRPMBlitLoops.java
+++ b/jdk/src/solaris/classes/sun/java2d/xr/XRPMBlitLoops.java
@@ -143,7 +143,8 @@ public class XRPMBlitLoops {
Blit swToSurfaceBlit = Blit.getFromCache(src.getSurfaceType(), CompositeType.SrcNoEa, vImgSurfaceType);
XRSurfaceData vImgSurface = (XRSurfaceData) vImg.getDestSurface();
- swToSurfaceBlit.Blit(src, vImgSurface, null, null, sx, sy, 0, 0, w, h);
+ swToSurfaceBlit.Blit(src, vImgSurface, AlphaComposite.Src, null,
+ sx, sy, 0, 0, w, h);
return vImgSurface;
}
diff --git a/jdk/src/solaris/classes/sun/java2d/xr/XRSurfaceData.java b/jdk/src/solaris/classes/sun/java2d/xr/XRSurfaceData.java
index d8790b2cb59..fa0598774df 100644
--- a/jdk/src/solaris/classes/sun/java2d/xr/XRSurfaceData.java
+++ b/jdk/src/solaris/classes/sun/java2d/xr/XRSurfaceData.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2010, 2011, 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
diff --git a/jdk/src/solaris/classes/sun/net/www/protocol/http/ntlm/NTLMAuthentication.java b/jdk/src/solaris/classes/sun/net/www/protocol/http/ntlm/NTLMAuthentication.java
index 5ad8b8d54d8..0d898336e24 100644
--- a/jdk/src/solaris/classes/sun/net/www/protocol/http/ntlm/NTLMAuthentication.java
+++ b/jdk/src/solaris/classes/sun/net/www/protocol/http/ntlm/NTLMAuthentication.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2011, 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
@@ -68,6 +68,9 @@ import sun.net.www.protocol.http.HttpURLConnection;
public class NTLMAuthentication extends AuthenticationInfo {
private static final long serialVersionUID = 170L;
+ private static final NTLMAuthenticationCallback NTLMAuthCallback =
+ NTLMAuthenticationCallback.getNTLMAuthenticationCallback();
+
private String hostname;
private static String defaultDomain; /* Domain to use if not specified by user */
@@ -81,6 +84,14 @@ public class NTLMAuthentication extends AuthenticationInfo {
return false;
}
+ /**
+ * Returns true if the given site is trusted, i.e. we can try
+ * transparent Authentication.
+ */
+ public static boolean isTrustedSite(URL url) {
+ return NTLMAuthCallback.isTrustedSite(url);
+ }
+
private void init0() {
hostname = java.security.AccessController.doPrivileged(
diff --git a/jdk/src/solaris/classes/sun/nio/ch/UnixAsynchronousServerSocketChannelImpl.java b/jdk/src/solaris/classes/sun/nio/ch/UnixAsynchronousServerSocketChannelImpl.java
index ee3731a0c2e..3b431e77b01 100644
--- a/jdk/src/solaris/classes/sun/nio/ch/UnixAsynchronousServerSocketChannelImpl.java
+++ b/jdk/src/solaris/classes/sun/nio/ch/UnixAsynchronousServerSocketChannelImpl.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2008, 2009, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2008, 2011, 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
diff --git a/jdk/src/solaris/classes/sun/nio/ch/UnixAsynchronousSocketChannelImpl.java b/jdk/src/solaris/classes/sun/nio/ch/UnixAsynchronousSocketChannelImpl.java
index 37caeeb9bce..d7fccc9d558 100644
--- a/jdk/src/solaris/classes/sun/nio/ch/UnixAsynchronousSocketChannelImpl.java
+++ b/jdk/src/solaris/classes/sun/nio/ch/UnixAsynchronousSocketChannelImpl.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2008, 2009, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2008, 2011, 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
diff --git a/jdk/src/solaris/classes/sun/nio/fs/GnomeFileTypeDetector.java b/jdk/src/solaris/classes/sun/nio/fs/GnomeFileTypeDetector.java
index 8e06835570f..f92a31488f8 100644
--- a/jdk/src/solaris/classes/sun/nio/fs/GnomeFileTypeDetector.java
+++ b/jdk/src/solaris/classes/sun/nio/fs/GnomeFileTypeDetector.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2008, 2009, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2008, 2011, 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
diff --git a/jdk/src/solaris/classes/sun/nio/fs/LinuxDosFileAttributeView.java b/jdk/src/solaris/classes/sun/nio/fs/LinuxDosFileAttributeView.java
index 4499a08924c..4a97e094243 100644
--- a/jdk/src/solaris/classes/sun/nio/fs/LinuxDosFileAttributeView.java
+++ b/jdk/src/solaris/classes/sun/nio/fs/LinuxDosFileAttributeView.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2008, 2009, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2008, 2011, 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
@@ -27,6 +27,7 @@ package sun.nio.fs;
import java.nio.file.attribute.*;
import java.util.Map;
+import java.util.Set;
import java.io.IOException;
import sun.misc.Unsafe;
@@ -57,6 +58,10 @@ class LinuxDosFileAttributeView
private static final int DOS_XATTR_SYSTEM = 0x04;
private static final int DOS_XATTR_ARCHIVE = 0x20;
+ // the names of the DOS attributes (includes basic)
+ private static final Set dosAttributeNames =
+ Util.newSet(basicAttributeNames, READONLY_NAME, ARCHIVE_NAME, SYSTEM_NAME, HIDDEN_NAME);
+
LinuxDosFileAttributeView(UnixPath file, boolean followLinks) {
super(file, followLinks);
}
@@ -93,9 +98,10 @@ class LinuxDosFileAttributeView
public Map readAttributes(String[] attributes)
throws IOException
{
- AttributesBuilder builder = AttributesBuilder.create(attributes);
+ AttributesBuilder builder =
+ AttributesBuilder.create(dosAttributeNames, attributes);
DosFileAttributes attrs = readAttributes();
- addBasicAttributesToBuilder(attrs, builder);
+ addRequestedBasicAttributes(attrs, builder);
if (builder.match(READONLY_NAME))
builder.add(READONLY_NAME, attrs.isReadOnly());
if (builder.match(ARCHIVE_NAME))
diff --git a/jdk/src/solaris/classes/sun/nio/fs/LinuxFileSystem.java b/jdk/src/solaris/classes/sun/nio/fs/LinuxFileSystem.java
index b8b8c30f936..89be8614a25 100644
--- a/jdk/src/solaris/classes/sun/nio/fs/LinuxFileSystem.java
+++ b/jdk/src/solaris/classes/sun/nio/fs/LinuxFileSystem.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2008, 2009, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2008, 2011, 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
@@ -28,8 +28,6 @@ package sun.nio.fs;
import java.nio.file.*;
import java.io.IOException;
import java.util.*;
-import java.security.AccessController;
-import sun.security.action.GetPropertyAction;
import static sun.nio.fs.LinuxNativeDispatcher.*;
/**
@@ -37,42 +35,16 @@ import static sun.nio.fs.LinuxNativeDispatcher.*;
*/
class LinuxFileSystem extends UnixFileSystem {
- private final boolean hasInotify;
-
LinuxFileSystem(UnixFileSystemProvider provider, String dir) {
super(provider, dir);
-
- // assume X.Y[-Z] format
- String osversion = AccessController
- .doPrivileged(new GetPropertyAction("os.version"));
- String[] vers = Util.split(osversion, '.');
- assert vers.length >= 2;
-
- int majorVersion = Integer.parseInt(vers[0]);
- int minorVersion = Integer.parseInt(vers[1]);
- int microVersion = 0;
- if (vers.length > 2) {
- String[] microVers = Util.split(vers[2], '-');
- microVersion = (microVers.length > 0) ?
- Integer.parseInt(microVers[0]) : 0;
- }
-
- // inotify available since 2.6.13
- this.hasInotify = ((majorVersion > 2) ||
- (majorVersion == 2 && minorVersion > 6) ||
- ((majorVersion == 2) && (minorVersion == 6) && (microVersion >= 13)));
}
@Override
public WatchService newWatchService()
throws IOException
{
- if (hasInotify) {
- return new LinuxWatchService(this);
- } else {
- // use polling implementation on older kernels
- return new PollingWatchService();
- }
+ // assume 2.6.13 or newer
+ return new LinuxWatchService(this);
}
diff --git a/jdk/src/solaris/classes/sun/nio/fs/LinuxFileSystemProvider.java b/jdk/src/solaris/classes/sun/nio/fs/LinuxFileSystemProvider.java
index 6659ff5ede4..1045a7e00c6 100644
--- a/jdk/src/solaris/classes/sun/nio/fs/LinuxFileSystemProvider.java
+++ b/jdk/src/solaris/classes/sun/nio/fs/LinuxFileSystemProvider.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2008, 2009, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2008, 2011, 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
@@ -56,11 +56,11 @@ public class LinuxFileSystemProvider extends UnixFileSystemProvider {
{
if (type == DosFileAttributeView.class) {
return (V) new LinuxDosFileAttributeView(UnixPath.toUnixPath(obj),
- followLinks(options));
+ Util.followLinks(options));
}
if (type == UserDefinedFileAttributeView.class) {
return (V) new LinuxUserDefinedFileAttributeView(UnixPath.toUnixPath(obj),
- followLinks(options));
+ Util.followLinks(options));
}
return super.getFileAttributeView(obj, type, options);
}
@@ -72,11 +72,11 @@ public class LinuxFileSystemProvider extends UnixFileSystemProvider {
{
if (name.equals("dos")) {
return new LinuxDosFileAttributeView(UnixPath.toUnixPath(obj),
- followLinks(options));
+ Util.followLinks(options));
}
if (name.equals("user")) {
return new LinuxUserDefinedFileAttributeView(UnixPath.toUnixPath(obj),
- followLinks(options));
+ Util.followLinks(options));
}
return super.getFileAttributeView(obj, name, options);
}
diff --git a/jdk/src/solaris/classes/sun/nio/fs/LinuxUserDefinedFileAttributeView.java b/jdk/src/solaris/classes/sun/nio/fs/LinuxUserDefinedFileAttributeView.java
index 14bfbcc2e1e..586e4b3fad1 100644
--- a/jdk/src/solaris/classes/sun/nio/fs/LinuxUserDefinedFileAttributeView.java
+++ b/jdk/src/solaris/classes/sun/nio/fs/LinuxUserDefinedFileAttributeView.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2008, 2009, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2008, 2011, 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
diff --git a/jdk/src/solaris/classes/sun/nio/fs/LinuxWatchService.java b/jdk/src/solaris/classes/sun/nio/fs/LinuxWatchService.java
index bca96756325..31d3bf0770f 100644
--- a/jdk/src/solaris/classes/sun/nio/fs/LinuxWatchService.java
+++ b/jdk/src/solaris/classes/sun/nio/fs/LinuxWatchService.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2008, 2009, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2008, 2011, 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
diff --git a/jdk/src/solaris/classes/sun/nio/fs/SolarisAclFileAttributeView.java b/jdk/src/solaris/classes/sun/nio/fs/SolarisAclFileAttributeView.java
index 5fa71242b81..b27f937b8d7 100644
--- a/jdk/src/solaris/classes/sun/nio/fs/SolarisAclFileAttributeView.java
+++ b/jdk/src/solaris/classes/sun/nio/fs/SolarisAclFileAttributeView.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2008, 2009, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2008, 2011, 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
diff --git a/jdk/src/solaris/classes/sun/nio/fs/SolarisFileSystem.java b/jdk/src/solaris/classes/sun/nio/fs/SolarisFileSystem.java
index 516d983c259..9aa9e533b8a 100644
--- a/jdk/src/solaris/classes/sun/nio/fs/SolarisFileSystem.java
+++ b/jdk/src/solaris/classes/sun/nio/fs/SolarisFileSystem.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2008, 2009, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2008, 2011, 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
diff --git a/jdk/src/solaris/classes/sun/nio/fs/SolarisFileSystemProvider.java b/jdk/src/solaris/classes/sun/nio/fs/SolarisFileSystemProvider.java
index 98c3ae8699c..5564a26235c 100644
--- a/jdk/src/solaris/classes/sun/nio/fs/SolarisFileSystemProvider.java
+++ b/jdk/src/solaris/classes/sun/nio/fs/SolarisFileSystemProvider.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2008, 2009, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2008, 2011, 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
@@ -57,11 +57,11 @@ public class SolarisFileSystemProvider extends UnixFileSystemProvider {
{
if (type == AclFileAttributeView.class) {
return (V) new SolarisAclFileAttributeView(UnixPath.toUnixPath(obj),
- followLinks(options));
+ Util.followLinks(options));
}
if (type == UserDefinedFileAttributeView.class) {
return(V) new SolarisUserDefinedFileAttributeView(UnixPath.toUnixPath(obj),
- followLinks(options));
+ Util.followLinks(options));
}
return super.getFileAttributeView(obj, type, options);
}
@@ -73,10 +73,10 @@ public class SolarisFileSystemProvider extends UnixFileSystemProvider {
{
if (name.equals("acl"))
return new SolarisAclFileAttributeView(UnixPath.toUnixPath(obj),
- followLinks(options));
+ Util.followLinks(options));
if (name.equals("user"))
return new SolarisUserDefinedFileAttributeView(UnixPath.toUnixPath(obj),
- followLinks(options));
+ Util.followLinks(options));
return super.getFileAttributeView(obj, name, options);
}
}
diff --git a/jdk/src/solaris/classes/sun/nio/fs/SolarisUserDefinedFileAttributeView.java b/jdk/src/solaris/classes/sun/nio/fs/SolarisUserDefinedFileAttributeView.java
index 6148f4109f2..c48ecef63b0 100644
--- a/jdk/src/solaris/classes/sun/nio/fs/SolarisUserDefinedFileAttributeView.java
+++ b/jdk/src/solaris/classes/sun/nio/fs/SolarisUserDefinedFileAttributeView.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2008, 2009, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2008, 2011, 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
diff --git a/jdk/src/solaris/classes/sun/nio/fs/SolarisWatchService.java b/jdk/src/solaris/classes/sun/nio/fs/SolarisWatchService.java
index 68296bc34e5..fcf36316b19 100644
--- a/jdk/src/solaris/classes/sun/nio/fs/SolarisWatchService.java
+++ b/jdk/src/solaris/classes/sun/nio/fs/SolarisWatchService.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2008, 2009, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2008, 2011, 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
diff --git a/jdk/src/solaris/classes/sun/nio/fs/UnixChannelFactory.java b/jdk/src/solaris/classes/sun/nio/fs/UnixChannelFactory.java
index 21c69ae4f4c..963e3777bdf 100644
--- a/jdk/src/solaris/classes/sun/nio/fs/UnixChannelFactory.java
+++ b/jdk/src/solaris/classes/sun/nio/fs/UnixChannelFactory.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2008, 2009, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2008, 2011, 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
diff --git a/jdk/src/solaris/classes/sun/nio/fs/UnixCopyFile.java b/jdk/src/solaris/classes/sun/nio/fs/UnixCopyFile.java
index 9a666c167ee..08aa82211dd 100644
--- a/jdk/src/solaris/classes/sun/nio/fs/UnixCopyFile.java
+++ b/jdk/src/solaris/classes/sun/nio/fs/UnixCopyFile.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2008, 2009, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2008, 2011, 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
diff --git a/jdk/src/solaris/classes/sun/nio/fs/UnixFileAttributeViews.java b/jdk/src/solaris/classes/sun/nio/fs/UnixFileAttributeViews.java
index c21a17707a8..3716e3fdef7 100644
--- a/jdk/src/solaris/classes/sun/nio/fs/UnixFileAttributeViews.java
+++ b/jdk/src/solaris/classes/sun/nio/fs/UnixFileAttributeViews.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2008, 2009, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2008, 2011, 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
@@ -123,6 +123,10 @@ class UnixFileAttributeViews {
private static final String OWNER_NAME = "owner";
private static final String GROUP_NAME = "group";
+ // the names of the posix attributes (incudes basic)
+ static final Set posixAttributeNames =
+ Util.newSet(basicAttributeNames, PERMISSIONS_NAME, OWNER_NAME, GROUP_NAME);
+
Posix(UnixPath file, boolean followLinks) {
super(file, followLinks);
}
@@ -172,9 +176,10 @@ class UnixFileAttributeViews {
* Invoked by readAttributes or sub-classes to add all matching posix
* attributes to the builder
*/
- final void addPosixAttributesToBuilder(PosixFileAttributes attrs,
+ final void addRequestedPosixAttributes(PosixFileAttributes attrs,
AttributesBuilder builder)
{
+ addRequestedBasicAttributes(attrs, builder);
if (builder.match(PERMISSIONS_NAME))
builder.add(PERMISSIONS_NAME, attrs.permissions());
if (builder.match(OWNER_NAME))
@@ -184,13 +189,13 @@ class UnixFileAttributeViews {
}
@Override
- public Map readAttributes(String[] attributes)
+ public Map readAttributes(String[] requested)
throws IOException
{
- AttributesBuilder builder = AttributesBuilder.create(attributes);
+ AttributesBuilder builder =
+ AttributesBuilder.create(posixAttributeNames, requested);
PosixFileAttributes attrs = readAttributes();
- addBasicAttributesToBuilder(attrs, builder);
- addPosixAttributesToBuilder(attrs, builder);
+ addRequestedPosixAttributes(attrs, builder);
return builder.unmodifiableMap();
}
@@ -287,6 +292,12 @@ class UnixFileAttributeViews {
private static final String GID_NAME = "gid";
private static final String CTIME_NAME = "ctime";
+ // the names of the unix attributes (including posix)
+ static final Set unixAttributeNames =
+ Util.newSet(posixAttributeNames,
+ MODE_NAME, INO_NAME, DEV_NAME, RDEV_NAME,
+ NLINK_NAME, UID_NAME, GID_NAME, CTIME_NAME);
+
Unix(UnixPath file, boolean followLinks) {
super(file, followLinks);
}
@@ -316,13 +327,13 @@ class UnixFileAttributeViews {
}
@Override
- public Map readAttributes(String[] attributes)
+ public Map readAttributes(String[] requested)
throws IOException
{
- AttributesBuilder builder = AttributesBuilder.create(attributes);
+ AttributesBuilder builder =
+ AttributesBuilder.create(unixAttributeNames, requested);
UnixFileAttributes attrs = readAttributes();
- addBasicAttributesToBuilder(attrs, builder);
- addPosixAttributesToBuilder(attrs, builder);
+ addRequestedPosixAttributes(attrs, builder);
if (builder.match(MODE_NAME))
builder.add(MODE_NAME, attrs.mode());
if (builder.match(INO_NAME))
diff --git a/jdk/src/solaris/classes/sun/nio/fs/UnixFileAttributes.java b/jdk/src/solaris/classes/sun/nio/fs/UnixFileAttributes.java
index 966712e0cf1..a6b79953add 100644
--- a/jdk/src/solaris/classes/sun/nio/fs/UnixFileAttributes.java
+++ b/jdk/src/solaris/classes/sun/nio/fs/UnixFileAttributes.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2008, 2009, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2008, 2011, 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
diff --git a/jdk/src/solaris/classes/sun/nio/fs/UnixFileStore.java b/jdk/src/solaris/classes/sun/nio/fs/UnixFileStore.java
index 080c2c0c2fd..4299b2668d0 100644
--- a/jdk/src/solaris/classes/sun/nio/fs/UnixFileStore.java
+++ b/jdk/src/solaris/classes/sun/nio/fs/UnixFileStore.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2008, 2011, 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
diff --git a/jdk/src/solaris/classes/sun/nio/fs/UnixFileSystem.java b/jdk/src/solaris/classes/sun/nio/fs/UnixFileSystem.java
index 96c6e4a4cce..28276e134ad 100644
--- a/jdk/src/solaris/classes/sun/nio/fs/UnixFileSystem.java
+++ b/jdk/src/solaris/classes/sun/nio/fs/UnixFileSystem.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2008, 2009, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2008, 2011, 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
diff --git a/jdk/src/solaris/classes/sun/nio/fs/UnixFileSystemProvider.java b/jdk/src/solaris/classes/sun/nio/fs/UnixFileSystemProvider.java
index 8ec672a306b..0c14ef02e7e 100644
--- a/jdk/src/solaris/classes/sun/nio/fs/UnixFileSystemProvider.java
+++ b/jdk/src/solaris/classes/sun/nio/fs/UnixFileSystemProvider.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2008, 2009, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2008, 2011, 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,20 +105,6 @@ public abstract class UnixFileSystemProvider
return (UnixPath)obj;
}
- boolean followLinks(LinkOption... options) {
- boolean followLinks = true;
- for (LinkOption option: options) {
- if (option == LinkOption.NOFOLLOW_LINKS) {
- followLinks = false;
- continue;
- }
- if (option == null)
- throw new NullPointerException();
- throw new AssertionError("Should not get here");
- }
- return followLinks;
- }
-
@Override
@SuppressWarnings("unchecked")
public V getFileAttributeView(Path obj,
@@ -126,7 +112,7 @@ public abstract class UnixFileSystemProvider
LinkOption... options)
{
UnixPath file = UnixPath.toUnixPath(obj);
- boolean followLinks = followLinks(options);
+ boolean followLinks = Util.followLinks(options);
if (type == BasicFileAttributeView.class)
return (V) UnixFileAttributeViews.createBasicView(file, followLinks);
if (type == PosixFileAttributeView.class)
@@ -163,7 +149,7 @@ public abstract class UnixFileSystemProvider
LinkOption... options)
{
UnixPath file = UnixPath.toUnixPath(obj);
- boolean followLinks = followLinks(options);
+ boolean followLinks = Util.followLinks(options);
if (name.equals("basic"))
return UnixFileAttributeViews.createBasicView(file, followLinks);
if (name.equals("posix"))
diff --git a/jdk/src/solaris/classes/sun/nio/fs/UnixPath.java b/jdk/src/solaris/classes/sun/nio/fs/UnixPath.java
index 9ec49b8d37a..30c4dfe6501 100644
--- a/jdk/src/solaris/classes/sun/nio/fs/UnixPath.java
+++ b/jdk/src/solaris/classes/sun/nio/fs/UnixPath.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2008, 2011, 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
@@ -606,7 +606,9 @@ class UnixPath
@Override
public boolean startsWith(Path other) {
- UnixPath that = toUnixPath(other);
+ if (!(Objects.requireNonNull(other) instanceof UnixPath))
+ return false;
+ UnixPath that = (UnixPath)other;
// other path is longer
if (that.path.length > path.length)
@@ -655,7 +657,9 @@ class UnixPath
@Override
public boolean endsWith(Path other) {
- UnixPath that = toUnixPath(other);
+ if (!(Objects.requireNonNull(other) instanceof UnixPath))
+ return false;
+ UnixPath that = (UnixPath)other;
int thisLen = path.length;
int thatLen = that.path.length;
@@ -815,13 +819,13 @@ class UnixPath
}
@Override
- public Path toRealPath(boolean resolveLinks) throws IOException {
+ public Path toRealPath(LinkOption... options) throws IOException {
checkRead();
UnixPath absolute = toAbsolutePath();
- // if resolveLinks is true then use realpath
- if (resolveLinks) {
+ // if resolving links then use realpath
+ if (Util.followLinks(options)) {
try {
byte[] rp = realpath(absolute);
return new UnixPath(getFileSystem(), rp);
@@ -830,7 +834,7 @@ class UnixPath
}
}
- // if resolveLinks is false then eliminate "." and also ".."
+ // if not resolving links then eliminate "." and also ".."
// where the previous element is not a link.
UnixPath result = fs.rootDirectory();
for (int i=0; i
+#include
+#endif
+
/* Take an array of string pairs (map of key->value) and a string (key).
* Examine each pair in the map to see if the first string (key) matches the
* string. If so, store the second string of the pair (value) in the value and
@@ -304,6 +309,36 @@ static int ParseLocale(int cat, char ** std_language, char ** std_script,
return 1;
}
+#ifdef JAVASE_EMBEDDED
+/* Determine the default embedded toolkit based on whether lib/xawt/
+ * exists in the JRE. This can still be overridden by -Dawt.toolkit=XXX
+ */
+static char* getEmbeddedToolkit() {
+ Dl_info dlinfo;
+ char buf[MAXPATHLEN];
+ int32_t len;
+ char *p;
+ struct stat statbuf;
+
+ /* Get address of this library and the directory containing it. */
+ dladdr((void *)getEmbeddedToolkit, &dlinfo);
+ realpath((char *)dlinfo.dli_fname, buf);
+ len = strlen(buf);
+ p = strrchr(buf, '/');
+ /* Default AWT Toolkit on Linux and Solaris is XAWT. */
+ strncpy(p, "/xawt/", MAXPATHLEN-len-1);
+ /* Check if it exists */
+ if (stat(buf, &statbuf) == -1 && errno == ENOENT) {
+ /* No - this is a reduced-headless-jre so use special HToolkit */
+ return "sun.awt.HToolkit";
+ }
+ else {
+ /* Yes - this is a headful JRE so fallback to SE defaults */
+ return NULL;
+ }
+}
+#endif
+
/* This function gets called very early, before VM_CALLS are setup.
* Do not use any of the VM_CALLS entries!!!
*/
@@ -328,7 +363,12 @@ GetJavaProperties(JNIEnv *env)
/* Java 2D properties */
sprops.graphics_env = "sun.awt.X11GraphicsEnvironment";
- sprops.awt_toolkit = NULL;
+
+#ifdef JAVASE_EMBEDDED
+ sprops.awt_toolkit = getEmbeddedToolkit();
+ if (sprops.awt_toolkit == NULL) // default as below
+#endif
+ sprops.awt_toolkit = "sun.awt.X11.XToolkit";
/* This is used only for debugging of font problems. */
v = getenv("JAVA2D_FONTPATH");
diff --git a/jdk/src/solaris/native/java/net/Inet4AddressImpl.c b/jdk/src/solaris/native/java/net/Inet4AddressImpl.c
index e6eaa0aa2f5..9a5b78e7723 100644
--- a/jdk/src/solaris/native/java/net/Inet4AddressImpl.c
+++ b/jdk/src/solaris/native/java/net/Inet4AddressImpl.c
@@ -60,7 +60,7 @@ Java_java_net_Inet4AddressImpl_getLocalHostName(JNIEnv *env, jobject this) {
char hostname[MAXHOSTNAMELEN+1];
hostname[0] = '\0';
- if (JVM_GetHostName(hostname, MAXHOSTNAMELEN)) {
+ if (JVM_GetHostName(hostname, sizeof(hostname))) {
/* Something went wrong, maybe networking is not setup? */
strcpy(hostname, "localhost");
} else {
@@ -83,6 +83,9 @@ Java_java_net_Inet4AddressImpl_getLocalHostName(JNIEnv *env, jobject this) {
char *buf2[HENT_BUF_SIZE/(sizeof (char *))];
int h_error=0;
+ // ensure null-terminated
+ hostname[MAXHOSTNAMELEN] = '\0';
+
#ifdef __GLIBC__
gethostbyname_r(hostname, &res, (char*)buf, sizeof(buf), &hp, &h_error);
#else
diff --git a/jdk/src/solaris/native/java/net/Inet6AddressImpl.c b/jdk/src/solaris/native/java/net/Inet6AddressImpl.c
index 5db03bf36fa..bb5bae78104 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, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2011, 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
@@ -64,10 +64,12 @@ Java_java_net_Inet6AddressImpl_getLocalHostName(JNIEnv *env, jobject this) {
char hostname[NI_MAXHOST+1];
hostname[0] = '\0';
- if (JVM_GetHostName(hostname, MAXHOSTNAMELEN)) {
+ if (JVM_GetHostName(hostname, sizeof(hostname))) {
/* Something went wrong, maybe networking is not setup? */
strcpy(hostname, "localhost");
} else {
+ // ensure null-terminated
+ hostname[NI_MAXHOST] = '\0';
#ifdef __linux__
/* On Linux gethostname() says "host.domain.sun.com". On
* Solaris gethostname() says "host", so extra work is needed.
diff --git a/jdk/src/solaris/native/java/net/NetworkInterface.c b/jdk/src/solaris/native/java/net/NetworkInterface.c
index ba1c3c7aa8e..0f987ff6764 100644
--- a/jdk/src/solaris/native/java/net/NetworkInterface.c
+++ b/jdk/src/solaris/native/java/net/NetworkInterface.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2011, 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
diff --git a/jdk/src/solaris/native/java/net/PlainDatagramSocketImpl.c b/jdk/src/solaris/native/java/net/PlainDatagramSocketImpl.c
index 0eb2a9be890..7a1edc3a99a 100644
--- a/jdk/src/solaris/native/java/net/PlainDatagramSocketImpl.c
+++ b/jdk/src/solaris/native/java/net/PlainDatagramSocketImpl.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2011, 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
diff --git a/jdk/src/solaris/native/java/net/PlainSocketImpl.c b/jdk/src/solaris/native/java/net/PlainSocketImpl.c
index 9aca8060962..64b6e3c07fd 100644
--- a/jdk/src/solaris/native/java/net/PlainSocketImpl.c
+++ b/jdk/src/solaris/native/java/net/PlainSocketImpl.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2011, 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
diff --git a/jdk/src/solaris/native/java/net/linux_close.c b/jdk/src/solaris/native/java/net/linux_close.c
index 1385519ef60..5665e85e09c 100644
--- a/jdk/src/solaris/native/java/net/linux_close.c
+++ b/jdk/src/solaris/native/java/net/linux_close.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2001, 2008, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 2011, 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
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 8e035b368f1..25b58f67c2a 100644
--- a/jdk/src/solaris/native/java/net/net_util_md.c
+++ b/jdk/src/solaris/native/java/net/net_util_md.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2011, 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
diff --git a/jdk/src/solaris/native/sun/awt/awt_DrawingSurface.c b/jdk/src/solaris/native/sun/awt/awt_DrawingSurface.c
index 0c1275b3bc2..21cc862dcae 100644
--- a/jdk/src/solaris/native/sun/awt/awt_DrawingSurface.c
+++ b/jdk/src/solaris/native/sun/awt/awt_DrawingSurface.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1996, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1996, 2011, 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
@@ -302,6 +302,7 @@ awt_DrawingSurface_FreeDrawingSurfaceInfo(JAWT_DrawingSurfaceInfo* dsi)
#ifdef DEBUG
fprintf(stderr, "Drawing Surface Info is NULL\n");
#endif
+ return;
}
free(dsi->platformInfo);
free(dsi);
diff --git a/jdk/src/solaris/native/sun/awt/awt_GraphicsEnv.c b/jdk/src/solaris/native/sun/awt/awt_GraphicsEnv.c
index 45184950931..301df87f8c9 100644
--- a/jdk/src/solaris/native/sun/awt/awt_GraphicsEnv.c
+++ b/jdk/src/solaris/native/sun/awt/awt_GraphicsEnv.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2009, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2011, 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
@@ -240,7 +240,7 @@ makeDefaultConfig(JNIEnv *env, int screen) {
AwtGraphicsConfigDataPtr defaultConfig;
int xinawareScreen = 0;
- VisualID forcedVisualID, defaultVisualID;
+ VisualID forcedVisualID = 0, defaultVisualID;
char *forcedVisualStr;
XVisualInfo vinfo;
long mask;
@@ -254,7 +254,7 @@ makeDefaultConfig(JNIEnv *env, int screen) {
if ((forcedVisualStr = getenv("FORCEDEFVIS"))) {
mask = VisualIDMask | VisualScreenMask;
- if (sscanf(forcedVisualStr, "%x", &forcedVisualID) > 0 &&
+ if (sscanf(forcedVisualStr, "%lx", &forcedVisualID) > 0 &&
forcedVisualID > 0)
{
vinfo.visualid = forcedVisualID;
diff --git a/jdk/src/solaris/native/sun/awt/awt_Robot.c b/jdk/src/solaris/native/sun/awt/awt_Robot.c
index c3384b2eb1a..38ad2786366 100644
--- a/jdk/src/solaris/native/sun/awt/awt_Robot.c
+++ b/jdk/src/solaris/native/sun/awt/awt_Robot.c
@@ -48,12 +48,28 @@
#ifdef __linux__
#include
#endif
+#include
extern struct X11GraphicsConfigIDs x11GraphicsConfigIDs;
static jint * masks;
static jint num_buttons;
+static unsigned int s_robotInstanceCounter = 0;
+
+static void* xcompositeLibHandle = NULL;
+static Bool xcompositeExtAvailable = False;
+static Bool xcompositeExtTested = False;
+
+typedef Status (*T_XCompositeQueryVersion)(Display *dpy, int *major_versionp, int *minor_versionp);
+typedef Window (*T_XCompositeGetOverlayWindow)(Display *dpy, Window window);
+typedef void (*T_XCompositeReleaseOverlayWindow)(Display *dpy, Window window);
+
+static T_XCompositeQueryVersion XCompositeQueryVersion = NULL;
+static T_XCompositeGetOverlayWindow XCompositeGetOverlayWindow = NULL;
+static T_XCompositeReleaseOverlayWindow XCompositeReleaseOverlayWindow = NULL;
+
+
static int32_t isXTestAvailable() {
int32_t major_opcode, first_event, first_error;
int32_t event_basep, error_basep, majorp, minorp;
@@ -194,8 +210,80 @@ Java_sun_awt_X11_XRobotPeer_setup (JNIEnv * env, jclass cls, jint numberOfButton
}
AWT_UNLOCK();
+
+ s_robotInstanceCounter++;
}
+JNIEXPORT void JNICALL
+Java_sun_awt_X11_XRobotPeer__1dispose (JNIEnv * env, jclass cls)
+{
+ if (--s_robotInstanceCounter) {
+ return;
+ }
+
+ // This is the last instance of the XRobotPeer being released
+
+ if (xcompositeExtTested && xcompositeExtAvailable && xcompositeLibHandle) {
+ // The lib is loaded in IsXCompositeAvailable(). Unload under AWT_LOCK
+ // so that the shutdown function of the lib behaves correctly.
+ AWT_LOCK();
+ dlclose(xcompositeLibHandle);
+ AWT_UNLOCK();
+ }
+
+ xcompositeExtTested = False;
+ xcompositeExtAvailable = False;
+ xcompositeLibHandle = NULL;
+}
+
+/*
+ * Returns True only if XCOMPOSITE is of version 0.3 or higher.
+ * The functions that we need are available since that version.
+ *
+ * Must be invoked under AWT_LOCK.
+ *
+ * Leaves the library loaded if the version is correct.
+ */
+static Bool IsXCompositeAvailable()
+{
+ if (!xcompositeExtTested) {
+ int opcode, eventb, errorb;
+
+ if (XQueryExtension(awt_display, "Composite", &opcode, &eventb, &errorb)) {
+ xcompositeLibHandle = dlopen("libXcomposite.so.1", RTLD_LAZY | RTLD_GLOBAL);
+#ifndef __linux__ /* SOLARIS */
+ if (xcompositeLibHandle == NULL) {
+ xcompositeLibHandle = dlopen("/usr/sfw/lib/libXcomposite.so.1",
+ RTLD_LAZY | RTLD_GLOBAL);
+ }
+#endif
+
+ if (xcompositeLibHandle) {
+ int major, minor;
+ XCompositeQueryVersion = (T_XCompositeQueryVersion)dlsym(xcompositeLibHandle, "XCompositeQueryVersion");
+
+ if (XCompositeQueryVersion && XCompositeQueryVersion(awt_display, &major, &minor)) {
+ if (major >= 0 && minor >= 3) {
+ XCompositeGetOverlayWindow = (T_XCompositeGetOverlayWindow)dlsym(xcompositeLibHandle, "XCompositeGetOverlayWindow");
+ XCompositeReleaseOverlayWindow = (T_XCompositeReleaseOverlayWindow)dlsym(xcompositeLibHandle, "XCompositeReleaseOverlayWindow");
+
+ if (XCompositeGetOverlayWindow && XCompositeReleaseOverlayWindow) {
+ xcompositeExtAvailable = True;
+ }
+ }
+ }
+
+ if (!xcompositeExtAvailable) {
+ dlclose(xcompositeLibHandle);
+ } /* else the lib is unloaded in _dispose() */
+ }
+ }
+
+ xcompositeExtTested = True;
+ }
+
+ return xcompositeExtAvailable;
+}
JNIEXPORT void JNICALL
Java_sun_awt_X11_XRobotPeer_getRGBPixelsImpl( JNIEnv *env,
@@ -211,7 +299,7 @@ Java_sun_awt_X11_XRobotPeer_getRGBPixelsImpl( JNIEnv *env,
jint *ary; /* Array of jints for sending pixel values back
* to parent process.
*/
- Window rootWindow;
+ Window window;
AwtGraphicsConfigDataPtr adata;
DTRACE_PRINTLN6("RobotPeer: getRGBPixelsImpl(%lx, %d, %d, %d, %d, %x)", xgc, x, y, width, height, pixelArray);
@@ -228,14 +316,24 @@ Java_sun_awt_X11_XRobotPeer_getRGBPixelsImpl( JNIEnv *env,
adata = (AwtGraphicsConfigDataPtr) JNU_GetLongFieldAsPtr(env, xgc, x11GraphicsConfigIDs.aData);
DASSERT(adata != NULL);
- rootWindow = XRootWindow(awt_display, adata->awt_visInfo.screen);
- image = getWindowImage(awt_display, rootWindow, x, y, width, height);
+ window = XRootWindow(awt_display, adata->awt_visInfo.screen);
+
+ if (IsXCompositeAvailable()) {
+ // Use 'composite overlay window' instead of the root window.
+ // See 6903034 for details.
+ window = XCompositeGetOverlayWindow(awt_display, window);
+ }
+
+ image = getWindowImage(awt_display, window, x, y, width, height);
/* Array to use to crunch around the pixel values */
ary = (jint *) malloc(width * height * sizeof (jint));
if (ary == NULL) {
JNU_ThrowOutOfMemoryError(env, "OutOfMemoryError");
XDestroyImage(image);
+ if (IsXCompositeAvailable()) {
+ XCompositeReleaseOverlayWindow(awt_display, window);
+ }
AWT_UNLOCK();
return;
}
@@ -256,6 +354,9 @@ Java_sun_awt_X11_XRobotPeer_getRGBPixelsImpl( JNIEnv *env,
free(ary);
XDestroyImage(image);
+ if (IsXCompositeAvailable()) {
+ XCompositeReleaseOverlayWindow(awt_display, window);
+ }
AWT_UNLOCK();
}
diff --git a/jdk/src/solaris/native/sun/awt/fontpath.c b/jdk/src/solaris/native/sun/awt/fontpath.c
index c868f3cc0ea..68c352db16c 100644
--- a/jdk/src/solaris/native/sun/awt/fontpath.c
+++ b/jdk/src/solaris/native/sun/awt/fontpath.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1998, 2006, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 2011, 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
diff --git a/jdk/src/solaris/native/sun/awt/gtk2_interface.c b/jdk/src/solaris/native/sun/awt/gtk2_interface.c
index 291edc3fb7e..3378dd00c2d 100644
--- a/jdk/src/solaris/native/sun/awt/gtk2_interface.c
+++ b/jdk/src/solaris/native/sun/awt/gtk2_interface.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2011, 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
diff --git a/jdk/src/solaris/native/sun/awt/gtk2_interface.h b/jdk/src/solaris/native/sun/awt/gtk2_interface.h
index addbc99d61c..9a6e2ca0f8f 100644
--- a/jdk/src/solaris/native/sun/awt/gtk2_interface.h
+++ b/jdk/src/solaris/native/sun/awt/gtk2_interface.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2011, 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
diff --git a/jdk/src/solaris/native/sun/awt/jawt.c b/jdk/src/solaris/native/sun/awt/jawt.c
index b682edaf45d..f6f8530cb9a 100644
--- a/jdk/src/solaris/native/sun/awt/jawt.c
+++ b/jdk/src/solaris/native/sun/awt/jawt.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1999, 2001, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2011, 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
@@ -33,6 +33,10 @@
*/
JNIEXPORT jboolean JNICALL JAWT_GetAWT(JNIEnv* env, JAWT* awt)
{
+#if defined(JAVASE_EMBEDDED) && defined(HEADLESS)
+ /* there are no AWT libs available at all */
+ return JNI_FALSE;
+#else
if (awt == NULL) {
return JNI_FALSE;
}
@@ -51,4 +55,5 @@ JNIEXPORT jboolean JNICALL JAWT_GetAWT(JNIEnv* env, JAWT* awt)
}
return JNI_TRUE;
+#endif
}
diff --git a/jdk/src/solaris/native/sun/java2d/loops/vis_IntArgbPre_Mask.c b/jdk/src/solaris/native/sun/java2d/loops/vis_IntArgbPre_Mask.c
index 2b142c46c48..3e9d09747e1 100644
--- a/jdk/src/solaris/native/sun/java2d/loops/vis_IntArgbPre_Mask.c
+++ b/jdk/src/solaris/native/sun/java2d/loops/vis_IntArgbPre_Mask.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2003, 2005, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 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
diff --git a/jdk/src/solaris/native/sun/java2d/loops/vis_SrcMaskFill.c b/jdk/src/solaris/native/sun/java2d/loops/vis_SrcMaskFill.c
index 170ab458d80..5d1710ce551 100644
--- a/jdk/src/solaris/native/sun/java2d/loops/vis_SrcMaskFill.c
+++ b/jdk/src/solaris/native/sun/java2d/loops/vis_SrcMaskFill.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2003, 2005, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 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
diff --git a/jdk/src/solaris/native/sun/java2d/x11/X11SurfaceData.c b/jdk/src/solaris/native/sun/java2d/x11/X11SurfaceData.c
index db16fdc524a..9b3e7061436 100644
--- a/jdk/src/solaris/native/sun/java2d/x11/X11SurfaceData.c
+++ b/jdk/src/solaris/native/sun/java2d/x11/X11SurfaceData.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2011, 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
diff --git a/jdk/src/solaris/native/sun/java2d/x11/X11SurfaceData.h b/jdk/src/solaris/native/sun/java2d/x11/X11SurfaceData.h
index 104d7b1021a..a082df9f518 100644
--- a/jdk/src/solaris/native/sun/java2d/x11/X11SurfaceData.h
+++ b/jdk/src/solaris/native/sun/java2d/x11/X11SurfaceData.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2011, 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
diff --git a/jdk/src/solaris/native/sun/java2d/x11/XRBackendNative.c b/jdk/src/solaris/native/sun/java2d/x11/XRBackendNative.c
index f56e904a669..969f5f589fe 100644
--- a/jdk/src/solaris/native/sun/java2d/x11/XRBackendNative.c
+++ b/jdk/src/solaris/native/sun/java2d/x11/XRBackendNative.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2010, 2011, 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
@@ -644,7 +644,7 @@ Java_sun_java2d_xr_XRBackendNative_XRAddGlyphsNative
for (i=0; i < glyphCnt; i++) {
GlyphInfo *jginfo = (GlyphInfo *) jlong_to_ptr(glyphInfoPtrs[i]);
- gid[i] = (Glyph) (0xffffffff & ((unsigned int) jginfo->cellInfo));
+ gid[i] = (Glyph) (0x0ffffffffL & ((unsigned long)(jginfo->cellInfo)));
xginfo[i].x = (-jginfo->topLeftX);
xginfo[i].y = (-jginfo->topLeftY);
xginfo[i].width = jginfo->width;
@@ -666,16 +666,56 @@ Java_sun_java2d_xr_XRBackendNative_XRAddGlyphsNative
JNIEXPORT void JNICALL
Java_sun_java2d_xr_XRBackendNative_XRFreeGlyphsNative
(JNIEnv *env, jclass cls, jint glyphSet, jintArray gidArray, jint glyphCnt) {
- jint *gids;
- int i;
- if ((gids = (jint *) (*env)->GetPrimitiveArrayCritical(env, gidArray, NULL)) == NULL) {
+ /* The glyph ids are 32 bit but may be stored in a 64 bit long on
+ * a 64 bit architecture. So optimise the 32 bit case to avoid
+ * extra stack or heap allocations by directly referencing the
+ * underlying Java array and only allocate on 64 bit.
+ */
+ if (sizeof(jint) == sizeof(Glyph)) {
+ jint *gids =
+ (*env)->GetPrimitiveArrayCritical(env, gidArray, NULL);
+ if (gids == NULL) {
+ return;
+ } else {
+ XRenderFreeGlyphs(awt_display,
+ (GlyphSet)glyphSet, (Glyph *)gids, glyphCnt);
+ (*env)->ReleasePrimitiveArrayCritical(env, gidArray,
+ gids, JNI_ABORT);
+ }
return;
+ } else {
+ Glyph stack_ids[64];
+ Glyph *gids = NULL;
+ jint* jgids = NULL;
+ int i;
+
+ if (glyphCnt <= 64) {
+ gids = stack_ids;
+ } else {
+ gids = (Glyph *)malloc(sizeof(Glyph) * glyphCnt);
+ if (gids == NULL) {
+ return;
+ }
+ }
+ jgids = (*env)->GetPrimitiveArrayCritical(env, gidArray, NULL);
+ if (jgids == NULL) {
+ if (gids != stack_ids) {
+ free(gids);
+ }
+ return;
+ }
+ for (i=0; i < glyphCnt; i++) {
+ gids[i] = jgids[i];
+ }
+ XRenderFreeGlyphs(awt_display,
+ (GlyphSet) glyphSet, gids, glyphCnt);
+ (*env)->ReleasePrimitiveArrayCritical(env, gidArray,
+ jgids, JNI_ABORT);
+ if (gids != stack_ids) {
+ free(gids);
+ }
}
-
- XRenderFreeGlyphs (awt_display, (GlyphSet) glyphSet, (Glyph *) gids, glyphCnt);
-
- (*env)->ReleasePrimitiveArrayCritical(env, gidArray, gids, JNI_ABORT);
}
JNIEXPORT jint JNICALL
@@ -692,9 +732,9 @@ Java_sun_java2d_xr_XRBackendNative_XRenderCompositeTextNative
jint *ids;
jint *elts;
XGlyphElt32 *xelts;
- Glyph *xids;
+ unsigned int *xids;
XGlyphElt32 selts[24];
- Glyph sids[256];
+ unsigned int sids[256];
int charCnt = 0;
if (eltCnt <= 24) {
@@ -709,7 +749,7 @@ Java_sun_java2d_xr_XRBackendNative_XRenderCompositeTextNative
if (glyphCnt <= 256) {
xids = &sids[0];
} else {
- xids = (Glyph *) malloc(sizeof(Glyph) * glyphCnt);
+ xids = (unsigned int*)malloc(sizeof(unsigned int) * glyphCnt);
if (xids == NULL) {
if (xelts != &selts[0]) {
free(xelts);
@@ -742,7 +782,7 @@ Java_sun_java2d_xr_XRBackendNative_XRenderCompositeTextNative
}
for (i=0; i < glyphCnt; i++) {
- xids[i] = (Glyph) ids[i];
+ xids[i] = ids[i];
}
for (i=0; i < eltCnt; i++) {
@@ -750,7 +790,7 @@ Java_sun_java2d_xr_XRBackendNative_XRenderCompositeTextNative
xelts[i].xOff = elts[i*4 + 1];
xelts[i].yOff = elts[i*4 + 2];
xelts[i].glyphset = (GlyphSet) elts[i*4 + 3];
- xelts[i].chars = (unsigned int *) &xids[charCnt];
+ xelts[i].chars = &xids[charCnt];
charCnt += xelts[i].nchars;
}
diff --git a/jdk/src/solaris/native/sun/java2d/x11/XRSurfaceData.c b/jdk/src/solaris/native/sun/java2d/x11/XRSurfaceData.c
index 620f90f7618..5de53ca7a04 100644
--- a/jdk/src/solaris/native/sun/java2d/x11/XRSurfaceData.c
+++ b/jdk/src/solaris/native/sun/java2d/x11/XRSurfaceData.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2010, 2011, 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
diff --git a/jdk/src/solaris/native/sun/nio/ch/FileChannelImpl.c b/jdk/src/solaris/native/sun/nio/ch/FileChannelImpl.c
index 539013f0bd7..808391433f6 100644
--- a/jdk/src/solaris/native/sun/nio/ch/FileChannelImpl.c
+++ b/jdk/src/solaris/native/sun/nio/ch/FileChannelImpl.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2000, 2009, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2011, 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
diff --git a/jdk/src/solaris/native/sun/nio/ch/Net.c b/jdk/src/solaris/native/sun/nio/ch/Net.c
index c43664c5000..def98591f8a 100644
--- a/jdk/src/solaris/native/sun/nio/ch/Net.c
+++ b/jdk/src/solaris/native/sun/nio/ch/Net.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2001, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 2011, 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
@@ -154,6 +154,22 @@ Java_sun_nio_ch_Net_isIPv6Available0(JNIEnv* env, jclass cl)
return (ipv6_available()) ? JNI_TRUE : JNI_FALSE;
}
+JNIEXPORT jboolean JNICALL
+Java_sun_nio_ch_Net_canIPv6SocketJoinIPv4Group0(JNIEnv* env, jclass cl)
+{
+ return JNI_TRUE;
+}
+
+JNIEXPORT jboolean JNICALL
+Java_sun_nio_ch_Net_canJoin6WithIPv4Group0(JNIEnv* env, jclass cl)
+{
+#ifdef __solaris__
+ return JNI_TRUE;
+#else
+ return JNI_FALSE;
+#endif
+}
+
JNIEXPORT int JNICALL
Java_sun_nio_ch_Net_socket0(JNIEnv *env, jclass cl, jboolean preferIPv6,
jboolean stream, jboolean reuse)
diff --git a/jdk/src/solaris/native/sun/nio/fs/UnixNativeDispatcher.c b/jdk/src/solaris/native/sun/nio/fs/UnixNativeDispatcher.c
index d01f09e3c64..ba22f417556 100644
--- a/jdk/src/solaris/native/sun/nio/fs/UnixNativeDispatcher.c
+++ b/jdk/src/solaris/native/sun/nio/fs/UnixNativeDispatcher.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2008, 2009, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2008, 2011, 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
diff --git a/jdk/src/solaris/native/sun/xawt/XToolkit.c b/jdk/src/solaris/native/sun/xawt/XToolkit.c
index 4ea63143c70..69620ffc1e6 100644
--- a/jdk/src/solaris/native/sun/xawt/XToolkit.c
+++ b/jdk/src/solaris/native/sun/xawt/XToolkit.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2002, 2006, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2002, 2011, 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
@@ -110,6 +110,21 @@ Java_sun_awt_X11_XToolkit_initIDs
awt_ModLockIsShiftLock = (*env)->GetStaticIntField(env, clazz, fid) != 0 ? True : False;
}
+/*
+ * Class: sun_awt_X11_XToolkit
+ * Method: getTrayIconDisplayTimeout
+ * Signature: ()J
+ */
+JNIEXPORT jlong JNICALL Java_sun_awt_X11_XToolkit_getTrayIconDisplayTimeout
+ (JNIEnv *env, jclass clazz)
+{
+#ifndef JAVASE_EMBEDDED
+ return (jlong) 2000;
+#else
+ return (jlong) 10000;
+#endif
+}
+
/*
* Class: sun_awt_X11_XToolkit
* Method: getDefaultXColormap
@@ -340,15 +355,34 @@ static uint32_t get_poll_timeout(jlong nextTaskTime);
#define AWT_READPIPE (awt_pipe_fds[0])
#define AWT_WRITEPIPE (awt_pipe_fds[1])
-#define DEF_AWT_MAX_POLL_TIMEOUT ((uint32_t)500) /* milliseconds */
+#ifdef JAVASE_EMBEDDED
+ #define DEF_AWT_MAX_POLL_TIMEOUT ((uint32_t)4000000000) /* milliseconds */
+#else
+ #define DEF_AWT_MAX_POLL_TIMEOUT ((uint32_t)500) /* milliseconds */
+#endif
+
#define DEF_AWT_FLUSH_TIMEOUT ((uint32_t)100) /* milliseconds */
#define AWT_MIN_POLL_TIMEOUT ((uint32_t)0) /* milliseconds */
#define TIMEOUT_TIMEDOUT 0
#define TIMEOUT_EVENTS 1
+/* awt_poll_alg - AWT Poll Events Aging Algorithms */
+#define AWT_POLL_FALSE 1
+#define AWT_POLL_AGING_SLOW 2
+#define AWT_POLL_AGING_FAST 3
+
+#define AWT_POLL_THRESHOLD 1000 // msec, Block if delay is larger
+#define AWT_POLL_BLOCK -1 // cause poll() block
+
// Static fields
+#ifdef JAVASE_EMBEDDED
+ static int awt_poll_alg = AWT_POLL_AGING_FAST;
+#else
+ static int awt_poll_alg = AWT_POLL_AGING_SLOW;
+#endif
+
static uint32_t AWT_FLUSH_TIMEOUT = DEF_AWT_FLUSH_TIMEOUT; /* milliseconds */
static uint32_t AWT_MAX_POLL_TIMEOUT = DEF_AWT_MAX_POLL_TIMEOUT; /* milliseconds */
static pthread_t awt_MainThread = 0;
@@ -417,6 +451,7 @@ awt_pipe_init() {
*/
static void readEnv() {
char * value;
+ int tmp_poll_alg;
static Boolean env_read = False;
if (env_read) return;
@@ -451,6 +486,23 @@ static void readEnv() {
if (static_poll_timeout != 0) {
curPollTimeout = static_poll_timeout;
}
+
+ // non-blocking poll()
+ value = getenv("_AWT_POLL_ALG");
+ if (value != NULL) {
+ tmp_poll_alg = atoi(value);
+ switch(tmp_poll_alg) {
+ case AWT_POLL_FALSE:
+ case AWT_POLL_AGING_SLOW:
+ case AWT_POLL_AGING_FAST:
+ awt_poll_alg = tmp_poll_alg;
+ break;
+ default:
+ PRINT("Unknown value of _AWT_POLL_ALG, assuming Slow Aging Algorithm by default");
+ awt_poll_alg = AWT_POLL_AGING_SLOW;
+ break;
+ }
+ }
}
/**
@@ -478,14 +530,29 @@ static void update_poll_timeout(int timeout_control) {
if (static_poll_timeout != 0) return;
// Update it otherwise
- if (timeout_control == TIMEOUT_TIMEDOUT) {
- /* add 1/4 (plus 1, in case the division truncates to 0) */
- curPollTimeout += ((curPollTimeout>>2) + 1);
- curPollTimeout = min(AWT_MAX_POLL_TIMEOUT, curPollTimeout);
- } else if (timeout_control == TIMEOUT_EVENTS) {
- /* subtract 1/4 (plus 1, in case the division truncates to 0) */
- curPollTimeout -= ((curPollTimeout>>2) + 1);
- curPollTimeout = max(AWT_MIN_POLL_TIMEOUT, curPollTimeout);
+
+ switch(awt_poll_alg) {
+ case AWT_POLL_AGING_SLOW:
+ if (timeout_control == TIMEOUT_TIMEDOUT) {
+ /* add 1/4 (plus 1, in case the division truncates to 0) */
+ curPollTimeout += ((curPollTimeout>>2) + 1);
+ curPollTimeout = min(AWT_MAX_POLL_TIMEOUT, curPollTimeout);
+ } else if (timeout_control == TIMEOUT_EVENTS) {
+ /* subtract 1/4 (plus 1, in case the division truncates to 0) */
+ curPollTimeout -= ((curPollTimeout>>2) + 1);
+ curPollTimeout = max(AWT_MIN_POLL_TIMEOUT, curPollTimeout);
+ }
+ break;
+ case AWT_POLL_AGING_FAST:
+ if (timeout_control == TIMEOUT_TIMEDOUT) {
+ curPollTimeout += ((curPollTimeout>>2) + 1);
+ curPollTimeout = min(AWT_MAX_POLL_TIMEOUT, curPollTimeout);
+ if((int)curPollTimeout > AWT_POLL_THRESHOLD || (int)curPollTimeout == AWT_POLL_BLOCK)
+ curPollTimeout = AWT_POLL_BLOCK;
+ } else if (timeout_control == TIMEOUT_EVENTS) {
+ curPollTimeout = max(AWT_MIN_POLL_TIMEOUT, 1);
+ }
+ break;
}
}
@@ -497,16 +564,37 @@ static void update_poll_timeout(int timeout_control) {
*/
static uint32_t get_poll_timeout(jlong nextTaskTime)
{
+ uint32_t ret_timeout;
+ uint32_t timeout;
+ uint32_t taskTimeout;
+ uint32_t flushTimeout;
+
jlong curTime = awtJNI_TimeMillis();
- uint32_t timeout = curPollTimeout;
- uint32_t taskTimeout = (nextTaskTime == -1) ? AWT_MAX_POLL_TIMEOUT : (uint32_t)max(0, (int32_t)(nextTaskTime - curTime));
- uint32_t flushTimeout = (awt_next_flush_time > 0) ? (uint32_t)max(0, (int32_t)(awt_next_flush_time - curTime)) : AWT_MAX_POLL_TIMEOUT;
+ timeout = curPollTimeout;
+ switch(awt_poll_alg) {
+ case AWT_POLL_AGING_SLOW:
+ case AWT_POLL_AGING_FAST:
+ taskTimeout = (nextTaskTime == -1) ? AWT_MAX_POLL_TIMEOUT : (uint32_t)max(0, (int32_t)(nextTaskTime - curTime));
+ flushTimeout = (awt_next_flush_time > 0) ? (uint32_t)max(0, (int32_t)(awt_next_flush_time - curTime)) : AWT_MAX_POLL_TIMEOUT;
- PRINT2("to: %d, ft: %d, to: %d, tt: %d, mil: %d\n", taskTimeout, flushTimeout, timeout, (int)nextTaskTime, (int)curTime);
+ PRINT2("to: %d, ft: %d, to: %d, tt: %d, mil: %d\n", taskTimeout, flushTimeout, timeout, (int)nextTaskTime, (int)curTime);
- // Adjust timeout to flush_time and task_time
- return min(flushTimeout, min(taskTimeout, timeout));
-} /* awt_get_poll_timeout() */
+ // Adjust timeout to flush_time and task_time
+ ret_timeout = min(flushTimeout, min(taskTimeout, timeout));
+ if((int)curPollTimeout == AWT_POLL_BLOCK)
+ ret_timeout = AWT_POLL_BLOCK;
+ break;
+
+ case AWT_POLL_FALSE:
+ ret_timeout = (nextTaskTime > curTime) ?
+ (nextTaskTime - curTime) :
+ ((nextTaskTime == -1) ? -1 : 0);
+ break;
+ }
+
+ return ret_timeout;
+
+} /* get_poll_timeout() */
/*
* Waits for X/Xt events to appear on the pipe. Returns only when
@@ -598,6 +686,8 @@ performPoll(JNIEnv *env, jlong nextTaskTime) {
if (result == 0) {
/* poll() timed out -- update timeout value */
update_poll_timeout(TIMEOUT_TIMEDOUT);
+ PRINT2("%s(): TIMEOUT_TIMEDOUT curPollTimeout = %d \n",
+ performPoll, curPollTimeout);
}
if (pollFds[1].revents) {
int count;
@@ -606,10 +696,14 @@ performPoll(JNIEnv *env, jlong nextTaskTime) {
do {
count = read(AWT_READPIPE, read_buf, AWT_POLL_BUFSIZE );
} while (count == AWT_POLL_BUFSIZE );
+ PRINT2("%s(): data on the AWT pipe: curPollTimeout = %d \n",
+ performPoll, curPollTimeout);
}
if (pollFds[0].revents) {
// Events in X pipe
update_poll_timeout(TIMEOUT_EVENTS);
+ PRINT2("%s(): TIMEOUT_EVENTS curPollTimeout = %ld \n",
+ performPoll, curPollTimeout);
}
return;
diff --git a/jdk/src/solaris/native/sun/xawt/awt_Desktop.c b/jdk/src/solaris/native/sun/xawt/awt_Desktop.c
index 69b9207bc99..77f38f88e07 100644
--- a/jdk/src/solaris/native/sun/xawt/awt_Desktop.c
+++ b/jdk/src/solaris/native/sun/xawt/awt_Desktop.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2011, 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
diff --git a/jdk/src/windows/bin/java_md.c b/jdk/src/windows/bin/java_md.c
index dfa50ac8af8..b8665f3fefb 100644
--- a/jdk/src/windows/bin/java_md.c
+++ b/jdk/src/windows/bin/java_md.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2011, 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
diff --git a/jdk/src/windows/classes/java/lang/ProcessEnvironment.java b/jdk/src/windows/classes/java/lang/ProcessEnvironment.java
index c5e4c130f26..b5a4383019e 100644
--- a/jdk/src/windows/classes/java/lang/ProcessEnvironment.java
+++ b/jdk/src/windows/classes/java/lang/ProcessEnvironment.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2003, 2006, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 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
diff --git a/jdk/src/windows/classes/java/net/PlainSocketImpl.java b/jdk/src/windows/classes/java/net/PlainSocketImpl.java
index cc25c39dc72..ea11fa609d8 100644
--- a/jdk/src/windows/classes/java/net/PlainSocketImpl.java
+++ b/jdk/src/windows/classes/java/net/PlainSocketImpl.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2007, 2008, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2007, 2011, 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
diff --git a/jdk/src/windows/classes/java/net/TwoStacksPlainDatagramSocketImpl.java b/jdk/src/windows/classes/java/net/TwoStacksPlainDatagramSocketImpl.java
index 65969a877d5..d8e4ec54c20 100644
--- a/jdk/src/windows/classes/java/net/TwoStacksPlainDatagramSocketImpl.java
+++ b/jdk/src/windows/classes/java/net/TwoStacksPlainDatagramSocketImpl.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2007, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2007, 2011, 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,6 +26,7 @@ package java.net;
import java.io.IOException;
import java.io.FileDescriptor;
+import sun.net.ResourceManager;
/**
* This class defines the plain DatagramSocketImpl that is used for all
@@ -108,6 +109,7 @@ class TwoStacksPlainDatagramSocketImpl extends AbstractPlainDatagramSocketImpl
protected void close() {
if (fd != null || fd1 != null) {
datagramSocketClose();
+ ResourceManager.afterUdpClose();
fd = null;
fd1 = null;
}
diff --git a/jdk/src/windows/classes/sun/awt/Win32FontManager.java b/jdk/src/windows/classes/sun/awt/Win32FontManager.java
index b2dd894e490..61e3b59eaa6 100644
--- a/jdk/src/windows/classes/sun/awt/Win32FontManager.java
+++ b/jdk/src/windows/classes/sun/awt/Win32FontManager.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2008, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2008, 2011, 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
diff --git a/jdk/src/windows/classes/sun/awt/Win32GraphicsEnvironment.java b/jdk/src/windows/classes/sun/awt/Win32GraphicsEnvironment.java
index f3088fcbca3..c9b38df6686 100644
--- a/jdk/src/windows/classes/sun/awt/Win32GraphicsEnvironment.java
+++ b/jdk/src/windows/classes/sun/awt/Win32GraphicsEnvironment.java
@@ -39,12 +39,8 @@ import java.util.NoSuchElementException;
import java.util.StringTokenizer;
import sun.awt.DisplayChangedListener;
import sun.awt.SunDisplayChanger;
-import sun.awt.windows.WFontConfiguration;
import sun.awt.windows.WPrinterJob;
import sun.awt.windows.WToolkit;
-import sun.font.FontManager;
-import sun.font.FontManagerFactory;
-import sun.font.SunFontManager;
import sun.java2d.SunGraphicsEnvironment;
import sun.java2d.SurfaceManagerFactory;
import sun.java2d.WindowsSurfaceManagerFactory;
@@ -231,20 +227,6 @@ public class Win32GraphicsEnvironment
return device;
}
- // Implements SunGraphicsEnvironment.createFontConfiguration.
- protected FontConfiguration createFontConfiguration() {
- FontConfiguration fc = new WFontConfiguration(SunFontManager.getInstance());
- fc.init();
- return fc;
- }
-
- public FontConfiguration createFontConfiguration(boolean preferLocaleFonts,
- boolean preferPropFonts) {
-
- return new WFontConfiguration(SunFontManager.getInstance(),
- preferLocaleFonts,preferPropFonts);
- }
-
public boolean isDisplayLocal() {
return true;
}
diff --git a/jdk/src/windows/classes/sun/awt/windows/WPathGraphics.java b/jdk/src/windows/classes/sun/awt/windows/WPathGraphics.java
index 180341f20f3..fff1765c464 100644
--- a/jdk/src/windows/classes/sun/awt/windows/WPathGraphics.java
+++ b/jdk/src/windows/classes/sun/awt/windows/WPathGraphics.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1998, 2008, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 2011, 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
diff --git a/jdk/src/windows/classes/sun/awt/windows/WPrinterJob.java b/jdk/src/windows/classes/sun/awt/windows/WPrinterJob.java
index cf629bb0ae8..250d8c72203 100644
--- a/jdk/src/windows/classes/sun/awt/windows/WPrinterJob.java
+++ b/jdk/src/windows/classes/sun/awt/windows/WPrinterJob.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2007, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2011, 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
diff --git a/jdk/src/windows/classes/sun/awt/windows/WToolkit.java b/jdk/src/windows/classes/sun/awt/windows/WToolkit.java
index b994c23a1e5..f87f5859bf7 100644
--- a/jdk/src/windows/classes/sun/awt/windows/WToolkit.java
+++ b/jdk/src/windows/classes/sun/awt/windows/WToolkit.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1996, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1996, 2011, 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
@@ -630,10 +630,10 @@ public class WToolkit extends SunToolkit implements Runnable {
public PrintJob getPrintJob(Frame frame, String doctitle,
JobAttributes jobAttributes,
- PageAttributes pageAttributes) {
-
- if (GraphicsEnvironment.isHeadless()) {
- throw new IllegalArgumentException();
+ PageAttributes pageAttributes)
+ {
+ if (frame == null) {
+ throw new NullPointerException("frame must not be null");
}
PrintJob2D printJob = new PrintJob2D(frame, doctitle,
diff --git a/jdk/src/windows/classes/sun/awt/windows/fontconfig.properties b/jdk/src/windows/classes/sun/awt/windows/fontconfig.properties
index a7f59e52b8d..2a43e6e90d0 100644
--- a/jdk/src/windows/classes/sun/awt/windows/fontconfig.properties
+++ b/jdk/src/windows/classes/sun/awt/windows/fontconfig.properties
@@ -102,28 +102,28 @@ sansserif.bolditalic.korean=Gulim
monospaced.plain.alphabetic=Courier New
monospaced.plain.chinese-ms950=MingLiU
monospaced.plain.chinese-ms950-extb=MingLiU-ExtB
-monospaced.plain.hebrew=David
+monospaced.plain.hebrew=Courier New
monospaced.plain.japanese=MS Gothic
monospaced.plain.korean=GulimChe
monospaced.bold.alphabetic=Courier New Bold
monospaced.bold.chinese-ms950=PMingLiU
monospaced.bold.chinese-ms950-extb=PMingLiU-ExtB
-monospaced.bold.hebrew=David Bold
+monospaced.bold.hebrew=Courier New Bold
monospaced.bold.japanese=MS Gothic
monospaced.bold.korean=GulimChe
monospaced.italic.alphabetic=Courier New Italic
monospaced.italic.chinese-ms950=PMingLiU
monospaced.italic.chinese-ms950-extb=PMingLiU-ExtB
-monospaced.italic.hebrew=David
+monospaced.italic.hebrew=Courier New
monospaced.italic.japanese=MS Gothic
monospaced.italic.korean=GulimChe
monospaced.bolditalic.alphabetic=Courier New Bold Italic
monospaced.bolditalic.chinese-ms950=PMingLiU
monospaced.bolditalic.chinese-ms950-extb=PMingLiU-ExtB
-monospaced.bolditalic.hebrew=David Bold
+monospaced.bolditalic.hebrew=Courier New Bold
monospaced.bolditalic.japanese=MS Gothic
monospaced.bolditalic.korean=GulimChe
diff --git a/jdk/src/windows/classes/sun/java2d/d3d/D3DSurfaceData.java b/jdk/src/windows/classes/sun/java2d/d3d/D3DSurfaceData.java
index bc7dfd8631a..50a51a6f94b 100644
--- a/jdk/src/windows/classes/sun/java2d/d3d/D3DSurfaceData.java
+++ b/jdk/src/windows/classes/sun/java2d/d3d/D3DSurfaceData.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2007, 2008, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2007, 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
diff --git a/jdk/src/windows/classes/sun/java2d/opengl/WGLVolatileSurfaceManager.java b/jdk/src/windows/classes/sun/java2d/opengl/WGLVolatileSurfaceManager.java
index 7c4fde1b640..0c3009c44db 100644
--- a/jdk/src/windows/classes/sun/java2d/opengl/WGLVolatileSurfaceManager.java
+++ b/jdk/src/windows/classes/sun/java2d/opengl/WGLVolatileSurfaceManager.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2004, 2008, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2004, 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
diff --git a/jdk/src/windows/classes/sun/net/www/protocol/http/ntlm/NTLMAuthentication.java b/jdk/src/windows/classes/sun/net/www/protocol/http/ntlm/NTLMAuthentication.java
index c9c26517d9b..8ca04d7fef7 100644
--- a/jdk/src/windows/classes/sun/net/www/protocol/http/ntlm/NTLMAuthentication.java
+++ b/jdk/src/windows/classes/sun/net/www/protocol/http/ntlm/NTLMAuthentication.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2002, 2005, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2002, 2011, 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
@@ -45,6 +45,9 @@ public class NTLMAuthentication extends AuthenticationInfo {
private static final long serialVersionUID = 100L;
+ private static final NTLMAuthenticationCallback NTLMAuthCallback =
+ NTLMAuthenticationCallback.getNTLMAuthenticationCallback();
+
private String hostname;
private static String defaultDomain; /* Domain to use if not specified by user */
@@ -142,6 +145,14 @@ public class NTLMAuthentication extends AuthenticationInfo {
return true;
}
+ /**
+ * Returns true if the given site is trusted, i.e. we can try
+ * transparent Authentication.
+ */
+ public static boolean isTrustedSite(URL url) {
+ return NTLMAuthCallback.isTrustedSite(url);
+ }
+
/**
* Not supported. Must use the setHeaders() method
*/
diff --git a/jdk/src/windows/classes/sun/nio/ch/PendingIoCache.java b/jdk/src/windows/classes/sun/nio/ch/PendingIoCache.java
index 7a4b1e3e319..a660ff097e3 100644
--- a/jdk/src/windows/classes/sun/nio/ch/PendingIoCache.java
+++ b/jdk/src/windows/classes/sun/nio/ch/PendingIoCache.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2008, 2009, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2008, 2011, 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
diff --git a/jdk/src/windows/classes/sun/nio/ch/WindowsAsynchronousFileChannelImpl.java b/jdk/src/windows/classes/sun/nio/ch/WindowsAsynchronousFileChannelImpl.java
index 82405875928..b144c96f81b 100644
--- a/jdk/src/windows/classes/sun/nio/ch/WindowsAsynchronousFileChannelImpl.java
+++ b/jdk/src/windows/classes/sun/nio/ch/WindowsAsynchronousFileChannelImpl.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2008, 2011, 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
diff --git a/jdk/src/windows/classes/sun/nio/ch/WindowsAsynchronousSocketChannelImpl.java b/jdk/src/windows/classes/sun/nio/ch/WindowsAsynchronousSocketChannelImpl.java
index 2cc9cf026af..a55e7a01a9d 100644
--- a/jdk/src/windows/classes/sun/nio/ch/WindowsAsynchronousSocketChannelImpl.java
+++ b/jdk/src/windows/classes/sun/nio/ch/WindowsAsynchronousSocketChannelImpl.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2008, 2009, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2008, 2011, 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
diff --git a/jdk/src/windows/classes/sun/nio/fs/RegistryFileTypeDetector.java b/jdk/src/windows/classes/sun/nio/fs/RegistryFileTypeDetector.java
index 8c846c1c219..e04cd746039 100644
--- a/jdk/src/windows/classes/sun/nio/fs/RegistryFileTypeDetector.java
+++ b/jdk/src/windows/classes/sun/nio/fs/RegistryFileTypeDetector.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2008, 2009, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2008, 2011, 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
diff --git a/jdk/src/windows/classes/sun/nio/fs/WindowsFileAttributeViews.java b/jdk/src/windows/classes/sun/nio/fs/WindowsFileAttributeViews.java
index 8a81b87a0ab..737bbd73e98 100644
--- a/jdk/src/windows/classes/sun/nio/fs/WindowsFileAttributeViews.java
+++ b/jdk/src/windows/classes/sun/nio/fs/WindowsFileAttributeViews.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2008, 2009, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2008, 2011, 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
@@ -157,6 +157,11 @@ class WindowsFileAttributeViews {
private static final String HIDDEN_NAME = "hidden";
private static final String ATTRIBUTES_NAME = "attributes";
+ // the names of the DOS attribtues (includes basic)
+ static final Set dosAttributeNames =
+ Util.newSet(basicAttributeNames,
+ READONLY_NAME, ARCHIVE_NAME, SYSTEM_NAME, HIDDEN_NAME, ATTRIBUTES_NAME);
+
Dos(WindowsPath file, boolean followLinks) {
super(file, followLinks);
}
@@ -193,9 +198,10 @@ class WindowsFileAttributeViews {
public Map readAttributes(String[] attributes)
throws IOException
{
- AttributesBuilder builder = AttributesBuilder.create(attributes);
+ AttributesBuilder builder =
+ AttributesBuilder.create(dosAttributeNames, attributes);
WindowsFileAttributes attrs = readAttributes();
- addBasicAttributesToBuilder(attrs, builder);
+ addRequestedBasicAttributes(attrs, builder);
if (builder.match(READONLY_NAME))
builder.add(READONLY_NAME, attrs.isReadOnly());
if (builder.match(ARCHIVE_NAME))
diff --git a/jdk/src/windows/classes/sun/nio/fs/WindowsFileCopy.java b/jdk/src/windows/classes/sun/nio/fs/WindowsFileCopy.java
index ed3421fb90e..a8ffba1c933 100644
--- a/jdk/src/windows/classes/sun/nio/fs/WindowsFileCopy.java
+++ b/jdk/src/windows/classes/sun/nio/fs/WindowsFileCopy.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2008, 2009, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2008, 2011, 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
diff --git a/jdk/src/windows/classes/sun/nio/fs/WindowsFileStore.java b/jdk/src/windows/classes/sun/nio/fs/WindowsFileStore.java
index 07eb73231ce..a18af6d1011 100644
--- a/jdk/src/windows/classes/sun/nio/fs/WindowsFileStore.java
+++ b/jdk/src/windows/classes/sun/nio/fs/WindowsFileStore.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2008, 2009, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2008, 2011, 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
diff --git a/jdk/src/windows/classes/sun/nio/fs/WindowsFileSystem.java b/jdk/src/windows/classes/sun/nio/fs/WindowsFileSystem.java
index 59891ec51d5..6dba2bc9394 100644
--- a/jdk/src/windows/classes/sun/nio/fs/WindowsFileSystem.java
+++ b/jdk/src/windows/classes/sun/nio/fs/WindowsFileSystem.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2008, 2009, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2008, 2011, 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
diff --git a/jdk/src/windows/classes/sun/nio/fs/WindowsFileSystemProvider.java b/jdk/src/windows/classes/sun/nio/fs/WindowsFileSystemProvider.java
index 6d6a4db89b2..bff9e0a60dc 100644
--- a/jdk/src/windows/classes/sun/nio/fs/WindowsFileSystemProvider.java
+++ b/jdk/src/windows/classes/sun/nio/fs/WindowsFileSystemProvider.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2008, 2009, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2008, 2011, 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
@@ -150,20 +150,6 @@ public class WindowsFileSystemProvider
}
}
- private boolean followLinks(LinkOption... options) {
- boolean followLinks = true;
- for (LinkOption option: options) {
- if (option == LinkOption.NOFOLLOW_LINKS) {
- followLinks = false;
- continue;
- }
- if (option == null)
- throw new NullPointerException();
- throw new AssertionError("Should not get here");
- }
- return followLinks;
- }
-
@Override
@SuppressWarnings("unchecked")
public V
@@ -172,7 +158,7 @@ public class WindowsFileSystemProvider
WindowsPath file = WindowsPath.toWindowsPath(obj);
if (view == null)
throw new NullPointerException();
- boolean followLinks = followLinks(options);
+ boolean followLinks = Util.followLinks(options);
if (view == BasicFileAttributeView.class)
return (V) WindowsFileAttributeViews.createBasicView(file, followLinks);
if (view == DosFileAttributeView.class)
@@ -209,7 +195,7 @@ public class WindowsFileSystemProvider
@Override
public DynamicFileAttributeView getFileAttributeView(Path obj, String name, LinkOption... options) {
WindowsPath file = WindowsPath.toWindowsPath(obj);
- boolean followLinks = followLinks(options);
+ boolean followLinks = Util.followLinks(options);
if (name.equals("basic"))
return WindowsFileAttributeViews.createBasicView(file, followLinks);
if (name.equals("dos"))
diff --git a/jdk/src/windows/classes/sun/nio/fs/WindowsPath.java b/jdk/src/windows/classes/sun/nio/fs/WindowsPath.java
index 26c2b26ce8e..e84db2af231 100644
--- a/jdk/src/windows/classes/sun/nio/fs/WindowsPath.java
+++ b/jdk/src/windows/classes/sun/nio/fs/WindowsPath.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2008, 2009, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2008, 2011, 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
@@ -646,7 +646,9 @@ class WindowsPath extends AbstractPath {
@Override
public boolean startsWith(Path obj) {
- WindowsPath other = toWindowsPath(obj);
+ if (!(Objects.requireNonNull(obj) instanceof WindowsPath))
+ return false;
+ WindowsPath other = (WindowsPath)obj;
// if this path has a root component the given path's root must match
if (!this.root.equalsIgnoreCase(other.root)) {
@@ -675,7 +677,9 @@ class WindowsPath extends AbstractPath {
@Override
public boolean endsWith(Path obj) {
- WindowsPath other = toWindowsPath(obj);
+ if (!(Objects.requireNonNull(obj) instanceof WindowsPath))
+ return false;
+ WindowsPath other = (WindowsPath)obj;
// other path is longer
if (other.path.length() > this.path.length()) {
@@ -827,9 +831,9 @@ class WindowsPath extends AbstractPath {
}
@Override
- public WindowsPath toRealPath(boolean resolveLinks) throws IOException {
+ public WindowsPath toRealPath(LinkOption... options) throws IOException {
checkRead();
- String rp = WindowsLinkSupport.getRealPath(this, resolveLinks);
+ String rp = WindowsLinkSupport.getRealPath(this, Util.followLinks(options));
return createFromNormalizedPath(getFileSystem(), rp);
}
diff --git a/jdk/src/windows/classes/sun/nio/fs/WindowsPathParser.java b/jdk/src/windows/classes/sun/nio/fs/WindowsPathParser.java
index e898fd55fd2..f1158e5f7de 100644
--- a/jdk/src/windows/classes/sun/nio/fs/WindowsPathParser.java
+++ b/jdk/src/windows/classes/sun/nio/fs/WindowsPathParser.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2008, 2009, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2008, 2011, 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
diff --git a/jdk/src/windows/classes/sun/nio/fs/WindowsSecurityDescriptor.java b/jdk/src/windows/classes/sun/nio/fs/WindowsSecurityDescriptor.java
index 7d9464e0ce4..fb432271cc6 100644
--- a/jdk/src/windows/classes/sun/nio/fs/WindowsSecurityDescriptor.java
+++ b/jdk/src/windows/classes/sun/nio/fs/WindowsSecurityDescriptor.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2008, 2009, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2008, 2011, 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
diff --git a/jdk/src/windows/classes/sun/nio/fs/WindowsUserDefinedFileAttributeView.java b/jdk/src/windows/classes/sun/nio/fs/WindowsUserDefinedFileAttributeView.java
index 5ae901fe8cd..45f5d064459 100644
--- a/jdk/src/windows/classes/sun/nio/fs/WindowsUserDefinedFileAttributeView.java
+++ b/jdk/src/windows/classes/sun/nio/fs/WindowsUserDefinedFileAttributeView.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2008, 2009, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2008, 2011, 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
diff --git a/jdk/src/windows/classes/sun/nio/fs/WindowsWatchService.java b/jdk/src/windows/classes/sun/nio/fs/WindowsWatchService.java
index 53f2fa2af56..d5ad78fee9b 100644
--- a/jdk/src/windows/classes/sun/nio/fs/WindowsWatchService.java
+++ b/jdk/src/windows/classes/sun/nio/fs/WindowsWatchService.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2008, 2009, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2008, 2011, 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
diff --git a/jdk/src/windows/classes/sun/print/Win32PrintService.java b/jdk/src/windows/classes/sun/print/Win32PrintService.java
index e9f1eb7df82..bef2213e664 100644
--- a/jdk/src/windows/classes/sun/print/Win32PrintService.java
+++ b/jdk/src/windows/classes/sun/print/Win32PrintService.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2000, 2008, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2011, 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
diff --git a/jdk/src/windows/demo/jvmti/hprof/hprof_md.c b/jdk/src/windows/demo/jvmti/hprof/hprof_md.c
index 03e77f635d5..073a946d2e4 100644
--- a/jdk/src/windows/demo/jvmti/hprof/hprof_md.c
+++ b/jdk/src/windows/demo/jvmti/hprof/hprof_md.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2003, 2005, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2011, Oracle and/or its affiliates. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
diff --git a/jdk/src/windows/native/com/sun/management/OperatingSystem_md.c b/jdk/src/windows/native/com/sun/management/OperatingSystem_md.c
index c8e72bf73a7..9422ee2dc86 100644
--- a/jdk/src/windows/native/com/sun/management/OperatingSystem_md.c
+++ b/jdk/src/windows/native/com/sun/management/OperatingSystem_md.c
@@ -30,6 +30,7 @@
#include "management.h"
#include "com_sun_management_OperatingSystem.h"
+#include
#include
#include
@@ -53,41 +54,12 @@ static jlong jlong_from(jint h, jint l) {
return result;
}
-// From psapi.h
-typedef struct _PROCESS_MEMORY_COUNTERS {
- DWORD cb;
- DWORD PageFaultCount;
- SIZE_T PeakWorkingSetSize;
- SIZE_T WorkingSetSize;
- SIZE_T QuotaPeakPagedPoolUsage;
- SIZE_T QuotaPagedPoolUsage;
- SIZE_T QuotaPeakNonPagedPoolUsage;
- SIZE_T QuotaNonPagedPoolUsage;
- SIZE_T PagefileUsage;
- SIZE_T PeakPagefileUsage;
-} PROCESS_MEMORY_COUNTERS;
-
-static HINSTANCE hInstPsapi = NULL;
-typedef BOOL (WINAPI *LPFNGETPROCESSMEMORYINFO)(HANDLE, PROCESS_MEMORY_COUNTERS*, DWORD);
-
-static jboolean is_nt = JNI_FALSE;
static HANDLE main_process;
JNIEXPORT void JNICALL
Java_com_sun_management_OperatingSystem_initialize
(JNIEnv *env, jclass cls)
{
- OSVERSIONINFO oi;
- oi.dwOSVersionInfoSize = sizeof(OSVERSIONINFO);
- GetVersionEx(&oi);
- switch(oi.dwPlatformId) {
- case VER_PLATFORM_WIN32_WINDOWS: is_nt = JNI_FALSE; break;
- case VER_PLATFORM_WIN32_NT: is_nt = JNI_TRUE; break;
- default:
- throw_internal_error(env, "Unsupported Platform");
- return;
- }
-
main_process = GetCurrentProcess();
}
@@ -95,31 +67,12 @@ JNIEXPORT jlong JNICALL
Java_com_sun_management_OperatingSystem_getCommittedVirtualMemorySize0
(JNIEnv *env, jobject mbean)
{
-
- /*
- * In bytes. NT/2000/XP only - using GetProcessMemoryInfo from psapi.dll
- */
- static LPFNGETPROCESSMEMORYINFO lpfnGetProcessMemoryInfo = NULL;
- static volatile jboolean psapi_inited = JNI_FALSE;
PROCESS_MEMORY_COUNTERS pmc;
-
- if (!is_nt) return -1;
-
- if (!psapi_inited) {
- psapi_inited = JNI_TRUE;
- if ((hInstPsapi = LoadLibrary("PSAPI.DLL")) == NULL) return -1;
- if ((lpfnGetProcessMemoryInfo = (LPFNGETPROCESSMEMORYINFO)
- GetProcAddress( hInstPsapi, "GetProcessMemoryInfo")) == NULL) {
- FreeLibrary(hInstPsapi);
- return -1;
- }
+ if (GetProcessMemoryInfo(main_process, &pmc, sizeof(PROCESS_MEMORY_COUNTERS)) == 0) {
+ return (jlong)-1L;
+ } else {
+ return (jlong) pmc.PagefileUsage;
}
-
- if (lpfnGetProcessMemoryInfo == NULL) return -1;
-
- lpfnGetProcessMemoryInfo(main_process, &pmc,
- sizeof(PROCESS_MEMORY_COUNTERS));
- return (jlong) pmc.PagefileUsage;
}
JNIEXPORT jlong JNICALL
@@ -148,20 +101,15 @@ Java_com_sun_management_OperatingSystem_getProcessCpuTime
FILETIME process_creation_time, process_exit_time,
process_user_time, process_kernel_time;
- // Windows NT only
- if (is_nt) {
- // Using static variables declared above
- // Units are 100-ns intervals. Convert to ns.
- GetProcessTimes(main_process, &process_creation_time,
- &process_exit_time,
- &process_kernel_time, &process_user_time);
- return (jlong_from(process_user_time.dwHighDateTime,
- process_user_time.dwLowDateTime) +
- jlong_from(process_kernel_time.dwHighDateTime,
- process_kernel_time.dwLowDateTime)) * 100;
- } else {
- return -1;
- }
+ // Using static variables declared above
+ // Units are 100-ns intervals. Convert to ns.
+ GetProcessTimes(main_process, &process_creation_time,
+ &process_exit_time,
+ &process_kernel_time, &process_user_time);
+ return (jlong_from(process_user_time.dwHighDateTime,
+ process_user_time.dwLowDateTime) +
+ jlong_from(process_kernel_time.dwHighDateTime,
+ process_kernel_time.dwLowDateTime)) * 100;
}
JNIEXPORT jlong JNICALL
diff --git a/jdk/src/windows/native/java/io/WinNTFileSystem_md.c b/jdk/src/windows/native/java/io/WinNTFileSystem_md.c
index 566b697eb8f..7d978294367 100644
--- a/jdk/src/windows/native/java/io/WinNTFileSystem_md.c
+++ b/jdk/src/windows/native/java/io/WinNTFileSystem_md.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2001, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 2011, 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,9 +23,9 @@
* questions.
*/
-/* Access APIs for Win2K and above */
+/* Access APIs for WinXP and above */
#ifndef _WIN32_WINNT
-#define _WIN32_WINNT 0x0500
+#define _WIN32_WINNT 0x0501
#endif
#include
@@ -60,13 +60,17 @@ static GetFinalPathNameByHandleProc GetFinalPathNameByHandle_func;
JNIEXPORT void JNICALL
Java_java_io_WinNTFileSystem_initIDs(JNIEnv *env, jclass cls)
{
- HANDLE handle;
+ HMODULE handle;
jclass fileClass = (*env)->FindClass(env, "java/io/File");
if (!fileClass) return;
ids.path =
(*env)->GetFieldID(env, fileClass, "path", "Ljava/lang/String;");
- handle = LoadLibrary("kernel32");
- if (handle != NULL) {
+
+ // GetFinalPathNameByHandle requires Windows Vista or newer
+ if (GetModuleHandleExW((GET_MODULE_HANDLE_EX_FLAG_FROM_ADDRESS |
+ GET_MODULE_HANDLE_EX_FLAG_UNCHANGED_REFCOUNT),
+ (LPCWSTR)&CreateFileW, &handle) != 0)
+ {
GetFinalPathNameByHandle_func = (GetFinalPathNameByHandleProc)
GetProcAddress(handle, "GetFinalPathNameByHandleW");
}
@@ -824,8 +828,6 @@ Java_java_io_WinNTFileSystem_getDriveDirectory(JNIEnv *env, jobject this,
return ret;
}
-typedef BOOL (WINAPI* GetVolumePathNameProc) (LPCWSTR, LPWSTR, DWORD);
-
JNIEXPORT jlong JNICALL
Java_java_io_WinNTFileSystem_getSpace0(JNIEnv *env, jobject this,
jobject file, jint t)
@@ -834,14 +836,7 @@ Java_java_io_WinNTFileSystem_getSpace0(JNIEnv *env, jobject this,
jlong rv = 0L;
WCHAR *pathbuf = fileToNTPath(env, file, ids.path);
- HMODULE h = LoadLibrary("kernel32");
- GetVolumePathNameProc getVolumePathNameW = NULL;
- if (h) {
- getVolumePathNameW
- = (GetVolumePathNameProc)GetProcAddress(h, "GetVolumePathNameW");
- }
-
- if (getVolumePathNameW(pathbuf, volname, MAX_PATH_LENGTH)) {
+ if (GetVolumePathNameW(pathbuf, volname, MAX_PATH_LENGTH)) {
ULARGE_INTEGER totalSpace, freeSpace, usableSpace;
if (GetDiskFreeSpaceExW(volname, &usableSpace, &totalSpace, &freeSpace)) {
switch(t) {
@@ -860,9 +855,6 @@ Java_java_io_WinNTFileSystem_getSpace0(JNIEnv *env, jobject this,
}
}
- if (h) {
- FreeLibrary(h);
- }
free(pathbuf);
return rv;
}
diff --git a/jdk/src/windows/native/java/io/canonicalize_md.c b/jdk/src/windows/native/java/io/canonicalize_md.c
index e0eadb6b82f..a7e3ccac417 100644
--- a/jdk/src/windows/native/java/io/canonicalize_md.c
+++ b/jdk/src/windows/native/java/io/canonicalize_md.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1998, 2005, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 2011, 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
diff --git a/jdk/src/windows/native/java/io/io_util_md.c b/jdk/src/windows/native/java/io/io_util_md.c
index 81a69392096..345f95588b9 100644
--- a/jdk/src/windows/native/java/io/io_util_md.c
+++ b/jdk/src/windows/native/java/io/io_util_md.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2001, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 2011, 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
diff --git a/jdk/src/windows/native/java/lang/java_props_md.c b/jdk/src/windows/native/java/lang/java_props_md.c
index 5b9332fb111..c66efbaf2fb 100644
--- a/jdk/src/windows/native/java/lang/java_props_md.c
+++ b/jdk/src/windows/native/java/lang/java_props_md.c
@@ -196,42 +196,23 @@ getHomeFromRegistry()
/*
* Code to figure out the user's home directory using shell32.dll
*/
-typedef HRESULT (WINAPI *GetSpecialFolderType)(HWND, int, LPITEMIDLIST *);
-typedef BOOL (WINAPI *GetPathFromIDListType)(LPCITEMIDLIST, LPSTR);
-
WCHAR*
getHomeFromShell32()
{
- HMODULE lib = LoadLibraryW(L"SHELL32.DLL");
- GetSpecialFolderType do_get_folder;
- GetPathFromIDListType do_get_path;
HRESULT rc;
LPITEMIDLIST item_list = 0;
WCHAR *p;
WCHAR path[MAX_PATH+1];
int size = MAX_PATH+1;
- if (lib == 0) {
- // We can't load the library !!??
- return NULL;
- }
-
- do_get_folder = (GetSpecialFolderType)GetProcAddress(lib, "SHGetSpecialFolderLocation");
- do_get_path = (GetPathFromIDListType)GetProcAddress(lib, "SHGetPathFromIDListW");
-
- if (do_get_folder == 0 || do_get_path == 0) {
- // the library doesn't hold the right functions !!??
- return NULL;
- }
-
- rc = (*do_get_folder)(NULL, CSIDL_DESKTOPDIRECTORY, &item_list);
+ rc = SHGetSpecialFolderLocation(NULL, CSIDL_DESKTOPDIRECTORY, &item_list);
if (!SUCCEEDED(rc)) {
// we can't find the shell folder.
return NULL;
}
path[0] = 0;
- (*do_get_path)(item_list, (LPSTR)path);
+ SHGetPathFromIDListW(item_list, (LPWSTR)path);
/* Get the parent of Desktop directory */
p = wcsrchr(path, L'\\');
@@ -253,17 +234,7 @@ getHomeFromShell32()
static boolean
haveMMX(void)
{
- boolean mmx = 0;
- HMODULE lib = LoadLibrary("KERNEL32");
- if (lib != NULL) {
- BOOL (WINAPI *isProcessorFeaturePresent)(DWORD) =
- (BOOL (WINAPI *)(DWORD))
- GetProcAddress(lib, "IsProcessorFeaturePresent");
- if (isProcessorFeaturePresent != NULL)
- mmx = isProcessorFeaturePresent(PF_MMX_INSTRUCTIONS_AVAILABLE);
- FreeLibrary(lib);
- }
- return mmx;
+ return IsProcessorFeaturePresent(PF_MMX_INSTRUCTIONS_AVAILABLE);
}
static const char *
@@ -532,10 +503,19 @@ GetJavaProperties(JNIEnv* env)
if (uname != NULL && wcslen(uname) > 0) {
sprops.user_name = _wcsdup(uname);
} else {
- WCHAR buf[100];
- int buflen = sizeof(buf);
- sprops.user_name =
- GetUserNameW(buf, &buflen) ? _wcsdup(buf) : L"unknown";
+ DWORD buflen = 0;
+ if (GetUserNameW(NULL, &buflen) == 0 &&
+ GetLastError() == ERROR_INSUFFICIENT_BUFFER)
+ {
+ uname = (WCHAR*)malloc(buflen * sizeof(WCHAR));
+ if (uname != NULL && GetUserNameW(uname, &buflen) == 0) {
+ free(uname);
+ uname = NULL;
+ }
+ } else {
+ uname = NULL;
+ }
+ sprops.user_name = (uname != NULL) ? uname : L"unknown";
}
}
@@ -633,8 +613,8 @@ GetJavaProperties(JNIEnv* env)
/* Current directory */
{
WCHAR buf[MAX_PATH];
- GetCurrentDirectoryW(sizeof(buf), buf);
- sprops.user_dir = _wcsdup(buf);
+ if (GetCurrentDirectoryW(sizeof(buf)/sizeof(WCHAR), buf) != 0)
+ sprops.user_dir = _wcsdup(buf);
}
sprops.file_separator = "\\";
diff --git a/jdk/src/windows/native/java/net/Inet4AddressImpl.c b/jdk/src/windows/native/java/net/Inet4AddressImpl.c
index 197800dc59b..4bbcfc782b3 100644
--- a/jdk/src/windows/native/java/net/Inet4AddressImpl.c
+++ b/jdk/src/windows/native/java/net/Inet4AddressImpl.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2000, 2008, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2011, 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
diff --git a/jdk/src/windows/native/java/net/Inet6AddressImpl.c b/jdk/src/windows/native/java/net/Inet6AddressImpl.c
index 1f9a6779e6e..efdcd54662b 100644
--- a/jdk/src/windows/native/java/net/Inet6AddressImpl.c
+++ b/jdk/src/windows/native/java/net/Inet6AddressImpl.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2000, 2008, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2011, 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
@@ -90,6 +90,7 @@ Java_java_net_Inet6AddressImpl_lookupAllHostAddr(JNIEnv *env, jobject this,
jobjectArray ret = 0;
int retLen = 0;
jboolean preferIPv6Address;
+ static jfieldID ia_preferIPv6AddressID;
int error=0;
struct addrinfo hints, *res, *resNew = NULL;
@@ -116,166 +117,163 @@ Java_java_net_Inet6AddressImpl_lookupAllHostAddr(JNIEnv *env, jobject this,
hostname = JNU_GetStringPlatformChars(env, host, JNI_FALSE);
CHECK_NULL_RETURN(hostname, NULL);
- if (NET_addrtransAvailable()) {
- static jfieldID ia_preferIPv6AddressID;
- if (ia_preferIPv6AddressID == NULL) {
- jclass c = (*env)->FindClass(env,"java/net/InetAddress");
- if (c) {
- ia_preferIPv6AddressID =
- (*env)->GetStaticFieldID(env, c, "preferIPv6Address", "Z");
- }
- if (ia_preferIPv6AddressID == NULL) {
- JNU_ReleaseStringPlatformChars(env, host, hostname);
- return NULL;
- }
+ if (ia_preferIPv6AddressID == NULL) {
+ jclass c = (*env)->FindClass(env,"java/net/InetAddress");
+ if (c) {
+ ia_preferIPv6AddressID =
+ (*env)->GetStaticFieldID(env, c, "preferIPv6Address", "Z");
}
- /* get the address preference */
- preferIPv6Address
- = (*env)->GetStaticBooleanField(env, ia_class, ia_preferIPv6AddressID);
-
- /* Try once, with our static buffer. */
- memset(&hints, 0, sizeof(hints));
- hints.ai_flags = AI_CANONNAME;
- hints.ai_family = AF_UNSPEC;
-
- error = (*getaddrinfo_ptr)(hostname, NULL, &hints, &res);
-
- if (error) {
- /* report error */
- JNU_ThrowByName(env, JNU_JAVANETPKG "UnknownHostException",
- (char *)hostname);
+ if (ia_preferIPv6AddressID == NULL) {
JNU_ReleaseStringPlatformChars(env, host, hostname);
return NULL;
- } else {
- int i = 0;
- int inetCount = 0, inet6Count = 0, inetIndex, inet6Index;
- struct addrinfo *itr, *last, *iterator = res;
- while (iterator != NULL) {
- int skip = 0;
- itr = resNew;
- while (itr != NULL) {
- if (iterator->ai_family == itr->ai_family &&
- iterator->ai_addrlen == itr->ai_addrlen) {
- if (itr->ai_family == AF_INET) { /* AF_INET */
- struct sockaddr_in *addr1, *addr2;
- addr1 = (struct sockaddr_in *)iterator->ai_addr;
- addr2 = (struct sockaddr_in *)itr->ai_addr;
- if (addr1->sin_addr.s_addr ==
- addr2->sin_addr.s_addr) {
- skip = 1;
- break;
- }
- } else {
- int t;
- struct sockaddr_in6 *addr1, *addr2;
- addr1 = (struct sockaddr_in6 *)iterator->ai_addr;
- addr2 = (struct sockaddr_in6 *)itr->ai_addr;
+ }
+ }
+ /* get the address preference */
+ preferIPv6Address
+ = (*env)->GetStaticBooleanField(env, ia_class, ia_preferIPv6AddressID);
- for (t = 0; t < 16; t++) {
- if (addr1->sin6_addr.s6_addr[t] !=
- addr2->sin6_addr.s6_addr[t]) {
- break;
- }
- }
- if (t < 16) {
- itr = itr->ai_next;
- continue;
- } else {
- skip = 1;
+ /* Try once, with our static buffer. */
+ memset(&hints, 0, sizeof(hints));
+ hints.ai_flags = AI_CANONNAME;
+ hints.ai_family = AF_UNSPEC;
+
+ error = getaddrinfo(hostname, NULL, &hints, &res);
+
+ if (error) {
+ /* report error */
+ JNU_ThrowByName(env, JNU_JAVANETPKG "UnknownHostException",
+ (char *)hostname);
+ JNU_ReleaseStringPlatformChars(env, host, hostname);
+ return NULL;
+ } else {
+ int i = 0;
+ int inetCount = 0, inet6Count = 0, inetIndex, inet6Index;
+ struct addrinfo *itr, *last, *iterator = res;
+ while (iterator != NULL) {
+ int skip = 0;
+ itr = resNew;
+ while (itr != NULL) {
+ if (iterator->ai_family == itr->ai_family &&
+ iterator->ai_addrlen == itr->ai_addrlen) {
+ if (itr->ai_family == AF_INET) { /* AF_INET */
+ struct sockaddr_in *addr1, *addr2;
+ addr1 = (struct sockaddr_in *)iterator->ai_addr;
+ addr2 = (struct sockaddr_in *)itr->ai_addr;
+ if (addr1->sin_addr.s_addr ==
+ addr2->sin_addr.s_addr) {
+ skip = 1;
+ break;
+ }
+ } else {
+ int t;
+ struct sockaddr_in6 *addr1, *addr2;
+ addr1 = (struct sockaddr_in6 *)iterator->ai_addr;
+ addr2 = (struct sockaddr_in6 *)itr->ai_addr;
+
+ for (t = 0; t < 16; t++) {
+ if (addr1->sin6_addr.s6_addr[t] !=
+ addr2->sin6_addr.s6_addr[t]) {
break;
}
}
- } else if (iterator->ai_family != AF_INET &&
- iterator->ai_family != AF_INET6) {
- /* we can't handle other family types */
- skip = 1;
- break;
+ if (t < 16) {
+ itr = itr->ai_next;
+ continue;
+ } else {
+ skip = 1;
+ break;
+ }
}
- itr = itr->ai_next;
+ } else if (iterator->ai_family != AF_INET &&
+ iterator->ai_family != AF_INET6) {
+ /* we can't handle other family types */
+ skip = 1;
+ break;
}
+ itr = itr->ai_next;
+ }
- if (!skip) {
- struct addrinfo *next
- = (struct addrinfo*) malloc(sizeof(struct addrinfo));
- if (!next) {
- JNU_ThrowOutOfMemoryError(env, "heap allocation failed");
- ret = NULL;
- goto cleanupAndReturn;
- }
- memcpy(next, iterator, sizeof(struct addrinfo));
- next->ai_next = NULL;
- if (resNew == NULL) {
- resNew = next;
- } else {
- last->ai_next = next;
- }
- last = next;
- i++;
- if (iterator->ai_family == AF_INET) {
- inetCount ++;
- } else if (iterator->ai_family == AF_INET6) {
- inet6Count ++;
- }
+ if (!skip) {
+ struct addrinfo *next
+ = (struct addrinfo*) malloc(sizeof(struct addrinfo));
+ if (!next) {
+ JNU_ThrowOutOfMemoryError(env, "heap allocation failed");
+ ret = NULL;
+ goto cleanupAndReturn;
}
- iterator = iterator->ai_next;
- }
- retLen = i;
- iterator = resNew;
- i = 0;
- ret = (*env)->NewObjectArray(env, retLen, ni_iacls, NULL);
-
- if (IS_NULL(ret)) {
- /* we may have memory to free at the end of this */
- goto cleanupAndReturn;
- }
-
- if (preferIPv6Address) {
- inetIndex = inet6Count;
- inet6Index = 0;
- } else {
- inetIndex = 0;
- inet6Index = inetCount;
- }
-
- while (iterator != NULL) {
+ memcpy(next, iterator, sizeof(struct addrinfo));
+ next->ai_next = NULL;
+ if (resNew == NULL) {
+ resNew = next;
+ } else {
+ last->ai_next = next;
+ }
+ last = next;
+ i++;
if (iterator->ai_family == AF_INET) {
- jobject iaObj = (*env)->NewObject(env, ni_ia4cls, ni_ia4ctrID);
- if (IS_NULL(iaObj)) {
- ret = NULL;
- goto cleanupAndReturn;
- }
- (*env)->SetIntField(env, iaObj, ni_iaaddressID,
- ntohl(((struct sockaddr_in*)iterator->ai_addr)->sin_addr.s_addr));
- (*env)->SetObjectField(env, iaObj, ni_iahostID, host);
- (*env)->SetObjectArrayElement(env, ret, inetIndex, iaObj);
- inetIndex ++;
+ inetCount ++;
} else if (iterator->ai_family == AF_INET6) {
- jint scope = 0;
- jbyteArray ipaddress;
- jobject iaObj = (*env)->NewObject(env, ni_ia6cls, ni_ia6ctrID);
- if (IS_NULL(iaObj)) {
- ret = NULL;
- goto cleanupAndReturn;
- }
- ipaddress = (*env)->NewByteArray(env, 16);
- if (IS_NULL(ipaddress)) {
- ret = NULL;
- goto cleanupAndReturn;
- }
- (*env)->SetByteArrayRegion(env, ipaddress, 0, 16,
- (jbyte *)&(((struct sockaddr_in6*)iterator->ai_addr)->sin6_addr));
- scope = ((struct sockaddr_in6*)iterator->ai_addr)->sin6_scope_id;
- if (scope != 0) { /* zero is default value, no need to set */
- (*env)->SetIntField(env, iaObj, ia6_scopeidID, scope);
- (*env)->SetBooleanField(env, iaObj, ia6_scopeidsetID, JNI_TRUE);
- }
- (*env)->SetObjectField(env, iaObj, ni_ia6ipaddressID, ipaddress);
- (*env)->SetObjectField(env, iaObj, ni_iahostID, host);
- (*env)->SetObjectArrayElement(env, ret, inet6Index, iaObj);
- inet6Index ++;
+ inet6Count ++;
}
- iterator = iterator->ai_next;
}
+ iterator = iterator->ai_next;
+ }
+ retLen = i;
+ iterator = resNew;
+ i = 0;
+ ret = (*env)->NewObjectArray(env, retLen, ni_iacls, NULL);
+
+ if (IS_NULL(ret)) {
+ /* we may have memory to free at the end of this */
+ goto cleanupAndReturn;
+ }
+
+ if (preferIPv6Address) {
+ inetIndex = inet6Count;
+ inet6Index = 0;
+ } else {
+ inetIndex = 0;
+ inet6Index = inetCount;
+ }
+
+ while (iterator != NULL) {
+ if (iterator->ai_family == AF_INET) {
+ jobject iaObj = (*env)->NewObject(env, ni_ia4cls, ni_ia4ctrID);
+ if (IS_NULL(iaObj)) {
+ ret = NULL;
+ goto cleanupAndReturn;
+ }
+ (*env)->SetIntField(env, iaObj, ni_iaaddressID,
+ ntohl(((struct sockaddr_in*)iterator->ai_addr)->sin_addr.s_addr));
+ (*env)->SetObjectField(env, iaObj, ni_iahostID, host);
+ (*env)->SetObjectArrayElement(env, ret, inetIndex, iaObj);
+ inetIndex ++;
+ } else if (iterator->ai_family == AF_INET6) {
+ jint scope = 0;
+ jbyteArray ipaddress;
+ jobject iaObj = (*env)->NewObject(env, ni_ia6cls, ni_ia6ctrID);
+ if (IS_NULL(iaObj)) {
+ ret = NULL;
+ goto cleanupAndReturn;
+ }
+ ipaddress = (*env)->NewByteArray(env, 16);
+ if (IS_NULL(ipaddress)) {
+ ret = NULL;
+ goto cleanupAndReturn;
+ }
+ (*env)->SetByteArrayRegion(env, ipaddress, 0, 16,
+ (jbyte *)&(((struct sockaddr_in6*)iterator->ai_addr)->sin6_addr));
+ scope = ((struct sockaddr_in6*)iterator->ai_addr)->sin6_scope_id;
+ if (scope != 0) { /* zero is default value, no need to set */
+ (*env)->SetIntField(env, iaObj, ia6_scopeidID, scope);
+ (*env)->SetBooleanField(env, iaObj, ia6_scopeidsetID, JNI_TRUE);
+ }
+ (*env)->SetObjectField(env, iaObj, ni_ia6ipaddressID, ipaddress);
+ (*env)->SetObjectField(env, iaObj, ni_iahostID, host);
+ (*env)->SetObjectArrayElement(env, ret, inet6Index, iaObj);
+ inet6Index ++;
+ }
+ iterator = iterator->ai_next;
}
}
@@ -291,8 +289,7 @@ cleanupAndReturn:
JNU_ReleaseStringPlatformChars(env, host, hostname);
}
- if (NET_addrtransAvailable())
- (*freeaddrinfo_ptr)(res);
+ freeaddrinfo(res);
return ret;
}
@@ -312,44 +309,41 @@ Java_java_net_Inet6AddressImpl_getHostByAddr(JNIEnv *env, jobject this,
int len = 0;
jbyte caddr[16];
- if (NET_addrtransAvailable()) {
- struct sockaddr_in him4;
- struct sockaddr_in6 him6;
- struct sockaddr *sa;
+ struct sockaddr_in him4;
+ struct sockaddr_in6 him6;
+ struct sockaddr *sa;
+ /*
+ * For IPv4 addresses construct a sockaddr_in structure.
+ */
+ if ((*env)->GetArrayLength(env, addrArray) == 4) {
+ jint addr;
+ (*env)->GetByteArrayRegion(env, addrArray, 0, 4, caddr);
+ addr = ((caddr[0]<<24) & 0xff000000);
+ addr |= ((caddr[1] <<16) & 0xff0000);
+ addr |= ((caddr[2] <<8) & 0xff00);
+ addr |= (caddr[3] & 0xff);
+ memset((char *) &him4, 0, sizeof(him4));
+ him4.sin_addr.s_addr = (uint32_t) htonl(addr);
+ him4.sin_family = AF_INET;
+ sa = (struct sockaddr *) &him4;
+ len = sizeof(him4);
+ } else {
/*
- * For IPv4 addresses construct a sockaddr_in structure.
+ * For IPv6 address construct a sockaddr_in6 structure.
*/
- if ((*env)->GetArrayLength(env, addrArray) == 4) {
- jint addr;
- (*env)->GetByteArrayRegion(env, addrArray, 0, 4, caddr);
- addr = ((caddr[0]<<24) & 0xff000000);
- addr |= ((caddr[1] <<16) & 0xff0000);
- addr |= ((caddr[2] <<8) & 0xff00);
- addr |= (caddr[3] & 0xff);
- memset((char *) &him4, 0, sizeof(him4));
- him4.sin_addr.s_addr = (uint32_t) htonl(addr);
- him4.sin_family = AF_INET;
- sa = (struct sockaddr *) &him4;
- len = sizeof(him4);
- } else {
- /*
- * For IPv6 address construct a sockaddr_in6 structure.
- */
- (*env)->GetByteArrayRegion(env, addrArray, 0, 16, caddr);
- memset((char *) &him6, 0, sizeof(him6));
- memcpy((void *)&(him6.sin6_addr), caddr, sizeof(struct in6_addr) );
- him6.sin6_family = AF_INET6;
- sa = (struct sockaddr *) &him6 ;
- len = sizeof(him6) ;
- }
+ (*env)->GetByteArrayRegion(env, addrArray, 0, 16, caddr);
+ memset((char *) &him6, 0, sizeof(him6));
+ memcpy((void *)&(him6.sin6_addr), caddr, sizeof(struct in6_addr) );
+ him6.sin6_family = AF_INET6;
+ sa = (struct sockaddr *) &him6 ;
+ len = sizeof(him6) ;
+ }
- error = (*getnameinfo_ptr)(sa, len, host, NI_MAXHOST, NULL, 0,
- NI_NAMEREQD);
+ error = getnameinfo(sa, len, host, NI_MAXHOST, NULL, 0, NI_NAMEREQD);
- if (!error) {
- ret = (*env)->NewStringUTF(env, host);
- }
+ if (!error) {
+ ret = (*env)->NewStringUTF(env, host);
}
if (ret == NULL) {
diff --git a/jdk/src/windows/native/java/net/NetworkInterface.c b/jdk/src/windows/native/java/net/NetworkInterface.c
index 6a318722414..fa5dfc13f61 100644
--- a/jdk/src/windows/native/java/net/NetworkInterface.c
+++ b/jdk/src/windows/native/java/net/NetworkInterface.c
@@ -53,36 +53,6 @@
* order and this ensures consistent device number across invocations.
*/
-
-/* IP helper library routines */
-int (PASCAL FAR *GetIpAddrTable_fn)();
-int (PASCAL FAR *GetIfTable_fn)();
-int (PASCAL FAR *GetFriendlyIfIndex_fn)();
-int (PASCAL FAR *GetAdaptersAddresses_fn)();
-int (PASCAL FAR *GetAdaptersInfo_fn)();
-int (PASCAL FAR *GetNumberOfInterfaces_fn)();
-
-/* Enumeration routines */
-typedef int (*EnumerateNetInterfaces)(JNIEnv *, netif **);
-typedef int(*EnumerateNetAddresses)(JNIEnv *, netif *, netaddr **);
-
-static EnumerateNetInterfaces enumInterfaces_fn;
-static EnumerateNetAddresses enumAddresses_fn;
-
-/* Windows 9x routines are external (not needed on 64-bit) */
-#ifndef _WIN64
-extern int enumInterfaces_win9x(JNIEnv *, netif **);
-extern int enumAddresses_win9x(JNIEnv *, netif *, netaddr **);
-extern int init_win9x(void);
-#endif
-
-
-/* Windows 95/98/ME running */
-static jboolean isW9x;
-
-/* Windows version supports */
-static jboolean os_supports_ipv6;
-
/* various JNI ids */
jclass ni_class; /* NetworkInterface */
@@ -154,10 +124,10 @@ MIB_IFROW *getIF(jint index) {
*/
size = sizeof(MIB_IFTABLE);
tableP = (MIB_IFTABLE *)malloc(size);
- count = (*GetIfTable_fn)(tableP, &size, TRUE);
+ count = GetIfTable(tableP, &size, TRUE);
if (count == ERROR_INSUFFICIENT_BUFFER || count == ERROR_BUFFER_OVERFLOW) {
tableP = (MIB_IFTABLE *)realloc(tableP, size);
- count = (*GetIfTable_fn)(tableP, &size, TRUE);
+ count = GetIfTable(tableP, &size, TRUE);
}
if (count != NO_ERROR) {
@@ -172,7 +142,7 @@ MIB_IFROW *getIF(jint index) {
/*
* Warning the real index is obtained by GetFriendlyIfIndex()
*/
- ifindex = (*GetFriendlyIfIndex_fn)(ifrowP->dwIndex);
+ ifindex = GetFriendlyIfIndex(ifrowP->dwIndex);
if (ifindex == index) {
/*
* Create a copy of the entry so that we can free the table.
@@ -199,7 +169,7 @@ MIB_IFROW *getIF(jint index) {
* occurs then netifPP be returned as list of netif structures or NULL
* if no interfaces are found.
*/
-int enumInterfaces_win(JNIEnv *env, netif **netifPP)
+int enumInterfaces(JNIEnv *env, netif **netifPP)
{
MIB_IFTABLE *tableP;
MIB_IFROW *ifrowP;
@@ -215,32 +185,16 @@ int enumInterfaces_win(JNIEnv *env, netif **netifPP)
*/
size = sizeof(MIB_IFTABLE);
tableP = (MIB_IFTABLE *)malloc(size);
- ret = (*GetIfTable_fn)(tableP, &size, TRUE);
+ ret = GetIfTable(tableP, &size, TRUE);
if (ret == ERROR_INSUFFICIENT_BUFFER || ret == ERROR_BUFFER_OVERFLOW) {
tableP = (MIB_IFTABLE *)realloc(tableP, size);
- ret = (*GetIfTable_fn)(tableP, &size, TRUE);
+ ret = GetIfTable(tableP, &size, TRUE);
}
if (ret != NO_ERROR) {
if (tableP != NULL)
free(tableP);
-#ifndef _WIN64
- if (isW9x && ret == ERROR_NOT_SUPPORTED) {
- /*
- * If ERROR_NOT_SUPPORTED is returned on Windows 98 it means that
- * IE5.0 has been installed. In this case we revert to the Windows 95
- * approach and avoid using the IP Helper Library.
- * See: http://support.microsoft.com/support/kb/articles/q234/5/73.asp
- */
- enumInterfaces_fn = enumInterfaces_win9x;
- enumAddresses_fn = enumAddresses_win9x;
- init_win9x();
-
- return (*enumInterfaces_fn)(env, netifPP);
- }
-#endif
-
JNU_ThrowByName(env, "java/lang/Error",
"IP Helper Library GetIfTable function failed");
@@ -328,7 +282,7 @@ int enumInterfaces_win(JNIEnv *env, netif **netifPP)
curr->displayName[ifrowP->dwDescrLen] = '\0';
curr->dwIndex = ifrowP->dwIndex;
curr->ifType = ifrowP->dwType;
- curr->index = (*GetFriendlyIfIndex_fn)(ifrowP->dwIndex);
+ curr->index = GetFriendlyIfIndex(ifrowP->dwIndex);
/*
* Put the interface at tail of list as GetIfTable(,,TRUE) is
@@ -384,10 +338,10 @@ int enumAddresses_win(JNIEnv *env, netif *netifP, netaddr **netaddrPP)
size = sizeof(MIB_IPADDRTABLE);
tableP = (MIB_IPADDRTABLE *)malloc(size);
- ret = (*GetIpAddrTable_fn)(&tableP, &size, FALSE);
+ ret = GetIpAddrTable(tableP, &size, FALSE);
if (ret == ERROR_INSUFFICIENT_BUFFER || ret == ERROR_BUFFER_OVERFLOW) {
tableP = (MIB_IPADDRTABLE *)realloc(tableP, size);
- ret = (*GetIpAddrTable_fn)(tableP, &size, FALSE);
+ ret = GetIpAddrTable(tableP, &size, FALSE);
}
if (ret != NO_ERROR) {
if (tableP) {
@@ -477,71 +431,6 @@ int enumAddresses_win(JNIEnv *env, netif *netifP, netaddr **netaddrPP)
JNIEXPORT void JNICALL
Java_java_net_NetworkInterface_init(JNIEnv *env, jclass cls)
{
- OSVERSIONINFO ver;
- HANDLE h;
-
- /*
- * First check if this is a Windows 9x machine.
- */
- ver.dwOSVersionInfoSize = sizeof(ver);
- GetVersionEx(&ver);
- if (ver.dwPlatformId == VER_PLATFORM_WIN32_WINDOWS && ver.dwMajorVersion == 4) {
- isW9x = JNI_TRUE;
- }
-
- /*
- * Try to load the IP Helper Library and obtain the entry points we
- * require. This will succeed on 98, NT SP4+, 2000 & XP. It will
- * fail on Windows 95 (if IE hasn't been updated) and old versions
- * of NT (IP helper library only appeared at SP4). If it fails on
- * Windows 9x we will use the registry approach, otherwise if it
- * fails we throw an Error indicating that we have an incompatible
- * IP helper library.
- */
- h = LoadLibrary("iphlpapi.dll");
- if (h != NULL) {
- GetIpAddrTable_fn =
- (int (PASCAL FAR *)())GetProcAddress(h, "GetIpAddrTable");
- GetIfTable_fn =
- (int (PASCAL FAR *)())GetProcAddress(h, "GetIfTable");
- GetFriendlyIfIndex_fn =
- (int (PASCAL FAR *)())GetProcAddress(h, "GetFriendlyIfIndex");
- GetNumberOfInterfaces_fn =
- (int (PASCAL FAR *)())GetProcAddress(h, "GetNumberOfInterfaces");
- GetAdaptersAddresses_fn =
- (int (PASCAL FAR *)())GetProcAddress(h, "GetAdaptersAddresses");
- GetAdaptersInfo_fn =
- (int (PASCAL FAR *)())GetProcAddress(h, "GetAdaptersInfo");
- }
-
- /* IPv6 is supported on Windows versions if the following APIs avail */
-
- os_supports_ipv6 = (GetAdaptersAddresses_fn != NULL) &&
- (GetNumberOfInterfaces_fn != NULL) &&
- (GetAdaptersInfo_fn != NULL);
-
- if (GetIpAddrTable_fn == NULL ||
- GetIfTable_fn == NULL ||
- GetFriendlyIfIndex_fn == NULL) {
-
-#ifndef _WIN64
- if (isW9x) {
- /* Use Windows 9x registry approach which requires initialization */
- enumInterfaces_fn = enumInterfaces_win9x;
- enumAddresses_fn = enumAddresses_win9x;
- init_win9x();
- } else
-#endif
- {
- JNU_ThrowByName(env, "java/lang/Error",
- "Incompatible IP helper library (iphlpapi.dll)");
- return;
- }
- } else {
- enumInterfaces_fn = enumInterfaces_win;
- enumAddresses_fn = enumAddresses_win;
- }
-
/*
* Get the various JNI ids that we require
*/
@@ -581,7 +470,8 @@ Java_java_net_NetworkInterface_init(JNIEnv *env, jclass cls)
* populate the InetAddress array based on the IP addresses for this
* interface.
*/
-jobject createNetworkInterface(JNIEnv *env, netif *ifs, int netaddrCount, netaddr *netaddrP)
+jobject createNetworkInterface
+ (JNIEnv *env, netif *ifs, int netaddrCount, netaddr *netaddrP)
{
jobject netifObj;
jobject name, displayName;
@@ -596,7 +486,8 @@ jobject createNetworkInterface(JNIEnv *env, netif *ifs, int netaddrCount, netadd
netifObj = (*env)->NewObject(env, ni_class, ni_ctor);
name = (*env)->NewStringUTF(env, ifs->name);
if (ifs->dNameIsUnicode) {
- displayName = (*env)->NewString(env, (PWCHAR)ifs->displayName, wcslen ((PWCHAR)ifs->displayName));
+ displayName = (*env)->NewString(env, (PWCHAR)ifs->displayName,
+ (jsize)wcslen ((PWCHAR)ifs->displayName));
} else {
displayName = (*env)->NewStringUTF(env, ifs->displayName);
}
@@ -612,7 +503,7 @@ jobject createNetworkInterface(JNIEnv *env, netif *ifs, int netaddrCount, netadd
* Note that 0 is a valid number of addresses.
*/
if (netaddrCount < 0) {
- netaddrCount = (*enumAddresses_fn)(env, ifs, &netaddrP);
+ netaddrCount = enumAddresses_win(env, ifs, &netaddrP);
if ((*env)->ExceptionOccurred(env)) {
free_netaddr(netaddrP);
return NULL;
@@ -725,12 +616,13 @@ JNIEXPORT jobject JNICALL Java_java_net_NetworkInterface_getByName0
const char *name_utf;
jobject netifObj = NULL;
- if (os_supports_ipv6 && ipv6_available()) {
+ // Retained for now to support IPv4 only stack, java.net.preferIPv4Stack
+ if (ipv6_available()) {
return Java_java_net_NetworkInterface_getByName0_XP (env, cls, name);
}
/* get the list of interfaces */
- if ((*enumInterfaces_fn)(env, &ifList) < 0) {
+ if (enumInterfaces(env, &ifList) < 0) {
return NULL;
}
@@ -771,12 +663,13 @@ JNIEXPORT jobject JNICALL Java_java_net_NetworkInterface_getByIndex0
netif *ifList, *curr;
jobject netifObj = NULL;
- if (os_supports_ipv6 && ipv6_available()) {
+ // Retained for now to support IPv4 only stack, java.net.preferIPv4Stack
+ if (ipv6_available()) {
return Java_java_net_NetworkInterface_getByIndex0_XP (env, cls, index);
}
/* get the list of interfaces */
- if ((*enumInterfaces_fn)(env, &ifList) < 0) {
+ if (enumInterfaces(env, &ifList) < 0) {
return NULL;
}
@@ -812,12 +705,13 @@ JNIEXPORT jobject JNICALL Java_java_net_NetworkInterface_getByInetAddress0
jint addr = (*env)->GetIntField(env, iaObj, ni_iaAddr);
jobject netifObj = NULL;
- if (os_supports_ipv6 && ipv6_available()) {
+ // Retained for now to support IPv4 only stack, java.net.preferIPv4Stack
+ if (ipv6_available()) {
return Java_java_net_NetworkInterface_getByInetAddress0_XP (env, cls, iaObj);
}
/* get the list of interfaces */
- if ((*enumInterfaces_fn)(env, &ifList) < 0) {
+ if (enumInterfaces(env, &ifList) < 0) {
return NULL;
}
@@ -832,7 +726,7 @@ JNIEXPORT jobject JNICALL Java_java_net_NetworkInterface_getByInetAddress0
netaddr *addrP;
/* enumerate the addresses on this interface */
- count = (*enumAddresses_fn)(env, curr, &addrList);
+ count = enumAddresses_win(env, curr, &addrList);
if (count < 0) {
free_netif(ifList);
return NULL;
@@ -881,14 +775,15 @@ JNIEXPORT jobjectArray JNICALL Java_java_net_NetworkInterface_getAll
jobjectArray netIFArr;
jint arr_index;
- if (os_supports_ipv6 && ipv6_available()) {
+ // Retained for now to support IPv4 only stack, java.net.preferIPv4Stack
+ if (ipv6_available()) {
return Java_java_net_NetworkInterface_getAll_XP (env, cls);
}
/*
* Get list of interfaces
*/
- count = (*enumInterfaces_fn)(env, &ifList);
+ count = enumInterfaces(env, &ifList);
if (count < 0) {
return NULL;
}
@@ -934,13 +829,16 @@ JNIEXPORT jboolean JNICALL Java_java_net_NetworkInterface_isUp0
(JNIEnv *env, jclass cls, jstring name, jint index) {
jboolean ret = JNI_FALSE;
- if (os_supports_ipv6 && ipv6_available()) {
+ // Retained for now to support IPv4 only stack, java.net.preferIPv4Stack
+ if (ipv6_available()) {
return Java_java_net_NetworkInterface_isUp0_XP(env, cls, name, index);
} else {
MIB_IFROW *ifRowP;
ifRowP = getIF(index);
if (ifRowP != NULL) {
- ret = ifRowP->dwAdminStatus == 1 && (ifRowP->dwOperStatus == MIB_IF_OPER_STATUS_OPERATIONAL || ifRowP->dwOperStatus == MIB_IF_OPER_STATUS_CONNECTED);
+ ret = ifRowP->dwAdminStatus == 1 &&
+ (ifRowP->dwOperStatus == MIB_IF_OPER_STATUS_OPERATIONAL ||
+ ifRowP->dwOperStatus == MIB_IF_OPER_STATUS_CONNECTED);
free(ifRowP);
}
}
@@ -952,11 +850,13 @@ JNIEXPORT jboolean JNICALL Java_java_net_NetworkInterface_isUp0
* Method: isP2P0
* Signature: (Ljava/lang/String;I)Z
*/
-JNIEXPORT jboolean JNICALL Java_java_net_NetworkInterface_isP2P0(JNIEnv *env, jclass cls, jstring name, jint index) {
+JNIEXPORT jboolean JNICALL Java_java_net_NetworkInterface_isP2P0
+ (JNIEnv *env, jclass cls, jstring name, jint index) {
MIB_IFROW *ifRowP;
jboolean ret = JNI_FALSE;
- if (os_supports_ipv6 && ipv6_available()) {
+ // Retained for now to support IPv4 only stack, java.net.preferIPv4Stack
+ if (ipv6_available()) {
return Java_java_net_NetworkInterface_isP2P0_XP(env, cls, name, index);
} else {
ifRowP = getIF(index);
@@ -983,7 +883,8 @@ JNIEXPORT jboolean JNICALL Java_java_net_NetworkInterface_isLoopback0
MIB_IFROW *ifRowP;
jboolean ret = JNI_FALSE;
- if (os_supports_ipv6 && ipv6_available()) {
+ // Retained for now to support IPv4 only stack, java.net.preferIPv4Stack
+ if (ipv6_available()) {
return Java_java_net_NetworkInterface_isLoopback0_XP(env, cls, name, index);
} else {
ifRowP = getIF(index);
@@ -1003,22 +904,8 @@ JNIEXPORT jboolean JNICALL Java_java_net_NetworkInterface_isLoopback0
*/
JNIEXPORT jboolean JNICALL Java_java_net_NetworkInterface_supportsMulticast0
(JNIEnv *env, jclass cls, jstring name, jint index) {
- MIB_IFROW *ifRowP;
- jboolean ret = JNI_TRUE;
-
- // Let's try to use the newer API (XP & 2003 only)
- if (GetAdaptersAddresses_fn != NULL) {
- ret = Java_java_net_NetworkInterface_supportsMulticast0_XP(env, cls,
+ return Java_java_net_NetworkInterface_supportsMulticast0_XP(env, cls,
name, index);
- return ret;
- }
- ifRowP = getIF(index);
- if (ifRowP != NULL) {
- if (ifRowP->dwType == MIB_IF_TYPE_LOOPBACK)
- ret = JNI_FALSE;
- free(ifRowP);
- }
- return ret;
}
/*
@@ -1026,12 +913,14 @@ JNIEXPORT jboolean JNICALL Java_java_net_NetworkInterface_supportsMulticast0
* Method: getMacAddr0
* Signature: ([bLjava/lang/String;I)[b
*/
-JNIEXPORT jbyteArray JNICALL Java_java_net_NetworkInterface_getMacAddr0(JNIEnv *env, jclass class, jbyteArray addrArray, jstring name, jint index) {
+JNIEXPORT jbyteArray JNICALL Java_java_net_NetworkInterface_getMacAddr0
+ (JNIEnv *env, jclass class, jbyteArray addrArray, jstring name, jint index) {
jbyteArray ret = NULL;
int len;
MIB_IFROW *ifRowP;
- if (os_supports_ipv6 && ipv6_available()) {
+ // Retained for now to support IPv4 only stack, java.net.preferIPv4Stack
+ if (ipv6_available()) {
return Java_java_net_NetworkInterface_getMacAddr0_XP(env, class, name, index);
} else {
ifRowP = getIF(index);
@@ -1058,11 +947,13 @@ JNIEXPORT jbyteArray JNICALL Java_java_net_NetworkInterface_getMacAddr0(JNIEnv *
* Method: getMTU0
* Signature: ([bLjava/lang/String;I)I
*/
-JNIEXPORT jint JNICALL Java_java_net_NetworkInterface_getMTU0(JNIEnv *env, jclass class, jstring name, jint index) {
+JNIEXPORT jint JNICALL Java_java_net_NetworkInterface_getMTU0
+ (JNIEnv *env, jclass class, jstring name, jint index) {
jint ret = -1;
MIB_IFROW *ifRowP;
- if (os_supports_ipv6 && ipv6_available()) {
+ // Retained for now to support IPv4 only stack, java.net.preferIPv4Stack
+ if (ipv6_available()) {
return Java_java_net_NetworkInterface_getMTU0_XP(env, class, name, index);
} else {
ifRowP = getIF(index);
diff --git a/jdk/src/windows/native/java/net/NetworkInterface.h b/jdk/src/windows/native/java/net/NetworkInterface.h
index 6d3e1c1a957..262e15a0db0 100644
--- a/jdk/src/windows/native/java/net/NetworkInterface.h
+++ b/jdk/src/windows/native/java/net/NetworkInterface.h
@@ -87,338 +87,6 @@ extern jfieldID ni_ibaddressID; /* InterfaceAddress.address */
extern jfieldID ni_ibbroadcastID; /* InterfaceAddress.broadcast */
extern jfieldID ni_ibmaskID; /* InterfaceAddress.maskLength */
-int enumInterfaces_win(JNIEnv *env, netif **netifPP);
-
-/* We have included iphlpapi.h which includes iptypes.h which has the definition
- * for MAX_ADAPTER_DESCRIPTION_LENGTH (along with the other definitions in this
- * ifndef block). Therefore if MAX_ADAPTER_DESCRIPTION_LENGTH is defined we can
- * be sure that the other definitions are also defined */
-#ifndef MAX_ADAPTER_DESCRIPTION_LENGTH
-
-/*
- * Following includes come from iptypes.h
- */
-
-#pragma warning(push)
-#pragma warning(disable:4201)
-
-#include
-
-// Definitions and structures used by getnetworkparams and getadaptersinfo apis
-
-#define MAX_ADAPTER_DESCRIPTION_LENGTH 128 // arb.
-#define MAX_ADAPTER_NAME_LENGTH 256 // arb.
-#define MAX_ADAPTER_ADDRESS_LENGTH 8 // arb.
-#define DEFAULT_MINIMUM_ENTITIES 32 // arb.
-#define MAX_HOSTNAME_LEN 128 // arb.
-#define MAX_DOMAIN_NAME_LEN 128 // arb.
-#define MAX_SCOPE_ID_LEN 256 // arb.
-
-//
-// types
-//
-
-// Node Type
-
-#define BROADCAST_NODETYPE 1
-#define PEER_TO_PEER_NODETYPE 2
-#define MIXED_NODETYPE 4
-#define HYBRID_NODETYPE 8
-
-//
-// IP_ADDRESS_STRING - store an IP address as a dotted decimal string
-//
-
-typedef struct {
- char String[4 * 4];
-} IP_ADDRESS_STRING, *PIP_ADDRESS_STRING, IP_MASK_STRING, *PIP_MASK_STRING;
-
-//
-// IP_ADDR_STRING - store an IP address with its corresponding subnet mask,
-// both as dotted decimal strings
-//
-
-typedef struct _IP_ADDR_STRING {
- struct _IP_ADDR_STRING* Next;
- IP_ADDRESS_STRING IpAddress;
- IP_MASK_STRING IpMask;
- DWORD Context;
-} IP_ADDR_STRING, *PIP_ADDR_STRING;
-
-//
-// ADAPTER_INFO - per-adapter information. All IP addresses are stored as
-// strings
-//
-
-typedef struct _IP_ADAPTER_INFO {
- struct _IP_ADAPTER_INFO* Next;
- DWORD ComboIndex;
- char AdapterName[MAX_ADAPTER_NAME_LENGTH + 4];
- char Description[MAX_ADAPTER_DESCRIPTION_LENGTH + 4];
- UINT AddressLength;
- BYTE Address[MAX_ADAPTER_ADDRESS_LENGTH];
- DWORD Index;
- UINT Type;
- UINT DhcpEnabled;
- PIP_ADDR_STRING CurrentIpAddress;
- IP_ADDR_STRING IpAddressList;
- IP_ADDR_STRING GatewayList;
- IP_ADDR_STRING DhcpServer;
- BOOL HaveWins;
- IP_ADDR_STRING PrimaryWinsServer;
- IP_ADDR_STRING SecondaryWinsServer;
- time_t LeaseObtained;
- time_t LeaseExpires;
-} IP_ADAPTER_INFO, *PIP_ADAPTER_INFO;
-
-#ifdef _WINSOCK2API_
-
-//
-// The following types require Winsock2.
-//
-
-typedef enum {
- IpPrefixOriginOther = 0,
- IpPrefixOriginManual,
- IpPrefixOriginWellKnown,
- IpPrefixOriginDhcp,
- IpPrefixOriginRouterAdvertisement,
-} IP_PREFIX_ORIGIN;
-
-typedef enum {
- IpSuffixOriginOther = 0,
- IpSuffixOriginManual,
- IpSuffixOriginWellKnown,
- IpSuffixOriginDhcp,
- IpSuffixOriginLinkLayerAddress,
- IpSuffixOriginRandom,
-} IP_SUFFIX_ORIGIN;
-
-typedef enum {
- IpDadStateInvalid = 0,
- IpDadStateTentative,
- IpDadStateDuplicate,
- IpDadStateDeprecated,
- IpDadStatePreferred,
-} IP_DAD_STATE;
-
-typedef struct _IP_ADAPTER_UNICAST_ADDRESS {
- union {
- ULONGLONG Alignment;
- struct {
- ULONG Length;
- DWORD Flags;
- };
- };
- struct _IP_ADAPTER_UNICAST_ADDRESS *Next;
- SOCKET_ADDRESS Address;
-
- IP_PREFIX_ORIGIN PrefixOrigin;
- IP_SUFFIX_ORIGIN SuffixOrigin;
- IP_DAD_STATE DadState;
-
- ULONG ValidLifetime;
- ULONG PreferredLifetime;
- ULONG LeaseLifetime;
-} IP_ADAPTER_UNICAST_ADDRESS, *PIP_ADAPTER_UNICAST_ADDRESS;
-
-typedef struct _IP_ADAPTER_ANYCAST_ADDRESS {
- union {
- ULONGLONG Alignment;
- struct {
- ULONG Length;
- DWORD Flags;
- };
- };
- struct _IP_ADAPTER_ANYCAST_ADDRESS *Next;
- SOCKET_ADDRESS Address;
-} IP_ADAPTER_ANYCAST_ADDRESS, *PIP_ADAPTER_ANYCAST_ADDRESS;
-
-typedef struct _IP_ADAPTER_MULTICAST_ADDRESS {
- union {
- ULONGLONG Alignment;
- struct {
- ULONG Length;
- DWORD Flags;
- };
- };
- struct _IP_ADAPTER_MULTICAST_ADDRESS *Next;
- SOCKET_ADDRESS Address;
-} IP_ADAPTER_MULTICAST_ADDRESS, *PIP_ADAPTER_MULTICAST_ADDRESS;
-
-//
-// Per-address Flags
-//
-#define IP_ADAPTER_ADDRESS_DNS_ELIGIBLE 0x01
-#define IP_ADAPTER_ADDRESS_TRANSIENT 0x02
-
-typedef struct _IP_ADAPTER_DNS_SERVER_ADDRESS {
- union {
- ULONGLONG Alignment;
- struct {
- ULONG Length;
- DWORD Reserved;
- };
- };
- struct _IP_ADAPTER_DNS_SERVER_ADDRESS *Next;
- SOCKET_ADDRESS Address;
-} IP_ADAPTER_DNS_SERVER_ADDRESS, *PIP_ADAPTER_DNS_SERVER_ADDRESS;
-
-typedef struct _IP_ADAPTER_PREFIX {
- union {
- ULONGLONG Alignment;
- struct {
- ULONG Length;
- DWORD Flags;
- };
- };
- struct _IP_ADAPTER_PREFIX *Next;
- SOCKET_ADDRESS Address;
- ULONG PrefixLength;
-} IP_ADAPTER_PREFIX, *PIP_ADAPTER_PREFIX;
-
-//
-// Per-adapter Flags
-//
-#define IP_ADAPTER_DDNS_ENABLED 0x01
-#define IP_ADAPTER_REGISTER_ADAPTER_SUFFIX 0x02
-#define IP_ADAPTER_DHCP_ENABLED 0x04
-#define IP_ADAPTER_RECEIVE_ONLY 0x08
-#define IP_ADAPTER_NO_MULTICAST 0x10
-#define IP_ADAPTER_IPV6_OTHER_STATEFUL_CONFIG 0x20
-
-//
-// OperStatus values from RFC 2863
-//
-typedef enum {
- IfOperStatusUp = 1,
- IfOperStatusDown,
- IfOperStatusTesting,
- IfOperStatusUnknown,
- IfOperStatusDormant,
- IfOperStatusNotPresent,
- IfOperStatusLowerLayerDown
-} IF_OPER_STATUS;
-
-//
-// Scope levels from RFC 2373 used with ZoneIndices array.
-//
-typedef enum {
- ScopeLevelInterface = 1,
- ScopeLevelLink = 2,
- ScopeLevelSubnet = 3,
- ScopeLevelAdmin = 4,
- ScopeLevelSite = 5,
- ScopeLevelOrganization = 8,
- ScopeLevelGlobal = 14
-} SCOPE_LEVEL;
-
-typedef struct _IP_ADAPTER_ADDRESSES {
- union {
- ULONGLONG Alignment;
- struct {
- ULONG Length;
- DWORD IfIndex;
- };
- };
- struct _IP_ADAPTER_ADDRESSES *Next;
- PCHAR AdapterName;
- PIP_ADAPTER_UNICAST_ADDRESS FirstUnicastAddress;
- PIP_ADAPTER_ANYCAST_ADDRESS FirstAnycastAddress;
- PIP_ADAPTER_MULTICAST_ADDRESS FirstMulticastAddress;
- PIP_ADAPTER_DNS_SERVER_ADDRESS FirstDnsServerAddress;
- PWCHAR DnsSuffix;
- PWCHAR Description;
- PWCHAR FriendlyName;
- BYTE PhysicalAddress[MAX_ADAPTER_ADDRESS_LENGTH];
- DWORD PhysicalAddressLength;
- DWORD Flags;
- DWORD Mtu;
- DWORD IfType;
- IF_OPER_STATUS OperStatus;
- DWORD Ipv6IfIndex;
- DWORD ZoneIndices[16];
- PIP_ADAPTER_PREFIX FirstPrefix;
-} IP_ADAPTER_ADDRESSES, *PIP_ADAPTER_ADDRESSES;
-
-//
-// Flags used as argument to GetAdaptersAddresses().
-// "SKIP" flags are added when the default is to include the information.
-// "INCLUDE" flags are added when the default is to skip the information.
-//
-#define GAA_FLAG_SKIP_UNICAST 0x0001
-#define GAA_FLAG_SKIP_ANYCAST 0x0002
-#define GAA_FLAG_SKIP_MULTICAST 0x0004
-#define GAA_FLAG_SKIP_DNS_SERVER 0x0008
-#define GAA_FLAG_INCLUDE_PREFIX 0x0010
-#define GAA_FLAG_SKIP_FRIENDLY_NAME 0x0020
-
-#endif /* _WINSOCK2API_ */
-
-//
-// IP_PER_ADAPTER_INFO - per-adapter IP information such as DNS server list.
-//
-
-typedef struct _IP_PER_ADAPTER_INFO {
- UINT AutoconfigEnabled;
- UINT AutoconfigActive;
- PIP_ADDR_STRING CurrentDnsServer;
- IP_ADDR_STRING DnsServerList;
-} IP_PER_ADAPTER_INFO, *PIP_PER_ADAPTER_INFO;
-
-//
-// FIXED_INFO - the set of IP-related information which does not depend on DHCP
-//
-
-typedef struct {
- char HostName[MAX_HOSTNAME_LEN + 4] ;
- char DomainName[MAX_DOMAIN_NAME_LEN + 4];
- PIP_ADDR_STRING CurrentDnsServer;
- IP_ADDR_STRING DnsServerList;
- UINT NodeType;
- char ScopeId[MAX_SCOPE_ID_LEN + 4];
- UINT EnableRouting;
- UINT EnableProxy;
- UINT EnableDns;
-} FIXED_INFO, *PFIXED_INFO;
-
-#pragma warning(pop)
-
-#endif /*!MAX_ADAPTER_DESCRIPTION_LENGTH*/
-
-#ifndef IP_INTERFACE_NAME_INFO_DEFINED
-#define IP_INTERFACE_NAME_INFO_DEFINED
-
-typedef struct ip_interface_name_info {
- ULONG Index; // Interface Index
- ULONG MediaType; // Interface Types - see ipifcons.h
- UCHAR ConnectionType;
- UCHAR AccessType;
- GUID DeviceGuid; // Device GUID is the guid of the device
- // that IP exposes
- GUID InterfaceGuid; // Interface GUID, if not GUID_NULL is the
- // GUID for the interface mapped to the device.
-} IP_INTERFACE_NAME_INFO, *PIP_INTERFACE_NAME_INFO;
-
-#endif
-
-
-/* from ipifcons.h */
-
-#ifndef IF_TYPE_PPP
-#define IF_TYPE_PPP 23
-#endif
-
-#ifndef IF_TYPE_SOFTWARE_LOOPBACK
-#define IF_TYPE_SOFTWARE_LOOPBACK 24
-#endif
-
-#ifndef IF_TYPE_SLIP
-#define IF_TYPE_SLIP 28
-#endif
-
-#ifndef IF_TYPE_TUNNEL
-#define IF_TYPE_TUNNEL 131
-#endif
+int enumInterfaces(JNIEnv *env, netif **netifPP);
#endif
diff --git a/jdk/src/windows/native/java/net/NetworkInterface_win9x.c b/jdk/src/windows/native/java/net/NetworkInterface_win9x.c
deleted file mode 100644
index deac1eb7f3d..00000000000
--- a/jdk/src/windows/native/java/net/NetworkInterface_win9x.c
+++ /dev/null
@@ -1,1141 +0,0 @@
-/*
- * Copyright (c) 2002, 2008, 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.
- */
-
-#include
-#include
-#include
-
-#include "jni_util.h"
-
-#include "NetworkInterface.h"
-
-/*
- * Windows 9x specific routines to enumerate network interfaces and the
- * IP addresses bound to those interfaces.
- *
- * Windows 95 does not include IP helper library support by default.
- * Additionally Windows 98 can have its IP helper library support
- * trashed by certain IE installations. For these environments we
- * combine information from the registry with the list of IP addresses
- * obtained via SIO_GET_INTERFACE_LIST.
- */
-
-/*
- * Header files are missing these
- */
-#if !defined(SIO_GET_INTERFACE_LIST)
-#define SIO_GET_INTERFACE_LIST _IOR('t', 127, u_long)
-
-struct in_addr6 {
- u_char s6_addr[16];
-};
-
-struct sockaddr_in6 {
- short sin6_family;
- u_short sin6_port;
- u_long sin6_flowinfo;
- struct in_addr6 sin6_addr;
-};
-
-typedef union sockaddr_gen{
- struct sockaddr Address;
- struct sockaddr_in AddressIn;
- struct sockaddr_in6 AddressIn6;
-} sockaddr_gen;
-
-typedef struct _INTERFACE_INFO
-{
- u_long iiFlags;
- sockaddr_gen iiAddress;
- sockaddr_gen iiBroadcastAddress;
- sockaddr_gen iiNetmask;
-} INTERFACE_INFO;
-
-#define IFF_UP 0x00000001
-#endif
-
-
-#define MAX_STR_LEN 256
-
-
-/*
- * A network adapter (similiar to the netif structure except contains
- * Windows 9x specific fields).
- */
-typedef struct _adapter {
- char *name;
- char *displayName;
- int index;
- char *reg_key;
- int is_wan_driver;
- netaddr *addrs;
- struct _adapter *next;
-} adapter;
-
-
-/*
- * Cached adapter list.
- */
-static CRITICAL_SECTION cacheLock;
-static adapter *cachedAdapterList;
-
-/*
- * Initialize cache
- */
-void init_win9x() {
- InitializeCriticalSection(&cacheLock);
-}
-
-
-/*
- * Free adapter list and any addresses bound to the adpater.
- */
-static void free_adapters(adapter *adapterP) {
- adapter *curr = adapterP;
- while (curr != NULL) {
- if (curr->name != NULL)
- free(curr->name);
-
- if (curr->displayName != NULL)
- free(curr->displayName);
-
- if (curr->reg_key != NULL)
- free(curr->reg_key);
-
- if (curr->addrs != NULL)
- free_netaddr(curr->addrs);
-
- adapterP = adapterP->next;
- free(curr);
- curr = adapterP;
- }
-}
-
-
-/*
- * Returns the SIO_GET_INTERFACE_LIST output
- */
-static int getInterfaceList(JNIEnv *env, INTERFACE_INFO *infoP, DWORD dwSize) {
- SOCKET sock;
- DWORD ret;
-
- /* create a socket and do the ioctl */
- sock = socket(AF_INET, SOCK_DGRAM, 0);
- if (sock == INVALID_SOCKET) {
- JNU_ThrowByName(env, "java/lang/Error", "socket failed");
- return -1;
- }
- ret = WSAIoctl(sock, SIO_GET_INTERFACE_LIST, NULL, 0,
- infoP, dwSize, &dwSize, NULL, NULL);
- closesocket(sock);
- if (ret == SOCKET_ERROR) {
- JNU_ThrowByName(env, "java/lang/Error", "WSAIoctl failed");
- return -1;
- }
- return dwSize;
-}
-
-
-/*
- * Gross, ugly, and crude way of guessing if this is a WAN (dial-up) driver.
- * Returns 1 if it's the normal PPCMAC VxD, otherwise 0.
- */
-static int isWanDriver(char *driver) {
- LONG ret;
- HKEY hKey;
- DWORD dwLen;
- ULONG ulType;
- char key[MAX_STR_LEN];
- char vxd[MAX_STR_LEN];
-
- sprintf(key, "System\\CurrentControlSet\\Services\\Class\\%s", driver);
- ret = RegOpenKeyEx(HKEY_LOCAL_MACHINE, key, 0, KEY_READ, (PHKEY)&hKey);
- if (ret != ERROR_SUCCESS) {
- return 0;
- }
- dwLen = sizeof(vxd);
- ret = RegQueryValueEx(hKey, "DeviceVxDs", NULL, &ulType,
- (LPBYTE)vxd, &dwLen);
- RegCloseKey(hKey);
- if (ret != ERROR_SUCCESS) {
- return 0;
- }
- return (strcmp(vxd, "pppmac.vxd") == 0);
-}
-
-/*
- * Windows 9x routine to get the network adapters using the registry.
- * We enumerate HKEY_LOCAL_MACHINE\Enum and iterate through the tree
- * looking for devices of class "Net". As these devices may not have a
- * unique name we assign them a generated name.
- *
- * Returns a list of adapters without IP addresses (addrs member is NULL).
- */
-static int getAdapters(JNIEnv *env, adapter **adapterPP)
-{
- LONG ret;
- HKEY enumKey;
- DWORD dwLen;
- DWORD dwEnumKeys;
- DWORD enumIndex;
- ULONG ulType;
- int adapterCount = 0;
- adapter *adapterP = NULL;
- adapter *curr;
-
- /*
- * Start at HKEY_LOCAL_MACHINE\Enum
- */
- ret = RegOpenKeyEx(HKEY_LOCAL_MACHINE, "Enum", 0, KEY_READ, (PHKEY)&enumKey);
- if (ret != ERROR_SUCCESS) {
- return -1;
- }
- ret = RegQueryInfoKey(enumKey, NULL, NULL, NULL, &dwEnumKeys,
- NULL, NULL, NULL, NULL, NULL, NULL, NULL);
- if (ret != ERROR_SUCCESS) {
- RegCloseKey(enumKey);
- return -1;
- }
-
- /*
- * Iterate through the sub-keys (PCI, Root, ...)
- */
- for(enumIndex = 0; enumIndexis_wan_driver = wan_device;
- curr->name = (char *)malloc(strlen(ps_name) + 1);
- if (curr->name) {
- curr->displayName = (char *)malloc(strlen(deviceDesc) + 1);
- if (curr->displayName) {
- curr->reg_key = (char *)malloc(strlen(key_name)+1);
- if (curr->reg_key == NULL) {
- free(curr->displayName);
- free(curr->name);
- free(curr);
- curr = NULL;
- }
- } else {
- free(curr->name);
- free(curr);
- curr = NULL;
- }
- } else {
- free(curr);
- curr = NULL;
- }
- }
-
- /* At OutOfMemory occurred */
- if (curr == NULL) {
- JNU_ThrowOutOfMemoryError(env, "heap allocation failure");
- free_adapters(adapterP);
- RegCloseKey(clsKey);
- RegCloseKey(nameKey);
- RegCloseKey(deviceKey);
- RegCloseKey(enumKey);
- return -1;
- }
-
- /* index starts at 1 (not 0) */
- curr->index = ++adapterCount;
-
- strcpy(curr->name, ps_name);
- strcpy(curr->displayName, deviceDesc);
- strcpy(curr->reg_key, key_name);
-
- /*
- * Put the adapter at the end of the list.
- */
- if (adapterP == NULL) {
- adapterP = curr;
- } else {
- adapter *tail = adapterP;
- while (tail->next != NULL) {
- tail = tail->next;
- }
- tail->next = curr;
- }
- }
- }
- }
- }
- RegCloseKey(clsKey);
- }
- RegCloseKey(nameKey);
- }
- RegCloseKey(deviceKey);
- }
- RegCloseKey(enumKey);
-
- /*
- * Insert an entry for the loopback interface
- */
- curr = (adapter *)calloc(1, sizeof(adapter));
- if (curr == NULL) {
- JNU_ThrowOutOfMemoryError(env, "heap allocation failure");
- free_adapters(adapterP);
- return -1;
- }
- curr->index = ++adapterCount;
- curr->name = _strdup("lo");
- curr->displayName = _strdup("TCP Loopback interface");
- curr->next = adapterP;
- *adapterPP = curr;
-
- return adapterCount;
-}
-
-/*
- * Windows 9x routine to obtain any static addresses for a specified
- * TCP/IP binding.
- *
- * We first open Enum\Network\${binding} and check that the driver
- * is TCP/IP. If so we pick up the driver and check for any IP addresses
- * in System\\CurrentControlSet\\Services\\Class\\${driver}
- *
- * Returns 0 if found, otherwise -1.
- */
-static int getStaticAddressEntry(char *binding, char *addresses) {
- LONG ret;
- HKEY hKey;
- char name[255];
- char desc[255];
- char driver[255];
- char ipaddr[255];
- DWORD dwName;
- ULONG ulType;
-
- /* assume nothing will be returned */
- strcpy(addresses, "");
-
- /*
- * Open the binding and check that it's TCP/IP
- */
- sprintf(name, "Enum\\Network\\%s", binding);
- ret = RegOpenKeyEx(HKEY_LOCAL_MACHINE, name, 0, KEY_READ, (PHKEY)&hKey);
- if (ret != ERROR_SUCCESS) {
- return -1;
- }
- dwName = sizeof(desc);
- ret = RegQueryValueEx(hKey, "DeviceDesc", NULL, &ulType,
- (LPBYTE)desc, &dwName);
- if (ret != ERROR_SUCCESS) {
- RegCloseKey(hKey);
- return -1;
- }
- if (strcmp(desc, "TCP/IP") != 0) {
- /* ignore non-TCP/IP bindings */
- RegCloseKey(hKey);
- return -1;
- }
-
- /*
- * Get the driver for this TCP/IP binding
- */
- dwName = sizeof(driver);
- ret = RegQueryValueEx(hKey, "Driver", NULL, &ulType,
- (LPBYTE)driver, &dwName);
- RegCloseKey(hKey);
- if (ret != ERROR_SUCCESS) {
- return -1;
- }
-
- /*
- * Finally check if there is an IPAddress value for this driver.
- */
- sprintf(name, "System\\CurrentControlSet\\Services\\Class\\%s", driver);
- ret = RegOpenKeyEx(HKEY_LOCAL_MACHINE, name, 0, KEY_READ, (PHKEY)&hKey);
- if (ret != ERROR_SUCCESS) {
- return -1;
- }
- dwName = sizeof(ipaddr);
- ret = RegQueryValueEx(hKey, "IPAddress", NULL, &ulType,
- (LPBYTE)ipaddr, &dwName);
- RegCloseKey(hKey);
- if (ret != ERROR_SUCCESS) {
- return -1;
- }
-
- /* Return the address(es) */
- strcpy( addresses, ipaddr );
- return 0;
-}
-
-/*
- * Windows 9x routine to enumerate the static IP addresses on a
- * particular interface using the registry.
- *
- * Returns a count of the number of addresses found.
- */
-static int getStaticAddresses(JNIEnv *env, char *reg_key, netaddr **netaddrPP)
-{
- LONG ret;
- HKEY enumKey, bindingKey;
- DWORD dwLen;
- ULONG ulType;
- char addresses[MAX_STR_LEN];
- unsigned long addr; /* IPv4 address */
- unsigned char byte;
- netaddr *netaddrP, *curr;
- int i, addrCount;
-
- /*
- * Open the HKEY_LOCAL_MACHINE\Enum\%s\%s\%s key
- */
- ret = RegOpenKeyEx(HKEY_LOCAL_MACHINE, reg_key, 0, KEY_READ,
- (PHKEY)&enumKey);
- if (ret != ERROR_SUCCESS) {
- /* interface has been removed */
- *netaddrPP = NULL;
- return 0;
- }
-
- /*
- * Iterate through each of the bindings to find any TCP/IP bindings
- * and any static address assoicated with the binding.
- */
- strcpy(addresses, "");
- addrCount = 0;
- netaddrP = NULL;
-
- ret = RegOpenKeyEx(enumKey, "Bindings", 0, KEY_READ, (PHKEY)&bindingKey);
- if (ret == ERROR_SUCCESS) {
- DWORD dwBindingKeys;
- DWORD dwBindingIndex;
-
- ret = RegQueryInfoKey(bindingKey, NULL, NULL, NULL, NULL, NULL, NULL, &dwBindingKeys,
- NULL, NULL, NULL, NULL);
- if (ret == ERROR_SUCCESS) {
- TCHAR binding[MAX_STR_LEN];
-
- dwBindingIndex=0;
- while (dwBindingIndexaddr.him4.sin_family = AF_INET;
- curr->addr.him4.sin_addr.s_addr = htonl(addr);
- curr->next = netaddrP;
-
- netaddrP = curr;
- addrCount++;
-
- /* reset the address for the next iteration */
- addr = 0;
- }
- byte = 0;
- } else {
- if (addresses[i] == '.') {
- addr = (addr << 8) | byte;
- byte = 0;
- } else {
- byte = (byte * 10) + (addresses[i] - '0');
- }
- }
- i++;
- }
- }
- }
- if (addrCount > 0) {
- break;
- }
- dwBindingIndex++;
- }
- }
- RegCloseKey(bindingKey);
- }
-
- /* close the registry */
- RegCloseKey(enumKey);
-
-
- /* return the list */
- *netaddrPP = netaddrP;
- return addrCount;
-}
-
-/*
- * Windows 9x routine to probe the registry for a DHCP allocated address.
- * This routine is only useful if we know that only one interface has its
- * address allocated using DHCP. Returns 0.0.0.0 if none or multiple
- * addresses found.0
- */
-static DWORD getDHCPAddress()
-{
- LONG ret;
- HKEY hKey;
- DWORD dwLen;
- ULONG ulType;
- char key[MAX_STR_LEN];
- int index;
- DWORD dhcp_addr = 0;
-
- index = 0;
- while (index < 99) {
- DWORD addr;
-
- sprintf(key, "SYSTEM\\CurrentControlSet\\Services\\VxD\\DHCP\\DhcpInfo%02d", index);
-
- ret = RegOpenKeyEx(HKEY_LOCAL_MACHINE, key, 0, KEY_READ, (PHKEY)&hKey);
- if (ret != ERROR_SUCCESS) {
- return dhcp_addr;
- }
-
- /*
- * On Windows 9x the DHCP address is in the DhcpIPAddress key. We
- * are assuming here that this is Windows Socket 2. If Windows
- * Sockets is the original 1.1 release then this doesn't work because
- * the IP address if in the DhcpInfo key (a blob with the first 4
- * bytes set to the IP address).
- */
- dwLen = sizeof(addr);
- ret = RegQueryValueEx(hKey, "DhcpIPAddress", NULL, &ulType,
- (LPBYTE)&addr, &dwLen);
- RegCloseKey(hKey);
-
- if (ret == ERROR_SUCCESS) {
- if (addr) {
- /* more than 1 DHCP address in registry */
- if (dhcp_addr) {
- return 0;
- }
- dhcp_addr = htonl(addr);
- }
- }
- index++;
- }
-
- /* if we get here it means we've examined 100 registry entries */
- return 0;
-}
-
-
-/*
- * Attempt to allocate the remaining addresses on addrList to the adpaters
- * on adapterList. Returns the number of address remaining.
- */
-int allocateRemaining(adapter *adapterList, int address_count, netaddr *addrList) {
- adapter *adapterP = adapterList;
- adapter *nobindingsP = NULL;
-
- /*
- * If all addresses have been assigned there's nothing to do.
- */
- if (address_count == 0) {
- return 0;
- }
-
- /*
- * Determine if there is only one adapter without an address
- */
- while (adapterP != NULL) {
- if (adapterP->addrs == NULL) {
- if (nobindingsP == NULL) {
- nobindingsP = adapterP;
- } else {
- nobindingsP = NULL;
- break;
- }
- }
- adapterP = adapterP->next;
- }
-
- /*
- * Found (only one)
- */
- if (nobindingsP) {
- nobindingsP->addrs = addrList;
- address_count = 0;
- }
-
- return address_count;
-}
-
-
-/*
- * 1. Network adapters are enumerated by traversing through the
- * HKEY_LOCAL_MACHINE\Enum tree and picking out class "Net" devices.
- *
- * 2. Address enumeration starts with the list of IP addresses returned
- * by SIO_GET_INTERFACE_LIST and then we "allocate" the addresses to
- * the network adapters enumerated in step 1. Allocation works as
- * follows :-
- *
- * i. Loopback address is assigned to the loopback interface. If there
- * is one network adapter then all other addresses must be bound
- * to that adapter.
- *
- * ii. Enumerate all static IP addresses using the registry. This allows
- * us to allocate all static IP address to the corresponding adapter.
- *
- * iii. After step ii. if there is one network adapter that has not been
- * allocated an IP address then we know that the remaining IP addresses
- * must be bound to this adapter.
- *
- * iv. If we get to this step it means we are dealing with a complex
- * configuration whereby multiple network adapters have their address
- * configured dynamically (eg: NIC using DHCP plus modem using PPP).
- * We employ a gross hack based on a crude determination done in step 1.
- * If there is a DHCP address configured and if one remaining
- * network adapter that is not a WAN adapter then the DHCP address
- * must be bound to it.
- */
-static adapter *loadConfig(JNIEnv *env) {
- adapter *adapterList;
- int adapter_count;
- INTERFACE_INFO interfaceInfo[8];
- DWORD dwSize;
- int address_count, i;
- netaddr *addrList;
-
- /*
- * Enumerate the network adapters
- */
- adapter_count = getAdapters(env, &adapterList);
- if (adapter_count < 0) {
- return NULL;
- }
- /* minimum of loopback interface */
- assert(adapter_count >= 1);
-
- /*
- * Enumerate all IP addresses as known to winsock
- */
- dwSize = getInterfaceList(env, interfaceInfo, sizeof(interfaceInfo));
- if (dwSize < 0) {
- free_adapters(adapterList);
- return NULL;
- }
- address_count = dwSize/sizeof(INTERFACE_INFO);
-
- /* minimum of loopback address */
- assert(address_count >= 1);
-
- /*
- * Create an address list (addrList) from the INTERFACE_INFO
- * structure.
- */
- addrList = NULL;
- for (i=0; iaddr.him4.sin_family = AF_INET;
- addrP->addr.him4.sin_addr.s_addr =
- ((SOCKADDR_IN *)&(interfaceInfo[i].iiAddress))->sin_addr.S_un.S_addr;
-
- addrP->next = addrList;
- addrList = addrP;
- }
-
-
- /*
- * First we assign the loopback address to the lo adapter.
- * If lo is the only adapter then we are done.
- */
- {
- adapter *loopbackAdapter;
- netaddr *addrP, *prevP;
-
- /* find the loopback adapter */
- loopbackAdapter = adapterList;
- while (strcmp(loopbackAdapter->name, "lo") != 0) {
- loopbackAdapter = loopbackAdapter->next;
- }
- assert(loopbackAdapter != NULL);
-
- /* find the loopback address and move it to the loopback adapter */
- addrP = addrList;
- prevP = NULL;
- while (addrP != NULL) {
- if (addrP->addr.him4.sin_addr.s_addr == htonl(0x7f000001)) {
- loopbackAdapter->addrs = addrP;
- if (prevP == NULL) {
- addrList = addrP->next;
- } else {
- prevP->next = addrP->next;
- }
- loopbackAdapter->addrs->next = NULL;
- address_count--;
- break;
- }
- prevP = addrP;
- addrP = addrP->next;
- }
- }
-
-
- /*
- * Special case. If there's only one network adapter then all remaining
- * IP addresses must be bound to that adapter.
- */
- address_count = allocateRemaining(adapterList, address_count, addrList);
- if (address_count == 0) {
- return adapterList;
- }
-
- /*
- * Locate any static IP addresses defined in the registry. Validate the
- * addresses against the SIO_GET_INTERFACE_LIST (as registry may have
- * stale settings). If valid we move the addresses from addrList to
- * the adapter.
- */
- {
- adapter *adapterP;
-
- adapterP = adapterList;
- while (adapterP != NULL) {
- int cnt;
- netaddr *static_addrP;
-
- /*
- * Skip loopback
- */
- if (strcmp(adapterP->name, "lo") == 0) {
- adapterP = adapterP->next;
- continue;
- }
-
- /*
- * Get the static addresses for this adapter.
- */
- cnt = getStaticAddresses(env, adapterP->reg_key, &static_addrP);
- if (cnt < 0) {
- free_netaddr(addrList);
- free(adapterList);
- return NULL;
- }
-
- /*
- * Validate against the SIO_GET_INTERFACE_LIST.
- * (avoids stale registry settings).
- */
- while (static_addrP != NULL) {
- netaddr *addrP = addrList;
- netaddr *prev = NULL;
-
- while (addrP != NULL) {
- if (addrP->addr.him4.sin_addr.s_addr == static_addrP->addr.him4.sin_addr.s_addr)
- break;
-
- prev = addrP;
- addrP = addrP->next;
- }
-
- /*
- * if addrP is not NULL it means we have a match
- * (ie: address from the registry is valid).
- */
- if (addrP != NULL) {
- /* remove from addrList */
- if (prev == NULL) {
- addrList = addrP->next;
- } else {
- prev->next = addrP->next;
- }
- address_count--;
-
- /* add to adapter list */
- addrP->next = adapterP->addrs;
- adapterP->addrs = addrP;
- }
-
- /*
- * On the next static address.
- */
- static_addrP = static_addrP->next;
- }
-
- /* not needed */
- free_netaddr(static_addrP);
-
- adapterP = adapterP->next;
- }
- }
-
-
- /*
- * Static addresses are now assigned so try again to allocate the
- * remaining addresses. This will succeed if there is one adapter
- * with a dynamically assigned address (DHCP or PPP).
- */
- address_count = allocateRemaining(adapterList, address_count, addrList);
- if (address_count == 0) {
- return adapterList;
- }
-
- /*
- * Next we see if there is a DHCP address in the registry. If there is
- * an address (and it's valid) then we know it must be bound to a LAN
- * adapter. Additionally, when we enumerate the network adapters
- * we made a crude determination on if an adapter is dial-up. Thus if
- * we know there is one remaining LAN adapter without an IP address
- * then the DHCP address must be bound to it.
- */
- {
- long dhcp_addr = getDHCPAddress(); /* returns in network order */
- if (dhcp_addr) {
- netaddr *addrP, *prevP;
-
- /*
- * Check that the DHCP address is valid
- */
- addrP = addrList;
- prevP = NULL;
- while (addrP != NULL) {
- if (addrP->addr.him4.sin_addr.s_addr == dhcp_addr) {
- break;
- }
- prevP = addrP;
- addrP = addrP->next;
- }
-
- /*
- * Address is valid - now check how many non-WAN adapters
- * don't have addresses yet.
- */
- if (addrP != NULL) {
- adapter *adapterP = adapterList;
- adapter *nobindingsP = NULL;
-
- while (adapterP != NULL) {
- if (adapterP->addrs == NULL && !adapterP->is_wan_driver) {
- if (nobindingsP == NULL) {
- nobindingsP = adapterP;
- } else {
- /* already found one */
- nobindingsP = NULL;
- break;
- }
- }
- adapterP = adapterP->next;
- }
-
- /*
- * One non-WAN adapter remaining
- */
- if (nobindingsP != NULL) {
- nobindingsP->addrs = addrP;
-
- /* remove from addrList */
- if (prevP == NULL) {
- addrList = addrP->next;
- } else {
- prevP->next = addrP->next;
- }
- addrP->next = NULL;
- address_count--;
- }
- }
- }
- }
-
- /*
- * Finally we do one final attempt to re-assign any remaining
- * addresses. This catches the case of 2 adapters that have their
- * addresses dynamically assigned (specifically NIC with DHCP, and
- * Modem using RAS/PPP).
- */
- address_count = allocateRemaining(adapterList, address_count, addrList);
- if (address_count == 0) {
- return adapterList;
- }
-
- /*
- * Free any unallocated addresses
- */
- if (address_count > 0) {
- free_netaddr(addrList);
- }
-
- /*
- * Return the adapter List.
- */
- return adapterList;
-
-}
-
-
-/*
- * Enumerate network interfaces. If successful returns the number of
- * network interfaces and netifPP returning a list of netif structures.
- * Returns -1 with exception thrown if error.
- */
-int enumInterfaces_win9x(JNIEnv *env, netif **netifPP) {
- adapter *adapters, *adapterP;
- int cnt = 0;
- netif *netifP = NULL;
-
- /* enumerate network configuration */
- adapters = loadConfig(env);
- if (adapters == NULL) {
- return -1;
- }
-
- /*
- * loadConfig returns an adapter list - we need to create a corresponding
- * list of netif structures.
- */
- adapterP = adapters;
- while (adapterP != NULL) {
- netif *ifs = (netif *)calloc(1, sizeof(netif));
-
- if (ifs == NULL) {
- JNU_ThrowOutOfMemoryError(env, "heap allocation failure");
- free_adapters(adapters);
- free_netif(netifP);
- return -1;
- }
-
- ifs->name = _strdup(adapterP->name);
- ifs->displayName = _strdup(adapterP->displayName);
- ifs->dwIndex = adapterP->index;
- ifs->index = adapterP->index;
- ifs->next = netifP;
- netifP = ifs;
-
- if (ifs->name == NULL || ifs->displayName == NULL) {
- JNU_ThrowOutOfMemoryError(env, "heap allocation failure");
- free_adapters(adapters);
- free_netif(netifP);
- return -1;
- }
-
- cnt++;
- adapterP = adapterP->next;
- }
-
- /*
- * Put the adapter list in the cache
- */
- EnterCriticalSection(&cacheLock);
- {
- if (cachedAdapterList != NULL) {
- free_adapters(cachedAdapterList);
- }
- cachedAdapterList = adapters;
- }
- LeaveCriticalSection(&cacheLock);
-
- /*
- * Return the netif list
- */
- *netifPP = netifP;
- return cnt;
-}
-
-/*
- * Enumerate the addresses for the specified network interface. If successful
- * returns the number of addresses bound to the interface and sets netaddrPP
- * to be a list of netaddr structures. Returns -1 if error.
- */
-int enumAddresses_win9x(JNIEnv *env, netif *netifP, netaddr **netaddrPP) {
-
- EnterCriticalSection(&cacheLock);
- {
- adapter *adapterP = cachedAdapterList;
- while (adapterP != NULL) {
- if (strcmp(adapterP->name, netifP->name) == 0) {
-
- netaddr *newlist = NULL;
- netaddr *curr = adapterP->addrs;
- int cnt = 0;
-
- while (curr != NULL) {
- /*
- * Clone the netaddr and add it to newlist.
- */
- netaddr *tmp = (netaddr *)calloc(1, sizeof(netaddr));
- if (tmp == NULL) {
- LeaveCriticalSection(&cacheLock);
- JNU_ThrowOutOfMemoryError(env, "heap allocation failure");
- free_netaddr(newlist);
- return -1;
- }
- tmp->addr = curr->addr;
- tmp->next = newlist;
- newlist = tmp;
-
- cnt++;
- curr = curr->next;
- }
-
- *netaddrPP = newlist;
- LeaveCriticalSection(&cacheLock);
- return cnt;
- }
- adapterP = adapterP->next;
- }
- }
- LeaveCriticalSection(&cacheLock);
-
- *netaddrPP = NULL;
- return 0;
-}
diff --git a/jdk/src/windows/native/java/net/NetworkInterface_winXP.c b/jdk/src/windows/native/java/net/NetworkInterface_winXP.c
index 283be81b89a..ecfab4967db 100644
--- a/jdk/src/windows/native/java/net/NetworkInterface_winXP.c
+++ b/jdk/src/windows/native/java/net/NetworkInterface_winXP.c
@@ -43,14 +43,6 @@
extern int enumAddresses_win(JNIEnv *env, netif *netifP, netaddr **netaddrPP);
int getAddrsFromAdapter(IP_ADAPTER_ADDRESSES *ptr, netaddr **netaddrPP);
-/* IP helper library routines */
-int (PASCAL FAR *GetIpAddrTable_fn)();
-int (PASCAL FAR *GetIfTable_fn)();
-int (PASCAL FAR *GetFriendlyIfIndex_fn)();
-int (PASCAL FAR *GetAdaptersAddresses_fn)();
-int (PASCAL FAR *GetAdaptersInfo_fn)();
-int (PASCAL FAR *GetNumberOfInterfaces_fn)();
-
#ifdef DEBUG
void printnif (netif *nif) {
#ifdef _WIN64
@@ -96,14 +88,14 @@ static int getAdapters (JNIEnv *env, IP_ADAPTER_ADDRESSES **adapters) {
flags = GAA_FLAG_SKIP_DNS_SERVER;
flags |= GAA_FLAG_SKIP_MULTICAST;
flags |= GAA_FLAG_INCLUDE_PREFIX;
- ret = (*GetAdaptersAddresses_fn) (AF_UNSPEC, flags, NULL, adapterInfo, &len);
+ ret = GetAdaptersAddresses(AF_UNSPEC, flags, NULL, adapterInfo, &len);
if (ret == ERROR_BUFFER_OVERFLOW) {
adapterInfo = (IP_ADAPTER_ADDRESSES *) realloc (adapterInfo, len);
if (adapterInfo == 0) {
return -1;
}
bufsize = len;
- ret = (*GetAdaptersAddresses_fn) (AF_UNSPEC, flags, NULL, adapterInfo, &len);
+ ret = GetAdaptersAddresses(AF_UNSPEC, flags, NULL, adapterInfo, &len);
}
if (ret != ERROR_SUCCESS) {
free (adapterInfo);
@@ -133,7 +125,7 @@ IP_ADAPTER_ADDRESSES *getAdapter (JNIEnv *env, jint index) {
flags = GAA_FLAG_SKIP_DNS_SERVER;
flags |= GAA_FLAG_SKIP_MULTICAST;
flags |= GAA_FLAG_INCLUDE_PREFIX;
- val = (*GetAdaptersAddresses_fn) (AF_UNSPEC, flags, NULL, adapterInfo, &len);
+ val = GetAdaptersAddresses(AF_UNSPEC, flags, NULL, adapterInfo, &len);
if (val == ERROR_BUFFER_OVERFLOW) {
adapterInfo = (IP_ADAPTER_ADDRESSES *) realloc (adapterInfo, len);
if (adapterInfo == 0) {
@@ -141,7 +133,7 @@ IP_ADAPTER_ADDRESSES *getAdapter (JNIEnv *env, jint index) {
return NULL;
}
bufsize = len;
- val = (*GetAdaptersAddresses_fn) (AF_UNSPEC, flags, NULL, adapterInfo, &len);
+ val = GetAdaptersAddresses(AF_UNSPEC, flags, NULL, adapterInfo, &len);
}
if (val != ERROR_SUCCESS) {
free (adapterInfo);
@@ -182,7 +174,7 @@ int getAllInterfacesAndAddresses (JNIEnv *env, netif **netifPP)
* as what previous JDK versions would return.
*/
- ret = enumInterfaces_win (env, netifPP);
+ ret = enumInterfaces(env, netifPP);
if (ret == -1) {
return -1;
} else {
@@ -221,7 +213,7 @@ int getAllInterfacesAndAddresses (JNIEnv *env, netif **netifPP)
* (b) IPv6 information for IPv6 only interfaces (probably tunnels)
*
* For compatibility with previous releases we use the naming
- * information gotten from enumInterfaces_win() for (a) entries
+ * information gotten from enumInterfaces() for (a) entries
* However, the index numbers are taken from the new API.
*
* The procedure is to go through the list of adapters returned
@@ -439,7 +431,8 @@ static jobject createNetworkInterfaceXP(JNIEnv *env, netif *ifs)
netifObj = (*env)->NewObject(env, ni_class, ni_ctor);
name = (*env)->NewStringUTF(env, ifs->name);
if (ifs->dNameIsUnicode) {
- displayName = (*env)->NewString(env, (PWCHAR)ifs->displayName, wcslen ((PWCHAR)ifs->displayName));
+ displayName = (*env)->NewString(env, (PWCHAR)ifs->displayName,
+ (jsize)wcslen ((PWCHAR)ifs->displayName));
} else {
displayName = (*env)->NewStringUTF(env, ifs->displayName);
}
diff --git a/jdk/src/windows/native/java/net/TwoStacksPlainSocketImpl.c b/jdk/src/windows/native/java/net/TwoStacksPlainSocketImpl.c
index 71e2b2b124e..9c1ffee6c1a 100644
--- a/jdk/src/windows/native/java/net/TwoStacksPlainSocketImpl.c
+++ b/jdk/src/windows/native/java/net/TwoStacksPlainSocketImpl.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2008, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2011, 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
diff --git a/jdk/src/windows/native/java/net/net_util_md.c b/jdk/src/windows/native/java/net/net_util_md.c
index ffaf52078aa..4cf522e786a 100644
--- a/jdk/src/windows/native/java/net/net_util_md.c
+++ b/jdk/src/windows/native/java/net/net_util_md.c
@@ -39,10 +39,6 @@
/* true if SO_RCVTIMEO is supported */
jboolean isRcvTimeoutSupported = JNI_TRUE;
-LPFN_GETADDRINFO getaddrinfo_ptr = NULL;
-LPFN_FREEADDRINFO freaddrinfo_ptr = NULL;
-LPFN_GETNAMEINFO getnameinfo_ptr = NULL;
-
/*
* Table of Windows Sockets errors, the specific exception we
* throw for the error, and the error text.
@@ -233,38 +229,15 @@ NET_GetFileDescriptorID(JNIEnv *env)
jint IPv6_supported()
{
- HMODULE lib;
- int fd = socket(AF_INET6, SOCK_STREAM, 0) ;
- if (fd < 0) {
+ SOCKET s = socket(AF_INET6, SOCK_STREAM, 0) ;
+ if (s == INVALID_SOCKET) {
return JNI_FALSE;
}
- closesocket (fd);
-
- if ((lib = LoadLibrary ("ws2_32.dll")) == NULL) {
- return JNI_FALSE;
- }
- if ((getaddrinfo_ptr = (LPFN_GETADDRINFO)GetProcAddress (lib, "getaddrinfo")) == NULL) {
- FreeLibrary (lib);
- return JNI_FALSE;
- }
- if ((freeaddrinfo_ptr = (LPFN_FREEADDRINFO)GetProcAddress (lib, "freeaddrinfo")) == NULL) {
- FreeLibrary (lib);
- return JNI_FALSE;
- }
- if ((getnameinfo_ptr = (LPFN_GETNAMEINFO)GetProcAddress (lib, "getnameinfo")) == NULL) {
- FreeLibrary (lib);
- return JNI_FALSE;
- }
- FreeLibrary(lib);
+ closesocket(s);
return JNI_TRUE;
}
-jboolean NET_addrtransAvailable() {
- return (jboolean)(getaddrinfo_ptr != NULL);
-}
-
-
/*
* Return the default TOS value
*/
@@ -664,7 +637,7 @@ NET_BindV6(struct ipv6bind* b) {
if (family == AF_INET && (b->addr->him4.sin_addr.s_addr != INADDR_ANY)) {
/* bind to v4 only */
int ret;
- ret = NET_Bind (b->ipv4_fd, (struct sockaddr *)b->addr,
+ ret = NET_Bind ((int)b->ipv4_fd, (struct sockaddr *)b->addr,
sizeof (struct sockaddr_in));
if (ret == SOCKET_ERROR) {
CLOSE_SOCKETS_AND_RETURN;
@@ -676,7 +649,7 @@ NET_BindV6(struct ipv6bind* b) {
if (family == AF_INET6 && (!IN6_IS_ADDR_ANY(&b->addr->him6.sin6_addr))) {
/* bind to v6 only */
int ret;
- ret = NET_Bind (b->ipv6_fd, (struct sockaddr *)b->addr,
+ ret = NET_Bind ((int)b->ipv6_fd, (struct sockaddr *)b->addr,
sizeof (struct SOCKADDR_IN6));
if (ret == SOCKET_ERROR) {
CLOSE_SOCKETS_AND_RETURN;
@@ -691,15 +664,15 @@ NET_BindV6(struct ipv6bind* b) {
memset (&oaddr, 0, sizeof(oaddr));
if (family == AF_INET) {
ofamily = AF_INET6;
- fd = b->ipv4_fd;
- ofd = b->ipv6_fd;
+ fd = (int)b->ipv4_fd;
+ ofd = (int)b->ipv6_fd;
port = (u_short)GET_PORT (b->addr);
IN6ADDR_SETANY (&oaddr.him6);
oaddr.him6.sin6_port = port;
} else {
ofamily = AF_INET;
- ofd = b->ipv4_fd;
- fd = b->ipv6_fd;
+ ofd = (int)b->ipv4_fd;
+ fd = (int)b->ipv6_fd;
port = (u_short)GET_PORT (b->addr);
oaddr.him4.sin_family = AF_INET;
oaddr.him4.sin_port = port;
@@ -744,11 +717,11 @@ NET_BindV6(struct ipv6bind* b) {
b->ipv6_fd = SOCKET_ERROR;
/* create two new sockets */
- fd = socket (family, sotype, 0);
+ fd = (int)socket (family, sotype, 0);
if (fd == SOCKET_ERROR) {
CLOSE_SOCKETS_AND_RETURN;
}
- ofd = socket (ofamily, sotype, 0);
+ ofd = (int)socket (ofamily, sotype, 0);
if (ofd == SOCKET_ERROR) {
CLOSE_SOCKETS_AND_RETURN;
}
@@ -802,7 +775,7 @@ jint getDefaultIPv6Interface(JNIEnv *env, struct SOCKADDR_IN6 *target_addr)
DWORD b;
struct sockaddr_in6 route;
SOCKET fd = socket(AF_INET6, SOCK_STREAM, 0);
- if (fd < 0) {
+ if (fd == INVALID_SOCKET) {
return 0;
}
@@ -810,7 +783,7 @@ jint getDefaultIPv6Interface(JNIEnv *env, struct SOCKADDR_IN6 *target_addr)
(void *)target_addr, sizeof(struct sockaddr_in6),
(void *)&route, sizeof(struct sockaddr_in6),
&b, 0, 0);
- if (ret < 0) {
+ if (ret == SOCKET_ERROR) {
// error
closesocket(fd);
return 0;
@@ -1001,10 +974,10 @@ NET_Wait(JNIEnv *env, jint fd, jint flags, jint timeout)
}
int NET_Socket (int domain, int type, int protocol) {
- int sock;
+ SOCKET sock;
sock = socket (domain, type, protocol);
if (sock != INVALID_SOCKET) {
SetHandleInformation((HANDLE)(uintptr_t)sock, HANDLE_FLAG_INHERIT, FALSE);
}
- return sock;
+ return (int)sock;
}
diff --git a/jdk/src/windows/native/java/net/net_util_md.h b/jdk/src/windows/native/java/net/net_util_md.h
index b1a37e9b826..e764260bb24 100644
--- a/jdk/src/windows/native/java/net/net_util_md.h
+++ b/jdk/src/windows/native/java/net/net_util_md.h
@@ -209,10 +209,6 @@ int
);
#endif
-LPFN_GETADDRINFO getaddrinfo_ptr;
-LPFN_FREEADDRINFO freeaddrinfo_ptr;
-LPFN_GETNAMEINFO getnameinfo_ptr;
-
/* used to disable connection reset messages on Windows XP */
#ifndef SIO_UDP_CONNRESET
#define SIO_UDP_CONNRESET _WSAIOW(IOC_VENDOR,12)
@@ -302,8 +298,6 @@ void NET_ThrowByNameWithLastError(JNIEnv *env, const char *name,
void NET_ThrowSocketException(JNIEnv *env, char* msg);
-jboolean NET_addrtransAvailable();
-
/*
* differs from NET_Timeout() as follows:
*
diff --git a/jdk/src/windows/native/sun/java2d/d3d/D3DGraphicsDevice.cpp b/jdk/src/windows/native/sun/java2d/d3d/D3DGraphicsDevice.cpp
index efb20c5d3a3..b20bd9c278d 100644
--- a/jdk/src/windows/native/sun/java2d/d3d/D3DGraphicsDevice.cpp
+++ b/jdk/src/windows/native/sun/java2d/d3d/D3DGraphicsDevice.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2007, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2007, 2011, 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
diff --git a/jdk/src/windows/native/sun/java2d/windows/GDIBlitLoops.cpp b/jdk/src/windows/native/sun/java2d/windows/GDIBlitLoops.cpp
index d3dc21dae14..5f888977713 100644
--- a/jdk/src/windows/native/sun/java2d/windows/GDIBlitLoops.cpp
+++ b/jdk/src/windows/native/sun/java2d/windows/GDIBlitLoops.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2002, 2008, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2002, 2011, 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
diff --git a/jdk/src/windows/native/sun/management/FileSystemImpl.c b/jdk/src/windows/native/sun/management/FileSystemImpl.c
index 57abea98541..0747121d35a 100644
--- a/jdk/src/windows/native/sun/management/FileSystemImpl.c
+++ b/jdk/src/windows/native/sun/management/FileSystemImpl.c
@@ -36,45 +36,6 @@
*/
#define ANY_ACCESS (FILE_GENERIC_READ | FILE_GENERIC_WRITE | FILE_GENERIC_EXECUTE)
-/*
- * Function prototypes for security functions - we can't statically
- * link because these functions aren't on Windows 9x.
- */
-typedef BOOL (WINAPI *GetFileSecurityFunc)
- (LPCTSTR lpFileName, SECURITY_INFORMATION RequestedInformation,
- PSECURITY_DESCRIPTOR pSecurityDescriptor, DWORD nLength,
- LPDWORD lpnLengthNeeded);
-
-typedef BOOL (WINAPI *GetSecurityDescriptorOwnerFunc)
- (PSECURITY_DESCRIPTOR pSecurityDescriptor, PSID *pOwner,
- LPBOOL lpbOwnerDefaulted);
-
-typedef BOOL (WINAPI *GetSecurityDescriptorDaclFunc)
- (PSECURITY_DESCRIPTOR pSecurityDescriptor, LPBOOL lpbDaclPresent,
- PACL *pDacl, LPBOOL lpbDaclDefaulted);
-
-typedef BOOL (WINAPI *GetAclInformationFunc)
- (PACL pAcl, LPVOID pAclInformation, DWORD nAclInformationLength,
- ACL_INFORMATION_CLASS dwAclInformationClass);
-
-typedef BOOL (WINAPI *GetAceFunc)
- (PACL pAcl, DWORD dwAceIndex, LPVOID *pAce);
-
-typedef BOOL (WINAPI *EqualSidFunc)(PSID pSid1, PSID pSid2);
-
-
-/* Addresses of the security functions */
-static GetFileSecurityFunc GetFileSecurity_func;
-static GetSecurityDescriptorOwnerFunc GetSecurityDescriptorOwner_func;
-static GetSecurityDescriptorDaclFunc GetSecurityDescriptorDacl_func;
-static GetAclInformationFunc GetAclInformation_func;
-static GetAceFunc GetAce_func;
-static EqualSidFunc EqualSid_func;
-
-/* True if this OS is NT kernel based (NT/2000/XP) */
-static int isNT;
-
-
/*
* Returns JNI_TRUE if the specified file is on a file system that supports
* persistent ACLs (On NTFS file systems returns true, on FAT32 file systems
@@ -165,7 +126,7 @@ static SECURITY_DESCRIPTOR* getFileSecurityDescriptor(JNIEnv* env, const char* p
SECURITY_INFORMATION info =
OWNER_SECURITY_INFORMATION | DACL_SECURITY_INFORMATION;
- (*GetFileSecurity_func)(path, info , 0, 0, &len);
+ GetFileSecurityA(path, info , 0, 0, &len);
if (GetLastError() != ERROR_INSUFFICIENT_BUFFER) {
JNU_ThrowIOExceptionWithLastError(env, "GetFileSecurity failed");
return NULL;
@@ -174,7 +135,7 @@ static SECURITY_DESCRIPTOR* getFileSecurityDescriptor(JNIEnv* env, const char* p
if (sd == NULL) {
JNU_ThrowOutOfMemoryError(env, 0);
} else {
- if (!(*GetFileSecurity_func)(path, info, sd, len, &len)) {
+ if (!(*GetFileSecurityA)(path, info, sd, len, &len)) {
JNU_ThrowIOExceptionWithLastError(env, "GetFileSecurity failed");
free(sd);
return NULL;
@@ -191,7 +152,7 @@ static SID* getFileOwner(JNIEnv* env, SECURITY_DESCRIPTOR* sd) {
SID* owner;
BOOL defaulted;
- if (!(*GetSecurityDescriptorOwner_func)(sd, &owner, &defaulted)) {
+ if (!GetSecurityDescriptorOwner(sd, &owner, &defaulted)) {
JNU_ThrowIOExceptionWithLastError(env, "GetSecurityDescriptorOwner failed");
return NULL;
}
@@ -206,7 +167,7 @@ static ACL* getFileDACL(JNIEnv* env, SECURITY_DESCRIPTOR* sd) {
ACL *acl;
int defaulted, present;
- if (!(*GetSecurityDescriptorDacl_func)(sd, &present, &acl, &defaulted)) {
+ if (!GetSecurityDescriptorDacl(sd, &present, &acl, &defaulted)) {
JNU_ThrowIOExceptionWithLastError(env, "GetSecurityDescriptorDacl failed");
return NULL;
}
@@ -235,8 +196,8 @@ static jboolean isAccessUserOnly(JNIEnv* env, SID* owner, ACL* acl) {
/*
* Get the ACE count
*/
- if (!(*GetAclInformation_func)(acl, (void *) &acl_size_info, sizeof(acl_size_info),
- AclSizeInformation)) {
+ if (!GetAclInformation(acl, (void *) &acl_size_info, sizeof(acl_size_info),
+ AclSizeInformation)) {
JNU_ThrowIOExceptionWithLastError(env, "GetAclInformation failed");
return JNI_FALSE;
}
@@ -250,7 +211,7 @@ static jboolean isAccessUserOnly(JNIEnv* env, SID* owner, ACL* acl) {
ACCESS_ALLOWED_ACE *access;
SID* sid;
- if (!(*GetAce_func)(acl, i, &ace)) {
+ if (!GetAce(acl, i, &ace)) {
JNU_ThrowIOExceptionWithLastError(env, "GetAce failed");
return -1;
}
@@ -280,51 +241,7 @@ static jboolean isAccessUserOnly(JNIEnv* env, SID* owner, ACL* acl) {
JNIEXPORT void JNICALL Java_sun_management_FileSystemImpl_init0
(JNIEnv *env, jclass ignored)
{
- OSVERSIONINFO ver;
- HINSTANCE hInst;
-
- /*
- * Get the OS version. If dwPlatformId is VER_PLATFORM_WIN32_NT
- * it means we're running on a Windows NT, 2000, or XP machine.
- */
- ver.dwOSVersionInfoSize = sizeof(ver);
- GetVersionEx(&ver);
- isNT = (ver.dwPlatformId == VER_PLATFORM_WIN32_NT);
- if (!isNT) {
- return;
- }
-
- /*
- * On NT/2000/XP we need the addresses of the security functions
- */
- hInst = LoadLibrary("ADVAPI32.DLL");
- if (hInst == NULL) {
- JNU_ThrowIOExceptionWithLastError(env, "Unable to load ADVAPI32.DLL");
- return;
- }
-
-
- GetFileSecurity_func = (GetFileSecurityFunc)GetProcAddress(hInst, "GetFileSecurityA");
- GetSecurityDescriptorOwner_func =
- (GetSecurityDescriptorOwnerFunc)GetProcAddress(hInst, "GetSecurityDescriptorOwner");
- GetSecurityDescriptorDacl_func =
- (GetSecurityDescriptorDaclFunc)GetProcAddress(hInst, "GetSecurityDescriptorDacl");
- GetAclInformation_func =
- (GetAclInformationFunc)GetProcAddress(hInst, "GetAclInformation");
- GetAce_func = (GetAceFunc)GetProcAddress(hInst, "GetAce");
- EqualSid_func = (EqualSidFunc)GetProcAddress(hInst, "EqualSid");
-
- if (GetFileSecurity_func == NULL ||
- GetSecurityDescriptorDacl_func == NULL ||
- GetSecurityDescriptorDacl_func == NULL ||
- GetAclInformation_func == NULL ||
- GetAce_func == NULL ||
- EqualSid_func == NULL)
- {
- JNU_ThrowIOExceptionWithLastError(env,
- "Unable to get address of security functions");
- return;
- }
+ /* nothing to do */
}
/*
@@ -339,10 +256,6 @@ JNIEXPORT jboolean JNICALL Java_sun_management_FileSystemImpl_isSecuritySupporte
jboolean isCopy;
const char* path;
- if (!isNT) {
- return JNI_FALSE;
- }
-
path = JNU_GetStringPlatformChars(env, str, &isCopy);
if (path != NULL) {
res = isSecuritySupported(env, path);
diff --git a/jdk/src/windows/native/sun/net/dns/ResolverConfigurationImpl.c b/jdk/src/windows/native/sun/net/dns/ResolverConfigurationImpl.c
index 21a87afa25e..8885bdc7902 100644
--- a/jdk/src/windows/native/sun/net/dns/ResolverConfigurationImpl.c
+++ b/jdk/src/windows/native/sun/net/dns/ResolverConfigurationImpl.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2002, 2008, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2002, 2011, 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
@@ -30,6 +30,7 @@
#include
#include
#include
+#include
#include "jni_util.h"
@@ -42,93 +43,17 @@
#define IS_SL_FOUND(sts) (sts & STS_SL_FOUND)
#define IS_NS_FOUND(sts) (sts & STS_NS_FOUND)
-/*
- * Visual C++ SP3 (as required by J2SE 1.4.0) is missing some of
- * the definitions required for the IP helper library routines that
- * were added in Windows 98 & Windows 2000.
- */
-#ifndef MAX_ADAPTER_NAME_LENGTH
-
-#define MAX_ADAPTER_ADDRESS_LENGTH 8
-#define MAX_ADAPTER_DESCRIPTION_LENGTH 128
-#define MAX_ADAPTER_NAME_LENGTH 256
-#define MAX_HOSTNAME_LEN 128
-#define MAX_DOMAIN_NAME_LEN 128
-#define MAX_SCOPE_ID_LEN 256
-
-typedef struct {
- char String[4 * 4];
-} IP_ADDRESS_STRING, *PIP_ADDRESS_STRING, IP_MASK_STRING, *PIP_MASK_STRING;
-
-typedef struct _IP_ADDR_STRING {
- struct _IP_ADDR_STRING* Next;
- IP_ADDRESS_STRING IpAddress;
- IP_MASK_STRING IpMask;
- DWORD Context;
-} IP_ADDR_STRING, *PIP_ADDR_STRING;
-
-typedef struct _IP_ADAPTER_INFO {
- struct _IP_ADAPTER_INFO* Next;
- DWORD ComboIndex;
- char AdapterName[MAX_ADAPTER_NAME_LENGTH + 4];
- char Description[MAX_ADAPTER_DESCRIPTION_LENGTH + 4];
- UINT AddressLength;
- BYTE Address[MAX_ADAPTER_ADDRESS_LENGTH];
- DWORD Index;
- UINT Type;
- UINT DhcpEnabled;
- PIP_ADDR_STRING CurrentIpAddress;
- IP_ADDR_STRING IpAddressList;
- IP_ADDR_STRING GatewayList;
- IP_ADDR_STRING DhcpServer;
- BOOL HaveWins;
- IP_ADDR_STRING PrimaryWinsServer;
- IP_ADDR_STRING SecondaryWinsServer;
- time_t LeaseObtained;
- time_t LeaseExpires;
-} IP_ADAPTER_INFO, *PIP_ADAPTER_INFO;
-
-typedef struct _FIXED_INFO {
- char HostName[MAX_HOSTNAME_LEN + 4] ;
- char DomainName[MAX_DOMAIN_NAME_LEN + 4];
- PIP_ADDR_STRING CurrentDnsServer;
- IP_ADDR_STRING DnsServerList;
- UINT NodeType;
- char ScopeId[MAX_SCOPE_ID_LEN + 4];
- UINT EnableRouting;
- UINT EnableProxy;
- UINT EnableDns;
-} FIXED_INFO, *PFIXED_INFO;
-
-#endif
-
-
-/* IP helper library routine used on 98/2000/XP */
-static int (PASCAL FAR *GetNetworkParams_fn)();
-static int (PASCAL FAR *GetAdaptersInfo_fn)();
-static int (PASCAL FAR *NotifyAddrChange_fn)();
-
-/*
- * Routines to obtain domain name and name servers are OS specific
- */
-typedef int (*LoadConfig)(char *sl, char *ns);
-static LoadConfig loadconfig_fn;
-
-
-/*
- * JNI ids
- */
+/* JNI ids */
static jfieldID searchlistID;
static jfieldID nameserversID;
-
/*
* Utility routine to append s2 to s1 with a space delimiter.
* strappend(s1="abc", "def") => "abc def"
* strappend(s1="", "def") => "def
*/
void strappend(char *s1, char *s2) {
- int len;
+ size_t len;
if (s2[0] == '\0') /* nothing to append */
return;
@@ -145,356 +70,6 @@ void strappend(char *s1, char *s2) {
strcat(s1, s2);
}
-
-/*
- * Windows 95/98/ME for static TCP/IP configuration.
- *
- * Use registry approach for statically configured TCP/IP settings.
- * Registry entries described in "MS TCP/IP and Windows 95 Networking"
- * (Microsoft TechNet site).
- */
-static int loadStaticConfig9x(char *sl, char *ns) {
- LONG ret;
- HANDLE hKey;
- DWORD dwLen;
- ULONG ulType;
- char result[MAX_STR_LEN];
- int sts = STS_NO_CONFIG;
-
- ret = RegOpenKeyEx(HKEY_LOCAL_MACHINE,
- "SYSTEM\\CurrentControlSet\\Services\\VxD\\MSTCP",
- 0,
- KEY_READ,
- (PHKEY)&hKey);
- if (ret == ERROR_SUCCESS) {
- /*
- * Determine suffix list
- */
- result[0] = '\0';
- dwLen = sizeof(result);
- ret = RegQueryValueEx(hKey, "SearchList", NULL, &ulType,
- (LPBYTE)&result, &dwLen);
- if ((ret != ERROR_SUCCESS) || (strlen(result) == 0)) {
- dwLen = sizeof(result);
- ret = RegQueryValueEx(hKey, "Domain", NULL, &ulType,
- (LPBYTE)&result, &dwLen);
- }
- if (ret == ERROR_SUCCESS) {
- assert(ulType == REG_SZ);
- if (strlen(result) > 0) {
- strappend(sl, result);
- sts |= STS_SL_FOUND;
- }
- }
-
- /*
- * Determine DNS name server(s)
- */
- result[0] = '\0';
- dwLen = sizeof(result);
- ret = RegQueryValueEx(hKey, "NameServer", NULL, &ulType,
- (LPBYTE)&result, &dwLen);
- if (ret == ERROR_SUCCESS) {
- assert(ulType == REG_SZ);
- if (strlen(result) > 0) {
- strappend(ns, result);
- sts |= STS_NS_FOUND;
- }
- }
-
- RegCloseKey(hKey);
- }
-
- return sts;
-}
-
-
-/*
- * Windows 95
- *
- * Use registry approach for statically configured TCP/IP settings
- * (see loadStaticConfig9x).
- *
- * If DHCP is used we examine the DHCP vendor specific extensions. We parse
- * this based on format described in RFC 2132.
- *
- * If Dial-up Networking (DUN) is used then this TCP/IP settings cannot
- * be determined here.
- */
-static int loadConfig95(char *sl, char *ns) {
- int sts;
- int index;
- LONG ret;
- HANDLE hKey;
- DWORD dwLen;
- ULONG ulType;
- char optionInfo[MAX_STR_LEN];
-
- /*
- * First try static configuration - if found we are done.
- */
- sts = loadStaticConfig9x(sl, ns);
- if (IS_SL_FOUND(sts) && IS_NS_FOUND(sts)) {
- return sts;
- }
-
- /*
- * Try DHCP. DHCP information is stored in :-
- * SYSTEM\CurrentControlSet\Services\VxD\DHCP\DhcpInfoXX
- *
- * The key is normally DhcpInfo00\OptionInfo (see Article Q255245 on
- * Microsoft site). However when multiple cards are added & removed we
- * have observed that it can be located in DhcpInfo{01,02, ...}.
- * As a hack we search all DhcpInfoXX keys until we find OptionInfo.
- */
- for (index=0; index<99; index++) {
- char key[MAX_STR_LEN];
- sprintf(key, "SYSTEM\\CurrentControlSet\\Services\\VxD\\DHCP\\DhcpInfo%02d",
- index);
-
- ret = RegOpenKeyEx(HKEY_LOCAL_MACHINE, key, 0, KEY_READ, (PHKEY)&hKey);
- if (ret != ERROR_SUCCESS) {
- /* end of DhcpInfoXX entries */
- break;
- }
-
- dwLen = sizeof(optionInfo);
- ret = RegQueryValueEx(hKey, "OptionInfo", NULL, &ulType,
- (LPBYTE)optionInfo, &dwLen);
- RegCloseKey(hKey);
-
- if (ret == ERROR_SUCCESS) {
- /* OptionInfo found */
- break;
- }
- }
-
- /*
- * If OptionInfo was found then we parse (as the 'options' field of
- * the DHCP packet - see RFC 2132).
- */
- if (ret == ERROR_SUCCESS) {
- unsigned int pos = 0;
-
- while (pos < dwLen) {
- int code, len;
-
- code = optionInfo[pos];
- pos++;
- if (pos >= dwLen) break; /* bad packet */
-
- len = optionInfo[pos];
- pos++;
-
- if (pos+len > dwLen) break; /* bad packet */
-
- /*
- * Domain Name - see RFC 2132 section 3.17
- */
- if (!IS_SL_FOUND(sts)) {
- if (code == 0xf) {
- char domain[MAX_STR_LEN];
-
- assert(len < MAX_STR_LEN);
-
- memcpy((void *)domain, (void *)&(optionInfo[pos]), (size_t)len);
- domain[len] = '\0';
-
- strappend(sl, domain);
- sts |= STS_SL_FOUND;
- }
- }
-
- /*
- * DNS Option - see RFC 2132 section 3.8
- */
- if (!IS_NS_FOUND(sts)) {
- if (code == 6 && (len % 4) == 0) {
- while (len > 0 && pos < dwLen) {
- char addr[32];
- sprintf(addr, "%d.%d.%d.%d",
- (unsigned char)optionInfo[pos],
- (unsigned char)optionInfo[pos+1],
- (unsigned char)optionInfo[pos+2],
- (unsigned char)optionInfo[pos+3]);
- pos += 4;
- len -= 4;
-
- /*
- * Append to list of name servers
- */
- strappend(ns, addr);
- sts |= STS_NS_FOUND;
- }
- }
- }
-
- /*
- * Onto the next options
- */
- pos += len;
- }
- }
-
- return sts;
-}
-
-/*
- * Windows 98/ME
- *
- * Use registry approach for statically configured TCP/IP settings
- * (see loadStaticConfig9x).
- *
- * If configuration is not static then use IP helper library routine
- * GetNetworkParams to obtain the network settings which include the
- * domain name and the DNS servers. Note that we use the registry in
- * preference to GetNetworkParams as the domain name is not populated
- * by GetNetworkParams if the configuration is static.
- */
-static int loadConfig98(char *sl, char *ns) {
- FIXED_INFO *infoP;
- ULONG size;
- DWORD ret;
- int sts;
-
- /*
- * Use registry approach to pick up static configuation.
- */
- sts = loadStaticConfig9x(sl, ns);
- if (IS_SL_FOUND(sts) && IS_NS_FOUND(sts)) {
- return sts;
- }
-
- /*
- * Use IP helper library to obtain dynamic configuration (DHCP and
- * DUN).
- */
- size = sizeof(FIXED_INFO);
- infoP = (FIXED_INFO *)malloc(size);
- if (infoP) {
- ret = (*GetNetworkParams_fn)(infoP, &size);
- if (ret == ERROR_BUFFER_OVERFLOW) {
- infoP = (FIXED_INFO *)realloc(infoP, size);
- if (infoP != NULL)
- ret = (*GetNetworkParams_fn)(infoP, &size);
- }
- }
- if (infoP == NULL) {
- return sts;
- }
- if (ret == ERROR_SUCCESS) {
- /*
- * Use DomainName if search-list not specified.
- */
- if (!IS_SL_FOUND(sts)) {
- strappend(sl, infoP->DomainName);
- sts |= STS_SL_FOUND;
- }
-
- /*
- * Use DnsServerList if not statically configured.
- */
- if (!IS_NS_FOUND(sts)) {
- PIP_ADDR_STRING dnsP = &(infoP->DnsServerList);
- do {
- strappend(ns, (char *)&(dnsP->IpAddress));
- dnsP = dnsP->Next;
- } while (dnsP != NULL);
- sts |= STS_NS_FOUND;
- }
- }
-
- free(infoP);
-
- return sts;
-}
-
-
-/*
- * Windows NT
- *
- * Use registry approach based on settings described in "TCP/IP and
- * NBT Configuration Parameters for Windows" - Article Q12062 on
- * Microsoft site.
- *
- * All non-RAS TCP/IP settings are stored in HKEY_LOCAL_MACHINE in
- * the SYSTEM\CurrentControlSet\Services\Tcpip\Parameters key.
- *
- * If SearchList if not provided then return Domain or DhcpDomain.
- * If Domain is specified it overrides DhcpDomain even if DHCP is
- * enabled.
- *
- * DNS name servers based on NameServer or DhcpNameServer settings.
- * NameServer overrides DhcpNameServer even if DHCP is enabled.
- */
-static int loadConfigNT(char *sl, char *ns) {
- LONG ret;
- HANDLE hKey;
- DWORD dwLen;
- ULONG ulType;
- char result[MAX_STR_LEN];
- int sts = STS_NO_CONFIG;
-
- ret = RegOpenKeyEx(HKEY_LOCAL_MACHINE,
- "SYSTEM\\CurrentControlSet\\Services\\Tcpip\\Parameters",
- 0,
- KEY_READ,
- (PHKEY)&hKey);
- if (ret != ERROR_SUCCESS) {
- return sts;
- }
-
- /*
- * Determine search list
- */
- result[0] = '\0';
- dwLen = sizeof(result);
- ret = RegQueryValueEx(hKey, "SearchList", NULL, &ulType,
- (LPBYTE)&result, &dwLen);
- if ((ret != ERROR_SUCCESS) || (strlen(result) == 0)) {
- dwLen = sizeof(result);
- ret = RegQueryValueEx(hKey, "Domain", NULL, &ulType,
- (LPBYTE)&result, &dwLen);
- if ((ret != ERROR_SUCCESS) || (strlen(result) == 0)) {
- dwLen = sizeof(result);
- ret = RegQueryValueEx(hKey, "DhcpDomain", NULL, &ulType,
- (LPBYTE)&result, &dwLen);
- }
- }
- if (ret == ERROR_SUCCESS) {
- assert(ulType == REG_SZ);
- if (strlen(result) > 0) {
- strappend(sl, result);
- sts |= STS_SL_FOUND;
- }
- }
-
- /*
- * Determine DNS name server(s)
- */
- result[0] = '\0';
- dwLen = sizeof(result);
- ret = RegQueryValueEx(hKey, "NameServer", NULL, &ulType,
- (LPBYTE)&result, &dwLen);
- if ((ret != ERROR_SUCCESS) || (strlen(result) == 0)) {
- dwLen = sizeof(result);
- ret = RegQueryValueEx(hKey, "DhcpNameServer", NULL, &ulType,
- (LPBYTE)&result, &dwLen);
- }
- if (ret == ERROR_SUCCESS) {
- assert(ulType == REG_SZ);
- if (strlen(result) > 0) {
- strappend(ns, result);
- sts |= STS_NS_FOUND;
- }
- }
-
- RegCloseKey(hKey);
-
- return sts;
-}
-
-
/*
* Windows 2000/XP
*
@@ -510,7 +85,7 @@ static int loadConfigNT(char *sl, char *ns) {
* names of each adapter and then query the corresponding registry
* settings to obtain NameServer/DhcpNameServer and Domain/DhcpDomain.
*/
-static int loadConfig2000(char *sl, char *ns) {
+static int loadConfig(char *sl, char *ns) {
IP_ADAPTER_INFO *adapterP;
ULONG size;
DWORD ret;
@@ -547,10 +122,10 @@ static int loadConfig2000(char *sl, char *ns) {
*/
size = sizeof(IP_ADAPTER_INFO);
adapterP = (IP_ADAPTER_INFO *)malloc(size);
- ret = (*GetAdaptersInfo_fn)(adapterP, &size);
+ ret = GetAdaptersInfo(adapterP, &size);
if (ret == ERROR_BUFFER_OVERFLOW) {
adapterP = (IP_ADAPTER_INFO *)realloc(adapterP, size);
- ret = (*GetAdaptersInfo_fn)(adapterP, &size);
+ ret = GetAdaptersInfo(adapterP, &size);
}
/*
@@ -648,87 +223,15 @@ static int loadConfig2000(char *sl, char *ns) {
/*
- * Initialization :-
- *
- * 1. Based on OS version set the function pointer for OS specific load
- * configuration routine.
- *
- * 2. On 98/2000/XP load the IP helper library.
- *
- * 3. Initialize JNI field IDs.
- *
+ * Initialize JNI field IDs.
*/
JNIEXPORT void JNICALL
Java_sun_net_dns_ResolverConfigurationImpl_init0(JNIEnv *env, jclass cls)
{
- OSVERSIONINFO ver;
- jboolean loadHelperLibrary = JNI_TRUE;
-
- /*
- * First we figure out which OS is running
- */
- ver.dwOSVersionInfoSize = sizeof(ver);
- GetVersionEx(&ver);
-
- if (ver.dwPlatformId == VER_PLATFORM_WIN32_WINDOWS) {
- if ((ver.dwMajorVersion == 4) && (ver.dwMinorVersion == 0)) {
- /*
- * Windows 95
- */
- loadHelperLibrary = JNI_FALSE;
- loadconfig_fn = loadConfig95;
- } else {
- /*
- * Windows 98/ME
- */
- loadHelperLibrary = JNI_TRUE;
- loadconfig_fn = loadConfig98;
- }
- }
-
- if (ver.dwPlatformId == VER_PLATFORM_WIN32_NT) {
- if (ver.dwMajorVersion <= 4) {
- /*
- * Windows NT
- */
- loadHelperLibrary = JNI_FALSE;
- loadconfig_fn = loadConfigNT;
- } else {
- /*
- * Windows 2000/XP
- */
- loadHelperLibrary = JNI_TRUE;
- loadconfig_fn = loadConfig2000;
- }
- }
-
- /*
- * On 98/2000/XP we load the IP Helper Library.
- */
- if (loadHelperLibrary) {
- HANDLE h = LoadLibrary("iphlpapi.dll");
-
- if (h != NULL) {
- GetNetworkParams_fn = (int (PASCAL FAR *)())GetProcAddress(h, "GetNetworkParams");
- GetAdaptersInfo_fn = (int (PASCAL FAR *)())GetProcAddress(h, "GetAdaptersInfo");
-
- NotifyAddrChange_fn = (int (PASCAL FAR *)())GetProcAddress(h, "NotifyAddrChange");
- }
-
- if (GetNetworkParams_fn == NULL || GetAdaptersInfo_fn == NULL) {
- JNU_ThrowByName(env, "java/lang/UnsatisfiedLinkError", "iphlpapi.dll");
- return;
- }
- }
-
- /*
- * Get JNI ids
- */
searchlistID = (*env)->GetStaticFieldID(env, cls, "os_searchlist",
"Ljava/lang/String;");
nameserversID = (*env)->GetStaticFieldID(env, cls, "os_nameservers",
"Ljava/lang/String;");
-
}
/*
@@ -746,8 +249,7 @@ Java_sun_net_dns_ResolverConfigurationImpl_loadDNSconfig0(JNIEnv *env, jclass cl
searchlist[0] = '\0';
nameservers[0] = '\0';
- /* call OS specific routine */
- (void)(*loadconfig_fn)(searchlist, nameservers);
+ loadConfig(searchlist, nameservers);
/*
* Populate static fields in sun.net.DefaultResolverConfiguration
@@ -772,17 +274,15 @@ Java_sun_net_dns_ResolverConfigurationImpl_notifyAddrChange0(JNIEnv *env, jclass
HANDLE h;
DWORD rc, xfer;
- if (NotifyAddrChange_fn != NULL) {
- ol.hEvent = (HANDLE)0;
- rc = (*NotifyAddrChange_fn)(&h, &ol);
- if (rc == ERROR_IO_PENDING) {
- rc = GetOverlappedResult(h, &ol, &xfer, TRUE);
- if (rc != 0) {
- return 0; /* address changed */
- }
+ ol.hEvent = (HANDLE)0;
+ rc = NotifyAddrChange(&h, &ol);
+ if (rc == ERROR_IO_PENDING) {
+ rc = GetOverlappedResult(h, &ol, &xfer, TRUE);
+ if (rc != 0) {
+ return 0; /* address changed */
}
}
- /* NotifyAddrChange not support or error */
+ /* error */
return -1;
}
diff --git a/jdk/src/windows/native/sun/net/www/protocol/http/ntlm/NTLMAuthSequence.c b/jdk/src/windows/native/sun/net/www/protocol/http/ntlm/NTLMAuthSequence.c
index fca399d3206..86af0a877a1 100644
--- a/jdk/src/windows/native/sun/net/www/protocol/http/ntlm/NTLMAuthSequence.c
+++ b/jdk/src/windows/native/sun/net/www/protocol/http/ntlm/NTLMAuthSequence.c
@@ -41,18 +41,6 @@
#define SECURITY_WIN32
#include "sspi.h"
-
-/*
- * OS calls loaded from DLL on intialization
- */
-
-static FREE_CREDENTIALS_HANDLE_FN pFreeCredentialsHandle;
-static ACQUIRE_CREDENTIALS_HANDLE_FN pAcquireCredentialsHandle;
-static FREE_CONTEXT_BUFFER_FN pFreeContextBuffer;
-static INITIALIZE_SECURITY_CONTEXT_FN pInitializeSecurityContext;
-static COMPLETE_AUTH_TOKEN_FN pCompleteAuthToken;
-static DELETE_SECURITY_CONTEXT_FN pDeleteSecurityContext;
-
static void endSequence (PCredHandle credHand, PCtxtHandle ctxHandle);
static jfieldID ntlm_ctxHandleID;
@@ -63,48 +51,8 @@ static HINSTANCE lib = NULL;
JNIEXPORT void JNICALL Java_sun_net_www_protocol_http_ntlm_NTLMAuthSequence_initFirst
(JNIEnv *env, jclass clazz)
{
- OSVERSIONINFO version;
- UCHAR libName[MAX_PATH];
-
ntlm_ctxHandleID = (*env)->GetFieldID(env, clazz, "ctxHandle", "J");
ntlm_crdHandleID = (*env)->GetFieldID(env, clazz, "crdHandle", "J");
-
- version.dwOSVersionInfoSize = sizeof (OSVERSIONINFO);
- GetVersionEx (&version);
-
- if (version.dwPlatformId == VER_PLATFORM_WIN32_NT) {
- strcpy (libName, "security.dll" );
- }
- else if (version.dwPlatformId == VER_PLATFORM_WIN32_WINDOWS) {
- strcpy (libName, "secur32.dll" );
- }
-
- lib = LoadLibrary (libName);
-
- pFreeCredentialsHandle
- = (FREE_CREDENTIALS_HANDLE_FN) GetProcAddress(
- lib, "FreeCredentialsHandle" );
-
- pAcquireCredentialsHandle
- = (ACQUIRE_CREDENTIALS_HANDLE_FN) GetProcAddress(
- lib, "AcquireCredentialsHandleA" );
-
- pFreeContextBuffer
- = (FREE_CONTEXT_BUFFER_FN) GetProcAddress(
- lib, "FreeContextBuffer" );
-
- pInitializeSecurityContext
- = (INITIALIZE_SECURITY_CONTEXT_FN) GetProcAddress(
- lib, "InitializeSecurityContextA" );
-
- pCompleteAuthToken
- = (COMPLETE_AUTH_TOKEN_FN) GetProcAddress(
- lib, "CompleteAuthToken" );
-
- pDeleteSecurityContext
- = (DELETE_SECURITY_CONTEXT_FN) GetProcAddress(
- lib, "DeleteSecurityContext" );
-
}
/*
@@ -158,17 +106,17 @@ JNIEXPORT jlong JNICALL Java_sun_net_www_protocol_http_ntlm_NTLMAuthSequence_get
if ( pUser != NULL ) {
AuthId.User = (unsigned char *) pUser;
- AuthId.UserLength = strlen( pUser );
+ AuthId.UserLength = (unsigned long) strlen( pUser );
}
if ( pPassword != NULL ) {
AuthId.Password = (unsigned char *) pPassword;
- AuthId.PasswordLength = strlen( pPassword );
+ AuthId.PasswordLength = (unsigned long) strlen( pPassword );
}
if ( pDomain != NULL ) {
AuthId.Domain = (unsigned char *) pDomain;
- AuthId.DomainLength = strlen( pDomain );
+ AuthId.DomainLength = (unsigned long) strlen( pDomain );
}
AuthId.Flags = SEC_WINNT_AUTH_IDENTITY_ANSI;
@@ -176,7 +124,7 @@ JNIEXPORT jlong JNICALL Java_sun_net_www_protocol_http_ntlm_NTLMAuthSequence_get
pAuthId = NULL;
}
- ss = pAcquireCredentialsHandle(
+ ss = AcquireCredentialsHandleA(
NULL, "NTLM", SECPKG_CRED_OUTBOUND,
NULL, pAuthId, NULL, NULL,
pCred, <ime
@@ -258,7 +206,7 @@ JNIEXPORT jbyteArray JNICALL Java_sun_net_www_protocol_http_ntlm_NTLMAuthSequenc
* need to send the out buffer if there are bytes to send
*/
- ss = pInitializeSecurityContext(
+ ss = InitializeSecurityContextA(
pCred, pCtx, NULL, 0, 0, SECURITY_NATIVE_DREP,
lastToken ? &InBuffDesc : NULL, 0, newContext, &OutBuffDesc,
&ContextAttributes, <ime
@@ -274,7 +222,7 @@ JNIEXPORT jbyteArray JNICALL Java_sun_net_www_protocol_http_ntlm_NTLMAuthSequenc
}
if ((ss == SEC_I_COMPLETE_NEEDED) || (ss == SEC_I_COMPLETE_AND_CONTINUE) ) {
- ss = pCompleteAuthToken( pCtx, &OutBuffDesc );
+ ss = CompleteAuthToken( pCtx, &OutBuffDesc );
if (ss < 0) {
endSequence (pCred, pCtx);
@@ -300,12 +248,12 @@ JNIEXPORT jbyteArray JNICALL Java_sun_net_www_protocol_http_ntlm_NTLMAuthSequenc
static void endSequence (PCredHandle credHand, PCtxtHandle ctxHandle) {
if (credHand != 0) {
- pFreeCredentialsHandle (credHand);
- free (credHand);
+ FreeCredentialsHandle(credHand);
+ free(credHand);
}
if (ctxHandle != 0) {
- pDeleteSecurityContext(ctxHandle);
- free (ctxHandle);
+ DeleteSecurityContext(ctxHandle);
+ free(ctxHandle);
}
}
diff --git a/jdk/src/windows/native/sun/nio/ch/Iocp.c b/jdk/src/windows/native/sun/nio/ch/Iocp.c
index 773a870ca2b..8f87a8937f7 100644
--- a/jdk/src/windows/native/sun/nio/ch/Iocp.c
+++ b/jdk/src/windows/native/sun/nio/ch/Iocp.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2008, 2009, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2008, 2011, 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
diff --git a/jdk/src/windows/native/sun/nio/ch/Net.c b/jdk/src/windows/native/sun/nio/ch/Net.c
index b415cdfc3e2..55c03a28b5b 100644
--- a/jdk/src/windows/native/sun/nio/ch/Net.c
+++ b/jdk/src/windows/native/sun/nio/ch/Net.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2001, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 2011, 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
@@ -100,6 +100,18 @@ Java_sun_nio_ch_Net_isIPv6Available0(JNIEnv* env, jclass cl)
return JNI_FALSE;
}
+JNIEXPORT jboolean JNICALL
+Java_sun_nio_ch_Net_canIPv6SocketJoinIPv4Group0(JNIEnv* env, jclass cl)
+{
+ return JNI_FALSE;
+}
+
+JNIEXPORT jboolean JNICALL
+Java_sun_nio_ch_Net_canJoin6WithIPv4Group0(JNIEnv* env, jclass cl)
+{
+ return JNI_FALSE;
+}
+
JNIEXPORT jint JNICALL
Java_sun_nio_ch_Net_socket0(JNIEnv *env, jclass cl, jboolean preferIPv6,
jboolean stream, jboolean reuse)
diff --git a/jdk/src/windows/native/sun/nio/fs/RegistryFileTypeDetector.c b/jdk/src/windows/native/sun/nio/fs/RegistryFileTypeDetector.c
index 6d082271015..946fc46601d 100644
--- a/jdk/src/windows/native/sun/nio/fs/RegistryFileTypeDetector.c
+++ b/jdk/src/windows/native/sun/nio/fs/RegistryFileTypeDetector.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2008, 2009, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2008, 2011, 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
diff --git a/jdk/src/windows/native/sun/nio/fs/WindowsNativeDispatcher.c b/jdk/src/windows/native/sun/nio/fs/WindowsNativeDispatcher.c
index d9d8a9d7cb2..5faf34d2458 100644
--- a/jdk/src/windows/native/sun/nio/fs/WindowsNativeDispatcher.c
+++ b/jdk/src/windows/native/sun/nio/fs/WindowsNativeDispatcher.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2008, 2009, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2008, 2011, 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 @@
*/
#ifndef _WIN32_WINNT
-#define _WIN32_WINNT 0x0500
+#define _WIN32_WINNT 0x0501
#endif
#include
@@ -36,6 +36,7 @@
#include
#include
#include
+#include
#include "jni.h"
#include "jni_util.h"
@@ -77,40 +78,20 @@ static jfieldID backupResult_context;
/**
- * Win32 APIs not defined in Visual Studio 2003 header files
+ * Win32 APIs not available in Windows XP
*/
-
-typedef enum {
- FindStreamInfoStandard
-} MY_STREAM_INFO_LEVELS;
-
-typedef struct _MY_WIN32_FIND_STREAM_DATA {
- LARGE_INTEGER StreamSize;
- WCHAR cStreamName[MAX_PATH + 36];
-} MY_WIN32_FIND_STREAM_DATA;
-
-typedef HANDLE (WINAPI* FindFirstStream_Proc)(LPCWSTR, MY_STREAM_INFO_LEVELS, LPVOID, DWORD);
+typedef HANDLE (WINAPI* FindFirstStream_Proc)(LPCWSTR, STREAM_INFO_LEVELS, LPVOID, DWORD);
typedef BOOL (WINAPI* FindNextStream_Proc)(HANDLE, LPVOID);
typedef BOOLEAN (WINAPI* CreateSymbolicLinkProc) (LPCWSTR, LPCWSTR, DWORD);
-typedef BOOL (WINAPI* CreateHardLinkProc) (LPCWSTR, LPCWSTR, LPSECURITY_ATTRIBUTES);
typedef BOOL (WINAPI* GetFinalPathNameByHandleProc) (HANDLE, LPWSTR, DWORD, DWORD);
-typedef BOOL (WINAPI* ConvertSidToStringSidProc) (PSID, LPWSTR*);
-typedef BOOL (WINAPI* ConvertStringSidToSidProc) (LPWSTR, PSID*);
-typedef DWORD (WINAPI* GetLengthSidProc) (PSID);
-
static FindFirstStream_Proc FindFirstStream_func;
static FindNextStream_Proc FindNextStream_func;
static CreateSymbolicLinkProc CreateSymbolicLink_func;
-static CreateHardLinkProc CreateHardLink_func;
static GetFinalPathNameByHandleProc GetFinalPathNameByHandle_func;
-static ConvertSidToStringSidProc ConvertSidToStringSid_func;
-static ConvertStringSidToSidProc ConvertStringSidToSid_func;
-static GetLengthSidProc GetLengthSid_func;
-
static void throwWindowsException(JNIEnv* env, DWORD lastError) {
jobject x = JNU_NewObjectByName(env, "sun/nio/fs/WindowsException",
"(I)V", lastError);
@@ -190,33 +171,23 @@ Java_sun_nio_fs_WindowsNativeDispatcher_initIDs(JNIEnv* env, jclass this)
backupResult_bytesTransferred = (*env)->GetFieldID(env, clazz, "bytesTransferred", "I");
backupResult_context = (*env)->GetFieldID(env, clazz, "context", "J");
-
- h = LoadLibrary("kernel32");
- if (h != INVALID_HANDLE_VALUE) {
+ // get handle to kernel32
+ if (GetModuleHandleExW((GET_MODULE_HANDLE_EX_FLAG_FROM_ADDRESS |
+ GET_MODULE_HANDLE_EX_FLAG_UNCHANGED_REFCOUNT),
+ (LPCWSTR)&CreateFileW, &h) != 0)
+ {
+ // requires Windows Server 2003 or newer
FindFirstStream_func =
(FindFirstStream_Proc)GetProcAddress(h, "FindFirstStreamW");
FindNextStream_func =
(FindNextStream_Proc)GetProcAddress(h, "FindNextStreamW");
+
+ // requires Windows Vista or newer
CreateSymbolicLink_func =
(CreateSymbolicLinkProc)GetProcAddress(h, "CreateSymbolicLinkW");
- CreateHardLink_func =
- (CreateHardLinkProc)GetProcAddress(h, "CreateHardLinkW");
GetFinalPathNameByHandle_func =
(GetFinalPathNameByHandleProc)GetProcAddress(h, "GetFinalPathNameByHandleW");
- FreeLibrary(h);
}
-
- h = LoadLibrary("advapi32");
- if (h != INVALID_HANDLE_VALUE) {
- ConvertSidToStringSid_func =
- (ConvertSidToStringSidProc)GetProcAddress(h, "ConvertSidToStringSidW");
- ConvertStringSidToSid_func =
- (ConvertStringSidToSidProc)GetProcAddress(h, "ConvertStringSidToSidW");
- GetLengthSid_func =
- (GetLengthSidProc)GetProcAddress(h, "GetLengthSid");
- FreeLibrary(h);
- }
-
}
JNIEXPORT jstring JNICALL
@@ -413,7 +384,7 @@ JNIEXPORT void JNICALL
Java_sun_nio_fs_WindowsNativeDispatcher_FindFirstStream0(JNIEnv* env, jclass this,
jlong address, jobject obj)
{
- MY_WIN32_FIND_STREAM_DATA data;
+ WIN32_FIND_STREAM_DATA data;
LPCWSTR lpFileName = jlong_to_ptr(address);
HANDLE handle;
@@ -443,7 +414,7 @@ JNIEXPORT jstring JNICALL
Java_sun_nio_fs_WindowsNativeDispatcher_FindNextStream(JNIEnv* env, jclass this,
jlong handle)
{
- MY_WIN32_FIND_STREAM_DATA data;
+ WIN32_FIND_STREAM_DATA data;
HANDLE h = (HANDLE)jlong_to_ptr(handle);
if (FindNextStream_func == NULL) {
@@ -909,12 +880,7 @@ Java_sun_nio_fs_WindowsNativeDispatcher_GetLengthSid(JNIEnv* env,
jclass this, jlong address)
{
PSID sid = jlong_to_ptr(address);
-
- if (GetLengthSid_func == NULL) {
- JNU_ThrowInternalError(env, "Should not get here");
- return 0;
- }
- return (jint)(*GetLengthSid_func)(sid);
+ return (jint)GetLengthSid(sid);
}
@@ -924,13 +890,7 @@ Java_sun_nio_fs_WindowsNativeDispatcher_ConvertSidToStringSid(JNIEnv* env,
{
PSID sid = jlong_to_ptr(address);
LPWSTR string;
-
- if (ConvertSidToStringSid_func == NULL) {
- JNU_ThrowInternalError(env, "Should not get here");
- return NULL;
- }
-
- if ((*ConvertSidToStringSid_func)(sid, &string) == 0) {
+ if (ConvertSidToStringSidW(sid, &string) == 0) {
throwWindowsException(env, GetLastError());
return NULL;
} else {
@@ -947,15 +907,8 @@ Java_sun_nio_fs_WindowsNativeDispatcher_ConvertStringSidToSid0(JNIEnv* env,
{
LPWSTR lpStringSid = jlong_to_ptr(address);
PSID pSid;
-
- if (ConvertStringSidToSid_func == NULL) {
- JNU_ThrowInternalError(env, "Should not get here");
- return (jlong)0;
- }
-
- if ((*ConvertStringSidToSid_func)(lpStringSid, &pSid) == 0)
+ if (ConvertStringSidToSidW(lpStringSid, &pSid) == 0)
throwWindowsException(env, GetLastError());
-
return ptr_to_jlong(pSid);
}
@@ -1137,11 +1090,7 @@ Java_sun_nio_fs_WindowsNativeDispatcher_CreateHardLink0(JNIEnv* env,
LPCWSTR newFile = jlong_to_ptr(newFileAddress);
LPCWSTR existingFile = jlong_to_ptr(existingFileAddress);
- if (CreateHardLink_func == NULL) {
- JNU_ThrowInternalError(env, "Should not get here");
- return;
- }
- if ((*CreateHardLink_func)(newFile, existingFile, NULL) == 0)
+ if (CreateHardLinkW(newFile, existingFile, NULL) == 0)
throwWindowsException(env, GetLastError());
}
diff --git a/jdk/src/windows/native/sun/security/krb5/NativeCreds.c b/jdk/src/windows/native/sun/security/krb5/NativeCreds.c
index 7533cc12811..91ed2cb84bb 100644
--- a/jdk/src/windows/native/sun/security/krb5/NativeCreds.c
+++ b/jdk/src/windows/native/sun/security/krb5/NativeCreds.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2000, 2009, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2011, 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
@@ -1032,12 +1032,12 @@ jobject BuildKerberosTime(JNIEnv *env, PLARGE_INTEGER kerbtime) {
// XXX Cannot use %02.2ld, because the leading 0 is ignored for integers.
// So, print them to strings, and then print them to the master string with a
// format pattern that makes it two digits and prefix with a 0 if necessary.
- swprintf( (wchar_t *)month, L"%2.2d", systemTime.wMonth);
- swprintf( (wchar_t *)day, L"%2.2d", systemTime.wDay);
- swprintf( (wchar_t *)hour, L"%2.2d", systemTime.wHour);
- swprintf( (wchar_t *)minute, L"%2.2d", systemTime.wMinute);
- swprintf( (wchar_t *)second, L"%2.2d", systemTime.wSecond);
- swprintf( (wchar_t *)timeString,
+ swprintf( (wchar_t *)month, 3, L"%2.2d", systemTime.wMonth);
+ swprintf( (wchar_t *)day, 3, L"%2.2d", systemTime.wDay);
+ swprintf( (wchar_t *)hour, 3, L"%2.2d", systemTime.wHour);
+ swprintf( (wchar_t *)minute, 3, L"%2.2d", systemTime.wMinute);
+ swprintf( (wchar_t *)second, 3, L"%2.2d", systemTime.wSecond);
+ swprintf( (wchar_t *)timeString, 16,
L"%ld%02.2s%02.2s%02.2s%02.2s%02.2sZ",
systemTime.wYear,
month,
diff --git a/jdk/src/windows/native/sun/security/provider/WinCAPISeedGenerator.c b/jdk/src/windows/native/sun/security/provider/WinCAPISeedGenerator.c
index d9d91080ddb..968650da591 100644
--- a/jdk/src/windows/native/sun/security/provider/WinCAPISeedGenerator.c
+++ b/jdk/src/windows/native/sun/security/provider/WinCAPISeedGenerator.c
@@ -33,11 +33,6 @@
#include
#include "sun_security_provider_NativeSeedGenerator.h"
-/* Typedefs for runtime linking. */
-typedef BOOL (WINAPI *CryptAcquireContextType)(HCRYPTPROV*, LPCTSTR, LPCTSTR, DWORD, DWORD);
-typedef BOOL (WINAPI *CryptGenRandomType)(HCRYPTPROV, DWORD, BYTE*);
-typedef BOOL (WINAPI *CryptReleaseContextType)(HCRYPTPROV, DWORD);
-
/*
* Get a random seed from the MS CryptoAPI. Return true if successful, false
* otherwise.
@@ -49,48 +44,27 @@ typedef BOOL (WINAPI *CryptReleaseContextType)(HCRYPTPROV, DWORD);
JNIEXPORT jboolean JNICALL Java_sun_security_provider_NativeSeedGenerator_nativeGenerateSeed
(JNIEnv *env, jclass clazz, jbyteArray randArray)
{
- HMODULE lib;
- CryptAcquireContextType acquireContext;
- CryptGenRandomType genRandom;
- CryptReleaseContextType releaseContext;
-
HCRYPTPROV hCryptProv;
jboolean result = JNI_FALSE;
jsize numBytes;
jbyte* randBytes;
- lib = LoadLibrary("ADVAPI32.DLL");
- if (lib == NULL) {
- return result;
- }
-
- acquireContext = (CryptAcquireContextType)GetProcAddress(lib, "CryptAcquireContextA");
- genRandom = (CryptGenRandomType)GetProcAddress(lib, "CryptGenRandom");
- releaseContext = (CryptReleaseContextType)GetProcAddress(lib, "CryptReleaseContext");
-
- if (acquireContext == NULL || genRandom == NULL || releaseContext == NULL) {
- FreeLibrary(lib);
- return result;
- }
-
- if (acquireContext(&hCryptProv, "J2SE", NULL, PROV_RSA_FULL, 0) == FALSE) {
+ if (CryptAcquireContextA(&hCryptProv, "J2SE", NULL, PROV_RSA_FULL, 0) == FALSE) {
/* If CSP context hasn't been created, create one. */
- if (acquireContext(&hCryptProv, "J2SE", NULL, PROV_RSA_FULL,
+ if (CryptAcquireContextA(&hCryptProv, "J2SE", NULL, PROV_RSA_FULL,
CRYPT_NEWKEYSET) == FALSE) {
- FreeLibrary(lib);
return result;
}
}
numBytes = (*env)->GetArrayLength(env, randArray);
randBytes = (*env)->GetByteArrayElements(env, randArray, NULL);
- if (genRandom(hCryptProv, numBytes, randBytes)) {
+ if (CryptGenRandom(hCryptProv, numBytes, randBytes)) {
result = JNI_TRUE;
}
(*env)->ReleaseByteArrayElements(env, randArray, randBytes, 0);
- releaseContext(hCryptProv, 0);
- FreeLibrary(lib);
+ CryptReleaseContext(hCryptProv, 0);
return result;
}
diff --git a/jdk/src/windows/native/sun/tools/attach/WindowsVirtualMachine.c b/jdk/src/windows/native/sun/tools/attach/WindowsVirtualMachine.c
index 07b136aba2d..6086ddf30f0 100644
--- a/jdk/src/windows/native/sun/tools/attach/WindowsVirtualMachine.c
+++ b/jdk/src/windows/native/sun/tools/attach/WindowsVirtualMachine.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2005, 2006, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2011, 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
@@ -173,24 +173,45 @@ JNIEXPORT jbyteArray JNICALL Java_sun_tools_attach_WindowsVirtualMachine_generat
JNIEXPORT jlong JNICALL Java_sun_tools_attach_WindowsVirtualMachine_openProcess
(JNIEnv *env, jclass cls, jint pid)
{
- HANDLE hProcess;
+ HANDLE hProcess = NULL;
- /*
- * Attempt to open process. If it fails then we try to enable the
- * SE_DEBUG_NAME privilege and retry.
- */
- hProcess = OpenProcess(PROCESS_ALL_ACCESS, FALSE, (DWORD)pid);
- if (hProcess == NULL && GetLastError() == ERROR_ACCESS_DENIED) {
- hProcess = doPrivilegedOpenProcess(PROCESS_ALL_ACCESS, FALSE, (DWORD)pid);
+ if (pid == (jint) GetCurrentProcessId()) {
+ /* process is attaching to itself; get a pseudo handle instead */
+ hProcess = GetCurrentProcess();
+ /* duplicate the pseudo handle so it can be used in more contexts */
+ if (DuplicateHandle(hProcess, hProcess, hProcess, &hProcess,
+ PROCESS_ALL_ACCESS, FALSE, 0) == 0) {
+ /*
+ * Could not duplicate the handle which isn't a good sign,
+ * but we'll try again with OpenProcess() below.
+ */
+ hProcess = NULL;
+ }
}
if (hProcess == NULL) {
- if (GetLastError() == ERROR_INVALID_PARAMETER) {
- JNU_ThrowIOException(env, "no such process");
- } else {
- JNU_ThrowIOExceptionWithLastError(env, "OpenProcess failed");
+ /*
+ * Attempt to open process. If it fails then we try to enable the
+ * SE_DEBUG_NAME privilege and retry.
+ */
+ hProcess = OpenProcess(PROCESS_ALL_ACCESS, FALSE, (DWORD)pid);
+ if (hProcess == NULL && GetLastError() == ERROR_ACCESS_DENIED) {
+ hProcess = doPrivilegedOpenProcess(PROCESS_ALL_ACCESS, FALSE,
+ (DWORD)pid);
+ }
+
+ if (hProcess == NULL) {
+ if (GetLastError() == ERROR_INVALID_PARAMETER) {
+ JNU_ThrowIOException(env, "no such process");
+ } else {
+ char err_mesg[255];
+ /* include the last error in the default detail message */
+ sprintf(err_mesg, "OpenProcess(pid=%d) failed; LastError=0x%x",
+ (int)pid, (int)GetLastError());
+ JNU_ThrowIOExceptionWithLastError(env, err_mesg);
+ }
+ return (jlong)0;
}
- return (jlong)0;
}
/*
diff --git a/jdk/src/windows/native/sun/windows/Devices.h b/jdk/src/windows/native/sun/windows/Devices.h
index 748ded20a3f..bbd8a497aaf 100644
--- a/jdk/src/windows/native/sun/windows/Devices.h
+++ b/jdk/src/windows/native/sun/windows/Devices.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2001, 2008, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 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
diff --git a/jdk/src/windows/native/sun/windows/awt_Debug.cpp b/jdk/src/windows/native/sun/windows/awt_Debug.cpp
index 42e099bb599..4be1b5d9165 100644
--- a/jdk/src/windows/native/sun/windows/awt_Debug.cpp
+++ b/jdk/src/windows/native/sun/windows/awt_Debug.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1999, 2003, Oracle and/or its affiliates. All rights reserved.
+ * 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
diff --git a/jdk/src/windows/native/sun/windows/awt_Debug.h b/jdk/src/windows/native/sun/windows/awt_Debug.h
index 729e652621a..9f7c0c08a8b 100644
--- a/jdk/src/windows/native/sun/windows/awt_Debug.h
+++ b/jdk/src/windows/native/sun/windows/awt_Debug.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1999, Oracle and/or its affiliates. All rights reserved.
+ * 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
diff --git a/jdk/src/windows/native/sun/windows/awt_Dialog.h b/jdk/src/windows/native/sun/windows/awt_Dialog.h
index 15918a6fd88..32199fdf266 100644
--- a/jdk/src/windows/native/sun/windows/awt_Dialog.h
+++ b/jdk/src/windows/native/sun/windows/awt_Dialog.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1996, 2007, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1996, 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
diff --git a/jdk/src/windows/native/sun/windows/awt_Frame.cpp b/jdk/src/windows/native/sun/windows/awt_Frame.cpp
index ca874cac841..4d3374e5734 100644
--- a/jdk/src/windows/native/sun/windows/awt_Frame.cpp
+++ b/jdk/src/windows/native/sun/windows/awt_Frame.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1996, 2009, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1996, 2011, 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
diff --git a/jdk/src/windows/native/sun/windows/awt_Frame.h b/jdk/src/windows/native/sun/windows/awt_Frame.h
index 2949ac92924..1adca139bf9 100644
--- a/jdk/src/windows/native/sun/windows/awt_Frame.h
+++ b/jdk/src/windows/native/sun/windows/awt_Frame.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1996, 2009, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1996, 2011, 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
diff --git a/jdk/src/windows/native/sun/windows/awt_PrintJob.cpp b/jdk/src/windows/native/sun/windows/awt_PrintJob.cpp
index df0f263ddfc..43c03fd5490 100644
--- a/jdk/src/windows/native/sun/windows/awt_PrintJob.cpp
+++ b/jdk/src/windows/native/sun/windows/awt_PrintJob.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1996, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1996, 2011, 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
@@ -3699,7 +3699,9 @@ static void matchPaperSize(HDC printDC, HGLOBAL hDevMode, HGLOBAL hDevNames,
double* newWid, double *newHgt,
WORD* paperSize) {
- const double epsilon = 0.50;
+ // Tolerated differences in comparing page dimensions between passed in
+ // "orig" media with that of Windows' device.
+ const double epsilon = 3.6; // (1/72) of an inch
const double tolerance = (1.0 * 72.0); // # inches * 72
*newWid = origWid;
diff --git a/jdk/src/windows/native/sun/windows/awt_TextArea.h b/jdk/src/windows/native/sun/windows/awt_TextArea.h
index 19a44e7681b..8a762924203 100644
--- a/jdk/src/windows/native/sun/windows/awt_TextArea.h
+++ b/jdk/src/windows/native/sun/windows/awt_TextArea.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1996, 2008, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1996, 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
diff --git a/jdk/src/windows/native/sun/windows/awt_Toolkit.cpp b/jdk/src/windows/native/sun/windows/awt_Toolkit.cpp
index cab78049f23..ca2bae8325a 100644
--- a/jdk/src/windows/native/sun/windows/awt_Toolkit.cpp
+++ b/jdk/src/windows/native/sun/windows/awt_Toolkit.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1996, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1996, 2011, 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,9 +528,6 @@ BOOL AwtToolkit::Dispose() {
tk.m_isActive = FALSE;
- awt_dnd_uninitialize();
- awt_clipboard_uninitialize((JNIEnv *)JNU_GetEnv(jvm, JNI_VERSION_1_2));
-
// dispose Direct3D-related resources. This should be done
// before AwtObjectList::Cleanup() as the d3d will attempt to
// shutdown when the last of its windows is disposed of
@@ -539,6 +536,9 @@ BOOL AwtToolkit::Dispose() {
AwtObjectList::Cleanup();
AwtFont::Cleanup();
+ awt_dnd_uninitialize();
+ awt_clipboard_uninitialize((JNIEnv *)JNU_GetEnv(jvm, JNI_VERSION_1_2));
+
if (tk.m_inputMethodHWnd != NULL) {
::SendMessage(tk.m_inputMethodHWnd, WM_IME_CONTROL, IMC_OPENSTATUSWINDOW, 0);
}
diff --git a/jdk/src/windows/native/sun/windows/awt_TrayIcon.cpp b/jdk/src/windows/native/sun/windows/awt_TrayIcon.cpp
index e43c8130405..4156c9cfec1 100644
--- a/jdk/src/windows/native/sun/windows/awt_TrayIcon.cpp
+++ b/jdk/src/windows/native/sun/windows/awt_TrayIcon.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2005, 2008, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2011, 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
diff --git a/jdk/src/windows/native/sun/windows/awt_Win32GraphicsEnv.cpp b/jdk/src/windows/native/sun/windows/awt_Win32GraphicsEnv.cpp
index efe485230a7..937007a5fd3 100644
--- a/jdk/src/windows/native/sun/windows/awt_Win32GraphicsEnv.cpp
+++ b/jdk/src/windows/native/sun/windows/awt_Win32GraphicsEnv.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2011, 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
diff --git a/jdk/src/windows/native/sun/windows/awt_Window.cpp b/jdk/src/windows/native/sun/windows/awt_Window.cpp
index a6a5eb64ffa..c742aca9000 100644
--- a/jdk/src/windows/native/sun/windows/awt_Window.cpp
+++ b/jdk/src/windows/native/sun/windows/awt_Window.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1996, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1996, 2011, 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
diff --git a/jdk/test/Makefile b/jdk/test/Makefile
index d26d19c544a..daa8ee92313 100644
--- a/jdk/test/Makefile
+++ b/jdk/test/Makefile
@@ -1,5 +1,5 @@
#
-# Copyright (c) 1995, 2010, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 1995, 2011, 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
@@ -261,6 +261,7 @@ endif
# Follow command with ";$(BUNDLE_UP_AND_EXIT)", so it always gets executed.
ZIP_UP_RESULTS = ( $(MKDIR) -p `$(DIRNAME) $(ARCHIVE_BUNDLE)` \
&& $(CD) $(ABS_TEST_OUTPUT_DIR) \
+ && $(CHMOD) -R a+r . \
&& $(ZIP) -q -r $(ARCHIVE_BUNDLE) . )
SUMMARY_TXT = $(shell $(GETMIXEDPATH) "$(ABS_TEST_OUTPUT_DIR)")/JTreport/text/summary.txt
STATS_TXT_NAME = Stats.txt
@@ -312,7 +313,9 @@ BUNDLE_UP_AND_EXIT = \
else \
$(ECHO) "Missing file: $${_summary}" >> $(STATS_TXT); \
fi; \
- $(CAT) $(STATS_TXT); \
+ if [ -f $(STATS_TXT) ] ; then \
+ $(CAT) $(STATS_TXT); \
+ fi; \
$(ZIP_UP_RESULTS) ; \
$(TESTEXIT) \
)
@@ -370,10 +373,10 @@ EXCLUDELIST=$(ABS_TEST_OUTPUT_DIR)/excludelist.txt
# Create exclude list for this platform and arch
ifdef NO_EXCLUDES
-$(EXCLUDELIST): $(PROBLEM_LISTS) $(TESTDIRS)
+$(EXCLUDELIST): $(PROBLEM_LISTS) $(TEST_DEPENDENCIES)
@$(ECHO) "NOTHING_EXCLUDED" > $@
else
-$(EXCLUDELIST): $(PROBLEM_LISTS) $(TESTDIRS)
+$(EXCLUDELIST): $(PROBLEM_LISTS) $(TEST_DEPENDENCIES)
@$(RM) $@ $@.temp1 $@.temp2
@(($(CAT) $(PROBLEM_LISTS) | $(EGREP) -- '$(OS_NAME)-all' ) ;\
($(CAT) $(PROBLEM_LISTS) | $(EGREP) -- '$(PLATFORM_OS)' ) ;\
@@ -385,7 +388,7 @@ $(EXCLUDELIST): $(PROBLEM_LISTS) $(TESTDIRS)
($(ECHO) "#") ;\
) | $(SED) -e 's@^[\ ]*@@' \
| $(EGREP) -v '^#' > $@.temp1
- @for tdir in $(TESTDIRS) ; do \
+ for tdir in $(TESTDIRS) SOLARIS_10_SH_BUG_NO_EMPTY_FORS ; do \
( ( $(CAT) $@.temp1 | $(EGREP) "^$${tdir}" ) ; $(ECHO) "#" ) >> $@.temp2 ; \
done
@$(ECHO) "# at least one line" >> $@.temp2
@@ -399,12 +402,12 @@ $(foreach i,$1,$(wildcard ${i})) $(foreach i,$1,$(wildcard closed/${i}))
endef
# Running batches of tests with or without samevm
define RunSamevmBatch
-$(ECHO) "Running tests in samevm mode: $(call TestDirs, $?)"
-$(MAKE) TESTDIRS="$(call TestDirs, $?)" USE_JTREG_SAMEVM=true UNIQUE_DIR=$@ jtreg_tests
+$(ECHO) "Running tests in samevm mode: $?"
+$(MAKE) TEST_DEPENDENCIES="$?" TESTDIRS="$?" USE_JTREG_SAMEVM=true UNIQUE_DIR=$@ jtreg_tests
endef
define RunOthervmBatch
-$(ECHO) "Running tests in othervm mode: $(call TestDirs, $?)"
-$(MAKE) TESTDIRS="$(call TestDirs, $?)" USE_JTREG_SAMEVM=false UNIQUE_DIR=$@ jtreg_tests
+$(ECHO) "Running tests in othervm mode: $?"
+$(MAKE) TEST_DEPENDENCIES="$?" TESTDIRS="$?" USE_JTREG_SAMEVM=false UNIQUE_DIR=$@ jtreg_tests
endef
define SummaryInfo
$(ECHO) "########################################################"
@@ -420,27 +423,29 @@ JDK_ALL_TARGETS =
# Stable othervm testruns (minus items from PROBLEM_LIST)
# Using samevm has problems, and doesn't help performance as much as others.
JDK_ALL_TARGETS += jdk_awt
-jdk_awt: com/sun/awt java/awt sun/awt
+jdk_awt: $(call TestDirs, com/sun/awt java/awt sun/awt)
$(call RunOthervmBatch)
# Stable samevm testruns (minus items from PROBLEM_LIST)
JDK_ALL_TARGETS += jdk_beans1
-jdk_beans1: java/beans/beancontext java/beans/PropertyChangeSupport \
+jdk_beans1: $(call TestDirs, \
+ java/beans/beancontext java/beans/PropertyChangeSupport \
java/beans/Introspector java/beans/Performance \
- java/beans/VetoableChangeSupport java/beans/Statement
+ java/beans/VetoableChangeSupport java/beans/Statement)
$(call RunSamevmBatch)
# Stable othervm testruns (minus items from PROBLEM_LIST)
# Using samevm has serious problems with these tests
JDK_ALL_TARGETS += jdk_beans2
-jdk_beans2: java/beans/Beans java/beans/EventHandler java/beans/XMLDecoder \
- java/beans/PropertyEditor
+jdk_beans2: $(call TestDirs, \
+ java/beans/Beans java/beans/EventHandler java/beans/XMLDecoder \
+ java/beans/PropertyEditor)
$(call RunOthervmBatch)
# Stable othervm testruns (minus items from PROBLEM_LIST)
# Using samevm has serious problems with these tests
JDK_ALL_TARGETS += jdk_beans3
-jdk_beans3: java/beans/XMLEncoder
+jdk_beans3: $(call TestDirs, java/beans/XMLEncoder)
$(call RunOthervmBatch)
# All beans tests
@@ -449,24 +454,24 @@ jdk_beans: jdk_beans1 jdk_beans2 jdk_beans3
# Stable samevm testruns (minus items from PROBLEM_LIST)
JDK_ALL_TARGETS += jdk_io
-jdk_io: java/io
+jdk_io: $(call TestDirs, java/io)
$(call RunSamevmBatch)
# Stable samevm testruns (minus items from PROBLEM_LIST)
JDK_ALL_TARGETS += jdk_lang
-jdk_lang: java/lang
+jdk_lang: $(call TestDirs, java/lang)
$(call RunSamevmBatch)
# Stable othervm testruns (minus items from PROBLEM_LIST)
# Using samevm has serious problems with these tests
JDK_ALL_TARGETS += jdk_management1
-jdk_management1: javax/management
+jdk_management1: $(call TestDirs, javax/management)
$(call RunOthervmBatch)
# Stable othervm testruns (minus items from PROBLEM_LIST)
# Using samevm has serious problems with these tests
JDK_ALL_TARGETS += jdk_management2
-jdk_management2: com/sun/jmx com/sun/management sun/management
+jdk_management2: $(call TestDirs, com/sun/jmx com/sun/management sun/management)
$(call RunOthervmBatch)
# All management tests
@@ -475,36 +480,37 @@ jdk_management: jdk_management1 jdk_management2
# Stable samevm testruns (minus items from PROBLEM_LIST)
JDK_ALL_TARGETS += jdk_math
-jdk_math: java/math
+jdk_math: $(call TestDirs, java/math)
$(call RunSamevmBatch)
# Stable samevm testruns (minus items from PROBLEM_LIST)
JDK_ALL_TARGETS += jdk_misc
-jdk_misc: demo javax/imageio javax/naming javax/print javax/script \
+jdk_misc: $(call TestDirs, \
+ demo javax/imageio javax/naming javax/print javax/script \
javax/smartcardio javax/sound com/sun/java com/sun/jndi \
- com/sun/org sun/misc sun/pisces
+ com/sun/org com/sun/xml sun/misc sun/pisces)
$(call RunSamevmBatch)
# Stable samevm testruns (minus items from PROBLEM_LIST)
JDK_ALL_TARGETS += jdk_net
-jdk_net: com/sun/net java/net sun/net
+jdk_net: $(call TestDirs, com/sun/net java/net sun/net)
$(call RunSamevmBatch)
# Stable samevm testruns (minus items from PROBLEM_LIST)
JDK_ALL_TARGETS += jdk_nio1
-jdk_nio1: java/nio/file
+jdk_nio1: $(call TestDirs, java/nio/file)
$(call RunSamevmBatch)
# Stable samevm testruns (minus items from PROBLEM_LIST)
JDK_ALL_TARGETS += jdk_nio2
-jdk_nio2: java/nio/Buffer java/nio/ByteOrder \
- java/nio/channels java/nio/BufferPoolMXBean java/nio/MappedByteBuffer
+jdk_nio2: $(call TestDirs, java/nio/Buffer java/nio/ByteOrder \
+ java/nio/channels java/nio/MappedByteBuffer)
$(call SharedLibraryPermissions,java/nio/channels)
$(call RunSamevmBatch)
# Stable samevm testruns (minus items from PROBLEM_LIST)
JDK_ALL_TARGETS += jdk_nio3
-jdk_nio3: com/sun/nio sun/nio
+jdk_nio3: $(call TestDirs, com/sun/nio sun/nio)
$(call RunSamevmBatch)
# All nio tests
@@ -514,24 +520,25 @@ jdk_nio: jdk_nio1 jdk_nio2 jdk_nio3
# Stable othervm testruns (minus items from PROBLEM_LIST)
# Using samevm has serious problems with these tests
JDK_ALL_TARGETS += jdk_rmi
-jdk_rmi: java/rmi javax/rmi sun/rmi
+jdk_rmi: $(call TestDirs, java/rmi javax/rmi sun/rmi)
$(call RunOthervmBatch)
# Stable samevm testruns (minus items from PROBLEM_LIST)
JDK_ALL_TARGETS += jdk_security1
-jdk_security1: java/security
+jdk_security1: $(call TestDirs, java/security)
$(call RunSamevmBatch)
# Stable othervm testruns (minus items from PROBLEM_LIST)
# Using samevm has serious problems with these tests
JDK_ALL_TARGETS += jdk_security2
-jdk_security2: javax/crypto com/sun/crypto
+jdk_security2: $(call TestDirs, javax/crypto com/sun/crypto)
$(call RunOthervmBatch)
# Stable othervm testruns (minus items from PROBLEM_LIST)
# Using samevm has serious problems with these tests
JDK_ALL_TARGETS += jdk_security3
-jdk_security3: com/sun/security lib/security javax/security sun/security
+jdk_security3: $(call TestDirs, com/sun/security lib/security \
+ javax/security sun/security)
$(call SharedLibraryPermissions,sun/security)
$(call RunOthervmBatch)
@@ -542,23 +549,25 @@ jdk_security: jdk_security1 jdk_security2 jdk_security3
# Stable othervm testruns (minus items from PROBLEM_LIST)
# Using samevm has problems, and doesn't help performance as much as others.
JDK_ALL_TARGETS += jdk_swing
-jdk_swing: javax/swing sun/java2d
+jdk_swing: $(call TestDirs, javax/swing sun/java2d)
$(call RunOthervmBatch)
# Stable samevm testruns (minus items from PROBLEM_LIST)
JDK_ALL_TARGETS += jdk_text
-jdk_text: java/text sun/text
+jdk_text: $(call TestDirs, java/text sun/text)
$(call RunSamevmBatch)
# Stable samevm testruns (minus items from PROBLEM_LIST)
JDK_ALL_TARGETS += jdk_tools1
-jdk_tools1: com/sun/jdi
+jdk_tools1: $(call TestDirs, com/sun/jdi)
$(call RunSamevmBatch)
# Stable othervm testruns (minus items from PROBLEM_LIST)
# Using samevm has serious problems with these tests
JDK_ALL_TARGETS += jdk_tools2
-jdk_tools2: com/sun/tools sun/jvmstat sun/tools tools vm com/sun/servicetag com/sun/tracing
+jdk_tools2: $(call TestDirs, \
+ com/sun/tools sun/jvmstat sun/tools tools vm \
+ com/sun/servicetag com/sun/tracing)
$(call SharedLibraryPermissions,tools/launcher)
$(call RunSamevmBatch)
@@ -568,7 +577,7 @@ jdk_tools: jdk_tools1 jdk_tools2
# Stable samevm testruns (minus items from PROBLEM_LIST)
JDK_ALL_TARGETS += jdk_util
-jdk_util: java/util sun/util
+jdk_util: $(call TestDirs, java/util sun/util)
$(call RunSamevmBatch)
# ------------------------------------------------------------------
@@ -678,7 +687,7 @@ PHONY_LIST += packtest packtest_stress
################################################################
-# perftest to collect statistics
+# perftest to collect statistics
# Expect JPRT to set JPRT_PACKTEST_HOME.
PERFTEST_HOME = $(TEST_ROOT)/perf
@@ -700,7 +709,7 @@ PHONY_LIST += perftest
# vmsqe tests
# Expect JPRT to set JPRT_VMSQE_HOME.
-VMSQE_HOME = /java/sqe/comp/vm/testbase/sqe/vm/current/build/latest/vm
+VMSQE_HOME = $(SLASH_JAVA)/sqe/comp/vm/testbase/sqe/vm/current/build/latest/vm
ifdef JPRT_VMSQE_HOME
VMSQE_HOME = $(JPRT_VMSQE_HOME)
endif
@@ -712,7 +721,7 @@ ifdef JPRT_RUNVMSQE_HOME
endif
# Expect JPRT to set JPRT_TONGA3_HOME.
-TONGA3_HOME = /java/sqe//tools/gtee/harness/tonga
+TONGA3_HOME = $(SLASH_JAVA)/sqe/tools/gtee/harness/tonga
ifdef JPRT_TONGA3_HOME
TONGA3_HOME = $(JPRT_TONGA3_HOME)
endif
@@ -765,148 +774,84 @@ PHONY_LIST += vmsqe_jdwp vmsqe_jdi vmsqe_jdb vmsqe_quick-jdi vmsqe_sajdi \
# jck tests
-JCK_WORK_DIR = $(ABS_TEST_OUTPUT_DIR)/JCKwork
-JCK_REPORT_DIR = $(ABS_TEST_OUTPUT_DIR)/JCKreport
-JCK_PROPERTIES = $(ABS_TEST_OUTPUT_DIR)/jck.properties
-JCK_CONFIG = $(ABS_TEST_OUTPUT_DIR)/jck.config
-
-JCK_JAVA_EXE = $(PRODUCT_HOME)/bin/java$(EXESUFFIX)
-
-JCK_JAVATEST_JAR = $(JCK_HOME)/lib/javatest.jar
-JCK_JAVATEST = $(ALT_BOOTDIR)/bin/java -jar $(JCK_JAVATEST_JAR)
-
-$(JCK_CONFIG): $(TEST_ROOT)/JCK-$(JCK_BUNDLE_NAME)-$(JCK_RELEASE)-base.jti
- $(RM) $@
- $(MKDIR) -p $(@D)
- $(CP) $< $@
-
-$(JCK_PROPERTIES): $(PRODUCT_HOME) $(JCK_JAVA_EXE)
- $(RM) $@
- $(MKDIR) -p $(@D)
- $(ECHO) "jck.env.compiler.compRefExecute.cmdAsFile=$(JCK_JAVA_EXE)" >> $@
- $(ECHO) "jck.env.compiler.compRefExecute.systemRoot=$(SYSTEMROOT)" >> $@
- $(ECHO) "jck.env.compiler.testCompile.testCompileAPImultiJVM.cmdAsFile=$(JCK_JAVA_EXE)" >> $@
- $(ECHO) "jck.tests.tests=$(JCK_BUNDLE_TESTDIRS)" >> $@
-
-jck_tests: prep $(JCK_HOME) $(JCK_PROPERTIES) $(JCK_CONFIG) $(JCK_JAVATEST_JAR)
- $(MKDIR) -p $(JCK_WORK_DIR)
- ( $(JCK_JAVATEST) \
- -verbose:commands,non-pass \
- -testSuite $(JCK_HOME) \
- -workDir $(JCK_WORK_DIR) \
- -config $(JCK_CONFIG) \
- -set -file $(JCK_PROPERTIES) \
- -runtests \
- -writeReport $(JCK_REPORT_DIR) \
- ) ; $(BUNDLE_UP_AND_EXIT)
-
-PHONY_LIST += jck_tests
-
-################################################################
-
-# jck6 tests
-
-JCK6_RELEASE = 6b
-JCK6_DEFAULT_HOME = $(SLASH_JAVA)/re/jck/$(JCK6_RELEASE)/archive/fcs/binaries
-
-# Expect JPRT to set JPRT_JCK6COMPILER_HOME.
-JCK6COMPILER_HOME = $(JCK6_DEFAULT_HOME)/JCK-compiler-$(JCK6_RELEASE)
-ifdef JPRT_JCK6COMPILER_HOME
- JCK6COMPILER_HOME = $(JPRT_JCK6COMPILER_HOME)
-endif
-
-# Expect JPRT to set JPRT_JCK6RUNTIME_HOME.
-JCK6RUNTIME_HOME = $(JCK6_DEFAULT_HOME)/JCK-runtime-$(JCK6_RELEASE)
-ifdef JPRT_JCK6RUNTIME_HOME
- JCK6RUNTIME_HOME = $(JPRT_JCK6RUNTIME_HOME)
-endif
-
-# Expect JPRT to set JPRT_JCK6DEVTOOLS_HOME.
-JCK6DEVTOOLS_HOME = $(JCK6_DEFAULT_HOME)/JCK-devtools-$(JCK6_RELEASE)
-ifdef JPRT_JCK6DEVTOOLS_HOME
- JCK6DEVTOOLS_HOME = $(JPRT_JCK6DEVTOOLS_HOME)
-endif
-
-jck6_tests: JCK_HOME=$(JCK6_HOME)
-jck6_tests: JCK_RELEASE=$(JCK6_RELEASE)
-jck6_tests: jck_tests
-
-jck6compiler: JCK6_HOME=$(JCK6COMPILER_HOME)
-jck6compiler: JCK_BUNDLE_NAME=compiler
-jck6compiler: jck6_tests
-
-jck6compiler_lang: JCK_BUNDLE_TESTDIRS=lang
-jck6compiler_lang: jck6compiler
-
-jck6runtime: JCK6_HOME=$(JCK6RUNTIME_HOME)
-jck6runtime: JCK_BUNDLE_NAME=runtime
-jck6runtime: jck6_tests
-
-jck6runtime_lang: JCK_BUNDLE_TESTDIRS=lang
-jck6runtime_lang: jck6runtime
-
-jck6devtools: JCK6_HOME=$(JCK6DEVTOOLS_HOME)
-jck6devtools: JCK_BUNDLE_NAME=devtools
-jck6devtools: jck6_tests
-
-jck6devtools_lang: JCK_BUNDLE_TESTDIRS=lang
-jck6devtools_lang: jck6devtools
-
-PHONY_LIST += jck6compiler jck6runtime jck6devtools jck6_tests \
- jck6compiler_lang jck6runtime_lang jck6devtools_lang
-
-################################################################
-
-# jck7 tests
-
-JCK7_RELEASE = 7
-JCK7_DEFAULT_HOME = $(SLASH_JAVA)/re/jck/$(JCK7_RELEASE)/archive/fcs/binaries
+# Default is to use jck 7 from /java/re
+JCK7_DEFAULT_HOME = $(SLASH_JAVA)/re/jck/7/promoted/latest/binaries
# Expect JPRT to set JPRT_JCK7COMPILER_HOME.
-JCK7COMPILER_HOME = $(JCK7_DEFAULT_HOME)/JCK-compiler-$(JCK7_RELEASE)
+JCK7COMPILER_HOME = $(JCK7_DEFAULT_HOME)/JCK-compiler-7
ifdef JPRT_JCK7COMPILER_HOME
- JCK7COMPILER_HOME = $(JPRT_JCK7COMPILER_HOME)
+ JCK7COMPILER_HOME = $(JPRT_JCK7COMPILER_HOME)/JCK-compiler-7
endif
# Expect JPRT to set JPRT_JCK7RUNTIME_HOME.
-JCK7RUNTIME_HOME = $(JCK7_DEFAULT_HOME)/JCK-runtime-$(JCK7_RELEASE)
+JCK7RUNTIME_HOME = $(JCK7_DEFAULT_HOME)/JCK-runtime-7
ifdef JPRT_JCK7RUNTIME_HOME
- JCK7RUNTIME_HOME = $(JPRT_JCK7RUNTIME_HOME)
+ JCK7RUNTIME_HOME = $(JPRT_JCK7RUNTIME_HOME)/JCK-runtime-7
endif
# Expect JPRT to set JPRT_JCK7DEVTOOLS_HOME.
-JCK7DEVTOOLS_HOME = $(JCK7_DEFAULT_HOME)/JCK-devtools-$(JCK7_RELEASE)
+JCK7DEVTOOLS_HOME = $(JCK7_DEFAULT_HOME)/JCK-devtools-7
ifdef JPRT_JCK7DEVTOOLS_HOME
- JCK7DEVTOOLS_HOME = $(JPRT_JCK7DEVTOOLS_HOME)
+ JCK7DEVTOOLS_HOME = $(JPRT_JCK7DEVTOOLS_HOME)/JCK-devtools-7
endif
-jck7_tests: JCK_HOME=$(JCK7_HOME)
-jck7_tests: JCK_RELEASE=$(JCK7_RELEASE)
-jck7_tests: jck_tests
+# The jtjck.jar utility to use to run the tests
+JTJCK_JAR = $(JCK_HOME)/lib/jtjck.jar
+JTJCK_JAVA_ARGS = -XX:MaxPermSize=256m -Xmx512m
+JTJCK_OPTIONS = -headless -v
-jck7compiler: JCK7_HOME=$(JCK7COMPILER_HOME)
-jck7compiler: JCK_BUNDLE_NAME=compiler
-jck7compiler: jck7_tests
+# Default tests to run
+ifndef JCK_COMPILER_TESTS
+ JCK_COMPILER_TESTS =
+endif
+ifndef JCK_RUNTIME_TESTS
+ JCK_RUNTIME_TESTS =
+endif
+ifndef JCK_DEVTOOLS_TESTS
+ JCK_DEVTOOLS_TESTS =
+endif
-jck7compiler_lang: JCK_BUNDLE_TESTDIRS=lang
-jck7compiler_lang: jck7compiler
+# Generic rule used to run jck tests
+_generic_jck_tests: prep $(PRODUCT_HOME) $(EXCLUDELIST)
+ @$(EXPAND) $(EXCLUDELIST) \
+ | $(CUT) -d' ' -f1 \
+ | $(SED) -e 's@^@Excluding: @'
+ ( $(CD) $(ABS_TEST_OUTPUT_DIR) && \
+ $(PRODUCT_HOME)/bin/java $(JTJCK_JAVA_ARGS) \
+ -jar "$(JTJCK_JAR)" \
+ $(JTJCK_OPTIONS) \
+ -r:$(shell $(GETMIXEDPATH) "$(ABS_TEST_OUTPUT_DIR)")/JTreport \
+ -w:$(shell $(GETMIXEDPATH) "$(ABS_TEST_OUTPUT_DIR)")/JTwork \
+ -jdk:$(shell $(GETMIXEDPATH) "$(PRODUCT_HOME)") \
+ $(TESTDIRS) \
+ ) ; $(BUNDLE_UP_AND_EXIT)
-jck7runtime: JCK7_HOME=$(JCK7RUNTIME_HOME)
-jck7runtime: JCK_BUNDLE_NAME=runtime
-jck7runtime: jck7_tests
+# JCK7 compiler tests
+jck7compiler:
+ $(MAKE) UNIQUE_DIR=$@ \
+ JCK_HOME=$(JCK7COMPILER_HOME) \
+ TESTDIRS="$(JCK_COMPILER_TESTS)" \
+ _generic_jck_tests
-jck7runtime_lang: JCK_BUNDLE_TESTDIRS=lang
-jck7runtime_lang: jck7runtime
+# JCK7 runtime tests
+jck7runtime:
+ $(MAKE) UNIQUE_DIR=$@ \
+ JCK_HOME=$(JCK7RUNTIME_HOME) \
+ TESTDIRS="$(JCK_RUNTIME_TESTS)" \
+ _generic_jck_tests
-jck7devtools: JCK7_HOME=$(JCK7DEVTOOLS_HOME)
-jck7devtools: JCK_BUNDLE_NAME=devtools
-jck7devtools: jck7_tests
+# JCK7 devtools tests
+jck7devtools:
+ $(MAKE) UNIQUE_DIR=$@ \
+ JCK_HOME=$(JCK7DEVTOOLS_HOME) \
+ TESTDIRS="$(JCK_DEVTOOLS_TESTS)" \
+ _generic_jck_tests
-jck7devtools_lang: JCK_BUNDLE_TESTDIRS=lang
-jck7devtools_lang: jck7devtools
+# Run all 3 sets of JCK7 tests
+jck_all: jck7runtime jck7devtools jck7compiler
-PHONY_LIST += jck7compiler jck7runtime jck7devtools jck7_tests \
- jck7compiler_lang jck7runtime_lang jck7devtools_lang
+PHONY_LIST += jck_all _generic_jck_tests \
+ jck7compiler jck7runtime jck7devtools
################################################################
diff --git a/jdk/test/ProblemList.txt b/jdk/test/ProblemList.txt
index 27518785b07..78ca9534f84 100644
--- a/jdk/test/ProblemList.txt
+++ b/jdk/test/ProblemList.txt
@@ -1,6 +1,6 @@
###########################################################################
#
-# Copyright (c) 2009, 2010, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2009, 2011, 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
@@ -690,6 +690,9 @@ sun/tools/jconsole/ResourceCheckTest.sh generic-all
# jdk_util
+# Filed 7027061
+java/util/Locale/Bug6989440.java windows-all
+
# Filed 6933803
java/util/concurrent/ThreadPoolExecutor/CoreThreadTimeOut.java generic-all
diff --git a/jdk/test/com/sun/awt/Translucency/WindowOpacity.java b/jdk/test/com/sun/awt/Translucency/WindowOpacity.java
index a5d80265d60..26c611c35d5 100644
--- a/jdk/test/com/sun/awt/Translucency/WindowOpacity.java
+++ b/jdk/test/com/sun/awt/Translucency/WindowOpacity.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2008, 2009, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2008, 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
diff --git a/jdk/test/com/sun/jdi/NativeInstanceFilter.java b/jdk/test/com/sun/jdi/NativeInstanceFilter.java
index 90e714e6889..eaa501a35fe 100644
--- a/jdk/test/com/sun/jdi/NativeInstanceFilter.java
+++ b/jdk/test/com/sun/jdi/NativeInstanceFilter.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2010, 2011, 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
diff --git a/jdk/test/com/sun/jdi/NativeInstanceFilterTarg.java b/jdk/test/com/sun/jdi/NativeInstanceFilterTarg.java
index 48a21b43aba..a3179da7078 100644
--- a/jdk/test/com/sun/jdi/NativeInstanceFilterTarg.java
+++ b/jdk/test/com/sun/jdi/NativeInstanceFilterTarg.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2010, 2011, 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
diff --git a/jdk/test/com/sun/jdi/PrivateTransportTest.sh b/jdk/test/com/sun/jdi/PrivateTransportTest.sh
index 75e666fdb5e..89a306c9ee9 100644
--- a/jdk/test/com/sun/jdi/PrivateTransportTest.sh
+++ b/jdk/test/com/sun/jdi/PrivateTransportTest.sh
@@ -1,7 +1,7 @@
#!/bin/ksh -p
#
-# Copyright (c) 2005, 2006, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2005, 2011, 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,8 @@ fi
libdir=${TESTCLASSES}
+is_windows=false
+is_cygwin=false
case `uname -s` in
SunOS)
libarch=`uname -p`
@@ -126,10 +128,13 @@ case `uname -s` in
libloc=`dirname ${xx}`
;;
Windows*)
+ is_windows=true
libloc=${jreloc}/bin
sep=';'
;;
CYGWIN*)
+ is_windows=true
+ is_cygwin=true
libloc=${jreloc}/bin
sep=':'
@@ -176,7 +181,18 @@ fi
#
CP="-classpath \"${TESTCLASSES}\""
#
-DEBUGGEEFLAGS="$DEBUGGEEFLAGS -agentlib:jdwp=transport=${private_transport},server=y,suspend=n"
+if [ "$is_windows" = "true" ]; then
+ if [ "$is_cygwin" = "true" ]; then
+ win_fullpath=`cygpath -m "$fullpath" \
+ | sed -e 's#/#\\\\\\\\#g' -e 's/\.dll//'`
+ else
+ win_fullpath=`echo "$fullpath" \
+ | sed -e 's#/#\\\\\\\\#g' -e 's/\.dll//'`
+ fi
+ DEBUGGEEFLAGS="$DEBUGGEEFLAGS -agentlib:jdwp=transport=${win_fullpath},server=y,suspend=n"
+else
+ DEBUGGEEFLAGS="$DEBUGGEEFLAGS -agentlib:jdwp=transport=${private_transport},server=y,suspend=n"
+fi
echo ${TESTJAVA}/bin/java ${DEBUGGEEFLAGS} ${CP} ${TARGETCLASS}
eval ${TESTJAVA}/bin/java ${DEBUGGEEFLAGS} ${CP} ${TARGETCLASS}
diff --git a/jdk/test/com/sun/jdi/ProcessAttachTest.sh b/jdk/test/com/sun/jdi/ProcessAttachTest.sh
index f0a61113574..d48ea5ec828 100644
--- a/jdk/test/com/sun/jdi/ProcessAttachTest.sh
+++ b/jdk/test/com/sun/jdi/ProcessAttachTest.sh
@@ -1,7 +1,7 @@
#!/bin/sh
#
-# Copyright (c) 2005, 2006, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2005, 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
diff --git a/jdk/test/com/sun/security/auth/module/LdapLoginModule/CheckConfigs.java b/jdk/test/com/sun/security/auth/module/LdapLoginModule/CheckConfigs.java
index f74e69079ed..fffcf4a204b 100644
--- a/jdk/test/com/sun/security/auth/module/LdapLoginModule/CheckConfigs.java
+++ b/jdk/test/com/sun/security/auth/module/LdapLoginModule/CheckConfigs.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2005, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2011, 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
diff --git a/jdk/test/com/sun/security/auth/module/LdapLoginModule/CheckOptions.java b/jdk/test/com/sun/security/auth/module/LdapLoginModule/CheckOptions.java
index 3f7d8e3bac2..7e616ffc51d 100644
--- a/jdk/test/com/sun/security/auth/module/LdapLoginModule/CheckOptions.java
+++ b/jdk/test/com/sun/security/auth/module/LdapLoginModule/CheckOptions.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2005, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2011, 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
diff --git a/jdk/test/com/sun/tools/attach/ApplicationSetup.sh b/jdk/test/com/sun/tools/attach/ApplicationSetup.sh
index a07fac420e2..9e40c5ddc26 100644
--- a/jdk/test/com/sun/tools/attach/ApplicationSetup.sh
+++ b/jdk/test/com/sun/tools/attach/ApplicationSetup.sh
@@ -1,7 +1,7 @@
#!/bin/sh
#
-# Copyright (c) 2005, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2005, 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
diff --git a/jdk/test/com/sun/tools/attach/BasicTests.sh b/jdk/test/com/sun/tools/attach/BasicTests.sh
index 3f8f8571411..a95060de40e 100644
--- a/jdk/test/com/sun/tools/attach/BasicTests.sh
+++ b/jdk/test/com/sun/tools/attach/BasicTests.sh
@@ -1,7 +1,7 @@
#!/bin/sh
#
-# Copyright (c) 2005, 2006, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2005, 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
diff --git a/jdk/test/com/sun/tools/attach/CommonSetup.sh b/jdk/test/com/sun/tools/attach/CommonSetup.sh
index b65d50152bf..b05d5d374e1 100644
--- a/jdk/test/com/sun/tools/attach/CommonSetup.sh
+++ b/jdk/test/com/sun/tools/attach/CommonSetup.sh
@@ -1,7 +1,7 @@
#!/bin/sh
#
-# Copyright (c) 2005, 2006, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2005, 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
diff --git a/jdk/test/com/sun/tools/attach/PermissionTests.sh b/jdk/test/com/sun/tools/attach/PermissionTests.sh
index 65d79104fbe..22828dcccea 100644
--- a/jdk/test/com/sun/tools/attach/PermissionTests.sh
+++ b/jdk/test/com/sun/tools/attach/PermissionTests.sh
@@ -1,7 +1,7 @@
#!/bin/sh
#
-# Copyright (c) 2005, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2005, 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
diff --git a/jdk/test/demo/zipfs/Basic.java b/jdk/test/demo/zipfs/Basic.java
index c0e478bc8f2..ae2ad15b52d 100644
--- a/jdk/test/demo/zipfs/Basic.java
+++ b/jdk/test/demo/zipfs/Basic.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2009, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2009, 2011, 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
diff --git a/jdk/test/demo/zipfs/PathOps.java b/jdk/test/demo/zipfs/PathOps.java
index ea097396dbb..ec1af09c9c5 100644
--- a/jdk/test/demo/zipfs/PathOps.java
+++ b/jdk/test/demo/zipfs/PathOps.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2009, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2009, 2011, 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
diff --git a/jdk/test/demo/zipfs/basic.sh b/jdk/test/demo/zipfs/basic.sh
index 06353dfa761..1b44152bc51 100644
--- a/jdk/test/demo/zipfs/basic.sh
+++ b/jdk/test/demo/zipfs/basic.sh
@@ -1,5 +1,5 @@
#
-# Copyright (c) 2009, 2010, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2009, 2011, 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
diff --git a/jdk/test/java/awt/Container/CheckZOrderChange/CheckZOrderChange.java b/jdk/test/java/awt/Container/CheckZOrderChange/CheckZOrderChange.java
index 3c06a523b29..fa888ecfec5 100644
--- a/jdk/test/java/awt/Container/CheckZOrderChange/CheckZOrderChange.java
+++ b/jdk/test/java/awt/Container/CheckZOrderChange/CheckZOrderChange.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2008, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2008, 2011, 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
diff --git a/jdk/test/java/awt/FontClass/LCDScale.java b/jdk/test/java/awt/FontClass/LCDScale.java
index 5f8d1f6a16d..6a9453e63af 100644
--- a/jdk/test/java/awt/FontClass/LCDScale.java
+++ b/jdk/test/java/awt/FontClass/LCDScale.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2010, 2011, 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
diff --git a/jdk/test/java/awt/Graphics2D/RenderClipTest/RenderClipTest.java b/jdk/test/java/awt/Graphics2D/RenderClipTest/RenderClipTest.java
index e920c448671..29ef55d2ab4 100644
--- a/jdk/test/java/awt/Graphics2D/RenderClipTest/RenderClipTest.java
+++ b/jdk/test/java/awt/Graphics2D/RenderClipTest/RenderClipTest.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2008, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2008, 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
diff --git a/jdk/test/java/awt/PrintJob/Text/StringWidth.java b/jdk/test/java/awt/PrintJob/Text/StringWidth.java
index e16229eba27..6773b7f6f96 100644
--- a/jdk/test/java/awt/PrintJob/Text/StringWidth.java
+++ b/jdk/test/java/awt/PrintJob/Text/StringWidth.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2007, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2007, 2011, 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
diff --git a/jdk/test/java/awt/Toolkit/Headless/GetPrintJob/GetPrintJob.java b/jdk/test/java/awt/Toolkit/Headless/GetPrintJob/GetPrintJob.java
new file mode 100644
index 00000000000..29a0950bf3b
--- /dev/null
+++ b/jdk/test/java/awt/Toolkit/Headless/GetPrintJob/GetPrintJob.java
@@ -0,0 +1,48 @@
+/*
+@test
+@bug 7023011
+@library ../../../regtesthelpers
+@build Sysout
+@summary Toolkit.getPrintJob() throws wrong exceptions
+@author andrei dmitriev: area=awt.headless
+@run main GetPrintJob
+ */
+
+import java.awt.*;
+import java.util.Properties;
+import test.java.awt.regtesthelpers.Sysout;
+/*
+ * In headfull mode we should always getting NPE on the getPrintJob() call if frame == null.
+ */
+
+public class GetPrintJob {
+
+ public static void main(String[] s) {
+ boolean stage1Passed = false;
+ boolean stage2Passed = false;
+
+ try {
+ Toolkit.getDefaultToolkit().getPrintJob(
+ (Frame) null, "title", new Properties());
+ } catch (NullPointerException e) {
+ stage1Passed = true;
+ Sysout.println("Stage 1 passed. getPrintJob(null, String, property) has thrown NPE.");
+ }
+ if (!stage1Passed) {
+ throw new RuntimeException("getPrintJob() should have thrown NPE but didn't.");
+ }
+
+ try {
+ Toolkit.getDefaultToolkit().getPrintJob(
+ (Frame) null, "title", new JobAttributes(), new PageAttributes());
+ } catch (NullPointerException e) {
+ stage2Passed = true;
+ Sysout.println("Stage 2 passed. getPrintJob(null, String, jobAttrs, pageAttr) has thrown NPE.");
+ }
+ if (!stage2Passed) {
+ throw new RuntimeException("getPrintJob() should have thrown NPE but didn't.");
+ }
+
+ Sysout.println("Test PASSED");
+ }
+}
diff --git a/jdk/test/java/awt/Toolkit/Headless/GetPrintJob/GetPrintJobHeadless.java b/jdk/test/java/awt/Toolkit/Headless/GetPrintJob/GetPrintJobHeadless.java
new file mode 100644
index 00000000000..c5edf26095f
--- /dev/null
+++ b/jdk/test/java/awt/Toolkit/Headless/GetPrintJob/GetPrintJobHeadless.java
@@ -0,0 +1,50 @@
+/*
+@test
+@bug 7023011
+@library ../../../regtesthelpers
+@build Sysout
+@summary Toolkit.getPrintJob() throws wrong exceptions
+@author andrei dmitriev: area=awt.headless
+@run main/othervm -Djava.awt.headless=true GetPrintJobHeadless
+ */
+
+/*
+ * In headless mode we should always getting NPE on the getPrintJob() call
+ */
+import java.awt.*;
+import java.util.Properties;
+import test.java.awt.regtesthelpers.Sysout;
+
+public class GetPrintJobHeadless {
+
+ public static void main(String[] s) {
+ boolean stage1Passed = false;
+ boolean stage2Passed = false;
+
+ try {
+ Toolkit.getDefaultToolkit().getPrintJob(
+ (Frame) null, "title", new Properties());
+ } catch (NullPointerException e) {
+ stage1Passed = true;
+ e.printStackTrace();
+ Sysout.println("Stage 1 passed. getPrintJob(null, String, property) has thrown NPE.");
+ }
+ if (!stage1Passed) {
+ throw new RuntimeException("getPrintJob() should have thrown NPE but didn't.");
+ }
+
+ try {
+ Toolkit.getDefaultToolkit().getPrintJob(
+ (Frame) null, "title", new JobAttributes(), new PageAttributes());
+ } catch (NullPointerException e) {
+ stage2Passed = true;
+ e.printStackTrace();
+ Sysout.println("Stage 2 passed. getPrintJob(null, String, jobAttrs, pageAttr) has thrown NPE.");
+ }
+ if (!stage2Passed) {
+ throw new RuntimeException("getPrintJob() should have thrown NPE but didn't.");
+ }
+
+ Sysout.println("Test PASSED");
+ }
+}
diff --git a/jdk/test/java/awt/font/FontNames/LocaleFamilyNames.java b/jdk/test/java/awt/font/FontNames/LocaleFamilyNames.java
index e6d71feb814..5356464334e 100644
--- a/jdk/test/java/awt/font/FontNames/LocaleFamilyNames.java
+++ b/jdk/test/java/awt/font/FontNames/LocaleFamilyNames.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2003, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2011, 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
diff --git a/jdk/test/java/awt/font/TextLayout/CombiningPerf.java b/jdk/test/java/awt/font/TextLayout/CombiningPerf.java
new file mode 100644
index 00000000000..d51e586e507
--- /dev/null
+++ b/jdk/test/java/awt/font/TextLayout/CombiningPerf.java
@@ -0,0 +1,85 @@
+/*
+ * Copyright (c) 2011, 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 6328154 6962082
+ * @summary ensure that ascii, and latin-1 text without combining marks, both layout faster
+ * than latin-1 text with combining marks. The presumption is then that the canonical
+ * GSUB table is being run only on the latter and not on either of the former.
+ */
+
+import java.awt.Font;
+import java.awt.GraphicsEnvironment;
+import java.awt.font.FontRenderContext;
+import java.awt.font.TextLayout;
+
+import static java.awt.Font.*;
+
+public class CombiningPerf {
+ private static Font font;
+ private static FontRenderContext frc;
+
+ public static void main(String[] args) throws Exception {
+ System.err.println("start");
+
+ GraphicsEnvironment.getLocalGraphicsEnvironment();
+
+ font = new Font("Lucida Sans Regular", PLAIN, 12);
+ frc = new FontRenderContext(null, false, false);
+
+ String ascii = "the characters are critical noodles?";
+ String french = "l'aper\u00e7u caract\u00e8re one \u00e9t\u00e9 cr\u00e9\u00e9s";
+ String frenchX = "l'aper\u00e7u caracte\u0300re one e\u0301te\u0301 ere\u0301e\u0301s";
+
+ // warmup
+ for (int i = 0; i < 100; ++i) {
+ TextLayout tl = new TextLayout(french, font, frc);
+ tl = new TextLayout(ascii, font, frc);
+ tl = new TextLayout(frenchX, font, frc);
+ }
+ /**/
+ long atime = test(ascii);
+ System.err.println("atime: " + (atime/1000000.0) + " length: " + ascii.length());
+
+ long ftime = test(french);
+ System.err.println("ftime: " + (ftime/1000000.0) + " length: " + french.length());
+
+ long xtime = test(frenchX);
+ System.err.println("xtime: " + (xtime/1000000.0) + " length: " + frenchX.length());
+
+ long limit = xtime * 2 / 3;
+ if (atime > limit || ftime > limit) {
+ throw new Exception("took too long");
+ }
+ /**/
+ }
+
+ private static long test(String text) {
+ long start = System.nanoTime();
+ for (int i = 0; i < 2000; ++i) {
+ TextLayout tl = new TextLayout(text, font, frc);
+ }
+ return System.nanoTime() - start;
+ }
+}
diff --git a/jdk/test/java/awt/font/TextLayout/KernCrash.java b/jdk/test/java/awt/font/TextLayout/KernCrash.java
new file mode 100644
index 00000000000..50e44d4c30d
--- /dev/null
+++ b/jdk/test/java/awt/font/TextLayout/KernCrash.java
@@ -0,0 +1,67 @@
+/*
+ * Copyright (c) 2011, 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.io.*;
+import java.awt.*;
+import java.awt.font.*;
+import java.util.*;
+
+/**
+ * Shows (top) with kerning, (middle) without, (bottom) also without.
+ *
+ * @bug 7017324
+ */
+public class KernCrash extends Frame {
+ private static Font font0;
+ private static Font font1;
+ private static Font font2;
+
+ public static void main(String[] args) throws Exception {
+ HashMap attrs = new HashMap();
+ font0 = Font.createFont(Font.TRUETYPE_FONT, new File("Vera.ttf"));
+ System.out.println("using " + font0);
+ attrs.put(TextAttribute.SIZE, new Float(58f));
+ font1 = font0.deriveFont(attrs);
+ attrs.put(TextAttribute.KERNING, TextAttribute.KERNING_ON);
+ font2 = font0.deriveFont(attrs);
+
+ KernCrash f = new KernCrash();
+ f.setTitle("Kerning Crash");
+ f.setSize(600, 300);
+ f.setForeground(Color.black);
+ f.show();
+ }
+
+ public void paint(Graphics g) {
+ Graphics2D g2 = (Graphics2D)g;
+ FontRenderContext frc = g2.getFontRenderContext();
+ TextLayout layout = new TextLayout("text", font2, frc);
+ layout.draw(g2, 10, 150);
+
+ String s = "WAVATastic";
+ TextLayout layout2 = new TextLayout(s, font1, frc);
+ layout2.draw(g2, 10, 200);
+ TextLayout layout3 = new TextLayout(s, font2, frc);
+ layout3.draw(g2, 10, 100);
+ }
+}
diff --git a/jdk/test/java/awt/image/GetSamplesTest.java b/jdk/test/java/awt/image/GetSamplesTest.java
index 86780c5cf9f..2352f9efce2 100644
--- a/jdk/test/java/awt/image/GetSamplesTest.java
+++ b/jdk/test/java/awt/image/GetSamplesTest.java
@@ -23,9 +23,9 @@
/*
* @test
- * @bug 6735275
- * @summary Test verifies that SampleModel.getSamples() throws an appropriate
- * exception if coordinates are not in bounds.
+ * @bug 6735275 6993561
+ * @summary Test verifies that SampleModel.getSamples() SampleModel.setSamples()
+ * throw an appropriate exception if coordinates are not in bounds.
*
* @run main GetSamplesTest
*/
@@ -75,6 +75,7 @@ public class GetSamplesTest {
try {
sm.getSamples(Integer.MAX_VALUE, 0, 1, 1, 0, iArray, db);
+ sm.setSamples(Integer.MAX_VALUE, 0, 1, 1, 0, iArray, db);
} catch (ArrayIndexOutOfBoundsException e) {
System.out.println(e.getMessage());
iOk = true;
@@ -82,6 +83,7 @@ public class GetSamplesTest {
try {
sm.getSamples(Integer.MAX_VALUE, 0, 1, 1, 0, fArray, db);
+ sm.setSamples(Integer.MAX_VALUE, 0, 1, 1, 0, fArray, db);
} catch (ArrayIndexOutOfBoundsException e) {
System.out.println(e.getMessage());
fOk = true;
@@ -89,6 +91,7 @@ public class GetSamplesTest {
try {
sm.getSamples(0, Integer.MAX_VALUE, 1, 1, 0, dArray, db);
+ sm.setSamples(0, Integer.MAX_VALUE, 1, 1, 0, dArray, db);
} catch (ArrayIndexOutOfBoundsException e) {
System.out.println(e.getMessage());
dOk = true;
diff --git a/jdk/test/java/awt/xembed/server/TestXEmbedServer.java b/jdk/test/java/awt/xembed/server/TestXEmbedServer.java
index 56756526a59..236ce0fd4df 100644
--- a/jdk/test/java/awt/xembed/server/TestXEmbedServer.java
+++ b/jdk/test/java/awt/xembed/server/TestXEmbedServer.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2004, 2008, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2004, 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
diff --git a/jdk/test/java/io/File/IsHidden.java b/jdk/test/java/io/File/IsHidden.java
index d2b43c5b641..a5b87794af5 100644
--- a/jdk/test/java/io/File/IsHidden.java
+++ b/jdk/test/java/io/File/IsHidden.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1998, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 2011, 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
diff --git a/jdk/test/java/io/File/SetAccess.java b/jdk/test/java/io/File/SetAccess.java
index 745deab1f7b..f9287ee5318 100644
--- a/jdk/test/java/io/File/SetAccess.java
+++ b/jdk/test/java/io/File/SetAccess.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2011, 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
diff --git a/jdk/test/java/io/File/SetLastModified.java b/jdk/test/java/io/File/SetLastModified.java
index fada781a202..249b7cca94c 100644
--- a/jdk/test/java/io/File/SetLastModified.java
+++ b/jdk/test/java/io/File/SetLastModified.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1998, 2008, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 2011, 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
diff --git a/jdk/test/java/io/File/SymLinks.java b/jdk/test/java/io/File/SymLinks.java
index 355b28875d4..df78f15529b 100644
--- a/jdk/test/java/io/File/SymLinks.java
+++ b/jdk/test/java/io/File/SymLinks.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2009, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2009, 2011, 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
diff --git a/jdk/test/java/io/File/basic.sh b/jdk/test/java/io/File/basic.sh
index 14e6eefcc2d..4244233e9c0 100644
--- a/jdk/test/java/io/File/basic.sh
+++ b/jdk/test/java/io/File/basic.sh
@@ -1,7 +1,7 @@
#! /bin/sh
#
-# Copyright (c) 1998, 1999, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 1998, 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
diff --git a/jdk/test/java/io/FileInputStream/LargeFileAvailable.java b/jdk/test/java/io/FileInputStream/LargeFileAvailable.java
index 0e33d9a969f..4f82ec1b78b 100644
--- a/jdk/test/java/io/FileInputStream/LargeFileAvailable.java
+++ b/jdk/test/java/io/FileInputStream/LargeFileAvailable.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2010, 2011, 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
diff --git a/jdk/test/java/io/FileOutputStream/AtomicAppend.java b/jdk/test/java/io/FileOutputStream/AtomicAppend.java
index c5f18e6cd98..ccc4b59cdb1 100644
--- a/jdk/test/java/io/FileOutputStream/AtomicAppend.java
+++ b/jdk/test/java/io/FileOutputStream/AtomicAppend.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2007, 2008, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2007, 2011, 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
diff --git a/jdk/test/java/io/OutputStreamWriter/Encode.java b/jdk/test/java/io/OutputStreamWriter/Encode.java
index fda2d03cc54..6f7a0269b7e 100644
--- a/jdk/test/java/io/OutputStreamWriter/Encode.java
+++ b/jdk/test/java/io/OutputStreamWriter/Encode.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2003, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2011, 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
diff --git a/jdk/test/java/io/PrintStream/EncodingConstructor.java b/jdk/test/java/io/PrintStream/EncodingConstructor.java
index a4b9c884295..4aeb225bcc8 100644
--- a/jdk/test/java/io/PrintStream/EncodingConstructor.java
+++ b/jdk/test/java/io/PrintStream/EncodingConstructor.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2000, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2011, 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
diff --git a/jdk/test/java/io/Serializable/NPEProvoker/NPEProvoker.java b/jdk/test/java/io/Serializable/NPEProvoker/NPEProvoker.java
index 47a8516a594..15981432a67 100644
--- a/jdk/test/java/io/Serializable/NPEProvoker/NPEProvoker.java
+++ b/jdk/test/java/io/Serializable/NPEProvoker/NPEProvoker.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2007, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2007, 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
diff --git a/jdk/test/java/io/Serializable/evolution/RenamePackage/install/SerialDriver.java b/jdk/test/java/io/Serializable/evolution/RenamePackage/install/SerialDriver.java
index 47f79ea713d..5a77164a08d 100644
--- a/jdk/test/java/io/Serializable/evolution/RenamePackage/install/SerialDriver.java
+++ b/jdk/test/java/io/Serializable/evolution/RenamePackage/install/SerialDriver.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1998, 2004, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 2011, 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
diff --git a/jdk/test/java/io/Serializable/evolution/RenamePackage/test/SerialDriver.java b/jdk/test/java/io/Serializable/evolution/RenamePackage/test/SerialDriver.java
index 533df16511d..7e312695beb 100644
--- a/jdk/test/java/io/Serializable/evolution/RenamePackage/test/SerialDriver.java
+++ b/jdk/test/java/io/Serializable/evolution/RenamePackage/test/SerialDriver.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1998, 2004, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 2011, 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
diff --git a/jdk/test/java/lang/Double/ParseDouble.java b/jdk/test/java/lang/Double/ParseDouble.java
index 669d078c029..a282a6aac68 100644
--- a/jdk/test/java/lang/Double/ParseDouble.java
+++ b/jdk/test/java/lang/Double/ParseDouble.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2001, 2003, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 2011, 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
diff --git a/jdk/test/java/lang/ProcessBuilder/Basic.java b/jdk/test/java/lang/ProcessBuilder/Basic.java
index 7ba90e8e8a2..22916929561 100644
--- a/jdk/test/java/lang/ProcessBuilder/Basic.java
+++ b/jdk/test/java/lang/ProcessBuilder/Basic.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2011, 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
diff --git a/jdk/test/java/lang/Runtime/exec/Duped.java b/jdk/test/java/lang/Runtime/exec/Duped.java
index 2788b77e48c..bef0a0f8a78 100644
--- a/jdk/test/java/lang/Runtime/exec/Duped.java
+++ b/jdk/test/java/lang/Runtime/exec/Duped.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1999, 2001, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2011, 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
diff --git a/jdk/test/java/lang/Runtime/shutdown/ShutdownHooks.java b/jdk/test/java/lang/Runtime/shutdown/ShutdownHooks.java
index bfe2b60e3ee..98c3614cb53 100644
--- a/jdk/test/java/lang/Runtime/shutdown/ShutdownHooks.java
+++ b/jdk/test/java/lang/Runtime/shutdown/ShutdownHooks.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2009, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2009, 2011, 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
diff --git a/jdk/test/java/lang/System/finalization/FinExit.sh b/jdk/test/java/lang/System/finalization/FinExit.sh
index 30a01ccaa31..53bc6756171 100644
--- a/jdk/test/java/lang/System/finalization/FinExit.sh
+++ b/jdk/test/java/lang/System/finalization/FinExit.sh
@@ -1,7 +1,7 @@
#! /bin/sh
#
-# Copyright (c) 1998, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 1998, 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
diff --git a/jdk/test/java/lang/Thread/StartOOMTest.java b/jdk/test/java/lang/Thread/StartOOMTest.java
index 57edd723c31..d543749a6a0 100644
--- a/jdk/test/java/lang/Thread/StartOOMTest.java
+++ b/jdk/test/java/lang/Thread/StartOOMTest.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2007, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2007, 2011, 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
diff --git a/jdk/test/java/lang/Throwable/SuppressedExceptions.java b/jdk/test/java/lang/Throwable/SuppressedExceptions.java
index f1c30b358ad..b987600dca3 100644
--- a/jdk/test/java/lang/Throwable/SuppressedExceptions.java
+++ b/jdk/test/java/lang/Throwable/SuppressedExceptions.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2010, 2011, 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,7 +26,7 @@ import java.util.*;
/*
* @test
- * @bug 6911258 6962571 6963622 6991528
+ * @bug 6911258 6962571 6963622 6991528 7005628
* @summary Basic tests of suppressed exceptions
* @author Joseph D. Darcy
*/
@@ -50,14 +50,6 @@ public class SuppressedExceptions {
} catch (IllegalArgumentException iae) {
; // Expected
}
-
- throwable.addSuppressed(null); // Immutable suppression list
- try {
- throwable.addSuppressed(throwable);
- throw new RuntimeException("IllegalArgumentException for self-suppresion not thrown.");
- } catch (IllegalArgumentException iae) {
- ; // Expected
- }
}
private static void basicSupressionTest() {
@@ -153,19 +145,19 @@ public class SuppressedExceptions {
(byte)0x02, (byte)0x00, (byte)0x00, (byte)0x78, (byte)0x70,
};
- ByteArrayInputStream bais = new ByteArrayInputStream(bytes);
- ObjectInputStream ois = new ObjectInputStream(bais);
+ try(ByteArrayInputStream bais = new ByteArrayInputStream(bytes);
+ ObjectInputStream ois = new ObjectInputStream(bais)) {
+ Object o = ois.readObject();
+ Throwable throwable = (Throwable) o;
- Object o = ois.readObject();
- Throwable throwable = (Throwable) o;
+ System.err.println("TESTING SERIALIZED EXCEPTION");
- System.err.println("TESTING SERIALIZED EXCEPTION");
-
- Throwable[] t0 = throwable.getSuppressed();
- if (t0.length != 0) { // Will fail if t0 is null.
- throw new RuntimeException(message);
+ Throwable[] t0 = throwable.getSuppressed();
+ if (t0.length != 0) { // Will fail if t0 is null.
+ throw new RuntimeException(message);
+ }
+ throwable.printStackTrace();
}
- throwable.printStackTrace();
}
private static void selfReference() {
@@ -183,8 +175,7 @@ public class SuppressedExceptions {
}
private static void noModification() {
- Throwable t = new Throwable();
- t.addSuppressed(null);
+ Throwable t = new NoSuppression(false);
Throwable[] t0 = t.getSuppressed();
if (t0.length != 0)
@@ -196,5 +187,24 @@ public class SuppressedExceptions {
t0 = t.getSuppressed();
if (t0.length != 0)
throw new RuntimeException("Bad nonzero length of suppressed exceptions.");
+
+ Throwable suppressed = new ArithmeticException();
+ t = new NoSuppression(true); // Suppression enabled
+ // Make sure addSuppressed(null) throws an NPE
+ try {
+ t.addSuppressed(null);
+ } catch(NullPointerException e) {
+ ; // Expected
+ }
+ t.addSuppressed(suppressed);
+ t0 = t.getSuppressed();
+ if (t0.length != 1 || t0[0] != suppressed)
+ throw new RuntimeException("Expected suppression did not occur.");
+ }
+
+ private static class NoSuppression extends Throwable {
+ public NoSuppression(boolean enableSuppression) {
+ super("The medium.", null, enableSuppression);
+ }
}
}
diff --git a/jdk/test/java/lang/annotation/PackageMain.java b/jdk/test/java/lang/annotation/PackageMain.java
index 8b3f727d8c7..5c73a9ebb25 100644
--- a/jdk/test/java/lang/annotation/PackageMain.java
+++ b/jdk/test/java/lang/annotation/PackageMain.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2004, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2004, 2011, 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
@@ -21,8 +21,6 @@
* questions.
*/
-import java.lang.annotation.Documented;
-
public class PackageMain {
public static void main(String[] args) throws Exception {
Class> c = Class.forName("foo.bar.Baz");
@@ -30,7 +28,7 @@ public class PackageMain {
System.out.println("cl=" + c.getClassLoader());
Package p = c.getPackage();
System.out.println("p=" + p);
- Documented d = p.getAnnotation(Documented.class);
+ Deprecated d = p.getAnnotation(Deprecated.class);
if (d == null) throw new Error();
}
}
diff --git a/jdk/test/java/lang/annotation/loaderLeak/LoaderLeak.sh b/jdk/test/java/lang/annotation/loaderLeak/LoaderLeak.sh
index 28a7d6c6c48..6c53bf5f9e4 100644
--- a/jdk/test/java/lang/annotation/loaderLeak/LoaderLeak.sh
+++ b/jdk/test/java/lang/annotation/loaderLeak/LoaderLeak.sh
@@ -1,6 +1,6 @@
#!/bin/sh
-# Copyright (c) 2004, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2004, 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
diff --git a/jdk/test/java/lang/annotation/package-info.java b/jdk/test/java/lang/annotation/package-info.java
index f5463672c5c..8b057d87a3d 100644
--- a/jdk/test/java/lang/annotation/package-info.java
+++ b/jdk/test/java/lang/annotation/package-info.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2004, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2004, 2011, 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,7 +31,7 @@
* @run main PackageMain
*/
-@java.lang.annotation.Documented
+@Deprecated
package foo.bar;
class Baz {}
diff --git a/jdk/test/java/lang/instrument/BootClassPath/Setup.java b/jdk/test/java/lang/instrument/BootClassPath/Setup.java
index 3ef40f13217..409c5940b90 100644
--- a/jdk/test/java/lang/instrument/BootClassPath/Setup.java
+++ b/jdk/test/java/lang/instrument/BootClassPath/Setup.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2004, 2005, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2004, 2011, 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
diff --git a/jdk/test/java/lang/instrument/appendToClassLoaderSearch/CommonSetup.sh b/jdk/test/java/lang/instrument/appendToClassLoaderSearch/CommonSetup.sh
index 6074b1dc2f9..8b8d8ef3e27 100644
--- a/jdk/test/java/lang/instrument/appendToClassLoaderSearch/CommonSetup.sh
+++ b/jdk/test/java/lang/instrument/appendToClassLoaderSearch/CommonSetup.sh
@@ -1,7 +1,7 @@
#!/bin/sh
#
-# Copyright (c) 2005, 2008, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2005, 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
diff --git a/jdk/test/java/lang/instrument/ilib/Inject.java b/jdk/test/java/lang/instrument/ilib/Inject.java
index 5e0caa4e1dd..22acbc9324b 100644
--- a/jdk/test/java/lang/instrument/ilib/Inject.java
+++ b/jdk/test/java/lang/instrument/ilib/Inject.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2005, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2011, 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
diff --git a/jdk/test/java/lang/instrument/ilib/InjectBytecodes.java b/jdk/test/java/lang/instrument/ilib/InjectBytecodes.java
index 35e185889ff..53e6a2feaea 100644
--- a/jdk/test/java/lang/instrument/ilib/InjectBytecodes.java
+++ b/jdk/test/java/lang/instrument/ilib/InjectBytecodes.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2005, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 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
diff --git a/jdk/test/java/lang/invoke/6987555/Test6987555.java b/jdk/test/java/lang/invoke/6987555/Test6987555.java
new file mode 100644
index 00000000000..7a2f45c6efe
--- /dev/null
+++ b/jdk/test/java/lang/invoke/6987555/Test6987555.java
@@ -0,0 +1,177 @@
+/*
+ * Copyright (c) 2010, 2011, 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 6987555
+ * @summary JSR 292 unboxing to a boolean value fails on big-endian SPARC
+ *
+ * @run main/othervm -Xint -ea -XX:+UnlockDiagnosticVMOptions -XX:+VerifyMethodHandles Test6987555
+ */
+
+import java.lang.invoke.*;
+
+public class Test6987555 {
+ private static final Class CLASS = Test6987555.class;
+ private static final String NAME = "foo";
+ private static final boolean DEBUG = false;
+
+ public static void main(String[] args) throws Throwable {
+ testboolean();
+ testbyte();
+ testchar();
+ testshort();
+ testint();
+ }
+
+ // boolean
+ static void testboolean() throws Throwable {
+ doboolean(false);
+ doboolean(true);
+ }
+ static void doboolean(boolean x) throws Throwable {
+ if (DEBUG) System.out.println("boolean=" + x);
+ MethodHandle mh1 = MethodHandles.lookup().findStatic(CLASS, NAME, MethodType.methodType(boolean.class, boolean.class));
+ MethodHandle mh2 = mh1.asType(MethodType.methodType(boolean.class, Boolean.class));
+ boolean a = (boolean) mh1.invokeExact(x);
+ boolean b = (boolean) mh2.invokeExact(Boolean.valueOf(x));
+ assert a == b : a + " != " + b;
+ }
+
+ // byte
+ static void testbyte() throws Throwable {
+ byte[] a = new byte[] {
+ Byte.MIN_VALUE,
+ Byte.MIN_VALUE + 1,
+ -0x0F,
+ -1,
+ 0,
+ 1,
+ 0x0F,
+ Byte.MAX_VALUE - 1,
+ Byte.MAX_VALUE
+ };
+ for (int i = 0; i < a.length; i++) {
+ dobyte(a[i]);
+ }
+ }
+ static void dobyte(byte x) throws Throwable {
+ if (DEBUG) System.out.println("byte=" + x);
+ MethodHandle mh1 = MethodHandles.lookup().findStatic(CLASS, NAME, MethodType.methodType(byte.class, byte.class));
+ MethodHandle mh2 = mh1.asType(MethodType.methodType(byte.class, Byte.class));
+ byte a = (byte) mh1.invokeExact(x);
+ byte b = (byte) mh2.invokeExact(Byte.valueOf(x));
+ assert a == b : a + " != " + b;
+ }
+
+ // char
+ static void testchar() throws Throwable {
+ char[] a = new char[] {
+ Character.MIN_VALUE,
+ Character.MIN_VALUE + 1,
+ 0x000F,
+ 0x00FF,
+ 0x0FFF,
+ Character.MAX_VALUE - 1,
+ Character.MAX_VALUE
+ };
+ for (int i = 0; i < a.length; i++) {
+ dochar(a[i]);
+ }
+ }
+ static void dochar(char x) throws Throwable {
+ if (DEBUG) System.out.println("char=" + x);
+ MethodHandle mh1 = MethodHandles.lookup().findStatic(CLASS, NAME, MethodType.methodType(char.class, char.class));
+ MethodHandle mh2 = mh1.asType(MethodType.methodType(char.class, Character.class));
+ char a = (char) mh1.invokeExact(x);
+ char b = (char) mh2.invokeExact(Character.valueOf(x));
+ assert a == b : a + " != " + b;
+ }
+
+ // short
+ static void testshort() throws Throwable {
+ short[] a = new short[] {
+ Short.MIN_VALUE,
+ Short.MIN_VALUE + 1,
+ -0x0FFF,
+ -0x00FF,
+ -0x000F,
+ -1,
+ 0,
+ 1,
+ 0x000F,
+ 0x00FF,
+ 0x0FFF,
+ Short.MAX_VALUE - 1,
+ Short.MAX_VALUE
+ };
+ for (int i = 0; i < a.length; i++) {
+ doshort(a[i]);
+ }
+ }
+ static void doshort(short x) throws Throwable {
+ if (DEBUG) System.out.println("short=" + x);
+ MethodHandle mh1 = MethodHandles.lookup().findStatic(CLASS, NAME, MethodType.methodType(short.class, short.class));
+ MethodHandle mh2 = mh1.asType(MethodType.methodType(short.class, Short.class));
+ short a = (short) mh1.invokeExact(x);
+ short b = (short) mh2.invokeExact(Short.valueOf(x));
+ assert a == b : a + " != " + b;
+ }
+
+ // int
+ static void testint() throws Throwable {
+ int[] a = new int[] {
+ Integer.MIN_VALUE,
+ Integer.MIN_VALUE + 1,
+ -0x00000FFF,
+ -0x000000FF,
+ -0x0000000F,
+ -1,
+ 0,
+ 1,
+ 0x0000000F,
+ 0x000000FF,
+ 0x00000FFF,
+ Integer.MAX_VALUE - 1,
+ Integer.MAX_VALUE
+ };
+ for (int i = 0; i < a.length; i++) {
+ doint(a[i]);
+ }
+ }
+ static void doint(int x) throws Throwable {
+ if (DEBUG) System.out.println("int=" + x);
+ MethodHandle mh1 = MethodHandles.lookup().findStatic(CLASS, NAME, MethodType.methodType(int.class, int.class));
+ MethodHandle mh2 = mh1.asType(MethodType.methodType(int.class, Integer.class));
+ int a = (int) mh1.invokeExact(x);
+ int b = (int) mh2.invokeExact(Integer.valueOf(x));
+ assert a == b : a + " != " + b;
+ }
+
+ public static boolean foo(boolean i) { return i; }
+ public static byte foo(byte i) { return i; }
+ public static char foo(char i) { return i; }
+ public static short foo(short i) { return i; }
+ public static int foo(int i) { return i; }
+}
diff --git a/jdk/test/java/lang/invoke/6991596/Test6991596.java b/jdk/test/java/lang/invoke/6991596/Test6991596.java
new file mode 100644
index 00000000000..b349a10c47b
--- /dev/null
+++ b/jdk/test/java/lang/invoke/6991596/Test6991596.java
@@ -0,0 +1,465 @@
+/*
+ * Copyright (c) 2010, 2011, 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 6991596
+ * @summary JSR 292 unimplemented adapter_opt_i2i and adapter_opt_l2i on SPARC
+ *
+ * @run main/othervm -ea -XX:+UnlockDiagnosticVMOptions -XX:+VerifyMethodHandles Test6991596
+ */
+
+import java.lang.invoke.*;
+
+public class Test6991596 {
+ private static final Class CLASS = Test6991596.class;
+ private static final String NAME = "foo";
+ private static final boolean DEBUG = System.getProperty("DEBUG", "false").equals("true");
+
+ public static void main(String[] args) throws Throwable {
+ testboolean();
+ testbyte();
+ testchar();
+ testshort();
+ testint();
+ testlong();
+ }
+
+ // Helpers to get various methods.
+ static MethodHandle getmh1(Class ret, Class arg) throws ReflectiveOperationException {
+ return MethodHandles.lookup().findStatic(CLASS, NAME, MethodType.methodType(ret, arg));
+ }
+ static MethodHandle getmh2(MethodHandle mh1, Class ret, Class arg) {
+ return MethodHandles.convertArguments(mh1, MethodType.methodType(ret, arg));
+ }
+ static MethodHandle getmh3(MethodHandle mh1, Class ret, Class arg) {
+ return MethodHandles.convertArguments(mh1, MethodType.methodType(ret, arg));
+ }
+
+ // test adapter_opt_i2i
+ static void testboolean() throws Throwable {
+ boolean[] a = new boolean[] {
+ true,
+ false
+ };
+ for (int i = 0; i < a.length; i++) {
+ doboolean(a[i]);
+ }
+ }
+ static void doboolean(boolean x) throws Throwable {
+ if (DEBUG) System.out.println("boolean=" + x);
+
+ // boolean
+ {
+ MethodHandle mh1 = getmh1( boolean.class, boolean.class);
+ MethodHandle mh2 = getmh2(mh1, boolean.class, boolean.class);
+ // TODO add this for all cases when the bugs are fixed.
+ //MethodHandle mh3 = getmh3(mh1, boolean.class, boolean.class);
+ boolean a = (boolean) mh1.invokeExact((boolean) x);
+ boolean b = (boolean) mh2.invokeExact(x);
+ //boolean c = mh3.invokeExact((boolean) x);
+ check(x, a, b);
+ //check(x, c, x);
+ }
+
+ // byte
+ {
+ MethodHandle mh1 = getmh1( byte.class, byte.class );
+ MethodHandle mh2 = getmh2(mh1, byte.class, boolean.class);
+ byte a = (byte) mh1.invokeExact((byte) (x ? 1 : 0));
+ byte b = (byte) mh2.invokeExact(x);
+ check(x, a, b);
+ }
+
+ // char
+ {
+ MethodHandle mh1 = getmh1( char.class, char.class);
+ MethodHandle mh2 = getmh2(mh1, char.class, boolean.class);
+ char a = (char) mh1.invokeExact((char) (x ? 1 : 0));
+ char b = (char) mh2.invokeExact(x);
+ check(x, a, b);
+ }
+
+ // short
+ {
+ MethodHandle mh1 = getmh1( short.class, short.class);
+ MethodHandle mh2 = getmh2(mh1, short.class, boolean.class);
+ short a = (short) mh1.invokeExact((short) (x ? 1 : 0));
+ short b = (short) mh2.invokeExact(x);
+ check(x, a, b);
+ }
+ }
+
+ static void testbyte() throws Throwable {
+ byte[] a = new byte[] {
+ Byte.MIN_VALUE,
+ Byte.MIN_VALUE + 1,
+ -0x0F,
+ -1,
+ 0,
+ 1,
+ 0x0F,
+ Byte.MAX_VALUE - 1,
+ Byte.MAX_VALUE
+ };
+ for (int i = 0; i < a.length; i++) {
+ dobyte(a[i]);
+ }
+ }
+ static void dobyte(byte x) throws Throwable {
+ if (DEBUG) System.out.println("byte=" + x);
+
+ // boolean
+ {
+ MethodHandle mh1 = getmh1( boolean.class, boolean.class);
+ MethodHandle mh2 = getmh2(mh1, boolean.class, byte.class);
+ boolean a = (boolean) mh1.invokeExact((x & 1) == 1);
+ boolean b = (boolean) mh2.invokeExact(x);
+ check(x, a, b);
+ }
+
+ // byte
+ {
+ MethodHandle mh1 = getmh1( byte.class, byte.class);
+ MethodHandle mh2 = getmh2(mh1, byte.class, byte.class);
+ byte a = (byte) mh1.invokeExact((byte) x);
+ byte b = (byte) mh2.invokeExact(x);
+ check(x, a, b);
+ }
+
+ // char
+ {
+ MethodHandle mh1 = getmh1( char.class, char.class);
+ MethodHandle mh2 = getmh2(mh1, char.class, byte.class);
+ char a = (char) mh1.invokeExact((char) x);
+ char b = (char) mh2.invokeExact(x);
+ check(x, a, b);
+ }
+
+ // short
+ {
+ MethodHandle mh1 = getmh1( short.class, short.class);
+ MethodHandle mh2 = getmh2(mh1, short.class, byte.class);
+ short a = (short) mh1.invokeExact((short) x);
+ short b = (short) mh2.invokeExact(x);
+ check(x, a, b);
+ }
+ }
+
+ static void testchar() throws Throwable {
+ char[] a = new char[] {
+ Character.MIN_VALUE,
+ Character.MIN_VALUE + 1,
+ 0x000F,
+ 0x00FF,
+ 0x0FFF,
+ Character.MAX_VALUE - 1,
+ Character.MAX_VALUE
+ };
+ for (int i = 0; i < a.length; i++) {
+ dochar(a[i]);
+ }
+ }
+ static void dochar(char x) throws Throwable {
+ if (DEBUG) System.out.println("char=" + x);
+
+ // boolean
+ {
+ MethodHandle mh1 = getmh1( boolean.class, boolean.class);
+ MethodHandle mh2 = getmh2(mh1, boolean.class, char.class);
+ boolean a = (boolean) mh1.invokeExact((x & 1) == 1);
+ boolean b = (boolean) mh2.invokeExact(x);
+ check(x, a, b);
+ }
+
+ // byte
+ {
+ MethodHandle mh1 = getmh1( byte.class, byte.class);
+ MethodHandle mh2 = getmh2(mh1, byte.class, char.class);
+ byte a = (byte) mh1.invokeExact((byte) x);
+ byte b = (byte) mh2.invokeExact(x);
+ check(x, a, b);
+ }
+
+ // char
+ {
+ MethodHandle mh1 = getmh1( char.class, char.class);
+ MethodHandle mh2 = getmh2(mh1, char.class, char.class);
+ char a = (char) mh1.invokeExact((char) x);
+ char b = (char) mh2.invokeExact(x);
+ check(x, a, b);
+ }
+
+ // short
+ {
+ MethodHandle mh1 = getmh1( short.class, short.class);
+ MethodHandle mh2 = getmh2(mh1, short.class, char.class);
+ short a = (short) mh1.invokeExact((short) x);
+ short b = (short) mh2.invokeExact(x);
+ check(x, a, b);
+ }
+ }
+
+ static void testshort() throws Throwable {
+ short[] a = new short[] {
+ Short.MIN_VALUE,
+ Short.MIN_VALUE + 1,
+ -0x0FFF,
+ -0x00FF,
+ -0x000F,
+ -1,
+ 0,
+ 1,
+ 0x000F,
+ 0x00FF,
+ 0x0FFF,
+ Short.MAX_VALUE - 1,
+ Short.MAX_VALUE
+ };
+ for (int i = 0; i < a.length; i++) {
+ doshort(a[i]);
+ }
+ }
+ static void doshort(short x) throws Throwable {
+ if (DEBUG) System.out.println("short=" + x);
+
+ // boolean
+ {
+ MethodHandle mh1 = getmh1( boolean.class, boolean.class);
+ MethodHandle mh2 = getmh2(mh1, boolean.class, short.class);
+ boolean a = (boolean) mh1.invokeExact((x & 1) == 1);
+ boolean b = (boolean) mh2.invokeExact(x);
+ check(x, a, b);
+ }
+
+ // byte
+ {
+ MethodHandle mh1 = getmh1( byte.class, byte.class);
+ MethodHandle mh2 = getmh2(mh1, byte.class, short.class);
+ byte a = (byte) mh1.invokeExact((byte) x);
+ byte b = (byte) mh2.invokeExact(x);
+ check(x, a, b);
+ }
+
+ // char
+ {
+ MethodHandle mh1 = getmh1( char.class, char.class);
+ MethodHandle mh2 = getmh2(mh1, char.class, short.class);
+ char a = (char) mh1.invokeExact((char) x);
+ char b = (char) mh2.invokeExact(x);
+ check(x, a, b);
+ }
+
+ // short
+ {
+ MethodHandle mh1 = getmh1( short.class, short.class);
+ MethodHandle mh2 = getmh2(mh1, short.class, short.class);
+ short a = (short) mh1.invokeExact((short) x);
+ short b = (short) mh2.invokeExact(x);
+ check(x, a, b);
+ }
+ }
+
+ static void testint() throws Throwable {
+ int[] a = new int[] {
+ Integer.MIN_VALUE,
+ Integer.MIN_VALUE + 1,
+ -0x0FFFFFFF,
+ -0x00FFFFFF,
+ -0x000FFFFF,
+ -0x0000FFFF,
+ -0x00000FFF,
+ -0x000000FF,
+ -0x0000000F,
+ -1,
+ 0,
+ 1,
+ 0x0000000F,
+ 0x000000FF,
+ 0x00000FFF,
+ 0x0000FFFF,
+ 0x000FFFFF,
+ 0x00FFFFFF,
+ 0x0FFFFFFF,
+ Integer.MAX_VALUE - 1,
+ Integer.MAX_VALUE
+ };
+ for (int i = 0; i < a.length; i++) {
+ doint(a[i]);
+ }
+ }
+ static void doint(int x) throws Throwable {
+ if (DEBUG) System.out.println("int=" + x);
+
+ // boolean
+ {
+ MethodHandle mh1 = getmh1( boolean.class, boolean.class);
+ MethodHandle mh2 = getmh2(mh1, boolean.class, int.class);
+ boolean a = (boolean) mh1.invokeExact((x & 1) == 1);
+ boolean b = (boolean) mh2.invokeExact(x);
+ check(x, a, b);
+ }
+
+ // byte
+ {
+ MethodHandle mh1 = getmh1( byte.class, byte.class);
+ MethodHandle mh2 = getmh2(mh1, byte.class, int.class);
+ byte a = (byte) mh1.invokeExact((byte) x);
+ byte b = (byte) mh2.invokeExact(x);
+ check(x, a, b);
+ }
+
+ // char
+ {
+ MethodHandle mh1 = getmh1( char.class, char.class);
+ MethodHandle mh2 = getmh2(mh1, char.class, int.class);
+ char a = (char) mh1.invokeExact((char) x);
+ char b = (char) mh2.invokeExact(x);
+ check(x, a, b);
+ }
+
+ // short
+ {
+ MethodHandle mh1 = getmh1( short.class, short.class);
+ MethodHandle mh2 = getmh2(mh1, short.class, int.class);
+ short a = (short) mh1.invokeExact((short) x);
+ short b = (short) mh2.invokeExact(x);
+ assert a == b : a + " != " + b;
+ check(x, a, b);
+ }
+
+ // int
+ {
+ MethodHandle mh1 = getmh1( int.class, int.class);
+ MethodHandle mh2 = getmh2(mh1, int.class, int.class);
+ int a = (int) mh1.invokeExact((int) x);
+ int b = (int) mh2.invokeExact(x);
+ check(x, a, b);
+ }
+ }
+
+ // test adapter_opt_l2i
+ static void testlong() throws Throwable {
+ long[] a = new long[] {
+ Long.MIN_VALUE,
+ Long.MIN_VALUE + 1,
+ -0x000000000FFFFFFFL,
+ -0x0000000000FFFFFFL,
+ -0x00000000000FFFFFL,
+ -0x000000000000FFFFL,
+ -0x0000000000000FFFL,
+ -0x00000000000000FFL,
+ -0x000000000000000FL,
+ -1L,
+ 0L,
+ 1L,
+ 0x000000000000000FL,
+ 0x00000000000000FFL,
+ 0x0000000000000FFFL,
+ 0x0000000000000FFFL,
+ 0x000000000000FFFFL,
+ 0x00000000000FFFFFL,
+ 0x0000000000FFFFFFL,
+ 0x000000000FFFFFFFL,
+ Long.MAX_VALUE - 1,
+ Long.MAX_VALUE
+ };
+ for (int i = 0; i < a.length; i++) {
+ dolong(a[i]);
+ }
+ }
+ static void dolong(long x) throws Throwable {
+ if (DEBUG) System.out.println("long=" + x);
+
+ // boolean
+ {
+ MethodHandle mh1 = getmh1( boolean.class, boolean.class);
+ MethodHandle mh2 = getmh2(mh1, boolean.class, long.class);
+ boolean a = (boolean) mh1.invokeExact((x & 1L) == 1L);
+ boolean b = (boolean) mh2.invokeExact(x);
+ check(x, a, b);
+ }
+
+ // byte
+ {
+ MethodHandle mh1 = getmh1( byte.class, byte.class);
+ MethodHandle mh2 = getmh2(mh1, byte.class, long.class);
+ byte a = (byte) mh1.invokeExact((byte) x);
+ byte b = (byte) mh2.invokeExact(x);
+ check(x, a, b);
+ }
+
+ // char
+ {
+ MethodHandle mh1 = getmh1( char.class, char.class);
+ MethodHandle mh2 = getmh2(mh1, char.class, long.class);
+ char a = (char) mh1.invokeExact((char) x);
+ char b = (char) mh2.invokeExact(x);
+ check(x, a, b);
+ }
+
+ // short
+ {
+ MethodHandle mh1 = getmh1( short.class, short.class);
+ MethodHandle mh2 = getmh2(mh1, short.class, long.class);
+ short a = (short) mh1.invokeExact((short) x);
+ short b = (short) mh2.invokeExact(x);
+ check(x, a, b);
+ }
+
+ // int
+ {
+ MethodHandle mh1 = getmh1( int.class, int.class);
+ MethodHandle mh2 = getmh2(mh1, int.class, long.class);
+ int a = (int) mh1.invokeExact((int) x);
+ int b = (int) mh2.invokeExact(x);
+ check(x, a, b);
+ }
+ }
+
+ static void check(boolean x, boolean e, boolean a) { p(z2h(x), z2h(e), z2h(a)); assert e == a : z2h(x) + ": " + z2h(e) + " != " + z2h(a); }
+ static void check(boolean x, byte e, byte a) { p(z2h(x), i2h(e), i2h(a)); assert e == a : z2h(x) + ": " + i2h(e) + " != " + i2h(a); }
+ static void check(boolean x, int e, int a) { p(z2h(x), i2h(e), i2h(a)); assert e == a : z2h(x) + ": " + i2h(e) + " != " + i2h(a); }
+
+ static void check(int x, boolean e, boolean a) { p(i2h(x), z2h(e), z2h(a)); assert e == a : i2h(x) + ": " + z2h(e) + " != " + z2h(a); }
+ static void check(int x, byte e, byte a) { p(i2h(x), i2h(e), i2h(a)); assert e == a : i2h(x) + ": " + i2h(e) + " != " + i2h(a); }
+ static void check(int x, int e, int a) { p(i2h(x), i2h(e), i2h(a)); assert e == a : i2h(x) + ": " + i2h(e) + " != " + i2h(a); }
+
+ static void check(long x, boolean e, boolean a) { p(l2h(x), z2h(e), z2h(a)); assert e == a : l2h(x) + ": " + z2h(e) + " != " + z2h(a); }
+ static void check(long x, byte e, byte a) { p(l2h(x), i2h(e), i2h(a)); assert e == a : l2h(x) + ": " + i2h(e) + " != " + i2h(a); }
+ static void check(long x, int e, int a) { p(l2h(x), i2h(e), i2h(a)); assert e == a : l2h(x) + ": " + i2h(e) + " != " + i2h(a); }
+
+ static void p(String x, String e, String a) { if (DEBUG) System.out.println(x + ": expected: " + e + ", actual: " + a); }
+
+ static String z2h(boolean x) { return x ? "1" : "0"; }
+ static String i2h(int x) { return Integer.toHexString(x); }
+ static String l2h(long x) { return Long.toHexString(x); }
+
+ // to int
+ public static boolean foo(boolean i) { return i; }
+ public static byte foo(byte i) { return i; }
+ public static char foo(char i) { return i; }
+ public static short foo(short i) { return i; }
+ public static int foo(int i) { return i; }
+}
diff --git a/jdk/test/java/dyn/ClassValueTest.java b/jdk/test/java/lang/invoke/ClassValueTest.java
similarity index 94%
rename from jdk/test/java/dyn/ClassValueTest.java
rename to jdk/test/java/lang/invoke/ClassValueTest.java
index f917e9581da..59c5a658c7e 100644
--- a/jdk/test/java/dyn/ClassValueTest.java
+++ b/jdk/test/java/lang/invoke/ClassValueTest.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011, 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,21 +26,21 @@
/* @test
* @summary tests for class-specific values
* @compile ClassValueTest.java
- * @run junit/othervm test.java.dyn.ClassValueTest
+ * @run junit/othervm test.java.lang.invoke.ClassValueTest
*/
/*
Manually:
- $ $JAVA7X_HOME/bin/javac -d foo -cp $JUNIT4_JAR test/java/dyn/ClassValueTest.java
- $ $JAVA7X_HOME/bin/java -cp foo:$JUNIT4_JAR org.junit.runner.JUnitCore test.java.dyn.ClassValueTest
+ $ $JAVA7X_HOME/bin/javac -d foo -cp $JUNIT4_JAR test/java/lang/invoke/ClassValueTest.java
+ $ $JAVA7X_HOME/bin/java -cp foo:$JUNIT4_JAR org.junit.runner.JUnitCore test.java.lang.invoke.ClassValueTest
Output: .testAdd => 1000 : Integer
*/
-package test.java.dyn;
+package test.java.lang.invoke;
import java.util.*;
-import java.dyn.*;
+import java.lang.invoke.*;
import org.junit.*;
import static org.junit.Assert.*;
diff --git a/jdk/test/java/dyn/InvokeDynamicPrintArgs.java b/jdk/test/java/lang/invoke/InvokeDynamicPrintArgs.java
similarity index 84%
rename from jdk/test/java/dyn/InvokeDynamicPrintArgs.java
rename to jdk/test/java/lang/invoke/InvokeDynamicPrintArgs.java
index 233c4fc316c..d8a395d2ba4 100644
--- a/jdk/test/java/dyn/InvokeDynamicPrintArgs.java
+++ b/jdk/test/java/lang/invoke/InvokeDynamicPrintArgs.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2010, 2011, 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
@@ -25,23 +25,23 @@
* @summary smoke test for invokedynamic instructions
* @build indify.Indify
* @compile InvokeDynamicPrintArgs.java
- * @run main/othervm -XX:+UnlockExperimentalVMOptions -XX:+EnableInvokeDynamic
+ * @run main/othervm
* indify.Indify
- * --verify-specifier-count=3 --transitionalJSR292=false
+ * --verify-specifier-count=3
* --expand-properties --classpath ${test.classes}
- * --java test.java.dyn.InvokeDynamicPrintArgs --check-output
+ * --java test.java.lang.invoke.InvokeDynamicPrintArgs --check-output
*/
-package test.java.dyn;
+package test.java.lang.invoke;
import org.junit.Test;
import java.util.*;
import java.io.*;
-import java.dyn.*;
-import static java.dyn.MethodHandles.*;
-import static java.dyn.MethodType.*;
+import java.lang.invoke.*;
+import static java.lang.invoke.MethodHandles.*;
+import static java.lang.invoke.MethodType.*;
public class InvokeDynamicPrintArgs {
public static void main(String... av) throws Throwable {
@@ -63,9 +63,10 @@ public class InvokeDynamicPrintArgs {
String testClassPath = System.getProperty("build.test.classes.dir");
if (testClassPath == null) throw new RuntimeException();
String[] args = new String[]{
- "--verify-specifier-count=3", "--transitionalJSR292=false",
+ "--verify-specifier-count=3",
+ "--verbose",
"--expand-properties", "--classpath", testClassPath,
- "--java", "test.java.dyn.InvokeDynamicPrintArgs", "--check-output"
+ "--java", "test.java.lang.invoke.InvokeDynamicPrintArgs", "--check-output"
};
System.err.println("Indify: "+Arrays.toString(args));
indify.Indify.main(args);
@@ -97,11 +98,11 @@ public class InvokeDynamicPrintArgs {
}
private static final String[] EXPECT_OUTPUT = {
"Printing some argument lists, starting with a empty one:",
- "[test.java.dyn.InvokeDynamicPrintArgs, nothing, ()void][]",
- "[test.java.dyn.InvokeDynamicPrintArgs, bar, (String,int)void, class java.lang.Void, void type!, 1, 234.5, 67.5, 89][bar arg, 1]",
- "[test.java.dyn.InvokeDynamicPrintArgs, bar2, (String,int)void, class java.lang.Void, void type!, 1, 234.5, 67.5, 89][bar2 arg, 222]",
- "[test.java.dyn.InvokeDynamicPrintArgs, baz, (String,int,double)void, 1234.5][baz arg, 2, 3.14]",
- "[test.java.dyn.InvokeDynamicPrintArgs, foo, (String)void][foo arg]",
+ "[test.java.lang.invoke.InvokeDynamicPrintArgs, nothing, ()void][]",
+ "[test.java.lang.invoke.InvokeDynamicPrintArgs, bar, (String,int)void, class java.lang.Void, void type!, 1, 234.5, 67.5, 89][bar arg, 1]",
+ "[test.java.lang.invoke.InvokeDynamicPrintArgs, bar2, (String,int)void, class java.lang.Void, void type!, 1, 234.5, 67.5, 89][bar2 arg, 222]",
+ "[test.java.lang.invoke.InvokeDynamicPrintArgs, baz, (String,int,double)void, 1234.5][baz arg, 2, 3.14]",
+ "[test.java.lang.invoke.InvokeDynamicPrintArgs, foo, (String)void][foo arg]",
"Done printing argument lists."
};
@@ -159,16 +160,14 @@ public class InvokeDynamicPrintArgs {
shouldNotCallThis();
return ((CallSite) MH_bsm2().invokeGeneric(lookup(),
"bar", methodType(void.class, String.class, int.class)
- , new Object[] { Void.class, "void type!",
- 1, 234.5F, 67.5, (long)89 }
+ , Void.class, "void type!", 1, 234.5F, 67.5, (long)89
)).dynamicInvoker();
}
private static MethodHandle INDY_bar2() throws Throwable {
shouldNotCallThis();
return ((CallSite) MH_bsm2().invokeGeneric(lookup(),
"bar2", methodType(void.class, String.class, int.class)
- , new Object[] { Void.class, "void type!",
- 1, 234.5F, 67.5, (long)89 }
+ , Void.class, "void type!", 1, 234.5F, 67.5, (long)89
)).dynamicInvoker();
}
private static MethodHandle INDY_baz() throws Throwable {
diff --git a/jdk/test/java/dyn/InvokeGenericTest.java b/jdk/test/java/lang/invoke/InvokeGenericTest.java
similarity index 97%
rename from jdk/test/java/dyn/InvokeGenericTest.java
rename to jdk/test/java/lang/invoke/InvokeGenericTest.java
index bae888060a0..2da9634c464 100644
--- a/jdk/test/java/dyn/InvokeGenericTest.java
+++ b/jdk/test/java/lang/invoke/InvokeGenericTest.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2009, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2009, 2011, 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,16 +24,16 @@
*/
/* @test
- * @summary unit tests for java.dyn.MethodHandle.invokeGeneric
- * @compile -XDallowTransitionalJSR292=no -target 7 InvokeGenericTest.java
- * @run junit/othervm -XX:+UnlockExperimentalVMOptions -XX:+EnableMethodHandles test.java.dyn.InvokeGenericTest
+ * @summary unit tests for java.lang.invoke.MethodHandle.invokeGeneric
+ * @compile -target 7 InvokeGenericTest.java
+ * @run junit/othervm test.java.lang.invoke.InvokeGenericTest
*/
-package test.java.dyn;
+package test.java.lang.invoke;
-import java.dyn.*;
-import static java.dyn.MethodHandles.*;
-import static java.dyn.MethodType.*;
+import java.lang.invoke.*;
+import static java.lang.invoke.MethodHandles.*;
+import static java.lang.invoke.MethodType.*;
import java.lang.reflect.*;
import java.util.*;
import org.junit.*;
@@ -49,7 +49,7 @@ public class InvokeGenericTest {
// How much output?
static int verbosity = 0;
static {
- String vstr = System.getProperty("test.java.dyn.InvokeGenericTest.verbosity");
+ String vstr = System.getProperty("test.java.lang.invoke.InvokeGenericTest.verbosity");
if (vstr != null) verbosity = Integer.parseInt(vstr);
}
@@ -216,7 +216,7 @@ public class InvokeGenericTest {
if (wrap != null) {
return wrap;
}
-// import sun.dyn.util.Wrapper;
+// import sun.invoke.util.Wrapper;
// Wrapper wrap = Wrapper.forBasicType(dst);
// if (wrap == Wrapper.OBJECT && Wrapper.isWrapperType(dst))
// wrap = Wrapper.forWrapperType(dst);
diff --git a/jdk/test/java/dyn/JavaDocExamplesTest.java b/jdk/test/java/lang/invoke/JavaDocExamplesTest.java
similarity index 88%
rename from jdk/test/java/dyn/JavaDocExamplesTest.java
rename to jdk/test/java/lang/invoke/JavaDocExamplesTest.java
index 72a62851f82..7810399c62d 100644
--- a/jdk/test/java/dyn/JavaDocExamplesTest.java
+++ b/jdk/test/java/lang/invoke/JavaDocExamplesTest.java
@@ -24,27 +24,26 @@
*/
/* @test
- * @summary example code used in javadoc for java.dyn API
- * @compile -XDallowTransitionalJSR292=no JavaDocExamplesTest.java
- * @run junit/othervm -XX:+UnlockExperimentalVMOptions -XX:+EnableMethodHandles test.java.dyn.JavaDocExamplesTest
+ * @summary example code used in javadoc for java.lang.invoke API
+ * @compile JavaDocExamplesTest.java
+ * @run junit/othervm test.java.lang.invoke.JavaDocExamplesTest
*/
/*
---- To run outside jtreg:
$ $JAVA7X_HOME/bin/javac -cp $JUNIT4_JAR -d /tmp/Classes \
- $DAVINCI/sources/jdk/test/java/dyn/JavaDocExamplesTest.java
+ $DAVINCI/sources/jdk/test/java/lang/invoke/JavaDocExamplesTest.java
$ $JAVA7X_HOME/bin/java -cp $JUNIT4_JAR:/tmp/Classes \
- -XX:+UnlockExperimentalVMOptions -XX:+EnableMethodHandles \
- -Dtest.java.dyn.JavaDocExamplesTest.verbosity=1 \
- test.java.dyn.JavaDocExamplesTest
+ -Dtest.java.lang.invoke.JavaDocExamplesTest.verbosity=1 \
+ test.java.lang.invoke.JavaDocExamplesTest
----
*/
-package test.java.dyn;
+package test.java.lang.invoke;
-import java.dyn.*;
-import static java.dyn.MethodHandles.*;
-import static java.dyn.MethodType.*;
+import java.lang.invoke.*;
+import static java.lang.invoke.MethodHandles.*;
+import static java.lang.invoke.MethodType.*;
import java.lang.reflect.*;
import java.util.*;
@@ -65,7 +64,7 @@ public class JavaDocExamplesTest {
org.junit.runner.JUnitCore.runClasses(JavaDocExamplesTest.class);
}
// How much output?
- static int verbosity = Integer.getInteger("test.java.dyn.JavaDocExamplesTest.verbosity", 0);
+ static int verbosity = Integer.getInteger("test.java.lang.invoke.JavaDocExamplesTest.verbosity", 0);
{}
static final private Lookup LOOKUP = lookup();
@@ -108,6 +107,16 @@ assertEquals("xy".hashCode(), (int) HASHCODE_3.invokeExact((Object)"xy"));
MethodHandle cat = lookup().findVirtual(String.class,
"concat", methodType(String.class, String.class));
assertEquals("xy", (String) cat.invokeExact("x", "y"));
+MethodType bigType = cat.type().insertParameterTypes(0, int.class, String.class);
+MethodHandle d0 = dropArguments(cat, 0, bigType.parameterList().subList(0,2));
+assertEquals(bigType, d0.type());
+assertEquals("yz", (String) d0.invokeExact(123, "x", "y", "z"));
+ }}
+ {{
+{} /// JAVADOC
+MethodHandle cat = lookup().findVirtual(String.class,
+ "concat", methodType(String.class, String.class));
+assertEquals("xy", (String) cat.invokeExact("x", "y"));
MethodHandle d0 = dropArguments(cat, 0, String.class);
assertEquals("yz", (String) d0.invokeExact("x", "y", "z"));
MethodHandle d1 = dropArguments(cat, 1, String.class);
diff --git a/jdk/test/java/dyn/MethodHandlesTest.java b/jdk/test/java/lang/invoke/MethodHandlesTest.java
similarity index 99%
rename from jdk/test/java/dyn/MethodHandlesTest.java
rename to jdk/test/java/lang/invoke/MethodHandlesTest.java
index b44f262fa02..427229de7c3 100644
--- a/jdk/test/java/dyn/MethodHandlesTest.java
+++ b/jdk/test/java/lang/invoke/MethodHandlesTest.java
@@ -24,15 +24,15 @@
*/
/* @test
- * @summary unit tests for java.dyn.MethodHandles
- * @compile -source 7 -target 7 -XDallowTransitionalJSR292=no MethodHandlesTest.java
- * @run junit/othervm -XX:+UnlockExperimentalVMOptions -XX:+EnableMethodHandles test.java.dyn.MethodHandlesTest
+ * @summary unit tests for java.lang.invoke.MethodHandles
+ * @compile -source 7 -target 7 MethodHandlesTest.java
+ * @run junit/othervm test.java.lang.invoke.MethodHandlesTest
*/
-package test.java.dyn;
+package test.java.lang.invoke;
-import java.dyn.*;
-import java.dyn.MethodHandles.Lookup;
+import java.lang.invoke.*;
+import java.lang.invoke.MethodHandles.Lookup;
import java.lang.reflect.*;
import java.util.*;
import org.junit.*;
@@ -48,7 +48,7 @@ public class MethodHandlesTest {
// How much output?
static int verbosity = 0;
static {
- String vstr = System.getProperty("test.java.dyn.MethodHandlesTest.verbosity");
+ String vstr = System.getProperty("test.java.lang.invoke.MethodHandlesTest.verbosity");
if (vstr != null) verbosity = Integer.parseInt(vstr);
}
@@ -258,7 +258,7 @@ public class MethodHandlesTest {
if (wrap != null) {
return wrap;
}
-// import sun.dyn.util.Wrapper;
+// import sun.invoke.util.Wrapper;
// Wrapper wrap = Wrapper.forBasicType(dst);
// if (wrap == Wrapper.OBJECT && Wrapper.isWrapperType(dst))
// wrap = Wrapper.forWrapperType(dst);
@@ -2264,7 +2264,7 @@ public class MethodHandlesTest {
}
}
}
-// Local abbreviated copy of sun.dyn.util.ValueConversions
+// Local abbreviated copy of sun.invoke.util.ValueConversions
class ValueConversions {
private static final Lookup IMPL_LOOKUP = MethodHandles.lookup();
private static final Object[] NO_ARGS_ARRAY = {};
diff --git a/jdk/test/java/dyn/MethodTypeTest.java b/jdk/test/java/lang/invoke/MethodTypeTest.java
similarity index 81%
rename from jdk/test/java/dyn/MethodTypeTest.java
rename to jdk/test/java/lang/invoke/MethodTypeTest.java
index caadaa04a33..037015090af 100644
--- a/jdk/test/java/dyn/MethodTypeTest.java
+++ b/jdk/test/java/lang/invoke/MethodTypeTest.java
@@ -24,15 +24,14 @@
*/
/* @test
- * @summary unit tests for java.dyn.MethodType
+ * @summary unit tests for java.lang.invoke.MethodType
* @compile MethodTypeTest.java
- * @run junit/othervm -XX:+UnlockExperimentalVMOptions -XX:+EnableMethodHandles test.java.dyn.MethodTypeTest
+ * @run junit/othervm test.java.lang.invoke.MethodTypeTest
*/
-package test.java.dyn;
+package test.java.lang.invoke;
-import sun.dyn.MemberName;
-import java.dyn.MethodType;
+import java.lang.invoke.MethodType;
import java.lang.reflect.Method;
import java.util.*;
@@ -163,18 +162,6 @@ public class MethodTypeTest {
assertSame(expResult, result);
}
- /**
- * Test of make method, of class MethodType.
- */
- @Test
- public void testMake_Method() {
- System.out.println("make (via MemberName.getMethodType)");
- MethodType expResult = MethodType.methodType(int.class, String.class);
- MemberName name = new MemberName(compareTo);
- MethodType result = name.getMethodType();
- assertSame(expResult, result);
- }
-
/**
* Test of make method, of class MethodType.
*/
@@ -476,10 +463,13 @@ public class MethodTypeTest {
@Test
public void testPortableSerialFormat() throws Throwable {
System.out.println("portable serial format");
+ boolean generateData = false;
+ //generateData = true; // set this true to generate the following input data:
Object[][] cases = {
{ mt_vv, new byte[] { // ()void
- (byte)0xac, (byte)0xed, (byte)0x00, (byte)0x05, (byte)0x73, (byte)0x72, (byte)0x00, (byte)0x13,
- (byte)0x6a, (byte)0x61, (byte)0x76, (byte)0x61, (byte)0x2e, (byte)0x64, (byte)0x79, (byte)0x6e,
+ (byte)0xac, (byte)0xed, (byte)0x00, (byte)0x05, (byte)0x73, (byte)0x72, (byte)0x00, (byte)0x1b,
+ (byte)0x6a, (byte)0x61, (byte)0x76, (byte)0x61, (byte)0x2e, (byte)0x6c, (byte)0x61, (byte)0x6e,
+ (byte)0x67, (byte)0x2e, (byte)0x69, (byte)0x6e, (byte)0x76, (byte)0x6f, (byte)0x6b, (byte)0x65,
(byte)0x2e, (byte)0x4d, (byte)0x65, (byte)0x74, (byte)0x68, (byte)0x6f, (byte)0x64, (byte)0x54,
(byte)0x79, (byte)0x70, (byte)0x65, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00,
(byte)0x00, (byte)0x01, (byte)0x24, (byte)0x03, (byte)0x00, (byte)0x00, (byte)0x78, (byte)0x70,
@@ -493,8 +483,9 @@ public class MethodTypeTest {
(byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x78,
} },
{ mt_OO, new byte[] { // (Object)Object
- (byte)0xac, (byte)0xed, (byte)0x00, (byte)0x05, (byte)0x73, (byte)0x72, (byte)0x00, (byte)0x13,
- (byte)0x6a, (byte)0x61, (byte)0x76, (byte)0x61, (byte)0x2e, (byte)0x64, (byte)0x79, (byte)0x6e,
+ (byte)0xac, (byte)0xed, (byte)0x00, (byte)0x05, (byte)0x73, (byte)0x72, (byte)0x00, (byte)0x1b,
+ (byte)0x6a, (byte)0x61, (byte)0x76, (byte)0x61, (byte)0x2e, (byte)0x6c, (byte)0x61, (byte)0x6e,
+ (byte)0x67, (byte)0x2e, (byte)0x69, (byte)0x6e, (byte)0x76, (byte)0x6f, (byte)0x6b, (byte)0x65,
(byte)0x2e, (byte)0x4d, (byte)0x65, (byte)0x74, (byte)0x68, (byte)0x6f, (byte)0x64, (byte)0x54,
(byte)0x79, (byte)0x70, (byte)0x65, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00,
(byte)0x00, (byte)0x01, (byte)0x24, (byte)0x03, (byte)0x00, (byte)0x00, (byte)0x78, (byte)0x70,
@@ -509,14 +500,47 @@ public class MethodTypeTest {
(byte)0x00, (byte)0x00, (byte)0x78, (byte)0x70, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x01,
(byte)0x71, (byte)0x00, (byte)0x7e, (byte)0x00, (byte)0x03, (byte)0x78,
} },
+ { mt_vOiSzA, new byte[] { // (Object,int,String,boolean,Object[])void
+ (byte)0xac, (byte)0xed, (byte)0x00, (byte)0x05, (byte)0x73, (byte)0x72, (byte)0x00, (byte)0x1b,
+ (byte)0x6a, (byte)0x61, (byte)0x76, (byte)0x61, (byte)0x2e, (byte)0x6c, (byte)0x61, (byte)0x6e,
+ (byte)0x67, (byte)0x2e, (byte)0x69, (byte)0x6e, (byte)0x76, (byte)0x6f, (byte)0x6b, (byte)0x65,
+ (byte)0x2e, (byte)0x4d, (byte)0x65, (byte)0x74, (byte)0x68, (byte)0x6f, (byte)0x64, (byte)0x54,
+ (byte)0x79, (byte)0x70, (byte)0x65, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00,
+ (byte)0x00, (byte)0x01, (byte)0x24, (byte)0x03, (byte)0x00, (byte)0x00, (byte)0x78, (byte)0x70,
+ (byte)0x76, (byte)0x72, (byte)0x00, (byte)0x04, (byte)0x76, (byte)0x6f, (byte)0x69, (byte)0x64,
+ (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00,
+ (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x78, (byte)0x70, (byte)0x75, (byte)0x72, (byte)0x00,
+ (byte)0x12, (byte)0x5b, (byte)0x4c, (byte)0x6a, (byte)0x61, (byte)0x76, (byte)0x61, (byte)0x2e,
+ (byte)0x6c, (byte)0x61, (byte)0x6e, (byte)0x67, (byte)0x2e, (byte)0x43, (byte)0x6c, (byte)0x61,
+ (byte)0x73, (byte)0x73, (byte)0x3b, (byte)0xab, (byte)0x16, (byte)0xd7, (byte)0xae, (byte)0xcb,
+ (byte)0xcd, (byte)0x5a, (byte)0x99, (byte)0x02, (byte)0x00, (byte)0x00, (byte)0x78, (byte)0x70,
+ (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x05, (byte)0x76, (byte)0x72, (byte)0x00, (byte)0x10,
+ (byte)0x6a, (byte)0x61, (byte)0x76, (byte)0x61, (byte)0x2e, (byte)0x6c, (byte)0x61, (byte)0x6e,
+ (byte)0x67, (byte)0x2e, (byte)0x4f, (byte)0x62, (byte)0x6a, (byte)0x65, (byte)0x63, (byte)0x74,
+ (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00,
+ (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x78, (byte)0x70, (byte)0x76, (byte)0x72, (byte)0x00,
+ (byte)0x03, (byte)0x69, (byte)0x6e, (byte)0x74, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00,
+ (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x78,
+ (byte)0x70, (byte)0x76, (byte)0x72, (byte)0x00, (byte)0x10, (byte)0x6a, (byte)0x61, (byte)0x76,
+ (byte)0x61, (byte)0x2e, (byte)0x6c, (byte)0x61, (byte)0x6e, (byte)0x67, (byte)0x2e, (byte)0x53,
+ (byte)0x74, (byte)0x72, (byte)0x69, (byte)0x6e, (byte)0x67, (byte)0xa0, (byte)0xf0, (byte)0xa4,
+ (byte)0x38, (byte)0x7a, (byte)0x3b, (byte)0xb3, (byte)0x42, (byte)0x02, (byte)0x00, (byte)0x00,
+ (byte)0x78, (byte)0x70, (byte)0x76, (byte)0x72, (byte)0x00, (byte)0x07, (byte)0x62, (byte)0x6f,
+ (byte)0x6f, (byte)0x6c, (byte)0x65, (byte)0x61, (byte)0x6e, (byte)0x00, (byte)0x00, (byte)0x00,
+ (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00,
+ (byte)0x78, (byte)0x70, (byte)0x76, (byte)0x72, (byte)0x00, (byte)0x13, (byte)0x5b, (byte)0x4c,
+ (byte)0x6a, (byte)0x61, (byte)0x76, (byte)0x61, (byte)0x2e, (byte)0x6c, (byte)0x61, (byte)0x6e,
+ (byte)0x67, (byte)0x2e, (byte)0x4f, (byte)0x62, (byte)0x6a, (byte)0x65, (byte)0x63, (byte)0x74,
+ (byte)0x3b, (byte)0x90, (byte)0xce, (byte)0x58, (byte)0x9f, (byte)0x10, (byte)0x73, (byte)0x29,
+ (byte)0x6c, (byte)0x02, (byte)0x00, (byte)0x00, (byte)0x78, (byte)0x70, (byte)0x78,
+ } },
};
- boolean generateData = false;
- //generateData = true;
for (Object[] c : cases) {
MethodType mt = (MethodType) c[0];
System.out.println("deserialize "+mt);
byte[] wire = (byte[]) c[1];
if (generateData) {
+ System.out.println("");
wire = writeSerial(mt);
final String INDENT = " ";
System.out.print("{ // "+mt);
@@ -528,6 +552,7 @@ public class MethodTypeTest {
}
System.out.println();
System.out.println(INDENT+"}");
+ System.out.println("");
System.out.flush();
}
Object decode;
diff --git a/jdk/test/java/dyn/indify/Indify.java b/jdk/test/java/lang/invoke/indify/Indify.java
similarity index 96%
rename from jdk/test/java/dyn/indify/Indify.java
rename to jdk/test/java/lang/invoke/indify/Indify.java
index ba24b79a9d9..6c0661dfef6 100644
--- a/jdk/test/java/dyn/indify/Indify.java
+++ b/jdk/test/java/lang/invoke/indify/Indify.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2010, 2011, 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,9 +47,9 @@ import java.util.regex.*;
* and {@code CONSTANT_MethodType} "ldc" instructions.
* The stereotyped code must create method types by calls to {@code methodType} or
* {@code fromMethodDescriptorString}. The "lookup" argument must be created
- * by calls to {@code java.dyn.MethodHandles#lookup MethodHandles.lookup}.
+ * by calls to {@code java.lang.invoke.MethodHandles#lookup MethodHandles.lookup}.
* The class and string arguments must be constant.
- * The following methods of {@code java.dyn.MethodHandle.Lookup Lookup} are
+ * The following methods of {@code java.lang.invoke.MethodHandle.Lookup Lookup} are
* allowed for method handle creation: {@code findStatic}, {@code findVirtual},
* {@code findConstructor}, {@code findSpecial},
* {@code findGetter}, {@code findSetter},
@@ -89,19 +89,15 @@ import java.util.regex.*;
$ JAVA_HOME=(some recent OpenJDK 7 build)
$ ant
$ $JAVA_HOME/bin/java -cp build/classes indify.Indify --overwrite --dest build/testout build/classes/indify/Example.class
-$ $JAVA_HOME/bin/java -XX:+UnlockExperimentalVMOptions -XX:+EnableInvokeDynamic -cp build/classes indify.Example
+$ $JAVA_HOME/bin/java -cp build/classes indify.Example
MT = (java.lang.Object)java.lang.Object
MH = adder(int,int)java.lang.Integer
adder(1,2) = 3
calling indy: 42
-$ $JAVA_HOME/bin/java -XX:+UnlockExperimentalVMOptions -XX:+EnableInvokeDynamic -cp build/testout indify.Example
+$ $JAVA_HOME/bin/java -cp build/testout indify.Example
(same output as above)
*
*
- * Before OpenJDK build b123, the format of {@code CONSTANT_InvokeDynamic} is in transition,
- * and the switch {@code --transitionalJSR292=yes} is recommended.
- * It is turned off by default, but users of earlier builds may need to turn it on.
- *
* A version of this transformation built on top of http://asm.ow2.org/ would be welcome.
* @author John Rose
*/
@@ -117,7 +113,6 @@ public class Indify {
public boolean overwrite = false;
public boolean quiet = false;
public boolean verbose = false;
- public boolean transitionalJSR292 = false; // final version is distributed
public boolean all = false;
public int verifySpecifierCount = -1;
@@ -203,9 +198,6 @@ public class Indify {
case "-v": case "--verbose": case "--verbose=":
verbose = booleanOption(a2); // more output
break;
- case "--transitionalJSR292": case "--transitionalJSR292=":
- transitionalJSR292 = booleanOption(a2); // use older invokedynamic format
- break;
default:
throw new IllegalArgumentException("unrecognized flag: "+a);
}
@@ -330,10 +322,14 @@ public class Indify {
if (resolve) resolveClass(c);
return c;
}
+ } catch (ClassNotFoundException ex) {
+ // fall through
+ } catch (IOException ex) {
+ // fall through
} catch (Exception ex) {
- if (ex instanceof IllegalArgumentException)
- // pass error from reportPatternMethods
- throw (IllegalArgumentException) ex;
+ // pass error from reportPatternMethods, etc.
+ if (ex instanceof RuntimeException) throw (RuntimeException) ex;
+ throw new RuntimeException(ex);
}
}
return super.loadClass(name, resolve);
@@ -350,10 +346,15 @@ public class Indify {
}
protected Class> findClass(String name) throws ClassNotFoundException {
try {
- return transformAndLoadClass(findClassInPath(name));
+ File f = findClassInPath(name);
+ if (f != null) {
+ Class> c = transformAndLoadClass(f);
+ if (c != null) return c;
+ }
} catch (IOException ex) {
throw new ClassNotFoundException("IO error", ex);
}
+ throw new ClassNotFoundException();
}
private Class> transformAndLoadClass(File f) throws ClassNotFoundException, IOException {
if (verbose) System.err.println("Loading class from "+f);
@@ -398,8 +399,7 @@ public class Indify {
if (blab++ == 0 && !quiet)
System.err.println("patching "+cf.nameString()+"."+m);
//if (blab == 1) { for (Instruction j = m.instructions(); j != null; j = j.next()) System.out.println(" |"+j); }
- if (con.tag == CONSTANT_InvokeDynamic ||
- con.tag == CONSTANT_InvokeDynamic_17) {
+ if (con.tag == CONSTANT_InvokeDynamic) {
// need to patch the following instruction too,
// but there are usually intervening argument pushes too
Instruction i2 = findPop(i);
@@ -561,7 +561,7 @@ public class Indify {
short nt = n12[1];
char cmark = poolMarks[(char)cl];
if (cmark != 0) {
- mark = cmark; // it is a java.dyn.* or java.lang.* method
+ mark = cmark; // it is a java.lang.invoke.* or java.lang.* method
break;
}
String cls = cf.pool.getString(CONSTANT_Class, cl);
@@ -592,7 +592,7 @@ public class Indify {
if (s.startsWith("MT_")) return 'T';
else if (s.startsWith("MH_")) return 'H';
else if (s.startsWith("INDY_")) return 'I';
- else if (s.startsWith("java/dyn/")) return 'D';
+ else if (s.startsWith("java/lang/invoke/")) return 'D';
else if (s.startsWith("java/lang/")) return 'J';
return 0;
}
@@ -605,15 +605,20 @@ public class Indify {
String descr = cf.pool.getString(CONSTANT_Utf8, n2);
String requiredType;
switch (poolMarks[(char)n1]) {
- case 'H': requiredType = "()Ljava/dyn/MethodHandle;"; break;
- case 'T': requiredType = "()Ljava/dyn/MethodType;"; break;
- case 'I': requiredType = "()Ljava/dyn/MethodHandle;"; break;
+ case 'H': requiredType = "()Ljava/lang/invoke/MethodHandle;"; break;
+ case 'T': requiredType = "()Ljava/lang/invoke/MethodType;"; break;
+ case 'I': requiredType = "()Ljava/lang/invoke/MethodHandle;"; break;
default: return 0;
}
- if (descr.equals(requiredType)) return mark;
+ if (matchType(descr, requiredType)) return mark;
return 0;
}
+ boolean matchType(String descr, String requiredType) {
+ if (descr.equals(requiredType)) return true;
+ return false;
+ }
+
private class JVMState {
final List