This commit is contained in:
Yong Jeffrey Huang 2010-04-20 01:24:48 -07:00
commit a7b302b493
280 changed files with 47575 additions and 22031 deletions
.hgtags.hgtags-top-repo
corba
hotspot
jaxp
jaxws
jdk

@ -62,3 +62,5 @@ b1e55627a6980b9508854ed0c0f21d4f981b4494 jdk7-b84
b6f633a93ae0ec4555ff4bf756f5e2150c9bdede jdk7-b85
c94d9cc81f495d97817eba9d71b84fc45f7661a5 jdk7-b86
b7456c473862048fa70ed8092313a4ef0a55d403 jdk7-b87
7077b95d42f6b3942a8751bba033801ff50e5889 jdk7-b88
44158f6d3b94c0fa020e33632532473d92d1ea96 jdk7-b89

@ -62,3 +62,5 @@ e1176f86805fe07fd9fb9da065dc51b47712ce76 jdk7-b82
cf26288a114be67c39f2758959ce50b60f5ae330 jdk7-b85
433a60a9c0bf1b26ee7e65cebaa89c541f497aed jdk7-b86
6b1069f53fbc30663ccef49d78c31bb7d6967bde jdk7-b87
82135c848d5fcddb065e98ae77b81077c858f593 jdk7-b88
7f1ba4459972bf84b8201dc1cc4f62b1fe1c74f4 jdk7-b89

@ -62,3 +62,5 @@ fde0df7a2384f7fe33204a79678989807d9c2b98 jdk7-b83
c67a9df7bc0ca291f08f9a9cc05cb78ea15d25e6 jdk7-b85
6253e28826d16cf1aecc39ce04c8de1f6bf2df5f jdk7-b86
09a41111a401d327f65e453384d976a10154d9ea jdk7-b87
39e14d2da687c7e592142137517aaf689544820f jdk7-b88
bb4424c5e778b842c064a8b1aa902b35f4397654 jdk7-b89

@ -86,3 +86,6 @@ ffc8d176b84bcfb5ac21302b4feb3b0c0d69b97c jdk7-b84
bf823ef06b4f211e66988d76a2e2669be5c0820e jdk7-b86
07226e9eab8f74b37346b32715f829a2ef2c3188 hs18-b01
e7e7e36ccdb5d56edd47e5744351202d38f3b7ad jdk7-b87
4b60f23c42231f7ecd62ad1fcb6a9ca26fa57d1b jdk7-b88
15836273ac2494f36ef62088bc1cb6f3f011f565 jdk7-b89
4b60f23c42231f7ecd62ad1fcb6a9ca26fa57d1b hs18-b02

@ -35,7 +35,7 @@ HOTSPOT_VM_COPYRIGHT=Copyright 2010
HS_MAJOR_VER=18
HS_MINOR_VER=0
HS_BUILD_NUMBER=02
HS_BUILD_NUMBER=03
JDK_MAJOR_VER=1
JDK_MINOR_VER=7

@ -1728,9 +1728,13 @@ void LIR_Assembler::comp_fl2i(LIR_Code code, LIR_Opr left, LIR_Opr right, LIR_Op
ShouldNotReachHere();
}
} else if (code == lir_cmp_l2i) {
#ifdef _LP64
__ lcmp(left->as_register_lo(), right->as_register_lo(), dst->as_register());
#else
__ lcmp(left->as_register_hi(), left->as_register_lo(),
right->as_register_hi(), right->as_register_lo(),
dst->as_register());
#endif
} else {
ShouldNotReachHere();
}
@ -2849,7 +2853,7 @@ void LIR_Assembler::emit_profile_call(LIR_OpProfileCall* op) {
void LIR_Assembler::align_backward_branch_target() {
__ align(16);
__ align(OptoLoopAlignment);
}

@ -60,9 +60,6 @@ define_pd_global(intx, FreqInlineSize, 175);
define_pd_global(intx, INTPRESSURE, 48); // large register set
define_pd_global(intx, InteriorEntryAlignment, 16); // = CodeEntryAlignment
define_pd_global(intx, NewSizeThreadIncrease, ScaleForWordSize(4*K));
// The default setting 16/16 seems to work best.
// (For _228_jack 16/16 is 2% better than 4/4, 16/4, 32/32, 32/16, or 16/32.)
define_pd_global(intx, OptoLoopAlignment, 16); // = 4*wordSize
define_pd_global(intx, RegisterCostAreaRatio, 12000);
define_pd_global(bool, UseTLAB, true);
define_pd_global(bool, ResizeTLAB, true);

@ -40,6 +40,9 @@ define_pd_global(bool, ImplicitNullChecks, true); // Generate code for
define_pd_global(bool, UncommonNullCast, true); // Uncommon-trap NULLs past to check cast
define_pd_global(intx, CodeEntryAlignment, 32);
// The default setting 16/16 seems to work best.
// (For _228_jack 16/16 is 2% better than 4/4, 16/4, 32/32, 32/16, or 16/32.)
define_pd_global(intx, OptoLoopAlignment, 16); // = 4*wordSize
define_pd_global(intx, InlineFrequencyCount, 50); // we can use more inlining on the SPARC
define_pd_global(intx, InlineSmallCode, 1500);
#ifdef _LP64

@ -471,6 +471,9 @@ extern bool can_branch_register( Node *bol, Node *cmp );
source %{
#define __ _masm.
// Block initializing store
#define ASI_BLK_INIT_QUAD_LDD_P 0xE2
// tertiary op of a LoadP or StoreP encoding
#define REGP_OP true
@ -6147,6 +6150,7 @@ instruct prefetchr( memory mem ) %{
%}
instruct prefetchw( memory mem ) %{
predicate(AllocatePrefetchStyle != 3 );
match( PrefetchWrite mem );
ins_cost(MEMORY_REF_COST);
@ -6156,6 +6160,23 @@ instruct prefetchw( memory mem ) %{
ins_pipe(iload_mem);
%}
// Use BIS instruction to prefetch.
instruct prefetchw_bis( memory mem ) %{
predicate(AllocatePrefetchStyle == 3);
match( PrefetchWrite mem );
ins_cost(MEMORY_REF_COST);
format %{ "STXA G0,$mem\t! // Block initializing store" %}
ins_encode %{
Register base = as_Register($mem$$base);
int disp = $mem$$disp;
if (disp != 0) {
__ add(base, AllocatePrefetchStepSize, base);
}
__ stxa(G0, base, G0, ASI_BLK_INIT_QUAD_LDD_P);
%}
ins_pipe(istore_mem_reg);
%}
//----------Store Instructions-------------------------------------------------
// Store Byte

@ -1148,7 +1148,7 @@ class StubGenerator: public StubCodeGenerator {
__ andn(from, 7, from); // Align address
__ ldx(from, 0, O3);
__ inc(from, 8);
__ align(16);
__ align(OptoLoopAlignment);
__ BIND(L_loop);
__ ldx(from, 0, O4);
__ deccc(count, count_dec); // Can we do next iteration after this one?
@ -1220,7 +1220,7 @@ class StubGenerator: public StubCodeGenerator {
//
__ andn(end_from, 7, end_from); // Align address
__ ldx(end_from, 0, O3);
__ align(16);
__ align(OptoLoopAlignment);
__ BIND(L_loop);
__ ldx(end_from, -8, O4);
__ deccc(count, count_dec); // Can we do next iteration after this one?
@ -1349,7 +1349,7 @@ class StubGenerator: public StubCodeGenerator {
__ BIND(L_copy_byte);
__ br_zero(Assembler::zero, false, Assembler::pt, count, L_exit);
__ delayed()->nop();
__ align(16);
__ align(OptoLoopAlignment);
__ BIND(L_copy_byte_loop);
__ ldub(from, offset, O3);
__ deccc(count);
@ -1445,7 +1445,7 @@ class StubGenerator: public StubCodeGenerator {
L_aligned_copy, L_copy_byte);
}
// copy 4 elements (16 bytes) at a time
__ align(16);
__ align(OptoLoopAlignment);
__ BIND(L_aligned_copy);
__ dec(end_from, 16);
__ ldx(end_from, 8, O3);
@ -1461,7 +1461,7 @@ class StubGenerator: public StubCodeGenerator {
__ BIND(L_copy_byte);
__ br_zero(Assembler::zero, false, Assembler::pt, count, L_exit);
__ delayed()->nop();
__ align(16);
__ align(OptoLoopAlignment);
__ BIND(L_copy_byte_loop);
__ dec(end_from);
__ dec(end_to);
@ -1577,7 +1577,7 @@ class StubGenerator: public StubCodeGenerator {
__ BIND(L_copy_2_bytes);
__ br_zero(Assembler::zero, false, Assembler::pt, count, L_exit);
__ delayed()->nop();
__ align(16);
__ align(OptoLoopAlignment);
__ BIND(L_copy_2_bytes_loop);
__ lduh(from, offset, O3);
__ deccc(count);
@ -1684,7 +1684,7 @@ class StubGenerator: public StubCodeGenerator {
L_aligned_copy, L_copy_2_bytes);
}
// copy 4 elements (16 bytes) at a time
__ align(16);
__ align(OptoLoopAlignment);
__ BIND(L_aligned_copy);
__ dec(end_from, 16);
__ ldx(end_from, 8, O3);
@ -1781,7 +1781,7 @@ class StubGenerator: public StubCodeGenerator {
// copy with shift 4 elements (16 bytes) at a time
__ dec(count, 4); // The cmp at the beginning guaranty count >= 4
__ align(16);
__ align(OptoLoopAlignment);
__ BIND(L_copy_16_bytes);
__ ldx(from, 4, O4);
__ deccc(count, 4); // Can we do next iteration after this one?
@ -1907,7 +1907,7 @@ class StubGenerator: public StubCodeGenerator {
// to form 2 aligned 8-bytes chunks to store.
//
__ ldx(end_from, -4, O3);
__ align(16);
__ align(OptoLoopAlignment);
__ BIND(L_copy_16_bytes);
__ ldx(end_from, -12, O4);
__ deccc(count, 4);
@ -1929,7 +1929,7 @@ class StubGenerator: public StubCodeGenerator {
__ delayed()->inc(count, 4);
// copy 4 elements (16 bytes) at a time
__ align(16);
__ align(OptoLoopAlignment);
__ BIND(L_aligned_copy);
__ dec(end_from, 16);
__ ldx(end_from, 8, O3);
@ -2000,6 +2000,27 @@ class StubGenerator: public StubCodeGenerator {
// to: O1
// count: O2 treated as signed
//
// count -= 2;
// if ( count >= 0 ) { // >= 2 elements
// if ( count > 6) { // >= 8 elements
// count -= 6; // original count - 8
// do {
// copy_8_elements;
// count -= 8;
// } while ( count >= 0 );
// count += 6;
// }
// if ( count >= 0 ) { // >= 2 elements
// do {
// copy_2_elements;
// } while ( (count=count-2) >= 0 );
// }
// }
// count += 2;
// if ( count != 0 ) { // 1 element left
// copy_1_element;
// }
//
void generate_disjoint_long_copy_core(bool aligned) {
Label L_copy_8_bytes, L_copy_16_bytes, L_exit;
const Register from = O0; // source array address
@ -2012,7 +2033,39 @@ class StubGenerator: public StubCodeGenerator {
__ mov(G0, offset0); // offset from start of arrays (0)
__ brx(Assembler::negative, false, Assembler::pn, L_copy_8_bytes );
__ delayed()->add(offset0, 8, offset8);
__ align(16);
// Copy by 64 bytes chunks
Label L_copy_64_bytes;
const Register from64 = O3; // source address
const Register to64 = G3; // destination address
__ subcc(count, 6, O3);
__ brx(Assembler::negative, false, Assembler::pt, L_copy_16_bytes );
__ delayed()->mov(to, to64);
// Now we can use O4(offset0), O5(offset8) as temps
__ mov(O3, count);
__ mov(from, from64);
__ align(OptoLoopAlignment);
__ BIND(L_copy_64_bytes);
for( int off = 0; off < 64; off += 16 ) {
__ ldx(from64, off+0, O4);
__ ldx(from64, off+8, O5);
__ stx(O4, to64, off+0);
__ stx(O5, to64, off+8);
}
__ deccc(count, 8);
__ inc(from64, 64);
__ brx(Assembler::greaterEqual, false, Assembler::pt, L_copy_64_bytes);
__ delayed()->inc(to64, 64);
// Restore O4(offset0), O5(offset8)
__ sub(from64, from, offset0);
__ inccc(count, 6);
__ brx(Assembler::negative, false, Assembler::pn, L_copy_8_bytes );
__ delayed()->add(offset0, 8, offset8);
// Copy by 16 bytes chunks
__ align(OptoLoopAlignment);
__ BIND(L_copy_16_bytes);
__ ldx(from, offset0, O3);
__ ldx(from, offset8, G3);
@ -2023,6 +2076,7 @@ class StubGenerator: public StubCodeGenerator {
__ brx(Assembler::greaterEqual, false, Assembler::pt, L_copy_16_bytes);
__ delayed()->inc(offset8, 16);
// Copy last 8 bytes
__ BIND(L_copy_8_bytes);
__ inccc(count, 2);
__ brx(Assembler::zero, true, Assembler::pn, L_exit );
@ -2085,7 +2139,7 @@ class StubGenerator: public StubCodeGenerator {
__ brx(Assembler::lessEqual, false, Assembler::pn, L_copy_8_bytes );
__ delayed()->sllx(count, LogBytesPerLong, offset8);
__ sub(offset8, 8, offset0);
__ align(16);
__ align(OptoLoopAlignment);
__ BIND(L_copy_16_bytes);
__ ldx(from, offset8, O2);
__ ldx(from, offset0, O3);
@ -2351,7 +2405,7 @@ class StubGenerator: public StubCodeGenerator {
// (O5 = 0; ; O5 += wordSize) --- offset from src, dest arrays
// (O2 = len; O2 != 0; O2--) --- number of oops *remaining*
// G3, G4, G5 --- current oop, oop.klass, oop.klass.super
__ align(16);
__ align(OptoLoopAlignment);
__ BIND(store_element);
__ deccc(G1_remain); // decrement the count

@ -86,14 +86,24 @@ void VM_Version::initialize() {
if (FLAG_IS_DEFAULT(InteriorEntryAlignment)) {
FLAG_SET_DEFAULT(InteriorEntryAlignment, 4);
}
if (is_niagara1_plus()) {
if (AllocatePrefetchStyle > 0 && FLAG_IS_DEFAULT(AllocatePrefetchStyle)) {
// Use BIS instruction for allocation prefetch.
FLAG_SET_DEFAULT(AllocatePrefetchStyle, 3);
if (FLAG_IS_DEFAULT(AllocatePrefetchDistance)) {
// Use smaller prefetch distance on N2 with BIS
FLAG_SET_DEFAULT(AllocatePrefetchDistance, 64);
}
}
if (AllocatePrefetchStyle != 3 && FLAG_IS_DEFAULT(AllocatePrefetchDistance)) {
// Use different prefetch distance without BIS
FLAG_SET_DEFAULT(AllocatePrefetchDistance, 256);
}
}
#endif
if (FLAG_IS_DEFAULT(OptoLoopAlignment)) {
FLAG_SET_DEFAULT(OptoLoopAlignment, 4);
}
if (is_niagara1_plus() && FLAG_IS_DEFAULT(AllocatePrefetchDistance)) {
// Use smaller prefetch distance on N2
FLAG_SET_DEFAULT(AllocatePrefetchDistance, 256);
}
#endif
}
// Use hardware population count instruction if available.

@ -3365,6 +3365,13 @@ void Assembler::shrdl(Register dst, Register src) {
#else // LP64
void Assembler::set_byte_if_not_zero(Register dst) {
int enc = prefix_and_encode(dst->encoding(), true);
emit_byte(0x0F);
emit_byte(0x95);
emit_byte(0xE0 | enc);
}
// 64bit only pieces of the assembler
// This should only be used by 64bit instructions that can use rip-relative
// it cannot be used by instructions that want an immediate value.

@ -2690,19 +2690,14 @@ void LIR_Assembler::comp_fl2i(LIR_Code code, LIR_Opr left, LIR_Opr right, LIR_Op
} else {
assert(code == lir_cmp_l2i, "check");
#ifdef _LP64
Register dest = dst->as_register();
__ xorptr(dest, dest);
Label high, done;
__ cmpptr(left->as_register_lo(), right->as_register_lo());
__ jcc(Assembler::equal, done);
__ jcc(Assembler::greater, high);
__ decrement(dest);
__ jmp(done);
__ bind(high);
__ increment(dest);
__ bind(done);
Label done;
Register dest = dst->as_register();
__ cmpptr(left->as_register_lo(), right->as_register_lo());
__ movl(dest, -1);
__ jccb(Assembler::less, done);
__ set_byte_if_not_zero(dest);
__ movzbl(dest, dest);
__ bind(done);
#else
__ lcmp2int(left->as_register_hi(),
left->as_register_lo(),

@ -781,7 +781,7 @@ void Runtime1::generate_unwind_exception(StubAssembler *sasm) {
// Restore SP from BP if the exception PC is a MethodHandle call site.
NOT_LP64(__ get_thread(thread);)
__ cmpl(Address(thread, JavaThread::is_method_handle_exception_offset()), 0);
__ cmpl(Address(thread, JavaThread::is_method_handle_return_offset()), 0);
__ cmovptr(Assembler::notEqual, rsp, rbp);
// continue at exception handler (return address removed)

@ -80,7 +80,6 @@ define_pd_global(intx, CodeCacheExpansionSize, 32*K);
// Ergonomics related flags
define_pd_global(uint64_t,MaxRAM, 4ULL*G);
#endif // AMD64
define_pd_global(intx, OptoLoopAlignment, 16);
define_pd_global(intx, RegisterCostAreaRatio, 16000);
// Peephole and CISC spilling both break the graph, and so makes the

@ -45,6 +45,7 @@ define_pd_global(intx, CodeEntryAlignment, 32);
#else
define_pd_global(intx, CodeEntryAlignment, 16);
#endif // COMPILER2
define_pd_global(intx, OptoLoopAlignment, 16);
define_pd_global(intx, InlineFrequencyCount, 100);
define_pd_global(intx, InlineSmallCode, 1000);

@ -115,8 +115,8 @@ void OptoRuntime::generate_exception_blob() {
// rax: exception handler for given <exception oop/exception pc>
// Restore SP from BP if the exception PC is a MethodHandle call.
__ cmpl(Address(rcx, JavaThread::is_method_handle_exception_offset()), 0);
// Restore SP from BP if the exception PC is a MethodHandle call site.
__ cmpl(Address(rcx, JavaThread::is_method_handle_return_offset()), 0);
__ cmovptr(Assembler::notEqual, rsp, rbp);
// We have a handler in rax, (could be deopt blob)

@ -3328,8 +3328,8 @@ void OptoRuntime::generate_exception_blob() {
// rax: exception handler
// Restore SP from BP if the exception PC is a MethodHandle call.
__ cmpl(Address(r15_thread, JavaThread::is_method_handle_exception_offset()), 0);
// Restore SP from BP if the exception PC is a MethodHandle call site.
__ cmpl(Address(r15_thread, JavaThread::is_method_handle_return_offset()), 0);
__ cmovptr(Assembler::notEqual, rsp, rbp);
// We have a handler in rax (could be deopt blob).

@ -430,7 +430,7 @@ class StubGenerator: public StubCodeGenerator {
__ verify_oop(exception_oop);
// Restore SP from BP if the exception PC is a MethodHandle call site.
__ cmpl(Address(thread, JavaThread::is_method_handle_exception_offset()), 0);
__ cmpl(Address(thread, JavaThread::is_method_handle_return_offset()), 0);
__ cmovptr(Assembler::notEqual, rsp, rbp);
// continue at exception handler (return address removed)
@ -812,7 +812,7 @@ class StubGenerator: public StubCodeGenerator {
Label L_copy_64_bytes_loop, L_copy_64_bytes, L_copy_8_bytes, L_exit;
// Copy 64-byte chunks
__ jmpb(L_copy_64_bytes);
__ align(16);
__ align(OptoLoopAlignment);
__ BIND(L_copy_64_bytes_loop);
if(UseUnalignedLoadStores) {
@ -874,7 +874,7 @@ class StubGenerator: public StubCodeGenerator {
Label L_copy_64_bytes_loop, L_copy_64_bytes, L_copy_8_bytes, L_exit;
// Copy 64-byte chunks
__ jmpb(L_copy_64_bytes);
__ align(16);
__ align(OptoLoopAlignment);
__ BIND(L_copy_64_bytes_loop);
__ movq(mmx0, Address(from, 0));
__ movq(mmx1, Address(from, 8));
@ -1144,7 +1144,7 @@ class StubGenerator: public StubCodeGenerator {
__ movl(Address(to, count, sf, 0), rdx);
__ jmpb(L_copy_8_bytes);
__ align(16);
__ align(OptoLoopAlignment);
// Move 8 bytes
__ BIND(L_copy_8_bytes_loop);
if (UseXMMForArrayCopy) {
@ -1235,7 +1235,7 @@ class StubGenerator: public StubCodeGenerator {
}
} else {
__ jmpb(L_copy_8_bytes);
__ align(16);
__ align(OptoLoopAlignment);
__ BIND(L_copy_8_bytes_loop);
__ fild_d(Address(from, 0));
__ fistp_d(Address(from, to_from, Address::times_1));
@ -1282,7 +1282,7 @@ class StubGenerator: public StubCodeGenerator {
__ jmpb(L_copy_8_bytes);
__ align(16);
__ align(OptoLoopAlignment);
__ BIND(L_copy_8_bytes_loop);
if (VM_Version::supports_mmx()) {
if (UseXMMForArrayCopy) {
@ -1454,7 +1454,7 @@ class StubGenerator: public StubCodeGenerator {
// Loop control:
// for (count = -count; count != 0; count++)
// Base pointers src, dst are biased by 8*count,to last element.
__ align(16);
__ align(OptoLoopAlignment);
__ BIND(L_store_element);
__ movptr(to_element_addr, elem); // store the oop

@ -871,9 +871,8 @@ class StubGenerator: public StubCodeGenerator {
}
address generate_fp_mask(const char *stub_name, int64_t mask) {
__ align(CodeEntryAlignment);
StubCodeMark mark(this, "StubRoutines", stub_name);
__ align(16);
address start = __ pc();
__ emit_data64( mask, relocInfo::none );
@ -1268,7 +1267,7 @@ class StubGenerator: public StubCodeGenerator {
Label& L_copy_32_bytes, Label& L_copy_8_bytes) {
DEBUG_ONLY(__ stop("enter at entry label, not here"));
Label L_loop;
__ align(16);
__ align(OptoLoopAlignment);
__ BIND(L_loop);
if(UseUnalignedLoadStores) {
__ movdqu(xmm0, Address(end_from, qword_count, Address::times_8, -24));
@ -1309,7 +1308,7 @@ class StubGenerator: public StubCodeGenerator {
Label& L_copy_32_bytes, Label& L_copy_8_bytes) {
DEBUG_ONLY(__ stop("enter at entry label, not here"));
Label L_loop;
__ align(16);
__ align(OptoLoopAlignment);
__ BIND(L_loop);
if(UseUnalignedLoadStores) {
__ movdqu(xmm0, Address(from, qword_count, Address::times_8, 16));
@ -2229,7 +2228,7 @@ class StubGenerator: public StubCodeGenerator {
// Loop control:
// for (count = -count; count != 0; count++)
// Base pointers src, dst are biased by 8*(count-1),to last element.
__ align(16);
__ align(OptoLoopAlignment);
__ BIND(L_store_element);
__ store_heap_oop(to_element_addr, rax_oop); // store the oop

@ -206,7 +206,6 @@ void CppInterpreter::native_entry(methodOop method, intptr_t UNUSED, TRAPS) {
// Update the invocation counter
if ((UseCompiler || CountCompiledCalls) && !method->is_synchronized()) {
thread->set_do_not_unlock();
InvocationCounter *counter = method->invocation_counter();
counter->increment();
if (counter->reached_InvocationLimit()) {
@ -215,7 +214,6 @@ void CppInterpreter::native_entry(methodOop method, intptr_t UNUSED, TRAPS) {
if (HAS_PENDING_EXCEPTION)
goto unwind_and_return;
}
thread->clr_do_not_unlock();
}
// Lock if necessary

@ -1,6 +1,6 @@
/*
* Copyright 1997-2007 Sun Microsystems, Inc. All Rights Reserved.
* Copyright 2009 Red Hat, Inc.
* Copyright 2009, 2010 Red Hat, Inc.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -23,4 +23,10 @@
*
*/
// This file is intentionally empty
#include "incls/_precompiled.incl"
#include "incls/_methodHandles_zero.cpp.incl"
void MethodHandles::generate_method_handle_stub(MacroAssembler* masm,
MethodHandles::EntryKind ek) {
ShouldNotCallThis();
}

@ -1,6 +1,6 @@
/*
* Copyright 2003-2005 Sun Microsystems, Inc. All Rights Reserved.
* Copyright 2007, 2008, 2009 Red Hat, Inc.
* Copyright 2007, 2008, 2009, 2010 Red Hat, Inc.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -41,6 +41,10 @@
code_size2 = 0 // if these are too small. Simply increase
}; // them if that happens.
enum method_handles_platform_dependent_constants {
method_handles_adapters_code_size = 0
};
#ifdef IA32
class x86 {
friend class VMStructs;

@ -192,7 +192,8 @@ int LinuxAttachListener::init() {
res = ::bind(listener, (struct sockaddr*)&addr, sizeof(addr));
}
if (res == -1) {
sprintf(path, "%s/.java_pid%d", os::get_temp_directory(), os::current_process_id());
snprintf(path, PATH_MAX+1, "%s/.java_pid%d",
os::get_temp_directory(), os::current_process_id());
strcpy(addr.sun_path, path);
::unlink(path);
res = ::bind(listener, (struct sockaddr*)&addr, sizeof(addr));
@ -460,13 +461,14 @@ bool AttachListener::is_init_trigger() {
if (init_at_startup() || is_initialized()) {
return false; // initialized at startup or already initialized
}
char fn[32];
char fn[128];
sprintf(fn, ".attach_pid%d", os::current_process_id());
int ret;
struct stat64 st;
RESTARTABLE(::stat64(fn, &st), ret);
if (ret == -1) {
sprintf(fn, "/tmp/.attach_pid%d", os::current_process_id());
snprintf(fn, sizeof(fn), "%s/.attach_pid%d",
os::get_temp_directory(), os::current_process_id());
RESTARTABLE(::stat64(fn, &st), ret);
}
if (ret == 0) {

@ -1522,7 +1522,10 @@ int os::current_process_id() {
const char* os::dll_file_extension() { return ".so"; }
const char* os::get_temp_directory() { return "/tmp/"; }
const char* os::get_temp_directory() {
const char *prop = Arguments::get_property("java.io.tmpdir");
return prop == NULL ? "/tmp" : prop;
}
static bool file_exists(const char* filename) {
struct stat statbuf;
@ -2305,7 +2308,8 @@ void linux_wrap_code(char* base, size_t size) {
char buf[40];
int num = Atomic::add(1, &cnt);
sprintf(buf, "/tmp/hs-vm-%d-%d", os::current_process_id(), num);
snprintf(buf, sizeof(buf), "%s/hs-vm-%d-%d",
os::get_temp_directory(), os::current_process_id(), num);
unlink(buf);
int fd = open(buf, O_CREAT | O_RDWR, S_IRWXU);

@ -145,11 +145,11 @@ static char* get_user_tmp_dir(const char* user) {
const char* tmpdir = os::get_temp_directory();
const char* perfdir = PERFDATA_NAME;
size_t nbytes = strlen(tmpdir) + strlen(perfdir) + strlen(user) + 2;
size_t nbytes = strlen(tmpdir) + strlen(perfdir) + strlen(user) + 3;
char* dirname = NEW_C_HEAP_ARRAY(char, nbytes);
// construct the path name to user specific tmp directory
snprintf(dirname, nbytes, "%s%s_%s", tmpdir, perfdir, user);
snprintf(dirname, nbytes, "%s/%s_%s", tmpdir, perfdir, user);
return dirname;
}
@ -331,8 +331,9 @@ static char* get_user_name_slow(int vmid, TRAPS) {
}
char* usrdir_name = NEW_C_HEAP_ARRAY(char,
strlen(tmpdirname) + strlen(dentry->d_name) + 1);
strlen(tmpdirname) + strlen(dentry->d_name) + 2);
strcpy(usrdir_name, tmpdirname);
strcat(usrdir_name, "/");
strcat(usrdir_name, dentry->d_name);
DIR* subdirp = os::opendir(usrdir_name);

@ -375,7 +375,8 @@ int SolarisAttachListener::create_door() {
return -1;
}
sprintf(door_path, "%s/.java_pid%d", os::get_temp_directory(), os::current_process_id());
snprintf(door_path, sizeof(door_path), "%s/.java_pid%d",
os::get_temp_directory(), os::current_process_id());
RESTARTABLE(::creat(door_path, S_IRUSR | S_IWUSR), fd);
if (fd == -1) {
@ -591,13 +592,14 @@ bool AttachListener::is_init_trigger() {
if (init_at_startup() || is_initialized()) {
return false; // initialized at startup or already initialized
}
char fn[32];
char fn[128];
sprintf(fn, ".attach_pid%d", os::current_process_id());
int ret;
struct stat64 st;
RESTARTABLE(::stat64(fn, &st), ret);
if (ret == -1) {
sprintf(fn, "/tmp/.attach_pid%d", os::current_process_id());
snprintf(fn, sizeof(fn), "%s/.attach_pid%d",
os::get_temp_directory(), os::current_process_id());
RESTARTABLE(::stat64(fn, &st), ret);
}
if (ret == 0) {

@ -676,15 +676,6 @@ bool os::have_special_privileges() {
}
static char* get_property(char* name, char* buffer, int buffer_size) {
if (os::getenv(name, buffer, buffer_size)) {
return buffer;
}
static char empty[] = "";
return empty;
}
void os::init_system_properties_values() {
char arch[12];
sysinfo(SI_ARCHITECTURE, arch, sizeof(arch));
@ -1826,7 +1817,10 @@ void os::set_error_file(const char *logfile) {}
const char* os::dll_file_extension() { return ".so"; }
const char* os::get_temp_directory() { return "/tmp/"; }
const char* os::get_temp_directory() {
const char *prop = Arguments::get_property("java.io.tmpdir");
return prop == NULL ? "/tmp" : prop;
}
static bool file_exists(const char* filename) {
struct stat statbuf;

@ -147,11 +147,11 @@ static char* get_user_tmp_dir(const char* user) {
const char* tmpdir = os::get_temp_directory();
const char* perfdir = PERFDATA_NAME;
size_t nbytes = strlen(tmpdir) + strlen(perfdir) + strlen(user) + 2;
size_t nbytes = strlen(tmpdir) + strlen(perfdir) + strlen(user) + 3;
char* dirname = NEW_C_HEAP_ARRAY(char, nbytes);
// construct the path name to user specific tmp directory
snprintf(dirname, nbytes, "%s%s_%s", tmpdir, perfdir, user);
snprintf(dirname, nbytes, "%s/%s_%s", tmpdir, perfdir, user);
return dirname;
}
@ -322,8 +322,9 @@ static char* get_user_name_slow(int vmid, TRAPS) {
}
char* usrdir_name = NEW_C_HEAP_ARRAY(char,
strlen(tmpdirname) + strlen(dentry->d_name) + 1);
strlen(tmpdirname) + strlen(dentry->d_name) + 2);
strcpy(usrdir_name, tmpdirname);
strcat(usrdir_name, "/");
strcat(usrdir_name, dentry->d_name);
DIR* subdirp = os::opendir(usrdir_name);

@ -998,15 +998,16 @@ os::closedir(DIR *dirp)
const char* os::dll_file_extension() { return ".dll"; }
const char * os::get_temp_directory()
{
static char path_buf[MAX_PATH];
if (GetTempPath(MAX_PATH, path_buf)>0)
return path_buf;
else{
path_buf[0]='\0';
return path_buf;
}
const char* os::get_temp_directory() {
const char *prop = Arguments::get_property("java.io.tmpdir");
if (prop != 0) return prop;
static char path_buf[MAX_PATH];
if (GetTempPath(MAX_PATH, path_buf)>0)
return path_buf;
else{
path_buf[0]='\0';
return path_buf;
}
}
static bool file_exists(const char* filename) {

@ -149,11 +149,11 @@ static char* get_user_tmp_dir(const char* user) {
const char* tmpdir = os::get_temp_directory();
const char* perfdir = PERFDATA_NAME;
size_t nbytes = strlen(tmpdir) + strlen(perfdir) + strlen(user) + 2;
size_t nbytes = strlen(tmpdir) + strlen(perfdir) + strlen(user) + 3;
char* dirname = NEW_C_HEAP_ARRAY(char, nbytes);
// construct the path name to user specific tmp directory
_snprintf(dirname, nbytes, "%s%s_%s", tmpdir, perfdir, user);
_snprintf(dirname, nbytes, "%s\\%s_%s", tmpdir, perfdir, user);
return dirname;
}
@ -318,8 +318,9 @@ static char* get_user_name_slow(int vmid) {
}
char* usrdir_name = NEW_C_HEAP_ARRAY(char,
strlen(tmpdirname) + strlen(dentry->d_name) + 1);
strlen(tmpdirname) + strlen(dentry->d_name) + 2);
strcpy(usrdir_name, tmpdirname);
strcat(usrdir_name, "\\");
strcat(usrdir_name, dentry->d_name);
DIR* subdirp = os::opendir(usrdir_name);

@ -2608,12 +2608,17 @@ int LinearScan::append_scope_value_for_operand(LIR_Opr opr, GrowableArray<ScopeV
} else if (opr->is_double_xmm()) {
assert(opr->fpu_regnrLo() == opr->fpu_regnrHi(), "assumed in calculation");
VMReg rname_first = opr->as_xmm_double_reg()->as_VMReg();
# ifdef _LP64
first = new LocationValue(Location::new_reg_loc(Location::dbl, rname_first));
second = &_int_0_scope_value;
# else
first = new LocationValue(Location::new_reg_loc(Location::normal, rname_first));
// %%% This is probably a waste but we'll keep things as they were for now
if (true) {
VMReg rname_second = rname_first->next();
second = new LocationValue(Location::new_reg_loc(Location::normal, rname_second));
}
# endif
#endif
} else if (opr->is_double_fpu()) {
@ -2639,13 +2644,17 @@ int LinearScan::append_scope_value_for_operand(LIR_Opr opr, GrowableArray<ScopeV
#endif
VMReg rname_first = frame_map()->fpu_regname(opr->fpu_regnrHi());
#ifdef _LP64
first = new LocationValue(Location::new_reg_loc(Location::dbl, rname_first));
second = &_int_0_scope_value;
#else
first = new LocationValue(Location::new_reg_loc(Location::normal, rname_first));
// %%% This is probably a waste but we'll keep things as they were for now
if (true) {
VMReg rname_second = rname_first->next();
second = new LocationValue(Location::new_reg_loc(Location::normal, rname_second));
}
#endif
} else {
ShouldNotReachHere();

@ -36,7 +36,7 @@ void ciConstant::print() {
basictype_to_str(basic_type()));
switch (basic_type()) {
case T_BOOLEAN:
tty->print("%s", bool_to_str(_value._int == 0));
tty->print("%s", bool_to_str(_value._int != 0));
break;
case T_CHAR:
case T_BYTE:

@ -385,11 +385,6 @@ ciKlass* ciEnv::get_klass_by_name_impl(ciKlass* accessing_klass,
KILL_COMPILE_ON_FATAL_(fail_type));
}
if (found_klass != NULL) {
// Found it. Build a CI handle.
return get_object(found_klass)->as_klass();
}
// If we fail to find an array klass, look again for its element type.
// The element type may be available either locally or via constraints.
// In either case, if we can find the element type in the system dictionary,
@ -414,6 +409,11 @@ ciKlass* ciEnv::get_klass_by_name_impl(ciKlass* accessing_klass,
}
}
if (found_klass != NULL) {
// Found it. Build a CI handle.
return get_object(found_klass)->as_klass();
}
if (require_local) return NULL;
// Not yet loaded into the VM, or not governed by loader constraints.
// Make a CI representative for it.

@ -2956,8 +2956,8 @@ instanceKlassHandle ClassFileParser::parseClassFile(symbolHandle name,
#endif
bool compact_fields = CompactFields;
int allocation_style = FieldsAllocationStyle;
if( allocation_style < 0 || allocation_style > 1 ) { // Out of range?
assert(false, "0 <= FieldsAllocationStyle <= 1");
if( allocation_style < 0 || allocation_style > 2 ) { // Out of range?
assert(false, "0 <= FieldsAllocationStyle <= 2");
allocation_style = 1; // Optimistic
}
@ -2993,6 +2993,25 @@ instanceKlassHandle ClassFileParser::parseClassFile(symbolHandle name,
} else if( allocation_style == 1 ) {
// Fields order: longs/doubles, ints, shorts/chars, bytes, oops
next_nonstatic_double_offset = next_nonstatic_field_offset;
} else if( allocation_style == 2 ) {
// Fields allocation: oops fields in super and sub classes are together.
if( nonstatic_field_size > 0 && super_klass() != NULL &&
super_klass->nonstatic_oop_map_size() > 0 ) {
int map_size = super_klass->nonstatic_oop_map_size();
OopMapBlock* first_map = super_klass->start_of_nonstatic_oop_maps();
OopMapBlock* last_map = first_map + map_size - 1;
int next_offset = last_map->offset() + (last_map->count() * heapOopSize);
if (next_offset == next_nonstatic_field_offset) {
allocation_style = 0; // allocate oops first
next_nonstatic_oop_offset = next_nonstatic_field_offset;
next_nonstatic_double_offset = next_nonstatic_oop_offset +
(nonstatic_oop_count * heapOopSize);
}
}
if( allocation_style == 2 ) {
allocation_style = 1; // allocate oops last
next_nonstatic_double_offset = next_nonstatic_field_offset;
}
} else {
ShouldNotReachHere();
}

@ -334,33 +334,6 @@ klassOop LoaderConstraintTable::find_constrained_klass(symbolHandle name,
return NULL;
}
klassOop LoaderConstraintTable::find_constrained_elem_klass(symbolHandle name,
symbolHandle elem_name,
Handle loader,
TRAPS) {
LoaderConstraintEntry *p = *(find_loader_constraint(name, loader));
if (p != NULL) {
assert(p->klass() == NULL, "Expecting null array klass");
// The array name has a constraint, but it will not have a class. Check
// each loader for an associated elem
for (int i = 0; i < p->num_loaders(); i++) {
Handle no_protection_domain;
klassOop k = SystemDictionary::find(elem_name, p->loader(i), no_protection_domain, THREAD);
if (k != NULL) {
// Return the first elem klass found.
return k;
}
}
}
// No constraints, or else no klass loaded yet.
return NULL;
}
void LoaderConstraintTable::ensure_loader_constraint_capacity(
LoaderConstraintEntry *p,
int nfree) {

@ -66,9 +66,6 @@ public:
// bool is_method, TRAPS)
klassOop find_constrained_klass(symbolHandle name, Handle loader);
klassOop find_constrained_elem_klass(symbolHandle name, symbolHandle elem_name,
Handle loader, TRAPS);
// Class loader constraints

@ -2178,9 +2178,8 @@ klassOop SystemDictionary::find_constrained_instance_or_array_klass(
// a loader constraint that would require this loader to return the
// klass that is already loaded.
if (FieldType::is_array(class_name())) {
// Array classes are hard because their klassOops are not kept in the
// constraint table. The array klass may be constrained, but the elem class
// may not be.
// For array classes, their klassOops are not kept in the
// constraint table. The element klassOops are.
jint dimension;
symbolOop object_key;
BasicType t = FieldType::get_array_info(class_name(), &dimension,
@ -2190,8 +2189,9 @@ klassOop SystemDictionary::find_constrained_instance_or_array_klass(
} else {
symbolHandle elem_name(THREAD, object_key);
MutexLocker mu(SystemDictionary_lock, THREAD);
klass = constraints()->find_constrained_elem_klass(class_name, elem_name, class_loader, THREAD);
klass = constraints()->find_constrained_klass(elem_name, class_loader);
}
// If element class already loaded, allocate array klass
if (klass != NULL) {
klass = Klass::cast(klass)->array_klass_or_null(dimension);
}
@ -2209,22 +2209,38 @@ bool SystemDictionary::add_loader_constraint(symbolHandle class_name,
Handle class_loader1,
Handle class_loader2,
Thread* THREAD) {
unsigned int d_hash1 = dictionary()->compute_hash(class_name, class_loader1);
symbolHandle constraint_name;
if (!FieldType::is_array(class_name())) {
constraint_name = class_name;
} else {
// For array classes, their klassOops are not kept in the
// constraint table. The element classes are.
jint dimension;
symbolOop object_key;
BasicType t = FieldType::get_array_info(class_name(), &dimension,
&object_key, CHECK_(false));
// primitive types always pass
if (t != T_OBJECT) {
return true;
} else {
constraint_name = symbolHandle(THREAD, object_key);
}
}
unsigned int d_hash1 = dictionary()->compute_hash(constraint_name, class_loader1);
int d_index1 = dictionary()->hash_to_index(d_hash1);
unsigned int d_hash2 = dictionary()->compute_hash(class_name, class_loader2);
unsigned int d_hash2 = dictionary()->compute_hash(constraint_name, class_loader2);
int d_index2 = dictionary()->hash_to_index(d_hash2);
{
MutexLocker mu_s(SystemDictionary_lock, THREAD);
MutexLocker mu_s(SystemDictionary_lock, THREAD);
// Better never do a GC while we're holding these oops
No_Safepoint_Verifier nosafepoint;
// Better never do a GC while we're holding these oops
No_Safepoint_Verifier nosafepoint;
klassOop klass1 = find_class(d_index1, d_hash1, class_name, class_loader1);
klassOop klass2 = find_class(d_index2, d_hash2, class_name, class_loader2);
return constraints()->add_entry(class_name, klass1, class_loader1,
klass2, class_loader2);
klassOop klass1 = find_class(d_index1, d_hash1, constraint_name, class_loader1);
klassOop klass2 = find_class(d_index2, d_hash2, constraint_name, class_loader2);
return constraints()->add_entry(constraint_name, klass1, class_loader1,
klass2, class_loader2);
}
}
@ -2301,6 +2317,7 @@ symbolOop SystemDictionary::find_resolution_error(constantPoolHandle pool, int w
// Returns the name of the type that failed a loader constraint check, or
// NULL if no constraint failed. The returned C string needs cleaning up
// with a ResourceMark in the caller. No exception except OOME is thrown.
// Arrays are not added to the loader constraint table, their elements are.
char* SystemDictionary::check_signature_loaders(symbolHandle signature,
Handle loader1, Handle loader2,
bool is_method, TRAPS) {

@ -1,5 +1,5 @@
/*
* Copyright 1997-2007 Sun Microsystems, Inc. All Rights Reserved.
* Copyright 1997-2010 Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -284,9 +284,11 @@ void CodeCache::scavenge_root_nmethods_do(CodeBlobClosure* f) {
cur->print_on(tty, is_live ? "scavenge root" : "dead scavenge root"); tty->cr();
}
#endif //PRODUCT
if (is_live)
if (is_live) {
// Perform cur->oops_do(f), maybe just once per nmethod.
f->do_code_blob(cur);
cur->fix_oop_relocations();
}
}
// Check for stray marks.

@ -1414,9 +1414,14 @@ void CompileBroker::init_compiler_thread_log() {
intx thread_id = os::current_thread_id();
for (int try_temp_dir = 1; try_temp_dir >= 0; try_temp_dir--) {
const char* dir = (try_temp_dir ? os::get_temp_directory() : NULL);
if (dir == NULL) dir = "";
sprintf(fileBuf, "%shs_c" UINTX_FORMAT "_pid%u.log",
dir, thread_id, os::current_process_id());
if (dir == NULL) {
jio_snprintf(fileBuf, sizeof(fileBuf), "hs_c" UINTX_FORMAT "_pid%u.log",
thread_id, os::current_process_id());
} else {
jio_snprintf(fileBuf, sizeof(fileBuf),
"%s%shs_c" UINTX_FORMAT "_pid%u.log", dir,
os::file_separator(), thread_id, os::current_process_id());
}
fp = fopen(fileBuf, "at");
if (fp != NULL) {
file = NEW_C_HEAP_ARRAY(char, strlen(fileBuf)+1);

@ -297,6 +297,11 @@ void CMRegionStack::push(MemRegion mr) {
}
}
// Currently we do not call this at all. Normally we would call it
// during the concurrent marking / remark phases but we now call
// the lock-based version instead. But we might want to resurrect this
// code in the future. So, we'll leave it here commented out.
#if 0
MemRegion CMRegionStack::pop() {
while (true) {
// Otherwise...
@ -321,6 +326,41 @@ MemRegion CMRegionStack::pop() {
// Otherwise, we need to try again.
}
}
#endif // 0
void CMRegionStack::push_with_lock(MemRegion mr) {
assert(mr.word_size() > 0, "Precondition");
MutexLockerEx x(CMRegionStack_lock, Mutex::_no_safepoint_check_flag);
if (isFull()) {
_overflow = true;
return;
}
_base[_index] = mr;
_index += 1;
}
MemRegion CMRegionStack::pop_with_lock() {
MutexLockerEx x(CMRegionStack_lock, Mutex::_no_safepoint_check_flag);
while (true) {
if (_index == 0) {
return MemRegion();
}
_index -= 1;
MemRegion mr = _base[_index];
if (mr.start() != NULL) {
assert(mr.end() != NULL, "invariant");
assert(mr.word_size() > 0, "invariant");
return mr;
} else {
// that entry was invalidated... let's skip it
assert(mr.end() == NULL, "invariant");
}
}
}
bool CMRegionStack::invalidate_entries_into_cset() {
bool result = false;
@ -668,24 +708,46 @@ ConcurrentMark::~ConcurrentMark() {
//
void ConcurrentMark::clearNextBitmap() {
guarantee(!G1CollectedHeap::heap()->mark_in_progress(), "Precondition.");
G1CollectedHeap* g1h = G1CollectedHeap::heap();
G1CollectorPolicy* g1p = g1h->g1_policy();
// clear the mark bitmap (no grey objects to start with).
// We need to do this in chunks and offer to yield in between
// each chunk.
HeapWord* start = _nextMarkBitMap->startWord();
HeapWord* end = _nextMarkBitMap->endWord();
HeapWord* cur = start;
size_t chunkSize = M;
while (cur < end) {
HeapWord* next = cur + chunkSize;
if (next > end)
next = end;
MemRegion mr(cur,next);
_nextMarkBitMap->clearRange(mr);
cur = next;
do_yield_check();
}
// Make sure that the concurrent mark thread looks to still be in
// the current cycle.
guarantee(cmThread()->during_cycle(), "invariant");
// We are finishing up the current cycle by clearing the next
// marking bitmap and getting it ready for the next cycle. During
// this time no other cycle can start. So, let's make sure that this
// is the case.
guarantee(!g1h->mark_in_progress(), "invariant");
// clear the mark bitmap (no grey objects to start with).
// We need to do this in chunks and offer to yield in between
// each chunk.
HeapWord* start = _nextMarkBitMap->startWord();
HeapWord* end = _nextMarkBitMap->endWord();
HeapWord* cur = start;
size_t chunkSize = M;
while (cur < end) {
HeapWord* next = cur + chunkSize;
if (next > end)
next = end;
MemRegion mr(cur,next);
_nextMarkBitMap->clearRange(mr);
cur = next;
do_yield_check();
// Repeat the asserts from above. We'll do them as asserts here to
// minimize their overhead on the product. However, we'll have
// them as guarantees at the beginning / end of the bitmap
// clearing to get some checking in the product.
assert(cmThread()->during_cycle(), "invariant");
assert(!g1h->mark_in_progress(), "invariant");
}
// Repeat the asserts from above.
guarantee(cmThread()->during_cycle(), "invariant");
guarantee(!g1h->mark_in_progress(), "invariant");
}
class NoteStartOfMarkHRClosure: public HeapRegionClosure {
@ -3363,7 +3425,7 @@ void CMTask::drain_region_stack(BitMapClosure* bc) {
gclog_or_tty->print_cr("[%d] draining region stack, size = %d",
_task_id, _cm->region_stack_size());
MemRegion mr = _cm->region_stack_pop();
MemRegion mr = _cm->region_stack_pop_with_lock();
// it returns MemRegion() if the pop fails
statsOnly(if (mr.start() != NULL) ++_region_stack_pops );
@ -3384,7 +3446,7 @@ void CMTask::drain_region_stack(BitMapClosure* bc) {
if (has_aborted())
mr = MemRegion();
else {
mr = _cm->region_stack_pop();
mr = _cm->region_stack_pop_with_lock();
// it returns MemRegion() if the pop fails
statsOnly(if (mr.start() != NULL) ++_region_stack_pops );
}
@ -3417,7 +3479,7 @@ void CMTask::drain_region_stack(BitMapClosure* bc) {
}
// Now push the part of the region we didn't scan on the
// region stack to make sure a task scans it later.
_cm->region_stack_push(newRegion);
_cm->region_stack_push_with_lock(newRegion);
}
// break from while
mr = MemRegion();

@ -252,9 +252,19 @@ public:
// with other "push" operations (no pops).
void push(MemRegion mr);
#if 0
// This is currently not used. See the comment in the .cpp file.
// Lock-free; assumes that it will only be called in parallel
// with other "pop" operations (no pushes).
MemRegion pop();
#endif // 0
// These two are the implementations that use a lock. They can be
// called concurrently with each other but they should not be called
// concurrently with the lock-free versions (push() / pop()).
void push_with_lock(MemRegion mr);
MemRegion pop_with_lock();
bool isEmpty() { return _index == 0; }
bool isFull() { return _index == _capacity; }
@ -540,6 +550,10 @@ public:
// Manipulation of the region stack
bool region_stack_push(MemRegion mr) {
// Currently we only call the lock-free version during evacuation
// pauses.
assert(SafepointSynchronize::is_at_safepoint(), "world should be stopped");
_regionStack.push(mr);
if (_regionStack.overflow()) {
set_has_overflown();
@ -547,7 +561,33 @@ public:
}
return true;
}
MemRegion region_stack_pop() { return _regionStack.pop(); }
#if 0
// Currently this is not used. See the comment in the .cpp file.
MemRegion region_stack_pop() { return _regionStack.pop(); }
#endif // 0
bool region_stack_push_with_lock(MemRegion mr) {
// Currently we only call the lock-based version during either
// concurrent marking or remark.
assert(!SafepointSynchronize::is_at_safepoint() || !concurrent(),
"if we are at a safepoint it should be the remark safepoint");
_regionStack.push_with_lock(mr);
if (_regionStack.overflow()) {
set_has_overflown();
return false;
}
return true;
}
MemRegion region_stack_pop_with_lock() {
// Currently we only call the lock-based version during either
// concurrent marking or remark.
assert(!SafepointSynchronize::is_at_safepoint() || !concurrent(),
"if we are at a safepoint it should be the remark safepoint");
return _regionStack.pop_with_lock();
}
int region_stack_size() { return _regionStack.size(); }
bool region_stack_overflow() { return _regionStack.overflow(); }
bool region_stack_empty() { return _regionStack.isEmpty(); }

@ -42,8 +42,8 @@ class ConcurrentMarkThread: public ConcurrentGCThread {
private:
ConcurrentMark* _cm;
bool _started;
bool _in_progress;
volatile bool _started;
volatile bool _in_progress;
void sleepBeforeNextCycle();
@ -67,15 +67,25 @@ class ConcurrentMarkThread: public ConcurrentGCThread {
// Counting virtual time so far.
double vtime_count_accum() { return _vtime_count_accum; }
ConcurrentMark* cm() { return _cm; }
ConcurrentMark* cm() { return _cm; }
void set_started() { _started = true; }
void clear_started() { _started = false; }
bool started() { return _started; }
void set_started() { _started = true; }
void clear_started() { _started = false; }
bool started() { return _started; }
void set_in_progress() { _in_progress = true; }
void clear_in_progress() { _in_progress = false; }
bool in_progress() { return _in_progress; }
void set_in_progress() { _in_progress = true; }
void clear_in_progress() { _in_progress = false; }
bool in_progress() { return _in_progress; }
// This flag returns true from the moment a marking cycle is
// initiated (during the initial-mark pause when started() is set)
// to the moment when the cycle completes (just after the next
// marking bitmap has been cleared and in_progress() is
// cleared). While this flag is true we will not start another cycle
// so that cycles do not overlap. We cannot use just in_progress()
// as the CM thread might take some time to wake up before noticing
// that started() is set and set in_progress().
bool during_cycle() { return started() || in_progress(); }
// Yield for GC
void yield();

@ -902,6 +902,10 @@ public:
void G1CollectedHeap::do_collection(bool full, bool clear_all_soft_refs,
size_t word_size) {
if (GC_locker::check_active_before_gc()) {
return; // GC is disabled (e.g. JNI GetXXXCritical operation)
}
ResourceMark rm;
if (PrintHeapAtGC) {
@ -916,10 +920,6 @@ void G1CollectedHeap::do_collection(bool full, bool clear_all_soft_refs,
assert(SafepointSynchronize::is_at_safepoint(), "should be at safepoint");
assert(Thread::current() == VMThread::vm_thread(), "should be in vm thread");
if (GC_locker::is_active()) {
return; // GC is disabled (e.g. JNI GetXXXCritical operation)
}
{
IsGCActiveMark x;
@ -2658,6 +2658,10 @@ struct PrepareForRSScanningClosure : public HeapRegionClosure {
void
G1CollectedHeap::do_collection_pause_at_safepoint() {
if (GC_locker::check_active_before_gc()) {
return; // GC is disabled (e.g. JNI GetXXXCritical operation)
}
if (PrintHeapAtGC) {
Universe::print_heap_before_gc();
}
@ -2665,6 +2669,11 @@ G1CollectedHeap::do_collection_pause_at_safepoint() {
{
ResourceMark rm;
// This call will decide whether this pause is an initial-mark
// pause. If it is, during_initial_mark_pause() will return true
// for the duration of this pause.
g1_policy()->decide_on_conc_mark_initiation();
char verbose_str[128];
sprintf(verbose_str, "GC pause ");
if (g1_policy()->in_young_gc_mode()) {
@ -2673,7 +2682,7 @@ G1CollectedHeap::do_collection_pause_at_safepoint() {
else
strcat(verbose_str, "(partial)");
}
if (g1_policy()->should_initiate_conc_mark())
if (g1_policy()->during_initial_mark_pause())
strcat(verbose_str, " (initial-mark)");
// if PrintGCDetails is on, we'll print long statistics information
@ -2697,10 +2706,6 @@ G1CollectedHeap::do_collection_pause_at_safepoint() {
"young list should be well formed");
}
if (GC_locker::is_active()) {
return; // GC is disabled (e.g. JNI GetXXXCritical operation)
}
bool abandoned = false;
{ // Call to jvmpi::post_class_unload_events must occur outside of active GC
IsGCActiveMark x;
@ -2756,7 +2761,7 @@ G1CollectedHeap::do_collection_pause_at_safepoint() {
_young_list->print();
#endif // SCAN_ONLY_VERBOSE
if (g1_policy()->should_initiate_conc_mark()) {
if (g1_policy()->during_initial_mark_pause()) {
concurrent_mark()->checkpointRootsInitialPre();
}
save_marks();
@ -2858,7 +2863,7 @@ G1CollectedHeap::do_collection_pause_at_safepoint() {
}
if (g1_policy()->in_young_gc_mode() &&
g1_policy()->should_initiate_conc_mark()) {
g1_policy()->during_initial_mark_pause()) {
concurrent_mark()->checkpointRootsInitialPost();
set_marking_started();
// CAUTION: after the doConcurrentMark() call below,
@ -2937,6 +2942,9 @@ void G1CollectedHeap::set_gc_alloc_region(int purpose, HeapRegion* r) {
// the same region
assert(r == NULL || !r->is_gc_alloc_region(),
"shouldn't already be a GC alloc region");
assert(r == NULL || !r->isHumongous(),
"humongous regions shouldn't be used as GC alloc regions");
HeapWord* original_top = NULL;
if (r != NULL)
original_top = r->top();
@ -3079,12 +3087,17 @@ void G1CollectedHeap::get_gc_alloc_regions() {
if (alloc_region->in_collection_set() ||
alloc_region->top() == alloc_region->end() ||
alloc_region->top() == alloc_region->bottom()) {
// we will discard the current GC alloc region if it's in the
// collection set (it can happen!), if it's already full (no
// point in using it), or if it's empty (this means that it
// was emptied during a cleanup and it should be on the free
// list now).
alloc_region->top() == alloc_region->bottom() ||
alloc_region->isHumongous()) {
// we will discard the current GC alloc region if
// * it's in the collection set (it can happen!),
// * it's already full (no point in using it),
// * it's empty (this means that it was emptied during
// a cleanup and it should be on the free list now), or
// * it's humongous (this means that it was emptied
// during a cleanup and was added to the free list, but
// has been subseqently used to allocate a humongous
// object that may be less than the region size).
alloc_region = NULL;
}
@ -3977,7 +3990,7 @@ public:
OopsInHeapRegionClosure *scan_perm_cl;
OopsInHeapRegionClosure *scan_so_cl;
if (_g1h->g1_policy()->should_initiate_conc_mark()) {
if (_g1h->g1_policy()->during_initial_mark_pause()) {
scan_root_cl = &scan_mark_root_cl;
scan_perm_cl = &scan_mark_perm_cl;
scan_so_cl = &scan_mark_heap_rs_cl;
@ -4140,7 +4153,7 @@ G1CollectedHeap::scan_scan_only_set(OopsInHeapRegionClosure* oc,
FilterAndMarkInHeapRegionAndIntoCSClosure scan_and_mark(this, &boc, concurrent_mark());
OopsInHeapRegionClosure *foc;
if (g1_policy()->should_initiate_conc_mark())
if (g1_policy()->during_initial_mark_pause())
foc = &scan_and_mark;
else
foc = &scan_only;

@ -178,8 +178,8 @@ G1CollectorPolicy::G1CollectorPolicy() :
// so the hack is to do the cast QQQ FIXME
_pauses_btwn_concurrent_mark((size_t)G1PausesBtwnConcMark),
_n_marks_since_last_pause(0),
_conc_mark_initiated(false),
_should_initiate_conc_mark(false),
_initiate_conc_mark_if_possible(false),
_during_initial_mark_pause(false),
_should_revert_to_full_young_gcs(false),
_last_full_young_gc(false),
@ -198,7 +198,9 @@ G1CollectorPolicy::G1CollectorPolicy() :
_recorded_survivor_regions(0),
_recorded_survivor_head(NULL),
_recorded_survivor_tail(NULL),
_survivors_age_table(true)
_survivors_age_table(true),
_gc_overhead_perc(0.0)
{
// Set up the region size and associated fields. Given that the
@ -275,6 +277,11 @@ G1CollectorPolicy::G1CollectorPolicy() :
// calculate_young_list_target_config during initialization
_max_survivor_regions = G1FixedSurvivorSpaceSize / HeapRegion::GrainBytes;
assert(GCTimeRatio > 0,
"we should have set it to a default value set_g1_gc_flags() "
"if a user set it to 0");
_gc_overhead_perc = 100.0 * (1.0 / (1.0 + GCTimeRatio));
initialize_all();
}
@ -786,7 +793,7 @@ void G1CollectorPolicy::calculate_young_list_target_config(size_t rs_lengths) {
elapsed_time_ms,
calculations,
full_young_gcs() ? "full" : "partial",
should_initiate_conc_mark() ? " i-m" : "",
during_initial_mark_pause() ? " i-m" : "",
_in_marking_window,
_in_marking_window_im);
#endif // TRACE_CALC_YOUNG_CONFIG
@ -1033,7 +1040,8 @@ void G1CollectorPolicy::record_full_collection_end() {
set_full_young_gcs(true);
_last_full_young_gc = false;
_should_revert_to_full_young_gcs = false;
_should_initiate_conc_mark = false;
clear_initiate_conc_mark_if_possible();
clear_during_initial_mark_pause();
_known_garbage_bytes = 0;
_known_garbage_ratio = 0.0;
_in_marking_window = false;
@ -1179,7 +1187,8 @@ void G1CollectorPolicy::record_concurrent_mark_init_start() {
void G1CollectorPolicy::record_concurrent_mark_init_end_pre(double
mark_init_elapsed_time_ms) {
_during_marking = true;
_should_initiate_conc_mark = false;
assert(!initiate_conc_mark_if_possible(), "we should have cleared it by now");
clear_during_initial_mark_pause();
_cur_mark_stop_world_time_ms = mark_init_elapsed_time_ms;
}
@ -1250,7 +1259,6 @@ void G1CollectorPolicy::record_concurrent_mark_cleanup_end_work2() {
}
_n_pauses_at_mark_end = _n_pauses;
_n_marks_since_last_pause++;
_conc_mark_initiated = false;
}
void
@ -1446,17 +1454,24 @@ void G1CollectorPolicy::record_collection_pause_end(bool abandoned) {
#endif // PRODUCT
if (in_young_gc_mode()) {
last_pause_included_initial_mark = _should_initiate_conc_mark;
last_pause_included_initial_mark = during_initial_mark_pause();
if (last_pause_included_initial_mark)
record_concurrent_mark_init_end_pre(0.0);
size_t min_used_targ =
(_g1->capacity() / 100) * InitiatingHeapOccupancyPercent;
if (cur_used_bytes > min_used_targ) {
if (cur_used_bytes <= _prev_collection_pause_used_at_end_bytes) {
} else if (!_g1->mark_in_progress() && !_last_full_young_gc) {
_should_initiate_conc_mark = true;
if (!_g1->mark_in_progress() && !_last_full_young_gc) {
assert(!last_pause_included_initial_mark, "invariant");
if (cur_used_bytes > min_used_targ &&
cur_used_bytes > _prev_collection_pause_used_at_end_bytes) {
assert(!during_initial_mark_pause(), "we should not see this here");
// Note: this might have already been set, if during the last
// pause we decided to start a cycle but at the beginning of
// this pause we decided to postpone it. That's OK.
set_initiate_conc_mark_if_possible();
}
}
@ -1747,7 +1762,7 @@ void G1CollectorPolicy::record_collection_pause_end(bool abandoned) {
bool new_in_marking_window = _in_marking_window;
bool new_in_marking_window_im = false;
if (_should_initiate_conc_mark) {
if (during_initial_mark_pause()) {
new_in_marking_window = true;
new_in_marking_window_im = true;
}
@ -2166,7 +2181,13 @@ void G1CollectorPolicy::check_if_region_is_too_expensive(double
if (predicted_time_ms > _expensive_region_limit_ms) {
if (!in_young_gc_mode()) {
set_full_young_gcs(true);
_should_initiate_conc_mark = true;
// We might want to do something different here. However,
// right now we don't support the non-generational G1 mode
// (and in fact we are planning to remove the associated code,
// see CR 6814390). So, let's leave it as is and this will be
// removed some time in the future
ShouldNotReachHere();
set_during_initial_mark_pause();
} else
// no point in doing another partial one
_should_revert_to_full_young_gcs = true;
@ -2288,7 +2309,7 @@ G1CollectorPolicy::conservative_avg_survival_fraction_work(double avg,
}
size_t G1CollectorPolicy::expansion_amount() {
if ((int)(recent_avg_pause_time_ratio() * 100.0) > G1GCPercent) {
if ((recent_avg_pause_time_ratio() * 100.0) > _gc_overhead_perc) {
// We will double the existing space, or take
// G1ExpandByPercentOfAvailable % of the available expansion
// space, whichever is smaller, bounded below by a minimum
@ -2689,6 +2710,50 @@ bool G1CollectorPolicy_BestRegionsFirst::assertMarkedBytesDataOK() {
}
#endif
void
G1CollectorPolicy::decide_on_conc_mark_initiation() {
// We are about to decide on whether this pause will be an
// initial-mark pause.
// First, during_initial_mark_pause() should not be already set. We
// will set it here if we have to. However, it should be cleared by
// the end of the pause (it's only set for the duration of an
// initial-mark pause).
assert(!during_initial_mark_pause(), "pre-condition");
if (initiate_conc_mark_if_possible()) {
// We had noticed on a previous pause that the heap occupancy has
// gone over the initiating threshold and we should start a
// concurrent marking cycle. So we might initiate one.
bool during_cycle = _g1->concurrent_mark()->cmThread()->during_cycle();
if (!during_cycle) {
// The concurrent marking thread is not "during a cycle", i.e.,
// it has completed the last one. So we can go ahead and
// initiate a new cycle.
set_during_initial_mark_pause();
// And we can now clear initiate_conc_mark_if_possible() as
// we've already acted on it.
clear_initiate_conc_mark_if_possible();
} else {
// The concurrent marking thread is still finishing up the
// previous cycle. If we start one right now the two cycles
// overlap. In particular, the concurrent marking thread might
// be in the process of clearing the next marking bitmap (which
// we will use for the next cycle if we start one). Starting a
// cycle now will be bad given that parts of the marking
// information might get cleared by the marking thread. And we
// cannot wait for the marking thread to finish the cycle as it
// periodically yields while clearing the next marking bitmap
// and, if it's in a yield point, it's waiting for us to
// finish. So, at this point we will not start a cycle and we'll
// let the concurrent marking thread complete the last one.
}
}
}
void
G1CollectorPolicy_BestRegionsFirst::
record_collection_pause_start(double start_time_sec, size_t start_used) {

@ -215,6 +215,8 @@ protected:
SurvRateGroup* _survivor_surv_rate_group;
// add here any more surv rate groups
double _gc_overhead_perc;
bool during_marking() {
return _during_marking;
}
@ -722,11 +724,31 @@ protected:
size_t _n_marks_since_last_pause;
// True iff CM has been initiated.
bool _conc_mark_initiated;
// At the end of a pause we check the heap occupancy and we decide
// whether we will start a marking cycle during the next pause. If
// we decide that we want to do that, we will set this parameter to
// true. So, this parameter will stay true between the end of a
// pause and the beginning of a subsequent pause (not necessarily
// the next one, see the comments on the next field) when we decide
// that we will indeed start a marking cycle and do the initial-mark
// work.
volatile bool _initiate_conc_mark_if_possible;
// If initiate_conc_mark_if_possible() is set at the beginning of a
// pause, it is a suggestion that the pause should start a marking
// cycle by doing the initial-mark work. However, it is possible
// that the concurrent marking thread is still finishing up the
// previous marking cycle (e.g., clearing the next marking
// bitmap). If that is the case we cannot start a new cycle and
// we'll have to wait for the concurrent marking thread to finish
// what it is doing. In this case we will postpone the marking cycle
// initiation decision for the next pause. When we eventually decide
// to start a cycle, we will set _during_initial_mark_pause which
// will stay true until the end of the initial-mark pause and it's
// the condition that indicates that a pause is doing the
// initial-mark work.
volatile bool _during_initial_mark_pause;
// True iff CM should be initiated
bool _should_initiate_conc_mark;
bool _should_revert_to_full_young_gcs;
bool _last_full_young_gc;
@ -979,9 +1001,21 @@ public:
// Add "hr" to the CS.
void add_to_collection_set(HeapRegion* hr);
bool should_initiate_conc_mark() { return _should_initiate_conc_mark; }
void set_should_initiate_conc_mark() { _should_initiate_conc_mark = true; }
void unset_should_initiate_conc_mark(){ _should_initiate_conc_mark = false; }
bool initiate_conc_mark_if_possible() { return _initiate_conc_mark_if_possible; }
void set_initiate_conc_mark_if_possible() { _initiate_conc_mark_if_possible = true; }
void clear_initiate_conc_mark_if_possible() { _initiate_conc_mark_if_possible = false; }
bool during_initial_mark_pause() { return _during_initial_mark_pause; }
void set_during_initial_mark_pause() { _during_initial_mark_pause = true; }
void clear_during_initial_mark_pause(){ _during_initial_mark_pause = false; }
// This is called at the very beginning of an evacuation pause (it
// has to be the first thing that the pause does). If
// initiate_conc_mark_if_possible() is true, and the concurrent
// marking thread has completed its work during the previous cycle,
// it will set during_initial_mark_pause() to so that the pause does
// the initial-mark work and start a marking cycle.
void decide_on_conc_mark_initiation();
// If an expansion would be appropriate, because recent GC overhead had
// exceeded the desired limit, return an amount to expand by.

@ -40,9 +40,6 @@
develop(bool, G1Gen, true, \
"If true, it will enable the generational G1") \
\
develop(intx, G1GCPercent, 10, \
"The desired percent time spent on GC") \
\
develop(intx, G1PolicyVerbose, 0, \
"The verbosity level on G1 policy decisions") \
\
@ -270,11 +267,11 @@
product(uintx, G1HeapRegionSize, 0, \
"Size of the G1 regions.") \
\
experimental(bool, G1UseParallelRSetUpdating, false, \
experimental(bool, G1UseParallelRSetUpdating, true, \
"Enables the parallelization of remembered set updating " \
"during evacuation pauses") \
\
experimental(bool, G1UseParallelRSetScanning, false, \
experimental(bool, G1UseParallelRSetScanning, true, \
"Enables the parallelization of remembered set scanning " \
"during evacuation pauses") \
\

@ -2328,6 +2328,17 @@ run:
}
DEFAULT:
#ifdef ZERO
// Some zero configurations use the C++ interpreter as a
// fallback interpreter and have support for platform
// specific fast bytecodes which aren't supported here, so
// redispatch to the equivalent non-fast bytecode when they
// are encountered.
if (Bytecodes::is_defined((Bytecodes::Code)opcode)) {
opcode = (jubyte)Bytecodes::java_code((Bytecodes::Code)opcode);
goto opcode_switch;
}
#endif
fatal2("\t*** Unimplemented opcode: %d = %s\n",
opcode, Bytecodes::name((Bytecodes::Code)opcode));
goto finish;

@ -111,7 +111,22 @@ public:
// Allocate size HeapWords. The memory is NOT initialized to zero.
inline HeapWord* allocate(size_t size);
static size_t alignment_reserve() { return align_object_size(typeArrayOopDesc::header_size(T_INT)); }
// Reserve space at the end of TLAB
static size_t end_reserve() {
int reserve_size = typeArrayOopDesc::header_size(T_INT);
if (AllocatePrefetchStyle == 3) {
// BIS is used to prefetch - we need a space for it.
// +1 for rounding up to next cache line +1 to be safe
int lines = AllocatePrefetchLines + 2;
int step_size = AllocatePrefetchStepSize;
int distance = AllocatePrefetchDistance;
int prefetch_end = (distance + step_size*lines)/(int)HeapWordSize;
reserve_size = MAX2(reserve_size, prefetch_end);
}
return reserve_size;
}
static size_t alignment_reserve() { return align_object_size(end_reserve()); }
static size_t alignment_reserve_in_bytes() { return alignment_reserve() * HeapWordSize; }
// Return tlab size or remaining space in eden such that the

@ -123,16 +123,16 @@ void typeArrayKlass::copy_array(arrayOop s, int src_pos, arrayOop d, int dst_pos
|| (((unsigned int) length + (unsigned int) dst_pos) > (unsigned int) d->length()) ) {
THROW(vmSymbols::java_lang_ArrayIndexOutOfBoundsException());
}
// Check zero copy
if (length == 0)
return;
// This is an attempt to make the copy_array fast.
// NB: memmove takes care of overlapping memory segments.
// Potential problem: memmove is not guaranteed to be word atomic
// Revisit in Merlin
int l2es = log2_element_size();
int ihs = array_header_in_bytes() / wordSize;
char* src = (char*) ((oop*)s + ihs) + (src_pos << l2es);
char* dst = (char*) ((oop*)d + ihs) + (dst_pos << l2es);
memmove(dst, src, length << l2es);
char* src = (char*) ((oop*)s + ihs) + ((size_t)src_pos << l2es);
char* dst = (char*) ((oop*)d + ihs) + ((size_t)dst_pos << l2es);
Copy::conjoint_memory_atomic(src, dst, (size_t)length << l2es);
}

@ -52,9 +52,6 @@
"Code alignment for interior entry points " \
"in generated code (in bytes)") \
\
product_pd(intx, OptoLoopAlignment, \
"Align inner loops to zero relative to this modulus") \
\
product(intx, MaxLoopPad, (OptoLoopAlignment-1), \
"Align a loop if padding size in bytes is less or equal to this value") \
\

@ -956,6 +956,7 @@ const Type *PhiNode::Value( PhaseTransform *phase ) const {
}
if( jtkp && ttkp ) {
if( jtkp->is_loaded() && jtkp->klass()->is_interface() &&
!jtkp->klass_is_exact() && // Keep exact interface klass (6894807)
ttkp->is_loaded() && !ttkp->klass()->is_interface() ) {
assert(ft == ttkp->cast_to_ptr_type(jtkp->ptr()) ||
ft->isa_narrowoop() && ft->make_ptr() == ttkp->cast_to_ptr_type(jtkp->ptr()), "");

@ -714,8 +714,6 @@ void Parse::catch_inline_exceptions(SafePointNode* ex_map) {
// iterate through all entries sequentially
for (;!handlers.is_done(); handlers.next()) {
// Do nothing if turned off
if( !DeutschShiffmanExceptions ) break;
ciExceptionHandler* handler = handlers.handler();
if (handler->is_rethrow()) {
@ -741,46 +739,26 @@ void Parse::catch_inline_exceptions(SafePointNode* ex_map) {
return; // No more handling to be done here!
}
// %%% The following logic replicates make_from_klass_unique.
// TO DO: Replace by a subroutine call. Then generalize
// the type check, as noted in the next "%%%" comment.
// Get the handler's klass
ciInstanceKlass* klass = handler->catch_klass();
if (UseUniqueSubclasses) {
// (We use make_from_klass because it respects UseUniqueSubclasses.)
const TypeOopPtr* tp = TypeOopPtr::make_from_klass(klass);
klass = tp->klass()->as_instance_klass();
if (!klass->is_loaded()) { // klass is not loaded?
// fall through into catch_call_exceptions which will emit a
// handler with an uncommon trap.
break;
}
// Get the handler's klass
if (!klass->is_loaded()) // klass is not loaded?
break; // Must call Rethrow!
if (klass->is_interface()) // should not happen, but...
break; // bail out
// See if the loaded exception klass has no subtypes
if (klass->has_subklass())
break; // Cannot easily do precise test ==> Rethrow
// %%% Now that subclass checking is very fast, we need to rewrite
// this section and remove the option "DeutschShiffmanExceptions".
// The exception processing chain should be a normal typecase pattern,
// with a bailout to the interpreter only in the case of unloaded
// classes. (The bailout should mark the method non-entrant.)
// This rewrite should be placed in GraphKit::, not Parse::.
// Add a dependence; if any subclass added we need to recompile
// %%% should use stronger assert_unique_concrete_subtype instead
if (!klass->is_final()) {
C->dependencies()->assert_leaf_type(klass);
}
// Implement precise test
// Check the type of the exception against the catch type
const TypeKlassPtr *tk = TypeKlassPtr::make(klass);
Node* con = _gvn.makecon(tk);
Node* cmp = _gvn.transform( new (C, 3) CmpPNode(ex_klass_node, con) );
Node* bol = _gvn.transform( new (C, 2) BoolNode(cmp, BoolTest::ne) );
{ BuildCutout unless(this, bol, PROB_LIKELY(0.7f));
const TypeInstPtr* tinst = TypeInstPtr::make_exact(TypePtr::NotNull, klass);
Node* not_subtype_ctrl = gen_subtype_check(ex_klass_node, con);
if (!stopped()) {
PreserveJVMState pjvms(this);
const TypeInstPtr* tinst = TypeOopPtr::make_from_klass_unique(klass)->cast_to_ptr_type(TypePtr::NotNull)->is_instptr();
assert(klass->has_subklass() || tinst->klass_is_exact(), "lost exactness");
Node* ex_oop = _gvn.transform(new (C, 2) CheckCastPPNode(control(), ex_node, tinst));
push_ex_oop(ex_oop); // Push exception oop for handler
#ifndef PRODUCT
@ -792,6 +770,7 @@ void Parse::catch_inline_exceptions(SafePointNode* ex_map) {
#endif
merge_exception(handler_bci);
}
set_control(not_subtype_ctrl);
// Come here if exception does not match handler.
// Carry on with more handler checks.
@ -800,21 +779,6 @@ void Parse::catch_inline_exceptions(SafePointNode* ex_map) {
assert(!stopped(), "you should return if you finish the chain");
if (remaining == 1) {
// Further checks do not matter.
}
if (can_rerun_bytecode()) {
// Do not push_ex_oop here!
// Re-executing the bytecode will reproduce the throwing condition.
bool must_throw = true;
uncommon_trap(Deoptimization::Reason_unhandled,
Deoptimization::Action_none,
(ciKlass*)NULL, (const char*)NULL, // default args
must_throw);
return;
}
// Oops, need to call into the VM to resolve the klasses at runtime.
// Note: This call must not deoptimize, since it is not a real at this bci!
kill_dead_locals();

@ -1487,11 +1487,11 @@ Node* PhaseMacroExpand::prefetch_allocation(Node* i_o, Node*& needgc_false,
Node*& contended_phi_rawmem,
Node* old_eden_top, Node* new_eden_top,
Node* length) {
enum { fall_in_path = 1, pf_path = 2 };
if( UseTLAB && AllocatePrefetchStyle == 2 ) {
// Generate prefetch allocation with watermark check.
// As an allocation hits the watermark, we will prefetch starting
// at a "distance" away from watermark.
enum { fall_in_path = 1, pf_path = 2 };
Node *pf_region = new (C, 3) RegionNode(3);
Node *pf_phi_rawmem = new (C, 3) PhiNode( pf_region, Type::MEMORY,
@ -1570,6 +1570,45 @@ Node* PhaseMacroExpand::prefetch_allocation(Node* i_o, Node*& needgc_false,
needgc_false = pf_region;
contended_phi_rawmem = pf_phi_rawmem;
i_o = pf_phi_abio;
} else if( UseTLAB && AllocatePrefetchStyle == 3 ) {
// Insert a prefetch for each allocation only on the fast-path
Node *pf_region = new (C, 3) RegionNode(3);
Node *pf_phi_rawmem = new (C, 3) PhiNode( pf_region, Type::MEMORY,
TypeRawPtr::BOTTOM );
// Generate several prefetch instructions only for arrays.
uint lines = (length != NULL) ? AllocatePrefetchLines : 1;
uint step_size = AllocatePrefetchStepSize;
uint distance = AllocatePrefetchDistance;
// Next cache address.
Node *cache_adr = new (C, 4) AddPNode(old_eden_top, old_eden_top,
_igvn.MakeConX(distance));
transform_later(cache_adr);
cache_adr = new (C, 2) CastP2XNode(needgc_false, cache_adr);
transform_later(cache_adr);
Node* mask = _igvn.MakeConX(~(intptr_t)(step_size-1));
cache_adr = new (C, 3) AndXNode(cache_adr, mask);
transform_later(cache_adr);
cache_adr = new (C, 2) CastX2PNode(cache_adr);
transform_later(cache_adr);
// Prefetch
Node *prefetch = new (C, 3) PrefetchWriteNode( contended_phi_rawmem, cache_adr );
prefetch->set_req(0, needgc_false);
transform_later(prefetch);
contended_phi_rawmem = prefetch;
Node *prefetch_adr;
distance = step_size;
for ( uint i = 1; i < lines; i++ ) {
prefetch_adr = new (C, 4) AddPNode( cache_adr, cache_adr,
_igvn.MakeConX(distance) );
transform_later(prefetch_adr);
prefetch = new (C, 3) PrefetchWriteNode( contended_phi_rawmem, prefetch_adr );
transform_later(prefetch);
distance += step_size;
contended_phi_rawmem = prefetch;
}
} else if( AllocatePrefetchStyle > 0 ) {
// Insert a prefetch for each allocation only on the fast-path
Node *prefetch_adr;

@ -1244,5 +1244,5 @@ public:
virtual int Opcode() const;
virtual uint ideal_reg() const { return NotAMachineReg; }
virtual uint match_edge(uint idx) const { return idx==2; }
virtual const Type *bottom_type() const { return Type::ABIO; }
virtual const Type *bottom_type() const { return ( AllocatePrefetchStyle == 3 ) ? Type::MEMORY : Type::ABIO; }
};

@ -551,9 +551,6 @@ class Parse : public GraphKit {
// Also handles exceptions for individual bytecodes.
void catch_inline_exceptions(SafePointNode* ex_map);
// Bytecode classifier, helps decide to use uncommon_trap vs. rethrow_C.
bool can_rerun_bytecode();
// Merge the given map into correct exceptional exit state.
// Assumes that there is no applicable local handler.
void throw_to_exit(SafePointNode* ex_map);

@ -798,67 +798,6 @@ void Compile::rethrow_exceptions(JVMState* jvms) {
initial_gvn()->transform_no_reclaim(exit);
}
bool Parse::can_rerun_bytecode() {
switch (bc()) {
case Bytecodes::_ldc:
case Bytecodes::_ldc_w:
case Bytecodes::_ldc2_w:
case Bytecodes::_getfield:
case Bytecodes::_putfield:
case Bytecodes::_getstatic:
case Bytecodes::_putstatic:
case Bytecodes::_arraylength:
case Bytecodes::_baload:
case Bytecodes::_caload:
case Bytecodes::_iaload:
case Bytecodes::_saload:
case Bytecodes::_faload:
case Bytecodes::_aaload:
case Bytecodes::_laload:
case Bytecodes::_daload:
case Bytecodes::_bastore:
case Bytecodes::_castore:
case Bytecodes::_iastore:
case Bytecodes::_sastore:
case Bytecodes::_fastore:
case Bytecodes::_aastore:
case Bytecodes::_lastore:
case Bytecodes::_dastore:
case Bytecodes::_irem:
case Bytecodes::_idiv:
case Bytecodes::_lrem:
case Bytecodes::_ldiv:
case Bytecodes::_frem:
case Bytecodes::_fdiv:
case Bytecodes::_drem:
case Bytecodes::_ddiv:
case Bytecodes::_checkcast:
case Bytecodes::_instanceof:
case Bytecodes::_anewarray:
case Bytecodes::_newarray:
case Bytecodes::_multianewarray:
case Bytecodes::_new:
case Bytecodes::_monitorenter: // can re-run initial null check, only
case Bytecodes::_return:
return true;
break;
// Don't rerun athrow since it's part of the exception path.
case Bytecodes::_athrow:
case Bytecodes::_invokestatic:
case Bytecodes::_invokedynamic:
case Bytecodes::_invokespecial:
case Bytecodes::_invokevirtual:
case Bytecodes::_invokeinterface:
return false;
break;
default:
assert(false, "unexpected bytecode produced an exception");
return true;
}
}
//---------------------------do_exceptions-------------------------------------
// Process exceptions arising from the current bytecode.
// Send caught exceptions to the proper handler within this method.
@ -872,9 +811,6 @@ void Parse::do_exceptions() {
return;
}
// Make sure we can classify this bytecode if we need to.
debug_only(can_rerun_bytecode());
PreserveJVMState pjvms(this, false);
SafePointNode* ex_map;

@ -865,7 +865,7 @@ JRT_ENTRY_NO_ASYNC(address, OptoRuntime::handle_exception_C_helper(JavaThread* t
thread->set_exception_stack_size(0);
// Check if the exception PC is a MethodHandle call site.
thread->set_is_method_handle_exception(nm->is_method_handle_return(pc));
thread->set_is_method_handle_return(nm->is_method_handle_return(pc));
}
// Restore correct return pc. Was saved above.

@ -2545,12 +2545,15 @@ const Type *TypeOopPtr::filter( const Type *kills ) const {
ftip->is_loaded() && ftip->klass()->is_interface() &&
ktip->is_loaded() && !ktip->klass()->is_interface()) {
// Happens in a CTW of rt.jar, 320-341, no extra flags
assert(!ftip->klass_is_exact(), "interface could not be exact");
return ktip->cast_to_ptr_type(ftip->ptr());
}
// Interface klass type could be exact in opposite to interface type,
// return it here instead of incorrect Constant ptr J/L/Object (6894807).
if (ftkp != NULL && ktkp != NULL &&
ftkp->is_loaded() && ftkp->klass()->is_interface() &&
!ftkp->klass_is_exact() && // Keep exact interface klass
ktkp->is_loaded() && !ktkp->klass()->is_interface()) {
// Happens in a CTW of rt.jar, 320-341, no extra flags
return ktkp->cast_to_ptr_type(ftkp->ptr());
}

@ -55,12 +55,11 @@ class vframeStreamForte : public vframeStreamCommon {
};
static void is_decipherable_compiled_frame(frame* fr, RegisterMap* map,
bool* is_compiled_p, bool* is_walkable_p);
static bool is_decipherable_compiled_frame(JavaThread* thread, frame* fr, nmethod* nm);
static bool is_decipherable_interpreted_frame(JavaThread* thread,
frame* fr,
methodOop* method_p,
int* bci_p);
frame* fr,
methodOop* method_p,
int* bci_p);
@ -122,41 +121,43 @@ void vframeStreamForte::forte_next() {
// Determine if 'fr' is a decipherable compiled frame. We are already
// assured that fr is for a java nmethod.
static bool is_decipherable_compiled_frame(frame* fr) {
assert(fr->cb() != NULL && fr->cb()->is_nmethod(), "invariant");
nmethod* nm = (nmethod*) fr->cb();
static bool is_decipherable_compiled_frame(JavaThread* thread, frame* fr, nmethod* nm) {
assert(nm->is_java_method(), "invariant");
// First try and find an exact PcDesc
PcDesc* pc_desc = nm->pc_desc_at(fr->pc());
// Did we find a useful PcDesc?
if (pc_desc != NULL &&
pc_desc->scope_decode_offset() == DebugInformationRecorder::serialized_null) {
address probe_pc = fr->pc() + 1;
pc_desc = nm->pc_desc_near(probe_pc);
// Now do we have a useful PcDesc?
if (thread->has_last_Java_frame() && thread->last_Java_pc() == fr->pc()) {
// We're stopped at a call into the JVM so look for a PcDesc with
// the actual pc reported by the frame.
PcDesc* pc_desc = nm->pc_desc_at(fr->pc());
// Did we find a useful PcDesc?
if (pc_desc != NULL &&
pc_desc->scope_decode_offset() == DebugInformationRecorder::serialized_null) {
// No debug information available for this pc
// vframeStream would explode if we try and walk the frames.
return false;
pc_desc->scope_decode_offset() != DebugInformationRecorder::serialized_null) {
return true;
}
// This PcDesc is useful however we must adjust the frame's pc
// so that the vframeStream lookups will use this same pc
fr->set_pc(pc_desc->real_pc(nm));
}
// We're at some random pc in the nmethod so search for the PcDesc
// whose pc is greater than the current PC. It's done this way
// because the extra PcDescs that are recorded for improved debug
// info record the end of the region covered by the ScopeDesc
// instead of the beginning.
PcDesc* pc_desc = nm->pc_desc_near(fr->pc() + 1);
// Now do we have a useful PcDesc?
if (pc_desc == NULL ||
pc_desc->scope_decode_offset() == DebugInformationRecorder::serialized_null) {
// No debug information available for this pc
// vframeStream would explode if we try and walk the frames.
return false;
}
// This PcDesc is useful however we must adjust the frame's pc
// so that the vframeStream lookups will use this same pc
fr->set_pc(pc_desc->real_pc(nm));
return true;
}
// Determine if 'fr' is a walkable interpreted frame. Returns false
// if it is not. *method_p, and *bci_p are not set when false is
// returned. *method_p is non-NULL if frame was executing a Java
@ -166,9 +167,9 @@ static bool is_decipherable_compiled_frame(frame* fr) {
// even if a valid BCI cannot be found.
static bool is_decipherable_interpreted_frame(JavaThread* thread,
frame* fr,
methodOop* method_p,
int* bci_p) {
frame* fr,
methodOop* method_p,
int* bci_p) {
assert(fr->is_interpreted_frame(), "just checking");
// top frame is an interpreted frame
@ -323,13 +324,15 @@ static bool find_initial_Java_frame(JavaThread* thread,
// have a PCDesc that can get us a bci however we did find
// a method
if (!is_decipherable_compiled_frame(&candidate)) {
if (!is_decipherable_compiled_frame(thread, &candidate, nm)) {
return false;
}
// is_decipherable_compiled_frame may modify candidate's pc
*initial_frame_p = candidate;
assert(nm->pc_desc_at(candidate.pc()) != NULL, "if it's decipherable then pc must be valid");
return true;
}

@ -1353,6 +1353,16 @@ void Arguments::set_g1_gc_flags() {
MarkStackSize / K, MarkStackSizeMax / K);
tty->print_cr("ConcGCThreads: %u", ConcGCThreads);
}
if (FLAG_IS_DEFAULT(GCTimeRatio) || GCTimeRatio == 0) {
// In G1, we want the default GC overhead goal to be higher than
// say in PS. So we set it here to 10%. Otherwise the heap might
// be expanded more aggressively than we would like it to. In
// fact, even 10% seems to not be high enough in some cases
// (especially small GC stress tests that the main thing they do
// is allocation). We might consider increase it further.
FLAG_SET_DEFAULT(GCTimeRatio, 9);
}
}
void Arguments::set_heap_size() {

@ -1052,7 +1052,8 @@ class CommandLineFlags {
"Use SSE2 MOVDQU instruction for Arraycopy") \
\
product(intx, FieldsAllocationStyle, 1, \
"0 - type based with oops first, 1 - with oops last") \
"0 - type based with oops first, 1 - with oops last, " \
"2 - oops in super and sub classes are together") \
\
product(bool, CompactFields, true, \
"Allocate nonstatic fields in gaps between previous fields") \
@ -2502,10 +2503,6 @@ class CommandLineFlags {
notproduct(bool, TraceSpilling, false, \
"Trace spilling") \
\
develop(bool, DeutschShiffmanExceptions, true, \
"Fast check to find exception handler for precisely typed " \
"exceptions") \
\
product(bool, SplitIfBlocks, true, \
"Clone compares and control flow through merge points to fold " \
"some branches") \
@ -2711,7 +2708,8 @@ class CommandLineFlags {
product(intx, AllocatePrefetchStyle, 1, \
"0 = no prefetch, " \
"1 = prefetch instructions for each allocation, " \
"2 = use TLAB watermark to gate allocation prefetch") \
"2 = use TLAB watermark to gate allocation prefetch, " \
"3 = use BIS instruction on Sparc for allocation prefetch") \
\
product(intx, AllocatePrefetchDistance, -1, \
"Distance to prefetch ahead of allocation pointer") \
@ -3114,6 +3112,9 @@ class CommandLineFlags {
develop_pd(intx, CodeEntryAlignment, \
"Code entry alignment for generated code (in bytes)") \
\
product_pd(intx, OptoLoopAlignment, \
"Align inner loops to zero relative to this modulus") \
\
product_pd(uintx, InitialCodeCacheSize, \
"Initial code cache size (in bytes)") \
\

@ -70,6 +70,7 @@ Monitor* FullGCCount_lock = NULL;
Monitor* CMark_lock = NULL;
Monitor* ZF_mon = NULL;
Monitor* Cleanup_mon = NULL;
Mutex* CMRegionStack_lock = NULL;
Mutex* SATB_Q_FL_lock = NULL;
Monitor* SATB_Q_CBL_mon = NULL;
Mutex* Shared_SATB_Q_lock = NULL;
@ -167,6 +168,7 @@ void mutex_init() {
def(CMark_lock , Monitor, nonleaf, true ); // coordinate concurrent mark thread
def(ZF_mon , Monitor, leaf, true );
def(Cleanup_mon , Monitor, nonleaf, true );
def(CMRegionStack_lock , Mutex, leaf, true );
def(SATB_Q_FL_lock , Mutex , special, true );
def(SATB_Q_CBL_mon , Monitor, nonleaf, true );
def(Shared_SATB_Q_lock , Mutex, nonleaf, true );

@ -63,6 +63,7 @@ extern Monitor* FullGCCount_lock; // in support of "concurrent" f
extern Monitor* CMark_lock; // used for concurrent mark thread coordination
extern Monitor* ZF_mon; // used for G1 conc zero-fill.
extern Monitor* Cleanup_mon; // used for G1 conc cleanup.
extern Mutex* CMRegionStack_lock; // used for protecting accesses to the CM region stack
extern Mutex* SATB_Q_FL_lock; // Protects SATB Q
// buffer free list.
extern Monitor* SATB_Q_CBL_mon; // Protects SATB Q

@ -259,13 +259,16 @@ JRT_END
address SharedRuntime::raw_exception_handler_for_return_address(JavaThread* thread, address return_address) {
assert(frame::verify_return_pc(return_address), "must be a return pc");
// Reset MethodHandle flag.
thread->set_is_method_handle_return(false);
// the fastest case first
CodeBlob* blob = CodeCache::find_blob(return_address);
if (blob != NULL && blob->is_nmethod()) {
nmethod* code = (nmethod*)blob;
assert(code != NULL, "nmethod must be present");
// Check if the return address is a MethodHandle call site.
thread->set_is_method_handle_exception(code->is_method_handle_return(return_address));
thread->set_is_method_handle_return(code->is_method_handle_return(return_address));
// native nmethods don't have exception handlers
assert(!code->is_native_method(), "no exception handler");
assert(code->header_begin() != code->exception_begin(), "no exception handler");
@ -292,7 +295,7 @@ address SharedRuntime::raw_exception_handler_for_return_address(JavaThread* thre
nmethod* code = (nmethod*)blob;
assert(code != NULL, "nmethod must be present");
// Check if the return address is a MethodHandle call site.
thread->set_is_method_handle_exception(code->is_method_handle_return(return_address));
thread->set_is_method_handle_return(code->is_method_handle_return(return_address));
assert(code->header_begin() != code->exception_begin(), "no exception handler");
return code->exception_begin();
}

@ -772,7 +772,7 @@ class JavaThread: public Thread {
volatile address _exception_pc; // PC where exception happened
volatile address _exception_handler_pc; // PC for handler of exception
volatile int _exception_stack_size; // Size of frame where exception happened
volatile int _is_method_handle_exception; // True if the current exception PC is at a MethodHandle call.
volatile int _is_method_handle_return; // true (== 1) if the current exception PC is a MethodHandle call site.
// support for compilation
bool _is_compiling; // is true if a compilation is active inthis thread (one compilation per thread possible)
@ -1108,13 +1108,13 @@ class JavaThread: public Thread {
int exception_stack_size() const { return _exception_stack_size; }
address exception_pc() const { return _exception_pc; }
address exception_handler_pc() const { return _exception_handler_pc; }
int is_method_handle_exception() const { return _is_method_handle_exception; }
bool is_method_handle_return() const { return _is_method_handle_return == 1; }
void set_exception_oop(oop o) { _exception_oop = o; }
void set_exception_pc(address a) { _exception_pc = a; }
void set_exception_handler_pc(address a) { _exception_handler_pc = a; }
void set_exception_stack_size(int size) { _exception_stack_size = size; }
void set_is_method_handle_exception(int value) { _is_method_handle_exception = value; }
void set_is_method_handle_return(bool value) { _is_method_handle_return = value ? 1 : 0; }
// Stack overflow support
inline size_t stack_available(address cur_sp);
@ -1188,7 +1188,7 @@ class JavaThread: public Thread {
static ByteSize exception_pc_offset() { return byte_offset_of(JavaThread, _exception_pc ); }
static ByteSize exception_handler_pc_offset() { return byte_offset_of(JavaThread, _exception_handler_pc); }
static ByteSize exception_stack_size_offset() { return byte_offset_of(JavaThread, _exception_stack_size); }
static ByteSize is_method_handle_exception_offset() { return byte_offset_of(JavaThread, _is_method_handle_exception); }
static ByteSize is_method_handle_return_offset() { return byte_offset_of(JavaThread, _is_method_handle_return); }
static ByteSize stack_guard_state_offset() { return byte_offset_of(JavaThread, _stack_guard_state ); }
static ByteSize suspend_flags_offset() { return byte_offset_of(JavaThread, _suspend_flags ); }

@ -363,7 +363,7 @@ bool defaultStream::has_log_file() {
return _log_file != NULL;
}
static const char* make_log_name(const char* log_name, const char* force_directory, char* buf) {
static const char* make_log_name(const char* log_name, const char* force_directory) {
const char* basename = log_name;
char file_sep = os::file_separator()[0];
const char* cp;
@ -374,6 +374,27 @@ static const char* make_log_name(const char* log_name, const char* force_directo
}
const char* nametail = log_name;
// Compute buffer length
size_t buffer_length;
if (force_directory != NULL) {
buffer_length = strlen(force_directory) + strlen(os::file_separator()) +
strlen(basename) + 1;
} else {
buffer_length = strlen(log_name) + 1;
}
const char* star = strchr(basename, '*');
int star_pos = (star == NULL) ? -1 : (star - nametail);
char pid[32];
if (star_pos >= 0) {
jio_snprintf(pid, sizeof(pid), "%u", os::current_process_id());
buffer_length += strlen(pid);
}
// Create big enough buffer.
char *buf = NEW_C_HEAP_ARRAY(char, buffer_length);
strcpy(buf, "");
if (force_directory != NULL) {
strcat(buf, force_directory);
@ -381,14 +402,11 @@ static const char* make_log_name(const char* log_name, const char* force_directo
nametail = basename; // completely skip directory prefix
}
const char* star = strchr(basename, '*');
int star_pos = (star == NULL) ? -1 : (star - nametail);
if (star_pos >= 0) {
// convert foo*bar.log to foo123bar.log
int buf_pos = (int) strlen(buf);
strncpy(&buf[buf_pos], nametail, star_pos);
sprintf(&buf[buf_pos + star_pos], "%u", os::current_process_id());
strcpy(&buf[buf_pos + star_pos], pid);
nametail += star_pos + 1; // skip prefix and star
}
@ -399,20 +417,23 @@ static const char* make_log_name(const char* log_name, const char* force_directo
void defaultStream::init_log() {
// %%% Need a MutexLocker?
const char* log_name = LogFile != NULL ? LogFile : "hotspot.log";
char buf[O_BUFLEN*2];
const char* try_name = make_log_name(log_name, NULL, buf);
const char* try_name = make_log_name(log_name, NULL);
fileStream* file = new(ResourceObj::C_HEAP) fileStream(try_name);
if (!file->is_open()) {
// Try again to open the file.
char warnbuf[O_BUFLEN*2];
sprintf(warnbuf, "Warning: Cannot open log file: %s\n", try_name);
jio_snprintf(warnbuf, sizeof(warnbuf),
"Warning: Cannot open log file: %s\n", try_name);
// Note: This feature is for maintainer use only. No need for L10N.
jio_print(warnbuf);
try_name = make_log_name("hs_pid*.log", os::get_temp_directory(), buf);
sprintf(warnbuf, "Warning: Forcing option -XX:LogFile=%s\n", try_name);
FREE_C_HEAP_ARRAY(char, try_name);
try_name = make_log_name("hs_pid*.log", os::get_temp_directory());
jio_snprintf(warnbuf, sizeof(warnbuf),
"Warning: Forcing option -XX:LogFile=%s\n", try_name);
jio_print(warnbuf);
delete file;
file = new(ResourceObj::C_HEAP) fileStream(try_name);
FREE_C_HEAP_ARRAY(char, try_name);
}
if (file->is_open()) {
_log_file = file;

@ -807,8 +807,8 @@ void VMError::report_and_die() {
if (fd == -1) {
// try temp directory
const char * tmpdir = os::get_temp_directory();
jio_snprintf(buffer, sizeof(buffer), "%shs_err_pid%u.log",
(tmpdir ? tmpdir : ""), os::current_process_id());
jio_snprintf(buffer, sizeof(buffer), "%s%shs_err_pid%u.log",
tmpdir, os::file_separator(), os::current_process_id());
fd = open(buffer, O_WRONLY | O_CREAT | O_TRUNC, 0666);
}

@ -0,0 +1,65 @@
/*
* Copyright 2009 Sun Microsystems, Inc. All Rights Reserved.
* 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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
* CA 95054 USA or visit www.sun.com if you need additional information or
* have any questions.
*
*/
/**
* @test
* @bug 6892265
* @summary System.arraycopy unable to reference elements beyond Integer.MAX_VALUE bytes
*
* @run main/othervm Test
*/
public class Test {
static final int NCOPY = 1;
static final int OVERFLOW = 1;
static int[] src2 = new int[NCOPY];
static int[] dst2;
static void test() {
int N;
int SIZE;
N = Integer.MAX_VALUE/4 + OVERFLOW;
System.arraycopy(src2, 0, dst2, N, NCOPY);
System.arraycopy(dst2, N, src2, 0, NCOPY);
}
public static void main(String[] args) {
try {
dst2 = new int[NCOPY + Integer.MAX_VALUE/4 + OVERFLOW];
} catch (OutOfMemoryError e) {
System.exit(95); // Not enough memory
}
System.out.println("warmup");
for (int i=0; i <11000; i++) {
test();
}
System.out.println("start");
for (int i=0; i <1000; i++) {
test();
}
System.out.println("finish");
}
}

@ -62,3 +62,5 @@ c876ad22e4bf9d3c6460080db7ace478e29a3ff9 jdk7-b82
6c0ccabb430dacdcd4479f8b197980d5da4eeb66 jdk7-b85
81c0f115bbe5d3bcf59864465b5eca5538567c79 jdk7-b86
8b493f1aa136d86de0885fcba15262c4fa2b1412 jdk7-b87
d8ebd15910034f2ba50b2f129f959f86cca01419 jdk7-b88
d2818fd2b036f3b3154a9a7de41afcf4ac679c1b jdk7-b89

@ -62,3 +62,5 @@ f051045fe94a48fae1097f90cbd9227e6aae6b7e jdk7-b81
8424512588ff95362c1f1e5f11c6efd4e7f7db6e jdk7-b85
512b0e924a5ae0c0b7ad326182cae0dc0e4d1aa8 jdk7-b86
3febd6fab2ac8ffddbaf7bed00d11290262af153 jdk7-b87
8c666f8f3565974e301ccb58b7538912551a6e26 jdk7-b88
bf3675aa7f20fc6f241ce95760005aef2a30ff41 jdk7-b89

@ -63,3 +63,4 @@ b396584a3e64988839cca21ea1f7fbdcc9248783 jdk7-b85
eae6e9ab26064d9ba0e7665dd646a1fd2506fcc1 jdk7-b86
2cafbbe9825e911a6ca6c17d9a18eb1f0bf0873c jdk7-b87
b3c69282f6d3c90ec21056cd1ab70dc0c895b069 jdk7-b88
4a6abb7e224cc8d9a583c23c5782e4668739a119 jdk7-b89

@ -21,4 +21,4 @@
# CA 95054 USA or visit www.sun.com if you need additional information or
# have any questions.
#
tzdata2010b
tzdata2010g

@ -79,6 +79,33 @@ Rule ChileAQ 1999 only - Apr 4 3:00u 0 -
Rule ChileAQ 1999 max - Oct Sun>=9 4:00u 1:00 S
Rule ChileAQ 2000 max - Mar Sun>=9 3:00u 0 -
# These rules are stolen from the `australasia' file.
Rule AusAQ 1917 only - Jan 1 0:01 1:00 -
Rule AusAQ 1917 only - Mar 25 2:00 0 -
Rule AusAQ 1942 only - Jan 1 2:00 1:00 -
Rule AusAQ 1942 only - Mar 29 2:00 0 -
Rule AusAQ 1942 only - Sep 27 2:00 1:00 -
Rule AusAQ 1943 1944 - Mar lastSun 2:00 0 -
Rule AusAQ 1943 only - Oct 3 2:00 1:00 -
Rule ATAQ 1967 only - Oct Sun>=1 2:00s 1:00 -
Rule ATAQ 1968 only - Mar lastSun 2:00s 0 -
Rule ATAQ 1968 1985 - Oct lastSun 2:00s 1:00 -
Rule ATAQ 1969 1971 - Mar Sun>=8 2:00s 0 -
Rule ATAQ 1972 only - Feb lastSun 2:00s 0 -
Rule ATAQ 1973 1981 - Mar Sun>=1 2:00s 0 -
Rule ATAQ 1982 1983 - Mar lastSun 2:00s 0 -
Rule ATAQ 1984 1986 - Mar Sun>=1 2:00s 0 -
Rule ATAQ 1986 only - Oct Sun>=15 2:00s 1:00 -
Rule ATAQ 1987 1990 - Mar Sun>=15 2:00s 0 -
Rule ATAQ 1987 only - Oct Sun>=22 2:00s 1:00 -
Rule ATAQ 1988 1990 - Oct lastSun 2:00s 1:00 -
Rule ATAQ 1991 1999 - Oct Sun>=1 2:00s 1:00 -
Rule ATAQ 1991 2005 - Mar lastSun 2:00s 0 -
Rule ATAQ 2000 only - Aug lastSun 2:00s 1:00 -
Rule ATAQ 2001 max - Oct Sun>=1 2:00s 1:00 -
Rule ATAQ 2006 only - Apr Sun>=1 2:00s 0 -
Rule ATAQ 2007 only - Mar lastSun 2:00s 0 -
Rule ATAQ 2008 max - Apr Sun>=1 2:00s 0 -
# Argentina - year-round bases
# Belgrano II, Confin Coast, -770227-0343737, since 1972-02-05
@ -120,20 +147,52 @@ Rule ChileAQ 2000 max - Mar Sun>=9 3:00u 0 -
# http://www.timeanddate.com/news/time/antarctica-new-times.html
# </a>
# From Steffen Thorsen (2010-03-10):
# We got these changes from the Australian Antarctic Division:
# - Macquarie Island will stay on UTC+11 for winter and therefore not
# switch back from daylight savings time when other parts of Australia do
# on 4 April.
#
# - Casey station reverted to its normal time of UTC+8 on 5 March 2010.
# The change to UTC+11 is being considered as a regular summer thing but
# has not been decided yet.
#
# - Davis station will revert to its normal time of UTC+7 at 10 March 2010
# 20:00 UTC.
#
# - Mawson station stays on UTC+5.
#
# In addition to the Rule changes for Casey/Davis, it means that Macquarie
# will no longer be like Hobart and will have to have its own Zone created.
#
# Background:
# <a href="http://www.timeanddate.com/news/time/antartica-time-changes-2010.html">
# http://www.timeanddate.com/news/time/antartica-time-changes-2010.html
# </a>
# Zone NAME GMTOFF RULES FORMAT [UNTIL]
Zone Antarctica/Casey 0 - zzz 1969
8:00 - WST 2009 Oct 18 2:00
# Western (Aus) Standard Time
11:00 - CAST # Casey Time
11:00 - CAST 2010 Mar 5 2:00
# Casey Time
8:00 - WST
Zone Antarctica/Davis 0 - zzz 1957 Jan 13
7:00 - DAVT 1964 Nov # Davis Time
0 - zzz 1969 Feb
7:00 - DAVT 2009 Oct 18 2:00
5:00 - DAVT
5:00 - DAVT 2010 Mar 10 20:00u
7:00 - DAVT
Zone Antarctica/Mawson 0 - zzz 1954 Feb 13
6:00 - MAWT 2009 Oct 18 2:00
# Mawson Time
5:00 - MAWT
Zone Antarctica/Macquarie 0 - zzz 1911
10:00 - EST 1916 Oct 1 2:00
10:00 1:00 EST 1917 Feb
10:00 AusAQ EST 1967
10:00 ATAQ EST 2010 Apr 4 3:00
11:00 - MIST # Macquarie Island Time
# References:
# <a href="http://www.antdiv.gov.au/aad/exop/sfo/casey/casey_aws.html">
# Casey Weather (1998-02-26)

@ -236,22 +236,20 @@ Zone Asia/Bahrain 3:22:20 - LMT 1920 # Al Manamah
# 2010 midnight. The decision came at a cabinet meeting at the Prime
# Minister's Office last night..."
# From Danvin Ruangchan (2009-12-24):
# ...the news mentions DST will be turned off again 7 months after March
# 31st on Oct 31, 2010.
# From Arthur David Olson (2009-12-26):
# Indeed, "The government will advance again the Banglasdesh Standard
# Time by one one hour on March 31 next year by enforcing the Daylight
# Saving Time (DST) for seven months. It will continue till October 31
# until further notice." I take that last sentence as the
# establishment of a rule.
# From Alexander Krivenyshev (2010-03-22):
# According to Bangladesh newspaper "The Daily Star,"
# Cabinet cancels Daylight Saving Time
# <a href="http://www.thedailystar.net/newDesign/latest_news.php?nid=22817">
# http://www.thedailystar.net/newDesign/latest_news.php?nid=22817
# </a>
# or
# <a href="http://www.worldtimezone.com/dst_news/dst_news_bangladesh06.html">
# http://www.worldtimezone.com/dst_news/dst_news_bangladesh06.html
# </a>
# Rule NAME FROM TO TYPE IN ON AT SAVE LETTER/S
Rule Dhaka 2009 only - Jun 19 23:00 1:00 S
Rule Dhaka 2010 only - Jan 1 0:00 0 -
Rule Dhaka 2010 max - Mar 31 23:00 1:00 S
Rule Dhaka 2010 max - Nov 1 0:00 0 -
Rule Dhaka 2009 only - Dec 31 23:59 0 -
# Zone NAME GMTOFF RULES FORMAT [UNTIL]
Zone Asia/Dhaka 6:01:40 - LMT 1890
@ -2131,6 +2129,32 @@ Zone Asia/Karachi 4:28:12 - LMT 1907
# http://www.worldtimezone.com/dst_news/dst_news_gazastrip02.html
# </a>
# From Alexander Krivenyshev (2010-03-19):
# According to Voice of Palestine DST will last for 191 days, from March
# 26, 2010 till "the last Sunday before the tenth day of Tishri
# (October), each year" (October 03, 2010?)
#
# <a href="http://palvoice.org/forums/showthread.php?t=245697">
# http://palvoice.org/forums/showthread.php?t=245697
# </a>
# (in Arabic)
# or
# <a href="http://www.worldtimezone.com/dst_news/dst_news_westbank03.html">
# http://www.worldtimezone.com/dst_news/dst_news_westbank03.html
# </a>
# From Steffen Thorsen (2010-03-24):
# ...Ma'an News Agency reports that Hamas cabinet has decided it will
# start one day later, at 12:01am. Not sure if they really mean 12:01am or
# noon though:
#
# <a href="http://www.maannews.net/eng/ViewDetails.aspx?ID=271178">
# http://www.maannews.net/eng/ViewDetails.aspx?ID=271178
# </a>
# (Ma'an News Agency)
# "At 12:01am Friday, clocks in Israel and the West Bank will change to
# 1:01am, while Gaza clocks will change at 12:01am Saturday morning."
# The rules for Egypt are stolen from the `africa' file.
# Rule NAME FROM TO TYPE IN ON AT SAVE LETTER/S
Rule EgyptAsia 1957 only - May 10 0:00 1:00 S
@ -2148,7 +2172,8 @@ Rule Palestine 2006 2008 - Apr 1 0:00 1:00 S
Rule Palestine 2006 only - Sep 22 0:00 0 -
Rule Palestine 2007 only - Sep Thu>=8 2:00 0 -
Rule Palestine 2008 only - Aug lastFri 2:00 0 -
Rule Palestine 2009 max - Mar lastFri 0:00 1:00 S
Rule Palestine 2009 only - Mar lastFri 0:00 1:00 S
Rule Palestine 2010 max - Mar lastSat 0:01 1:00 S
Rule Palestine 2009 max - Sep Fri>=1 2:00 0 -
# Zone NAME GMTOFF RULES FORMAT [UNTIL]
@ -2440,9 +2465,18 @@ Rule Syria 2007 only - Nov Fri>=1 0:00 0 -
# Thursday of the month or the start of the last Friday of the month or
# something else. For now, use the start of the last Friday.
# From Steffen Thorsen (2010-03-17):
# The "Syrian News Station" reported on 2010-03-16 that the Council of
# Ministers has decided that Syria will start DST on midnight Thursday
# 2010-04-01: (midnight between Thursday and Friday):
# <a href="http://sns.sy/sns/?path=news/read/11421">
# http://sns.sy/sns/?path=news/read/11421 (Arabic)
# </a>
Rule Syria 2008 only - Apr Fri>=1 0:00 1:00 S
Rule Syria 2008 only - Nov 1 0:00 0 -
Rule Syria 2009 max - Mar lastFri 0:00 1:00 S
Rule Syria 2009 only - Mar lastFri 0:00 1:00 S
Rule Syria 2010 max - Apr Fri>=1 0:00 1:00 S
Rule Syria 2009 max - Oct lastFri 0:00 0 -
# Zone NAME GMTOFF RULES FORMAT [UNTIL]

@ -289,11 +289,30 @@ Zone Indian/Cocos 6:27:40 - LMT 1900
# <a href="http://www.fiji.gov.fj/publish/page_16198.shtml">
# http://www.fiji.gov.fj/publish/page_16198.shtml
# </a>
# From Steffen Thorsen (2010-03-03):
# The Cabinet in Fiji has decided to end DST about a month early, on
# 2010-03-28 at 03:00.
# The plan is to observe DST again, from 2010-10-24 to sometime in March
# 2011 (last Sunday a good guess?).
#
# Official source:
# <a href="http://www.fiji.gov.fj/index.php?option=com_content&view=article&id=1096:3310-cabinet-approves-change-in-daylight-savings-dates&catid=49:cabinet-releases&Itemid=166">
# http://www.fiji.gov.fj/index.php?option=com_content&view=article&id=1096:3310-cabinet-approves-change-in-daylight-savings-dates&catid=49:cabinet-releases&Itemid=166
# </a>
#
# A bit more background info here:
# <a href="http://www.timeanddate.com/news/time/fiji-dst-ends-march-2010.html">
# http://www.timeanddate.com/news/time/fiji-dst-ends-march-2010.html
# </a>
# Rule NAME FROM TO TYPE IN ON AT SAVE LETTER/S
Rule Fiji 1998 1999 - Nov Sun>=1 2:00 1:00 S
Rule Fiji 1999 2000 - Feb lastSun 3:00 0 -
Rule Fiji 2009 only - Nov 29 2:00 1:00 S
Rule Fiji 2010 only - Apr 25 3:00 0 -
Rule Fiji 2010 only - Mar lastSun 3:00 0 -
Rule Fiji 2010 only - Oct 24 2:00 1:00 S
Rule Fiji 2011 only - Mar lastSun 3:00 0 -
# Zone NAME GMTOFF RULES FORMAT [UNTIL]
Zone Pacific/Fiji 11:53:40 - LMT 1915 Oct 26 # Suva
12:00 Fiji FJ%sT # Fiji Time
@ -471,70 +490,30 @@ Zone Pacific/Pago_Pago 12:37:12 - LMT 1879 Jul 5
# Samoa
# From Alexander Krivenyshev (2008-12-06):
# The Samoa government (Western Samoa) may implement DST on the first Sunday of
# October 2009 (October 4, 2009) until the last Sunday of March 2010 (March 28,
# 2010).
#
# "Selected Committee reports to Cabinet on Daylight Saving Time",
# Government of Samoa:
# <a href="http://www.govt.ws/pr_article.cfm?pr_id=560">
# http://www.govt.ws/pr_article.cfm?pr_id=560
# </a>
# or
# <a href="http://www.worldtimezone.com/dst_news/dst_news_samoa01.html">
# http://www.worldtimezone.com/dst_news/dst_news_samoa01.html
# </a>
# From Steffen Thorsen (2009-08-27):
# Samoa's parliament passed the Daylight Saving Bill 2009, and will start
# daylight saving time on the first Sunday of October 2009 and end on the
# last Sunday of March 2010. We hope that the full text will be published
# soon, but we believe that the bill is only valid for 2009-2010. Samoa's
# Daylight Saving Act 2009 will be enforced as soon as the Head of State
# executes a proclamation publicizing this Act.
# From Steffen Thorsen (2009-10-16):
# We have been in contact with the government of Samoa again, and received
# the following info:
#
# Some background information here, which will be updated once we have
# more details:
# "Cabinet has now approved Daylight Saving to be effected next year
# commencing from the last Sunday of September 2010 and conclude first
# Sunday of April 2011."
#
# Background info:
# <a href="http://www.timeanddate.com/news/time/samoa-dst-plan-2009.html">
# http://www.timeanddate.com/news/time/samoa-dst-plan-2009.html
# </a>
# From Alexander Krivenyshev (2009-10-03):
# First, my deepest condolences to people of Samoa islands and all families and
# loved ones around the world who lost their lives in the earthquake and tsunami.
#
# Considering the recent devastation on Samoa by earthquake and tsunami and that
# many government offices/ ministers are closed- not sure if "Daylight Saving
# Bill 2009" will be implemented in next few days- on October 4, 2009.
#
# Here is reply from Consulate-General of Samoa in New Zealand
# ---------------------------
# Consul General
# consulgeneral@samoaconsulate.org.nz
#
# Talofa Alexander,
#
# Thank you for your sympathy for our country but at this time we have not
# been informed about the Daylight Savings Time Change. Most Ministries in
# Apia are closed or relocating due to weather concerns.
#
# When we do find out if they are still proceeding with the time change we
# will advise you soonest.
#
# Kind Regards,
# Lana
# for: Consul General
# From Steffen Thorsen (2009-10-05):
# We have called a hotel in Samoa and asked about local time there - they
# are still on standard time.
# Samoa's Daylight Saving Time Act 2009 is available here, but does not
# contain any dates:
# <a href="http://www.parliament.gov.ws/documents/acts/Daylight%20Saving%20Act%20%202009%20%28English%29%20-%20Final%207-7-091.pdf">
# http://www.parliament.gov.ws/documents/acts/Daylight%20Saving%20Act%20%202009%20%28English%29%20-%20Final%207-7-091.pdf
# </a>
Zone Pacific/Apia 12:33:04 - LMT 1879 Jul 5
-11:26:56 - LMT 1911
-11:30 - SAMT 1950 # Samoa Time
-11:00 - WST 2009 Oct 4
-11:00 1:00 WSDT 2010 Mar 28
-11:00 - WST 2010 Sep 26
-11:00 1:00 WSDT 2011 Apr 3
-11:00 - WST
# Solomon Is

@ -2063,7 +2063,9 @@ Zone Europe/Samara 3:20:36 - LMT 1919 Jul 1 2:00
3:00 Russia KUY%sT 1991 Mar 31 2:00s
2:00 Russia KUY%sT 1991 Sep 29 2:00s
3:00 - KUYT 1991 Oct 20 3:00
4:00 Russia SAM%sT # Samara Time
4:00 Russia SAM%sT 2010 Mar 28 2:00s # Samara Time
3:00 Russia SAM%sT
#
# From Oscar van Vlijmen (2001-08-25): [This region consists of]
# Respublika Bashkortostan, Komi-Permyatskij avtonomnyj okrug,
@ -2216,7 +2218,8 @@ Zone Asia/Kamchatka 10:34:36 - LMT 1922 Nov 10
11:00 - PETT 1930 Jun 21 # P-K Time
12:00 Russia PET%sT 1991 Mar 31 2:00s
11:00 Russia PET%sT 1992 Jan 19 2:00s
12:00 Russia PET%sT
12:00 Russia PET%sT 2010 Mar 28 2:00s
11:00 Russia PET%sT
#
# Chukotskij avtonomnyj okrug
Zone Asia/Anadyr 11:49:56 - LMT 1924 May 2
@ -2224,7 +2227,8 @@ Zone Asia/Anadyr 11:49:56 - LMT 1924 May 2
13:00 Russia ANA%sT 1982 Apr 1 0:00s
12:00 Russia ANA%sT 1991 Mar 31 2:00s
11:00 Russia ANA%sT 1992 Jan 19 2:00s
12:00 Russia ANA%sT
12:00 Russia ANA%sT 2010 Mar 28 2:00s
11:00 Russia ANA%sT
# Serbia
# Zone NAME GMTOFF RULES FORMAT [UNTIL]

@ -1143,6 +1143,18 @@ Zone America/Rio_Branco -4:31:12 - LMT 1914
# http://www.shoa.cl/noticias/2008/04hora/hora.htm
# </a>.
# From Angel Chiang (2010-03-04):
# Subject: DST in Chile exceptionally extended to 3 April due to earthquake
# <a href="http://www.gobiernodechile.cl/viewNoticia.aspx?idArticulo=30098">
# http://www.gobiernodechile.cl/viewNoticia.aspx?idArticulo=30098
# </a>
# (in Spanish, last paragraph).
#
# This is breaking news. There should be more information available later.
# From Arthur Daivd Olson (2010-03-06):
# Angel Chiang's message confirmed by Julio Pacheco; Julio provided a patch.
# Rule NAME FROM TO TYPE IN ON AT SAVE LETTER/S
Rule Chile 1927 1932 - Sep 1 0:00 1:00 S
Rule Chile 1928 1932 - Apr 1 0:00 0 -
@ -1177,7 +1189,9 @@ Rule Chile 2000 2007 - Mar Sun>=9 3:00u 0 -
# N.B.: the end of March 29 in Chile is March 30 in Universal time,
# which is used below in specifying the transition.
Rule Chile 2008 only - Mar 30 3:00u 0 -
Rule Chile 2009 max - Mar Sun>=9 3:00u 0 -
Rule Chile 2009 only - Mar Sun>=9 3:00u 0 -
Rule Chile 2010 only - Apr 4 3:00u 0 -
Rule Chile 2011 max - Mar Sun>=9 3:00u 0 -
# IATA SSIM anomalies: (1992-02) says 1992-03-14;
# (1996-09) says 1998-03-08. Ignore these.
# Zone NAME GMTOFF RULES FORMAT [UNTIL]
@ -1386,8 +1400,24 @@ Rule Para 2002 2003 - Sep Sun>=1 0:00 1:00 S
# Decree 1,867 (2004-03-05)
# From Carlos Raul Perasso via Jesper Norgaard Welen (2006-10-13)
# <http://www.presidencia.gov.py/decretos/D1867.pdf>
Rule Para 2004 max - Oct Sun>=15 0:00 1:00 S
Rule Para 2005 max - Mar Sun>=8 0:00 0 -
Rule Para 2004 2009 - Oct Sun>=15 0:00 1:00 S
Rule Para 2005 2009 - Mar Sun>=8 0:00 0 -
# From Carlos Raul Perasso (2010-02-18):
# By decree number 3958 issued yesterday (
# <a href="http://www.presidencia.gov.py/v1/wp-content/uploads/2010/02/decreto3958.pdf">
# http://www.presidencia.gov.py/v1/wp-content/uploads/2010/02/decreto3958.pdf
# </a>
# )
# Paraguay changes its DST schedule, postponing the March rule to April and
# modifying the October date. The decree reads:
# ...
# Art. 1. It is hereby established that from the second Sunday of the month of
# April of this year (2010), the official time is to be set back 60 minutes,
# and that on the first Sunday of the month of October, it is to be set
# forward 60 minutes, in all the territory of the Paraguayan Republic.
# ...
Rule Para 2010 max - Oct Sun>=1 0:00 1:00 S
Rule Para 2010 max - Apr Sun>=8 0:00 0 -
# Zone NAME GMTOFF RULES FORMAT [UNTIL]
Zone America/Asuncion -3:50:40 - LMT 1890

@ -66,6 +66,7 @@ AQ -6617+11031 Antarctica/Casey Casey Station, Bailey Peninsula
AQ -7824+10654 Antarctica/Vostok Vostok Station, S Magnetic Pole
AQ -6640+14001 Antarctica/DumontDUrville Dumont-d'Urville Station, Terre Adelie
AQ -690022+0393524 Antarctica/Syowa Syowa Station, E Ongul I
AQ -5430+15857 Antarctica/Macquarie Macquarie Island Station, Macquarie Island
AR -3436-05827 America/Argentina/Buenos_Aires Buenos Aires (BA, CF)
AR -3124-06411 America/Argentina/Cordoba most locations (CB, CC, CN, ER, FM, MN, SE, SF)
AR -2447-06525 America/Argentina/Salta (SA, LP, NQ, RN)
@ -351,7 +352,7 @@ RS +4450+02030 Europe/Belgrade
RU +5443+02030 Europe/Kaliningrad Moscow-01 - Kaliningrad
RU +5545+03735 Europe/Moscow Moscow+00 - west Russia
RU +4844+04425 Europe/Volgograd Moscow+00 - Caspian Sea
RU +5312+05009 Europe/Samara Moscow+01 - Samara, Udmurtia
RU +5312+05009 Europe/Samara Moscow - Samara, Udmurtia
RU +5651+06036 Asia/Yekaterinburg Moscow+02 - Urals
RU +5500+07324 Asia/Omsk Moscow+03 - west Siberia
RU +5502+08255 Asia/Novosibirsk Moscow+03 - Novosibirsk
@ -362,8 +363,8 @@ RU +6200+12940 Asia/Yakutsk Moscow+06 - Lena River
RU +4310+13156 Asia/Vladivostok Moscow+07 - Amur River
RU +4658+14242 Asia/Sakhalin Moscow+07 - Sakhalin Island
RU +5934+15048 Asia/Magadan Moscow+08 - Magadan
RU +5301+15839 Asia/Kamchatka Moscow+09 - Kamchatka
RU +6445+17729 Asia/Anadyr Moscow+10 - Bering Sea
RU +5301+15839 Asia/Kamchatka Moscow+08 - Kamchatka
RU +6445+17729 Asia/Anadyr Moscow+08 - Bering Sea
RW -0157+03004 Africa/Kigali
SA +2438+04643 Asia/Riyadh
SB -0932+16012 Pacific/Guadalcanal

@ -42,8 +42,6 @@ FILES_src = \
sun/io/ByteToCharBig5_Solaris.java \
sun/io/ByteToCharBig5_HKSCS.java \
sun/io/ByteToCharMS950_HKSCS.java \
sun/io/ByteToCharHKSCS.java \
sun/io/ByteToCharHKSCS_2001.java \
sun/io/ByteToCharGB18030.java \
sun/io/ByteToCharGB18030DB.java \
sun/io/ByteToCharCp037.java \
@ -173,8 +171,6 @@ FILES_src = \
sun/io/CharToByteBig5.java \
sun/io/CharToByteBig5_Solaris.java \
sun/io/CharToByteBig5_HKSCS.java \
sun/io/CharToByteHKSCS.java \
sun/io/CharToByteHKSCS_2001.java \
sun/io/CharToByteMS950_HKSCS.java \
sun/io/CharToByteGB18030.java \
sun/io/CharToByteCp037.java \
@ -374,6 +370,9 @@ FILES_gen_extcs = \
sun/nio/cs/ext/MacUkraine.java \
sun/nio/cs/ext/TIS_620.java \
sun/nio/cs/ext/EUC_TWMapping.java \
sun/nio/cs/ext/HKSCSMapping.java \
sun/nio/cs/ext/HKSCS2001Mapping.java \
sun/nio/cs/ext/HKSCS_XPMapping.java \
sun/nio/cs/ext/IBM1381.java \
sun/nio/cs/ext/IBM1383.java \
sun/nio/cs/ext/IBM930.java \
@ -394,7 +393,8 @@ FILES_gen_extcs = \
sun/nio/cs/ext/MS936.java \
sun/nio/cs/ext/MS949.java \
sun/nio/cs/ext/MS950.java \
sun/nio/cs/ext/GBK.java
sun/nio/cs/ext/GBK.java \
sun/nio/cs/ext/Big5.java
FILES_java = $(FILES_src) $(FILES_gen_extcs)

@ -93,7 +93,9 @@ $(FILES_genout_extcs): \
$(MKDIR) -p $(GENCSEXT)
$(BOOT_JAVA_CMD) -jar $(CHARSETMAPPING_JARFILE) $(GENCSDATASRC) $(GENCSEXT) extsbcs
$(BOOT_JAVA_CMD) -jar $(CHARSETMAPPING_JARFILE) $(GENCSDATASRC) $(GENCSEXT) euctw \
$(GENCSSRCDIR)/GenerateEUC_TW.java
$(GENCSSRCDIR)/EUC_TW.java
$(BOOT_JAVA_CMD) -jar $(CHARSETMAPPING_JARFILE) $(GENCSDATASRC) $(GENCSEXT) hkscs \
$(GENCSSRCDIR)/HKSCS.java
$(BOOT_JAVA_CMD) -jar $(CHARSETMAPPING_JARFILE) $(GENCSDATASRC) $(GENCSEXT) dbcs
$(CLASSDESTDIR)/$(SERVICE_DESCRIPTION_PATH): \

@ -0,0 +1,8 @@
#Add the following 5 characters which are duplicated
#or have conflicts with other characters.
0xA1C4 0xFF3F #REGWARN Fallback 0xA1C4 SPACING UNDERSCORE
0xA2AC 0x2571 #REGWARN Fallback 0xA2AC LT DIAG UP RIGHT TO LOW LEFT
0xA2AD 0x2572 #REGWARN Fallback 0xA2AD LT DIAG UP LEFT TO LOW RIGHT
0xA451 0x5341 #REGWARN Fallback 0xA451 HANGZHOU NUMERAL TEN
0xA4CA 0x5345 #REGWARN Fallback 0xA4CA HANGZHOU NUMERAL THIRTY
#

File diff suppressed because it is too large Load Diff

@ -0,0 +1,5 @@
0xA15A 0xFF3F #SPACING UNDERSCORE
0xA1FE 0x2571 #LT DIAG UP RIGHT TO LOW LEFT
0xA240 0x2572 #LT DIAG UP LEFT TO LOW RIGHTG
0xA2CC 0x5341 #HANGHZOU NUMERAL TEN
0xA2CE 0x5345 #HANGZHOU NUMERAL THIRTY

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

@ -0,0 +1,529 @@
# Generated from HKSCS.Encoder
#
0xFA45 0xE005
0xFA48 0xE008
0xFA68 0xE028
0xFA6B 0xE02B
0xFAA5 0xE043
0xFACC 0xE06A
0xFACD 0xE06B
0xFAD0 0xE06E
0xFAE0 0xE07E
0xFAE8 0xE086
0xFAFA 0xE098
0xFAFD 0xE09B
0xFB43 0xE0A0
0xFB4B 0xE0A8
0xFB5E 0xE0BB
0xFB65 0xE0C2
0xFB70 0xE0CD
0xFB7A 0xE0D7
0xFB7D 0xE0DA
0xFBB6 0xE0F1
0xFBB9 0xE0F4
0xFBBF 0xE0FA
0xFBC1 0xE0FC
0xFBC9 0xE104
0xFBCA 0xE105
0xFBD3 0xE10E
0xFBDC 0xE117
0xFBEA 0xE125
0xFBEF 0xE12A
0xFBF0 0xE12B
0xFC42 0xE13C
0xFC49 0xE143
0xFC4A 0xE144
0xFC59 0xE153
0xFC64 0xE15E
0xFC65 0xE15F
0xFC66 0xE160
0xFC6A 0xE164
0xFCA6 0xE17E
0xFCB4 0xE18C
0xFCC2 0xE19A
0xFCC4 0xE19C
0xFCCF 0xE1A7
0xFCD1 0xE1A9
0xFCEE 0xE1C6
0xFCF7 0xE1CF
0xFD49 0xE1E0
0xFD4A 0xE1E1
0xFD4C 0xE1E3
0xFD50 0xE1E7
0xFD53 0xE1EA
0xFD5D 0xE1F4
0xFD61 0xE1F8
0xFD6C 0xE203
0xFD7A 0xE211
0xFDA2 0xE217
0xFDA3 0xE218
0xFDC4 0xE239
0xFDCA 0xE23F
0xFDCE 0xE243
0xFDD1 0xE246
0xFDE8 0xE25D
0xFDE9 0xE25E
0xFE4D 0xE281
0xFE56 0xE28A
0xFE64 0xE298
0xFE6E 0xE2A2
0xFE78 0xE2AC
0xFE7D 0xE2B1
0xFEB6 0xE2C8
0xFEC5 0xE2D7
0xFEFB 0xE30D
0x8E45 0xE316
0x8E55 0xE326
0x8E59 0xE32A
0x8E6B 0xE33C
0x8EA2 0xE351
0x8EAF 0xE35E
0x8EB9 0xE368
0x8EC7 0xE376
0x8EC9 0xE378
0x8ED8 0xE387
0x8EED 0xE39C
0x8EFE 0xE3AD
0x8F45 0xE3B3
0x8F50 0xE3BE
0x8F54 0xE3C2
0x8F59 0xE3C7
0x8F5D 0xE3CB
0x8F63 0xE3D1
0x8F64 0xE3D2
0x8F70 0xE3DE
0x8F74 0xE3E2
0x8F76 0xE3E4
0x8F7A 0xE3E8
0x8F7C 0xE3EA
0x8FA9 0xE3F5
0x8FAB 0xE3F7
0x8FBA 0xE406
0x8FC2 0xE40E
0x8FDB 0xE427
0x8FEB 0xE437
0x8FF1 0xE43D
0x8FFD 0xE449
0x9044 0xE44F
0x9055 0xE460
0x9060 0xE46B
0x906F 0xE47A
0x90AA 0xE493
0x90B7 0xE4A0
0x90BC 0xE4A5
0x90C0 0xE4A9
0x90C9 0xE4B2
0x90D5 0xE4BE
0x90D6 0xE4BF
0x90D7 0xE4C0
0x90F5 0xE4DE
0x90FA 0xE4E3
0x90FC 0xE4E5
0x9145 0xE4ED
0x914F 0xE4F7
0x9158 0xE500
0x915F 0xE507
0x9166 0xE50E
0x91AE 0xE534
0x91B3 0xE539
0x91B4 0xE53A
0x91B5 0xE53B
0x91B7 0xE53D
0x91BB 0xE541
0x91CD 0xE553
0x91E3 0xE569
0x91EE 0xE574
0x91F2 0xE578
0x91F5 0xE57B
0x91F9 0xE57F
0x924C 0xE591
0x9251 0xE596
0x9252 0xE597
0x9253 0xE598
0x9257 0xE59C
0x9269 0xE5AE
0x9274 0xE5B9
0x9277 0xE5BC
0x92BD 0xE5E0
0x92C9 0xE5EC
0x92D2 0xE5F5
0x92D7 0xE5FA
0x92DB 0xE5FE
0x92E9 0xE60C
0x92FA 0xE61D
0x9347 0xE629
0x934B 0xE62D
0x9357 0xE639
0x9359 0xE63B
0x935B 0xE63D
0x936F 0xE651
0x93A4 0xE664
0x93B5 0xE675
0x93C1 0xE681
0x93C2 0xE682
0x93CD 0xE68D
0x93D4 0xE694
0x93DD 0xE69D
0x93E0 0xE6A0
0x93E4 0xE6A4
0x93E9 0xE6A9
0x93EB 0xE6AB
0x93F6 0xE6B6
0x9449 0xE6C8
0x9463 0xE6E2
0x9464 0xE6E3
0x9469 0xE6E8
0x946E 0xE6ED
0x9470 0xE6EF
0x9472 0xE6F1
0x9475 0xE6F4
0x9479 0xE6F8
0x947E 0xE6FD
0x94A1 0xE6FE
0x94A3 0xE700
0x94B5 0xE712
0x94B9 0xE716
0x94BC 0xE719
0x94C9 0xE726
0x94D1 0xE72E
0x94D3 0xE730
0x94DB 0xE738
0x94DD 0xE73A
0x94DE 0xE73B
0x94EC 0xE749
0x94EF 0xE74C
0x9544 0xE760
0x955A 0xE776
0x9562 0xE77E
0x9564 0xE780
0x9573 0xE78F
0x95B0 0xE7AA
0x95B2 0xE7AC
0x95B3 0xE7AD
0x95B4 0xE7AE
0x95C6 0xE7C0
0x95C7 0xE7C1
0x95CD 0xE7C7
0x95D1 0xE7CB
0x95D6 0xE7D0
0x95DB 0xE7D5
0x95DF 0xE7D9
0x95EC 0xE7E6
0x95F0 0xE7EA
0x95F6 0xE7F0
0x95FC 0xE7F6
0x9641 0xE7FA
0x964D 0xE806
0x965C 0xE815
0x9662 0xE81B
0x9664 0xE81D
0x9669 0xE822
0x966B 0xE824
0x9675 0xE82E
0x9678 0xE831
0x9679 0xE832
0x96A6 0xE83D
0x96A8 0xE83F
0x96B9 0xE850
0x96BC 0xE853
0x96C8 0xE85F
0x96D4 0xE86B
0x96D6 0xE86D
0x96DF 0xE876
0x96E9 0xE880
0x96F7 0xE88E
0x9743 0xE899
0x9745 0xE89B
0x9746 0xE89C
0x975D 0xE8B3
0x9761 0xE8B7
0x9766 0xE8BC
0x977C 0xE8D2
0x97AE 0xE8E2
0x97B0 0xE8E4
0x97B8 0xE8EC
0x97BA 0xE8EE
0x97C0 0xE8F4
0x97C2 0xE8F6
0x97C3 0xE8F7
0x97C5 0xE8F9
0x97C6 0xE8FA
0x97C9 0xE8FD
0x97CD 0xE901
0x97D2 0xE906
0x97D7 0xE90B
0x97DA 0xE90E
0x97DB 0xE90F
0x97DC 0xE910
0x97DD 0xE911
0x97DE 0xE912
0x97E1 0xE915
0x97E7 0xE91B
0x97FD 0xE931
0x97FE 0xE932
0x9853 0xE946
0x9856 0xE949
0x9872 0xE965
0x9879 0xE96C
0x98A8 0xE979
0x98BC 0xE98D
0x98C3 0xE994
0x98C5 0xE996
0x98CB 0xE99C
0x98CC 0xE99D
0x98CD 0xE99E
0x98CE 0xE99F
0x98D0 0xE9A1
0x98D1 0xE9A2
0x98D6 0xE9A7
0x98D9 0xE9AA
0x98DB 0xE9AC
0x98DD 0xE9AE
0x98E4 0xE9B5
0x98E6 0xE9B7
0x98E8 0xE9B9
0x98E9 0xE9BA
0x98EB 0xE9BC
0x98EC 0xE9BD
0x98F4 0xE9C5
0x98FE 0xE9CF
0x9940 0xE9D0
0x9946 0xE9D6
0x9948 0xE9D8
0x994B 0xE9DB
0x994E 0xE9DE
0x9955 0xE9E5
0x9956 0xE9E6
0x9959 0xE9E9
0x995B 0xE9EB
0x9967 0xE9F7
0x996E 0xE9FE
0x9973 0xEA03
0x997A 0xEA0A
0x997B 0xEA0B
0x99A1 0xEA0F
0x99A5 0xEA13
0x99A7 0xEA15
0x99AD 0xEA1B
0x99B3 0xEA21
0x99BC 0xEA2A
0x99C3 0xEA31
0x99C7 0xEA35
0x99CE 0xEA3C
0x99CF 0xEA3D
0x99DE 0xEA4C
0x99E1 0xEA4F
0x99E9 0xEA57
0x99F5 0xEA63
0x99F8 0xEA66
0x9A48 0xEA75
0x9A49 0xEA76
0x9A50 0xEA7D
0x9A55 0xEA82
0x9A58 0xEA85
0x9A5A 0xEA87
0x9A5C 0xEA89
0x9A60 0xEA8D
0x9A63 0xEA90
0x9A6E 0xEA9B
0x9A70 0xEA9D
0x9A79 0xEAA6
0x9A7B 0xEAA8
0x9ABD 0xEAC8
0x9AEC 0xEAF7
0x9B4D 0xEB17
0x9BA9 0xEB51
0x9BAA 0xEB52
0x9BB8 0xEB60
0x9BBE 0xEB66
0x9BC2 0xEB6A
0x9BDF 0xEB87
0x9BE3 0xEB8B
0x9BEA 0xEB92
0x9BEE 0xEB96
0x9C4A 0xEBB1
0x9C5C 0xEBC3
0x9C6F 0xEBD6
0x9C79 0xEBE0
0x9CA1 0xEBE6
0x9CA5 0xEBEA
0x9CBA 0xEBFF
0x9CBB 0xEC00
0x9CBE 0xEC03
0x9CC6 0xEC0B
0x9CC8 0xEC0D
0x9CD1 0xEC16
0x9CF8 0xEC3D
0x9D46 0xEC4A
0x9D49 0xEC4D
0x9D4F 0xEC53
0x9D51 0xEC55
0x9D5D 0xEC61
0x9D73 0xEC77
0x9D78 0xEC7C
0x9D7B 0xEC7F
0x9DA5 0xEC87
0x9DAA 0xEC8C
0x9DAD 0xEC8F
0x9DB5 0xEC97
0x9DCC 0xECAE
0x9DCE 0xECB0
0x9DEE 0xECD0
0x9DF3 0xECD5
0x9E53 0xECF4
0x9E64 0xED05
0x9E7A 0xED1B
0x9E7E 0xED1F
0x9EA4 0xED23
0x9EB4 0xED33
0x9EB8 0xED37
0x9EB9 0xED38
0x9EBB 0xED3A
0x9EC5 0xED44
0x9EC9 0xED48
0x9ECD 0xED4C
0x9EDA 0xED59
0x9EDD 0xED5C
0x9EDE 0xED5D
0x9EDF 0xED5E
0x9EE5 0xED64
0x9EE7 0xED66
0x9EEE 0xED6D
0x9EF0 0xED6F
0x9EFC 0xED7B
0x9F70 0xEDAE
0x9FA5 0xEDC1
0x9FD7 0xEDF3
0x9FD9 0xEDF5
0xA053 0xEE2E
0xA068 0xEE43
0xA06A 0xEE45
0xA06F 0xEE4A
0xA078 0xEE53
0xA07E 0xEE59
0xA0AC 0xEE65
0xA0D0 0xEE89
0xA0DA 0xEE93
0xA0DE 0xEE97
0xA0E6 0xEE9F
0xA0F9 0xEEB2
0x89B7 0xF3F5
0x89BA 0xF3F8
0x89BF 0xF3FD
0x89C5 0xF403
0x89D5 0xF413
0x89D7 0xF415
0x89DA 0xF418
0x89DB 0xF419
0x89DC 0xF41A
0x89E6 0xF424
0x89E8 0xF426
0x89EA 0xF428
0x89ED 0xF42B
0x89EE 0xF42C
0x89EF 0xF42D
0x89F9 0xF437
0x89FB 0xF439
0x89FC 0xF43A
0x89FE 0xF43C
0x8A48 0xF445
0x8A4D 0xF44A
0x8A51 0xF44E
0x8A52 0xF44F
0x8A67 0xF464
0x8A6B 0xF468
0x8A6D 0xF46A
0x8A6E 0xF46B
0x8A76 0xF473
0x8A7D 0xF47A
0x8AAC 0xF487
0x8AAE 0xF489
0x8AB8 0xF493
0x8AB9 0xF494
0x8ABB 0xF496
0x8AC2 0xF49D
0x8AC7 0xF4A2
0x8AD0 0xF4AB
0x8AD1 0xF4AC
0x8AD3 0xF4AE
0x8ADA 0xF4B5
0x8AEB 0xF4C6
0x8AF0 0xF4CB
0x8AFB 0xF4D6
0x8B47 0xF4E1
0x8B60 0xF4FA
0x8B68 0xF502
0x8B6A 0xF504
0x8BA6 0xF51E
0x8BB1 0xF529
0x8BB5 0xF52D
0x8BB6 0xF52E
0x8BB8 0xF530
0x8BBE 0xF536
0x8BC8 0xF540
0x8BCC 0xF544
0x8BDC 0xF554
0x8D63 0xF637
0x8D64 0xF638
0x8D67 0xF63B
0x8D68 0xF63C
0x8D6D 0xF641
0x8D6E 0xF642
0x8D6F 0xF643
0x8D70 0xF644
0x8D74 0xF648
0x8D78 0xF64C
0x8D7D 0xF651
0x8DA1 0xF653
0x8DA6 0xF658
0x8DAB 0xF65D
0x8DAD 0xF65F
0x8DB0 0xF662
0x8DB2 0xF664
0x8DB4 0xF666
0x8DB7 0xF669
0x8DBA 0xF66C
0x8DBB 0xF66D
0x8DBC 0xF66E
0x8DC3 0xF675
0x8DC5 0xF677
0x8DCA 0xF67C
0x8DCC 0xF67E
0x8DD6 0xF688
0x8DDB 0xF68D
0x8DEB 0xF69D
0x8DEF 0xF6A1
0x8DF0 0xF6A2
0x8DF3 0xF6A5
0x8DF5 0xF6A7
0x8DFC 0xF6AE
0x8DFD 0xF6AF
0xC6CD 0xF6DD
0xC8D6 0xF820
0xC8D7 0xF821
0xC8D8 0xF822
0xC8D9 0xF823
0xC8DA 0xF824
0xC8DB 0xF825
0xC8DC 0xF826
0xC8DD 0xF827
0xC8DE 0xF828
0xC8DF 0xF829
0xC8E0 0xF82A
0xC8E1 0xF82B
0xC8E2 0xF82C
0xC8E3 0xF82D
0xC8E4 0xF82E
0xC8E5 0xF82F
0xC8E6 0xF830
0xC8E7 0xF831
0xC8E8 0xF832
0xC8E9 0xF833
0xC8EA 0xF834
0xC8EB 0xF835
0xC8EC 0xF836
0xC8ED 0xF837
0xC8EE 0xF838
0xC8EF 0xF839
0xC8F0 0xF83A
0xC8F1 0xF83B

File diff suppressed because it is too large Load Diff

@ -1,6 +1,7 @@
#
#clzName csName hisName dbtype pkg ascii b1min b1max b2min b2max
#
Big5 Big5 Big5 basic sun.nio.cs.ext true 0xa1 0xf9 0x40 0xfe
Johab x-Johab x-Johab basic sun.nio.cs.ext true 0x84 0xf9 0x31 0xfe
EUC_CN GB2312 EUC_CN basic sun.nio.cs.ext true 0xa1 0xf7 0xa1 0xfe
EUC_KR EUC-KR EUC_KR basic sun.nio.cs.ext true 0xa1 0xfd 0xa1 0xfe

@ -1,5 +1,5 @@
/*
* Copyright 2009 Sun Microsystems, Inc. All Rights Reserved.
* Copyright 2010 Sun Microsystems, Inc. All Rights Reserved.
* 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,12 +31,13 @@ import java.util.Scanner;
import java.util.Formatter;
import java.util.regex.*;
import java.nio.charset.*;
import static build.tools.charsetmapping.CharsetMapping.*;
import static build.tools.charsetmapping.Utils.*;
public class GenerateDBCS {
public class DBCS {
// pattern used by this class to read in mapping table
static Pattern mPattern = Pattern.compile("(?:0x)?(\\p{XDigit}++)\\s++(?:0x)?(\\p{XDigit}++)(?:\\s++#.*)?");
public static void genDBCS(String args[]) throws Exception {
public static void genClass(String args[]) throws Exception {
Scanner s = new Scanner(new File(args[0], args[2]));
while (s.hasNextLine()) {
@ -63,81 +64,29 @@ public class GenerateDBCS {
int b2Min = toInteger(fields[8]);
int b2Max = toInteger(fields[9]);
System.out.printf("%s,%s,%s,%b,%s%n", clzName, csName, hisName, isASCII, pkgName);
genClass(args[0], args[1], "DoubleByte-X.java.template",
genClass0(args[0], args[1], "DoubleByte-X.java.template",
clzName, csName, hisName, pkgName,
isASCII, type,
b1Min, b1Max, b2Min, b2Max);
}
}
private static int toInteger(String s) {
static int toInteger(String s) {
if (s.startsWith("0x") || s.startsWith("0X"))
return Integer.valueOf(s.substring(2), 16);
else
return Integer.valueOf(s);
}
private static void outString(Formatter out,
char[] cc, int off, int end,
String closure)
{
while (off < end) {
out.format(" \"");
for (int j = 0; j < 8; j++) {
if (off == end)
break;
char c = cc[off++];
switch (c) {
case '\b':
out.format("\\b"); break;
case '\t':
out.format("\\t"); break;
case '\n':
out.format("\\n"); break;
case '\f':
out.format("\\f"); break;
case '\r':
out.format("\\r"); break;
case '\"':
out.format("\\\""); break;
case '\'':
out.format("\\'"); break;
case '\\':
out.format("\\\\"); break;
default:
out.format("\\u%04X", c & 0xffff);
}
}
if (off == end)
out.format("\" %s%n", closure);
else
out.format("\" + %n");
}
}
private static void outString(Formatter out,
char[] db,
int b1,
int b2Min, int b2Max,
String closure)
{
char[] cc = new char[b2Max - b2Min + 1];
int off = 0;
for (int b2 = b2Min; b2 <= b2Max; b2++) {
cc[off++] = db[(b1 << 8) | b2];
}
outString(out, cc, 0, cc.length, closure);
}
private static void genClass(String srcDir, String dstDir, String template,
String clzName,
String csName,
String hisName,
String pkgName,
boolean isASCII,
String type,
int b1Min, int b1Max,
int b2Min, int b2Max)
private static void genClass0(String srcDir, String dstDir, String template,
String clzName,
String csName,
String hisName,
String pkgName,
boolean isASCII,
String type,
int b1Min, int b1Max,
int b2Min, int b2Max)
throws Exception
{
@ -172,21 +121,21 @@ public class GenerateDBCS {
c2bIndex[e.cp>>8] = 1;
}
}
Formatter fm = new Formatter(b2cSB);
fm.format("%n static final String b2cSBStr =%n");
outString(fm, db, 0x00, 0x100, ";");
Output out = new Output(new Formatter(b2cSB));
out.format("%n static final String b2cSBStr =%n");
out.format(db, 0x00, 0x100, ";");
fm.format("%n static final String[] b2cStr = {%n");
out.format("%n static final String[] b2cStr = {%n");
for (int i = 0; i < 0x100; i++) {
if (b2cIndex[i] == UNMAPPABLE_DECODING) {
fm.format(" null,%n"); //unmappable segments
out.format(" null,%n"); //unmappable segments
} else {
outString(fm, db, i, b2Min, b2Max, ",");
out.format(db, i, b2Min, b2Max, ",");
}
}
fm.format(" };%n");
fm.close();
out.format(" };%n");
out.close();
// (2)now parse the .nr file which includes "b->c" non-roundtrip entries
File f = new File(srcDir, clzName + ".nr");
@ -201,10 +150,10 @@ public class GenerateDBCS {
sb.append((char)e.cp);
}
char[] nr = sb.toString().toCharArray();
fm = new Formatter(b2cNRSB);
fm.format("String b2cNR =%n");
outString(fm, nr, 0, nr.length, ";");
fm.close();
out = new Output(new Formatter(b2cNRSB));
out.format("String b2cNR =%n");
out.format(nr, 0, nr.length, ";");
out.close();
} else {
b2cNRSB.append("String b2cNR = null;");
}
@ -226,10 +175,10 @@ public class GenerateDBCS {
sb.append((char)e.cp);
}
char[] nr = sb.toString().toCharArray();
fm = new Formatter(c2bNRSB);
fm.format("String c2bNR =%n");
outString(fm, nr, 0, nr.length, ";");
fm.close();
out = new Output(new Formatter(c2bNRSB));
out.format("String c2bNR =%n");
out.format(nr, 0, nr.length, ";");
out.close();
} else {
c2bNRSB.append("String c2bNR = null;");
}
@ -240,15 +189,15 @@ public class GenerateDBCS {
String c2bNR = c2bNRSB.toString();
Scanner s = new Scanner(new File(srcDir, template));
PrintStream out = new PrintStream(new FileOutputStream(
new File(dstDir, clzName + ".java")));
PrintStream ops = new PrintStream(new FileOutputStream(
new File(dstDir, clzName + ".java")));
if (hisName == null)
hisName = "";
while (s.hasNextLine()) {
String line = s.nextLine();
if (line.indexOf("$") == -1) {
out.println(line);
ops.println(line);
continue;
}
line = line.replace("$PACKAGE$" , pkgName)
@ -280,8 +229,8 @@ public class GenerateDBCS {
.replace("$NONROUNDTRIP_B2C$", b2cNR)
.replace("$NONROUNDTRIP_C2B$", c2bNR);
out.println(line);
ops.println(line);
}
out.close();
ops.close();
}
}

@ -0,0 +1,177 @@
/*
* Copyright 2010 Sun Microsystems, Inc. All Rights Reserved.
* 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. Sun designates this
* particular file as subject to the "Classpath" exception as provided
* by Sun 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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
* CA 95054 USA or visit www.sun.com if you need additional information or
* have any questions.
*/
package build.tools.charsetmapping;
import java.io.*;
import java.util.ArrayList;
import java.util.Scanner;
import java.util.Formatter;
import java.util.regex.*;
import java.nio.charset.*;
import static build.tools.charsetmapping.Utils.*;
public class EUC_TW {
static char[] toCharArray(int[] db,
int b1Min, int b1Max,
int b2Min, int b2Max)
{
char[] ca = new char[(b1Max - b1Min + 1) * (b2Max - b2Min + 1)];
int off = 0;
for (int b1 = b1Min; b1 <= b1Max; b1++) {
for (int b2 = b2Min; b2 <= b2Max; b2++) {
ca[off++] = (char)(db[b1 * 256 + b2] & 0xffff);
}
}
return ca;
}
static char[] toCharArray(byte[] ba,
int b1Min, int b1Max,
int b2Min, int b2Max)
{
char[] ca = new char[(b1Max - b1Min + 1) * (b2Max - b2Min + 1)];
int off = 0;
for (int b1 = b1Min; b1 <= b1Max; b1++) {
int b2 = b2Min;
while (b2 <= b2Max) {
ca[off++] = (char)(((ba[b1 * 256 + b2++] & 0xff) << 8) |
(ba[b1 * 256 + b2++] & 0xff));
}
}
return ca;
}
private static int initC2BIndex(char[] index) {
int off = 0;
for (int i = 0; i < index.length; i++) {
if (index[i] != 0) {
index[i] = (char)off;
off += 0x100;
} else {
index[i] = UNMAPPABLE_ENCODING;
}
}
return off;
}
private static Pattern euctw = Pattern.compile("(?:8ea)?(\\p{XDigit}++)\\s++(\\p{XDigit}++)?\\s*+.*");
static void genClass(String args[]) throws Exception
{
InputStream is = new FileInputStream(new File(args[0], "euc_tw.map"));
PrintStream ps = new PrintStream(new File(args[1], "EUC_TWMapping.java"),
"ISO-8859-1");
String copyright = getCopyright(new File(args[3]));
// ranges of byte1 and byte2, something should come from a "config" file
int b1Min = 0xa1;
int b1Max = 0xfe;
int b2Min = 0xa1;
int b2Max = 0xfe;
try {
int[][] db = new int[8][0x10000]; // doublebyte
byte[] suppFlag = new byte[0x10000]; // doublebyte
char[] indexC2B = new char[256];
char[] indexC2BSupp = new char[256];
for (int i = 0; i < 8; i++)
for (int j = 0; j < 0x10000; j++)
db[i][j] = UNMAPPABLE_DECODING;
Parser p = new Parser(is, euctw);
Entry e = null;
while ((e = p.next()) != null) {
int plane = 0;
if (e.bs >= 0x10000) {
plane = ((e.bs >> 16) & 0xff) - 1;
if (plane >= 14)
plane = 7;
e.bs = e.bs & 0xffff;
}
db[plane][e.bs] = e.cp;
if (e.cp < 0x10000) {
indexC2B[e.cp>>8] = 1;
} else {
indexC2BSupp[(e.cp&0xffff)>>8] = 1;
suppFlag[e.bs] |= (1 << plane);
}
}
StringBuilder sb = new StringBuilder();
Output out = new Output(new Formatter(sb));
out.format(copyright);
out.format("%n// -- This file was mechanically generated: Do not edit! -- //%n");
out.format("package sun.nio.cs.ext;%n%n");
out.format("class EUC_TWMapping {%n%n");
// boundaries
out.format(" final static int b1Min = 0x%x;%n", b1Min);
out.format(" final static int b1Max = 0x%x;%n", b1Max);
out.format(" final static int b2Min = 0x%x;%n", b2Min);
out.format(" final static int b2Max = 0x%x;%n", b2Max);
// b2c tables
out.format("%n final static String[] b2c = {%n");
for (int plane = 0; plane < 8; plane++) {
out.format(" // Plane %d%n", plane);
out.format(toCharArray(db[plane], b1Min, b1Max, b2Min, b2Max),
",");
out.format("%n");
}
out.format(" };%n");
// c2bIndex
out.format("%n static final int C2BSIZE = 0x%x;%n",
initC2BIndex(indexC2B));
out.format("%n static char[] c2bIndex = new char[] {%n");
out.format(indexC2B);
out.format(" };%n");
// c2bIndexSupp
out.format("%n static final int C2BSUPPSIZE = 0x%x;%n",
initC2BIndex(indexC2BSupp));
out.format("%n static char[] c2bSuppIndex = new char[] {%n");
out.format(indexC2BSupp);
out.format(" };%n");
// suppFlags
out.format("%n static String b2cIsSuppStr =%n");
out.format(toCharArray(suppFlag, b1Min, b1Max, b2Min, b2Max),
";");
out.format("}");
out.close();
ps.println(sb.toString());
ps.close();
} catch (Exception x) {
x.printStackTrace();
}
}
}

@ -1,246 +0,0 @@
/*
* Copyright 2009 Sun Microsystems, Inc. All Rights Reserved.
* 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. Sun designates this
* particular file as subject to the "Classpath" exception as provided
* by Sun 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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
* CA 95054 USA or visit www.sun.com if you need additional information or
* have any questions.
*/
package build.tools.charsetmapping;
import java.io.*;
import java.util.ArrayList;
import java.util.Scanner;
import java.util.Formatter;
import java.util.regex.*;
import java.nio.charset.*;
import static build.tools.charsetmapping.CharsetMapping.*;
public class GenerateEUC_TW {
public static void genEUC_TW(String args[]) throws Exception {
genClass(new FileInputStream(new File(args[0], "euc_tw.map")),
new PrintStream(new File(args[1], "EUC_TWMapping.java"), "ISO-8859-1"),
getCopyright(new File(args[3])));
}
private static String getCopyright(File f) throws IOException {
Scanner s = new Scanner(f, "ISO-8859-1");
StringBuilder sb = new StringBuilder();
while (s.hasNextLine()) {
String ln = s.nextLine();
sb.append(ln + "\n");
// assume we have the copyright as the first comment
if (ln.matches("^\\s\\*\\/$"))
break;
}
s.close();
return sb.toString();
}
private static char[] toCharArray(int[] db,
int b1Min, int b1Max,
int b2Min, int b2Max)
{
char[] ca = new char[(b1Max - b1Min + 1) * (b2Max - b2Min + 1)];
int off = 0;
for (int b1 = b1Min; b1 <= b1Max; b1++) {
for (int b2 = b2Min; b2 <= b2Max; b2++) {
ca[off++] = (char)(db[b1 * 256 + b2] & 0xffff);
}
}
return ca;
}
private static void toChar(Formatter out, String fmt, char c) {
switch (c) {
case '\b':
out.format("\\b"); break;
case '\t':
out.format("\\t"); break;
case '\n':
out.format("\\n"); break;
case '\f':
out.format("\\f"); break;
case '\r':
out.format("\\r"); break;
case '\"':
out.format("\\\""); break;
case '\'':
out.format("\\'"); break;
case '\\':
out.format("\\\\"); break;
default:
out.format(fmt, c & 0xffff);
}
}
private static void toString(Formatter out, char[] date, String endStr)
{
int off = 0;
int end = date.length;
while (off < end) {
out.format(" \"");
for (int j = 0; j < 8 && off < end; j++) {
toChar(out, "\\u%04X", date[off++]);
}
if (off == end)
out.format("\"%s%n", endStr);
else
out.format("\" +%n");
}
}
private static char[] toCharArray(byte[] ba,
int b1Min, int b1Max,
int b2Min, int b2Max)
{
char[] ca = new char[(b1Max - b1Min + 1) * (b2Max - b2Min + 1)];
int off = 0;
for (int b1 = b1Min; b1 <= b1Max; b1++) {
int b2 = b2Min;
while (b2 <= b2Max) {
ca[off++] = (char)(((ba[b1 * 256 + b2++] & 0xff) << 8) |
(ba[b1 * 256 + b2++] & 0xff));
}
}
return ca;
}
private static void toCharArray(Formatter out, char[] date) {
int off = 0;
int end = date.length;
while (off < end) {
out.format(" ");
for (int j = 0; j < 8 && off < end; j++) {
toChar(out, "'\\u%04X',", date[off++]);
}
out.format("%n");
}
}
private static int initC2BIndex(char[] index) {
int off = 0;
for (int i = 0; i < index.length; i++) {
if (index[i] != 0) {
index[i] = (char)off;
off += 0x100;
} else {
index[i] = CharsetMapping.UNMAPPABLE_ENCODING;
}
}
return off;
}
private static Pattern euctw = Pattern.compile("(?:8ea)?(\\p{XDigit}++)\\s++(\\p{XDigit}++)?\\s*+.*");
private static void genClass(InputStream is, PrintStream ps, String copyright)
throws Exception
{
// ranges of byte1 and byte2, something should come from a "config" file
int b1Min = 0xa1;
int b1Max = 0xfe;
int b2Min = 0xa1;
int b2Max = 0xfe;
try {
int[][] db = new int[8][0x10000]; // doublebyte
byte[] suppFlag = new byte[0x10000]; // doublebyte
char[] indexC2B = new char[256];
char[] indexC2BSupp = new char[256];
for (int i = 0; i < 8; i++)
for (int j = 0; j < 0x10000; j++)
db[i][j] = CharsetMapping.UNMAPPABLE_DECODING;
CharsetMapping.Parser p = new CharsetMapping.Parser(is, euctw);
CharsetMapping.Entry e = null;
while ((e = p.next()) != null) {
int plane = 0;
if (e.bs >= 0x10000) {
plane = ((e.bs >> 16) & 0xff) - 1;
if (plane >= 14)
plane = 7;
e.bs = e.bs & 0xffff;
}
db[plane][e.bs] = e.cp;
if (e.cp < 0x10000) {
indexC2B[e.cp>>8] = 1;
} else {
indexC2BSupp[(e.cp&0xffff)>>8] = 1;
suppFlag[e.bs] |= (1 << plane);
}
}
StringBuilder out = new StringBuilder();
Formatter fm = new Formatter(out);
fm.format(copyright);
fm.format("%n// -- This file was mechanically generated: Do not edit! -- //%n");
fm.format("package sun.nio.cs.ext;%n%n");
fm.format("class EUC_TWMapping {%n%n");
// boundaries
fm.format(" final static int b1Min = 0x%x;%n", b1Min);
fm.format(" final static int b1Max = 0x%x;%n", b1Max);
fm.format(" final static int b2Min = 0x%x;%n", b2Min);
fm.format(" final static int b2Max = 0x%x;%n", b2Max);
// b2c tables
fm.format("%n final static String[] b2c = {%n");
for (int plane = 0; plane < 8; plane++) {
fm.format(" // Plane %d%n", plane);
toString(fm, toCharArray(db[plane],
b1Min, b1Max, b2Min, b2Max),
",");
fm.format("%n");
}
fm.format(" };%n");
// c2bIndex
fm.format("%n static final int C2BSIZE = 0x%x;%n",
initC2BIndex(indexC2B));
fm.format("%n static char[] c2bIndex = new char[] {%n");
toCharArray(fm, indexC2B);
fm.format(" };%n");
// c2bIndexSupp
fm.format("%n static final int C2BSUPPSIZE = 0x%x;%n",
initC2BIndex(indexC2BSupp));
fm.format("%n static char[] c2bSuppIndex = new char[] {%n");
toCharArray(fm, indexC2BSupp);
fm.format(" };%n");
// suppFlags
fm.format("%n static String b2cIsSuppStr =%n");
toString(fm, toCharArray(suppFlag,
b1Min, b1Max, b2Min, b2Max),
";");
fm.format("}");
fm.close();
ps.println(out.toString());
ps.close();
} catch (Exception x) {
x.printStackTrace();
}
}
}

@ -1,95 +0,0 @@
/*
* Copyright 2008 Sun Microsystems, Inc. All Rights Reserved.
* 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. Sun designates this
* particular file as subject to the "Classpath" exception as provided
* by Sun 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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
* CA 95054 USA or visit www.sun.com if you need additional information or
* have any questions.
*/
package build.tools.charsetmapping;
import java.io.*;
import java.util.regex.*;
import static build.tools.charsetmapping.CharsetMapping.*;
public class GenerateMapping {
public static void genMapping(String argv[]) throws IOException {
genDataJIS0213(new FileInputStream(argv[0]),
new FileOutputStream(argv[1]));
}
// regex pattern to parse the "jis0213.map" file
static Pattern sjis0213 = Pattern.compile("0x(\\p{XDigit}++)\\s++U\\+(\\p{XDigit}++)(?:\\+(\\p{XDigit}++))?\\s++#.*");
private static void genDataJIS0213(InputStream in, OutputStream out)
{
int[] sb = new int[0x100]; // singlebyte
int[] db = new int[0x10000]; // doublebyte
int[] indexC2B = new int[256];
Entry[] supp = new Entry[0x10000];
Entry[] comp = new Entry[0x100];
int suppTotal = 0;
int compTotal = 0;
int b1Min1 = 0x81;
int b1Max1 = 0x9f;
int b1Min2 = 0xe0;
int b1Max2 = 0xfc;
int b2Min = 0x40;
int b2Max = 0xfe;
//init
for (int i = 0; i < 0x80; i++) sb[i] = i;
for (int i = 0x80; i < 0x100; i++) sb[i] = UNMAPPABLE_DECODING;
for (int i = 0; i < 0x10000; i++) db[i] = UNMAPPABLE_DECODING;
try {
Parser p = new Parser(in, sjis0213);
Entry e = null;
while ((e = p.next()) != null) {
if (e.cp2 != 0) {
comp[compTotal++] = e;
} else {
if (e.cp <= 0xffff) {
if (e.bs <= 0xff)
sb[e.bs] = e.cp;
else
db[e.bs] = e.cp;
indexC2B[e.cp>>8] = 1;
} else {
supp[suppTotal++] = e;
}
}
}
ByteArrayOutputStream baos = new ByteArrayOutputStream();
// c2b Index Table, always the first one
writeINDEXC2B(baos, indexC2B);
writeSINGLEBYTE(baos, sb);
writeDOUBLEBYTE1(baos, db, b1Min1, b1Max1, b2Min, b2Max);
writeDOUBLEBYTE2(baos, db, b1Min2, b1Max2, b2Min, b2Max);
writeSUPPLEMENT(baos, supp, suppTotal);
writeCOMPOSITE(baos, comp, compTotal);
writeSIZE(out, baos.size());
baos.writeTo(out);
out.close();
} catch (Exception x) {
x.printStackTrace();
}
}
}

@ -0,0 +1,190 @@
/*
* Copyright 2010 Sun Microsystems, Inc. All Rights Reserved.
* 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. Sun designates this
* particular file as subject to the "Classpath" exception as provided
* by Sun 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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
* CA 95054 USA or visit www.sun.com if you need additional information or
* have any questions.
*/
package build.tools.charsetmapping;
import java.io.*;
import java.util.Arrays;
import java.util.ArrayList;
import java.util.Scanner;
import java.util.Formatter;
import java.util.regex.*;
import java.nio.charset.*;
import static build.tools.charsetmapping.Utils.*;
public class HKSCS {
// HKSCS2001.map has the third column for "UnicodeAlternate", which
// is for c->b non-roundtrip mapping.
// For HKSCS2008, those non-roundtrip mappings are in .nr file
private static Pattern hkscs =
Pattern.compile("(?:0x)?+(\\p{XDigit}++)\\s++(?:0x|U\\+)?+(\\p{XDigit}++)?\\s*+(?:0x|U\\+)?(\\p{XDigit}++)?\\s*+.*");
static void genClass(String args[]) throws Exception {
// hkscs2008
genClass0(new FileInputStream(new File(args[0], "HKSCS2008.map")),
new FileInputStream(new File(args[0], "HKSCS2008.c2b")),
new PrintStream(new File(args[1], "HKSCSMapping.java"),
"ISO-8859-1"),
"HKSCSMapping",
getCopyright(new File(args[3])));
// xp2001
genClass0(new FileInputStream(new File(args[0], "HKSCS_XP.map")),
null,
new PrintStream(new File(args[1], "HKSCS_XPMapping.java"),
"ISO-8859-1"),
"HKSCS_XPMapping",
getCopyright(new File(args[3])));
// hkscs2001
genClass0(new FileInputStream(new File(args[0], "HKSCS2001.map")),
new FileInputStream(new File(args[0], "HKSCS2001.c2b")),
new PrintStream(new File(args[1], "HKSCS2001Mapping.java"),
"ISO-8859-1"),
"HKSCS2001Mapping",
getCopyright(new File(args[3])));
}
static void genClass0(InputStream isB2C,
InputStream isC2B,
PrintStream ps,
String clzName,
String copyright)
throws Exception
{
// ranges of byte1 and byte2, something should come from a "config" file
int b1Min = 0x87;
int b1Max = 0xfe;
int b2Min = 0x40;
int b2Max = 0xfe;
try {
char[] bmp = new char[0x10000];
char[] supp = new char[0x10000];
boolean[] b2cBmp = new boolean[0x100];
boolean[] b2cSupp = new boolean[0x100];
// pua should be in range of e000-f8ff. Expand
// it to 0xf93b becase the hkscs2001.c2b has
// the f920-f93b filled
//char[] pua = new char[0xF8FF - 0xE000 + 1];
char[] pua = new char[0xF93b - 0xE000 + 1];
boolean hasSupp = false;
boolean hasPua = false;
Arrays.fill(bmp, UNMAPPABLE_DECODING);
Arrays.fill(supp, UNMAPPABLE_DECODING);
Arrays.fill(pua, UNMAPPABLE_DECODING);
Parser p = new Parser(isB2C, hkscs);
Entry e = null;
while ((e = p.next()) != null) {
if (e.cp >= 0x10000) {
supp[e.bs] = (char)e.cp;
b2cSupp[e.bs>>8] = true;
hasSupp = true;
} else {
bmp[e.bs] = (char)e.cp;
b2cBmp[e.bs>>8] = true;
}
if (e.cp2 != 0 && e.cp2 >= 0xe000 && e.cp2 <= 0xf8ff) {
hasPua = true;
pua[e.cp2 - 0xE000] = (char)e.bs;
}
}
if (isC2B != null) {
p = new Parser(isC2B, hkscs);
e = null;
while ((e = p.next()) != null) {
pua[e.cp - 0xE000] = (char)e.bs;
}
hasPua = true;
}
StringBuilder sb = new StringBuilder();
Output out = new Output(new Formatter(sb));
out.format(copyright);
out.format("%n// -- This file was mechanically generated: Do not edit! -- //%n");
out.format("package sun.nio.cs.ext;%n%n");
out.format("class %s {%n%n", clzName);
/* hardcoded in sun.nio.cs.ext.HKSCS.java
out.format(" final static int b1Min = 0x%x;%n", b1Min);
out.format(" final static int b1Max = 0x%x;%n", b1Max);
out.format(" final static int b2Min = 0x%x;%n", b2Min);
out.format(" final static int b2Max = 0x%x;%n", b2Max);
*/
// bmp tables
out.format("%n static final String[] b2cBmpStr = new String[] {%n");
for (int i = 0; i < 0x100; i++) {
if (b2cBmp[i])
out.format(bmp, i, b2Min, b2Max, ",");
else
out.format(" null,%n"); //unmappable segments
}
out.format(" };%n");
// supp tables
out.format("%n static final String[] b2cSuppStr =");
if (hasSupp) {
out.format(" new String[] {%n");
for (int i = 0; i < 0x100; i++) {
if (b2cSupp[i])
out.format(supp, i, b2Min, b2Max, ",");
else
out.format(" null,%n"); //unmappable segments
}
out.format(" };%n");
} else {
out.format(" null;%n");
}
// private area tables
out.format("%n final static String pua =");
if (hasPua) {
out.format("%n");
out.format(pua, 0, pua.length, ";");
} else {
out.format(" null;%n");
}
out.format("%n");
out.format("}");
out.close();
ps.println(sb.toString());
ps.close();
} catch (Exception x) {
x.printStackTrace();
}
}
}

@ -25,29 +25,71 @@
package build.tools.charsetmapping;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.io.BufferedReader;
import java.io.IOException;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import java.io.*;
import java.util.regex.*;
import java.util.*;
import static build.tools.charsetmapping.Utils.*;
public class CharsetMapping {
public final static char UNMAPPABLE_DECODING = '\uFFFD';
public final static int UNMAPPABLE_ENCODING = 0xFFFD;
public class JIS0213 {
public static class Entry {
public int bs; //byte sequence reps
public int cp; //Unicode codepoint
public int cp2; //CC of composite
// regex pattern to parse the "jis0213.map" file
static Pattern sjis0213 = Pattern.compile("0x(\\p{XDigit}++)\\s++U\\+(\\p{XDigit}++)(?:\\+(\\p{XDigit}++))?\\s++#.*");
public Entry () {}
public Entry (int bytes, int cp, int cp2) {
this.bs = bytes;
this.cp = cp;
this.cp2 = cp2;
static void genClass(String argv[]) throws IOException
{
InputStream in = new FileInputStream(argv[0]) ;
OutputStream out = new FileOutputStream(argv[1]);
int[] sb = new int[0x100]; // singlebyte
int[] db = new int[0x10000]; // doublebyte
int[] indexC2B = new int[256];
Entry[] supp = new Entry[0x10000];
Entry[] comp = new Entry[0x100];
int suppTotal = 0;
int compTotal = 0;
int b1Min1 = 0x81;
int b1Max1 = 0x9f;
int b1Min2 = 0xe0;
int b1Max2 = 0xfc;
int b2Min = 0x40;
int b2Max = 0xfe;
//init
for (int i = 0; i < 0x80; i++) sb[i] = i;
for (int i = 0x80; i < 0x100; i++) sb[i] = UNMAPPABLE_DECODING;
for (int i = 0; i < 0x10000; i++) db[i] = UNMAPPABLE_DECODING;
try {
Parser p = new Parser(in, sjis0213);
Entry e = null;
while ((e = p.next()) != null) {
if (e.cp2 != 0) {
comp[compTotal++] = e;
} else {
if (e.cp <= 0xffff) {
if (e.bs <= 0xff)
sb[e.bs] = e.cp;
else
db[e.bs] = e.cp;
indexC2B[e.cp>>8] = 1;
} else {
supp[suppTotal++] = e;
}
}
}
ByteArrayOutputStream baos = new ByteArrayOutputStream();
// c2b Index Table, always the first one
writeINDEXC2B(baos, indexC2B);
writeSINGLEBYTE(baos, sb);
writeDOUBLEBYTE1(baos, db, b1Min1, b1Max1, b2Min, b2Max);
writeDOUBLEBYTE2(baos, db, b1Min2, b1Max2, b2Min, b2Max);
writeSUPPLEMENT(baos, supp, suppTotal);
writeCOMPOSITE(baos, comp, compTotal);
writeSIZE(out, baos.size());
baos.writeTo(out);
out.close();
} catch (Exception x) {
x.printStackTrace();
}
}
@ -61,76 +103,6 @@ public class CharsetMapping {
}
};
public static class Parser {
static final Pattern basic = Pattern.compile("(?:0x)?(\\p{XDigit}++)\\s++(?:0x)?(\\p{XDigit}++)?\\s*+.*");
static final int gBS = 1;
static final int gCP = 2;
static final int gCP2 = 3;
BufferedReader reader;
boolean closed;
Matcher matcher;
int gbs, gcp, gcp2;
public Parser (InputStream in, Pattern p, int gbs, int gcp, int gcp2)
throws IOException
{
this.reader = new BufferedReader(new InputStreamReader(in));
this.closed = false;
this.matcher = p.matcher("");
this.gbs = gbs;
this.gcp = gcp;
this.gcp2 = gcp2;
}
public Parser (InputStream in, Pattern p) throws IOException {
this(in, p, gBS, gCP, gCP2);
}
public Parser (InputStream in) throws IOException {
this(in, basic, gBS, gCP, gCP2);
}
protected boolean isDirective(String line) {
return line.startsWith("#");
}
protected Entry parse(Matcher matcher, Entry mapping) {
mapping.bs = Integer.parseInt(matcher.group(gbs), 16);
mapping.cp = Integer.parseInt(matcher.group(gcp), 16);
if (gcp2 <= matcher.groupCount() &&
matcher.group(gcp2) != null)
mapping.cp2 = Integer.parseInt(matcher.group(gcp2), 16);
else
mapping.cp2 = 0;
return mapping;
}
public Entry next() throws Exception {
return next(new Entry());
}
// returns null and closes the input stream if the eof has beenreached.
public Entry next(Entry mapping) throws Exception {
if (closed)
return null;
String line;
while ((line = reader.readLine()) != null) {
if (isDirective(line))
continue;
matcher.reset(line);
if (!matcher.lookingAt()) {
//System.out.println("Missed: " + line);
continue;
}
return parse(matcher, mapping);
}
reader.close();
closed = true;
return null;
}
}
// tags of different charset mapping tables
private final static int MAP_SINGLEBYTE = 0x1; // 0..256 : c
private final static int MAP_DOUBLEBYTE1 = 0x2; // min..max: c
@ -161,7 +133,7 @@ public class CharsetMapping {
}
}
public static final void writeSIZE(OutputStream out, int data)
private static final void writeSIZE(OutputStream out, int data)
throws IOException
{
out.write((data >>> 24) & 0xFF);
@ -170,7 +142,7 @@ public class CharsetMapping {
out.write((data ) & 0xFF);
}
public static void writeINDEXC2B(OutputStream out, int[] indexC2B)
private static void writeINDEXC2B(OutputStream out, int[] indexC2B)
throws IOException
{
writeShort(out, MAP_INDEXC2B);
@ -186,7 +158,7 @@ public class CharsetMapping {
}
}
public static void writeSINGLEBYTE(OutputStream out, int[] sb)
private static void writeSINGLEBYTE(OutputStream out, int[] sb)
throws IOException
{
writeShortArray(out, MAP_SINGLEBYTE, sb, 0, 256);
@ -212,7 +184,8 @@ public class CharsetMapping {
}
}
}
public static void writeDOUBLEBYTE1(OutputStream out,
private static void writeDOUBLEBYTE1(OutputStream out,
int[] db,
int b1Min, int b1Max,
int b2Min, int b2Max)
@ -221,7 +194,7 @@ public class CharsetMapping {
writeDOUBLEBYTE(out, MAP_DOUBLEBYTE1, db, b1Min, b1Max, b2Min, b2Max);
}
public static void writeDOUBLEBYTE2(OutputStream out,
private static void writeDOUBLEBYTE2(OutputStream out,
int[] db,
int b1Min, int b1Max,
int b2Min, int b2Max)
@ -231,7 +204,7 @@ public class CharsetMapping {
}
// the c2b table is output as well
public static void writeSUPPLEMENT(OutputStream out, Entry[] supp, int size)
private static void writeSUPPLEMENT(OutputStream out, Entry[] supp, int size)
throws IOException
{
writeShort(out, MAP_SUPPLEMENT);
@ -256,7 +229,7 @@ public class CharsetMapping {
}
}
public static void writeCOMPOSITE(OutputStream out, Entry[] comp, int size)
private static void writeCOMPOSITE(OutputStream out, Entry[] comp, int size)
throws IOException
{
writeShort(out, MAP_COMPOSITE);

@ -32,23 +32,19 @@ public class Main {
public static void main(String args[]) throws Exception {
if (args.length < 3 ) {
System.out.println("Usage: java -jar charsetmapping.jar src dst mType...");
System.out.println("Usage: java -jar charsetmapping.jar src dst mType [copyrightSrc]");
System.exit(1);
}
if ("sbcs".equals(args[2]) || "extsbcs".equals(args[2])) {
GenerateSBCS.genSBCS(args);
SBCS.genClass(args);
} else if ("dbcs".equals(args[2])) {
GenerateDBCS.genDBCS(args);
DBCS.genClass(args);
} else if ("euctw".equals(args[2])) {
if (args.length != 4) {
System.out.println("Usage: java -jar charsetmapping.jar srcDir dstDir euctw copyrightSrc");
System.exit(1);
}
GenerateEUC_TW.genEUC_TW(args);
EUC_TW.genClass(args);
} else if ("sjis0213".equals(args[2])) {
GenerateMapping.genMapping(args);
JIS0213.genClass(args);
} else if ("hkscs".equals(args[2])) {
HKSCS.genClass(args);
}
}
}

@ -32,11 +32,11 @@ import java.util.Scanner;
import java.util.Formatter;
import java.util.regex.*;
import java.nio.charset.*;
import static build.tools.charsetmapping.CharsetMapping.*;
import static build.tools.charsetmapping.Utils.*;
public class GenerateSBCS {
public class SBCS {
public static void genSBCS(String args[]) throws Exception {
public static void genClass(String args[]) throws Exception {
Scanner s = new Scanner(new File(args[0], args[2]));
while (s.hasNextLine()) {
@ -55,8 +55,8 @@ public class GenerateSBCS {
String pkgName = fields[4];
System.out.printf("%s,%s,%s,%b,%s%n", clzName, csName, hisName, isASCII, pkgName);
genClass(args[0], args[1], "SingleByte-X.java.template",
clzName, csName, hisName, pkgName, isASCII);
genClass0(args[0], args[1], "SingleByte-X.java.template",
clzName, csName, hisName, pkgName, isASCII);
}
}
@ -108,13 +108,13 @@ public class GenerateSBCS {
static Pattern sbmap = Pattern.compile("0x(\\p{XDigit}++)\\s++U\\+(\\p{XDigit}++)(\\s++#.*)?");
private static void genClass(String srcDir, String dstDir,
String template,
String clzName,
String csName,
String hisName,
String pkgName,
boolean isASCII)
private static void genClass0(String srcDir, String dstDir,
String template,
String clzName,
String csName,
String hisName,
String pkgName,
boolean isASCII)
throws Exception
{
StringBuilder b2cSB = new StringBuilder();

@ -0,0 +1,221 @@
/*
* Copyright 2008 Sun Microsystems, Inc. All Rights Reserved.
* 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. Sun designates this
* particular file as subject to the "Classpath" exception as provided
* by Sun 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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
* CA 95054 USA or visit www.sun.com if you need additional information or
* have any questions.
*/
package build.tools.charsetmapping;
import java.io.File;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.io.BufferedReader;
import java.io.IOException;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import java.util.Scanner;
import java.util.Formatter;
public class Utils {
public final static char UNMAPPABLE_DECODING = '\uFFFD';
public final static int UNMAPPABLE_ENCODING = 0xFFFD;
public static class Entry {
public int bs; //byte sequence reps
public int cp; //Unicode codepoint
public int cp2; //CC of composite
public Entry () {}
public Entry (int bytes, int cp, int cp2) {
this.bs = bytes;
this.cp = cp;
this.cp2 = cp2;
}
}
public static class Parser {
static final Pattern basic = Pattern.compile("(?:0x)?(\\p{XDigit}++)\\s++(?:0x)?(\\p{XDigit}++)?\\s*+.*");
static final int gBS = 1;
static final int gCP = 2;
static final int gCP2 = 3;
BufferedReader reader;
boolean closed;
Matcher matcher;
int gbs, gcp, gcp2;
public Parser (InputStream in, Pattern p, int gbs, int gcp, int gcp2)
throws IOException
{
this.reader = new BufferedReader(new InputStreamReader(in));
this.closed = false;
this.matcher = p.matcher("");
this.gbs = gbs;
this.gcp = gcp;
this.gcp2 = gcp2;
}
public Parser (InputStream in, Pattern p) throws IOException {
this(in, p, gBS, gCP, gCP2);
}
public Parser (InputStream in) throws IOException {
this(in, basic, gBS, gCP, gCP2);
}
protected boolean isDirective(String line) {
return line.startsWith("#");
}
protected Entry parse(Matcher matcher, Entry mapping) {
mapping.bs = Integer.parseInt(matcher.group(gbs), 16);
mapping.cp = Integer.parseInt(matcher.group(gcp), 16);
if (gcp2 <= matcher.groupCount() &&
matcher.group(gcp2) != null)
mapping.cp2 = Integer.parseInt(matcher.group(gcp2), 16);
else
mapping.cp2 = 0;
return mapping;
}
public Entry next() throws Exception {
return next(new Entry());
}
// returns null and closes the input stream if the eof has beenreached.
public Entry next(Entry mapping) throws Exception {
if (closed)
return null;
String line;
while ((line = reader.readLine()) != null) {
if (isDirective(line))
continue;
matcher.reset(line);
if (!matcher.lookingAt()) {
//System.out.println("Missed: " + line);
continue;
}
return parse(matcher, mapping);
}
reader.close();
closed = true;
return null;
}
}
public static class Output {
private Formatter out;
public Output(Formatter out) {
this.out = out;
}
public void close() {
out.close();
}
private void toChar(String fmt, char c) {
switch (c) {
case '\b':
out.format("\\b"); break;
case '\t':
out.format("\\t"); break;
case '\n':
out.format("\\n"); break;
case '\f':
out.format("\\f"); break;
case '\r':
out.format("\\r"); break;
case '\"':
out.format("\\\""); break;
case '\'':
out.format("\\'"); break;
case '\\':
out.format("\\\\"); break;
default:
out.format(fmt, c & 0xffff);
}
}
public void format(String fmt, Object ... args) {
out.format(fmt, args);
}
public void format(char[] cc, int off, int end, String closure) {
while (off < end) {
out.format(" \"");
for (int j = 0; j < 8; j++) {
if (off == end)
break;
toChar("\\u%04X", cc[off++]);
}
if (off == end)
out.format("\" %s%n", closure);
else
out.format("\" + %n");
}
}
public void format(char[] cc, String closure) {
format(cc, 0, cc.length, closure);
}
public void format(char[] db, int b1, int b2Min, int b2Max,
String closure)
{
char[] cc = new char[b2Max - b2Min + 1];
int off = 0;
for (int b2 = b2Min; b2 <= b2Max; b2++) {
cc[off++] = db[(b1 << 8) | b2];
}
format(cc, 0, cc.length, closure);
}
public void format(char[] date) {
int off = 0;
int end = date.length;
while (off < end) {
out.format(" ");
for (int j = 0; j < 8 && off < end; j++) {
toChar("'\\u%04X',", date[off++]);
}
out.format("%n");
}
}
}
public static String getCopyright(File f) throws IOException {
Scanner s = new Scanner(f, "ISO-8859-1");
StringBuilder sb = new StringBuilder();
while (s.hasNextLine()) {
String ln = s.nextLine();
sb.append(ln + "\n");
// assume we have the copyright as the first comment
if (ln.matches("^\\s\\*\\/$"))
break;
}
s.close();
return sb.toString();
}
}

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