This commit is contained in:
Zhengyu Gu 2012-05-24 20:04:07 -04:00
commit 6a6296d61b
420 changed files with 12203 additions and 7207 deletions

View File

@ -158,3 +158,6 @@ a6e6d42203e6d35f9e8b31eac25b0021b4dd58ad jdk8-b33
0ae89825c75c9492e44efb3aca3d9ee3d8a209df jdk8-b34
f151d5833912a82cd4f203944da0305c3be83ecc jdk8-b35
98ce9816ae089c959ba1e70fba98423a31c4e9fa jdk8-b36
b3a91113026c99b0da010d41055719ab0d8938f0 jdk8-b37
4cc5610a6dd6227da766ebf9742eb11ff5ded6c0 jdk8-b38
35a5397278779a2f8f3013f81586dc8f30cb149d jdk8-b39

View File

@ -158,3 +158,6 @@ cc771d92284f71765eca14d6d08703c4af254c04 jdk8-b21
894a478d2c4819a1a0f230bd7bdd09f3b2de9a8c jdk8-b34
5285317ebb4e8e4f6d8d52b5616fa801e2ea844d jdk8-b35
6a6ba0a07f33d37a2f97b1107e60c6a9a69ec84d jdk8-b36
b2972095a4b1e2a97409b7c3df61f3b263a5ce14 jdk8-b37
d939bd0ab13c16647ffa38cc4b64fb31b7d44e10 jdk8-b38
8927dd68aee3fa54a1a698e2980e1b2f6c7c12c1 jdk8-b39

View File

@ -65,6 +65,7 @@
<li><a href="#linux">Basic Linux System Setup</a> </li>
<li><a href="#solaris">Basic Solaris System Setup</a> </li>
<li><a href="#windows">Basic Windows System Setup</a> </li>
<li><a href="#macosx">Basic Mac OS X System Setup</a></li>
<li><a href="#dependencies">Build Dependencies</a>
<ul>
<li><a href="#bootjdk">Bootstrap JDK</a> </li>
@ -230,6 +231,12 @@
<td>Microsoft Visual Studio C++ 2010 Professional Edition</td>
<td>JDK 6u18</td>
</tr>
<tr>
<td>Mac OS X X64 (64-bit)</td>
<td>Mac OS X 10.7.3 "Lion"</td>
<td>XCode 4.1 or later</td>
<td>Java for OS X Lion Update 1</td>
</tr>
</tbody>
</table>
<p>
@ -951,6 +958,36 @@
</blockquote>
<!-- ------------------------------------------------------ -->
<hr>
<h3><a name="macosx">Basic Mac OS X System Setup</a></h3>
<blockquote>
<strong>X64 only:</strong>
The minimum recommended hardware for building
the Mac OS X version is any 64-bit capable Intel processor, at least 2
GB of RAM, and approximately 3 GB of free disk space. You should also
have OS X Lion 10.7.3 installed.
</blockquote>
<!-- ------------------------------------------------------ -->
<h4><a name="macosx_checklist">Basic Mac OS X Check List</a></h4>
<blockquote>
<ol>
<li>
Install <a href="https://developer.apple.com/xcode/">XCode 4.1</a> or newer.
If you install XCode 4.3 or newer, make sure you also install
"Command line tools" found under the preferences pane "Downloads".
</li>
<li>
Install <a href="http://support.apple.com/kb/dl1421" target="_blank">"Java for OS X Lion Update 1"</a>,
set <tt><a href="#ALT_BOOTDIR">ALT_BOOTDIR</a> to <code>`/usr/libexec/java_home -v 1.6`</code></tt>
</li>
<li>
<a href="#importjdk">Optional Import JDK</a>, set
<tt><a href="#ALT_JDK_IMPORT_PATH">ALT_JDK_IMPORT_PATH</a></tt>.
</li>
</ol>
</blockquote>
<!-- ------------------------------------------------------ -->
<hr>
<h3><a name="dependencies">Build Dependencies</a></h3>
<blockquote>
Depending on the platform, the OpenJDK build process has some basic
@ -1194,6 +1231,10 @@
set INCLUDE=%VSINSTALLDIR%\vc\include;%WindowsSdkDir%\include
set LIB=%VSINSTALLDIR%\vc\lib\amd64;%WindowsSdkDir%\lib\x64
</pre>
<strong><a name="llvmgcc">OS X Lion 10.7.3: LLVM GCC</a></strong>
<blockquote>
LLVM GCC is bundled with XCode. The version should be at least 4.2.1.
</blockquote>
</blockquote>
<!-- ------------------------------------------------------ -->
<h4><a name="zip">Zip and Unzip</a></h4>

View File

@ -158,3 +158,6 @@ e45d6b406d5f91ff5256a5c82456ab1e7eb8becd jdk8-b25
e24c5cc8b0f7cc48374eef0f995838fb4823e0eb jdk8-b34
e3d735914edd0a621b16bb85417423f8e6af5d51 jdk8-b35
a5a61f259961a7f46b002e5cc50b4a9bf86927b6 jdk8-b36
83fac66442cf680bb59ec9e3a71cc4729322b595 jdk8-b37
b8cbfb31139f820e5e094ba71449e58159fbe22e jdk8-b38
785af00e2827990f149b32ec37f523dbca3efdd1 jdk8-b39

View File

@ -1,5 +1,5 @@
#
# Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved.
# Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# This code is free software; you can redistribute it and/or modify it
@ -275,7 +275,7 @@ ifeq ($(PLATFORM), bsd)
echo sparc \
;; \
x86_64) \
echo amd64 \
echo x86_64 \
;; \
"Power Macintosh") \
echo ppc \
@ -287,12 +287,13 @@ ifeq ($(PLATFORM), bsd)
ARCH := $(shell $(archExpr) )
ARCH_FAMILY := $(ARCH)
# Darwin x86 builds are i386/amd64 universal.
ifeq ($(SYSTEM_UNAME), Darwin)
ifneq ($(ARCH), ppc)
ARCH=universal
endif
endif
# Darwin builds are currently universal but only include 64-bit
#
# ifeq ($(SYSTEM_UNAME), Darwin)
# ifneq ($(ARCH), ppc)
# ARCH=universal
# endif
# endif
# i586, sparc, and ppc are 32 bit, amd64 and sparc64 are 64
ifneq (,$(findstring $(ARCH), i586 sparc ppc universal))

View File

@ -1,3 +1,28 @@
/*
* Copyright (c) 2001, 2012, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* 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.
*/
package com.sun.corba.se.impl.orbutil ;
import java.lang.reflect.Method;

View File

@ -1,3 +1,27 @@
/*
* Copyright (c) 2004, 2012, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package com.sun.corba.se.impl.presentation.rmi ;

View File

@ -1,7 +1,7 @@
#!/bin/sh
#
# Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
# Copyright (c) 2010, 2012, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# This code is free software; you can redistribute it and/or modify it
@ -26,7 +26,7 @@
#
# Get clones of all nested repositories
sh ./make/scripts/hgforest.sh clone
sh ./make/scripts/hgforest.sh clone $*
# Update all existing repositories to the latest sources
sh ./make/scripts/hgforest.sh pull -u

View File

@ -242,4 +242,9 @@ f284b08835584517c1ca3dd67341f569e763841f jdk8-b34
f621660a297baa48fab9dca28e99d318826e8304 jdk8-b35
dff6e3459210f8dd0430b9b03ccc99280560da30 hs24-b08
50b4400ca1ecb2ac2fde35f5e53ec8f04b86be7f jdk8-b36
bfcf92bfefb82da00f7fdbf0d9273feaa0a9456d jdk8-b37
7d5ec8bf38d1b12e0e09ec381f10976b8beede3b hs24-b09
637c3f5f068f88fb9ec9c5867341cf59fd5ebedc jdk8-b38
73147e6c48813b5fee904aa33f79a77103250ff4 hs24-b10
96a403721094ecdaf6a1f4f52ebd0a82e07df199 jdk8-b39
14b0e07ab9a6fa1662414496b7e07ac8450cf517 hs24-b11

View File

@ -1,5 +1,5 @@
#
# Copyright (c) 2006, 2011, Oracle and/or its affiliates. All rights reserved.
# Copyright (c) 2006, 2012, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# This code is free software; you can redistribute it and/or modify it
@ -31,11 +31,11 @@
#
# Don't put quotes (fail windows build).
HOTSPOT_VM_COPYRIGHT=Copyright 2011
HOTSPOT_VM_COPYRIGHT=Copyright 2012
HS_MAJOR_VER=24
HS_MINOR_VER=0
HS_BUILD_NUMBER=10
HS_BUILD_NUMBER=12
JDK_MAJOR_VER=1
JDK_MINOR_VER=8

View File

@ -102,9 +102,11 @@ CXXFLAGS = \
# a time and date.
vm_version.o: CXXFLAGS += ${JRE_VERSION}
ifndef JAVASE_EMBEDDED
ifndef JAVASE_EMBEDDED
ifneq (${ARCH},arm)
CFLAGS += -DINCLUDE_TRACE
endif
endif
# CFLAGS_WARN holds compiler options to suppress/enable warnings.
CFLAGS += $(CFLAGS_WARN/BYFILE)
@ -153,11 +155,13 @@ SOURCE_PATHS+=$(HS_COMMON_SRC)/os/posix/vm
SOURCE_PATHS+=$(HS_COMMON_SRC)/cpu/$(Platform_arch)/vm
SOURCE_PATHS+=$(HS_COMMON_SRC)/os_cpu/$(Platform_os_arch)/vm
ifndef JAVASE_EMBEDDED
ifndef JAVASE_EMBEDDED
ifneq (${ARCH},arm)
SOURCE_PATHS+=$(shell if [ -d $(HS_ALT_SRC)/share/vm/jfr ]; then \
find $(HS_ALT_SRC)/share/vm/jfr -type d; \
fi)
endif
endif
CORE_PATHS=$(foreach path,$(SOURCE_PATHS),$(call altsrc,$(path)) $(path))
CORE_PATHS+=$(GENERATED)/jvmtifiles

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2000, 2012, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -238,9 +238,12 @@ void LIR_Assembler::emit_string_compare(LIR_Opr left, LIR_Opr right, LIR_Opr dst
Register result = dst->as_register();
{
// Get a pointer to the first character of string0 in tmp0 and get string0.count in str0
// Get a pointer to the first character of string1 in tmp1 and get string1.count in str1
// Also, get string0.count-string1.count in o7 and get the condition code set
// Get a pointer to the first character of string0 in tmp0
// and get string0.length() in str0
// Get a pointer to the first character of string1 in tmp1
// and get string1.length() in str1
// Also, get string0.length()-string1.length() in
// o7 and get the condition code set
// Note: some instructions have been hoisted for better instruction scheduling
Register tmp0 = L0;
@ -248,27 +251,40 @@ void LIR_Assembler::emit_string_compare(LIR_Opr left, LIR_Opr right, LIR_Opr dst
Register tmp2 = L2;
int value_offset = java_lang_String:: value_offset_in_bytes(); // char array
int offset_offset = java_lang_String::offset_offset_in_bytes(); // first character position
int count_offset = java_lang_String:: count_offset_in_bytes();
__ load_heap_oop(str0, value_offset, tmp0);
__ ld(str0, offset_offset, tmp2);
__ add(tmp0, arrayOopDesc::base_offset_in_bytes(T_CHAR), tmp0);
__ ld(str0, count_offset, str0);
__ sll(tmp2, exact_log2(sizeof(jchar)), tmp2);
if (java_lang_String::has_offset_field()) {
int offset_offset = java_lang_String::offset_offset_in_bytes(); // first character position
int count_offset = java_lang_String:: count_offset_in_bytes();
__ load_heap_oop(str0, value_offset, tmp0);
__ ld(str0, offset_offset, tmp2);
__ add(tmp0, arrayOopDesc::base_offset_in_bytes(T_CHAR), tmp0);
__ ld(str0, count_offset, str0);
__ sll(tmp2, exact_log2(sizeof(jchar)), tmp2);
} else {
__ load_heap_oop(str0, value_offset, tmp1);
__ add(tmp1, arrayOopDesc::base_offset_in_bytes(T_CHAR), tmp0);
__ ld(tmp1, arrayOopDesc::length_offset_in_bytes(), str0);
}
// str1 may be null
add_debug_info_for_null_check_here(info);
__ load_heap_oop(str1, value_offset, tmp1);
__ add(tmp0, tmp2, tmp0);
if (java_lang_String::has_offset_field()) {
int offset_offset = java_lang_String::offset_offset_in_bytes(); // first character position
int count_offset = java_lang_String:: count_offset_in_bytes();
__ load_heap_oop(str1, value_offset, tmp1);
__ add(tmp0, tmp2, tmp0);
__ ld(str1, offset_offset, tmp2);
__ add(tmp1, arrayOopDesc::base_offset_in_bytes(T_CHAR), tmp1);
__ ld(str1, count_offset, str1);
__ sll(tmp2, exact_log2(sizeof(jchar)), tmp2);
__ ld(str1, offset_offset, tmp2);
__ add(tmp1, arrayOopDesc::base_offset_in_bytes(T_CHAR), tmp1);
__ ld(str1, count_offset, str1);
__ sll(tmp2, exact_log2(sizeof(jchar)), tmp2);
__ add(tmp1, tmp2, tmp1);
} else {
__ load_heap_oop(str1, value_offset, tmp2);
__ add(tmp2, arrayOopDesc::base_offset_in_bytes(T_CHAR), tmp1);
__ ld(tmp2, arrayOopDesc::length_offset_in_bytes(), str1);
}
__ subcc(str0, str1, O7);
__ add(tmp1, tmp2, tmp1);
}
{
@ -302,7 +318,7 @@ void LIR_Assembler::emit_string_compare(LIR_Opr left, LIR_Opr right, LIR_Opr dst
// Shift base0 and base1 to the end of the arrays, negate limit
__ add(base0, limit, base0);
__ add(base1, limit, base1);
__ neg(limit); // limit = -min{string0.count, strin1.count}
__ neg(limit); // limit = -min{string0.length(), string1.length()}
__ lduh(base0, limit, chr0);
__ bind(Lloop);

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2000, 2012, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -505,19 +505,28 @@ void LIR_Assembler::emit_string_compare(LIR_Opr arg0, LIR_Opr arg1, LIR_Opr dst,
// Get addresses of first characters from both Strings
__ load_heap_oop(rsi, Address(rax, java_lang_String::value_offset_in_bytes()));
__ movptr (rcx, Address(rax, java_lang_String::offset_offset_in_bytes()));
__ lea (rsi, Address(rsi, rcx, Address::times_2, arrayOopDesc::base_offset_in_bytes(T_CHAR)));
if (java_lang_String::has_offset_field()) {
__ movptr (rcx, Address(rax, java_lang_String::offset_offset_in_bytes()));
__ movl (rax, Address(rax, java_lang_String::count_offset_in_bytes()));
__ lea (rsi, Address(rsi, rcx, Address::times_2, arrayOopDesc::base_offset_in_bytes(T_CHAR)));
} else {
__ movl (rax, Address(rsi, arrayOopDesc::length_offset_in_bytes()));
__ lea (rsi, Address(rsi, arrayOopDesc::base_offset_in_bytes(T_CHAR)));
}
// rbx, may be NULL
add_debug_info_for_null_check_here(info);
__ load_heap_oop(rdi, Address(rbx, java_lang_String::value_offset_in_bytes()));
__ movptr (rcx, Address(rbx, java_lang_String::offset_offset_in_bytes()));
__ lea (rdi, Address(rdi, rcx, Address::times_2, arrayOopDesc::base_offset_in_bytes(T_CHAR)));
if (java_lang_String::has_offset_field()) {
__ movptr (rcx, Address(rbx, java_lang_String::offset_offset_in_bytes()));
__ movl (rbx, Address(rbx, java_lang_String::count_offset_in_bytes()));
__ lea (rdi, Address(rdi, rcx, Address::times_2, arrayOopDesc::base_offset_in_bytes(T_CHAR)));
} else {
__ movl (rbx, Address(rdi, arrayOopDesc::length_offset_in_bytes()));
__ lea (rdi, Address(rdi, arrayOopDesc::base_offset_in_bytes(T_CHAR)));
}
// compute minimum length (in rax) and difference of lengths (on top of stack)
__ movl (rbx, Address(rbx, java_lang_String::count_offset_in_bytes()));
__ movl (rax, Address(rax, java_lang_String::count_offset_in_bytes()));
__ mov (rcx, rbx);
__ subptr(rbx, rax); // subtract lengths
__ push (rbx); // result

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -143,7 +143,27 @@ compute_optional_offset(int& dest_offset,
}
int java_lang_String::value_offset = 0;
int java_lang_String::offset_offset = 0;
int java_lang_String::count_offset = 0;
int java_lang_String::hash_offset = 0;
bool java_lang_String::initialized = false;
void java_lang_String::compute_offsets() {
assert(!initialized, "offsets should be initialized only once");
klassOop k = SystemDictionary::String_klass();
compute_offset(value_offset, k, vmSymbols::value_name(), vmSymbols::char_array_signature());
compute_optional_offset(offset_offset, k, vmSymbols::offset_name(), vmSymbols::int_signature());
compute_optional_offset(count_offset, k, vmSymbols::count_name(), vmSymbols::int_signature());
compute_optional_offset(hash_offset, k, vmSymbols::hash_name(), vmSymbols::int_signature());
initialized = true;
}
Handle java_lang_String::basic_create(int length, bool tenured, TRAPS) {
assert(initialized, "Must be initialized");
// Create the String object first, so there's a chance that the String
// and the char array it points to end up in the same cache line.
oop obj;
@ -2837,10 +2857,6 @@ int java_lang_System::err_offset_in_bytes() {
int java_lang_String::value_offset;
int java_lang_String::offset_offset;
int java_lang_String::count_offset;
int java_lang_String::hash_offset;
int java_lang_Class::_klass_offset;
int java_lang_Class::_array_klass_offset;
int java_lang_Class::_resolved_constructor_offset;
@ -3000,12 +3016,6 @@ void JavaClasses::compute_hard_coded_offsets() {
const int x = heapOopSize;
const int header = instanceOopDesc::base_offset_in_bytes();
// Do the String Class
java_lang_String::value_offset = java_lang_String::hc_value_offset * x + header;
java_lang_String::offset_offset = java_lang_String::hc_offset_offset * x + header;
java_lang_String::count_offset = java_lang_String::offset_offset + sizeof (jint);
java_lang_String::hash_offset = java_lang_String::count_offset + sizeof (jint);
// Throwable Class
java_lang_Throwable::backtrace_offset = java_lang_Throwable::hc_backtrace_offset * x + header;
java_lang_Throwable::detailMessage_offset = java_lang_Throwable::hc_detailMessage_offset * x + header;
@ -3200,9 +3210,13 @@ void JavaClasses::check_offsets() {
// java.lang.String
CHECK_OFFSET("java/lang/String", java_lang_String, value, "[C");
CHECK_OFFSET("java/lang/String", java_lang_String, offset, "I");
CHECK_OFFSET("java/lang/String", java_lang_String, count, "I");
CHECK_OFFSET("java/lang/String", java_lang_String, hash, "I");
if (java_lang_String::has_offset_field()) {
CHECK_OFFSET("java/lang/String", java_lang_String, offset, "I");
CHECK_OFFSET("java/lang/String", java_lang_String, count, "I");
}
if (java_lang_String::has_hash_field()) {
CHECK_OFFSET("java/lang/String", java_lang_String, hash, "I");
}
// java.lang.Class

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -52,26 +52,36 @@
class java_lang_String : AllStatic {
private:
enum {
hc_value_offset = 0,
hc_offset_offset = 1
//hc_count_offset = 2 -- not a word-scaled offset
//hc_hash_offset = 3 -- not a word-scaled offset
};
static int value_offset;
static int offset_offset;
static int count_offset;
static int hash_offset;
static bool initialized;
static Handle basic_create(int length, bool tenured, TRAPS);
static Handle basic_create_from_unicode(jchar* unicode, int length, bool tenured, TRAPS);
static void set_value( oop string, typeArrayOop buffer) { string->obj_field_put(value_offset, (oop)buffer); }
static void set_offset(oop string, int offset) { string->int_field_put(offset_offset, offset); }
static void set_count( oop string, int count) { string->int_field_put(count_offset, count); }
static void set_value( oop string, typeArrayOop buffer) {
assert(initialized, "Must be initialized");
string->obj_field_put(value_offset, (oop)buffer);
}
static void set_offset(oop string, int offset) {
assert(initialized, "Must be initialized");
if (offset_offset > 0) {
string->int_field_put(offset_offset, offset);
}
}
static void set_count( oop string, int count) {
assert(initialized, "Must be initialized");
if (count_offset > 0) {
string->int_field_put(count_offset, count);
}
}
public:
static void compute_offsets();
// Instance creation
static Handle create_from_unicode(jchar* unicode, int len, TRAPS);
static Handle create_tenured_from_unicode(jchar* unicode, int len, TRAPS);
@ -82,23 +92,61 @@ class java_lang_String : AllStatic {
static Handle create_from_platform_dependent_str(const char* str, TRAPS);
static Handle char_converter(Handle java_string, jchar from_char, jchar to_char, TRAPS);
static int value_offset_in_bytes() { return value_offset; }
static int count_offset_in_bytes() { return count_offset; }
static int offset_offset_in_bytes() { return offset_offset; }
static int hash_offset_in_bytes() { return hash_offset; }
static bool has_offset_field() {
assert(initialized, "Must be initialized");
return (offset_offset > 0);
}
static bool has_count_field() {
assert(initialized, "Must be initialized");
return (count_offset > 0);
}
static bool has_hash_field() {
assert(initialized, "Must be initialized");
return (hash_offset > 0);
}
static int value_offset_in_bytes() {
assert(initialized && (value_offset > 0), "Must be initialized");
return value_offset;
}
static int count_offset_in_bytes() {
assert(initialized && (count_offset > 0), "Must be initialized");
return count_offset;
}
static int offset_offset_in_bytes() {
assert(initialized && (offset_offset > 0), "Must be initialized");
return offset_offset;
}
static int hash_offset_in_bytes() {
assert(initialized && (hash_offset > 0), "Must be initialized");
return hash_offset;
}
// Accessors
static typeArrayOop value(oop java_string) {
assert(initialized && (value_offset > 0), "Must be initialized");
assert(is_instance(java_string), "must be java_string");
return (typeArrayOop) java_string->obj_field(value_offset);
}
static int offset(oop java_string) {
assert(initialized, "Must be initialized");
assert(is_instance(java_string), "must be java_string");
return java_string->int_field(offset_offset);
if (offset_offset > 0) {
return java_string->int_field(offset_offset);
} else {
return 0;
}
}
static int length(oop java_string) {
assert(initialized, "Must be initialized");
assert(is_instance(java_string), "must be java_string");
return java_string->int_field(count_offset);
if (count_offset > 0) {
return java_string->int_field(count_offset);
} else {
return ((typeArrayOop)java_string->obj_field(value_offset))->length();
}
}
static int utf8_length(oop java_string);

View File

@ -1971,6 +1971,9 @@ void SystemDictionary::initialize_preloaded_classes(TRAPS) {
// first do Object, String, Class
initialize_wk_klasses_through(WK_KLASS_ENUM_NAME(Class_klass), scan, CHECK);
// Calculate offsets for String and Class classes since they are loaded and
// can be used after this point.
java_lang_String::compute_offsets();
java_lang_Class::compute_offsets();
// Fixup mirrors for classes loaded before java.lang.Class.

View File

@ -340,6 +340,9 @@
template(park_event_name, "nativeParkEventPointer") \
template(cache_field_name, "cache") \
template(value_name, "value") \
template(offset_name, "offset") \
template(count_name, "count") \
template(hash_name, "hash") \
template(frontCacheEnabled_name, "frontCacheEnabled") \
template(stringCacheEnabled_name, "stringCacheEnabled") \
template(numberOfLeadingZeros_name, "numberOfLeadingZeros") \

View File

@ -6332,10 +6332,10 @@ void CMSCollector::reset(bool asynch) {
)
}
void CMSCollector::do_CMS_operation(CMS_op_type op) {
void CMSCollector::do_CMS_operation(CMS_op_type op, GCCause::Cause gc_cause) {
gclog_or_tty->date_stamp(PrintGC && PrintGCDateStamps);
TraceCPUTime tcpu(PrintGCDetails, true, gclog_or_tty);
TraceTime t("GC", PrintGC, !PrintGCDetails, gclog_or_tty);
TraceTime t(GCCauseString("GC", gc_cause), PrintGC, !PrintGCDetails, gclog_or_tty);
TraceCollectorStats tcs(counters());
switch (op) {

View File

@ -717,7 +717,7 @@ class CMSCollector: public CHeapObj {
CMS_op_checkpointRootsFinal
};
void do_CMS_operation(CMS_op_type op);
void do_CMS_operation(CMS_op_type op, GCCause::Cause gc_cause);
bool stop_world_and_do(CMS_op_type op);
OopTaskQueueSet* task_queues() { return _task_queues; }

View File

@ -146,7 +146,7 @@ void VM_CMS_Initial_Mark::doit() {
VM_CMS_Operation::verify_before_gc();
IsGCActiveMark x; // stop-world GC active
_collector->do_CMS_operation(CMSCollector::CMS_op_checkpointRootsInitial);
_collector->do_CMS_operation(CMSCollector::CMS_op_checkpointRootsInitial, gch->gc_cause());
VM_CMS_Operation::verify_after_gc();
#ifndef USDT2
@ -178,7 +178,7 @@ void VM_CMS_Final_Remark::doit() {
VM_CMS_Operation::verify_before_gc();
IsGCActiveMark x; // stop-world GC active
_collector->do_CMS_operation(CMSCollector::CMS_op_checkpointRootsFinal);
_collector->do_CMS_operation(CMSCollector::CMS_op_checkpointRootsFinal, gch->gc_cause());
VM_CMS_Operation::verify_after_gc();
#ifndef USDT2

View File

@ -1252,10 +1252,7 @@ bool G1CollectedHeap::do_collection(bool explicit_gc,
gclog_or_tty->date_stamp(G1Log::fine() && PrintGCDateStamps);
TraceCPUTime tcpu(G1Log::finer(), true, gclog_or_tty);
char verbose_str[128];
sprintf(verbose_str, "Full GC (%s)", GCCause::to_string(gc_cause()));
TraceTime t(verbose_str, G1Log::fine(), true, gclog_or_tty);
TraceTime t(GCCauseString("Full GC", gc_cause()), G1Log::fine(), true, gclog_or_tty);
TraceCollectorStats tcs(g1mm()->full_collection_counters());
TraceMemoryManagerStats tms(true /* fullGC */, gc_cause());
@ -3600,12 +3597,10 @@ G1CollectedHeap::do_collection_pause_at_safepoint(double target_pause_time_ms) {
gclog_or_tty->date_stamp(G1Log::fine() && PrintGCDateStamps);
TraceCPUTime tcpu(G1Log::finer(), true, gclog_or_tty);
char verbose_str[128];
sprintf(verbose_str, "GC pause (%s) (%s)%s",
GCCause::to_string(gc_cause()),
g1_policy()->gcs_are_young() ? "young" : "mixed",
g1_policy()->during_initial_mark_pause() ? " (initial-mark)" : "");
TraceTime t(verbose_str, G1Log::fine() && !G1Log::finer(), true, gclog_or_tty);
GCCauseString gc_cause_str = GCCauseString("GC pause", gc_cause())
.append(g1_policy()->gcs_are_young() ? " (young)" : " (mixed)")
.append(g1_policy()->during_initial_mark_pause() ? " (initial-mark)" : "");
TraceTime t(gc_cause_str, G1Log::fine() && !G1Log::finer(), true, gclog_or_tty);
TraceCollectorStats tcs(g1mm()->incremental_collection_counters());
TraceMemoryManagerStats tms(false /* fullGC */, gc_cause());
@ -5502,7 +5497,7 @@ void G1CollectedHeap::evacuate_collection_set() {
if (evacuation_failed()) {
remove_self_forwarding_pointers();
if (G1Log::finer()) {
gclog_or_tty->print(" (to-space overflow)");
gclog_or_tty->print(" (to-space exhausted)");
} else if (G1Log::fine()) {
gclog_or_tty->print("--");
}

View File

@ -886,9 +886,8 @@ void G1CollectorPolicy::record_collection_pause_start(double start_time_sec,
size_t start_used) {
if (G1Log::finer()) {
gclog_or_tty->stamp(PrintGCTimeStamps);
gclog_or_tty->print("[GC pause (%s) (%s)",
GCCause::to_string(_g1->gc_cause()),
gcs_are_young() ? "young" : "mixed");
gclog_or_tty->print("[%s", (const char*)GCCauseString("GC pause", _g1->gc_cause())
.append(gcs_are_young() ? " (young)" : " (mixed)"));
}
// We only need to do this here as the policy will only be applied
@ -1010,7 +1009,8 @@ T sum_of(T* sum_arr, int start, int n, int N) {
void G1CollectorPolicy::print_par_stats(int level,
const char* str,
double* data) {
double* data,
bool showDecimals) {
double min = data[0], max = data[0];
double total = 0.0;
LineBuffer buf(level);
@ -1023,7 +1023,11 @@ void G1CollectorPolicy::print_par_stats(int level,
max = val;
total += val;
if (G1Log::finest()) {
buf.append(" %.1lf", val);
if (showDecimals) {
buf.append(" %.1lf", val);
} else {
buf.append(" %d", (int)val);
}
}
}
@ -1031,36 +1035,26 @@ void G1CollectorPolicy::print_par_stats(int level,
buf.append_and_print_cr("");
}
double avg = total / (double) no_of_gc_threads();
buf.append_and_print_cr(" Avg: %.1lf Min: %.1lf Max: %.1lf Diff: %.1lf]",
avg, min, max, max - min);
}
void G1CollectorPolicy::print_par_sizes(int level,
const char* str,
double* data) {
double min = data[0], max = data[0];
double total = 0.0;
LineBuffer buf(level);
buf.append("[%s :", str);
for (uint i = 0; i < no_of_gc_threads(); ++i) {
double val = data[i];
if (val < min)
min = val;
if (val > max)
max = val;
total += val;
buf.append(" %d", (int) val);
if (showDecimals) {
buf.append_and_print_cr(" Min: %.1lf, Avg: %.1lf, Max: %.1lf, Diff: %.1lf, Sum: %.1lf]",
min, avg, max, max - min, total);
} else {
buf.append_and_print_cr(" Min: %d, Avg: %d, Max: %d, Diff: %d, Sum: %d]",
(int)min, (int)avg, (int)max, (int)max - (int)min, (int)total);
}
buf.append_and_print_cr("");
double avg = total / (double) no_of_gc_threads();
buf.append_and_print_cr(" Sum: %d, Avg: %d, Min: %d, Max: %d, Diff: %d]",
(int)total, (int)avg, (int)min, (int)max, (int)max - (int)min);
}
void G1CollectorPolicy::print_stats(int level,
const char* str,
double value) {
LineBuffer(level).append_and_print_cr("[%s: %5.1lf ms]", str, value);
LineBuffer(level).append_and_print_cr("[%s: %.1lf ms]", str, value);
}
void G1CollectorPolicy::print_stats(int level,
const char* str,
double value,
int workers) {
LineBuffer(level).append_and_print_cr("[%s: %.1lf ms, GC Workers: %d]", str, value, workers);
}
void G1CollectorPolicy::print_stats(int level,
@ -1373,7 +1367,7 @@ void G1CollectorPolicy::record_collection_pause_end(int no_of_gc_threads) {
print_stats(1, "Root Region Scan Waiting", _root_region_scan_wait_time_ms);
}
if (parallel) {
print_stats(1, "Parallel Time", _cur_collection_par_time_ms);
print_stats(1, "Parallel Time", _cur_collection_par_time_ms, no_of_gc_threads);
print_par_stats(2, "GC Worker Start", _par_last_gc_worker_start_times_ms);
print_par_stats(2, "Ext Root Scanning", _par_last_ext_root_scan_times_ms);
if (print_marking_info) {
@ -1381,13 +1375,15 @@ void G1CollectorPolicy::record_collection_pause_end(int no_of_gc_threads) {
}
print_par_stats(2, "Update RS", _par_last_update_rs_times_ms);
if (G1Log::finest()) {
print_par_sizes(3, "Processed Buffers", _par_last_update_rs_processed_buffers);
print_par_stats(3, "Processed Buffers", _par_last_update_rs_processed_buffers,
false /* showDecimals */);
}
print_par_stats(2, "Scan RS", _par_last_scan_rs_times_ms);
print_par_stats(2, "Object Copy", _par_last_obj_copy_times_ms);
print_par_stats(2, "Termination", _par_last_termination_times_ms);
if (G1Log::finest()) {
print_par_sizes(3, "Termination Attempts", _par_last_termination_attempts);
print_par_stats(3, "Termination Attempts", _par_last_termination_attempts,
false /* showDecimals */);
}
for (int i = 0; i < _parallel_gc_threads; i++) {
@ -1601,9 +1597,9 @@ void G1CollectorPolicy::record_collection_pause_end(int no_of_gc_threads) {
_collectionSetChooser->verify();
}
#define EXT_SIZE_FORMAT "%d%s"
#define EXT_SIZE_FORMAT "%.1f%s"
#define EXT_SIZE_PARAMS(bytes) \
byte_size_in_proper_unit((bytes)), \
byte_size_in_proper_unit((double)(bytes)), \
proper_unit_for_byte_size((bytes))
void G1CollectorPolicy::print_heap_transition() {

View File

@ -552,10 +552,10 @@ public:
private:
void print_stats(int level, const char* str, double value);
void print_stats(int level, const char* str, double value, int workers);
void print_stats(int level, const char* str, int value);
void print_par_stats(int level, const char* str, double* data);
void print_par_sizes(int level, const char* str, double* data);
void print_par_stats(int level, const char* str, double* data, bool showDecimals = true);
void check_other_times(int level,
NumberSeq* other_times_ms,

View File

@ -42,6 +42,7 @@ VM_G1CollectForAllocation::VM_G1CollectForAllocation(
void VM_G1CollectForAllocation::doit() {
G1CollectedHeap* g1h = G1CollectedHeap::heap();
GCCauseSetter x(g1h, _gc_cause);
_result = g1h->satisfy_failed_allocation(_word_size, &_pause_succeeded);
assert(_result == NULL || _pause_succeeded,
"if we get back a result, the pause should have succeeded");

View File

@ -916,7 +916,7 @@ void ParNewGeneration::collect(bool full,
size_policy->minor_collection_begin();
}
TraceTime t1("GC", PrintGC && !PrintGCDetails, true, gclog_or_tty);
TraceTime t1(GCCauseString("GC", gch->gc_cause()), PrintGC && !PrintGCDetails, true, gclog_or_tty);
// Capture heap used before collection (for printing).
size_t gch_prev_used = gch->used();

View File

@ -160,16 +160,10 @@ bool PSMarkSweep::invoke_no_policy(bool clear_all_softrefs) {
{
HandleMark hm;
const bool is_system_gc = gc_cause == GCCause::_java_lang_system_gc;
// This is useful for debugging but don't change the output the
// the customer sees.
const char* gc_cause_str = "Full GC";
if (is_system_gc && PrintGCDetails) {
gc_cause_str = "Full GC (System)";
}
gclog_or_tty->date_stamp(PrintGC && PrintGCDateStamps);
TraceCPUTime tcpu(PrintGCDetails, true, gclog_or_tty);
TraceTime t1(gc_cause_str, PrintGC, !PrintGCDetails, gclog_or_tty);
TraceTime t1(GCCauseString("Full GC", gc_cause), PrintGC, !PrintGCDetails, gclog_or_tty);
TraceCollectorStats tcs(counters());
TraceMemoryManagerStats tms(true /* Full GC */,gc_cause);

View File

@ -2047,17 +2047,9 @@ bool PSParallelCompact::invoke_no_policy(bool maximum_heap_compaction) {
gc_task_manager()->task_idle_workers();
heap->set_par_threads(gc_task_manager()->active_workers());
const bool is_system_gc = gc_cause == GCCause::_java_lang_system_gc;
// This is useful for debugging but don't change the output the
// the customer sees.
const char* gc_cause_str = "Full GC";
if (is_system_gc && PrintGCDetails) {
gc_cause_str = "Full GC (System)";
}
gclog_or_tty->date_stamp(PrintGC && PrintGCDateStamps);
TraceCPUTime tcpu(PrintGCDetails, true, gclog_or_tty);
TraceTime t1(gc_cause_str, PrintGC, !PrintGCDetails, gclog_or_tty);
TraceTime t1(GCCauseString("Full GC", gc_cause), PrintGC, !PrintGCDetails, gclog_or_tty);
TraceCollectorStats tcs(counters());
TraceMemoryManagerStats tms(true /* Full GC */,gc_cause);
@ -2090,7 +2082,8 @@ bool PSParallelCompact::invoke_no_policy(bool maximum_heap_compaction) {
}
#endif // #ifndef PRODUCT
bool max_on_system_gc = UseMaximumCompactionOnSystemGC && is_system_gc;
bool max_on_system_gc = UseMaximumCompactionOnSystemGC
&& gc_cause == GCCause::_java_lang_system_gc;
summary_phase(vmthread_cm, maximum_heap_compaction || max_on_system_gc);
COMPILER2_PRESENT(assert(DerivedPointerTable::is_active(), "Sanity"));

View File

@ -325,7 +325,7 @@ bool PSScavenge::invoke_no_policy() {
gclog_or_tty->date_stamp(PrintGC && PrintGCDateStamps);
TraceCPUTime tcpu(PrintGCDetails, true, gclog_or_tty);
TraceTime t1("GC", PrintGC, !PrintGCDetails, gclog_or_tty);
TraceTime t1(GCCauseString("GC", gc_cause), PrintGC, !PrintGCDetails, gclog_or_tty);
TraceCollectorStats tcs(counters());
TraceMemoryManagerStats tms(false /* not full GC */,gc_cause);

View File

@ -31,9 +31,15 @@ float AdaptiveWeightedAverage::compute_adaptive_average(float new_sample,
float average) {
// We smooth the samples by not using weight() directly until we've
// had enough data to make it meaningful. We'd like the first weight
// used to be 1, the second to be 1/2, etc until we have 100/weight
// samples.
unsigned count_weight = 100/count();
// used to be 1, the second to be 1/2, etc until we have
// OLD_THRESHOLD/weight samples.
unsigned count_weight = 0;
// Avoid division by zero if the counter wraps (7158457)
if (!is_old()) {
count_weight = OLD_THRESHOLD/count();
}
unsigned adaptive_weight = (MAX2(weight(), count_weight));
float new_avg = exp_avg(average, new_sample, adaptive_weight);
@ -43,8 +49,6 @@ float AdaptiveWeightedAverage::compute_adaptive_average(float new_sample,
void AdaptiveWeightedAverage::sample(float new_sample) {
increment_count();
assert(count() != 0,
"Wraparound -- history would be incorrectly discarded");
// Compute the new weighted average
float new_avg = compute_adaptive_average(new_sample, average());

View File

@ -50,11 +50,20 @@ class AdaptiveWeightedAverage : public CHeapObj {
unsigned _weight; // The weight used to smooth the averages
// A higher weight favors the most
// recent data.
bool _is_old; // Has enough historical data
const static unsigned OLD_THRESHOLD = 100;
protected:
float _last_sample; // The last value sampled.
void increment_count() { _sample_count++; }
void increment_count() {
_sample_count++;
if (!_is_old && _sample_count > OLD_THRESHOLD) {
_is_old = true;
}
}
void set_average(float avg) { _average = avg; }
// Helper function, computes an adaptive weighted average
@ -64,13 +73,15 @@ class AdaptiveWeightedAverage : public CHeapObj {
public:
// Input weight must be between 0 and 100
AdaptiveWeightedAverage(unsigned weight, float avg = 0.0) :
_average(avg), _sample_count(0), _weight(weight), _last_sample(0.0) {
_average(avg), _sample_count(0), _weight(weight), _last_sample(0.0),
_is_old(false) {
}
void clear() {
_average = 0;
_sample_count = 0;
_last_sample = 0;
_is_old = false;
}
// Useful for modifying static structures after startup.
@ -84,7 +95,8 @@ class AdaptiveWeightedAverage : public CHeapObj {
float average() const { return _average; }
unsigned weight() const { return _weight; }
unsigned count() const { return _sample_count; }
float last_sample() const { return _last_sample; }
float last_sample() const { return _last_sample; }
bool is_old() const { return _is_old; }
// Update data with a new sample.
void sample(float new_sample);

View File

@ -88,4 +88,36 @@ class GCCause : public AllStatic {
static const char* to_string(GCCause::Cause cause);
};
// Helper class for doing logging that includes the GC Cause
// as a string.
class GCCauseString : StackObj {
private:
static const int _length = 128;
char _buffer[_length];
int _position;
public:
GCCauseString(const char* prefix, GCCause::Cause cause) {
if (PrintGCCause) {
_position = jio_snprintf(_buffer, _length, "%s (%s)", prefix, GCCause::to_string(cause));
} else {
_position = jio_snprintf(_buffer, _length, "%s", prefix);
}
assert(_position >= 0 && _position <= _length,
err_msg("Need to increase the buffer size in GCCauseString? %d", _position));
}
GCCauseString& append(const char* str) {
int res = jio_snprintf(_buffer + _position, _length - _position, "%s", str);
_position += res;
assert(res >= 0 && _position <= _length,
err_msg("Need to increase the buffer size in GCCauseString? %d", res));
return *this;
}
operator const char*() {
return _buffer;
}
};
#endif // SHARE_VM_GC_INTERFACE_GCCAUSE_HPP

View File

@ -548,7 +548,7 @@ void DefNewGeneration::collect(bool full,
init_assuming_no_promotion_failure();
TraceTime t1("GC", PrintGC && !PrintGCDetails, true, gclog_or_tty);
TraceTime t1(GCCauseString("GC", gch->gc_cause()), PrintGC && !PrintGCDetails, true, gclog_or_tty);
// Capture heap used before collection (for printing).
size_t gch_prev_used = gch->used();

View File

@ -78,8 +78,8 @@ public:
void do_oop(oop* p) {
if (p != NULL) {
oop obj = *p;
if (obj->klass() == SystemDictionary::String_klass()) {
if (obj->klass() == SystemDictionary::String_klass() &&
java_lang_String::has_hash_field()) {
int hash = java_lang_String::hash_string(obj);
obj->int_field_put(hash_offset, hash);
}

View File

@ -480,26 +480,15 @@ void GenCollectedHeap::do_collection(bool full,
const size_t perm_prev_used = perm_gen()->used();
print_heap_before_gc();
if (Verbose) {
gclog_or_tty->print_cr("GC Cause: %s", GCCause::to_string(gc_cause()));
}
{
FlagSetting fl(_is_gc_active, true);
bool complete = full && (max_level == (n_gens()-1));
const char* gc_cause_str = "GC ";
if (complete) {
GCCause::Cause cause = gc_cause();
if (cause == GCCause::_java_lang_system_gc) {
gc_cause_str = "Full GC (System) ";
} else {
gc_cause_str = "Full GC ";
}
}
const char* gc_cause_prefix = complete ? "Full GC" : "GC";
gclog_or_tty->date_stamp(PrintGC && PrintGCDateStamps);
TraceCPUTime tcpu(PrintGCDetails, true, gclog_or_tty);
TraceTime t(gc_cause_str, PrintGCDetails, false, gclog_or_tty);
TraceTime t(GCCauseString(gc_cause_prefix, gc_cause()), PrintGCDetails, false, gclog_or_tty);
gc_prologue(complete);
increment_total_collections(complete);

View File

@ -76,7 +76,7 @@ void GenMarkSweep::invoke_at_safepoint(int level, ReferenceProcessor* rp,
_ref_processor = rp;
rp->setup_policy(clear_all_softrefs);
TraceTime t1("Full GC", PrintGC && !PrintGCDetails, true, gclog_or_tty);
TraceTime t1(GCCauseString("Full GC", gch->gc_cause()), PrintGC && !PrintGCDetails, true, gclog_or_tty);
// When collecting the permanent generation methodOops may be moving,
// so we either have to flush all bcp data or convert it into bci.

View File

@ -880,10 +880,17 @@ class ContiguousSpace: public CompactibleSpace {
void object_iterate_mem(MemRegion mr, UpwardsObjectClosure* cl);
// iterates on objects up to the safe limit
HeapWord* object_iterate_careful(ObjectClosureCareful* cl);
inline HeapWord* concurrent_iteration_safe_limit();
HeapWord* concurrent_iteration_safe_limit() {
assert(_concurrent_iteration_safe_limit <= top(),
"_concurrent_iteration_safe_limit update missed");
return _concurrent_iteration_safe_limit;
}
// changes the safe limit, all objects from bottom() to the new
// limit should be properly initialized
inline void set_concurrent_iteration_safe_limit(HeapWord* new_limit);
void set_concurrent_iteration_safe_limit(HeapWord* new_limit) {
assert(new_limit <= top(), "uninitialized objects in the safe range");
_concurrent_iteration_safe_limit = new_limit;
}
#ifndef SERIALGC
// In support of parallel oop_iterate.

View File

@ -67,17 +67,4 @@ OffsetTableContigSpace::block_start_const(const void* p) const {
return _offsets.block_start(p);
}
inline HeapWord* ContiguousSpace::concurrent_iteration_safe_limit()
{
assert(_concurrent_iteration_safe_limit <= top(),
"_concurrent_iteration_safe_limit update missed");
return _concurrent_iteration_safe_limit;
}
inline void ContiguousSpace::set_concurrent_iteration_safe_limit(HeapWord* new_limit)
{
assert(new_limit <= top(), "uninitialized objects in the safe range");
_concurrent_iteration_safe_limit = new_limit;
}
#endif // SHARE_VM_MEMORY_SPACE_INLINE_HPP

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2001, 2011, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2001, 2012, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -3748,3 +3748,81 @@ void GraphKit::g1_write_barrier_post(Node* oop_store,
final_sync(ideal);
}
#undef __
Node* GraphKit::load_String_offset(Node* ctrl, Node* str) {
if (java_lang_String::has_offset_field()) {
int offset_offset = java_lang_String::offset_offset_in_bytes();
const TypeInstPtr* string_type = TypeInstPtr::make(TypePtr::NotNull, C->env()->String_klass(),
false, NULL, 0);
const TypePtr* offset_field_type = string_type->add_offset(offset_offset);
int offset_field_idx = C->get_alias_index(offset_field_type);
return make_load(ctrl,
basic_plus_adr(str, str, offset_offset),
TypeInt::INT, T_INT, offset_field_idx);
} else {
return intcon(0);
}
}
Node* GraphKit::load_String_length(Node* ctrl, Node* str) {
if (java_lang_String::has_count_field()) {
int count_offset = java_lang_String::count_offset_in_bytes();
const TypeInstPtr* string_type = TypeInstPtr::make(TypePtr::NotNull, C->env()->String_klass(),
false, NULL, 0);
const TypePtr* count_field_type = string_type->add_offset(count_offset);
int count_field_idx = C->get_alias_index(count_field_type);
return make_load(ctrl,
basic_plus_adr(str, str, count_offset),
TypeInt::INT, T_INT, count_field_idx);
} else {
return load_array_length(load_String_value(ctrl, str));
}
}
Node* GraphKit::load_String_value(Node* ctrl, Node* str) {
int value_offset = java_lang_String::value_offset_in_bytes();
const TypeInstPtr* string_type = TypeInstPtr::make(TypePtr::NotNull, C->env()->String_klass(),
false, NULL, 0);
const TypePtr* value_field_type = string_type->add_offset(value_offset);
const TypeAryPtr* value_type = TypeAryPtr::make(TypePtr::NotNull,
TypeAry::make(TypeInt::CHAR,TypeInt::POS),
ciTypeArrayKlass::make(T_CHAR), true, 0);
int value_field_idx = C->get_alias_index(value_field_type);
return make_load(ctrl, basic_plus_adr(str, str, value_offset),
value_type, T_OBJECT, value_field_idx);
}
void GraphKit::store_String_offset(Node* ctrl, Node* str, Node* value) {
int offset_offset = java_lang_String::offset_offset_in_bytes();
const TypeInstPtr* string_type = TypeInstPtr::make(TypePtr::NotNull, C->env()->String_klass(),
false, NULL, 0);
const TypePtr* offset_field_type = string_type->add_offset(offset_offset);
int offset_field_idx = C->get_alias_index(offset_field_type);
store_to_memory(ctrl, basic_plus_adr(str, offset_offset),
value, T_INT, offset_field_idx);
}
void GraphKit::store_String_value(Node* ctrl, Node* str, Node* value) {
int value_offset = java_lang_String::value_offset_in_bytes();
const TypeInstPtr* string_type = TypeInstPtr::make(TypePtr::NotNull, C->env()->String_klass(),
false, NULL, 0);
const TypePtr* value_field_type = string_type->add_offset(value_offset);
const TypeAryPtr* value_type = TypeAryPtr::make(TypePtr::NotNull,
TypeAry::make(TypeInt::CHAR,TypeInt::POS),
ciTypeArrayKlass::make(T_CHAR), true, 0);
int value_field_idx = C->get_alias_index(value_field_type);
store_to_memory(ctrl, basic_plus_adr(str, value_offset),
value, T_OBJECT, value_field_idx);
}
void GraphKit::store_String_length(Node* ctrl, Node* str, Node* value) {
int count_offset = java_lang_String::count_offset_in_bytes();
const TypeInstPtr* string_type = TypeInstPtr::make(TypePtr::NotNull, C->env()->String_klass(),
false, NULL, 0);
const TypePtr* count_field_type = string_type->add_offset(count_offset);
int count_field_idx = C->get_alias_index(count_field_type);
store_to_memory(ctrl, basic_plus_adr(str, count_offset),
value, T_INT, count_field_idx);
}

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2001, 2011, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2001, 2012, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -781,6 +781,14 @@ class GraphKit : public Phase {
Node* new_array(Node* klass_node, Node* count_val, int nargs,
Node* *return_size_val = NULL);
// java.lang.String helpers
Node* load_String_offset(Node* ctrl, Node* str);
Node* load_String_length(Node* ctrl, Node* str);
Node* load_String_value(Node* ctrl, Node* str);
void store_String_offset(Node* ctrl, Node* str, Node* value);
void store_String_length(Node* ctrl, Node* str, Node* value);
void store_String_value(Node* ctrl, Node* str, Node* value);
// Handy for making control flow
IfNode* create_and_map_if(Node* ctrl, Node* tst, float prob, float cnt) {
IfNode* iff = new (C, 2) IfNode(ctrl, tst, prob, cnt);// New IfNode's

View File

@ -147,7 +147,8 @@ class LibraryCallKit : public GraphKit {
return generate_method_call(method_id, true, false);
}
Node* make_string_method_node(int opcode, Node* str1, Node* cnt1, Node* str2, Node* cnt2);
Node* make_string_method_node(int opcode, Node* str1_start, Node* cnt1, Node* str2_start, Node* cnt2);
Node* make_string_method_node(int opcode, Node* str1, Node* str2);
bool inline_string_compareTo();
bool inline_string_indexOf();
Node* string_indexOf(Node* string_object, ciTypeArray* target_array, jint offset, jint cache_i, jint md2_i);
@ -873,48 +874,76 @@ Node* LibraryCallKit::generate_current_thread(Node* &tls_output) {
//------------------------------make_string_method_node------------------------
// Helper method for String intrinsic finctions.
Node* LibraryCallKit::make_string_method_node(int opcode, Node* str1, Node* cnt1, Node* str2, Node* cnt2) {
const int value_offset = java_lang_String::value_offset_in_bytes();
const int count_offset = java_lang_String::count_offset_in_bytes();
const int offset_offset = java_lang_String::offset_offset_in_bytes();
// Helper method for String intrinsic functions. This version is called
// with str1 and str2 pointing to String object nodes.
//
Node* LibraryCallKit::make_string_method_node(int opcode, Node* str1, Node* str2) {
Node* no_ctrl = NULL;
ciInstanceKlass* klass = env()->String_klass();
const TypeOopPtr* string_type = TypeOopPtr::make_from_klass(klass);
const TypeAryPtr* value_type =
TypeAryPtr::make(TypePtr::NotNull,
TypeAry::make(TypeInt::CHAR,TypeInt::POS),
ciTypeArrayKlass::make(T_CHAR), true, 0);
// Get start addr of string and substring
Node* str1_valuea = basic_plus_adr(str1, str1, value_offset);
Node* str1_value = make_load(no_ctrl, str1_valuea, value_type, T_OBJECT, string_type->add_offset(value_offset));
Node* str1_offseta = basic_plus_adr(str1, str1, offset_offset);
Node* str1_offset = make_load(no_ctrl, str1_offseta, TypeInt::INT, T_INT, string_type->add_offset(offset_offset));
// Get start addr of string
Node* str1_value = load_String_value(no_ctrl, str1);
Node* str1_offset = load_String_offset(no_ctrl, str1);
Node* str1_start = array_element_address(str1_value, str1_offset, T_CHAR);
Node* str2_valuea = basic_plus_adr(str2, str2, value_offset);
Node* str2_value = make_load(no_ctrl, str2_valuea, value_type, T_OBJECT, string_type->add_offset(value_offset));
Node* str2_offseta = basic_plus_adr(str2, str2, offset_offset);
Node* str2_offset = make_load(no_ctrl, str2_offseta, TypeInt::INT, T_INT, string_type->add_offset(offset_offset));
// Get length of string 1
Node* str1_len = load_String_length(no_ctrl, str1);
Node* str2_value = load_String_value(no_ctrl, str2);
Node* str2_offset = load_String_offset(no_ctrl, str2);
Node* str2_start = array_element_address(str2_value, str2_offset, T_CHAR);
Node* str2_len = NULL;
Node* result = NULL;
switch (opcode) {
case Op_StrIndexOf:
// Get length of string 2
str2_len = load_String_length(no_ctrl, str2);
result = new (C, 6) StrIndexOfNode(control(), memory(TypeAryPtr::CHARS),
str1_start, str1_len, str2_start, str2_len);
break;
case Op_StrComp:
// Get length of string 2
str2_len = load_String_length(no_ctrl, str2);
result = new (C, 6) StrCompNode(control(), memory(TypeAryPtr::CHARS),
str1_start, str1_len, str2_start, str2_len);
break;
case Op_StrEquals:
result = new (C, 5) StrEqualsNode(control(), memory(TypeAryPtr::CHARS),
str1_start, str2_start, str1_len);
break;
default:
ShouldNotReachHere();
return NULL;
}
// All these intrinsics have checks.
C->set_has_split_ifs(true); // Has chance for split-if optimization
return _gvn.transform(result);
}
// Helper method for String intrinsic functions. This version is called
// with str1 and str2 pointing to char[] nodes, with cnt1 and cnt2 pointing
// to Int nodes containing the lenghts of str1 and str2.
//
Node* LibraryCallKit::make_string_method_node(int opcode, Node* str1_start, Node* cnt1, Node* str2_start, Node* cnt2) {
Node* result = NULL;
switch (opcode) {
case Op_StrIndexOf:
result = new (C, 6) StrIndexOfNode(control(), memory(TypeAryPtr::CHARS),
str1_start, cnt1, str2_start, cnt2);
str1_start, cnt1, str2_start, cnt2);
break;
case Op_StrComp:
result = new (C, 6) StrCompNode(control(), memory(TypeAryPtr::CHARS),
str1_start, cnt1, str2_start, cnt2);
str1_start, cnt1, str2_start, cnt2);
break;
case Op_StrEquals:
result = new (C, 5) StrEqualsNode(control(), memory(TypeAryPtr::CHARS),
str1_start, str2_start, cnt1);
str1_start, str2_start, cnt1);
break;
default:
ShouldNotReachHere();
@ -932,10 +961,6 @@ bool LibraryCallKit::inline_string_compareTo() {
if (!Matcher::has_match_rule(Op_StrComp)) return false;
const int value_offset = java_lang_String::value_offset_in_bytes();
const int count_offset = java_lang_String::count_offset_in_bytes();
const int offset_offset = java_lang_String::offset_offset_in_bytes();
_sp += 2;
Node *argument = pop(); // pop non-receiver first: it was pushed second
Node *receiver = pop();
@ -952,18 +977,7 @@ bool LibraryCallKit::inline_string_compareTo() {
return true;
}
ciInstanceKlass* klass = env()->String_klass();
const TypeOopPtr* string_type = TypeOopPtr::make_from_klass(klass);
Node* no_ctrl = NULL;
// Get counts for string and argument
Node* receiver_cnta = basic_plus_adr(receiver, receiver, count_offset);
Node* receiver_cnt = make_load(no_ctrl, receiver_cnta, TypeInt::INT, T_INT, string_type->add_offset(count_offset));
Node* argument_cnta = basic_plus_adr(argument, argument, count_offset);
Node* argument_cnt = make_load(no_ctrl, argument_cnta, TypeInt::INT, T_INT, string_type->add_offset(count_offset));
Node* compare = make_string_method_node(Op_StrComp, receiver, receiver_cnt, argument, argument_cnt);
Node* compare = make_string_method_node(Op_StrComp, receiver, argument);
push(compare);
return true;
}
@ -973,10 +987,6 @@ bool LibraryCallKit::inline_string_equals() {
if (!Matcher::has_match_rule(Op_StrEquals)) return false;
const int value_offset = java_lang_String::value_offset_in_bytes();
const int count_offset = java_lang_String::count_offset_in_bytes();
const int offset_offset = java_lang_String::offset_offset_in_bytes();
int nargs = 2;
_sp += nargs;
Node* argument = pop(); // pop non-receiver first: it was pushed second
@ -1030,24 +1040,31 @@ bool LibraryCallKit::inline_string_equals() {
}
}
const TypeOopPtr* string_type = TypeOopPtr::make_from_klass(klass);
Node* no_ctrl = NULL;
Node* receiver_cnt;
Node* argument_cnt;
if (!stopped()) {
const TypeOopPtr* string_type = TypeOopPtr::make_from_klass(klass);
// Properly cast the argument to String
argument = _gvn.transform(new (C, 2) CheckCastPPNode(control(), argument, string_type));
// This path is taken only when argument's type is String:NotNull.
argument = cast_not_null(argument, false);
// Get counts for string and argument
Node* receiver_cnta = basic_plus_adr(receiver, receiver, count_offset);
receiver_cnt = make_load(no_ctrl, receiver_cnta, TypeInt::INT, T_INT, string_type->add_offset(count_offset));
Node* no_ctrl = NULL;
Node* argument_cnta = basic_plus_adr(argument, argument, count_offset);
argument_cnt = make_load(no_ctrl, argument_cnta, TypeInt::INT, T_INT, string_type->add_offset(count_offset));
// Get start addr of receiver
Node* receiver_val = load_String_value(no_ctrl, receiver);
Node* receiver_offset = load_String_offset(no_ctrl, receiver);
Node* receiver_start = array_element_address(receiver_val, receiver_offset, T_CHAR);
// Get length of receiver
Node* receiver_cnt = load_String_length(no_ctrl, receiver);
// Get start addr of argument
Node* argument_val = load_String_value(no_ctrl, argument);
Node* argument_offset = load_String_offset(no_ctrl, argument);
Node* argument_start = array_element_address(argument_val, argument_offset, T_CHAR);
// Get length of argument
Node* argument_cnt = load_String_length(no_ctrl, argument);
// Check for receiver count != argument count
Node* cmp = _gvn.transform( new(C, 3) CmpINode(receiver_cnt, argument_cnt) );
@ -1057,14 +1074,14 @@ bool LibraryCallKit::inline_string_equals() {
phi->init_req(4, intcon(0));
region->init_req(4, if_ne);
}
}
// Check for count == 0 is done by mach node StrEquals.
// Check for count == 0 is done by assembler code for StrEquals.
if (!stopped()) {
Node* equals = make_string_method_node(Op_StrEquals, receiver, receiver_cnt, argument, argument_cnt);
phi->init_req(1, equals);
region->init_req(1, control());
if (!stopped()) {
Node* equals = make_string_method_node(Op_StrEquals, receiver_start, receiver_cnt, argument_start, argument_cnt);
phi->init_req(1, equals);
region->init_req(1, control());
}
}
// post merge
@ -1162,20 +1179,9 @@ Node* LibraryCallKit::string_indexOf(Node* string_object, ciTypeArray* target_ar
const int nargs = 2; // number of arguments to push back for uncommon trap in predicate
const int value_offset = java_lang_String::value_offset_in_bytes();
const int count_offset = java_lang_String::count_offset_in_bytes();
const int offset_offset = java_lang_String::offset_offset_in_bytes();
ciInstanceKlass* klass = env()->String_klass();
const TypeOopPtr* string_type = TypeOopPtr::make_from_klass(klass);
const TypeAryPtr* source_type = TypeAryPtr::make(TypePtr::NotNull, TypeAry::make(TypeInt::CHAR,TypeInt::POS), ciTypeArrayKlass::make(T_CHAR), true, 0);
Node* sourceOffseta = basic_plus_adr(string_object, string_object, offset_offset);
Node* sourceOffset = make_load(no_ctrl, sourceOffseta, TypeInt::INT, T_INT, string_type->add_offset(offset_offset));
Node* sourceCounta = basic_plus_adr(string_object, string_object, count_offset);
Node* sourceCount = make_load(no_ctrl, sourceCounta, TypeInt::INT, T_INT, string_type->add_offset(count_offset));
Node* sourcea = basic_plus_adr(string_object, string_object, value_offset);
Node* source = make_load(no_ctrl, sourcea, source_type, T_OBJECT, string_type->add_offset(value_offset));
Node* source = load_String_value(no_ctrl, string_object);
Node* sourceOffset = load_String_offset(no_ctrl, string_object);
Node* sourceCount = load_String_length(no_ctrl, string_object);
Node* target = _gvn.transform( makecon(TypeOopPtr::make_from_constant(target_array, true)) );
jint target_length = target_array->length();
@ -1243,10 +1249,6 @@ Node* LibraryCallKit::string_indexOf(Node* string_object, ciTypeArray* target_ar
//------------------------------inline_string_indexOf------------------------
bool LibraryCallKit::inline_string_indexOf() {
const int value_offset = java_lang_String::value_offset_in_bytes();
const int count_offset = java_lang_String::count_offset_in_bytes();
const int offset_offset = java_lang_String::offset_offset_in_bytes();
_sp += 2;
Node *argument = pop(); // pop non-receiver first: it was pushed second
Node *receiver = pop();
@ -1280,12 +1282,21 @@ bool LibraryCallKit::inline_string_indexOf() {
Node* result_phi = new (C, 4) PhiNode(result_rgn, TypeInt::INT);
Node* no_ctrl = NULL;
// Get counts for string and substr
Node* source_cnta = basic_plus_adr(receiver, receiver, count_offset);
Node* source_cnt = make_load(no_ctrl, source_cnta, TypeInt::INT, T_INT, string_type->add_offset(count_offset));
// Get start addr of source string
Node* source = load_String_value(no_ctrl, receiver);
Node* source_offset = load_String_offset(no_ctrl, receiver);
Node* source_start = array_element_address(source, source_offset, T_CHAR);
Node* substr_cnta = basic_plus_adr(argument, argument, count_offset);
Node* substr_cnt = make_load(no_ctrl, substr_cnta, TypeInt::INT, T_INT, string_type->add_offset(count_offset));
// Get length of source string
Node* source_cnt = load_String_length(no_ctrl, receiver);
// Get start addr of substring
Node* substr = load_String_value(no_ctrl, argument);
Node* substr_offset = load_String_offset(no_ctrl, argument);
Node* substr_start = array_element_address(substr, substr_offset, T_CHAR);
// Get length of source string
Node* substr_cnt = load_String_length(no_ctrl, argument);
// Check for substr count > string count
Node* cmp = _gvn.transform( new(C, 3) CmpINode(substr_cnt, source_cnt) );
@ -1308,7 +1319,7 @@ bool LibraryCallKit::inline_string_indexOf() {
}
if (!stopped()) {
result = make_string_method_node(Op_StrIndexOf, receiver, source_cnt, argument, substr_cnt);
result = make_string_method_node(Op_StrIndexOf, source_start, source_cnt, substr_start, substr_cnt);
result_phi->init_req(1, result);
result_rgn->init_req(1, control());
}
@ -1333,11 +1344,19 @@ bool LibraryCallKit::inline_string_indexOf() {
ciInstance* str = str_const->as_instance();
assert(str != NULL, "must be instance");
ciObject* v = str->field_value_by_offset(value_offset).as_object();
int o = str->field_value_by_offset(offset_offset).as_int();
int c = str->field_value_by_offset(count_offset).as_int();
ciObject* v = str->field_value_by_offset(java_lang_String::value_offset_in_bytes()).as_object();
ciTypeArray* pat = v->as_type_array(); // pattern (argument) character array
int o;
int c;
if (java_lang_String::has_offset_field()) {
o = str->field_value_by_offset(java_lang_String::offset_offset_in_bytes()).as_int();
c = str->field_value_by_offset(java_lang_String::count_offset_in_bytes()).as_int();
} else {
o = 0;
c = pat->length();
}
// constant strings have no offset and count == length which
// simplifies the resulting code somewhat so lets optimize for that.
if (o != 0 || c != pat->length()) {

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2009, 2011, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2009, 2012, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -528,16 +528,6 @@ PhaseStringOpts::PhaseStringOpts(PhaseGVN* gvn, Unique_Node_List*):
}
// Collect the types needed to talk about the various slices of memory
const TypeInstPtr* string_type = TypeInstPtr::make(TypePtr::NotNull, C->env()->String_klass(),
false, NULL, 0);
const TypePtr* value_field_type = string_type->add_offset(java_lang_String::value_offset_in_bytes());
const TypePtr* offset_field_type = string_type->add_offset(java_lang_String::offset_offset_in_bytes());
const TypePtr* count_field_type = string_type->add_offset(java_lang_String::count_offset_in_bytes());
value_field_idx = C->get_alias_index(value_field_type);
count_field_idx = C->get_alias_index(count_field_type);
offset_field_idx = C->get_alias_index(offset_field_type);
char_adr_idx = C->get_alias_index(TypeAryPtr::CHARS);
// For each locally allocated StringBuffer see if the usages can be
@ -1174,18 +1164,9 @@ void PhaseStringOpts::int_getChars(GraphKit& kit, Node* arg, Node* char_array, N
Node* PhaseStringOpts::copy_string(GraphKit& kit, Node* str, Node* char_array, Node* start) {
Node* string = str;
Node* offset = kit.make_load(kit.control(),
kit.basic_plus_adr(string, string, java_lang_String::offset_offset_in_bytes()),
TypeInt::INT, T_INT, offset_field_idx);
Node* count = kit.make_load(kit.control(),
kit.basic_plus_adr(string, string, java_lang_String::count_offset_in_bytes()),
TypeInt::INT, T_INT, count_field_idx);
const TypeAryPtr* value_type = TypeAryPtr::make(TypePtr::NotNull,
TypeAry::make(TypeInt::CHAR,TypeInt::POS),
ciTypeArrayKlass::make(T_CHAR), true, 0);
Node* value = kit.make_load(kit.control(),
kit.basic_plus_adr(string, string, java_lang_String::value_offset_in_bytes()),
value_type, T_OBJECT, value_field_idx);
Node* offset = kit.load_String_offset(kit.control(), string);
Node* count = kit.load_String_length(kit.control(), string);
Node* value = kit.load_String_value (kit.control(), string);
// copy the contents
if (offset->is_Con() && count->is_Con() && value->is_Con() && count->get_int() < unroll_string_copy_length) {
@ -1342,10 +1323,9 @@ void PhaseStringOpts::replace_string_concat(StringConcat* sc) {
arg = phi;
sc->set_argument(argi, arg);
}
// Node* offset = kit.make_load(NULL, kit.basic_plus_adr(arg, arg, offset_offset),
// TypeInt::INT, T_INT, offset_field_idx);
Node* count = kit.make_load(kit.control(), kit.basic_plus_adr(arg, arg, java_lang_String::count_offset_in_bytes()),
TypeInt::INT, T_INT, count_field_idx);
Node* count = kit.load_String_length(kit.control(), arg);
length = __ AddI(length, count);
string_sizes->init_req(argi, NULL);
break;
@ -1436,12 +1416,11 @@ void PhaseStringOpts::replace_string_concat(StringConcat* sc) {
}
// Intialize the string
kit.store_to_memory(kit.control(), kit.basic_plus_adr(result, java_lang_String::offset_offset_in_bytes()),
__ intcon(0), T_INT, offset_field_idx);
kit.store_to_memory(kit.control(), kit.basic_plus_adr(result, java_lang_String::count_offset_in_bytes()),
length, T_INT, count_field_idx);
kit.store_to_memory(kit.control(), kit.basic_plus_adr(result, java_lang_String::value_offset_in_bytes()),
char_array, T_OBJECT, value_field_idx);
if (java_lang_String::has_offset_field()) {
kit.store_String_offset(kit.control(), result, __ intcon(0));
kit.store_String_length(kit.control(), result, length);
}
kit.store_String_value(kit.control(), result, char_array);
// hook up the outgoing control and result
kit.replace_call(sc->end(), result);

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2009, 2010, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2009, 2012, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -41,9 +41,6 @@ class PhaseStringOpts : public Phase {
// Memory slices needed for code gen
int char_adr_idx;
int value_field_idx;
int count_field_idx;
int offset_field_idx;
// Integer.sizeTable - used for int to String conversion
ciField* size_table_field;

View File

@ -3039,7 +3039,7 @@ jint Arguments::parse(const JavaVMInitArgs* args) {
return result;
}
#ifdef JAVASE_EMBEDDED
#if (defined JAVASE_EMBEDDED || defined ARM)
UNSUPPORTED_OPTION(UseG1GC, "G1 GC");
#endif
@ -3092,6 +3092,14 @@ jint Arguments::parse(const JavaVMInitArgs* args) {
PrintGC = true;
}
if (!JDK_Version::is_gte_jdk18x_version()) {
// To avoid changing the log format for 7 updates this flag is only
// true by default in JDK8 and above.
if (FLAG_IS_DEFAULT(PrintGCCause)) {
FLAG_SET_DEFAULT(PrintGCCause, false);
}
}
// Set object alignment values.
set_object_alignment();

View File

@ -148,6 +148,8 @@ void Flag::print_as_flag(outputStream* st) {
st->print("-XX:%s=" UINTX_FORMAT, name, get_uintx());
} else if (is_uint64_t()) {
st->print("-XX:%s=" UINT64_FORMAT, name, get_uint64_t());
} else if (is_double()) {
st->print("-XX:%s=%f", name, get_double());
} else if (is_ccstr()) {
st->print("-XX:%s=", name);
const char* cp = get_ccstr();

View File

@ -3902,7 +3902,10 @@ class CommandLineFlags {
" of this flag is true for JDK 6 and earlier") \
\
diagnostic(bool, WhiteBoxAPI, false, \
"Enable internal testing APIs")
"Enable internal testing APIs") \
\
product(bool, PrintGCCause, true, \
"Include GC cause in GC logging")
/*
* Macros for factoring of globals

View File

@ -206,6 +206,10 @@ class JDK_Version VALUE_OBJ_CLASS_SPEC {
return current().compare_major(7) == 0;
}
static bool is_jdk18x_version() {
return current().compare_major(8) == 0;
}
static bool is_gte_jdk13x_version() {
return current().compare_major(3) >= 0;
}
@ -225,6 +229,10 @@ class JDK_Version VALUE_OBJ_CLASS_SPEC {
static bool is_gte_jdk17x_version() {
return current().compare_major(7) >= 0;
}
static bool is_gte_jdk18x_version() {
return current().compare_major(8) >= 0;
}
};
#endif // SHARE_VM_RUNTIME_JAVA_HPP

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -179,6 +179,11 @@ const jlong NANOSECS_PER_SEC = CONST64(1000000000);
const jint NANOSECS_PER_MILLISEC = 1000000;
inline const char* proper_unit_for_byte_size(size_t s) {
#ifdef _LP64
if (s >= 10*G) {
return "G";
}
#endif
if (s >= 10*M) {
return "M";
} else if (s >= 10*K) {
@ -188,17 +193,22 @@ inline const char* proper_unit_for_byte_size(size_t s) {
}
}
inline size_t byte_size_in_proper_unit(size_t s) {
template <class T>
inline T byte_size_in_proper_unit(T s) {
#ifdef _LP64
if (s >= 10*G) {
return (T)(s/G);
}
#endif
if (s >= 10*M) {
return s/M;
return (T)(s/M);
} else if (s >= 10*K) {
return s/K;
return (T)(s/K);
} else {
return s;
}
}
//----------------------------------------------------------------------------------------------------
// VM type definitions

View File

@ -0,0 +1,38 @@
/*
* Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*
*/
/*
* Note that in the run command below the only important flag is PrintCommandLineFlags.
* The others are just flags of all types; bool, intx, uintx, uint64_t, double and ccstr.
*
* @test PrintAsFlag
* @summary verify that Flag::print_as_flag() works correctly. This is used by "jinfo -flag" and -XX:+PrintCommandLineFlags.
* @run main/othervm -XX:+PrintCommandLineFlags -XX:-ShowMessageBoxOnError -XX:BiasedLockingStartupDelay=4000 -XX:ParallelGCThreads=4 -XX:MaxRAM=1G -XX:CMSSmallCoalSurplusPercent=1.05 -XX:ErrorFile="file" PrintAsFlag
*/
public class PrintAsFlag {
public static void main(String... args) {
System.out.printf("Done");
}
}

View File

@ -158,3 +158,6 @@ f3244c1f04864d35c41fa8d13669faf4f65b81e2 jdk8-b28
8b91a897a04486cf901af0de7f684a3eb31f121f jdk8-b34
e187f3ede64965dc2979df9a211107cd3d38eacb jdk8-b35
cfd288fe1d3e2b700838342e70d71d44ac991af5 jdk8-b36
90204bfab4e2bed402badcc997cbf8446ab5669f jdk8-b37
5bbe0cb6f2f2d7ce292da77bf4fa9d618d770a78 jdk8-b38
f95fdbe525c88ef0d57dc1390be6582a8af5e07c jdk8-b39

View File

@ -158,3 +158,6 @@ ea80b2388dce711fbde8e4fd6e07c2c64ad16743 jdk8-b33
f1d020a49c8c33667fb10c8caa255206a78a3675 jdk8-b34
e8afc16522e190cb93c66bcb15d6fba0fe9e6833 jdk8-b35
89b36c658e39f0a2957be55453a3a3befd9c8a6b jdk8-b36
b05a948db1b6c933c980f24e4dc8fd897b7cf4ef jdk8-b37
ac1ba3b56775e3cdcd91b7a48793b59f6a3c18b5 jdk8-b38
7f6b44fd303478caa83575dbc225de187c509c50 jdk8-b39

View File

@ -158,3 +158,6 @@ ddfe5562f61f54ed2121ac0c73b688b94f3e66b5 jdk8-b32
29b680393f33bf953688c17d93aca7a870ca4024 jdk8-b34
2e3e1356ffbddb2ae95c08da72830ba9ab8b3181 jdk8-b35
45da9cb055ee258dc09e69c1718e27eadea38e45 jdk8-b36
9e82ac15ab80370d6e021aea7b98c7c9626adb5e jdk8-b37
c45f3509a70796c54b48f32910d1caf435763416 jdk8-b38
b6f52911752110a2889681923992c7a0baa52ccc jdk8-b39

View File

@ -65,12 +65,8 @@ FILES_export = \
com/apple/laf/ScreenMenuPropertyHandler.java \
com/apple/laf/ScreenMenuPropertyListener.java
#RESOURCE_BUNDLES_COMPILED_PROPERTIES += \
# com/apple/laf/resources/aqua.properties \
# com/apple/laf/resources/aqua_de.properties \
# com/apple/laf/resources/aqua_fr.properties \
# com/apple/laf/resources/aqua_ja.properties
RESOURCE_BUNDLES_COMPILED_PROPERTIES += \
com/apple/laf/resources/aqua.properties
#
# Rules

View File

@ -139,7 +139,7 @@ ifndef OPENJDK
#
CLASSDESTDIR = $(TEMPDIR)/classes
JAVAHFLAGS = -bootclasspath \
"$(CLASSDESTDIR)$(CLASSPATH_SEPARATOR)$(CLASSBINDIR)"
"$(CLASSDESTDIR)$(CLASSPATH_SEPARATOR)$(CLASSBINDIR)$(JCE_PATH)"
include $(BUILDDIR)/common/Mapfile-vers.gmk
include $(BUILDDIR)/common/Library.gmk

View File

@ -1,5 +1,5 @@
#
# Copyright (c) 1999, 2011, Oracle and/or its affiliates. All rights reserved.
# Copyright (c) 1999, 2012, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# This code is free software; you can redistribute it and/or modify it
@ -111,10 +111,10 @@ CC_OPT = $(CC_OPT/$(OPTIMIZATION_LEVEL))
# For all platforms, do not omit the frame pointer register usage.
# We need this frame pointer to make it easy to walk the stacks.
# This should be the default on X86, but ia64 and amd64 may not have this
# as the default.
CFLAGS_REQUIRED_amd64 += -m64 -fno-omit-frame-pointer -D_LITTLE_ENDIAN
LDFLAGS_COMMON_amd64 += -m64
# This should be the default on X86, but ia64, and x86_64
# may not have this as the default.
CFLAGS_REQUIRED_x86_64 += -m64 -fno-omit-frame-pointer -D_LITTLE_ENDIAN
LDFLAGS_COMMON_x86_64 += -m64
CFLAGS_REQUIRED_i586 += -m32 -fno-omit-frame-pointer -D_LITTLE_ENDIAN
LDFLAGS_COMMON_i586 += -m32
CFLAGS_REQUIRED_ia64 += -m64 -fno-omit-frame-pointer -D_LITTLE_ENDIAN
@ -168,7 +168,7 @@ PIC_CODE_LARGE = -fPIC
PIC_CODE_SMALL = -fpic
GLOBAL_KPIC = $(PIC_CODE_LARGE)
CFLAGS_COMMON += $(GLOBAL_KPIC) $(GCC_WARNINGS)
ifeq ($(ARCH), amd64)
ifeq ($(ARCH), x86_64)
CFLAGS_COMMON += -pipe
endif

View File

@ -29,14 +29,14 @@ JA_DIRNAME=ja_JP.UTF-8
# Defines the release targets for Mac OS X build products
JDK_BUNDLE_DIR = $(ABS_OUTPUTDIR)/j2sdk-bundle/$(THIS_JDK_VERSION).jdk/Contents
JRE_BUNDLE_DIR = $(ABS_OUTPUTDIR)/j2re-bundle/$(THIS_JDK_VERSION).jre/Contents
JDK_BUNDLE_DIR = $(ABS_OUTPUTDIR)/j2sdk-bundle/jdk$(JDK_VERSION).jdk/Contents
JRE_BUNDLE_DIR = $(ABS_OUTPUTDIR)/j2re-bundle/jre$(JDK_VERSION).jre/Contents
MACOSX_SRC = $(JDK_TOPDIR)/src/macosx
BUNDLE_ID ?= net.java.openjdk
BUNLDE_ID_JRE ?= $(BUNDLE_ID).jre
BUNLDE_ID_JDK ?= $(BUNDLE_ID).jdk
BUNDLE_ID_JRE ?= $(BUNDLE_ID).jre
BUNDLE_ID_JDK ?= $(BUNDLE_ID).jdk
BUNDLE_NAME ?= OpenJDK $(JDK_MINOR_VERSION)
BUNDLE_NAME_JRE ?= $(BUNDLE_NAME)

View File

@ -156,6 +156,7 @@ JDK_MAN_PAGES = \
jstack.1 \
jstat.1 \
jstatd.1 \
jvisualvm.1 \
native2ascii.1 \
rmic.1 \
schemagen.1 \
@ -1311,8 +1312,8 @@ $(TEMP_PREV_JDK_COMPARISON): install-previous-jdk $(DIRDIFF_JARFILE)
@$(java-vm-cleanup)
# Clean up names in the messages printed out
CAT_FILTER = $(SED) -e "s@$(JDK_IMAGE_DIR)@JDK_IMAGE@g" \
-e "s@$(JRE_IMAGE_DIR)@JRE_IMAGE@g"
CAT_FILTER = $(SED) -e "s|$(JDK_IMAGE_DIR)|JDK_IMAGE|g" \
-e "s|$(JRE_IMAGE_DIR)|JRE_IMAGE|g"
# Report on the jre image comparison
compare-image-jre: $(TEMP_PREV_JRE_COMPARISON)

View File

@ -197,6 +197,10 @@ $(GENSRCDIR)/%.java: $(SHARE_SRC)/classes/%.properties
$(add-property-java-file)
$(GENSRCDIR)/%.java: $(GENSRCDIR)/%.properties
$(add-property-java-file)
ifdef PLATFORM_SRC_MACOS
$(GENSRCDIR)/%.java: $(PLATFORM_SRC_MACOS)/classes/%.properties
$(add-property-java-file)
endif
ifndef OPENJDK
$(GENSRCDIR)/%.java: $(CLOSED_PLATFORM_SRC)/classes/%.properties
$(add-property-java-file)

View File

@ -1,5 +1,5 @@
#
# Copyright (c) 2007, 2011, Oracle and/or its affiliates. All rights reserved.
# Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# This code is free software; you can redistribute it and/or modify it
@ -139,7 +139,7 @@ JAVACFLAGS += $(JAVAC_LINT_OPTIONS)
# built implicitly/explicitly.
#
ifeq ($(wildcard $(SHARE_SRC)/classes/javax/crypto/Cipher.java),)
JCEFLAGS = $(CLASSPATH_SEPARATOR)$(LIBDIR)/jce.jar
JCE_PATH = $(CLASSPATH_SEPARATOR)$(LIBDIR)/jce.jar
endif
# Add the source level
@ -152,11 +152,11 @@ TARGET_CLASS_VERSION = 7
CLASS_VERSION = -target $(TARGET_CLASS_VERSION)
JAVACFLAGS += $(CLASS_VERSION)
JAVACFLAGS += -encoding ascii
JAVACFLAGS += "-Xbootclasspath:$(CLASSBINDIR)$(JCEFLAGS)"
JAVACFLAGS += "-Xbootclasspath:$(CLASSBINDIR)$(JCE_PATH)"
JAVACFLAGS += $(OTHER_JAVACFLAGS)
# Needed for javah
JAVAHFLAGS += -bootclasspath "$(CLASSBINDIR)$(JCEFLAGS)"
JAVAHFLAGS += -bootclasspath "$(CLASSBINDIR)$(JCE_PATH)"
# Needed for javadoc to ensure it builds documentation
# against the newly built classes

View File

@ -1,5 +1,5 @@
#
# Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved.
# Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# This code is free software; you can redistribute it and/or modify it
@ -264,7 +264,7 @@ ifeq ($(PLATFORM), macosx)
echo sparc \
;; \
x86_64) \
echo amd64 \
echo x86_64 \
;; \
universal) \
echo universal \

View File

@ -261,8 +261,7 @@ ifndef BUILD_CLIENT_ONLY
ifeq ($(ZIP_DEBUGINFO_FILES),1)
# the import JDK may not contain the target of the symlink
ifneq ($(wildcard $(HOTSPOT_IMPORT_PATH)/$(ARCH_VM_SUBDIR)/$(LIBJSIG_DIZ_NAME)),)
# check for the .diz file, but create the .debuginfo link
IMPORT_LIST += $(LIB_LOCATION)/$(SERVER_LOCATION)/$(LIBJSIG_DEBUGINFO_NAME)
IMPORT_LIST += $(LIB_LOCATION)/$(SERVER_LOCATION)/$(LIBJSIG_DIZ_NAME)
endif
else
# the import JDK may not contain the target of the symlink
@ -319,8 +318,7 @@ ifeq ($(ENABLE_FULL_DEBUG_SYMBOLS),1)
ifeq ($(ZIP_DEBUGINFO_FILES),1)
# the import JDK may not contain the target of the symlink
ifneq ($(wildcard $(HOTSPOT_IMPORT_PATH)/$(ARCH_VM_SUBDIR)/$(LIBJSIG_DIZ_NAME)),)
# check for the .diz file, but create the .debuginfo link
IMPORT_LIST += $(LIB_LOCATION)/$(CLIENT_LOCATION)/$(LIBJSIG_DEBUGINFO_NAME)
IMPORT_LIST += $(LIB_LOCATION)/$(CLIENT_LOCATION)/$(LIBJSIG_DIZ_NAME)
endif
else
# the import JDK may not contain the target of the symlink
@ -472,11 +470,24 @@ $(LIB_LOCATION)/$(SERVER_LOCATION)/$(LIBJSIG_NAME):
$(call install-sym-link, ../$(LIBJSIG_NAME))
ifeq ($(ENABLE_FULL_DEBUG_SYMBOLS),1)
# we don't create a symlink to a libjsig.diz file
# We don't create a symlink to a libjsig.diz file, but we do put
# the libjsig.debuginfo symlink into a libjsig.diz file. The aurora
# system does not like dangling symlinks.
ifeq ($(ZIP_DEBUGINFO_FILES),1)
$(LIB_LOCATION)/$(CLIENT_LOCATION)/$(LIBJSIG_DIZ_NAME) \
$(LIB_LOCATION)/$(SERVER_LOCATION)/$(LIBJSIG_DIZ_NAME):
@$(prep-target)
$(LN) -s ../$(LIBJSIG_DEBUGINFO_NAME) $(@D)/$(LIBJSIG_DEBUGINFO_NAME)
( $(CD) $(@D) ; \
$(ZIPEXE) -y $(LIBJSIG_DIZ_NAME) $(LIBJSIG_DEBUGINFO_NAME) ; \
$(RM) $(LIBJSIG_DEBUGINFO_NAME) ; \
)
else
$(LIB_LOCATION)/$(CLIENT_LOCATION)/$(LIBJSIG_DEBUGINFO_NAME) \
$(LIB_LOCATION)/$(SERVER_LOCATION)/$(LIBJSIG_DEBUGINFO_NAME):
@$(prep-target)
$(call install-sym-link, ../$(LIBJSIG_DEBUGINFO_NAME))
endif
endif
else
$(LIB_LOCATION)/$(CLIENT_LOCATION)/$(LIBJSIG_NAME):
@ -484,10 +495,22 @@ $(LIB_LOCATION)/$(CLIENT_LOCATION)/$(LIBJSIG_NAME):
$(call install-sym-link, ../$(LIBJSIG_NAME))
ifeq ($(ENABLE_FULL_DEBUG_SYMBOLS),1)
# we don't create a symlink to a libjsig.diz file
# We don't create a symlink to a libjsig.diz file, but we do put
# the libjsig.debuginfo symlink into a libjsig.diz file. The aurora
# system does not like dangling symlinks.
ifeq ($(ZIP_DEBUGINFO_FILES),1)
$(LIB_LOCATION)/$(CLIENT_LOCATION)/$(LIBJSIG_DIZ_NAME):
@$(prep-target)
$(LN) -s ../$(LIBJSIG_DEBUGINFO_NAME) $(@D)/$(LIBJSIG_DEBUGINFO_NAME)
( $(CD) $(@D) ; \
$(ZIPEXE) -y $(LIBJSIG_DIZ_NAME) $(LIBJSIG_DEBUGINFO_NAME) ; \
$(RM) $(LIBJSIG_DEBUGINFO_NAME) ; \
)
else
$(LIB_LOCATION)/$(CLIENT_LOCATION)/$(LIBJSIG_DEBUGINFO_NAME):
@$(prep-target)
$(call install-sym-link, ../$(LIBJSIG_DEBUGINFO_NAME))
endif
endif
endif

View File

@ -81,6 +81,7 @@ endif
# SA tools
ifeq ($(PROGRAM),jstack)
SA_TOOL=true
INFO_PLIST_FILE=Info-privileged.plist
endif
ifeq ($(PROGRAM),jsadebugd)
SA_TOOL=true

View File

@ -1,5 +1,5 @@
#
# Copyright (c) 2009, 2011, Oracle and/or its affiliates. All rights reserved.
# Copyright (c) 2009, 2012, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# This code is free software; you can redistribute it and/or modify it
@ -160,7 +160,7 @@ ifeq ($(NATIVE_ECC_AVAILABLE), true)
$(PKGDIR)/ECKeyPairGenerator.java
JAVAHFLAGS = -bootclasspath \
"$(CLASSDESTDIR)$(CLASSPATH_SEPARATOR)$(CLASSBINDIR)"
"$(CLASSDESTDIR)$(CLASSPATH_SEPARATOR)$(CLASSBINDIR)$(JCE_PATH)"
#

View File

@ -150,7 +150,7 @@ OTHER_INCLUDES += \
#
CLASSDESTDIR = $(TEMPDIR)/classes
JAVAHFLAGS = -bootclasspath \
"$(CLASSDESTDIR)$(CLASSPATH_SEPARATOR)$(CLASSBINDIR)"
"$(CLASSDESTDIR)$(CLASSPATH_SEPARATOR)$(CLASSBINDIR)$(JCE_PATH)"
include $(BUILDDIR)/common/Mapfile-vers.gmk

View File

@ -151,7 +151,7 @@ OTHER_INCLUDES += \
#
CLASSDESTDIR = $(TEMPDIR)/classes
JAVAHFLAGS = -bootclasspath \
"$(CLASSDESTDIR)$(CLASSPATH_SEPARATOR)$(CLASSBINDIR)"
"$(CLASSDESTDIR)$(CLASSPATH_SEPARATOR)$(CLASSBINDIR)$(JCE_PATH)"
include $(BUILDDIR)/common/Mapfile-vers.gmk

View File

@ -139,7 +139,7 @@ ifndef OPENJDK
#
CLASSDESTDIR = $(TEMPDIR)/classes
JAVAHFLAGS = -bootclasspath \
"$(CLASSDESTDIR)$(CLASSPATH_SEPARATOR)$(CLASSBINDIR)"
"$(CLASSDESTDIR)$(CLASSPATH_SEPARATOR)$(CLASSBINDIR)$(JCE_PATH)"
include $(BUILDDIR)/common/Mapfile-vers.gmk
include $(BUILDDIR)/common/Library.gmk

View File

@ -1,5 +1,5 @@
#
# Copyright (c) 2007, 2011, Oracle and/or its affiliates. All rights reserved.
# Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# This code is free software; you can redistribute it and/or modify it
@ -141,7 +141,7 @@ JAVACFLAGS += $(JAVAC_LINT_OPTIONS)
# built implicitly/explicitly.
#
ifeq ($(wildcard $(SHARE_SRC)/classes/javax/crypto/Cipher.java),)
JCEFLAGS = $(CLASSPATH_SEPARATOR)$(LIBDIR)/jce.jar
JCE_PATH = $(CLASSPATH_SEPARATOR)$(LIBDIR)/jce.jar
endif
# Add the source level
@ -154,11 +154,11 @@ TARGET_CLASS_VERSION = 7
CLASS_VERSION = -target $(TARGET_CLASS_VERSION)
JAVACFLAGS += $(CLASS_VERSION)
JAVACFLAGS += -encoding ascii
JAVACFLAGS += "-Xbootclasspath:$(CLASSBINDIR)$(JCEFLAGS)"
JAVACFLAGS += "-Xbootclasspath:$(CLASSBINDIR)$(JCE_PATH)"
JAVACFLAGS += $(OTHER_JAVACFLAGS)
# Needed for javah
JAVAHFLAGS += -bootclasspath "$(CLASSBINDIR)$(JCEFLAGS)"
JAVAHFLAGS += -bootclasspath "$(CLASSBINDIR)$(JCE_PATH)"
# Needed for javadoc to ensure it builds documentation
# against the newly built classes

View File

@ -1,5 +1,5 @@
#
# Copyright (c) 2009, 2011, Oracle and/or its affiliates. All rights reserved.
# Copyright (c) 2009, 2012, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# This code is free software; you can redistribute it and/or modify it
@ -159,7 +159,8 @@ ifeq ($(NATIVE_ECC_AVAILABLE), true)
$(PKGDIR)/ECDSASignature.java \
$(PKGDIR)/ECKeyPairGenerator.java
JAVAHFLAGS += -Xbootclasspath/p:$(CLASSDESTDIR)
JAVAHFLAGS = -bootclasspath \
"$(CLASSDESTDIR)$(CLASSPATH_SEPARATOR)$(CLASSBINDIR)$(JCE_PATH)"
#
# C and C++ files

View File

@ -1,5 +1,5 @@
#
# Copyright (c) 2005, 2011, Oracle and/or its affiliates. All rights reserved.
# Copyright (c) 2005, 2012, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# This code is free software; you can redistribute it and/or modify it
@ -149,7 +149,8 @@ OTHER_INCLUDES += \
# Rules
#
CLASSDESTDIR = $(TEMPDIR)/classes
JAVAHFLAGS += -Xbootclasspath/p:$(CLASSDESTDIR)
JAVAHFLAGS = -bootclasspath \
"$(CLASSDESTDIR)$(CLASSPATH_SEPARATOR)$(CLASSBINDIR)$(JCE_PATH)"
include $(BUILDDIR)/common/Mapfile-vers.gmk

View File

@ -150,7 +150,8 @@ OTHER_INCLUDES += \
# Rules
#
CLASSDESTDIR = $(TEMPDIR)/classes
JAVAHFLAGS = -bootclasspath "$(CLASSDESTDIR)$(CLASSPATH_SEPARATOR)$(CLASSBINDIR)"
JAVAHFLAGS = -bootclasspath \
"$(CLASSDESTDIR)$(CLASSPATH_SEPARATOR)$(CLASSBINDIR)$(JCE_PATH)"
include $(BUILDDIR)/common/Mapfile-vers.gmk

View File

@ -906,11 +906,41 @@ SetXDockArgForAWT(const char *arg)
{
char envVar[80];
if (strstr(arg, "-Xdock:name=") == arg) {
/*
* The APP_NAME_<pid> environment variable is used to pass
* an application name as specified with the -Xdock:name command
* line option from Java launcher code to the AWT code in order
* to assign this name to the app's dock tile on the Mac.
* The _<pid> part is added to avoid collisions with child processes.
*
* WARNING: This environment variable is an implementation detail and
* isn't meant for use outside of the core platform. The mechanism for
* passing this information from Java launcher to other modules may
* change drastically between update release, and it may even be
* removed or replaced with another mechanism.
*
* NOTE: It is used by SWT, and JavaFX.
*/
snprintf(envVar, sizeof(envVar), "APP_NAME_%d", getpid());
setenv(envVar, (arg + 12), 1);
}
if (strstr(arg, "-Xdock:icon=") == arg) {
/*
* The APP_ICON_<pid> environment variable is used to pass
* an application icon as specified with the -Xdock:icon command
* line option from Java launcher code to the AWT code in order
* to assign this icon to the app's dock tile on the Mac.
* The _<pid> part is added to avoid collisions with child processes.
*
* WARNING: This environment variable is an implementation detail and
* isn't meant for use outside of the core platform. The mechanism for
* passing this information from Java launcher to other modules may
* change drastically between update release, and it may even be
* removed or replaced with another mechanism.
*
* NOTE: It is used by SWT, and JavaFX.
*/
snprintf(envVar, sizeof(envVar), "APP_ICON_%d", getpid());
setenv(envVar, (arg + 12), 1);
}
@ -931,6 +961,22 @@ SetMainClassForAWT(JNIEnv *env, jclass mainClass) {
NULL_CHECK(mainClassName = (*env)->GetStringUTFChars(env, mainClassString, NULL));
char envVar[80];
/*
* The JAVA_MAIN_CLASS_<pid> environment variable is used to pass
* the name of a Java class whose main() method is invoked by
* the Java launcher code to start the application, to the AWT code
* in order to assign the name to the Apple menu bar when the app
* is active on the Mac.
* The _<pid> part is added to avoid collisions with child processes.
*
* WARNING: This environment variable is an implementation detail and
* isn't meant for use outside of the core platform. The mechanism for
* passing this information from Java launcher to other modules may
* change drastically between update release, and it may even be
* removed or replaced with another mechanism.
*
* NOTE: It is used by SWT, and JavaFX.
*/
snprintf(envVar, sizeof(envVar), "JAVA_MAIN_CLASS_%d", getpid());
setenv(envVar, mainClassName, 1);

View File

@ -27,7 +27,6 @@ package apple.launcher;
import java.io.*;
import java.lang.reflect.*;
import java.security.PrivilegedAction;
import java.text.MessageFormat;
import java.util.*;
import java.util.jar.*;
@ -36,7 +35,13 @@ import javax.swing.*;
class JavaAppLauncher implements Runnable {
static {
java.security.AccessController.doPrivileged((PrivilegedAction<?>)new sun.security.action.LoadLibraryAction("osx"));
java.security.AccessController.doPrivileged(
new java.security.PrivilegedAction<Void>() {
public Void run() {
System.loadLibrary("osx");
return null;
}
});
}
private static native <T> T nativeConvertAndRelease(final long ptr);

View File

@ -103,7 +103,13 @@ public final class KeychainStore extends KeyStoreSpi {
private static final int SALT_LEN = 20;
static {
java.security.AccessController.doPrivileged((PrivilegedAction<?>)new sun.security.action.LoadLibraryAction("osx"));
AccessController.doPrivileged(
new PrivilegedAction<Void>() {
public Void run() {
System.loadLibrary("osx");
return null;
}
});
try {
PKCS8ShroudedKeyBag_OID = new ObjectIdentifier(keyBag);
pbeWithSHAAnd3KeyTripleDESCBC_OID = new ObjectIdentifier(pbeWithSHAAnd3KeyTripleDESCBC);

View File

@ -26,17 +26,23 @@
package com.apple.concurrent;
final class LibDispatchNative {
static {
java.security.AccessController.doPrivileged((java.security.PrivilegedAction<?>)new sun.security.action.LoadLibraryAction("osx"));
}
static {
java.security.AccessController.doPrivileged(
new java.security.PrivilegedAction<Void>() {
public Void run() {
System.loadLibrary("osx");
return null;
}
});
}
static native boolean nativeIsDispatchSupported();
static native long nativeGetMainQueue();
static native long nativeCreateConcurrentQueue(int priority);
static native long nativeCreateSerialQueue(String name);
static native void nativeReleaseQueue(long nativeQueue);
static native void nativeExecuteAsync(long nativeQueue, Runnable task);
static native void nativeExecuteSync(long nativeQueue, Runnable task);
static native boolean nativeIsDispatchSupported();
static native long nativeGetMainQueue();
static native long nativeCreateConcurrentQueue(int priority);
static native long nativeCreateSerialQueue(String name);
static native void nativeReleaseQueue(long nativeQueue);
static native void nativeExecuteAsync(long nativeQueue, Runnable task);
static native void nativeExecuteSync(long nativeQueue, Runnable task);
private LibDispatchNative() { }
private LibDispatchNative() { }
}

View File

@ -28,7 +28,6 @@ package com.apple.eawt;
import java.awt.*;
import java.awt.peer.*;
import java.beans.Beans;
import java.security.PrivilegedAction;
import javax.swing.JMenuBar;
@ -59,7 +58,13 @@ public class Application {
static Application sApplication = null;
static {
java.security.AccessController.doPrivileged((PrivilegedAction<?>)new sun.security.action.LoadLibraryAction("awt"));
java.security.AccessController.doPrivileged(
new java.security.PrivilegedAction<Void>() {
public Void run() {
System.loadLibrary("awt");
return null;
}
});
checkSecurity();
if (!Beans.isDesignTime()) {

View File

@ -55,7 +55,13 @@ import java.io.*;
*/
public class FileManager {
static {
java.security.AccessController.doPrivileged((java.security.PrivilegedAction<?>)new sun.security.action.LoadLibraryAction("osx"));
java.security.AccessController.doPrivileged(
new java.security.PrivilegedAction<Void>() {
public Void run() {
System.loadLibrary("osx");
return null;
}
});
}
/**

View File

@ -30,6 +30,7 @@ import java.awt.image.BufferedImage;
import javax.swing.*;
import javax.swing.border.Border;
import javax.swing.plaf.UIResource;
import javax.swing.plaf.basic.BasicHTML;
import javax.swing.text.View;
@ -76,8 +77,11 @@ public abstract class AquaButtonLabeledUI extends AquaButtonToggleUI implements
protected void setThemeBorder(final AbstractButton b) {
super.setThemeBorder(b);
// Set the correct border
b.setBorder(AquaButtonBorder.getBevelButtonBorder());
Border border = b.getBorder();
if (border == null || border instanceof UIResource) {
// Set the correct border
b.setBorder(AquaButtonBorder.getBevelButtonBorder());
}
}
protected abstract AquaButtonBorder getPainter();

View File

@ -26,7 +26,6 @@
package com.apple.laf;
import java.io.*;
import java.security.PrivilegedAction;
import java.util.*;
import java.util.Map.Entry;
@ -57,7 +56,13 @@ class AquaFileView extends FileView {
static final int kLSItemInfoExtensionIsHidden = 0x00100000; /* Item has a hidden extension*/
static {
java.security.AccessController.doPrivileged((PrivilegedAction<?>)new sun.security.action.LoadLibraryAction("osxui"));
java.security.AccessController.doPrivileged(
new java.security.PrivilegedAction<Void>() {
public Void run() {
System.loadLibrary("osxui");
return null;
}
});
}
// TODO: Un-comment this out when the native version exists

View File

@ -134,10 +134,16 @@ public class AquaLookAndFeel extends BasicLookAndFeel {
* @see UIManager#setLookAndFeel
*/
public void initialize() {
java.security.AccessController.doPrivileged((PrivilegedAction<?>)new sun.security.action.LoadLibraryAction("osxui"));
java.security.AccessController.doPrivileged(new PrivilegedAction<Object>(){
java.security.AccessController.doPrivileged(new PrivilegedAction<Void>() {
public Void run() {
System.loadLibrary("osxui");
return null;
}
});
java.security.AccessController.doPrivileged(new PrivilegedAction<Void>(){
@Override
public Object run() {
public Void run() {
JRSUIControl.initJRSUI();
return null;
}
@ -244,6 +250,7 @@ public class AquaLookAndFeel extends BasicLookAndFeel {
*/
private void initResourceBundle(final UIDefaults table) {
table.setDefaultLocale(Locale.getDefault());
table.addResourceBundle(PKG_PREFIX + "resources.aqua");
try {
final ResourceBundle aquaProperties = MacOSXResourceBundle.getMacResourceBundle(PKG_PREFIX + "resources.aqua");
final Enumeration<String> propertyKeys = aquaProperties.getKeys();
@ -253,7 +260,6 @@ public class AquaLookAndFeel extends BasicLookAndFeel {
table.put(key, aquaProperties.getString(key));
}
} catch (final Exception e) {
table.addResourceBundle(PKG_PREFIX + "resources.aqua");
}
}

View File

@ -27,7 +27,6 @@ package com.apple.laf;
import java.awt.*;
import java.awt.image.BufferedImage;
import java.security.PrivilegedAction;
import javax.swing.plaf.UIResource;
@ -35,7 +34,13 @@ import com.apple.laf.AquaUtils.RecyclableSingleton;
public class AquaNativeResources {
static {
java.security.AccessController.doPrivileged((PrivilegedAction<?>)new sun.security.action.LoadLibraryAction("osxui"));
java.security.AccessController.doPrivileged(
new java.security.PrivilegedAction<Void>() {
public Void run() {
System.loadLibrary("osxui");
return null;
}
});
}
// TODO: removing CColorPaint for now

View File

@ -318,7 +318,7 @@ public class AquaTabbedPaneUI extends AquaTabbedPaneCopyFromBasicUI {
}
// not for the scrolling tabs
if (tabIndex >= 0) {
if (component == null && tabIndex >= 0) {
paintTitle(g2d, font, metrics, textRect, tabIndex, title);
}

View File

@ -28,7 +28,6 @@ package com.apple.laf;
import java.awt.*;
import java.awt.event.*;
import java.awt.peer.MenuComponentPeer;
import java.security.PrivilegedAction;
import java.util.Hashtable;
import javax.swing.*;
@ -38,7 +37,13 @@ import sun.lwawt.macosx.*;
class ScreenMenu extends Menu implements ContainerListener, ComponentListener, ScreenMenuPropertyHandler {
static {
java.security.AccessController.doPrivileged((PrivilegedAction<?>)new sun.security.action.LoadLibraryAction("awt"));
java.security.AccessController.doPrivileged(
new java.security.PrivilegedAction<Void>() {
public Void run() {
System.loadLibrary("awt");
return null;
}
});
}
// screen menu stuff

View File

@ -26,15 +26,19 @@
package com.apple.laf;
import java.awt.*;
import java.security.PrivilegedAction;
import javax.swing.*;
import sun.lwawt.macosx.CPlatformWindow;
class ScreenPopupFactory extends PopupFactory {
static {
java.security.AccessController.doPrivileged((PrivilegedAction<?>)new sun.security.action.LoadLibraryAction("osxui"));
java.security.AccessController.doPrivileged(
new java.security.PrivilegedAction<Void>() {
public Void run() {
System.loadLibrary("osxui");
return null;
}
});
}
static final Float TRANSLUCENT = new Float(248f/255f);

View File

@ -36,45 +36,45 @@
# support.
############ FILE CHOOSER STRINGS #############
FileChooser.fileDescriptionText=Generic File
FileChooser.directoryDescriptionText=Directory
FileChooser.newFolderErrorText=Error occured during folder creation
FileChooser.fileDescription.textAndMnemonic=Generic File
FileChooser.directoryDescription.textAndMnemonic=Directory
FileChooser.newFolderError.textAndMnemonic=Error occured during folder creation
FileChooser.newFolderErrorSeparator= :
FileChooser.acceptAllFileFilterText=All Files
FileChooser.cancelButtonText=Cancel
FileChooser.saveButtonText=Save
FileChooser.openButtonText=Open
FileChooser.saveDialogTitleText=Save
FileChooser.openDialogTitleText=Open
FileChooser.updateButtonText=Update
FileChooser.helpButtonText=Help
FileChooser.directoryOpenButtonText=Open
FileChooser.acceptAllFileFilter.textAndMnemonic=All Files
FileChooser.cancelButton.textAndMnemonic=Cancel
FileChooser.saveButton.textAndMnemonic=Save
FileChooser.openButton.textAndMnemonic=Open
FileChooser.saveDialogTitle.textAndMnemonic=Save
FileChooser.openDialogTitle.textAndMnemonic=Open
FileChooser.updateButton.textAndMnemonic=Update
FileChooser.helpButton.textAndMnemonic=Help
FileChooser.directoryOpenButton.textAndMnemonic=Open
# File Size Units
FileChooser.fileSizeKiloBytes={0} KB
FileChooser.fileSizeMegaBytes={0} MB
FileChooser.fileSizeGigaBytes={0} GB
// Mac-specific strings
FileChooser.saveTitleText=Save
FileChooser.openTitleText=Open
FileChooser.newFolderExistsErrorText=That name is already taken
FileChooser.chooseButtonText=Choose
# Mac-specific strings
FileChooser.saveTitle.textAndMnemonic=Save
FileChooser.openTitle.textAndMnemonic=Open
FileChooser.newFolderExistsError.textAndMnemonic=That name is already taken
FileChooser.chooseButton.textAndMnemonic=Choose
FileChooser.newFolderButtonText=New Folder
FileChooser.newFolderTitleText=New Folder
FileChooser.fileNameLabelText=File:
FileChooser.saveDialogFileNameLabelText=Save As:
FileChooser.filesOfTypeLabelText=File Format:
FileChooser.newFolderButton.textAndMnemonic=New Folder
FileChooser.newFolderTitle.textAndMnemonic=New Folder
FileChooser.fileNameLabel.textAndMnemonic=File:
FileChooser.saveDialogFileNameLabel.textAndMnemonic=Save As:
FileChooser.filesOfTypeLabel.textAndMnemonic=File Format:
FileChooser.desktopName=Desktop
FileChooser.newFolderPromptText=Name of new folder:
FileChooser.newFolderPrompt.textAndMnemonic=Name of new folder:
FileChooser.untitledFolderName=untitled folder
FileChooser.untitledFileName=untitled
FileChooser.createButtonText=Create
FileChooser.createButton.textAndMnemonic=Create
FileChooser.byDateText=Date Modified
FileChooser.byNameText=Name
FileChooser.byDate.textAndMnemonic=Date Modified
FileChooser.by.textAndMnemonic=Name
FileChooser.newFolderAccessibleName=New Folder
FileChooser.mac.newFolder=untitled folder
@ -82,76 +82,54 @@ FileChooser.mac.newFolder.subsequent=untitled folder {0}
############ COLOR CHOOSER STRINGS #############
ColorChooser.previewText=Preview
ColorChooser.okText=OK
ColorChooser.cancelText=Cancel
ColorChooser.resetText=Reset
# VK_XXX constant for 'ColorChooser.resetText' button to make mnemonic
ColorChooser.resetMnemonic=82
ColorChooser.sampleText=Sample Text Sample Text
ColorChooser.swatchesNameText=Swatches
ColorChooser.swatchesMnemonic=83
ColorChooser.swatchesDisplayedMnemonicIndex=0
ColorChooser.swatchesRecentText=Recent:
ColorChooser.hsbNameText=HSB
# Each of the ColorChooser types can define a mnemonic, as a KeyEvent.VK_XXX
# constant, and an index into the text to render the mnemonic as. The
# mnemonic is xxxMnemonic and the index of the character to underline is
# xxxDisplayedMnemonicIndex.
ColorChooser.hsbMnemonic=72
ColorChooser.hsbDisplayedMnemonicIndex=0
ColorChooser.hsbHueText=H
ColorChooser.hsbSaturationText=S
ColorChooser.hsbBrightnessText=B
ColorChooser.hsbRedText=R
ColorChooser.hsbGreenText=G
ColorChooser.hsbBlueText=B
ColorChooser.rgbNameText=RGB
ColorChooser.rgbMnemonic=71
ColorChooser.rgbDisplayedMnemonicIndex=1
ColorChooser.rgbRedText=Red
ColorChooser.rgbRedMnemonic=68
ColorChooser.rgbGreenText=Green
ColorChooser.rgbGreenMnemonic=78
ColorChooser.rgbBlueText=Blue
ColorChooser.rgbBlueMnemonic=66
ColorChooser.preview.textAndMnemonic=Preview
ColorChooser.ok.textAndMnemonic=OK
ColorChooser.cancel.textAndMnemonic=Cancel
ColorChooser.reset.textAndMnemonic=&Reset
ColorChooser.sample.textAndMnemonic=Sample Text Sample Text
ColorChooser.swatches.textAndMnemonic=&Swatches
ColorChooser.swatchesRecent.textAndMnemonic=Recent:
ColorChooser.hsb.textAndMnemonic=&HSB
ColorChooser.hsbHue.textAndMnemonic=H
ColorChooser.hsbSaturation.textAndMnemonic=S
ColorChooser.hsbBrightness.textAndMnemonic=B
ColorChooser.hsbRed.textAndMnemonic=R
ColorChooser.hsbGreen.textAndMnemonic=G
ColorChooser.hsbBlue.textAndMnemonic=B
ColorChooser.rgb.textAndMnemonic=R&GB
ColorChooser.rgbRed.textAndMnemonic=Re&d
ColorChooser.rgbGreen.textAndMnemonic=Gree&n
ColorChooser.rgbBlue.textAndMnemonic=&Blue
############ OPTION PANE STRINGS #############
# Mnemonic keys correspond to KeyEvent.VK_XXX constant
# We only define mnemonics for YES/NO, but for completeness you can
# define mnemonics for any of the buttons.
OptionPane.yesButtonText=Yes
OptionPane.yesButtonMnemonic=89
OptionPane.noButtonText=No
OptionPane.noButtonMnemonic=78
OptionPane.okButtonText=OK
OptionPane.okButtonMnemonic=0
OptionPane.cancelButtonText=Cancel
OptionPane.cancelButtonMnemonic=0
OptionPane.titleText=Select an Option
OptionPane.yesButton.textAndMnemonic=&Yes
OptionPane.noButton.textAndMnemonic=&No
OptionPane.okButton.textAndMnemonic=OK
OptionPane.cancelButton.textAndMnemonic=Cancel
OptionPane.title.textAndMnemonic=Select an Option
# Title for the dialog for the showInputDialog methods. Only used if
# the developer uses one of the variants that doesn't take a title.
OptionPane.inputDialogTitle=Input
OptionPane.inputDialog.titleAndMnemonic=Input
# Title for the dialog for the showMessageDialog methods. Only used if
# the developer uses one of the variants that doesn't take a title.
OptionPane.messageDialogTitle=Message
OptionPane.messageDialog.titleAndMnemonic=Message
############ Printing Dialog Strings ############
PrintingDialog.titleProgressText=Printing
PrintingDialog.titleAbortingText=Printing (Aborting)
PrintingDialog.titleProgress.textAndMnemonic=Printing
PrintingDialog.titleAborting.textAndMnemonic=Printing (Aborting)
PrintingDialog.contentInitialText=Printing in progress...
PrintingDialog.contentInitial.textAndMnemonic=Printing in progress...
# The following string will be formatted by a MessageFormat
# and {0} will be replaced by page number being printed
PrintingDialog.contentProgressText=Printed page {0}...
PrintingDialog.contentProgress.textAndMnemonic=Printed page {0}...
PrintingDialog.contentAbortingText=Printing aborting...
PrintingDialog.contentAborting.textAndMnemonic=Printing aborting...
PrintingDialog.abortButtonText=Abort
PrintingDialog.abortButtonMnemonic=65
PrintingDialog.abortButtonDisplayedMnemonicIndex=0
PrintingDialog.abortButtonToolTipText=Abort Printing
PrintingDialog.abortButton.textAndMnemonic=&Abort
PrintingDialog.abortButtonToolTip.textAndMnemonic=Abort Printing
############ Internal Frame Strings ############
InternalFrame.iconButtonToolTip=Minimize
@ -160,42 +138,42 @@ InternalFrame.restoreButtonToolTip=Restore
InternalFrame.closeButtonToolTip=Close
############ Internal Frame Title Pane Strings ############
InternalFrameTitlePane.restoreButtonText=Restore
InternalFrameTitlePane.moveButtonText=Move
InternalFrameTitlePane.sizeButtonText=Size
InternalFrameTitlePane.minimizeButtonText=Minimize
InternalFrameTitlePane.maximizeButtonText=Maximize
InternalFrameTitlePane.closeButtonText=Close
InternalFrameTitlePane.restoreButton.textAndMnemonic=Restore
InternalFrameTitlePane.moveButton.textAndMnemonic=Move
InternalFrameTitlePane.sizeButton.textAndMnemonic=Size
InternalFrameTitlePane.minimizeButton.textAndMnemonic=Minimize
InternalFrameTitlePane.maximizeButton.textAndMnemonic=Maximize
InternalFrameTitlePane.closeButton.textAndMnemonic=Close
############ Text strings #############
# Used for html forms
FormView.submitButtonText=Submit Query
FormView.resetButtonText=Reset
FormView.browseFileButtonText=Browse...
FormView.submitButton.textAndMnemonic=Submit Query
FormView.resetButton.textAndMnemonic=Reset
FormView.browseFileButton.textAndMnemonic=Browse...
############ Abstract Document Strings ############
AbstractDocument.styleChangeText=style change
AbstractDocument.additionText=addition
AbstractDocument.deletionText=deletion
AbstractDocument.undoText=Undo
AbstractDocument.redoText=Redo
AbstractDocument.styleChange.textAndMnemonic=style change
AbstractDocument.addition.textAndMnemonic=addition
AbstractDocument.deletion.textAndMnemonic=deletion
AbstractDocument.undo.textAndMnemonic=Undo
AbstractDocument.redo.textAndMnemonic=Redo
############ Abstract Button Strings ############
AbstractButton.clickText=click
AbstractButton.click.textAndMnemonic=click
############ Abstract Undoable Edit Strings ############
AbstractUndoableEdit.undoText=Undo
AbstractUndoableEdit.redoText=Redo
AbstractUndoableEdit.undo.textAndMnemonic=Undo
AbstractUndoableEdit.redo.textAndMnemonic=Redo
############ Combo Box Strings ############
ComboBox.togglePopupText=togglePopup
ComboBox.togglePopup.textAndMnemonic=togglePopup
############ Progress Monitor Strings ############
ProgressMonitor.progressText=Progress...
ProgressMonitor.progress.textAndMnemonic=Progress...
############ Split Pane Strings ############
SplitPane.leftButtonText=left button
SplitPane.rightButtonText=right button
SplitPane.leftButton.textAndMnemonic=left button
SplitPane.rightButton.textAndMnemonic=right button
# Used for Isindex
IsindexView.prompt=This is a searchable index. Enter search keywords:

View File

@ -25,6 +25,8 @@
package java.util.prefs;
import java.util.Objects;
class MacOSXPreferences extends AbstractPreferences {
// fixme need security checks?
@ -133,25 +135,30 @@ class MacOSXPreferences extends AbstractPreferences {
// AbstractPreferences implementation
@Override
protected void putSpi(String key, String value)
{
file.addKeyToNode(path, key, value);
}
// AbstractPreferences implementation
@Override
protected String getSpi(String key)
{
return file.getKeyFromNode(path, key);
}
// AbstractPreferences implementation
@Override
protected void removeSpi(String key)
{
Objects.requireNonNull(key, "Specified key cannot be null");
file.removeKeyFromNode(path, key);
}
// AbstractPreferences implementation
@Override
protected void removeNodeSpi()
throws BackingStoreException
{
@ -171,6 +178,7 @@ class MacOSXPreferences extends AbstractPreferences {
// AbstractPreferences implementation
@Override
protected String[] childrenNamesSpi()
throws BackingStoreException
{
@ -180,6 +188,7 @@ class MacOSXPreferences extends AbstractPreferences {
}
// AbstractPreferences implementation
@Override
protected String[] keysSpi()
throws BackingStoreException
{
@ -189,6 +198,7 @@ class MacOSXPreferences extends AbstractPreferences {
}
// AbstractPreferences implementation
@Override
protected AbstractPreferences childSpi(String name)
{
// Add to parent's child list here and disallow sync
@ -200,6 +210,7 @@ class MacOSXPreferences extends AbstractPreferences {
}
// AbstractPreferences override
@Override
public void flush()
throws BackingStoreException
{
@ -214,6 +225,7 @@ class MacOSXPreferences extends AbstractPreferences {
}
// AbstractPreferences implementation
@Override
protected void flushSpi()
throws BackingStoreException
{
@ -221,6 +233,7 @@ class MacOSXPreferences extends AbstractPreferences {
}
// AbstractPreferences override
@Override
public void sync()
throws BackingStoreException
{
@ -228,13 +241,20 @@ class MacOSXPreferences extends AbstractPreferences {
if (isRemoved())
throw new IllegalStateException("Node has been removed");
// fixme! overkill
if (!MacOSXPreferencesFile.syncWorld()) {
throw new BackingStoreException("Synchronization failed for node '" + path + "'");
if (isUser) {
if (!MacOSXPreferencesFile.syncUser()) {
throw new BackingStoreException("Synchronization failed for node '" + path + "'");
}
} else {
if (!MacOSXPreferencesFile.syncWorld()) {
throw new BackingStoreException("Synchronization failed for node '" + path + "'");
}
}
}
}
// AbstractPreferences implementation
@Override
protected void syncSpi()
throws BackingStoreException
{

View File

@ -26,10 +26,12 @@
package java.util.prefs;
class MacOSXPreferencesFactory implements PreferencesFactory {
@Override
public Preferences userRoot() {
return MacOSXPreferences.getUserRoot();
}
@Override
public Preferences systemRoot() {
return MacOSXPreferences.getSystemRoot();
}

View File

@ -79,7 +79,13 @@ import java.lang.ref.WeakReference;
class MacOSXPreferencesFile {
static {
java.security.AccessController.doPrivileged(new sun.security.action.LoadLibraryAction("osx"));
java.security.AccessController.doPrivileged(
new java.security.PrivilegedAction<Void>() {
public Void run() {
System.loadLibrary("osx");
return null;
}
});
}
private class FlushTask extends TimerTask {
@ -95,9 +101,10 @@ class MacOSXPreferencesFile {
}
// Maps string -> weak reference to MacOSXPreferencesFile
private static HashMap cachedFiles = null;
private static HashMap<String, WeakReference<MacOSXPreferencesFile>>
cachedFiles;
// Files that may have unflushed changes
private static HashSet changedFiles = null;
private static HashSet<MacOSXPreferencesFile> changedFiles;
// Timer and pending sync and flush tasks (which are both scheduled
@ -130,13 +137,14 @@ class MacOSXPreferencesFile {
{
MacOSXPreferencesFile result = null;
if (cachedFiles == null) cachedFiles = new HashMap();
if (cachedFiles == null)
cachedFiles = new HashMap<>();
String hashkey =
newName + String.valueOf(isUser);
WeakReference hashvalue = (WeakReference)cachedFiles.get(hashkey);
WeakReference<MacOSXPreferencesFile> hashvalue = cachedFiles.get(hashkey);
if (hashvalue != null) {
result = (MacOSXPreferencesFile)hashvalue.get();
result = hashvalue.get();
}
if (result == null) {
// Java user node == CF current user, any host
@ -144,7 +152,7 @@ class MacOSXPreferencesFile {
result = new MacOSXPreferencesFile(newName,
isUser ? cfCurrentUser : cfAnyUser,
isUser ? cfAnyHost : cfCurrentHost);
cachedFiles.put(hashkey, new WeakReference(result));
cachedFiles.put(hashkey, new WeakReference<MacOSXPreferencesFile>(result));
}
// Don't schedule this file for flushing until some nodes or
@ -165,10 +173,11 @@ class MacOSXPreferencesFile {
boolean ok = true;
if (cachedFiles != null && !cachedFiles.isEmpty()) {
Iterator iter = cachedFiles.values().iterator();
Iterator<WeakReference<MacOSXPreferencesFile>> iter =
cachedFiles.values().iterator();
while (iter.hasNext()) {
WeakReference ref = (WeakReference)iter.next();
MacOSXPreferencesFile f = (MacOSXPreferencesFile)ref.get();
WeakReference<MacOSXPreferencesFile> ref = iter.next();
MacOSXPreferencesFile f = ref.get();
if (f != null) {
if (!f.synchronize()) ok = false;
} else {
@ -192,6 +201,40 @@ class MacOSXPreferencesFile {
}
// Sync only current user preferences
static synchronized boolean syncUser() {
boolean ok = true;
if (cachedFiles != null && !cachedFiles.isEmpty()) {
Iterator<WeakReference<MacOSXPreferencesFile>> iter =
cachedFiles.values().iterator();
while (iter.hasNext()) {
WeakReference<MacOSXPreferencesFile> ref = iter.next();
MacOSXPreferencesFile f = ref.get();
if (f != null && f.user == cfCurrentUser) {
if (!f.synchronize()) {
ok = false;
}
} else {
iter.remove();
}
}
}
// Remove synchronized file from changed file list. The changed files were
// guaranteed to have been in the cached file list (because there was a strong
// reference from changedFiles.
if (changedFiles != null) {
Iterator<MacOSXPreferencesFile> iterChanged = changedFiles.iterator();
while (iterChanged.hasNext()) {
MacOSXPreferencesFile f = iterChanged.next();
if (f != null && f.user == cfCurrentUser)
iterChanged.remove();
}
}
return ok;
}
// Write all prefs changes to disk, but do not clear all cached prefs
// values. Also kills any scheduled flush task.
// There's no CFPreferencesFlush() (<rdar://problem/3049129>), so lots of cached prefs
@ -201,12 +244,10 @@ class MacOSXPreferencesFile {
boolean ok = true;
if (changedFiles != null && !changedFiles.isEmpty()) {
Iterator iter = changedFiles.iterator();
while (iter.hasNext()) {
MacOSXPreferencesFile f = (MacOSXPreferencesFile)iter.next();
if (!f.synchronize()) ok = false;
for (MacOSXPreferencesFile f : changedFiles) {
if (!f.synchronize())
ok = false;
}
changedFiles.clear();
}
@ -224,7 +265,8 @@ class MacOSXPreferencesFile {
private void markChanged()
{
// Add this file to the changed file list
if (changedFiles == null) changedFiles = new HashSet();
if (changedFiles == null)
changedFiles = new HashSet<>();
changedFiles.add(this);
// Schedule a new flush and a shutdown hook, if necessary
@ -270,7 +312,9 @@ class MacOSXPreferencesFile {
if (syncInterval > 0) {
timer().schedule(new TimerTask() {
public void run() { MacOSXPreferencesFile.syncWorld();}
@Override
public void run() {
MacOSXPreferencesFile.syncWorld();}
}, syncInterval * 1000, syncInterval * 1000);
} else {
// syncInterval property not set. No sync timer ever.
@ -284,6 +328,7 @@ class MacOSXPreferencesFile {
if (timer == null) {
timer = new Timer(true); // daemon
Thread flushThread = new Thread() {
@Override
public void run() {
flushWorld();
}

View File

@ -40,7 +40,7 @@ public class CGraphicsDevice extends GraphicsDevice {
private final int displayID;
// Array of all GraphicsConfig instances for this device
private final CGraphicsConfig[] configs;
private final GraphicsConfiguration[] configs;
// Default config (temporarily hard coded)
private final int DEFAULT_CONFIG = 0;
@ -49,7 +49,7 @@ public class CGraphicsDevice extends GraphicsDevice {
public CGraphicsDevice(int displayID) {
this.displayID = displayID;
configs = new CGraphicsConfig[] {
configs = new GraphicsConfiguration[] {
CGLGraphicsConfig.getConfig(this, 0)
};
}
@ -66,7 +66,7 @@ public class CGraphicsDevice extends GraphicsDevice {
*/
@Override
public GraphicsConfiguration[] getConfigurations() {
return configs;
return configs.clone();
}
/**

View File

@ -58,9 +58,15 @@ public class CGraphicsEnvironment extends SunGraphicsEnvironment {
public static void init() { }
static {
java.security.AccessController.doPrivileged(new sun.security.action.LoadLibraryAction("awt"));
java.security.AccessController.doPrivileged(new java.security.PrivilegedAction<Object>() {
public Object run() {
java.security.AccessController.doPrivileged(new java.security.PrivilegedAction<Void>() {
public Void run() {
System.loadLibrary("awt");
return null;
}
});
java.security.AccessController.doPrivileged(new java.security.PrivilegedAction<Void>() {
public Void run() {
if (isHeadless()) return null;
initCocoa();
return null;

View File

@ -56,6 +56,8 @@ import sun.java2d.SunGraphics2D;
import sun.java2d.opengl.OGLRenderQueue;
import sun.java2d.pipe.Region;
import sun.util.logging.PlatformLogger;
import javax.swing.JComponent;
import javax.swing.SwingUtilities;
import javax.swing.RepaintManager;
@ -65,7 +67,10 @@ import sun.lwawt.macosx.CDropTarget;
import com.sun.java.swing.SwingUtilities3;
public abstract class LWComponentPeer<T extends Component, D extends JComponent>
implements ComponentPeer, DropTargetPeer {
implements ComponentPeer, DropTargetPeer
{
private static final PlatformLogger focusLog = PlatformLogger.getLogger("sun.lwawt.focus.LWComponentPeer");
// State lock is to be used for modifications to this
// peer's fields (e.g. bounds, background, font, etc.)
// It should be the last lock in the lock chain
@ -372,7 +377,7 @@ public abstract class LWComponentPeer<T extends Component, D extends JComponent>
}
@Override
public void dispose() {
public final void dispose() {
if (disposed.compareAndSet(false, true)) {
disposeImpl();
}
@ -885,7 +890,13 @@ public abstract class LWComponentPeer<T extends Component, D extends JComponent>
@Override
public boolean requestFocus(Component lightweightChild, boolean temporary,
boolean focusedWindowChangeAllowed, long time,
CausedFocusEvent.Cause cause) {
CausedFocusEvent.Cause cause)
{
if (focusLog.isLoggable(PlatformLogger.FINEST)) {
focusLog.finest("lightweightChild=" + lightweightChild + ", temporary=" + temporary +
", focusedWindowChangeAllowed=" + focusedWindowChangeAllowed +
", time= " + time + ", cause=" + cause);
}
if (LWKeyboardFocusManagerPeer.getInstance(getAppContext()).
processSynchronousLightweightTransfer(getTarget(), lightweightChild, temporary,
focusedWindowChangeAllowed, time)) {
@ -901,19 +912,44 @@ public abstract class LWComponentPeer<T extends Component, D extends JComponent>
case LWKeyboardFocusManagerPeer.SNFH_SUCCESS_PROCEED:
Window parentWindow = SunToolkit.getContainingWindow(getTarget());
if (parentWindow == null) {
focusLog.fine("request rejected, parentWindow is null");
LWKeyboardFocusManagerPeer.removeLastFocusRequest(getTarget());
return false;
}
LWWindowPeer parentPeer = (LWWindowPeer) parentWindow.getPeer();
if (parentPeer == null) {
focusLog.fine("request rejected, parentPeer is null");
LWKeyboardFocusManagerPeer.removeLastFocusRequest(getTarget());
return false;
}
// A fix for 7145768. Ensure the parent window is currently natively focused.
// The more evident place to perform this check is in KFM.shouldNativelyFocusHeavyweight,
// however that is the shared code and this particular problem's reproducibility has
// platform specifics. So, it was decided to narrow down the fix to lwawt (OSX) in
// current release. TODO: consider fixing it in the shared code.
if (!focusedWindowChangeAllowed) {
LWWindowPeer decoratedPeer = parentPeer.isSimpleWindow() ?
LWWindowPeer.getOwnerFrameDialog(parentPeer) : parentPeer;
if (decoratedPeer == null || !decoratedPeer.getPlatformWindow().isActive()) {
if (focusLog.isLoggable(PlatformLogger.FINE)) {
focusLog.fine("request rejected, focusedWindowChangeAllowed==false, " +
"decoratedPeer is inactive: " + decoratedPeer);
}
LWKeyboardFocusManagerPeer.removeLastFocusRequest(getTarget());
return false;
}
}
boolean res = parentPeer.requestWindowFocus(cause);
// If parent window can be made focused and has been made focused (synchronously)
// then we can proceed with children, otherwise we retreat
if (!res || !parentWindow.isFocused()) {
if (focusLog.isLoggable(PlatformLogger.FINE)) {
focusLog.fine("request rejected, res= " + res + ", parentWindow.isFocused()=" +
parentWindow.isFocused());
}
LWKeyboardFocusManagerPeer.removeLastFocusRequest(getTarget());
return false;
}
@ -940,8 +976,8 @@ public abstract class LWComponentPeer<T extends Component, D extends JComponent>
@Override
public Image createImage(int w, int h) {
// TODO: accelerated image
return getGraphicsConfiguration().createCompatibleImage(w, h);
CGraphicsConfig gc = (CGraphicsConfig)getGraphicsConfiguration();
return gc.createAcceleratedImage(getTarget(), w, h);
}
@Override

View File

@ -88,20 +88,20 @@ public abstract class LWCursorManager {
} else {
cursor = (c != null) ? c.getCursor() : null;
}
// TODO: default cursor for modal blocked windows
setCursor(cursor);
}
/**
* Returns the first visible, enabled and showing component under cursor.
* Returns null for modal blocked windows.
*
* @param cursorPos Current cursor position.
* @return Component
* @return Component or null.
*/
private static final Component findComponent(final Point cursorPos) {
final LWComponentPeer<?, ?> peer = LWWindowPeer.getPeerUnderCursor();
Component c = null;
if (peer != null) {
if (peer != null && peer.getWindowPeerOrSelf().getBlocker() == null) {
c = peer.getTarget();
if (c instanceof Container) {
final Point p = peer.getLocationOnScreen();

View File

@ -210,6 +210,15 @@ final class LWTextAreaPeer
super();
}
@Override
public void replaceSelection(String content) {
getDocument().removeDocumentListener(LWTextAreaPeer.this);
super.replaceSelection(content);
// post only one text event in this case
postTextEvent();
getDocument().addDocumentListener(LWTextAreaPeer.this);
}
@Override
public boolean hasFocus() {
return getTarget().hasFocus();

View File

@ -81,6 +81,18 @@ abstract class LWTextComponentPeer<T extends TextComponent, D extends JComponent
firstChangeSkipped = true;
}
@Override
protected final void disposeImpl() {
synchronized (getDelegateLock()) {
// visible caret has a timer thread which must be stopped
getTextComponent().getCaret().setVisible(false);
}
super.disposeImpl();
}
/**
* This method should be called under getDelegateLock().
*/
abstract JTextComponent getTextComponent();
public Dimension getPreferredSize(final int rows, final int columns) {
@ -187,7 +199,7 @@ abstract class LWTextComponentPeer<T extends TextComponent, D extends JComponent
}
}
private void sendTextEvent(final DocumentEvent e) {
protected final void postTextEvent() {
postEvent(new TextEvent(getTarget(), TextEvent.TEXT_VALUE_CHANGED));
synchronized (getDelegateLock()) {
revalidate();
@ -196,17 +208,17 @@ abstract class LWTextComponentPeer<T extends TextComponent, D extends JComponent
@Override
public final void changedUpdate(final DocumentEvent e) {
sendTextEvent(e);
postTextEvent();
}
@Override
public final void insertUpdate(final DocumentEvent e) {
sendTextEvent(e);
postTextEvent();
}
@Override
public final void removeUpdate(final DocumentEvent e) {
sendTextEvent(e);
postTextEvent();
}
@Override

View File

@ -95,7 +95,7 @@ final class LWTextFieldPeer
@Override
public void actionPerformed(final ActionEvent e) {
postEvent(new ActionEvent(getTarget(), ActionEvent.ACTION_PERFORMED,
getText(), e.getWhen(), e.getModifiers()));
getText(), e.getWhen(), e.getModifiers()));
}
/**
@ -121,6 +121,15 @@ final class LWTextFieldPeer
super();
}
@Override
public void replaceSelection(String content) {
getDocument().removeDocumentListener(LWTextFieldPeer.this);
super.replaceSelection(content);
// post only one text event in this case
postTextEvent();
getDocument().addDocumentListener(LWTextFieldPeer.this);
}
@Override
public boolean hasFocus() {
return getTarget().hasFocus();

View File

@ -50,7 +50,7 @@ public class LWWindowPeer
EMBEDDEDFRAME
}
private static final sun.util.logging.PlatformLogger focusLog = PlatformLogger.getLogger("sun.lwawt.focus.LWWindowPeer");
private static final PlatformLogger focusLog = PlatformLogger.getLogger("sun.lwawt.focus.LWWindowPeer");
private PlatformWindow platformWindow;
@ -101,8 +101,6 @@ public class LWWindowPeer
// events between MOUSE_PRESSED and MOUSE_RELEASED for particular button
private static int mouseClickButtons = 0;
private volatile boolean cachedFocusableWindow;
private volatile boolean isOpaque = true;
private static final Font DEFAULT_FONT = new Font("Lucida Grande", Font.PLAIN, 13);
@ -172,8 +170,6 @@ public class LWWindowPeer
setAlwaysOnTop(getTarget().isAlwaysOnTop());
updateMinimumSize();
cachedFocusableWindow = getTarget().isFocusableWindow();
setOpacity(getTarget().getOpacity());
setOpaque(getTarget().isOpaque());
@ -245,15 +241,17 @@ public class LWWindowPeer
getInstance(getAppContext());
if (visible) {
updateFocusableWindowState();
changeFocusedWindow(true, true);
if (!getTarget().isAutoRequestFocus()) {
return;
} else {
requestWindowFocus(CausedFocusEvent.Cause.ACTIVATION);
}
// Focus the owner in case this window is focused.
} else if (manager.getCurrentFocusedWindow() == getTarget()) {
// Transfer focus to the owner.
LWWindowPeer owner = getOwnerFrameDialog(LWWindowPeer.this);
if (owner != null) {
// KFM will do all the rest.
owner.changeFocusedWindow(true, false);
owner.requestWindowFocus(CausedFocusEvent.Cause.ACTIVATION);
}
}
}
@ -400,7 +398,6 @@ public class LWWindowPeer
@Override
public void updateFocusableWindowState() {
cachedFocusableWindow = getTarget().isFocusableWindow();
platformWindow.updateFocusableWindowState();
}
@ -409,6 +406,8 @@ public class LWWindowPeer
synchronized (getPeerTreeLock()) {
this.blocker = blocked ? (LWWindowPeer)blocker.getPeer() : null;
}
platformWindow.setModalBlocked(blocked);
}
@Override
@ -617,7 +616,7 @@ public class LWWindowPeer
}
public void notifyActivation(boolean activation) {
changeFocusedWindow(activation, false);
changeFocusedWindow(activation);
}
// MouseDown in non-client area
@ -669,39 +668,42 @@ public class LWWindowPeer
}
} else {
if (targetPeer != lastMouseEventPeer) {
// lastMouseEventPeer may be null if mouse was out of Java windows
if (lastMouseEventPeer != null && lastMouseEventPeer.isEnabled()) {
// Sometimes, MOUSE_EXITED is not sent by delegate (or is sent a bit
// later), in which case lastWindowPeer is another window
if (lastWindowPeer != this) {
Point oldp = lastMouseEventPeer.windowToLocal(x, y, lastWindowPeer);
// Additionally translate from this to lastWindowPeer coordinates
Rectangle lr = lastWindowPeer.getBounds();
oldp.x += r.x - lr.x;
oldp.y += r.y - lr.y;
postEvent(new MouseEvent(lastMouseEventPeer.getTarget(),
MouseEvent.MOUSE_EXITED,
if (id != MouseEvent.MOUSE_DRAGGED || lastMouseEventPeer == null) {
// lastMouseEventPeer may be null if mouse was out of Java windows
if (lastMouseEventPeer != null && lastMouseEventPeer.isEnabled()) {
// Sometimes, MOUSE_EXITED is not sent by delegate (or is sent a bit
// later), in which case lastWindowPeer is another window
if (lastWindowPeer != this) {
Point oldp = lastMouseEventPeer.windowToLocal(x, y, lastWindowPeer);
// Additionally translate from this to lastWindowPeer coordinates
Rectangle lr = lastWindowPeer.getBounds();
oldp.x += r.x - lr.x;
oldp.y += r.y - lr.y;
postEvent(new MouseEvent(lastMouseEventPeer.getTarget(),
MouseEvent.MOUSE_EXITED,
when, modifiers,
oldp.x, oldp.y, screenX, screenY,
clickCount, popupTrigger, button));
} else {
Point oldp = lastMouseEventPeer.windowToLocal(x, y, this);
postEvent(new MouseEvent(lastMouseEventPeer.getTarget(),
MouseEvent.MOUSE_EXITED,
when, modifiers,
oldp.x, oldp.y, screenX, screenY,
clickCount, popupTrigger, button));
}
}
if (targetPeer != null && targetPeer.isEnabled() && id != MouseEvent.MOUSE_ENTERED) {
Point newp = targetPeer.windowToLocal(x, y, curWindowPeer);
postEvent(new MouseEvent(targetPeer.getTarget(),
MouseEvent.MOUSE_ENTERED,
when, modifiers,
oldp.x, oldp.y, screenX, screenY,
clickCount, popupTrigger, button));
} else {
Point oldp = lastMouseEventPeer.windowToLocal(x, y, this);
postEvent(new MouseEvent(lastMouseEventPeer.getTarget(),
MouseEvent.MOUSE_EXITED,
when, modifiers,
oldp.x, oldp.y, screenX, screenY,
newp.x, newp.y, screenX, screenY,
clickCount, popupTrigger, button));
}
}
lastMouseEventPeer = targetPeer;
if (targetPeer != null && targetPeer.isEnabled() && id != MouseEvent.MOUSE_ENTERED) {
Point newp = targetPeer.windowToLocal(x, y, curWindowPeer);
postEvent(new MouseEvent(targetPeer.getTarget(),
MouseEvent.MOUSE_ENTERED,
when, modifiers,
newp.x, newp.y, screenX, screenY,
clickCount, popupTrigger, button));
}
}
// TODO: fill "bdata" member of AWTEvent
@ -1060,6 +1062,10 @@ public class LWWindowPeer
return lastMouseEventPeer;
}
/*
* Requests platform to set native focus on a frame/dialog.
* In case of a simple window, triggers appropriate java focus change.
*/
public boolean requestWindowFocus(CausedFocusEvent.Cause cause) {
if (focusLog.isLoggable(PlatformLogger.FINE)) {
focusLog.fine("requesting native focus to " + this);
@ -1103,14 +1109,14 @@ public class LWWindowPeer
}
// DKFM will synthesize all the focus/activation events correctly.
changeFocusedWindow(true, false);
changeFocusedWindow(true);
return true;
// In case the toplevel is active but not focused, change focus directly,
// as requesting native focus on it will not have effect.
} else if (getTarget() == currentActive && !getTarget().hasFocus()) {
changeFocusedWindow(true, false);
changeFocusedWindow(true);
return true;
}
return platformWindow.requestWindowFocus();
@ -1119,7 +1125,19 @@ public class LWWindowPeer
private boolean focusAllowedFor() {
Window window = getTarget();
// TODO: check if modal blocked
return window.isVisible() && window.isEnabled() && window.isFocusableWindow();
return window.isVisible() && window.isEnabled() && isFocusableWindow();
}
private boolean isFocusableWindow() {
boolean focusable = getTarget().isFocusableWindow();
if (isSimpleWindow()) {
LWWindowPeer ownerPeer = getOwnerFrameDialog(this);
if (ownerPeer == null) {
return false;
}
return focusable && ownerPeer.getTarget().isFocusableWindow();
}
return focusable;
}
public boolean isSimpleWindow() {
@ -1128,19 +1146,19 @@ public class LWWindowPeer
}
/*
* "Delegates" the responsibility of managing focus to keyboard focus manager.
* Changes focused window on java level.
*/
private void changeFocusedWindow(boolean becomesFocused, boolean isShowing) {
private void changeFocusedWindow(boolean becomesFocused) {
if (focusLog.isLoggable(PlatformLogger.FINE)) {
focusLog.fine((becomesFocused?"gaining":"loosing") + " focus window: " + this);
}
if (isShowing && !getTarget().isAutoRequestFocus() || skipNextFocusChange) {
if (skipNextFocusChange) {
focusLog.fine("skipping focus change");
skipNextFocusChange = false;
return;
}
if (!cachedFocusableWindow) {
if (!isFocusableWindow() && becomesFocused) {
focusLog.fine("the window is not focusable");
return;
}
if (becomesFocused) {
@ -1179,7 +1197,7 @@ public class LWWindowPeer
postEvent(windowEvent);
}
private static LWWindowPeer getOwnerFrameDialog(LWWindowPeer peer) {
static LWWindowPeer getOwnerFrameDialog(LWWindowPeer peer) {
Window owner = (peer != null ? peer.getTarget().getOwner() : null);
while (owner != null && !(owner instanceof Frame || owner instanceof Dialog)) {
owner = owner.getOwner();

View File

@ -108,6 +108,8 @@ public interface PlatformWindow {
public void flip(int x1, int y1, int x2, int y2,
BufferCapabilities.FlipContents flipAction);
public void setModalBlocked(boolean blocked);
public void toFront();
public void toBack();

View File

@ -29,7 +29,6 @@ import java.awt.*;
import java.beans.*;
import java.lang.reflect.Field;
import java.lang.reflect.InvocationTargetException;
import java.security.PrivilegedAction;
import java.util.*;
import java.util.concurrent.Callable;
@ -41,7 +40,13 @@ class CAccessibility implements PropertyChangeListener {
static {
// Need to load the native library for this code.
java.security.AccessController.doPrivileged((PrivilegedAction<?>)new sun.security.action.LoadLibraryAction("awt"));
java.security.AccessController.doPrivileged(
new java.security.PrivilegedAction<Void>() {
public Void run() {
System.loadLibrary("awt");
return null;
}
});
}
static CAccessibility sAccessibility;

View File

@ -36,6 +36,7 @@ final class CCursorManager extends LWCursorManager {
private static native Point2D nativeGetCursorPosition();
private static native void nativeSetBuiltInCursor(final int type, final String name);
private static native void nativeSetCustomCursor(final long imgPtr, final double x, final double y);
public static native void nativeSetAllowsCursorSetInBackground(final boolean allows);
private static final int NAMED_CURSOR = -1;

View File

@ -76,6 +76,12 @@ public class CEmbeddedFrame extends EmbeddedFrame {
int screenX = locationOnScreen.x + x;
int screenY = locationOnScreen.y + y;
if (eventType == CocoaConstants.NPCocoaEventMouseEntered) {
CCursorManager.nativeSetAllowsCursorSetInBackground(true);
} else if (eventType == CocoaConstants.NPCocoaEventMouseExited) {
CCursorManager.nativeSetAllowsCursorSetInBackground(false);
}
responder.handleMouseEvent(eventType, modifierFlags, buttonNumber,
clickCount, x, y, screenX, screenY);
}
@ -106,28 +112,19 @@ public class CEmbeddedFrame extends EmbeddedFrame {
public void handleFocusEvent(boolean focused) {
this.focused = focused;
updateOverlayWindowActiveState();
if (parentWindowActive) {
responder.handleWindowFocusEvent(focused);
}
}
public void handleWindowFocusEvent(boolean parentWindowActive) {
this.parentWindowActive = parentWindowActive;
updateOverlayWindowActiveState();
if (focused) {
responder.handleWindowFocusEvent(parentWindowActive);
}
}
public boolean isParentWindowActive() {
return parentWindowActive;
}
/*
* May change appearance of contents of window, and generate a
* WINDOW_ACTIVATED event.
*/
private void updateOverlayWindowActiveState() {
final boolean showAsFocused = parentWindowActive && focused;
dispatchEvent(
new FocusEvent(this, showAsFocused ?
FocusEvent.FOCUS_GAINED :
FocusEvent.FOCUS_LOST));
}
}

View File

@ -34,6 +34,7 @@ import java.util.List;
import java.io.*;
import sun.awt.CausedFocusEvent.Cause;
import sun.awt.AWTAccessor;
import sun.java2d.pipe.Region;
class CFileDialog implements FileDialogPeer {
@ -53,33 +54,40 @@ class CFileDialog implements FileDialogPeer {
title = " ";
}
String userFileName = nativeRunFileDialog(title,
dialogMode, navigateApps,
String[] userFileNames = nativeRunFileDialog(title,
dialogMode,
target.isMultipleMode(),
navigateApps,
target.getFilenameFilter() != null,
target.getDirectory(),
target.getFile());
File file = null;
if (userFileName != null) {
// the dialog wasn't cancelled
file = new File(userFileName);
}
String directory = null;
String file = null;
File[] files = null;
if (file != null) {
// make sure directory always ends in '/'
String parent = file.getParent();
if (!parent.endsWith(File.separator)) {
parent = parent + File.separator;
if (userFileNames != null) {
// the dialog wasn't cancelled
int filesNumber = userFileNames.length;
files = new File[filesNumber];
for (int i = 0; i < filesNumber; i++) {
files[i] = new File(userFileNames[i]);
}
// store results back in component
target.setDirectory(parent);
target.setFile(file.getName());
} else {
// setting file name to null is how we tell
// java client that user hit the cancel button
target.setFile(null);
directory = files[0].getParent();
// make sure directory always ends in '/'
if (!directory.endsWith(File.separator)) {
directory = directory + File.separator;
}
file = files[0].getName(); // pick any file
}
// store results back in component
AWTAccessor.FileDialogAccessor accessor = AWTAccessor.getFileDialogAccessor();
accessor.setDirectory(target, directory);
accessor.setFile(target, file);
accessor.setFiles(target, files);
} finally {
// Java2 Dialog waits for hide to let show() return
target.dispose();
@ -133,8 +141,8 @@ class CFileDialog implements FileDialogPeer {
return ret;
}
private native String nativeRunFileDialog(String title, int mode,
boolean shouldNavigateApps, boolean hasFilenameFilter,
private native String[] nativeRunFileDialog(String title, int mode,
boolean multipleMode, boolean shouldNavigateApps, boolean hasFilenameFilter,
String directory, String file);
@Override

Some files were not shown because too many files have changed in this diff Show More